- spawn functions.

This commit is contained in:
Christoph Oelckers 2021-11-23 00:35:29 +01:00
parent 40ae38c173
commit f09e7ed32f
18 changed files with 62 additions and 63 deletions

View file

@ -38,7 +38,7 @@ void BuildSplash(DExhumedActor* actor, sectortype* nSector);
// anubis
void BuildAnubis(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer);
void BuildAnubis(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, uint8_t bIsDrummer);
void FuncAnubis(int, int a, int b, int c);
// bubbles
@ -86,7 +86,7 @@ void BackUpBullet(int *x, int *y, int nAngle);
// fish
void BuildFish(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle);
void BuildFish(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle);
void FuncFish(int, int, int, int);
void FuncFishLimb(int a, int b, int c);
@ -190,7 +190,7 @@ void AddFlicker(sectortype* nSector, int nVal);
// lion
void BuildLion(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle);
void BuildLion(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle);
void FuncLion(int, int, int, int);
// move
@ -246,7 +246,7 @@ void SetQuake(DExhumedActor* nSprite, int nVal);
enum { kMaxMummies = 150 };
void BuildMummy(DExhumedActor* val, int x, int y, int z, int nSector, int nAngle);
void BuildMummy(DExhumedActor* val, int x, int y, int z, sectortype* nSector, int nAngle);
void FuncMummy(int nSector, int edx, int nRun);
// object
@ -303,7 +303,7 @@ int BuildSlide(int nChannel, walltype* edx, walltype* ebx, walltype* ecx, wallty
// queen
void InitQueens();
void BuildQueen(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, int nVal);
void BuildQueen(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, int nVal);
void FuncQueenEgg(int, int, int, int);
void FuncQueenHead(int, int, int, int);
void FuncQueen(int, int, int, int);
@ -334,17 +334,17 @@ void FuncRa(int, int, int, int);
// rat
void InitRats();
void BuildRat(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle);
void BuildRat(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle);
void FuncRat(int a, int, int b, int nRun);
// rex
void BuildRex(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, int nChannel);
void BuildRex(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel);
void FuncRex(int, int, int, int);
// roach
void BuildRoach(int nType, DExhumedActor* nSprite, int x, int y, int z, int nSector, int angle);
void BuildRoach(int nType, DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int angle);
void FuncRoach(int a, int, int nDamage, int nRun);
// runlist
@ -706,12 +706,12 @@ void runlist_ExecObjects();
// scorp
void BuildScorp(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, int nChannel);
void BuildScorp(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel);
void FuncScorp(int, int, int, int);
// set
void BuildSet(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, int nChannel);
void BuildSet(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel);
void FuncSoul(int, int, int, int);
void FuncSet(int, int, int, int);
@ -744,7 +744,7 @@ void FuncSnake(int, int, int, int);
// spider
DExhumedActor* BuildSpider(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle);
DExhumedActor* BuildSpider(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle);
void FuncSpider(int a, int, int b, int nRun);
// switch
@ -770,7 +770,7 @@ std::pair<int, int> BuildSwPressWall(int nChannel, int nLink, walltype* pWall);
// wasp
DExhumedActor* BuildWasp(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, bool bEggWasp);
DExhumedActor* BuildWasp(DExhumedActor* nSprite, int x, int y, int z, sectortype* nSector, int nAngle, bool bEggWasp);
void FuncWasp(int eax, int, int edx, int nRun);

View file

@ -43,12 +43,12 @@ static const actionSeq AnubisSeq[] = {
{ 43, 1 },
};
void BuildAnubis(DExhumedActor* ap, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer)
void BuildAnubis(DExhumedActor* ap, int x, int y, int z, sectortype* pSector, int nAngle, uint8_t bIsDrummer)
{
spritetype* sp;
if (ap == nullptr)
{
ap = insertActor(nSector, 101);
ap = insertActor(pSector, 101);
sp = &ap->s();
}
else

View file

@ -145,7 +145,7 @@ void AIFishLimb::Draw(RunListEvent* ev)
}
void BuildFish(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle)
void BuildFish(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle)
{
spritetype* pSprite;

View file

@ -410,7 +410,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildAnubis(pActor, 0, 0, 0, 0, 0, 1);
BuildAnubis(pActor, 0, 0, 0, nullptr, 0, 1);
return;
}
case 117:
@ -420,27 +420,27 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildWasp(pActor, 0, 0, 0, 0, 0, false);
BuildWasp(pActor, 0, 0, 0, nullptr, 0, false);
return;
}
case 116:
{
BuildRat(pActor, 0, 0, 0, 0, -1);
BuildRat(pActor, 0, 0, 0, nullptr, -1);
return;
}
case 115: // Rat (eating)
{
BuildRat(pActor, 0, 0, 0, 0, 0);
BuildRat(pActor, 0, 0, 0, nullptr, 0);
return;
}
case 113:
{
BuildQueen(pActor, 0, 0, 0, 0, 0, nChannel);
BuildQueen(pActor, 0, 0, 0, nullptr, 0, nChannel);
return;
}
case 112:
{
BuildScorp(pActor, 0, 0, 0, 0, 0, nChannel);
BuildScorp(pActor, 0, 0, 0, nullptr, 0, nChannel);
return;
}
case 111:
@ -450,7 +450,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildSet(pActor, 0, 0, 0, 0, 0, nChannel);
BuildSet(pActor, 0, 0, 0, nullptr, 0, nChannel);
return;
}
case 108:
@ -470,7 +470,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildRex(pActor, 0, 0, 0, 0, 0, nChannel);
BuildRex(pActor, 0, 0, 0, nullptr, 0, nChannel);
return;
}
case 106:
@ -480,7 +480,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildFish(pActor, 0, 0, 0, 0, 0);
BuildFish(pActor, 0, 0, 0, nullptr, 0);
return;
}
case 105:
@ -490,7 +490,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildSpider(pActor, 0, 0, 0, 0, 0);
BuildSpider(pActor, 0, 0, 0, nullptr, 0);
return;
}
case 104:
@ -500,7 +500,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildRoach(1, pActor, 0, 0, 0, 0, 0);
BuildRoach(1, pActor, 0, 0, 0, nullptr, 0);
return;
}
case 103:
@ -510,7 +510,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildRoach(0, pActor, 0, 0, 0, 0, 0);
BuildRoach(0, pActor, 0, 0, 0, nullptr, 0);
return;
}
case 102:
@ -520,7 +520,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildLion(pActor, 0, 0, 0, 0, 0);
BuildLion(pActor, 0, 0, 0, nullptr, 0);
return;
}
case 101:
@ -530,7 +530,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildMummy(pActor, 0, 0, 0, 0, 0);
BuildMummy(pActor, 0, 0, 0, nullptr, 0);
return;
}
case 100:
@ -540,7 +540,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
return;
}
BuildAnubis(pActor, 0, 0, 0, 0, 0, 0);
BuildAnubis(pActor, 0, 0, 0, nullptr, 0, 0);
return;
}
case 99: // underwater type 2

View file

@ -41,7 +41,7 @@ static actionSeq LionSeq[] = {
};
void BuildLion(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle)
void BuildLion(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle)
{
spritetype* pSprite;
if (pActor == nullptr)

View file

@ -37,7 +37,7 @@ static actionSeq MummySeq[] = {
};
void BuildMummy(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle)
void BuildMummy(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle)
{
spritetype* pSprite;
if (pActor == nullptr)

View file

@ -73,20 +73,20 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
if (parm->numparms != 1) return CCMD_SHOWHELP;
auto c = parm->parms[0];
auto sectp = &sector[initsect];
if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initx, inity, sectp->floorz, initsect, inita, false);
else if (!stricmp(c, "spider")) BuildSpider(nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "fish")) BuildFish(nullptr, initx, inity, initz + PlayerList[nLocalPlayer].eyelevel, initsect, inita);
else if (!stricmp(c, "lion")) BuildLion(nullptr, initx, inity, sectp->floorz, initsect, inita);
if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initx, inity, sectp->floorz, sectp, inita, false);
else if (!stricmp(c, "spider")) BuildSpider(nullptr, initx, inity, sectp->floorz, sectp, inita);
else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initx, inity, sectp->floorz, sectp, inita);
else if (!stricmp(c, "fish")) BuildFish(nullptr, initx, inity, initz + PlayerList[nLocalPlayer].eyelevel, sectp, inita);
else if (!stricmp(c, "lion")) BuildLion(nullptr, initx, inity, sectp->floorz, sectp, inita);
else if (!stricmp(c, "lava")) BuildLava(nullptr, initx, inity, sectp->floorz, sectp, inita, nNetPlayerCount);
else if (!stricmp(c, "rex")) BuildRex(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "set")) BuildSet(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "queen")) BuildQueen(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "roach")) BuildRoach(0, nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "roach2")) BuildRoach(1, nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "wasp")) BuildWasp(nullptr, initx, inity, sectp->floorz - 25600, initsect, inita, false);
else if (!stricmp(c, "scorp")) BuildScorp(nullptr, initx, inity, sectp->floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "rat")) BuildRat(nullptr, initx, inity, sectp->floorz, initsect, inita);
else if (!stricmp(c, "rex")) BuildRex(nullptr, initx, inity, sectp->floorz, sectp, inita, nNetPlayerCount);
else if (!stricmp(c, "set")) BuildSet(nullptr, initx, inity, sectp->floorz, sectp, inita, nNetPlayerCount);
else if (!stricmp(c, "queen")) BuildQueen(nullptr, initx, inity, sectp->floorz, sectp, inita, nNetPlayerCount);
else if (!stricmp(c, "roach")) BuildRoach(0, nullptr, initx, inity, sectp->floorz, sectp, inita);
else if (!stricmp(c, "roach2")) BuildRoach(1, nullptr, initx, inity, sectp->floorz, sectp, inita);
else if (!stricmp(c, "wasp")) BuildWasp(nullptr, initx, inity, sectp->floorz - 25600, sectp, inita, false);
else if (!stricmp(c, "scorp")) BuildScorp(nullptr, initx, inity, sectp->floorz, sectp, inita, nNetPlayerCount);
else if (!stricmp(c, "rat")) BuildRat(nullptr, initx, inity, sectp->floorz, sectp, inita);
else Printf("Unknown creature type %s\n", c);
return CCMD_OK;
}

View file

@ -2497,8 +2497,8 @@ sectdone:
// loc_1C201:
if (nLocalPlayer == nPlayer)
{
nLocalEyeSect = sectnum(PlayerList[nLocalPlayer].pPlayerViewSect);
CheckAmbience(nLocalEyeSect);
pLocalEyeSect = PlayerList[nLocalPlayer].pPlayerViewSect;
CheckAmbience(pLocalEyeSect);
}
int var_AC = SeqOffsets[PlayerList[nPlayer].nSeq] + PlayerSeq[nAction].a;

View file

@ -641,7 +641,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
pEgg->nCounter--;
if (pEgg->nCounter <= 0)
{
auto pWaspSprite = BuildWasp(nullptr, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, pSprite->ang, true);
auto pWaspSprite = BuildWasp(nullptr, pSprite->x, pSprite->y, pSprite->z, pSprite->sector(), pSprite->ang, true);
pSprite->z = pWaspSprite->s().z;
DestroyEgg(nEgg);
@ -1100,7 +1100,7 @@ void AIQueenHead::Draw(RunListEvent* ev)
seq_PlotSequence(ev->nParam, nSeq, QueenHead.nFrame, edx);
}
void BuildQueen(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle, int nChannel)
void BuildQueen(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel)
{
QueenCount--;

View file

@ -73,7 +73,7 @@ void SetRatVel(spritetype* pSprite)
pSprite->yvel = bsin(pSprite->ang, -2);
}
void BuildRat(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle)
void BuildRat(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle)
{
spritetype* pSprite;
if (pActor == nullptr)

View file

@ -37,7 +37,7 @@ static actionSeq RexSeq[] = {
{28, 1}
};
void BuildRex(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle, int nChannel)
void BuildRex(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel)
{
spritetype* pSprite;
if (pActor == nullptr)

View file

@ -35,7 +35,7 @@ static actionSeq RoachSeq[] = {
};
// TODO - make nType a bool?
void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, int nSector, int angle)
void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int angle)
{
spritetype* pSprite;
if (pActor == nullptr)

View file

@ -38,7 +38,7 @@ static actionSeq ScorpSeq[] = {
{53, 1}
};
void BuildScorp(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle, int nChannel)
void BuildScorp(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel)
{
spritetype* pSprite;
@ -379,7 +379,7 @@ void AIScorp::Tick(RunListEvent* ev)
return;
}
auto pSpiderActor = BuildSpider(nullptr, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, pSprite->ang);
auto pSpiderActor = BuildSpider(nullptr, pSprite->x, pSprite->y, pSprite->z, pSprite->sector(), pSprite->ang);
if (pSpiderActor)
{
auto pSpiderSprite = &pSpiderActor->s();

View file

@ -39,7 +39,7 @@ static actionSeq SetSeq[] = {
{74, 1}
};
void BuildSet(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle, int nChannel)
void BuildSet(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle, int nChannel)
{
spritetype* pSprite;
if (pActor == nullptr)

View file

@ -115,7 +115,7 @@ const char *SoundFiles[kMaxSoundFiles] =
int nStopSound;
int nStoneSound;
int nSwitchSound;
int nLocalEyeSect;
sectortype* pLocalEyeSect;
int nElevSound;
int nCreepyTimer;
@ -668,10 +668,9 @@ void PlayFXAtXYZ(unsigned int ax, int x, int y, int z, EChanFlags chanflags, int
//
//==========================================================================
void CheckAmbience(int nSector)
void CheckAmbience(sectortype* sect)
{
if (!SoundEnabled()) return;
auto sect = &sector[nSector];
if (sect->Sound != -1)
{
auto pSector2 = sect->pSoundSect;

View file

@ -108,7 +108,7 @@ extern int gFXVolume;
extern int nStopSound;
extern int nStoneSound;
extern int nSwitchSound;
extern int nLocalEyeSect;
extern sectortype* pLocalEyeSect;
extern int nElevSound;
extern int nCreepyTimer;
@ -128,7 +128,7 @@ void PlayLocalSound(int nSound, int val, bool unattached = false, EChanFlags cfl
int LoadSound(const char* sound);
void BendAmbientSound();
void CheckAmbience(int nSector);
void CheckAmbience(sectortype* nSector);
void PlayFX2(unsigned int nSound, DExhumedActor* nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0);

View file

@ -36,12 +36,12 @@ static actionSeq SpiderSeq[] = {
};
DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, int nSector, int nAngle)
DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, sectortype* pSector, int nAngle)
{
spritetype* sp;
if (spp == nullptr)
{
spp = insertActor(nSector, 99);
spp = insertActor(pSector, 99);
sp = &spp->s();
}
else

View file

@ -40,7 +40,7 @@ void SetWaspVel(spritetype* pSprite)
pSprite->yvel = bsin(pSprite->ang);
}
DExhumedActor* BuildWasp(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle, bool bEggWasp)
DExhumedActor* BuildWasp(DExhumedActor* pActor, int x, int y, int z, sectortype* nSector, int nAngle, bool bEggWasp)
{
spritetype* pSprite;
if (pActor == nullptr)