mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- formatting and cleanup.
This commit is contained in:
parent
3928407eae
commit
2044f591f2
4 changed files with 37 additions and 12 deletions
|
@ -7443,7 +7443,6 @@ void HITINFO::set(hitdata_t* hit)
|
|||
{
|
||||
hitsect = hit->sect;
|
||||
hitwall = hit->wall;
|
||||
hitsprite = hit->sprite;
|
||||
hitactor = hit->sprite >= 0 ? &bloodActors[hit->sprite] : nullptr;
|
||||
hitx = hit->pos.x;
|
||||
hity = hit->pos.y;
|
||||
|
|
|
@ -373,4 +373,12 @@ void PropagateMarkerReferences(void);
|
|||
unsigned int dbReadMapCRC(const char *pPath);
|
||||
void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short *pSector, unsigned int *pCRC);
|
||||
|
||||
inline XSECTOR* getxsector(int index)
|
||||
{
|
||||
return index <= 0? nullptr : &xsector[sector[index].extra];
|
||||
}
|
||||
inline XWALL* getxwall(int index)
|
||||
{
|
||||
return index <= 0 ? nullptr : &xwall[sector[index].extra];
|
||||
}
|
||||
END_BLD_NS
|
||||
|
|
|
@ -30,7 +30,6 @@ struct HITINFO {
|
|||
DBloodActor* hitactor;
|
||||
short hitsect;
|
||||
short hitwall;
|
||||
short hitsprite;
|
||||
int hitx;
|
||||
int hity;
|
||||
int hitz;
|
||||
|
@ -38,7 +37,6 @@ struct HITINFO {
|
|||
void clearObj()
|
||||
{
|
||||
hitsect = hitwall = -1;
|
||||
hitsprite = -1;
|
||||
hitactor = nullptr;
|
||||
}
|
||||
void set(hitdata_t* hit);
|
||||
|
|
|
@ -1336,20 +1336,20 @@ void nnExtProcessSuperSprites()
|
|||
|
||||
if (pXSightSpr->unused3 & kTriggerSpriteAim)
|
||||
{
|
||||
bool vector = (sprite[index].cstat & CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
bool vector = (pSightSpr->cstat & CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
if (!vector)
|
||||
sprite[index].cstat |= CSTAT_SPRITE_BLOCK_HITSCAN;
|
||||
pSightSpr->cstat |= CSTAT_SPRITE_BLOCK_HITSCAN;
|
||||
|
||||
HitScan(pPlaySprite, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, CLIPMASK0 | CLIPMASK1, 0);
|
||||
|
||||
//VectorScan(pPlaySprite, 0, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, 0, 1);
|
||||
|
||||
if (!vector)
|
||||
sprite[index].cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
|
||||
pSightSpr->cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
|
||||
|
||||
if (gHitInfo.hitsprite == index)
|
||||
if (gHitInfo.hitactor == gSightSpritesList[i])
|
||||
{
|
||||
trTriggerSprite(index, pXSightSpr, kCmdSpriteSight);
|
||||
trTriggerSprite(gHitInfo.hitactor, kCmdSpriteSight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7344,7 +7344,13 @@ bool isActive(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
int getDataFieldOfObject(int objType, int objIndex, DBloodActor* actor, int dataIndex)
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int getDataFieldOfObject(int objType, int objIndex, DBloodActor* actor, int dataIndex)
|
||||
{
|
||||
int data = -65535;
|
||||
switch (objType)
|
||||
|
@ -7369,6 +7375,12 @@ int getDataFieldOfObject(int objType, int objIndex, DBloodActor* actor, int data
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool setDataValueOfObject(int objType, int objIndex, DBloodActor* objActor, int dataIndex, int value)
|
||||
{
|
||||
switch (objType)
|
||||
|
@ -7450,7 +7462,12 @@ bool setDataValueOfObject(int objType, int objIndex, DBloodActor* objActor, int
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// a replacement of vanilla CanMove for patrol dudes
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool nnExtCanMove(spritetype* pSprite, int nTarget, int nAngle, int nRange) {
|
||||
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
|
@ -7458,7 +7475,7 @@ bool nnExtCanMove(spritetype* pSprite, int nTarget, int nAngle, int nRange) {
|
|||
HitScan(pSprite, z, Cos(nAngle) >> 16, Sin(nAngle) >> 16, 0, CLIPMASK0, nRange);
|
||||
int nDist = approxDist(x - gHitInfo.hitx, y - gHitInfo.hity);
|
||||
if (nTarget >= 0 && nDist - (pSprite->clipdist << 2) < nRange)
|
||||
return (nTarget == gHitInfo.hitsprite);
|
||||
return (nTarget == gHitInfo.hitactor->s().index);
|
||||
|
||||
x += MulScale(nRange, Cos(nAngle), 30);
|
||||
y += MulScale(nRange, Sin(nAngle), 30);
|
||||
|
@ -7476,8 +7493,12 @@ bool nnExtCanMove(spritetype* pSprite, int nTarget, int nAngle, int nRange) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// a replacement of vanilla aiChooseDirection for patrol dudes
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void nnExtAiSetDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3) {
|
||||
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
|
@ -7514,7 +7535,6 @@ void nnExtAiSetDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3) {
|
|||
if (!nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang + pXSprite->dodgeDir * 512, 512))
|
||||
pXSprite->dodgeDir = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue