mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
- changed the byte order swappers to use ZDoom's versions
This is to reduce redundancy, plus, these are native on Windows and macOS.
This commit is contained in:
parent
3c8da8c421
commit
5704c57fe0
7 changed files with 88 additions and 97 deletions
|
@ -644,20 +644,18 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
byte_1A76C7 = 1;
|
||||
}
|
||||
|
||||
#if B_BIG_ENDIAN == 1
|
||||
mapHeader.at0 = B_LITTLE32(mapHeader.at0);
|
||||
mapHeader.at4 = B_LITTLE32(mapHeader.at4);
|
||||
mapHeader.at8 = B_LITTLE32(mapHeader.at8);
|
||||
mapHeader.atc = B_LITTLE16(mapHeader.atc);
|
||||
mapHeader.ate = B_LITTLE16(mapHeader.ate);
|
||||
mapHeader.at10 = B_LITTLE16(mapHeader.at10);
|
||||
mapHeader.at12 = B_LITTLE32(mapHeader.at12);
|
||||
mapHeader.at16 = B_LITTLE32(mapHeader.at16);
|
||||
mapHeader.at1b = B_LITTLE32(mapHeader.at1b);
|
||||
mapHeader.at1f = B_LITTLE16(mapHeader.at1f);
|
||||
mapHeader.at21 = B_LITTLE16(mapHeader.at21);
|
||||
mapHeader.at23 = B_LITTLE16(mapHeader.at23);
|
||||
#endif
|
||||
mapHeader.at0 = LittleLong(mapHeader.at0);
|
||||
mapHeader.at4 = LittleLong(mapHeader.at4);
|
||||
mapHeader.at8 = LittleLong(mapHeader.at8);
|
||||
mapHeader.atc = LittleShort(mapHeader.atc);
|
||||
mapHeader.ate = LittleShort(mapHeader.ate);
|
||||
mapHeader.at10 = LittleShort(mapHeader.at10);
|
||||
mapHeader.at12 = LittleLong(mapHeader.at12);
|
||||
mapHeader.at16 = LittleLong(mapHeader.at16);
|
||||
mapHeader.at1b = LittleLong(mapHeader.at1b);
|
||||
mapHeader.at1f = LittleShort(mapHeader.at1f);
|
||||
mapHeader.at21 = LittleShort(mapHeader.at21);
|
||||
mapHeader.at23 = LittleShort(mapHeader.at23);
|
||||
|
||||
*pX = mapHeader.at0;
|
||||
*pY = mapHeader.at4;
|
||||
|
@ -696,11 +694,10 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
{
|
||||
fr.Read(&byte_19AE44, 128);
|
||||
dbCrypt((char*)&byte_19AE44, 128, numwalls);
|
||||
#if B_BIG_ENDIAN == 1
|
||||
byte_19AE44.at40 = B_LITTLE32(byte_19AE44.at40);
|
||||
byte_19AE44.at44 = B_LITTLE32(byte_19AE44.at44);
|
||||
byte_19AE44.at48 = B_LITTLE32(byte_19AE44.at48);
|
||||
#endif
|
||||
|
||||
byte_19AE44.at40 = LittleLong(byte_19AE44.at40);
|
||||
byte_19AE44.at44 = LittleLong(byte_19AE44.at44);
|
||||
byte_19AE44.at48 = LittleLong(byte_19AE44.at48);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -718,7 +715,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
pSky->lognumtiles = mapHeader.at10;
|
||||
for (int i = 0; i < ClipHigh(gSkyCount, MAXPSKYTILES); i++)
|
||||
{
|
||||
pSky->tileofs[i] = B_LITTLE16(tpskyoff[i]);
|
||||
pSky->tileofs[i] = LittleShort(tpskyoff[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
|
@ -729,21 +726,20 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
{
|
||||
dbCrypt((char*)pSector, sizeof(sectortype), gMapRev*sizeof(sectortype));
|
||||
}
|
||||
#if B_BIG_ENDIAN == 1
|
||||
pSector->wallptr = B_LITTLE16(pSector->wallptr);
|
||||
pSector->wallnum = B_LITTLE16(pSector->wallnum);
|
||||
pSector->ceilingz = B_LITTLE32(pSector->ceilingz);
|
||||
pSector->floorz = B_LITTLE32(pSector->floorz);
|
||||
pSector->ceilingstat = B_LITTLE16(pSector->ceilingstat);
|
||||
pSector->floorstat = B_LITTLE16(pSector->floorstat);
|
||||
pSector->ceilingpicnum = B_LITTLE16(pSector->ceilingpicnum);
|
||||
pSector->ceilingheinum = B_LITTLE16(pSector->ceilingheinum);
|
||||
pSector->floorpicnum = B_LITTLE16(pSector->floorpicnum);
|
||||
pSector->floorheinum = B_LITTLE16(pSector->floorheinum);
|
||||
pSector->type = B_LITTLE16(pSector->type);
|
||||
pSector->hitag = B_LITTLE16(pSector->hitag);
|
||||
pSector->extra = B_LITTLE16(pSector->extra);
|
||||
#endif
|
||||
pSector->wallptr = LittleShort(pSector->wallptr);
|
||||
pSector->wallnum = LittleShort(pSector->wallnum);
|
||||
pSector->ceilingz = LittleLong(pSector->ceilingz);
|
||||
pSector->floorz = LittleLong(pSector->floorz);
|
||||
pSector->ceilingstat = LittleShort(pSector->ceilingstat);
|
||||
pSector->floorstat = LittleShort(pSector->floorstat);
|
||||
pSector->ceilingpicnum = LittleShort(pSector->ceilingpicnum);
|
||||
pSector->ceilingheinum = LittleShort(pSector->ceilingheinum);
|
||||
pSector->floorpicnum = LittleShort(pSector->floorpicnum);
|
||||
pSector->floorheinum = LittleShort(pSector->floorheinum);
|
||||
pSector->type = LittleShort(pSector->type);
|
||||
pSector->hitag = LittleShort(pSector->hitag);
|
||||
pSector->extra = LittleShort(pSector->extra);
|
||||
|
||||
qsector_filler[i] = pSector->fogpal;
|
||||
pSector->fogpal = 0;
|
||||
if (sector[i].extra > 0)
|
||||
|
@ -854,19 +850,17 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
{
|
||||
dbCrypt((char*)pWall, sizeof(walltype), (gMapRev*sizeof(sectortype)) | 0x7474614d);
|
||||
}
|
||||
#if B_BIG_ENDIAN == 1
|
||||
pWall->x = B_LITTLE32(pWall->x);
|
||||
pWall->y = B_LITTLE32(pWall->y);
|
||||
pWall->point2 = B_LITTLE16(pWall->point2);
|
||||
pWall->nextwall = B_LITTLE16(pWall->nextwall);
|
||||
pWall->nextsector = B_LITTLE16(pWall->nextsector);
|
||||
pWall->cstat = B_LITTLE16(pWall->cstat);
|
||||
pWall->picnum = B_LITTLE16(pWall->picnum);
|
||||
pWall->overpicnum = B_LITTLE16(pWall->overpicnum);
|
||||
pWall->type = B_LITTLE16(pWall->type);
|
||||
pWall->hitag = B_LITTLE16(pWall->hitag);
|
||||
pWall->extra = B_LITTLE16(pWall->extra);
|
||||
#endif
|
||||
pWall->x = LittleLong(pWall->x);
|
||||
pWall->y = LittleLong(pWall->y);
|
||||
pWall->point2 = LittleShort(pWall->point2);
|
||||
pWall->nextwall = LittleShort(pWall->nextwall);
|
||||
pWall->nextsector = LittleShort(pWall->nextsector);
|
||||
pWall->cstat = LittleShort(pWall->cstat);
|
||||
pWall->picnum = LittleShort(pWall->picnum);
|
||||
pWall->overpicnum = LittleShort(pWall->overpicnum);
|
||||
pWall->type = LittleShort(pWall->type);
|
||||
pWall->hitag = LittleShort(pWall->hitag);
|
||||
pWall->extra = LittleShort(pWall->extra);
|
||||
if (wall[i].extra > 0)
|
||||
{
|
||||
char pBuffer[nXWallSize];
|
||||
|
@ -931,23 +925,23 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
{
|
||||
dbCrypt((char*)pSprite, sizeof(spritetype), (gMapRev*sizeof(spritetype)) | 0x7474614d);
|
||||
}
|
||||
#if B_BIG_ENDIAN == 1
|
||||
pSprite->x = B_LITTLE32(pSprite->x);
|
||||
pSprite->y = B_LITTLE32(pSprite->y);
|
||||
pSprite->z = B_LITTLE32(pSprite->z);
|
||||
pSprite->cstat = B_LITTLE16(pSprite->cstat);
|
||||
pSprite->picnum = B_LITTLE16(pSprite->picnum);
|
||||
pSprite->sectnum = B_LITTLE16(pSprite->sectnum);
|
||||
pSprite->statnum = B_LITTLE16(pSprite->statnum);
|
||||
pSprite->ang = B_LITTLE16(pSprite->ang);
|
||||
pSprite->owner = B_LITTLE16(pSprite->owner);
|
||||
pSprite->index = B_LITTLE16(pSprite->index);
|
||||
pSprite->yvel = B_LITTLE16(pSprite->yvel);
|
||||
pSprite->inittype = B_LITTLE16(pSprite->inittype);
|
||||
pSprite->type = B_LITTLE16(pSprite->type);
|
||||
pSprite->flags = B_LITTLE16(pSprite->hitag);
|
||||
pSprite->extra = B_LITTLE16(pSprite->extra);
|
||||
#endif
|
||||
|
||||
pSprite->x = LittleLong(pSprite->x);
|
||||
pSprite->y = LittleLong(pSprite->y);
|
||||
pSprite->z = LittleLong(pSprite->z);
|
||||
pSprite->cstat = LittleShort(pSprite->cstat);
|
||||
pSprite->picnum = LittleShort(pSprite->picnum);
|
||||
pSprite->sectnum = LittleShort(pSprite->sectnum);
|
||||
pSprite->statnum = LittleShort(pSprite->statnum);
|
||||
pSprite->ang = LittleShort(pSprite->ang);
|
||||
pSprite->owner = LittleShort(pSprite->owner);
|
||||
pSprite->index = LittleShort(pSprite->index);
|
||||
pSprite->yvel = LittleShort(pSprite->yvel);
|
||||
pSprite->inittype = LittleShort(pSprite->inittype);
|
||||
pSprite->type = LittleShort(pSprite->type);
|
||||
pSprite->flags = LittleShort(pSprite->hitag);
|
||||
pSprite->extra = LittleShort(pSprite->extra);
|
||||
|
||||
InsertSpriteSect(i, sprite[i].sectnum);
|
||||
InsertSpriteStat(i, sprite[i].statnum);
|
||||
Numsprites++;
|
||||
|
@ -1051,11 +1045,8 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
|||
sprite[i].cstat &= ~0x30;
|
||||
}
|
||||
}
|
||||
unsigned int nCRC;
|
||||
fr.Read(&nCRC, 4);
|
||||
#if B_BIG_ENDIAN == 1
|
||||
nCRC = B_LITTLE32(nCRC);
|
||||
#endif
|
||||
unsigned int nCRC = fr.ReadUInt32();
|
||||
|
||||
fr.Seek(0, FileReader::SeekSet);
|
||||
auto buffer = fr.Read();
|
||||
md4once(buffer.Data(), buffer.Size(), g_loadedMapHack.md4);
|
||||
|
|
|
@ -179,27 +179,27 @@ void ByteSwapQAV(void* p)
|
|||
{
|
||||
#if B_BIG_ENDIAN == 1
|
||||
QAV* qav = (QAV*)p;
|
||||
qav->nFrames = B_LITTLE32(qav->nFrames);
|
||||
qav->ticksPerFrame = B_LITTLE32(qav->ticksPerFrame);
|
||||
qav->at10 = B_LITTLE32(qav->at10);
|
||||
qav->x = B_LITTLE32(qav->x);
|
||||
qav->y = B_LITTLE32(qav->y);
|
||||
qav->nSprite = B_LITTLE32(qav->nSprite);
|
||||
qav->nFrames = LittleLong(qav->nFrames);
|
||||
qav->ticksPerFrame = LittleLong(qav->ticksPerFrame);
|
||||
qav->at10 = LittleLong(qav->at10);
|
||||
qav->x = LittleLong(qav->x);
|
||||
qav->y = LittleLong(qav->y);
|
||||
qav->nSprite = LittleLong(qav->nSprite);
|
||||
for (int i = 0; i < qav->nFrames; i++)
|
||||
{
|
||||
FRAMEINFO* pFrame = &qav->frames[i];
|
||||
SOUNDINFO* pSound = &pFrame->sound;
|
||||
pFrame->nCallbackId = B_LITTLE32(pFrame->nCallbackId);
|
||||
pSound->sound = B_LITTLE32(pSound->sound);
|
||||
pFrame->nCallbackId = LittleLong(pFrame->nCallbackId);
|
||||
pSound->sound = LittleLong(pSound->sound);
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
TILE_FRAME* pTile = &pFrame->tiles[j];
|
||||
pTile->picnum = B_LITTLE32(pTile->picnum);
|
||||
pTile->x = B_LITTLE32(pTile->x);
|
||||
pTile->y = B_LITTLE32(pTile->y);
|
||||
pTile->z = B_LITTLE32(pTile->z);
|
||||
pTile->stat = B_LITTLE32(pTile->stat);
|
||||
pTile->angle = B_LITTLE16(pTile->angle);
|
||||
pTile->picnum = LittleLong(pTile->picnum);
|
||||
pTile->x = LittleLong(pTile->x);
|
||||
pTile->y = LittleLong(pTile->y);
|
||||
pTile->z = LittleLong(pTile->z);
|
||||
pTile->stat = LittleLong(pTile->stat);
|
||||
pTile->angle = LittleShort(pTile->angle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -603,11 +603,11 @@ void SeqLoadSaveConstruct(void)
|
|||
static void ByteSwapSEQ(Seq* pSeq)
|
||||
{
|
||||
#if B_BIG_ENDIAN == 1
|
||||
pSeq->version = B_LITTLE16(pSeq->version);
|
||||
pSeq->nFrames = B_LITTLE16(pSeq->nFrames);
|
||||
pSeq->at8 = B_LITTLE16(pSeq->at8);
|
||||
pSeq->ata = B_LITTLE16(pSeq->ata);
|
||||
pSeq->atc = B_LITTLE32(pSeq->atc);
|
||||
pSeq->version = LittleShort(pSeq->version);
|
||||
pSeq->nFrames = LittleShort(pSeq->nFrames);
|
||||
pSeq->at8 = LittleShort(pSeq->at8);
|
||||
pSeq->ata = LittleShort(pSeq->ata);
|
||||
pSeq->atc = LittleLong(pSeq->atc);
|
||||
for (int i = 0; i < pSeq->nFrames; i++)
|
||||
{
|
||||
SEQFRAME* pFrame = &pSeq->frames[i];
|
||||
|
|
|
@ -55,11 +55,11 @@ int soundRates[13] = {
|
|||
void ByteSwapSFX(SFX* pSFX)
|
||||
{
|
||||
#if B_BIG_ENDIAN == 1
|
||||
pSFX->relVol = B_LITTLE32(pSFX->relVol);
|
||||
pSFX->pitch = B_LITTLE32(pSFX->pitch);
|
||||
pSFX->pitchRange = B_LITTLE32(pSFX->pitchRange);
|
||||
pSFX->format = B_LITTLE32(pSFX->format);
|
||||
pSFX->loopStart = B_LITTLE32(pSFX->loopStart);
|
||||
pSFX->relVol = LittleLong(pSFX->relVol);
|
||||
pSFX->pitch = LittleLong(pSFX->pitch);
|
||||
pSFX->pitchRange = LittleLong(pSFX->pitchRange);
|
||||
pSFX->format = LittleLong(pSFX->format);
|
||||
pSFX->loopStart = LittleLong(pSFX->loopStart);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ int tileInit(char a1, const char *a2)
|
|||
hFile.Read(voxelIndex, sizeof(voxelIndex));
|
||||
#if B_BIG_ENDIAN == 1
|
||||
for (int i = 0; i < kMaxTiles; i++)
|
||||
voxelIndex[i] = B_LITTLE16(voxelIndex[i]);
|
||||
voxelIndex[i] = LittleShort(voxelIndex[i]);
|
||||
#endif
|
||||
}
|
||||
hFile = fileSystem.OpenFileReader("SHADE.DAT");
|
||||
|
|
|
@ -66,7 +66,7 @@ void trigInit()
|
|||
#if B_BIG_ENDIAN == 1
|
||||
for (int i = 0; i < 512; i++)
|
||||
{
|
||||
costable[i] = B_LITTLE32(costable[i]);
|
||||
costable[i] = LittleLong(costable[i]);
|
||||
}
|
||||
#endif
|
||||
costable[512] = 0;
|
||||
|
|
|
@ -348,7 +348,7 @@ void viewInit(void)
|
|||
#if B_BIG_ENDIAN == 1
|
||||
for (int i = 0; i < kLensSize*kLensSize; i++)
|
||||
{
|
||||
lensTable[i] = B_LITTLE32(lensTable[i]);
|
||||
lensTable[i] = LittleLong(lensTable[i]);
|
||||
}
|
||||
#endif
|
||||
uint8_t *data = tileAllocTile(4077, kLensSize, kLensSize);
|
||||
|
|
Loading…
Reference in a new issue