mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- actSpawnSprite, ZONE, startsectnum and dbLoadMap
This commit is contained in:
parent
b187f3c028
commit
443cfc991c
12 changed files with 39 additions and 39 deletions
|
@ -524,7 +524,7 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
}
|
||||
|
||||
|
||||
void qloadboard(const char* filename, char flags, vec3_t* dapos, int16_t* daang, int* dacursectnum);
|
||||
void qloadboard(const char* filename, char flags, vec3_t* dapos, int16_t* daang);
|
||||
|
||||
|
||||
// loads a map into the backup buffer.
|
||||
|
@ -536,7 +536,7 @@ void loadMapBackup(const char* filename)
|
|||
|
||||
if (isBlood())
|
||||
{
|
||||
qloadboard(filename, 0, &pos, &scratch, &scratch2);
|
||||
qloadboard(filename, 0, &pos, &scratch);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2761,12 +2761,12 @@ static void actNapalmMove(DBloodActor* actor)
|
|||
static DBloodActor* actSpawnFloor(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
int sector = pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
int x = pSprite->x;
|
||||
int y = pSprite->y;
|
||||
updatesector(x, y, §or);
|
||||
int zFloor = getflorzofslope(sector, x, y);
|
||||
auto spawned = actSpawnSprite(sector, x, y, zFloor, 3, 0);
|
||||
updatesector(x, y, &pSector);
|
||||
int zFloor = getflorzofslopeptr(pSector, x, y);
|
||||
auto spawned = actSpawnSprite(pSector, x, y, zFloor, 3, 0);
|
||||
if (spawned) spawned->s().cstat &= ~257;
|
||||
return spawned;
|
||||
}
|
||||
|
@ -5517,7 +5517,7 @@ void actExplodeSprite(DBloodActor* actor)
|
|||
|
||||
case kThingTNTBarrel:
|
||||
{
|
||||
auto spawned = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0, 1);
|
||||
auto spawned = actSpawnSprite(pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0, 1);
|
||||
spawned->SetOwner(actor->GetOwner());
|
||||
if (actCheckRespawn(actor))
|
||||
{
|
||||
|
@ -5892,7 +5892,6 @@ static void actCheckExplosion()
|
|||
int x = pSprite->x;
|
||||
int y = pSprite->y;
|
||||
int z = pSprite->z;
|
||||
int nSector = pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
int radius = pExplodeInfo->radius;
|
||||
|
||||
|
@ -6319,9 +6318,9 @@ void actProcessSprites(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool setextra)
|
||||
DBloodActor* actSpawnSprite(sectortype* pSector, int x, int y, int z, int nStat, bool setextra)
|
||||
{
|
||||
DBloodActor* actor = InsertSprite(nSector, nStat);
|
||||
DBloodActor* actor = InsertSprite(pSector, nStat);
|
||||
|
||||
vec3_t pos = { x, y, z };
|
||||
setActorPos(actor, &pos);
|
||||
|
@ -6346,7 +6345,7 @@ DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool se
|
|||
DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
|
||||
{
|
||||
auto pSource = &source->s();
|
||||
DBloodActor* actor = InsertSprite(pSource->sectnum, nStat);
|
||||
DBloodActor* actor = InsertSprite(pSource->sector(), nStat);
|
||||
|
||||
spritetype* pSprite = &actor->s();
|
||||
pSprite->x = pSource->x;
|
||||
|
@ -6447,7 +6446,7 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, int a3, int a4)
|
|||
DBloodActor* actSpawnThing(int nSector, int x, int y, int z, int nThingType)
|
||||
{
|
||||
assert(nThingType >= kThingBase && nThingType < kThingMax);
|
||||
auto actor = actSpawnSprite(nSector, x, y, z, 4, 1);
|
||||
auto actor = actSpawnSprite(§or[nSector], x, y, z, 4, 1);
|
||||
spritetype* pSprite = &actor->s();
|
||||
int nType = nThingType - kThingBase;
|
||||
pSprite->type = nThingType;
|
||||
|
@ -6678,7 +6677,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
|
|||
y = gHitInfo.hity - MulScale(pMissileInfo->clipDist << 1, Sin(pSprite->ang), 28);
|
||||
}
|
||||
}
|
||||
auto spawned = actSpawnSprite(pSprite->sectnum, x, y, z, 5, 1);
|
||||
auto spawned = actSpawnSprite(pSprite->sector(), x, y, z, 5, 1);
|
||||
spritetype* pMissile = &spawned->s();
|
||||
pMissile->cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||
pMissile->type = nType;
|
||||
|
|
|
@ -224,7 +224,7 @@ void actAirDrag(DBloodActor *pSprite, int a2);
|
|||
void actExplodeSprite(DBloodActor *pSprite);
|
||||
void actActivateGibObject(DBloodActor *actor);
|
||||
void actProcessSprites(void);
|
||||
DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool a6);
|
||||
DBloodActor* actSpawnSprite(sectortype* pSector, int x, int y, int z, int nStat, bool a6);
|
||||
DBloodActor* actSpawnDude(DBloodActor* pSource, int nType, int a3, int a4);
|
||||
DBloodActor * actSpawnSprite(DBloodActor *pSource, int nStat);
|
||||
DBloodActor * actSpawnThing(int nSector, int x, int y, int z, int nThingType);
|
||||
|
|
|
@ -1887,7 +1887,7 @@ bool doExplosion(DBloodActor* actor, int nType)
|
|||
{
|
||||
auto const pSprite = &actor->s();
|
||||
|
||||
auto actExplosion = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, kStatExplosion, true);
|
||||
auto actExplosion = actSpawnSprite(pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, kStatExplosion, true);
|
||||
auto const pExplosion = &actExplosion->s();
|
||||
auto const pXExplosion = &actExplosion->x();
|
||||
if (!actExplosion->hasX())
|
||||
|
|
|
@ -61,7 +61,7 @@ PLAYER gPlayerTemp[kMaxPlayers];
|
|||
int gHealthTemp[kMaxPlayers];
|
||||
vec3_t startpos;
|
||||
int16_t startang;
|
||||
int startsectnum;
|
||||
sectortype* startsector;
|
||||
|
||||
|
||||
void QuitGame(void)
|
||||
|
@ -111,7 +111,7 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
}
|
||||
}
|
||||
//drawLoadingScreen();
|
||||
dbLoadMap(currentLevel->fileName, (int*)&startpos.x, (int*)&startpos.y, (int*)&startpos.z, &startang, &startsectnum, nullptr);
|
||||
dbLoadMap(currentLevel->fileName, (int*)&startpos.x, (int*)&startpos.y, (int*)&startpos.z, &startang, &startsector, nullptr);
|
||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||
STAT_NewLevel(currentLevel->fileName);
|
||||
wsrand(dbReadMapCRC(currentLevel->LabelName()));
|
||||
|
@ -149,12 +149,12 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
Printf(PRINT_NONOTIFY, "> Modern types erased: %d.\n", modernTypesErased);
|
||||
#endif
|
||||
|
||||
startpos.z = getflorzofslope(startsectnum, startpos.x, startpos.y);
|
||||
startpos.z = getflorzofslopeptr(startsector, startpos.x, startpos.y);
|
||||
for (int i = 0; i < kMaxPlayers; i++) {
|
||||
gStartZone[i].x = startpos.x;
|
||||
gStartZone[i].y = startpos.y;
|
||||
gStartZone[i].z = startpos.z;
|
||||
gStartZone[i].sectnum = startsectnum;
|
||||
gStartZone[i].sector = startsector;
|
||||
gStartZone[i].ang = startang;
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
|
@ -163,13 +163,13 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
gStartZoneTeam1[i].x = startpos.x;
|
||||
gStartZoneTeam1[i].y = startpos.y;
|
||||
gStartZoneTeam1[i].z = startpos.z;
|
||||
gStartZoneTeam1[i].sectnum = startsectnum;
|
||||
gStartZoneTeam1[i].sector = startsector;
|
||||
gStartZoneTeam1[i].ang = startang;
|
||||
|
||||
gStartZoneTeam2[i].x = startpos.x;
|
||||
gStartZoneTeam2[i].y = startpos.y;
|
||||
gStartZoneTeam2[i].z = startpos.z;
|
||||
gStartZoneTeam2[i].sectnum = startsectnum;
|
||||
gStartZoneTeam2[i].sector = startsector;
|
||||
gStartZoneTeam2[i].ang = startang;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -162,7 +162,7 @@ void qinitspritelists(void) // Replace
|
|||
Numsprites = 0;
|
||||
}
|
||||
|
||||
DBloodActor* InsertSprite(int nSector, int nStat)
|
||||
DBloodActor* InsertSprite(sectortype* pSector, int nStat)
|
||||
{
|
||||
int nSprite = headspritestat[kMaxStatus];
|
||||
assert(nSprite < kMaxSprites);
|
||||
|
@ -177,7 +177,7 @@ DBloodActor* InsertSprite(int nSector, int nStat)
|
|||
spritetype *pSprite = &actor->s();
|
||||
memset(pSprite, 0, sizeof(spritetype));
|
||||
InsertSpriteStat(nSprite, nStat);
|
||||
InsertSpriteSect(nSprite, nSector);
|
||||
InsertSpriteSect(nSprite, sectnum(pSector));
|
||||
pSprite->cstat = 128;
|
||||
pSprite->clipdist = 32;
|
||||
pSprite->xrepeat = pSprite->yrepeat = 64;
|
||||
|
@ -393,7 +393,7 @@ struct walltypedisk
|
|||
#pragma pack(pop)
|
||||
|
||||
|
||||
void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* pSector, unsigned int* pCRC)
|
||||
void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sectortype** pSector, unsigned int* pCRC)
|
||||
{
|
||||
int16_t tpskyoff[256];
|
||||
ClearAutomap();
|
||||
|
@ -463,7 +463,6 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
*pY = mapHeader.y;
|
||||
*pZ = mapHeader.z;
|
||||
*pAngle = mapHeader.ang;
|
||||
*pSector = mapHeader.sect;
|
||||
gVisibility = g_visibility = mapHeader.visibility;
|
||||
gMattId = mapHeader.mattid;
|
||||
if (encrypted)
|
||||
|
@ -493,6 +492,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
#if 1 // bad, bad hack, just for making Polymost happy...
|
||||
PolymostAllocFakeSector();
|
||||
#endif
|
||||
* pSector = §or[mapHeader.sect];
|
||||
|
||||
dbInit();
|
||||
if (encrypted)
|
||||
|
@ -970,9 +970,10 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
END_BLD_NS
|
||||
|
||||
// only used by the backup loader.
|
||||
void qloadboard(const char* filename, char flags, vec3_t* dapos, int16_t* daang, int* dacursectnum)
|
||||
void qloadboard(const char* filename, char flags, vec3_t* dapos, int16_t* daang)
|
||||
{
|
||||
Blood::dbLoadMap(filename, &dapos->x, &dapos->y, &dapos->z, daang, dacursectnum, NULL);
|
||||
sectortype* sp;
|
||||
Blood::dbLoadMap(filename, &dapos->x, &dapos->y, &dapos->z, daang, &sp, NULL);
|
||||
Blood::dbInit(); // clean up immediately.
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ void RemoveSpriteSect(int nSprite);
|
|||
void InsertSpriteStat(int nSprite, int nStat);
|
||||
void RemoveSpriteStat(int nSprite);
|
||||
void qinitspritelists(void);
|
||||
DBloodActor* InsertSprite(int nSector, int nStat);
|
||||
DBloodActor* InsertSprite(sectortype* pSector, int nStat);
|
||||
int DeleteSprite(int nSprite);
|
||||
int ChangeSpriteSect(int nSprite, int nSector);
|
||||
int qchangespritesect(short nSprite, short nSector);
|
||||
|
@ -126,7 +126,7 @@ void InitFreeList(unsigned short *pList, int nCount);
|
|||
void dbInit(void);
|
||||
void PropagateMarkerReferences(void);
|
||||
unsigned int dbReadMapCRC(const char *pPath);
|
||||
void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* pSector, unsigned int* pCRC);
|
||||
void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sectortype** pSector, unsigned int* pCRC);
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -161,7 +161,7 @@ DBloodActor* CFX::fxSpawnActor(FX_ID nFx, int nSector, int x, int y, int z, unsi
|
|||
return nullptr;
|
||||
destroy(iactor);
|
||||
}
|
||||
auto actor = actSpawnSprite(nSector, x, y, z, 1, 0);
|
||||
auto actor = actSpawnSprite(§or[nSector], x, y, z, 1, 0);
|
||||
spritetype* pSprite = &actor->s();
|
||||
pSprite->type = nFx;
|
||||
pSprite->picnum = pFX->picnum;
|
||||
|
|
|
@ -58,7 +58,7 @@ void WeaponPrecache();
|
|||
|
||||
struct ZONE {
|
||||
int x, y, z;
|
||||
int sectnum;
|
||||
sectortype* sector;
|
||||
short ang;
|
||||
};
|
||||
extern ZONE gStartZone[8];
|
||||
|
|
|
@ -3590,7 +3590,7 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector
|
|||
{
|
||||
if (pXSource->data3 > 0)
|
||||
{
|
||||
auto spawned = InsertSprite(pSprite->sectnum, kStatDecoration);
|
||||
auto spawned = InsertSprite(pSprite->sector(), kStatDecoration);
|
||||
auto pSpawned = &spawned->s();
|
||||
int top, bottom; GetActorExtents(spawned, &top, &bottom);
|
||||
pSpawned->x = pSprite->x;
|
||||
|
|
|
@ -637,7 +637,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
|
||||
if (maxRetries != 0) {
|
||||
// check if there is no spawned player in selected zone
|
||||
BloodSectIterator it(pStartZone->sectnum);
|
||||
BloodSectIterator it(pStartZone->sector);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
spritetype* pSprite = &act->s();
|
||||
|
@ -658,7 +658,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
pStartZone = &gStartZone[Random(8)];
|
||||
}
|
||||
|
||||
auto actor = actSpawnSprite(pStartZone->sectnum, pStartZone->x, pStartZone->y, pStartZone->z, 6, 1);
|
||||
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->x, pStartZone->y, pStartZone->z, 6, 1);
|
||||
spritetype* pSprite = &actor->s();
|
||||
assert(actor->hasX());
|
||||
XSPRITE *pXSprite = &actor->x();
|
||||
|
|
|
@ -73,7 +73,7 @@ void warpInit(void)
|
|||
pZone->x = pSprite->x;
|
||||
pZone->y = pSprite->y;
|
||||
pZone->z = pSprite->z;
|
||||
pZone->sectnum = pSprite->sectnum;
|
||||
pZone->sector = pSprite->sector();
|
||||
pZone->ang = pSprite->ang;
|
||||
}
|
||||
DeleteSprite(actor);
|
||||
|
@ -86,7 +86,7 @@ void warpInit(void)
|
|||
pZone->x = pSprite->x;
|
||||
pZone->y = pSprite->y;
|
||||
pZone->z = pSprite->z;
|
||||
pZone->sectnum = pSprite->sectnum;
|
||||
pZone->sector = pSprite->sector();
|
||||
pZone->ang = pSprite->ang;
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
|
@ -97,7 +97,7 @@ void warpInit(void)
|
|||
pZone->x = pSprite->x;
|
||||
pZone->y = pSprite->y;
|
||||
pZone->z = pSprite->z;
|
||||
pZone->sectnum = pSprite->sectnum;
|
||||
pZone->sector = pSprite->sector();
|
||||
pZone->ang = pSprite->ang;
|
||||
team1++;
|
||||
|
||||
|
@ -106,7 +106,7 @@ void warpInit(void)
|
|||
pZone->x = pSprite->x;
|
||||
pZone->y = pSprite->y;
|
||||
pZone->z = pSprite->z;
|
||||
pZone->sectnum = pSprite->sectnum;
|
||||
pZone->sector = pSprite->sector();
|
||||
pZone->ang = pSprite->ang;
|
||||
team2++;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ZONE& w, ZONE* def
|
|||
arc("x", w.x)
|
||||
("y", w.y)
|
||||
("z", w.z)
|
||||
("sector", w.sectnum)
|
||||
("sector", w.sector)
|
||||
("angle", w.ang)
|
||||
.EndObject();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue