- use GetIndex for error messages and deleted several unused index variables.

This commit is contained in:
Christoph Oelckers 2021-09-06 22:47:10 +02:00
parent 21a208e59e
commit 98a3564ee6
9 changed files with 14 additions and 21 deletions

View file

@ -2454,7 +2454,7 @@ static void actInitDudes()
{
spritetype* pSprite = &act->s();
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
I_Error("Non-enemy sprite (%d) in the enemy sprite list.\n", pSprite->index);
I_Error("Non-enemy sprite (%d) in the enemy sprite list.\n", act->GetIndex());
unk[pSprite->type - kDudeBase] = 1;
}
@ -2581,7 +2581,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
}
else
{
Printf(PRINT_HIGH, "Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", (int)pSprite->index, (int)pSprite->type, (int)pSprite->statnum);
Printf(PRINT_HIGH, "Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", actor->GetIndex(), (int)pSprite->type, (int)pSprite->statnum);
return;
}
@ -2589,7 +2589,6 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
{
int size = (tileWidth(pSprite->picnum) * pSprite->xrepeat * tileHeight(pSprite->picnum) * pSprite->yrepeat) >> 1;
int t = scale(damage, size, mass);
int nSprite = pSprite->index;
actor->xvel += MulScale(t, dx, 16);
actor->yvel += MulScale(t, dy, 16);
actor->zvel += MulScale(t, dz, 16);
@ -6738,7 +6737,6 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
assert(nType >= kMissileBase && nType < kMissileMax);
char v4 = 0;
auto pSprite = &actor->s();
int nSprite = pSprite->index;
const MissileType* pMissileInfo = &missileInfo[nType - kMissileBase];
int x = pSprite->x + MulScale(a2, Cos(pSprite->ang + 512), 30);
int y = pSprite->y + MulScale(a2, Sin(pSprite->ang + 512), 30);

View file

@ -982,7 +982,6 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
if (source)
{
spritetype* pSource = &source->s();
int nSource = pSource->index;
if (pSprite == pSource) return 0;
else if (actor->GetTarget() == nullptr) // if no target, give the dude a target
{
@ -1027,7 +1026,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
}
}
DPrintf(DMSG_SPAMMY, "Player #%d does the critical damage to patrol dude #%d!", pPlayer->nPlayer + 1, pSprite->index);
DPrintf(DMSG_SPAMMY, "Player #%d does the critical damage to patrol dude #%d!", pPlayer->nPlayer + 1, actor->GetIndex());
}
return nDamage;

View file

@ -546,7 +546,6 @@ static void sub_62D7C(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return;

View file

@ -272,7 +272,6 @@ static void ghostMoveDodgeUp(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
@ -302,7 +301,6 @@ static void ghostMoveDodgeDown(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");

View file

@ -310,7 +310,7 @@ static void sub_6CB00(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;

View file

@ -2356,7 +2356,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
Printf(PRINT_HIGH, "pSprite->type != kDudeModernCustom");
return false;
} else if (propId < kGenDudePropertyAll || propId >= kGenDudePropertyMax) {
viewSetSystemMessage("Unknown custom dude #%d property (%d)", pSprite->index, propId);
viewSetSystemMessage("Unknown custom dude #%d property (%d)", actor->GetIndex(), propId);
return false;
}
@ -2446,7 +2446,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
if (!pSeq)
{
pXSprite->data2 = getDudeInfo(pSprite->type)->seqStartID;
viewSetSystemMessage("No SEQ animation id %d found for custom dude #%d!", i, pSprite->index);
viewSetSystemMessage("No SEQ animation id %d found for custom dude #%d!", i, actor->GetIndex());
viewSetSystemMessage("SEQ base id: %d", seqStartId);
}
else if ((i - seqStartId) == kGenDudeSeqAttackPunch)

View file

@ -131,7 +131,7 @@ void ambInit(void)
auto snd = soundEngine->FindSoundByResID(nSFX);
if (!snd) {
//I_Error("Missing sound #%d used in ambient sound generator %d\n", nSFX);
viewSetSystemMessage("Missing sound #%d used in ambient sound generator #%d\n", nSFX, actor->s().index);
viewSetSystemMessage("Missing sound #%d used in ambient sound generator #%d\n", nSFX, actor->GetIndex());
actPostSprite(actor, kStatDecoration);
continue;
}

View file

@ -562,7 +562,7 @@ void nnExtInitModernStuff(bool bSaveLoad)
if (!pXSprite->rxID && pXSprite->data1 > kCondGameMax) condError(actor,"\nThe condition must have RX ID!\nSPRITE #%d", actor->GetIndex());
else if (!pXSprite->txID && !pSprite->flags)
{
Printf(PRINT_HIGH, "The condition must have TX ID or hitag to be set: RX ID %d, SPRITE #%d", pXSprite->rxID, pSprite->index);
Printf(PRINT_HIGH, "The condition must have TX ID or hitag to be set: RX ID %d, SPRITE #%d", pXSprite->rxID, actor->GetIndex());
}
break;
}
@ -705,7 +705,7 @@ void nnExtInitModernStuff(bool bSaveLoad)
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer out of a range (data1 = %d)", actor->GetIndex(), pXSprite->data1);
//if (numplayers < pXSprite->data1)
//I_Error("\nPlayer Control (SPRITE #%d):\n There is no player #%d", pSprite->index, pXSprite->data1);
//I_Error("\nPlayer Control (SPRITE #%d):\n There is no player #%d", actor->GetIndex(), pXSprite->data1);
if (pXSprite->rxID && pXSprite->rxID != kChannelLevelStart)
I_Error("\nPlayer Control (SPRITE #%d) with Link command should have no RX ID!", actor->GetIndex());
@ -739,7 +739,7 @@ void nnExtInitModernStuff(bool bSaveLoad)
if (pXSprite->waitTime > 0)
{
pXSprite->busyTime += ClipHigh(((pXSprite->waitTime * 120) / 10), 4095); pXSprite->waitTime = 0;
Printf(PRINT_HIGH, "Summing busyTime and waitTime for tracking condition #%d, RX ID %d. Result = %d ticks", pSprite->index, pXSprite->rxID, pXSprite->busyTime);
Printf(PRINT_HIGH, "Summing busyTime and waitTime for tracking condition #%d, RX ID %d. Result = %d ticks", actor->GetIndex(), pXSprite->rxID, pXSprite->busyTime);
}
pXSprite->busy = pXSprite->busyTime;
}
@ -918,7 +918,7 @@ void nnExtInitModernStuff(bool bSaveLoad)
}
if (pXSprite->data1 > kCondGameMax && count == 0)
Printf(PRINT_HIGH, "No objects to track found for condition #%d, RXID: %d!", pSprite->index, pXSprite->rxID);
Printf(PRINT_HIGH, "No objects to track found for condition #%d, RXID: %d!", iactor->GetIndex(), pXSprite->rxID);
pCond->length = count;
pCond->actor = iactor;
@ -8014,7 +8014,7 @@ void aiPatrolSetMarker(DBloodActor* actor)
if (firstFinePath == nullptr)
{
viewSetSystemMessage("No markers with id #%d found for dude #%d! (back = %d)", next, pSprite->index, back);
viewSetSystemMessage("No markers with id #%d found for dude #%d! (back = %d)", next, actor->GetIndex(), back);
return;
}
@ -8307,7 +8307,7 @@ void aiPatrolAlarmFull(DBloodActor* actor, DBloodActor* targetactor, bool chain)
if (chain)
aiPatrolAlarmFull(dudeactor, targetactor, Chance(0x0010));
//Printf("Dude #%d alarms dude #%d", pSprite->index, pDude->index);
//Printf("Dude #%d alarms dude #%d", actor->GetIndex(), pDude->index);
}
}
}
@ -8673,7 +8673,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
if (itCanSee && seeChance > 0)
{
//DPrintf(DMSG_SPAMMY, "Patrol dude #%d seeing the Player #%d.", pSprite->index, pPlayer->nPlayer + 1);
//DPrintf(DMSG_SPAMMY, "Patrol dude #%d seeing the Player #%d.", actor->GetIndex(), pPlayer->nPlayer + 1);
//pXSprite->data3 += seeChance;
pXSprite->data3 = ClipRange(pXSprite->data3 + seeChance, -kMaxPatrolSpotValue, kMaxPatrolSpotValue);
if (!stealth)

View file

@ -1582,7 +1582,6 @@ void ProcessInput(PLAYER *pPlayer)
{
spritetype* pSprite2 = &spawned->s();
pSprite2->ang = (pPlayer->pSprite->ang + 1024) & 2047;
int nSprite = pPlayer->pSprite->index;
int x = bcos(pPlayer->pSprite->ang);
int y = bsin(pPlayer->pSprite->ang);
spawned->xvel = pPlayer->actor->xvel + MulScale(0x155555, x, 14);