This commit is contained in:
nukeykt 2019-08-31 19:36:26 +09:00 committed by Christoph Oelckers
parent e0858d501c
commit 708483ca78
11 changed files with 41 additions and 31 deletions

View file

@ -7110,7 +7110,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
if (d4 >= u4) vlineasm4(d4-u4+1, (char *)(ylookup[u4]+p)); if (d4 >= u4) vlineasm4(d4-u4+1, (char *)(ylookup[u4]+p));
i = p+ylookup[d4+1]; intptr_t i = p+ylookup[d4+1];
if (y2ve[0] > d4) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); if (y2ve[0] > d4) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0);
if (y2ve[1] > d4) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); if (y2ve[1] > d4) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1);
if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2);
@ -7134,7 +7134,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
if (d4 >= u4) mvlineasm4(d4-u4+1, (char *)(ylookup[u4]+p)); if (d4 >= u4) mvlineasm4(d4-u4+1, (char *)(ylookup[u4]+p));
i = p+ylookup[d4+1]; intptr_t i = p+ylookup[d4+1];
if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0);
if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1);
if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2);

View file

@ -38,6 +38,8 @@ void kensetpalette(unsigned char *vgapal)
//setbrightness(0, (char*)vgapal, 4 | 2); //setbrightness(0, (char*)vgapal, 4 | 2);
// TODO // TODO
Bmemcpy(palette, vgapal, 768); Bmemcpy(palette, vgapal, 768);
for (auto &i : palette)
i <<= 2;
videoSetPalette(0, 0, /*4 | */2); videoSetPalette(0, 0, /*4 | */2);
#if 0 #if 0
char vesapal[1024]; char vesapal[1024];

View file

@ -3277,8 +3277,8 @@ int DoSpiritHead()
} }
// loc_135F9 // loc_135F9
curx[i] = ebx << 8; curx[i] = ebx * 256;
cury[i] = esi << 8; cury[i] = esi * 256;
//ecx += 2; //ecx += 2;
// ecx++; // ecx++;

View file

@ -90,6 +90,9 @@ int LoadPaletteLookups()
} }
kread(hFile, buffer, 256*64); kread(hFile, buffer, 256*64);
// TODO: dumb hack
if (palookup[i])
ALIGNED_FREE_AND_NULL(palookup[i]);
paletteSetLookupTable(i, buffer); paletteSetLookupTable(i, buffer);
kclose(hFile); kclose(hFile);

View file

@ -1860,12 +1860,13 @@ void ReadyCinemaText(uint16_t nVal)
uint8_t AdvanceCinemaText() uint8_t AdvanceCinemaText()
{ {
int var_1C = nCDTrackLength; int var_1C = nCDTrackLength;
int tmp = nHeight + nCrawlY > 0;
if (nHeight + nCrawlY > 0 || nCDTrackLength && nCDTrackLength > 0) if (tmp || nCDTrackLength && nCDTrackLength > 0)
{ {
nextclock = totalclock + 14; nextclock = totalclock + 14;
if ((nHeight + nCrawlY > 0) > 0) if (tmp > 0)
{ {
short y = nCrawlY; short y = nCrawlY;
int edi = 0; int edi = 0;

View file

@ -343,7 +343,7 @@ short FindWallSprites(short nSector)
return nSprite; return nSprite;
} }
int BuildElevF(int nChannel, int nSector, int nWallSprite, int arg_4, int arg_5, int nCount, int zList ...) int BuildElevF(int nChannel, int nSector, int nWallSprite, int arg_4, int arg_5, int nCount, ...)
{ {
assert(ElevCount > 0); assert(ElevCount > 0);
@ -368,8 +368,9 @@ int BuildElevF(int nChannel, int nSector, int nWallSprite, int arg_4, int arg_5,
} }
Elevator[ElevCount].nSprite = nWallSprite; Elevator[ElevCount].nSprite = nWallSprite;
int *pZVals = (int*)&zList; va_list zlist;
va_start(zlist, nCount);
while (1) while (1)
{ {
@ -381,14 +382,14 @@ int BuildElevF(int nChannel, int nSector, int nWallSprite, int arg_4, int arg_5,
Elevator[ElevCount].nCountZOffsets++; Elevator[ElevCount].nCountZOffsets++;
Elevator[ElevCount].zOffsets[nVal] = *pZVals; Elevator[ElevCount].zOffsets[nVal] = va_arg(zlist, int);
pZVals++;
} }
va_end(zlist);
return ElevCount; return ElevCount;
} }
int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, int arg6, int nCount, int zList ...) int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, int arg6, int nCount, ...)
{ {
int edi = arg5; int edi = arg5;
@ -421,7 +422,8 @@ int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, i
Elevator[ElevCount].nSprite = nWallSprite; Elevator[ElevCount].nSprite = nWallSprite;
int *pZVals = (int*)&zList; va_list zlist;
va_start(zlist, nCount);
while (1) while (1)
{ {
@ -433,9 +435,9 @@ int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, i
Elevator[ElevCount].nCountZOffsets++; Elevator[ElevCount].nCountZOffsets++;
Elevator[ElevCount].zOffsets[nVal] = *pZVals; Elevator[ElevCount].zOffsets[nVal] = va_arg(zlist, int);
pZVals++;
} }
va_end(zlist);
return ElevCount; return ElevCount;
} }
@ -775,7 +777,7 @@ void InitWallFace()
WallFaceCount = kMaxWallFace; WallFaceCount = kMaxWallFace;
} }
int BuildWallFace(short nChannel, short nWall, short nCount, int nPics ...) int BuildWallFace(short nChannel, short nWall, short nCount, ...)
{ {
if (WallFaceCount <= 0) { if (WallFaceCount <= 0) {
bail2dos("Too many wall faces!\n"); bail2dos("Too many wall faces!\n");
@ -791,16 +793,17 @@ int BuildWallFace(short nChannel, short nWall, short nCount, int nPics ...)
nCount = 8; nCount = 8;
} }
int *pPicNums = (int*)&nPics; va_list piclist;
va_start(piclist, nCount);
while (WallFace[WallFaceCount].field_4 < nCount) while (WallFace[WallFaceCount].field_4 < nCount)
{ {
int i = WallFace[WallFaceCount].field_4; int i = WallFace[WallFaceCount].field_4;
WallFace[WallFaceCount].field_4++; WallFace[WallFaceCount].field_4++;
WallFace[WallFaceCount].field_6[i] = *pPicNums; WallFace[WallFaceCount].field_6[i] = va_arg(piclist, short);
pPicNums++;
} }
va_end(piclist);
return WallFaceCount | 0x70000; return WallFaceCount | 0x70000;
} }

View file

@ -59,10 +59,10 @@ void BuildDrip(int nSprite);
int BuildEnergyBlock(short nSector); int BuildEnergyBlock(short nSector);
int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, int arg6, int nCount, int zList ...); int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, int arg6, int nCount, ...);
int BuildElevF(int nChannel, int nSector, int nWallSprite, int arg_4, int arg_5, int nCount, int zList ...); int BuildElevF(int nChannel, int nSector, int nWallSprite, int arg_4, int arg_5, int nCount, ...);
int BuildWallFace(short nChannel, short nWall, short nCount, int nPics ...); int BuildWallFace(short nChannel, short nWall, short nCount, ...);
int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int arg3); int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int arg3);

View file

@ -1358,7 +1358,7 @@ void runlist_ProcessSectorTag(int nSector, int lotag, int hitag)
short nextSector = nextsectorneighborz(nSector, sector[nSector].ceilingz, -1, -1); short nextSector = nextsectorneighborz(nSector, sector[nSector].ceilingz, -1, -1);
assert(nextSector > -1); assert(nextSector > -1);
int nElev = BuildElevC(0, nChannel, nSector, FindWallSprites(nSector), var_18 * 100, var_18 * 100, 2, sector[nSector].floorz, sector[nextSector].ceilingz); int nElev = BuildElevC(0, nChannel, nSector, FindWallSprites(nSector), var_18 * 100, var_18 * 100, 2, (int)sector[nSector].floorz, (int)sector[nextSector].ceilingz);
runlist_AddRunRec(sRunChannels[nChannel].a, nElev); runlist_AddRunRec(sRunChannels[nChannel].a, nElev);
@ -1375,7 +1375,7 @@ void runlist_ProcessSectorTag(int nSector, int lotag, int hitag)
case 74: case 74:
{ {
int nElev = BuildElevC(0, nChannel, nSector, FindWallSprites(nSector), var_18 * 100, var_18 * 100, 2, sector[nSector].ceilingz, sector[nSector].floorz); int nElev = BuildElevC(0, nChannel, nSector, FindWallSprites(nSector), var_18 * 100, var_18 * 100, 2, (int)sector[nSector].ceilingz, (int)sector[nSector].floorz);
runlist_AddRunRec(sRunChannels[nChannel].a, nElev); runlist_AddRunRec(sRunChannels[nChannel].a, nElev);

View file

@ -834,10 +834,10 @@ void DrawStatus()
int x = (nViewLeft + nViewRight) / 2; int x = (nViewLeft + nViewRight) / 2;
sprintf(coordBuf, "X %d", sprite[nSprite].x); sprintf(coordBuf, "X %d", (int)sprite[nSprite].x);
printext(x, nViewTop + 1, coordBuf, kTile159, 255); printext(x, nViewTop + 1, coordBuf, kTile159, 255);
sprintf(coordBuf, "Y %d", sprite[nSprite].y); sprintf(coordBuf, "Y %d", (int)sprite[nSprite].y);
printext(x, nViewTop + 10, coordBuf, kTile159, 255); printext(x, nViewTop + 10, coordBuf, kTile159, 255);
} }

View file

@ -37,13 +37,14 @@ void InitLink()
LinkCount = kMaxLinks; LinkCount = kMaxLinks;
} }
int BuildLink(int nCount, int argList ...) int BuildLink(int nCount, ...)
{ {
if (LinkCount <= 0) { if (LinkCount <= 0) {
return -1; return -1;
} }
int *pList = &argList; va_list list;
va_start(list, nCount);
LinkCount--; LinkCount--;
@ -57,12 +58,12 @@ int BuildLink(int nCount, int argList ...)
} }
else else
{ {
ebx = *pList; ebx = va_arg(list, int);
pList++;
} }
LinkMap[LinkCount][i] = (int8_t)ebx; LinkMap[LinkCount][i] = (int8_t)ebx;
} }
va_end(list);
return LinkCount; return LinkCount;
} }

View file

@ -17,7 +17,7 @@ void FuncSwPressWall(int, int, int);
int BuildSwPause(int nChannel, int nLink, int ebx); int BuildSwPause(int nChannel, int nLink, int ebx);
int BuildSwNotOnPause(int nChannel, int nLink, int nSector, int ecx); int BuildSwNotOnPause(int nChannel, int nLink, int nSector, int ecx);
int BuildLink(int nCount, int argList ...); int BuildLink(int nCount, ...);
int BuildSwPressSector(int nChannel, int nLink, int nSector, int ecx); int BuildSwPressSector(int nChannel, int nLink, int nSector, int ecx);
int BuildSwStepOn(int nChannel, int nLink, int nSector); int BuildSwStepOn(int nChannel, int nLink, int nSector);
int BuildSwReady(int nChannel, short nLink); int BuildSwReady(int nChannel, short nLink);