mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- made nBodySprite an actor array.
# Conflicts: # source/games/exhumed/src/aistuff.h # source/games/exhumed/src/player.cpp # Conflicts: # source/games/exhumed/src/aistuff.h # source/games/exhumed/src/player.cpp
This commit is contained in:
parent
dbe4aa3515
commit
c2467dc47b
4 changed files with 22 additions and 19 deletions
|
@ -228,7 +228,7 @@ extern BlockInfo sBlockInfo[];
|
|||
|
||||
extern int hihit;
|
||||
extern short nChunkSprite[];
|
||||
extern short nBodySprite[];
|
||||
extern DExhumedActor* nBodySprite[];
|
||||
|
||||
signed int lsqrt(int a1);
|
||||
void MoveThings();
|
||||
|
@ -241,7 +241,7 @@ int MoveCreature(short nSprite);
|
|||
int MoveCreatureWithCaution(int nSprite);
|
||||
void WheresMyMouth(int nPlayer, int *x, int *y, int *z, short *sectnum);
|
||||
int GetSpriteHeight(int nSprite);
|
||||
int GrabBody();
|
||||
DExhumedActor* GrabBody();
|
||||
int GrabBodyGunSprite();
|
||||
void CreatePushBlock(int nSector);
|
||||
void FuncCreatureChunk(int a, int, int nRun);
|
||||
|
|
|
@ -38,7 +38,7 @@ short nPushBlocks;
|
|||
short overridesect;
|
||||
short NearCount = -1;
|
||||
|
||||
short nBodySprite[50];
|
||||
DExhumedActor* nBodySprite[50];
|
||||
|
||||
int hihit, sprceiling, sprfloor, lohit;
|
||||
|
||||
|
@ -1324,7 +1324,7 @@ void InitChunks()
|
|||
nCurChunkNum = 0;
|
||||
memset(nChunkSprite, -1, sizeof(nChunkSprite));
|
||||
memset(nBodyGunSprite, -1, sizeof(nBodyGunSprite));
|
||||
memset(nBodySprite, -1, sizeof(nBodySprite));
|
||||
memset(nBodySprite, 0, sizeof(nBodySprite));
|
||||
nCurBodyNum = 0;
|
||||
nCurBodyGunNum = 0;
|
||||
nBodyTotal = 0;
|
||||
|
@ -1367,23 +1367,24 @@ int GrabBodyGunSprite()
|
|||
return nSprite;
|
||||
}
|
||||
|
||||
int GrabBody()
|
||||
DExhumedActor GrabBody()
|
||||
{
|
||||
int nSprite;
|
||||
|
||||
DExhumedActor* pActor = nullptr;
|
||||
spritetype* pSprite = nullptr;
|
||||
do
|
||||
{
|
||||
nSprite = nBodySprite[nCurBodyNum];
|
||||
pSprite = &sprite[nSprite];
|
||||
pActor = nBodySprite[nCurBodyNum];
|
||||
|
||||
if (nSprite == -1)
|
||||
if (pActor == nullptr)
|
||||
{
|
||||
nSprite = insertsprite(0, 899);
|
||||
pSprite = &sprite[nSprite];
|
||||
nBodySprite[nCurBodyNum] = nSprite;
|
||||
pActor = insertActor(0, 899);
|
||||
pSprite = &pActor->s();
|
||||
nBodySprite[nCurBodyNum] = pActor;
|
||||
pSprite->cstat = 0x8000;
|
||||
}
|
||||
else
|
||||
pSprite = &pActor->s();
|
||||
|
||||
|
||||
nCurBodyNum++;
|
||||
if (nCurBodyNum >= 50) {
|
||||
|
@ -1396,7 +1397,7 @@ int GrabBody()
|
|||
}
|
||||
|
||||
pSprite->cstat = 0;
|
||||
return nSprite;
|
||||
return pActor;
|
||||
}
|
||||
|
||||
int GrabChunkSprite()
|
||||
|
|
|
@ -49,6 +49,7 @@ extern int lPlayerYVel;
|
|||
|
||||
struct Player
|
||||
{
|
||||
DExhumedActor* Actor() { return nSprite == -1? nullptr : &exhumedActors[nSprite]; }
|
||||
short nHealth;
|
||||
short nLives;
|
||||
short nDouble;
|
||||
|
|
|
@ -190,13 +190,14 @@ int FindFood(short nSprite)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int nSprite2 = nBodySprite[RandomSize(7) % nBodyTotal];
|
||||
if (nSprite2 != -1)
|
||||
auto pActor2 = nBodySprite[RandomSize(7) % nBodyTotal];
|
||||
if (pActor2 != nullptr)
|
||||
{
|
||||
if (nPlayerPic == sprite[nSprite2].picnum)
|
||||
auto pSprite2 = &pActor2->s();
|
||||
if (nPlayerPic == pSprite2->picnum)
|
||||
{
|
||||
if (cansee(x, y, z, nSector, sprite[nSprite2].x, sprite[nSprite2].y, sprite[nSprite2].z, sprite[nSprite2].sectnum)) {
|
||||
return nSprite2;
|
||||
if (cansee(x, y, z, nSector, pSprite2->x, pSprite2->y, pSprite2->z, pSprite2->sectnum)) {
|
||||
return pActor2->GetSpriteIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue