- Fix all GCC warnings in the game-side code.

* Most of these were due to mixed spaces/tabs playing nastiness with non-braced if/else statements.
This commit is contained in:
Mitchell Richters 2023-10-04 18:11:00 +11:00
parent 94e23343e1
commit 623e453d4d
22 changed files with 67 additions and 73 deletions

View file

@ -4694,7 +4694,7 @@ void MoveDude(DBloodActor* actor)
if (actor->IsPlayerActor()) pPlayer = getPlayer(actor); if (actor->IsPlayerActor()) pPlayer = getPlayer(actor);
if (!(actor->IsDudeActor())) if (!(actor->IsDudeActor()))
{ {
Printf(PRINT_HIGH, "%s is not a dude actor type\n", actor->GetClass()->TypeName); Printf(PRINT_HIGH, "%s is not a dude actor type\n", actor->GetClass()->TypeName.GetChars());
return; return;
} }

View file

@ -61,6 +61,7 @@ bool AllowedKillType(DBloodActor* actor)
{ {
if (!actor || actor->spr.statnum != kStatDude) if (!actor || actor->spr.statnum != kStatDude)
return false; return false;
auto type = actor->GetType(); auto type = actor->GetType();
return type != kDudeBat && type != kDudeRat && type != kDudeInnocent && type != kDudeBurningInnocent; return type != kDudeBat && type != kDudeRat && type != kDudeInnocent && type != kDudeBurningInnocent;
} }

View file

@ -4337,7 +4337,7 @@ bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH)
case 0: // check if this player is connected case 0: // check if this player is connected
if (!condCmp(pPlayer->pnum + 1, arg1, arg2, cmpOp) || pPlayer->GetActor() == nullptr) return false; if (!condCmp(pPlayer->pnum + 1, arg1, arg2, cmpOp) || pPlayer->GetActor() == nullptr) return false;
else if (PUSH) condPush(aCond, pPlayer->GetActor()); else if (PUSH) condPush(aCond, pPlayer->GetActor());
return (pPlayer->pnum >= 0); return true;
case 1: return condCmp((gGameOptions.nGameType != 3) ? 0 : pPlayer->teamId + 1, arg1, arg2, cmpOp); // compare team case 1: return condCmp((gGameOptions.nGameType != 3) ? 0 : pPlayer->teamId + 1, arg1, arg2, cmpOp); // compare team
case 2: return (arg1 > 0 && arg1 < 8 && pPlayer->hasKey[arg1 - 1]); case 2: return (arg1 > 0 && arg1 < 8 && pPlayer->hasKey[arg1 - 1]);
case 3: return (arg1 > 0 && arg1 < 15 && pPlayer->hasWeapon[arg1 - 1]); case 3: return (arg1 > 0 && arg1 < 15 && pPlayer->hasWeapon[arg1 - 1]);

View file

@ -746,7 +746,7 @@ void checkdive(DDukeActor* transporter, DDukeActor* transported)
int onfloorz = transporter->temp_data[4]; int onfloorz = transporter->temp_data[4];
Collision coll; Collision coll;
double ll = abs(transported->vel.Z), ll2; double ll = abs(transported->vel.Z), ll2 = 0;
if (transported->vel.Z >= 0) if (transported->vel.Z >= 0)
warpdir = 2; warpdir = 2;
else else

View file

@ -54,7 +54,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t = tsprites.get(j); t = tsprites.get(j);
h = static_cast<DDukeActor*>(t->ownerActor); h = static_cast<DDukeActor*>(t->ownerActor);
if (!(h->flags2 & SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguy(static_cast<DDukeActor*>(t->ownerActor)) && t->extra > 0) || t->statnum == STAT_PLAYER) if ((!(h->flags2 & SFLAG2_FORCESECTORSHADE) && (t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguy(static_cast<DDukeActor*>(t->ownerActor)) && t->extra > 0) || t->statnum == STAT_PLAYER)
{ {
if (h->sector()->shadedsector == 1 && h->spr.statnum != STAT_ACTOR) if (h->sector()->shadedsector == 1 && h->spr.statnum != STAT_ACTOR)
{ {

View file

@ -49,7 +49,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t = tsprites.get(j); t = tsprites.get(j);
h = static_cast<DDukeActor*>(t->ownerActor); h = static_cast<DDukeActor*>(t->ownerActor);
if (!(h->flags2 & SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || badguy(static_cast<DDukeActor*>(t->ownerActor)) || t->statnum == STAT_PLAYER) if ((!(h->flags2 & SFLAG2_FORCESECTORSHADE) && (t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || badguy(static_cast<DDukeActor*>(t->ownerActor)) || t->statnum == STAT_PLAYER)
{ {
if (h->sector()->shadedsector == 1 && h->spr.statnum != 1) if (h->sector()->shadedsector == 1 && h->spr.statnum != 1)
{ {

View file

@ -201,7 +201,7 @@ DDukeActor* aim(DDukeActor* actor, int abase, bool force, bool* b)
{ {
DAngle aang = mapangle(abase); DAngle aang = mapangle(abase);
bool gotshrinker, gotfreezer; bool gotshrinker = false, gotfreezer = false;
static const int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR }; static const int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR };
DAngle a = actor->spr.Angles.Yaw; DAngle a = actor->spr.Angles.Yaw;
@ -266,12 +266,7 @@ DDukeActor* aim(DDukeActor* actor, int abase, bool force, bool* b)
DDukeActor* aimed = nullptr; DDukeActor* aimed = nullptr;
// if(actor->isPlayer() && ps[actor->PlayerIndex()].aim_mode) return -1; // if(actor->isPlayer() && ps[actor->PlayerIndex()].aim_mode) return -1;
if (isRR()) if (!isRR() && actor->isPlayer())
{
gotshrinker = false;
gotfreezer = false;
}
else if (actor->isPlayer())
{ {
const auto plr = getPlayer(actor->PlayerIndex()); const auto plr = getPlayer(actor->PlayerIndex());

View file

@ -48,7 +48,7 @@ BEGIN_DUKE_NS
void prelevel_d(int g, TArray<DDukeActor*>& actors) void prelevel_d(int g, TArray<DDukeActor*>& actors)
{ {
int j, lotaglist; unsigned j;
TArray<short> lotags; TArray<short> lotags;
prelevel_common(g); prelevel_common(g);
@ -85,7 +85,6 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
spriteinit(actor, actors); spriteinit(actor, actors);
} }
} }
lotaglist = 0;
it.Reset(STAT_DEFAULT); it.Reset(STAT_DEFAULT);
while (auto actor = it.Next()) while (auto actor = it.Next())

View file

@ -43,8 +43,7 @@ BEGIN_DUKE_NS
void prelevel_r(int g, TArray<DDukeActor*>& actors) void prelevel_r(int g, TArray<DDukeActor*>& actors)
{ {
DDukePlayer* p; DDukePlayer* p;
int j; unsigned j;
int lotaglist;
TArray<short> lotags; TArray<short> lotags;
int speed = 0; int speed = 0;
int dist; int dist;
@ -235,8 +234,6 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
} }
} }
lotaglist = 0;
it.Reset(STAT_DEFAULT); it.Reset(STAT_DEFAULT);
while (auto ac = it.Next()) while (auto ac = it.Next())
{ {

View file

@ -391,6 +391,7 @@ MOVEEND:
hitactor = coll.actor(); hitactor = coll.actor();
goto HITSPRITE; goto HITSPRITE;
} }
break;
default: default:
if (coll.exbits) if (coll.exbits)
goto HITSECT; goto HITSECT;

View file

@ -69,7 +69,7 @@ public:
Type& operator[](size_t index) Type& operator[](size_t index)
{ {
return DataList[index]; return DataList[std::min(index, (size_t)count-1)];
} }
void Serialize(FSerializer& arc, const char* key) void Serialize(FSerializer& arc, const char* key)

View file

@ -775,7 +775,7 @@ static void doPickupWeapon(DExhumedPlayer* pPlayer, DExhumedActor* pPickupActor,
static void doPickupHealth(DExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, int nItem, const int nAmount, int nSound) static void doPickupHealth(DExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, int nItem, const int nAmount, int nSound)
{ {
if (!pPickupActor->spr.hitag || nAmount > 0 && pPlayer->nHealth >= 800) if (!pPickupActor->spr.hitag || (nAmount > 0 && pPlayer->nHealth >= 800))
return; return;
int tintRed = 0, tintGreen = 16; int tintRed = 0, tintGreen = 16;

View file

@ -126,7 +126,7 @@ static TMap<FName, TArray<Seq>> FileSeqMap;
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
const TArray<Seq>* const getFileSeqs(const FName nSeqFile) TArray<Seq>* getFileSeqs(const FName nSeqFile)
{ {
return FileSeqMap.CheckKey(nSeqFile); return FileSeqMap.CheckKey(nSeqFile);
} }

View file

@ -46,7 +46,7 @@ struct SeqFrame
return chunks.Size() ? chunks[0].tex : FNullTextureID(); return chunks.Size() ? chunks[0].tex : FNullTextureID();
} }
const void playSound(DExhumedActor* const pActor) const void playSound(DExhumedActor* const pActor) const
{ {
if (sound == -1) if (sound == -1)
return; return;
@ -84,9 +84,9 @@ void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqI
void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex); void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex);
void seq_DrawPilotLightSeq(double xPos, double yPos, double nAngle); void seq_DrawPilotLightSeq(double xPos, double yPos, double nAngle);
const TArray<Seq>* const getFileSeqs(const FName nSeqFile); TArray<Seq>* getFileSeqs(const FName nSeqFile);
inline const Seq* const getSequence(const FName nSeqFile, const unsigned nSeqIndex = 0) inline Seq* getSequence(const FName nSeqFile, const unsigned nSeqIndex = 0)
{ {
return getFileSeqs(nSeqFile)->Data(nSeqIndex); return getFileSeqs(nSeqFile)->Data(nSeqIndex);
} }

View file

@ -412,7 +412,7 @@ void EXSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
{ {
if (pos != nullptr) if (pos != nullptr)
{ {
DVector3 campos; DVector3 campos{};
if (nSnakeCam > -1) if (nSnakeCam > -1)
{ {
Snake* pSnake = &SnakeList[nSnakeCam]; Snake* pSnake = &SnakeList[nSnakeCam];
@ -487,8 +487,8 @@ void GameInterface::UpdateSounds()
const auto pActor = getPlayer(nLocalPlayer)->GetActor(); const auto pActor = getPlayer(nLocalPlayer)->GetActor();
DVector3 pos; DVector3 pos{};
DAngle ang; DAngle ang{};
if (nSnakeCam > -1) if (nSnakeCam > -1)
{ {
Snake* pSnake = &SnakeList[nSnakeCam]; Snake* pSnake = &SnakeList[nSnakeCam];

View file

@ -2129,6 +2129,7 @@ struct ANIM
case ANIM_Spritez: case ANIM_Spritez:
if (animactor == nullptr) return; if (animactor == nullptr) return;
animactor->spr.pos.Z = value; animactor->spr.pos.Z = value;
break;
case ANIM_Userz: case ANIM_Userz:
if (animactor == nullptr) return; if (animactor == nullptr) return;
animactor->user.pos.Z = value; animactor->user.pos.Z = value;