ref: e63a4a079eda660f5de81fcf66c0cda453cf1094
parent: 957ca0fed33028a6126ab5bdab60a09027cd0ce7
parent: 09ba7616f3ba9bf367aab25731191b96678ea492
author: Fabien Sanglard <[email protected]>
date: Thu Dec 13 18:12:17 EST 2012
Merge branch 'master' of github.com:fabiensanglard/chocolate_duke3D
--- a/Engine/src/a.c
+++ b/Engine/src/a.c
@@ -17,10 +17,6 @@
extern int32_t asm3;
extern int32_t asm4;
-int32_t is_vmware_running(void)
-{
- return 0;
-} /* is_vmware_running */
/* #pragma aux mmxoverlay modify [eax ebx ecx edx] */
int32_t mmxoverlay(void)
@@ -87,17 +83,17 @@
rmach_ecx = i3;
rmach_edx = i4;
rmach_esi = i5;
-} /* setuprhlineasm4 */
+}
-void rhlineasm4(int32_t i1, int32_t i2, int32_t i3, uint32_t i4, uint32_t i5, int32_t i6)
+void rhlineasm4(int32_t i1, int32_t i2, int32_t i3, uint32_t i4, uint32_t i5, int32_t numPixels)
{
- uint32_t ebp = i6 - i1;
+ uint32_t ebp = numPixels - i1;
uint32_t rmach6b = ebp-1;
if (i1 <= 0) return;
- i6 = i1;
+ numPixels = i1;
do {
i3 = ((i3&0xffffff00)|(*((uint8_t *)i2)));
i4 -= rmach_eax;
@@ -107,10 +103,10 @@
else i2 -= rmach_ecx;
ebp &= rmach_esi;
i1 = ((i1&0xffffff00)|(((uint8_t *)i3)[rmach_edx]));
- ((uint8_t *)rmach6b)[i6] = (i1&0xff);
+ ((uint8_t *)rmach6b)[numPixels] = (i1&0xff);
i2 -= ebp;
- i6--;
- } while (i6);
+ numPixels--;
+ } while (numPixels);
} /* rhlineasm4 */
static int32_t rmmach_eax;
@@ -125,18 +121,18 @@
rmmach_ecx = i3;
rmmach_edx = i4;
rmmach_esi = i5;
-} /* setuprmhlineasm4 */
+}
-/* #pragma aux rmhlineasm4 parm [eax][ebx][ecx][edx][esi][edi] */
+
//FCS: ????
-void rmhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
+void rmhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t numPixels)
{
- uint32_t ebp = i6 - i1;
+ uint32_t ebp = numPixels - i1;
uint32_t rmach6b = ebp-1;
if (i1 <= 0) return;
- i6 = i1;
+ numPixels = i1;
do {
i3 = ((i3&0xffffff00)|(*((uint8_t *)i2)));
i4 -= rmmach_eax;
@@ -147,44 +143,31 @@
ebp &= rmmach_esi;
if ((i3&0xff) != 255) {
i1 = ((i1&0xffffff00)|(((uint8_t *)i3)[rmmach_edx]));
- ((uint8_t *)rmach6b)[i6] = (i1&0xff);
+ ((uint8_t *)rmach6b)[numPixels] = (i1&0xff);
}
i2 -= ebp;
- i6--;
- } while (i6);
-} /* rmhlineasm4 */
+ numPixels--;
+ } while (numPixels);
+}
-/* #pragma aux setupqrhlineasm4 parm [eax][ebx][ecx][edx][esi][edi] */
-void setupqrhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
-{
- setuprhlineasm4(i1,i2,i3,i4,i5,i6);
-} /* setupqrhlineasm4 */
-
-/* #pragma aux qrhlineasm4 parm [eax][ebx][ecx][edx][esi][edi] */
-void qrhlineasm4(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
-{
- rhlineasm4(i1,i2,i3,i4,i5,i6);
-} /* qrhlineasm4 */
-
-/* #pragma aux setvlinebpl parm [eax] */
static int32_t fixchain;
void setvlinebpl(int32_t i1)
{
fixchain = i1;
-} /* setvlinebpl */
+}
-/* #pragma aux fixtransluscence parm [eax] */
+
static int32_t tmach;
void fixtransluscence(int32_t i1)
{
tmach = i1;
-} /* fixtransluscence */
+}
int32_t vlineasm1(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6);
-/* #pragma aux prevlineasm1 parm [eax][ebx][ecx][edx][esi][edi] */
+
static uint8_t mach3_al;
//FCS: RENDER TOP AND BOTTOM COLUMN
@@ -210,14 +193,11 @@
} else {
return vlineasm1(i1,i2,i3,i4,i5,i6);
}
-} /* prevlineasm1 */
+}
-//FCS:Debug
-//extern uint8_t * get_framebuffer(void);
-/* #pragma aux vlineasm1 parm [eax][ebx][ecx][edx][esi][edi] */
//FCS: This is used to draw wall border vertical lines
-int32_t vlineasm1(int32_t vince, int32_t palookupoffse, int32_t i3, int32_t vplce, int32_t bufplce, int32_t i6)
+int32_t vlineasm1(int32_t vince, int32_t palookupoffse, int32_t numPixels, int32_t vplce, int32_t bufplce, int32_t i6)
{
uint32_t temp;
uint8_t *dest = (uint8_t *)i6;
@@ -225,8 +205,8 @@
if (!RENDER_DRAW_WALL_BORDERS)
return vplce;
- i3++;
- while (i3)
+ numPixels++;
+ while (numPixels)
{
temp = ((unsigned)vplce) >> mach3_al;
@@ -235,27 +215,27 @@
*dest = ((uint8_t *)palookupoffse)[temp];
vplce += vince;
dest += fixchain;
- i3--;
+ numPixels--;
}
return vplce;
-} /* vlineasm1 */
+}
-/* #pragma aux setuptvlineasm parm [eax] */
+
static uint8_t transmach3_al = 32;
void setuptvlineasm(int32_t i1)
{
transmach3_al = (i1 & 0x1f);
-} /* setuptvlineasm */
+}
-/* #pragma aux tvlineasm1 parm [eax][ebx][ecx][edx][esi][edi] */
+
static int transrev = 0;
-int32_t tvlineasm1(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
+int32_t tvlineasm1(int32_t i1, int32_t i2, int32_t numPixels, int32_t i4, int32_t i5, int32_t i6)
{
uint8_t *source = (uint8_t *)i5;
uint8_t *dest = (uint8_t *)i6;
- i3++;
- while (i3)
+ numPixels++;
+ while (numPixels)
{
uint32_t temp = i4;
temp >>= transmach3_al;
@@ -270,7 +250,7 @@
}
i4 += i1;
dest += fixchain;
- i3--;
+ numPixels--;
}
return i4;
} /* tvlineasm1 */
@@ -286,7 +266,7 @@
tran2pal_ecx = i3;
} /* */
-/* #pragma aux tvlineasm2 parm [eax][ebx][ecx][edx][esi][edi] */
+
void tvlineasm2(uint32_t i1, uint32_t i2, uint32_t i3, uint32_t i4, uint32_t i5, uint32_t i6)
{
uint32_t ebp = i1;
@@ -340,10 +320,10 @@
} while (i6 > i6 - fixchain);
asm1 = i5;
asm2 = ebp;
-} /* tvlineasm2 */
+}
-/* #pragma aux mvlineasm1 parm [eax][ebx][ecx][edx][esi][edi] */
+
static uint8_t machmv;
int32_t mvlineasm1(int32_t vince, int32_t palookupoffse, int32_t i3, int32_t vplce, int32_t bufplce, int32_t i6)
{
@@ -362,11 +342,11 @@
return vplce;
} /* mvlineasm1 */
-/* #pragma aux setupvlineasm parm [eax] */
+
void setupvlineasm(int32_t i1)
{
mach3_al = (i1&0x1f);
-} /* setupvlineasm */
+}
extern int32_t vplce[4], vince[4], palookupoffse[4], bufplce[4];
@@ -415,12 +395,11 @@
}
#endif
-/* #pragma aux vlineasm4 parm [ecx][edi] modify [eax ebx ecx edx esi edi] */
+
//FCS This is used to fill the inside of a wall
void vlineasm4(int32_t i1, int32_t i2)
{
-
if (!RENDER_DRAW_WALL_INSIDE)
return ;
@@ -447,13 +426,13 @@
}
} /* vlineasm4 */
-/* #pragma aux setupmvlineasm parm [eax] */
+
void setupmvlineasm(int32_t i1)
{
machmv = (i1&0x1f);
} /* setupmvlineasm */
-/* #pragma aux mvlineasm4 parm [ecx][edi] modify [eax ebx ecx edx esi edi] */
+
void mvlineasm4(int32_t i1, int32_t i2)
{
int i;
@@ -474,7 +453,7 @@
} while (((unsigned)dest - fixchain) < ((unsigned)dest));
} /* mvlineasm4 */
-/* #pragma aux setupspritevline parm [eax][ebx][ecx][edx][esi][edi] */
+
static int32_t spal_eax;
static int32_t smach_eax;
static int32_t smach2_eax;
@@ -487,20 +466,22 @@
smach2_eax = (i5>>16)+i2;
smach5_eax = smach2_eax + i4;
smach_ecx = i3;
-} /* setupspritevline */
+}
-/* #pragma aux spritevline parm [eax][ebx][ecx][edx][esi][edi] */
+
void spritevline(int32_t i1, uint32_t i2, int32_t i3, uint32_t i4, int32_t i5, int32_t i6)
{
uint8_t *source = (uint8_t *)i5;
uint8_t *dest = (uint8_t *)i6;
-dumblabel1:
+setup:
+
i2 += smach_eax;
i1 = (i1&0xffffff00) | (*source&0xff);
if ((i2 - smach_eax) > i2) source += smach2_eax + 1;
else source += smach2_eax;
-dumblabel2:
+
+draw:
i1 = (i1&0xffffff00) | (((uint8_t *)spal_eax)[i1]&0xff);
*dest = i1;
dest += fixchain;
@@ -508,16 +489,16 @@
i4 += smach_ecx;
i4--;
if (!((i4 - smach_ecx) > i4) && i4 != 0)
- goto dumblabel1;
+ goto setup;
if (i4 == 0) return;
i2 += smach_eax;
i1 = (i1&0xffffff00) | (*source&0xff);
if ((i2 - smach_eax) > i2) source += smach5_eax + 1;
else source += smach5_eax;
- goto dumblabel2;
+ goto draw;
} /* spritevline */
-/* #pragma aux msetupspritevline parm [eax][ebx][ecx][edx][esi][edi] */
+
static int32_t mspal_eax;
static int32_t msmach_eax;
static int32_t msmach2_eax;
@@ -530,20 +511,21 @@
msmach2_eax = (i5>>16)+i2;
msmach5_eax = smach2_eax + i4;
msmach_ecx = i3;
-} /* msetupspritevline */
+}
-/* #pragma aux mspritevline parm [eax][ebx][ecx][edx][esi][edi] */
+
void mspritevline(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
{
uint8_t *source = (uint8_t *)i5;
uint8_t *dest = (uint8_t *)i6;
-msdumblabel1:
+setup:
i2 += smach_eax;
i1 = (i1&0xffffff00) | (*source&0xff);
if ((i2 - smach_eax) > i2) source += smach2_eax + 1;
else source += smach2_eax;
-msdumblabel2:
+
+ draw:
if ((i1&0xff) != 255)
{
i1 = (i1&0xffffff00) | (((uint8_t *)spal_eax)[i1]&0xff);
@@ -554,16 +536,16 @@
i4 += smach_ecx;
i4--;
if (!((i4 - smach_ecx) > i4) && i4 != 0)
- goto msdumblabel1;
+ goto setup;
if (i4 == 0) return;
i2 += smach_eax;
i1 = (i1&0xffffff00) | (*source&0xff);
if ((i2 - smach_eax) > i2) source += smach5_eax + 1;
else source += smach5_eax;
- goto msdumblabel2;
-} /* mspritevline */
+ goto draw;
+}
-/* #pragma aux tsetupspritevline parm [eax][ebx][ecx][edx][esi][edi] */
+
uint32_t tspal;
uint32_t tsmach_eax1;
uint32_t tsmach_eax2;
@@ -576,15 +558,15 @@
tsmach_eax2 = (i5 >> 16) + i2;
tsmach_eax3 = tsmach_eax2 + i4;
tsmach_ecx = i3;
-} /* tsetupspritevline */
+}
-/* #pragma aux tspritevline parm [eax][ebx][ecx][edx][esi][edi] */
-void tspritevline(int32_t i1, int32_t i2, int32_t i3, uint32_t i4, int32_t i5, int32_t i6)
+
+void tspritevline(int32_t i1, int32_t i2, int32_t numPixels, uint32_t i4, int32_t i5, int32_t i6)
{
- while (i3)
+ while (numPixels)
{
- i3--;
- if (i3 != 0)
+ numPixels--;
+ if (numPixels != 0)
{
uint32_t adder = tsmach_eax2;
i4 += tsmach_ecx;
@@ -606,9 +588,9 @@
i6 += fixchain;
}
}
-} /* tspritevline */
+}
-/* #pragma aux mhline parm [eax][ebx][ecx][edx][esi][edi] */
+
static int32_t mmach_eax;
static int32_t mmach_asm3;
static int32_t mmach_asm1;
@@ -621,9 +603,9 @@
mmach_asm1 = asm1;
mmach_asm2 = asm2;
mhlineskipmodify(asm2,i2,i3,i4,i5,i6);
-} /* mhline */
+}
-/* #pragma aux mhlineskipmodify parm [eax][ebx][ecx][edx][esi][edi] */
+
static uint8_t mshift_al = 26;
static uint8_t mshift_bl = 6;
void mhlineskipmodify(int32_t i1, uint32_t i2, uint32_t i3, int32_t i4, int32_t i5, int32_t i6)
@@ -643,9 +625,9 @@
i6++;
counter--;
}
-} /* mhlineskipmodify */
+}
-/* #pragma aux msethlineshift parm [eax][ebx] */
+
void msethlineshift(int32_t i1, int32_t i2)
{
i1 = 256-i1;
@@ -653,7 +635,7 @@
mshift_bl = (i2&0x1f);
} /* msethlineshift */
-/* #pragma aux thline parm [eax][ebx][ecx][edx][esi][edi] */
+
static int32_t tmach_eax;
static int32_t tmach_asm3;
static int32_t tmach_asm1;
@@ -666,9 +648,8 @@
tmach_asm1 = asm1;
tmach_asm2 = asm2;
thlineskipmodify(asm2,i2,i3,i4,i5,i6);
-} /* thline */
+}
-/* #pragma aux thlineskipmodify parm [eax][ebx][ecx][edx][esi][edi] */
static uint8_t tshift_al = 26;
static uint8_t tshift_bl = 6;
void thlineskipmodify(int32_t i1, uint32_t i2, uint32_t i3, int32_t i4, int32_t i5, int32_t i6)
@@ -693,17 +674,17 @@
i6++;
counter--;
}
-} /* thlineskipmodify */
+}
-/* #pragma aux tsethlineshift parm [eax][ebx] */
+
void tsethlineshift(int32_t i1, int32_t i2)
{
i1 = 256-i1;
tshift_al = (i1&0x1f);
tshift_bl = (i2&0x1f);
-} /* tsethlineshift */
+}
-/* #pragma aux setupslopevlin parm [eax][ebx][ecx] modify [edx] */
+
static int32_t slopemach_ebx;
static int32_t slopemach_ecx;
static int32_t slopemach_edx;
@@ -722,7 +703,7 @@
slopemach_ah2 = (slopemach_ah1 - (i1&0x1f)) & 0x1f;
c.f = asm2_f = (float)asm1;
asm2 = c.i;
-} /* setupslopevlin */
+}
extern int32_t reciptable[2048];
extern int32_t globalx3, globaly3;
@@ -794,46 +775,15 @@
} while ((int32_t)ebx > 0);
} /* slopevlin */
-/* #pragma aux settransnormal parm */
+
void settransnormal(void)
{
transrev = 0;
-} /* settransnormal */
+}
-/* #pragma aux settransreverse parm */
+
void settransreverse(void)
{
transrev = 1;
-} /* settransreverse */
-
-/* #pragma aux setupdrawslab parm [eax][ebx] */
-int32_t setupdrawslab(int32_t i1, int32_t i2)
-{
- int32_t retval = 0;
-
- return(retval);
-
-} /* setupdrawslab */
-
-/* #pragma aux drawslab parm [eax][ebx][ecx][edx][esi][edi] */
-int32_t drawslab(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
-{
- int32_t retval = 0;
- /*
- __asm__ __volatile__ (
- "call _asm_drawslab \n\t"
- : "=a" (retval)
- : "a" (i1), "b" (i2), "c" (i3), "d" (i4), "S" (i5), "D" (i6)
- : "cc", "memory");
- */
- return(retval);
-} /* drawslab */
-
-/* #pragma aux stretchhline parm [eax][ebx][ecx][edx][esi][edi] */
-int32_t stretchhline(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6)
-{
- int32_t retval = 0;
-
- return(retval);
-} /* stretchhline */
+}
--- a/Engine/src/a.h
+++ b/Engine/src/a.h
@@ -27,8 +27,8 @@
int32_t rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
int32_t setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
int32_t rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
-int32_t setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
-int32_t qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
+
+
int32_t setvlinebpl(int32_t);
int32_t fixtransluscence(int32_t);
int32_t prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
--- a/Engine/src/cache1d.c
+++ b/Engine/src/cache1d.c
@@ -207,7 +207,7 @@
}
}
-void reportandexit(uint8_t *errormessage)
+void reportandexit(char *errormessage)
{
int32_t i, j;
--- a/Engine/src/cache1d.h
+++ b/Engine/src/cache1d.h
@@ -24,7 +24,7 @@
void allocache (int32_t *newhandle, int32_t newbytes, uint8_t *newlockptr);
void suckcache (int32_t *suckptr);
void agecache(void);
-void reportandexit(uint8_t *errormessage);
+void reportandexit(char *errormessage);
int32_t initgroupfile(const uint8_t *filename);
void uninitgroupfile(void);
unsigned short crc16(uint8_t *data_p, unsigned short length);
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -3378,7 +3378,7 @@
if ((xv2&0x0000ffff) == 0)
{
qlinemode = 1;
- setupqrhlineasm4(0L,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),palookupoffs,0L,0L);
+ setuprhlineasm4(0L,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),palookupoffs,0L,0L);
}
else
{
@@ -3411,7 +3411,7 @@
/* x,y1 */
bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
- if (dastat&64) { if (qlinemode) qrhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace);
+ if (dastat&64) { if (qlinemode) rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace);
else rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace);
} else rmhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace);
}
@@ -3425,7 +3425,7 @@
/* x,y1 */
bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
- if (dastat&64) { if (qlinemode) qrhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace);
+ if (dastat&64) { if (qlinemode) rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace);
else rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace);
} else rmhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace);
}
@@ -3437,7 +3437,7 @@
/* x,y2 */
bx += xv*(y2-oy); by += yv*(y2-oy); oy = y2;
- if (dastat&64) { if (qlinemode) qrhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y2]+x+frameplace);
+ if (dastat&64) { if (qlinemode) rhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y2]+x+frameplace);
else rhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y2]+x+frameplace);
} else rmhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y2]+x+frameplace);
}
@@ -3451,7 +3451,7 @@
/* x,y1 */
bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
- if (dastat&64) { if (qlinemode) qrhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace);
+ if (dastat&64) { if (qlinemode) rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace);
else rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace);
} else rmhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace);
}
@@ -3468,7 +3468,7 @@
/* x2,y1 */
bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
- if (dastat&64) { if (qlinemode) qrhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x2+frameplace);
+ if (dastat&64) { if (qlinemode) rhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x2+frameplace);
else rhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x2+frameplace);
} else rmhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x2+frameplace);
}
@@ -4178,219 +4178,6 @@
while (y1 < y2-1) ceilspritehline(x2,++y1);
faketimerhandler();
}
-
-
-#ifdef SUPERBUILD
-static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasprang,
- int32_t daxscale, int32_t dayscale, uint8_t daindex,
- int8_t dashade, uint8_t dapal, int32_t *daumost, int32_t *dadmost)
-{
- int32_t i, j, k, x, y, syoff, ggxstart, ggystart, nxoff;
- int32_t cosang, sinang, sprcosang, sprsinang, backx, backy, gxinc, gyinc;
- int32_t daxsiz, daysiz, dazsiz, daxpivot, daypivot, dazpivot;
- int32_t daxscalerecip, dayscalerecip, cnt, gxstart, gystart, odayscale;
- int32_t l1, l2, slabxoffs, xyvoxoffs, *longptr;
- int32_t lx, rx, nx, ny, x1=0, y1=0, z1, x2=0, y2=0, z2, yplc, yinc=0;
- int32_t yoff, xs=0, ys=0, xe, ye, xi=0, yi=0, cbackx, cbacky, dagxinc, dagyinc;
- short *shortptr;
- uint8_t *voxptr, *voxend, *davoxptr, oand, oand16, oand32;
-
- cosang = sintable[(globalang+512)&2047];
- sinang = sintable[globalang&2047];
- sprcosang = sintable[(dasprang+512)&2047];
- sprsinang = sintable[dasprang&2047];
-
- i = klabs(dmulscale6(dasprx-globalposx,cosang,daspry-globalposy,sinang));
- j = (long)(getpalookup((long)mulscale21(globvis,i),(long)dashade)<<8);
- setupdrawslab(ylookup[1],(long)FP_OFF(palookup[dapal])+j);
- j = 1310720;
- j *= min(daxscale,dayscale); j >>= 6; /* New hacks (for sized-down voxels) */
- for(k=0;k<MAXVOXMIPS;k++)
- {
- if (i < j) { i = k; break; }
- j <<= 1;
- }
- if (k >= MAXVOXMIPS) i = MAXVOXMIPS-1;
-
- davoxptr = (uint8_t *)voxoff[daindex][i]; if (!davoxptr) return;
-
- daxscale <<= (i+8); dayscale <<= (i+8);
- odayscale = dayscale;
- daxscale = mulscale16(daxscale,xyaspect);
- daxscale = scale(daxscale,xdimenscale,xdimen<<8);
- dayscale = scale(dayscale,mulscale16(xdimenscale,viewingrangerecip),xdimen<<8);
-
- daxscalerecip = (1<<30)/daxscale;
- dayscalerecip = (1<<30)/dayscale;
-
- longptr = (int32_t *)davoxptr;
- daxsiz = longptr[0]; daysiz = longptr[1]; dazsiz = longptr[2];
- daxpivot = longptr[3]; daypivot = longptr[4]; dazpivot = longptr[5];
- davoxptr += (6<<2);
-
- x = mulscale16(globalposx-dasprx,daxscalerecip);
- y = mulscale16(globalposy-daspry,daxscalerecip);
- backx = ((dmulscale10(x,sprcosang,y,sprsinang)+daxpivot)>>8);
- backy = ((dmulscale10(y,sprcosang,x,-sprsinang)+daypivot)>>8);
- cbackx = min(max(backx,0),daxsiz-1);
- cbacky = min(max(backy,0),daysiz-1);
-
- sprcosang = mulscale14(daxscale,sprcosang);
- sprsinang = mulscale14(daxscale,sprsinang);
-
- x = (dasprx-globalposx) - dmulscale18(daxpivot,sprcosang,daypivot,-sprsinang);
- y = (daspry-globalposy) - dmulscale18(daypivot,sprcosang,daxpivot,sprsinang);
-
- cosang = mulscale16(cosang,dayscalerecip);
- sinang = mulscale16(sinang,dayscalerecip);
-
- gxstart = y*cosang - x*sinang;
- gystart = x*cosang + y*sinang;
- gxinc = dmulscale10(sprsinang,cosang,sprcosang,-sinang);
- gyinc = dmulscale10(sprcosang,cosang,sprsinang,sinang);
-
- x = 0; y = 0; j = max(daxsiz,daysiz);
- for(i=0;i<=j;i++)
- {
- ggxinc[i] = x; x += gxinc;
- ggyinc[i] = y; y += gyinc;
- }
-
- if ((klabs(globalposz-dasprz)>>10) >= klabs(odayscale)) return;
- syoff = divscale21(globalposz-dasprz,odayscale) + (dazpivot<<7);
- yoff = ((klabs(gxinc)+klabs(gyinc))>>1);
- longptr = (int32_t *)davoxptr;
- xyvoxoffs = ((daxsiz+1)<<2);
-
- for(cnt=0;cnt<8;cnt++)
- {
- switch(cnt)
- {
- case 0: xs = 0; ys = 0; xi = 1; yi = 1; break;
- case 1: xs = daxsiz-1; ys = 0; xi = -1; yi = 1; break;
- case 2: xs = 0; ys = daysiz-1; xi = 1; yi = -1; break;
- case 3: xs = daxsiz-1; ys = daysiz-1; xi = -1; yi = -1; break;
- case 4: xs = 0; ys = cbacky; xi = 1; yi = 2; break;
- case 5: xs = daxsiz-1; ys = cbacky; xi = -1; yi = 2; break;
- case 6: xs = cbackx; ys = 0; xi = 2; yi = 1; break;
- case 7: xs = cbackx; ys = daysiz-1; xi = 2; yi = -1; break;
- }
- xe = cbackx; ye = cbacky;
- if (cnt < 4)
- {
- if ((xi < 0) && (xe >= xs)) continue;
- if ((xi > 0) && (xe <= xs)) continue;
- if ((yi < 0) && (ye >= ys)) continue;
- if ((yi > 0) && (ye <= ys)) continue;
- }
- else
- {
- if ((xi < 0) && (xe > xs)) continue;
- if ((xi > 0) && (xe < xs)) continue;
- if ((yi < 0) && (ye > ys)) continue;
- if ((yi > 0) && (ye < ys)) continue;
- xe += xi; ye += yi;
- }
-
- i = ksgn(ys-backy)+ksgn(xs-backx)*3+4;
- switch(i)
- {
- case 6: case 7: x1 = 0; y1 = 0; break;
- case 8: case 5: x1 = gxinc; y1 = gyinc; break;
- case 0: case 3: x1 = gyinc; y1 = -gxinc; break;
- case 2: case 1: x1 = gxinc+gyinc; y1 = gyinc-gxinc; break;
- }
- switch(i)
- {
- case 2: case 5: x2 = 0; y2 = 0; break;
- case 0: case 1: x2 = gxinc; y2 = gyinc; break;
- case 8: case 7: x2 = gyinc; y2 = -gxinc; break;
- case 6: case 3: x2 = gxinc+gyinc; y2 = gyinc-gxinc; break;
- }
- oand = pow2char[(xs<backx)+0]+pow2char[(ys<backy)+2];
- oand16 = oand+16;
- oand32 = oand+32;
-
- if (yi > 0) { dagxinc = gxinc; dagyinc = mulscale16(gyinc,viewingrangerecip); }
- else { dagxinc = -gxinc; dagyinc = -mulscale16(gyinc,viewingrangerecip); }
-
- /* Fix for non 90 degree viewing ranges */
- nxoff = mulscale16(x2-x1,viewingrangerecip);
- x1 = mulscale16(x1,viewingrangerecip);
-
- ggxstart = gxstart+ggyinc[ys];
- ggystart = gystart-ggxinc[ys];
-
- for(x=xs;x!=xe;x+=xi)
- {
- slabxoffs = (long)&davoxptr[longptr[x]];
- shortptr = (short *)&davoxptr[((x*(daysiz+1))<<1)+xyvoxoffs];
-
- nx = mulscale16(ggxstart+ggxinc[x],viewingrangerecip)+x1;
- ny = ggystart+ggyinc[x];
- for(y=ys;y!=ye;y+=yi,nx+=dagyinc,ny-=dagxinc)
- {
- if ((ny <= nytooclose) || (ny >= nytoofar)) continue;
- voxptr = (uint8_t *)(shortptr[y]+slabxoffs);
- voxend = (uint8_t *)(shortptr[y+1]+slabxoffs);
- if (voxptr == voxend) continue;
-
- lx = mulscale32(nx>>3,distrecip[(ny+y1)>>14])+halfxdimen;
- if (lx < 0) lx = 0;
- rx = mulscale32((nx+nxoff)>>3,distrecip[(ny+y2)>>14])+halfxdimen;
- if (rx > xdimen) rx = xdimen;
- if (rx <= lx) continue;
- rx -= lx;
-
- l1 = distrecip[(ny-yoff)>>14];
- l2 = distrecip[(ny+yoff)>>14];
- for(;voxptr<voxend;voxptr+=voxptr[1]+3)
- {
- j = (voxptr[0]<<15)-syoff;
- if (j < 0)
- {
- k = j+(voxptr[1]<<15);
- if (k < 0)
- {
- if ((voxptr[2]&oand32) == 0) continue;
- z2 = mulscale32(l2,k) + globalhoriz; /* Below slab */
- }
- else
- {
- if ((voxptr[2]&oand) == 0) continue; /* Middle of slab */
- z2 = mulscale32(l1,k) + globalhoriz;
- }
- z1 = mulscale32(l1,j) + globalhoriz;
- }
- else
- {
- if ((voxptr[2]&oand16) == 0) continue;
- z1 = mulscale32(l2,j) + globalhoriz; /* Above slab */
- z2 = mulscale32(l1,j+(voxptr[1]<<15)) + globalhoriz;
- }
-
- if (voxptr[1] == 1)
- {
- yplc = 0; yinc = 0;
- if (z1 < daumost[lx]) z1 = daumost[lx];
- }
- else
- {
- if (z2-z1 >= 1024) yinc = divscale16(voxptr[1],z2-z1);
- else if (z2 > z1) yinc = (lowrecip[z2-z1]*voxptr[1]>>8);
- if (z1 < daumost[lx]) { yplc = yinc*(daumost[lx]-z1); z1 = daumost[lx]; } else yplc = 0;
- }
- if (z2 > dadmost[lx]) z2 = dadmost[lx];
- z2 -= z1; if (z2 <= 0) continue;
-
- drawslab(rx,yplc,z2,yinc,(long)&voxptr[3],ylookup[z1]+lx+frameoffset);
- }
- }
- }
- }
-}
-#endif
-
static void drawsprite (int32_t snum)
{
--- a/Engine/src/engine_protos.h
+++ b/Engine/src/engine_protos.h
@@ -29,7 +29,7 @@
extern void allocache(int32_t *newhandle, int32_t newbytes, uint8_t *newlockptr);
extern void suckcache(int32_t *suckptr);
extern void agecache(void);
-extern void reportandexit(uint8_t *errormessage);
+extern void reportandexit(char *errormessage);
extern int32_t initgroupfile(const uint8_t *filename);
extern void uninitgroupfile(void);
extern int32_t kopen4load(const char *filename,int readfromGRP);
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -1055,21 +1055,6 @@
} /* output_sdl_versions */
-static int in_vmware = 0;
-static __inline void detect_vmware(void)
-{
-#if 1
- in_vmware = 0; /* oh well. */
-#else
- /* !!! need root access to touch i/o ports on Linux. */
- #if (!defined __linux__)
- in_vmware = (int) is_vmware_running();
- #endif
- sdldebug("vmWare %s running.", (in_vmware) ? "is" : "is not");
-#endif
-} /* detect_vmware */
-
-
/* lousy -ansi flag. :) */
static char *string_dupe(const char *str)
{
@@ -1373,7 +1358,7 @@
output_sdl_versions();
output_driver_info();
- detect_vmware();
+
printf("Video Driver [directx or windib]? -> %s \n", SDL_VideoDriverName(dummyString, 20));
@@ -2480,7 +2465,7 @@
//Timer on windows 98 used to be really poor but now it is very accurate
-// We can just used what SDL uses, now need for QueryPerformanceFrequency or QueryPerformanceCounter
+// We can just use what SDL uses, no need for QueryPerformanceFrequency or QueryPerformanceCounter
// (which I bet SDL is using anyway).
#if 0//PLATFORM_WIN32
int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
--- a/Game/src/sounds.c
+++ b/Game/src/sounds.c
@@ -676,14 +676,14 @@
{
int32_t i;
- printf("FCS: Warning, cleaning sound lock in unproper way. THIS MUST BE FIXED ON MACOSX.\n");
+
for(i=0;i<NUM_SOUNDS;i++)
- // if(Sound[i].lock >= 200)
+
Sound[i].lock = 199;
for(i=0;i<11;i++)
- // if(lumplockbyte[i] >= 200)
+
lumplockbyte[i] = 199;
}