Blood: workaround dudeInfo OOB issue

# Conflicts:
#	source/blood/src/actor.cpp
#	source/blood/src/demo.cpp
#	source/blood/src/dude.cpp
#	source/blood/src/dude.h
This commit is contained in:
nukeykt 2020-02-06 06:17:05 +09:00 committed by Christoph Oelckers
parent 215cb14401
commit 9cc4d9f432
31 changed files with 200 additions and 189 deletions

View file

@ -2787,7 +2787,7 @@ void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6)
int mass = 0;
if (IsDudeSprite(pSprite)) {
mass = dudeInfo[pSprite->type - kDudeBase].mass;
mass = getDudeInfo(pSprite->type)->mass;
#ifdef NOONE_EXTENSIONS
switch (pSprite->type) {
case kDudeModernCustom:
@ -3342,7 +3342,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
break;
}
if (!gSysRes.Lookup(dudeInfo[nType].seqStartID + nSeq, "SEQ"))
if (!gSysRes.Lookup(getDudeInfo(nType+kDudeBase)->seqStartID + nSeq, "SEQ"))
{
seqKill(3, nXSprite);
gKillMgr.AddKill(pSprite);
@ -3651,13 +3651,13 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
seqSpawn(dudeInfo[nType].seqStartID+12, 3, nXSprite, nDudeToGibClient1);
break;
default:
seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1);
seqSpawn(getDudeInfo(nType+kDudeBase)->seqStartID+nSeq, 3, nXSprite, -1);
break;
}
if (damageType == DAMAGE_TYPE_3)
{
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
for (int i = 0; i < 3; i++)
if (pDudeInfo->nGibType[i] > -1)
GibSprite(pSprite, (GIBTYPE)pDudeInfo->nGibType[i], NULL, NULL);
@ -3695,7 +3695,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
//ThrowError("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & 16) ? "RESPAWN" : "NORMAL");
}
int nType = pSprite->type - kDudeBase; int nDamageFactor = dudeInfo[nType].at70[damageType];
int nType = pSprite->type - kDudeBase; int nDamageFactor = getDudeInfo(nType+kDudeBase)->at70[damageType];
#ifdef NOONE_EXTENSIONS
if (pSprite->type == kDudeModernCustom)
nDamageFactor = gGenDudeExtra[pSprite->index].dmgControl[damageType];
@ -3884,7 +3884,7 @@ void actImpactMissile(spritetype *pMissile, int hitCode)
pThingInfo = &thingInfo[pSpriteHit->type - kThingBase];
break;
case kStatDude:
pDudeInfo = &dudeInfo[pSpriteHit->type - kDudeBase];
pDudeInfo = getDudeInfo(pSpriteHit->type);
break;
}
}
@ -3905,7 +3905,7 @@ void actImpactMissile(spritetype *pMissile, int hitCode)
if (IsDudeSprite(pSource) && pXSource != NULL && pXSource->health != 0)
actHealDude(pXSource, nDamage >> 2, dudeInfo[pSource->type - kDudeBase].startHealth);
actHealDude(pXSource, nDamage >> 2, getDudeInfo(pSource->type)->startHealth);
}
}
@ -4115,7 +4115,7 @@ void actImpactMissile(spritetype *pMissile, int hitCode)
XSPRITE *pXOwner = &xsprite[pOwner->extra];
int nType = pOwner->type-kDudeBase;
if (pXOwner->health > 0)
actHealDude(pXOwner, 10, dudeInfo[nType].startHealth);
actHealDude(pXOwner, 10, getDudeInfo(nType+kDudeBase)->startHealth);
}
}
break;
@ -4241,8 +4241,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
// add size shroom abilities
if ((IsPlayerSprite(pSprite) && isShrinked(pSprite)) || (IsPlayerSprite(pSprite2) && isGrown(pSprite2))) {
int mass1 = dudeInfo[pSprite2->type - kDudeBase].mass;
int mass2 = dudeInfo[pSprite->type - kDudeBase].mass;
int mass1 = getDudeInfo(pSprite2->type)->mass;
int mass2 = getDudeInfo(pSprite->type)->mass;
switch (pSprite->type) {
case kDudeModernCustom:
case kDudeModernCustomBurning:
@ -4316,8 +4316,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
// add size shroom abilities
if ((IsPlayerSprite(pSprite2) && isShrinked(pSprite2)) || (IsPlayerSprite(pSprite) && isGrown(pSprite))) {
if (xvel[pSprite->xvel] != 0 && IsDudeSprite(pSprite2)) {
int mass1 = dudeInfo[pSprite->type - kDudeBase].mass;
int mass2 = dudeInfo[pSprite2->type - kDudeBase].mass;
int mass1 = getDudeInfo(pSprite->type)->mass;
int mass2 = getDudeInfo(pSprite2->type)->mass;
switch (pSprite2->type) {
case kDudeModernCustom:
case kDudeModernCustomBurning:
@ -4373,8 +4373,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
// add size shroom abilities
if ((IsPlayerSprite(pSprite2) && isShrinked(pSprite2)) || (IsPlayerSprite(pSprite) && isGrown(pSprite))) {
int mass1 = dudeInfo[pSprite->type - kDudeBase].mass;
int mass2 = dudeInfo[pSprite2->type - kDudeBase].mass;
int mass1 = getDudeInfo(pSprite->type)->mass;
int mass2 = getDudeInfo(pSprite2->type)->mass;
switch (pSprite2->type) {
case kDudeModernCustom:
case kDudeModernCustomBurning:
@ -4717,7 +4717,7 @@ void MoveDude(spritetype *pSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
int bz = (bottom-pSprite->z)/4;
@ -6231,10 +6231,10 @@ void actProcessSprites(void)
pXIncarnation->key = pXIncarnation->dropMsg = 0;
// set hp
if (pXSprite->data4 <= 0) pXSprite->health = dudeInfo[pSprite->type - kDudeBase].startHealth << 4;
if (pXSprite->data4 <= 0) pXSprite->health = getDudeInfo(pSprite->type)->startHealth << 4;
else pXSprite->health = ClipRange(pXSprite->data4 << 4, 1, 65535);
int seqId = dudeInfo[pSprite->type - kDudeBase].seqStartID;
int seqId = getDudeInfo(pSprite->type)->seqStartID;
switch (pSprite->type) {
case kDudePodMother: // fake dude
case kDudeTentacleMother: // fake dude
@ -6491,11 +6491,11 @@ spritetype *actSpawnDude(spritetype *pSource, short nType, int a3, int a4)
vec3_t pos = { x, y, z };
setsprite(pSprite2->index, &pos);
pSprite2->cstat |= 0x1101;
pSprite2->clipdist = dudeInfo[nDude].clipdist;
pXSprite2->health = dudeInfo[nDude].startHealth<<4;
pSprite2->clipdist = getDudeInfo(nDude+kDudeBase)->clipdist;
pXSprite2->health = getDudeInfo(nDude+kDudeBase)->startHealth<<4;
pXSprite2->respawn = 1;
if (gSysRes.Lookup(dudeInfo[nDude].seqStartID, "SEQ"))
seqSpawn(dudeInfo[nDude].seqStartID, 3, pSprite2->extra, -1);
if (gSysRes.Lookup(getDudeInfo(nDude+kDudeBase)->seqStartID, "SEQ"))
seqSpawn(getDudeInfo(nDude+kDudeBase)->seqStartID, 3, pSprite2->extra, -1);
#ifdef NOONE_EXTENSIONS
// add a way to inherit some values of spawner type 18 by dude.
@ -7027,7 +7027,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
}
if (pSprite->statnum == kStatDude)
{
int t = pSprite->type == kThingBloodChunks ? 0 : dudeInfo[pSprite->type-kDudeBase].mass;
int t = getDudeInfo(pSprite->type)->mass;
#ifdef NOONE_EXTENSIONS
if (IsDudeSprite(pSprite)) {
@ -7494,7 +7494,7 @@ spritetype* actSpawnCustomDude(spritetype* pSprite, int nDist) {
pDude->type = nType; pDude->ang = nAngle;
vec3_t pos = { x, y, z }; setsprite(pDude->index, &pos);
pDude->cstat |= 0x1101; pDude->clipdist = dudeInfo[nType - kDudeBase].clipdist;
pDude->cstat |= 0x1101; pDude->clipdist = getDudeInfo(nType)->clipdist;
// inherit weapon, seq and sound settings.
pXDude->data1 = pXSource->data1;
@ -7512,7 +7512,7 @@ spritetype* actSpawnCustomDude(spritetype* pSprite, int nDist) {
if (pSource->clipdist > 0) pDude->clipdist = pSource->clipdist;
// inherit custom hp settings
if (pXSource->data4 <= 0) pXDude->health = dudeInfo[nType - kDudeBase].startHealth << 4;
if (pXSource->data4 <= 0) pXDude->health = getDudeInfo(nType)->startHealth << 4;
else pXDude->health = ClipRange(pXSource->data4 << 4, 1, 65535);
@ -7566,7 +7566,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
clipDist = gGenDudeExtra[pSprite->index].initVals[2];
break;
default:
seqId = dudeInfo[pSprite->type - kDudeBase].seqStartID;
seqId = getDudeInfo(pSprite->type)->seqStartID;
break;
}
@ -7910,7 +7910,7 @@ bool isImmune(spritetype* pSprite, int dmgType, int minScale) {
else if (IsDudeSprite(pSprite)) {
if (IsPlayerSprite(pSprite)) return (gPlayer[pSprite->type - kDudePlayer1].damageControl[dmgType] <= minScale);
else if (pSprite->type == kDudeModernCustom) return (gGenDudeExtra[pSprite->index].dmgControl[dmgType] <= minScale);
else return (dudeInfo[pSprite->type - kDudeBase].at70[dmgType] <= minScale);
else return (getDudeInfo(pSprite->type)->at70[dmgType] <= minScale);
}
}

View file

@ -95,7 +95,7 @@ bool sub_5BDA8(spritetype *pSprite, int nSeq)
{
if (pSprite->statnum == kStatDude && pSprite->type >= kDudeBase && pSprite->type < kDudeMax)
{
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
if (seqGetID(3, pSprite->extra) == pDudeInfo->seqStartID + nSeq && seqGetStatus(3, pSprite->extra) >= 0)
return true;
}
@ -118,7 +118,7 @@ void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4)
void aiNewState(spritetype *pSprite, XSPRITE *pXSprite, AISTATE *pAIState)
{
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
pXSprite->stateTimer = pAIState->stateTicks;
pXSprite->aiState = pAIState;
int seqStartId = pDudeInfo->seqStartID;
@ -305,7 +305,7 @@ void aiMoveForward(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -318,7 +318,7 @@ void aiMoveForward(spritetype *pSprite, XSPRITE *pXSprite)
void aiMoveTurn(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -328,7 +328,7 @@ void aiMoveDodge(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -910,7 +910,7 @@ void aiSetTarget(XSPRITE *pXSprite, int nTarget)
if (actSpriteOwnerToSpriteId(&sprite[pXSprite->reference]) != nTarget)
{
pXSprite->target = nTarget;
DUDEINFO *pDudeInfo = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pTarget->type);
pXSprite->targetX = pTarget->x;
pXSprite->targetY = pTarget->y;
pXSprite->targetZ = pTarget->z-((pDudeInfo->eyeHeight*pTarget->yrepeat)<<2);
@ -926,7 +926,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
return 0;
pXSprite->health = ClipLow(pXSprite->health - nDamage, 0);
cumulDamage[pSprite->extra] += nDamage;
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nSprite = pXSprite->reference;
if (nSource >= 0)
{
@ -1127,7 +1127,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
char v4 = Chance(0x8000);
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
if (pSprite->statnum == kStatDude && (pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
switch (pSprite->type) {
#ifdef NOONE_EXTENSIONS
case kDudeModernCustom: {
@ -1371,7 +1371,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
void aiThinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
if (Chance(pDudeInfo->alertChance))
{
for (int p = connecthead; p >= 0; p = connectpoint2[p])
@ -1410,7 +1410,7 @@ void aiThinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
void sub_5F15C(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
if (Chance(pDudeInfo->alertChance))
{
for (int p = connecthead; p >= 0; p = connectpoint2[p])
@ -1457,7 +1457,7 @@ void sub_5F15C(spritetype *pSprite, XSPRITE *pXSprite)
int nDist = approxDist(dx, dy);
if (pSprite2->type == kDudeInnocent)
{
DUDEINFO *pDudeInfo = &dudeInfo[pSprite2->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite2->type);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue;
int UNUSED(nAngle) = getangle(dx,dy);
@ -1475,7 +1475,7 @@ void aiProcessDudes(void) {
spritetype *pSprite = &sprite[nSprite];
if (pSprite->flags & 32) continue;
int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
XSPRITE *pXSprite = &xsprite[nXSprite]; DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
if (IsPlayerSprite(pSprite) || pXSprite->health == 0) continue;
pXSprite->stateTimer = ClipLow(pXSprite->stateTimer-4, 0);
switch (pSprite->type){

View file

@ -83,8 +83,8 @@ static void BiteSeqCallback(int, int nXSprite)
int dx = Cos(pSprite->ang) >> 16;
int dy = Sin(pSprite->ang) >> 16;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
@ -94,7 +94,7 @@ static void BiteSeqCallback(int, int nXSprite)
static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10)
pDudeExtraE->at4++;
@ -152,7 +152,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -171,7 +171,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -188,7 +188,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
{
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
int height2 = (dudeInfo[pTarget->type-kDudeBase].eyeHeight*pTarget->yrepeat)<<2;
int height2 = (getDudeInfo(pTarget->type)->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
@ -221,7 +221,7 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -245,7 +245,7 @@ static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -275,7 +275,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -331,7 +331,7 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -364,7 +364,7 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -396,7 +396,7 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -207,7 +207,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra;
if (nXSector > 0)
@ -246,7 +246,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -394,7 +394,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkSwimGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -413,7 +413,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -464,7 +464,7 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -484,7 +484,7 @@ static void sub_628A0(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -517,10 +517,10 @@ static void sub_62AE0(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
int z = pSprite->z + dudeInfo[pSprite->type - kDudeBase].eyeHeight;
int z2 = pTarget->z + dudeInfo[pTarget->type - kDudeBase].eyeHeight;
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -553,10 +553,10 @@ static void sub_62D7C(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
int z = pSprite->z + dudeInfo[pSprite->type - kDudeBase].eyeHeight;
int z2 = pTarget->z + dudeInfo[pTarget->type - kDudeBase].eyeHeight;
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -84,8 +84,8 @@ static void BiteSeqCallback(int, int nXSprite)
int dx = Cos(pSprite->ang) >> 16;
int dy = Sin(pSprite->ang) >> 16;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
/*
@ -107,7 +107,7 @@ static void BiteSeqCallback(int, int nXSprite)
static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10)
pDudeExtraE->at4++;
@ -167,7 +167,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -186,7 +186,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -203,7 +203,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
{
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
int height2 = (dudeInfo[pTarget->type-kDudeBase].eyeHeight*pTarget->yrepeat)<<2;
int height2 = (getDudeInfo(pTarget->type)->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
@ -236,7 +236,7 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -260,7 +260,7 @@ static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -290,7 +290,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -342,7 +342,7 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -375,7 +375,7 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -404,7 +404,7 @@ static void MoveAscend(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -100,7 +100,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -171,7 +171,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -108,7 +108,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra;
if (nXSector > 0)
@ -147,7 +147,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -261,7 +261,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkSwimGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -280,7 +280,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -326,7 +326,7 @@ static void sub_65D04(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -359,10 +359,10 @@ static void sub_65F44(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
int z = pSprite->z + dudeInfo[pSprite->type - kDudeBase].eyeHeight;
int z2 = pTarget->z + dudeInfo[pTarget->type - kDudeBase].eyeHeight;
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -395,10 +395,10 @@ static void sub_661E0(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
int z = pSprite->z + dudeInfo[pSprite->type - kDudeBase].eyeHeight;
int z2 = pTarget->z + dudeInfo[pTarget->type - kDudeBase].eyeHeight;
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -104,7 +104,7 @@ static void BurnSeqCallback(int, int nXSprite)
XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pDudeInfo->eyeHeight*pSprite->yrepeat;
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
@ -190,7 +190,7 @@ static void BurnSeqCallback2(int, int nXSprite)
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pDudeInfo->eyeHeight*pSprite->yrepeat;
int x = pSprite->x;
@ -240,7 +240,7 @@ static void BurnSeqCallback2(int, int nXSprite)
int nDeltaAngle = ((nAngle-pSprite->ang+1024)&2047)-1024;
if (klabs(nDeltaAngle) <= tt1.at8)
{
DUDEINFO *pDudeInfo2 = &dudeInfo[pSprite2->type - kDudeBase];
DUDEINFO *pDudeInfo2 = getDudeInfo(pSprite2->type);
int height = (pDudeInfo2->aimHeight*pSprite2->yrepeat)<<2;
int tz = (z2-height)-z;
if (cansee(x, y, z, pSprite->sectnum, x2, y2, z2, pSprite2->sectnum))
@ -279,7 +279,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10)
pDudeExtraE->at4++;
@ -339,7 +339,7 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -379,7 +379,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {

View file

@ -237,7 +237,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -276,7 +276,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -106,8 +106,8 @@ static void SlashFSeqCallback(int, int nXSprite)
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
spritetype *pTarget = &sprite[pXSprite->target];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
int dz = height-height2;
@ -136,7 +136,7 @@ static void BlastSSeqCallback(int, int nXSprite)
spritetype *pSprite = &sprite[nSprite];
wrand(); // ???
spritetype *pTarget = &sprite[pXSprite->target];
int height = (pSprite->yrepeat*dudeInfo[pSprite->type-kDudeBase].eyeHeight) << 2;
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int UNUSED(nDist) = approxDist(dx, dy);
@ -231,7 +231,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10)
pDudeExtraE->at4++;
@ -294,7 +294,7 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -313,7 +313,7 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -341,7 +341,7 @@ static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -375,7 +375,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
@ -565,7 +565,7 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -602,7 +602,7 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -646,7 +646,7 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -689,7 +689,7 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -88,8 +88,8 @@ static void SlashSeqCallback(int, int nXSprite)
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
spritetype *pTarget = &sprite[pXSprite->target];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
int dz = height-height2;
@ -119,7 +119,7 @@ static void BlastSeqCallback(int, int nXSprite)
spritetype *pSprite = &sprite[nSprite];
wrand(); // ???
spritetype *pTarget = &sprite[pXSprite->target];
int height = (pSprite->yrepeat*dudeInfo[pSprite->type-kDudeBase].eyeHeight) << 2;
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int UNUSED(nDist) = approxDist(dx, dy);
@ -206,7 +206,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10)
pDudeExtraE->at4++;
@ -268,7 +268,7 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -287,7 +287,7 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -315,7 +315,7 @@ static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -349,7 +349,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
@ -457,7 +457,7 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -494,7 +494,7 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -535,7 +535,7 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -575,7 +575,7 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -99,7 +99,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra;
if (nXSector > 0)
@ -138,7 +138,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -248,7 +248,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkSwimGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -267,7 +267,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -318,7 +318,7 @@ static void sub_6CB00(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -351,10 +351,10 @@ static void sub_6CD74(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
int z = pSprite->z + dudeInfo[pSprite->type - kDudeBase].eyeHeight;
int z2 = pTarget->z + dudeInfo[pTarget->type - kDudeBase].eyeHeight;
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
@ -387,10 +387,10 @@ static void sub_6D03C(spritetype *pSprite, XSPRITE *pXSprite)
{
int nSprite = pSprite->index;
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
int z = pSprite->z + dudeInfo[pSprite->type - kDudeBase].eyeHeight;
int z2 = pTarget->z + dudeInfo[pTarget->type - kDudeBase].eyeHeight;
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;

View file

@ -85,7 +85,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -104,7 +104,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -108,7 +108,7 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -131,7 +131,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");

View file

@ -64,7 +64,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -83,7 +83,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -107,7 +107,7 @@ static void sub_6FFA0(int, int nXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int x = pTarget->x-pSprite->x;
int y = pTarget->y-pSprite->y;
int dz = pTarget->z-pSprite->z;
@ -184,7 +184,7 @@ static void sub_70380(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -225,7 +225,7 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");

View file

@ -82,7 +82,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -101,7 +101,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -170,7 +170,7 @@ static void sub_71370(int, int nXSprite)
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
@ -207,7 +207,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -226,7 +226,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -88,7 +88,7 @@ static void sub_71BD4(int, int nXSprite)
XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
@ -167,7 +167,7 @@ static void sub_720AC(int, int nXSprite)
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
int ax, ay, az;
ax = Cos(pSprite->ang)>>16;
@ -248,7 +248,7 @@ static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
if (pDudeExtraE->at4 && pDudeExtraE->at0 < 10)
pDudeExtraE->at0++;
@ -305,7 +305,7 @@ static void sub_72850(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -328,7 +328,7 @@ static void sub_72934(spritetype *pSprite, XSPRITE *pXSprite)
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
return;
}
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");

View file

@ -210,12 +210,12 @@ static void punchCallback(int, int nXIndex) {
int nSprite = pXSprite->reference;
spritetype* pSprite = &sprite[nSprite];
int nZOffset1 = dudeInfo[pSprite->type - kDudeBase].eyeHeight * pSprite->yrepeat << 2;
int nZOffset1 = getDudeInfo(pSprite->type)->eyeHeight * pSprite->yrepeat << 2;
int nZOffset2 = 0;
spritetype* pTarget = &sprite[pXSprite->target];
if(IsDudeSprite(pTarget))
nZOffset2 = dudeInfo[pTarget->type - kDudeBase].eyeHeight * pTarget->yrepeat << 2;
nZOffset2 = getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat << 2;
int dx = Cos(pSprite->ang) >> 16;
int dy = Sin(pSprite->ang) >> 16;
@ -429,7 +429,7 @@ static void thinkGoto(spritetype* pSprite, XSPRITE* pXSprite) {
aiChooseDirection(pSprite, pXSprite, nAngle);
// if reached target, change to search mode
if (approxDist(dx, dy) < 5120 && klabs(pSprite->ang - nAngle) < dudeInfo[pSprite->type - kDudeBase].periphery) {
if (approxDist(dx, dy) < 5120 && klabs(pSprite->ang - nAngle) < getDudeInfo(pSprite->type)->periphery) {
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchW);
else aiGenDudeNewState(pSprite, &genDudeSearchL);
}
@ -498,7 +498,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) {
}
}
DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
int losAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
int eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
@ -958,7 +958,7 @@ int checkAttackState(spritetype* pSprite, XSPRITE* pXSprite) {
///// For gen dude
int getGenDudeMoveSpeed(spritetype* pSprite,int which, bool mul, bool shift) {
DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
XSPRITE* pXSprite = &xsprite[pSprite->extra];
int speed = -1; int step = 2500; int maxSpeed = 146603;
switch(which){
@ -992,7 +992,7 @@ int getGenDudeMoveSpeed(spritetype* pSprite,int which, bool mul, bool shift) {
}
void aiGenDudeMoveForward(spritetype* pSprite, XSPRITE* pXSprite ) {
DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
GENDUDEEXTRA* pExtra = &gGenDudeExtra[pSprite->index];
int maxTurn = pDudeInfo->angSpeed * 4 >> 4;
@ -1294,7 +1294,7 @@ void scaleDamage(XSPRITE* pXSprite) {
short weaponType = gGenDudeExtra[sprite[pXSprite->reference].index].weaponType;
unsigned short* curScale = gGenDudeExtra[sprite[pXSprite->reference].index].dmgControl;
for (int i = 0; i < kDmgMax; i++)
curScale[i] = dudeInfo[kDudeModernCustom - kDudeBase].startDamage[i];
curScale[i] = getDudeInfo(kDudeModernCustom)->startDamage[i];
// all enemies with vector weapons gets extra resistance to bullet damage
if (weaponType == kGenDudeWeaponHitscan) {
@ -1305,7 +1305,7 @@ void scaleDamage(XSPRITE* pXSprite) {
} else if (weaponType == kGenDudeWeaponSummon) {
for (int i = 0; i < kDmgMax; i++)
curScale[i] = dudeInfo[curWeapon - kDudeBase].startDamage[i];
curScale[i] = getDudeInfo(curWeapon)->startDamage[i];
// these does not like the explosions and burning
} else if (weaponType == kGenDudeWeaponKamikaze) {
@ -1856,7 +1856,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
// check the animation
int seqStartId = -1;
if (pXSprite->data2 <= 0) seqStartId = pXSprite->data2 = dudeInfo[pSprite->type - kDudeBase].seqStartID;
if (pXSprite->data2 <= 0) seqStartId = pXSprite->data2 = getDudeInfo(pSprite->type)->seqStartID;
else seqStartId = pXSprite->data2;
for (int i = seqStartId; i < seqStartId + kGenDudeSeqMax; i++) {
@ -1867,7 +1867,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
case kGenDudeSeqAttackThrow:
case kGenDudeSeqAttackPunch:
if (!gSysRes.Lookup(i, "SEQ")) {
pXSprite->data2 = dudeInfo[pSprite->type - kDudeBase].seqStartID;
pXSprite->data2 = getDudeInfo(pSprite->type)->seqStartID;
viewSetSystemMessage("No SEQ animation id %d found for custom dude #%d!", i, pSprite->index);
viewSetSystemMessage("SEQ base id: %d", seqStartId);
} else if ((i - seqStartId) == kGenDudeSeqAttackPunch) {

View file

@ -83,8 +83,8 @@ static void HackSeqCallback(int, int nXSprite)
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
spritetype *pTarget = &sprite[pXSprite->target];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int tx = pXSprite->targetX-pSprite->x;
int ty = pXSprite->targetY-pSprite->y;
int UNUSED(nDist) = approxDist(tx, ty);
@ -114,7 +114,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -133,7 +133,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -179,7 +179,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
@ -225,7 +225,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
static void myThinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
for (int p = connecthead; p >= 0; p = connectpoint2[p])
{
PLAYER *pPlayer = &gPlayer[p];

View file

@ -78,9 +78,9 @@ static void HackSeqCallback(int, int nXSprite)
if (pSprite->type != kDudeZombieButcher)
return;
spritetype *pTarget = &sprite[pXSprite->target];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height2 = (pDudeInfoT->eyeHeight*pTarget->yrepeat);
actFireVector(pSprite, 0, 0, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, height-height2, VECTOR_TYPE_11);
}
@ -91,8 +91,8 @@ static void PukeSeqCallback(int, int nXSprite)
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
spritetype *pTarget = &sprite[pXSprite->target];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfoT = &dudeInfo[pTarget->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
int height2 = (pDudeInfoT->eyeHeight*pTarget->yrepeat);
int tx = pXSprite->targetX-pSprite->x;
@ -110,7 +110,7 @@ static void ThrowSeqCallback(int, int nXSprite)
XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite];
actFireMissile(pSprite, 0, -dudeInfo[pSprite->type-kDudeBase].eyeHeight, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, kMissileButcherKnife);
actFireMissile(pSprite, 0, -getDudeInfo(pSprite->type)->eyeHeight, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, kMissileButcherKnife);
}
static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
@ -122,7 +122,7 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy);
@ -141,7 +141,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return;
}
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra];

View file

@ -171,7 +171,7 @@ void QuitGame(void)
void PrecacheDude(spritetype *pSprite)
{
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
seqPrecacheId(pDudeInfo->seqStartID);
seqPrecacheId(pDudeInfo->seqStartID+5);
seqPrecacheId(pDudeInfo->seqStartID+1);

View file

@ -269,10 +269,10 @@ void Respawn(int nSprite) // 9
pSprite->y = baseSprite[nSprite].y;
pSprite->z = baseSprite[nSprite].z;
pSprite->cstat |= 0x1101;
pSprite->clipdist = dudeInfo[nType].clipdist;
pXSprite->health = dudeInfo[nType].startHealth<<4;
if (gSysRes.Lookup(dudeInfo[nType].seqStartID, "SEQ"))
seqSpawn(dudeInfo[nType].seqStartID, 3, pSprite->extra, -1);
pSprite->clipdist = getDudeInfo(nType+kDudeBase)->clipdist;
pXSprite->health = getDudeInfo(nType+kDudeBase)->startHealth<<4;
if (gSysRes.Lookup(getDudeInfo(nType+kDudeBase)->seqStartID, "SEQ"))
seqSpawn(getDudeInfo(nType+kDudeBase)->seqStartID, 3, pSprite->extra, -1);
aiInitSprite(pSprite);
pXSprite->key = 0;
} else if (pSprite->type == kThingTNTBarrel) {

View file

@ -302,6 +302,7 @@ void CDemo::Playback(void)
inputState.SetBindsEnabled(false);
ready2send = 0;
int v4 = 0;
totalclock = 0;
gNetFifoClock = totalclock;
gViewMode = 3;
_DEMOPLAYBACK:
@ -309,7 +310,7 @@ _DEMOPLAYBACK:
{
handleevents();
D_ProcessEvents();
while (totalclock >= gNetFifoClock && !gQuitGame)
while (((int)totalclock*16) >= gNetFifoClock && !gQuitGame)
{
if (!v4)
{

View file

@ -1731,4 +1731,6 @@ DUDEINFO gPlayerTemplate[4] =
},
};
DUDEINFO fakeDudeInfo = {};
END_BLD_NS

View file

@ -57,5 +57,13 @@ struct DUDEINFO {
extern DUDEINFO dudeInfo[kDudeMax-kDudeBase];
extern DUDEINFO gPlayerTemplate[4];
extern DUDEINFO fakeDudeInfo;
inline DUDEINFO *getDudeInfo(int const nType)
{
if (nType >= kDudeBase && nType < kDudeMax)
return &dudeInfo[nType - kDudeBase];
return &fakeDudeInfo;
}
END_BLD_NS

View file

@ -1394,7 +1394,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
{
spritetype *pSprite = &sprite[*a2];
XSPRITE *pXSprite = &xsprite[*a3];
int nMass = dudeInfo[pSprite->type-kDudeBase].mass;
int nMass = getDudeInfo(pSprite->type)->mass;
if (nMass)
{
int t2 = divscale(0xccccc, nMass, 8);
@ -2095,7 +2095,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
XSPRITE *pXSprite = pPlayer->pXSprite;
int nXSprite = pSprite->extra;
int nXSector = sector[pSprite->sectnum].extra;
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nDeathSeqID = -1;
int nKneelingPlayer = -1;
int nSprite = pSprite->index;

View file

@ -289,7 +289,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
int nType = pTarget->type-kDudeBase;
DUDEINFO *pDudeInfo = &dudeInfo[nType];
DUDEINFO *pDudeInfo = getDudeInfo(nType+kDudeBase);
int z1 = (top-pSprite->z)-256;
int x = pTarget->x;
int y = pTarget->y;
@ -423,7 +423,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
case kDudeBurningZombieButcher:
case kDudeBurningTinyCaleb:
case kDudeBurningBeast: {
pXSpawn->health = dudeInfo[pXSprite->data1 - kDudeBase].startHealth << 4;
pXSpawn->health = getDudeInfo(pXSprite->data1)->startHealth << 4;
pXSpawn->burnTime = 10;
pXSpawn->target = -1;
aiActivateDude(pSpawn, pXSpawn);
@ -1271,7 +1271,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
case kDudeBurningZombieButcher:
case kDudeBurningTinyCaleb:
case kDudeBurningBeast: {
pXSpawn->health = dudeInfo[pXSprite->data1 - kDudeBase].startHealth << 4;
pXSpawn->health = getDudeInfo(pXSprite->data1)->startHealth << 4;
pXSpawn->burnTime = 10;
pXSpawn->target = -1;
aiActivateDude(pSpawn, pXSpawn);
@ -3759,7 +3759,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) {
spritetype* pSprite = &sprite[nDest]; XSPRITE* pXSprite = &xsprite[pSprite->extra];
spritetype* pTarget = NULL; XSPRITE* pXTarget = NULL; int receiveHp = 33 + Random(33);
DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int matesPerEnemy = 1;
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); int matesPerEnemy = 1;
// dude is burning?
if (pXSprite->burnTime > 0 && spriRangeIsFine(pXSprite->burnSource)) {
@ -3853,7 +3853,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) {
if (pXMate->data4 > 0 && pXMate->health < pXMate->data4)
actHealDude(pXMate, receiveHp, pXMate->data4);
else {
DUDEINFO* pTDudeInfo = &dudeInfo[pMate->type - kDudeBase];
DUDEINFO* pTDudeInfo = getDudeInfo(pMate->type);
if (pXMate->health < pTDudeInfo->startHealth)
actHealDude(pXMate, receiveHp, pTDudeInfo->startHealth);
}
@ -4060,7 +4060,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) {
// the following functions required for kModernDudeTargetChanger
//---------------------------------------
spritetype* getTargetInRange(spritetype* pSprite, int minDist, int maxDist, short data, short teamMode) {
DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; XSPRITE* pXSprite = &xsprite[pSprite->extra];
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); XSPRITE* pXSprite = &xsprite[pSprite->extra];
spritetype* pTarget = NULL; XSPRITE* pXTarget = NULL; spritetype* cTarget = NULL;
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
pTarget = &sprite[nSprite]; pXTarget = &xsprite[pTarget->extra];
@ -4366,7 +4366,7 @@ bool getDudesForTargetChg(XSPRITE* pXSprite) {
void disturbDudesInSight(spritetype* pSprite, int max) {
spritetype* pDude = NULL; XSPRITE* pXDude = NULL;
XSPRITE* pXSprite = &xsprite[pSprite->extra];
DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
pDude = &sprite[nSprite];
if (pDude->xvel == pSprite->xvel || !IsDudeSprite(pDude) || pDude->extra < 0)

View file

@ -3091,7 +3091,7 @@ void viewDrawScreen(bool sceneonly)
if (gViewMode == 3 || gViewMode == 4 || gOverlayMap)
{
DoSectorLighting();
//DoSectorLighting();
}
if (gViewMode == 3 || gOverlayMap)
{

View file

@ -373,7 +373,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int nDist2 = ksqrt(dx*dx+dy*dy+dz*dz);
if (nDist2 >= nClosest)
continue;
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int center = (pSprite->yrepeat*pDudeInfo->aimHeight)<<2;
int dzCenter = (z2-center)-z;
if (cansee(x, y, z, pPSprite->sectnum, x2, y2, z2, pSprite->sectnum))