From 948f1940642de45cf75a2b2a3ec390213f38fd32 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 8 Oct 2021 19:21:29 +0200 Subject: [PATCH] - fixed warnings in Duke. --- source/games/duke/src/actors.cpp | 4 ++-- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/gamedef.cpp | 2 +- source/games/duke/src/gameexec.cpp | 1 + source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 6 +++--- source/games/duke/src/spawn.cpp | 2 +- source/games/sw/src/cheats.cpp | 4 ++-- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d81b07b76..2e4c0f1d5 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4737,7 +4737,7 @@ void handle_se128(DDukeActor *actor) auto wal = &wall[t[2]]; - if (wal->cstat | 32) +// if (wal->cstat | 32) // this has always been bugged, the condition can never be false. { wal->cstat &= (255 - 32); wal->cstat |= 16; @@ -4747,7 +4747,7 @@ void handle_se128(DDukeActor *actor) wall[wal->nextwall].cstat |= 16; } } - else return; +// else return; wal->overpicnum++; if (wal->nextwall >= 0) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 289537872..810975cd2 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -618,7 +618,7 @@ void movefta_r(void) s->shade = sector[s->sectnum].ceilingshade; else s->shade = sector[s->sectnum].floorshade; - if (s->picnum != HEN || s->picnum != COW || s->picnum != PIG || s->picnum != DOGRUN || ((isRRRA()) && s->picnum != RABBIT)) + if (s->picnum == HEN || s->picnum == COW || s->picnum == PIG || s->picnum == DOGRUN || ((isRRRA()) && s->picnum == RABBIT)) { if (wakeup(act, p)) { diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 3dfc2aac6..538590832 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -990,7 +990,7 @@ int ConCompiler::parsecommand() Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate move '%s' ignored.\n", fn, line_number, parselabel.GetChars()); break; } - if (i == labels.Size()) + if (i == (int)labels.Size()) appendlabeladdress(LABEL_MOVE); for (j = 0; j < 2; j++) { diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 0205f4e0a..9f9bea9dc 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1142,6 +1142,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, { // if they've asked for 'this', then use 'this'... act = sActor; + iActor = ActorToScriptIndex(sActor); } else { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 294974cc0..474c9c9b9 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -737,7 +737,7 @@ void playerJump(int snum, int fz, int cz) void player_struct::apply_seasick(double factor) { - if (isRRRA() && SeaSick && (dead_flag == 0 || dead_flag && resurrected)) + if (isRRRA() && SeaSick && (dead_flag == 0 || (dead_flag && resurrected))) { if (SeaSick < 250) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 82d7f624d..fe1235966 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1236,7 +1236,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum } else if (k == GROW_WEAPON) // JBF: this is handling next/previous with the grower selected { - if (j == (unsigned int)-1) + if (j == -1) k = 5; else k = 7; @@ -1375,7 +1375,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum PlayerSetInput(snum, SB_HOLSTER); p->oweapon_pos = p->weapon_pos = -9; } - else if (j >= MIN_WEAPON && p->gotweapon[j] && (unsigned int)p->curr_weapon != j) switch (j) + else if (j >= MIN_WEAPON && p->gotweapon[j] && p->curr_weapon != j) switch (j) { case KNEE_WEAPON: fi.addweapon(p, KNEE_WEAPON); @@ -2021,7 +2021,7 @@ int operateTripbomb(int snum) DDukeActor* j; DukeSectIterator it(sect); - while (j = it.Next()) + while ((j = it.Next())) { auto sj = j->s; if (sj->picnum == TRIPBOMB && diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 2c0336fa7..da7508cfe 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -306,7 +306,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam) { sp->xrepeat = 31; sp->yrepeat = 1; - sp->z = sector[spj->sectnum].floorz - isRR() ? PHEIGHT_RR : PHEIGHT_DUKE; + sp->z = sector[spj->sectnum].floorz - (isRR() ? PHEIGHT_RR : PHEIGHT_DUKE); } else { diff --git a/source/games/sw/src/cheats.cpp b/source/games/sw/src/cheats.cpp index 90a41e712..6f4e92f23 100644 --- a/source/games/sw/src/cheats.cpp +++ b/source/games/sw/src/cheats.cpp @@ -208,7 +208,7 @@ static void WeaponCheat(int player) if (!SW_SHAREWARE) p->WpnFlags = 0xFFFFFFFF; else p->WpnFlags = 0x0000207F; // Disallows high weapon cheat in shareware - for (int i = 0; i < SIZ(p->WpnAmmo); i++) + for (size_t i = 0; i < SIZ(p->WpnAmmo); i++) { p->WpnAmmo[i] = DamageData[i].max_ammo; } @@ -286,7 +286,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) p->WpnRocketHeat = 5; p->WpnRocketNuke = 1; - for (int i = 0; i < SIZ(p->WpnAmmo); i++) + for (size_t i = 0; i < SIZ(p->WpnAmmo); i++) { p->WpnAmmo[i] = DamageData[i].max_ammo; }