From dcccb0d6537b8ed2f3a61d4ba9b5085504da75bb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Nov 2021 12:25:25 +0100 Subject: [PATCH] - Duke: added [[fallthrough]] annotations wherever needed. --- source/games/duke/src/actors.cpp | 4 +- source/games/duke/src/actors_d.cpp | 9 +++- source/games/duke/src/actors_r.cpp | 10 ++++ source/games/duke/src/animatesprites_d.cpp | 7 +++ source/games/duke/src/animatesprites_r.cpp | 7 +++ source/games/duke/src/ccmds.cpp | 7 ++- source/games/duke/src/gamedef.cpp | 5 +- source/games/duke/src/gameexec.cpp | 56 ++++++++++++++++------ source/games/duke/src/hudweapon_d.cpp | 1 + source/games/duke/src/hudweapon_r.cpp | 2 +- source/games/duke/src/input.cpp | 4 +- source/games/duke/src/player_d.cpp | 4 +- source/games/duke/src/player_r.cpp | 3 ++ source/games/duke/src/premap_d.cpp | 2 + source/games/duke/src/premap_r.cpp | 1 + source/games/duke/src/sectors.cpp | 2 + source/games/duke/src/sectors_d.cpp | 7 +++ source/games/duke/src/sectors_r.cpp | 12 +++++ source/games/duke/src/spawn.cpp | 5 ++ source/games/duke/src/spawn_d.cpp | 28 +++++++++++ source/games/duke/src/spawn_r.cpp | 19 ++++++++ 21 files changed, 171 insertions(+), 24 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index b7d2d7130..4c293f33d 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4535,10 +4535,10 @@ void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2, continue; } - //[[fallthrough]] + [[fallthrough]]; case 6: if (s2->picnum == TRIPBOMB) break; - //[[fallthrough]] + [[fallthrough]]; case 1: case 0: if (testlist(list2, s2->picnum) || diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 554573ce2..ae8c529d3 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1953,6 +1953,7 @@ void moveweapons_d(void) deletesprite(act); continue; } + [[fallthrough]]; case FIREBALL: // Twentieth Anniversary World Tour if (act->s->picnum == FIREBALL && !isWorldTour()) break; @@ -2161,6 +2162,7 @@ void movetransports_d(void) if (spr2->extra > 0) continue; } + [[fallthrough]]; case STAT_PROJECTILE: case STAT_MISC: case STAT_FALLER: @@ -2206,10 +2208,12 @@ void movetransports_d(void) spr2->cstat &= 32767; break; } + [[fallthrough]]; default: if (spr2->statnum == 5 && !(sectlotag == 1 || sectlotag == 2)) break; - + [[fallthrough]]; + case WATERBUBBLE: //if( rnd(192) && a2->s.picnum == WATERBUBBLE) // break; @@ -3163,6 +3167,7 @@ void moveactors_d(void) case BOUNCEMINE: case MORTER: spawn(act, FRAMEEFFECT1)->temp_data[0] = 3; + [[fallthrough]]; case HEAVYHBOMB: heavyhbomb(act); @@ -3337,6 +3342,7 @@ void moveexplosions_d(void) // STATNUM 5 SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0)); ps[p].GetActor()->s->extra -= 4; } + [[fallthrough]]; case FIRELASER: if (s->extra != 999) @@ -3393,6 +3399,7 @@ void moveexplosions_d(void) // STATNUM 5 case WHISPYSMOKE: if (!isWorldTour()) continue; + [[fallthrough]]; case BURNING: case BURNING2: diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index fabbe35ea..ae85185c4 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1535,9 +1535,11 @@ void moveweapons_r(void) deletesprite(proj); continue; } + [[fallthrough]]; case RPG2: case RRTILE1790: if (!isRRRA()) continue; + [[fallthrough]]; case SHRINKSPARK: case RPG: case FIRELASER: @@ -1744,6 +1746,7 @@ void movetransports_r(void) if (spr->picnum == SHARK || (isRRRA() && (spr->picnum == CHEERBOAT || spr->picnum == HULKBOAT || spr->picnum == MINIONBOAT || spr->picnum == UFO1_RRRA)) || (!isRRRA() && (spr->picnum == UFO1_RR || spr->picnum == UFO2 || spr->picnum == UFO3 || spr->picnum == UFO4 || spr->picnum == UFO5))) continue; + [[fallthrough]]; case STAT_PROJECTILE: case STAT_MISC: case STAT_DUMMYPLAYER: @@ -1816,9 +1819,11 @@ void movetransports_r(void) spr2->cstat &= 32767; break; } + [[fallthrough]]; default: if (spr2->statnum == 5 && !(sectlotag == ST_1_ABOVE_WATER || sectlotag == ST_2_UNDERWATER || (isRRRA() && (sectlotag == 160 || sectlotag == 161)))) break; + [[fallthrough]]; case WATERBUBBLE: if (rnd(192) && spr2->picnum == WATERBUBBLE) @@ -2984,6 +2989,7 @@ void moveactors_r(void) { S_StopSound(356, nullptr); } + [[fallthrough]]; case BOWLINGPIN: case BOWLINGPIN+1: case HENSTAND: @@ -3062,6 +3068,7 @@ void moveactors_r(void) case CHEERBOMB: if (!isRRRA()) break; + [[fallthrough]]; case MORTER: case HEAVYHBOMB: heavyhbomb(act); @@ -3202,6 +3209,7 @@ void moveexplosions_r(void) // STATNUM 5 SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0)); ps[p].GetActor()->s->extra -= 4; } + [[fallthrough]]; case COOLEXPLOSION1: case FIRELASER: @@ -3259,6 +3267,7 @@ void moveexplosions_r(void) // STATNUM 5 case MAMAJIBA: case MAMAJIBB: if (!isRRRA()) break; + [[fallthrough]]; case BILLYJIBA: case BILLYJIBB: @@ -3571,6 +3580,7 @@ void moveeffectors_r(void) //STATNUM 3 case 156: if (!isRRRA()) break; + [[fallthrough]]; case SE_24_CONVEYOR: case SE_34: { diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index a59e9a4b8..2c06fbf18 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -105,6 +105,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->shade = -127; continue; } + [[fallthrough]]; case BULLETHOLE: case CRACK1: case CRACK2: @@ -363,6 +364,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int case FLAMETHROWER_WEAPON: //Twentieth Anniversary World Tour if (isWorldTour()) newtspr->picnum = FLAMETHROWERSPRITE; break; + [[fallthrough]]; case DEVISTATOR_WEAPON: newtspr->picnum = DEVISTATORSPRITE; break; } @@ -462,6 +464,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int case DUKEGUN: case DUKETORSO: if (t->pal == 6) t->shade = -120; + [[fallthrough]]; case SCRAP1: case SCRAP2: @@ -492,6 +495,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->pal = 7; break; } + [[fallthrough]]; default: if (sectp->floorpal) @@ -638,6 +642,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->z = Owner->z - (3 << 8); if (gs.lasermode == 2 && ps[screenpeek].heat_on == 0) t->yrepeat = 0; + [[fallthrough]]; case EXPLOSION2: case EXPLOSION2BOT: case FREEZEBLAST: @@ -659,6 +664,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int case FIRE: case FIRE2: t->cstat |= 128; + [[fallthrough]]; case BURNING: case BURNING2: if (!Owner) break; @@ -700,6 +706,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int break; case SHELL: t->picnum = s->picnum + (h->temp_data[0] & 1); + [[fallthrough]]; case SHOTGUNSHELL: t->cstat |= 12; if (h->temp_data[0] > 1) t->cstat &= ~4; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index ca7498a78..3ff153e86 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -83,6 +83,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->shade = -127; continue; } + [[fallthrough]]; case BULLETHOLE: case CRACK1: case CRACK2: @@ -577,6 +578,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int case MINJIBC: if (isRRRA() && t->pal == 19) t->shade = -127; + [[fallthrough]]; case JIBS1: case JIBS2: case JIBS3: @@ -599,6 +601,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int if (shadedsector[s->sectnum] == 1) t->shade = 16; + [[fallthrough]]; case SCRAP1: case SCRAP2: @@ -628,6 +631,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->pal = 7; break; } + [[fallthrough]]; default: default_case: @@ -789,6 +793,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int case RPG2: case RRTILE1790: if (!isRRRA()) break; + [[fallthrough]]; case EXPLOSION2: case FREEZEBLAST: case ATOMICHEALTH: @@ -839,6 +844,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int case RRTILE8218: case RRTILE8220: if (!isRRRA()) break; + [[fallthrough]]; case RRTILE1878: case RRTILE1952: case RRTILE1953: @@ -934,6 +940,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int break; case SHELL: t->picnum = s->picnum + (h->temp_data[0] & 1); + [[fallthrough]]; case SHOTGUNSHELL: t->cstat |= 12; if (h->temp_data[0] > 1) t->cstat &= ~4; diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 8c642016e..928108207 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -43,7 +43,8 @@ int getlabelvalue(const char* text); static int ccmd_spawn(CCmdFuncPtr parm) { int x = 0, y = 0, z = 0; - unsigned int cstat = 0, picnum = 0; + unsigned int cstat = 0; + int picnum = 0; unsigned int pal = 0; int ang = 0; int set = 0; @@ -61,12 +62,16 @@ static int ccmd_spawn(CCmdFuncPtr parm) y = atol(parm->parms[5]); z = atol(parm->parms[6]); set |= 8; + [[fallthrough]]; case 4: // ang ang = atol(parm->parms[3]) & 2047; set |= 4; + [[fallthrough]]; case 3: // cstat cstat = (unsigned short)atol(parm->parms[2]); set |= 2; + [[fallthrough]]; case 2: // pal pal = (uint8_t)atol(parm->parms[1]); set |= 1; + [[fallthrough]]; case 1: // tile number if (isdigit(parm->parms[0][0])) { picnum = (unsigned short)atol(parm->parms[0]); diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 8234b92b1..2c8388965 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -571,7 +571,7 @@ static void appendscriptvalue(int value) static int popscriptvalue() { - decltype(ScriptCode)::value_type p; + decltype(ScriptCode)::value_type p = 0; ScriptCode.Pop(p); return p; } @@ -1566,6 +1566,7 @@ int ConCompiler::parsecommand() case concmd_ifpinventory: transnum(LABEL_DEFINE); + [[fallthrough]]; case concmd_ifrnd: case concmd_ifpdistl: case concmd_ifpdistg: @@ -1591,6 +1592,7 @@ int ConCompiler::parsecommand() case concmd_ifsoundid: case concmd_ifsounddist: transnum(tw == concmd_ifai? LABEL_AI : tw == concmd_ifaction? LABEL_ACTION : tw == concmd_ifmove? LABEL_MOVE : LABEL_DEFINE); + [[fallthrough]]; case concmd_ifonwater: case concmd_ifinwater: case concmd_ifactornotstayput: @@ -1870,6 +1872,7 @@ int ConCompiler::parsecommand() { return 1; } + [[fallthrough]]; case concmd_fall: case concmd_tip: // case 21: diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index cc39fad86..0795d46b0 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2732,41 +2732,67 @@ int ParseState::parse(void) j = 0; switch(*(insptr++)) { - case 0:if( ps[g_p].steroids_amount != *insptr) + case 0: + if( ps[g_p].steroids_amount != *insptr) j = 1; break; - case 1:if(ps[g_p].shield_amount != gs.max_player_health ) + case 1: + if(ps[g_p].shield_amount != gs.max_player_health ) j = 1; break; - case 2:if(ps[g_p].scuba_amount != *insptr) j = 1;break; - case 3:if(ps[g_p].holoduke_amount != *insptr) j = 1;break; - case 4:if(ps[g_p].jetpack_amount != *insptr) j = 1;break; + case 2: + if(ps[g_p].scuba_amount != *insptr) j = 1; + break; + case 3: + if(ps[g_p].holoduke_amount != *insptr) j = 1; + break; + case 4: + if(ps[g_p].jetpack_amount != *insptr) j = 1; + break; case 6: if (isRR()) { switch (g_sp->lotag) { - case 100: if (ps[g_p].keys[1]) j = 1; break; - case 101: if (ps[g_p].keys[2]) j = 1; break; - case 102: if (ps[g_p].keys[3]) j = 1; break; - case 103: if (ps[g_p].keys[4]) j = 1; break; + case 100: + if (ps[g_p].keys[1]) j = 1; + break; + case 101: + if (ps[g_p].keys[2]) j = 1; + break; + case 102: + if (ps[g_p].keys[3]) j = 1; + break; + case 103: + if (ps[g_p].keys[4]) j = 1; + break; } } else { switch (g_sp->pal) { - case 0: if (ps[g_p].got_access & 1) j = 1; break; - case 21: if (ps[g_p].got_access & 2) j = 1; break; - case 23: if (ps[g_p].got_access & 4) j = 1; break; + case 0: + if (ps[g_p].got_access & 1) j = 1; + break; + case 21: + if (ps[g_p].got_access & 2) j = 1; + break; + case 23: + if (ps[g_p].got_access & 4) j = 1; + break; } } break; - case 7:if(ps[g_p].heat_amount != *insptr) j = 1;break; + case 7: + if(ps[g_p].heat_amount != *insptr) j = 1; + break; case 9: - if(ps[g_p].firstaid_amount != *insptr) j = 1;break; + if(ps[g_p].firstaid_amount != *insptr) j = 1; + break; case 10: - if(ps[g_p].boot_amount != *insptr) j = 1;break; + if(ps[g_p].boot_amount != *insptr) j = 1; + break; } parseifelse(j); diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index 0046c479f..e36034490 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -486,6 +486,7 @@ void displayweapon_d(int snum, double smoothratio) case 1: case 2: hud_drawpal(weapon_xoffset + 168 - look_anghalf,looking_arc + 201 - gun_pos, SHOTGUN + 2,-128,o,pal); + [[fallthrough]]; case 0: case 6: case 7: diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 5a5459e5a..0f9fd3841 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -150,7 +150,7 @@ void displayweapon_r(int snum, double smoothratio) shade = p->GetActor()->s->shade; if(shade > 24) shade = 24; - pal = p->GetActor()->s->pal == 1 ? 1 : pal = p->cursector()->floorpal; + pal = p->GetActor()->s->pal == 1 ? 1 : p->cursector()->floorpal; if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0)) return; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index b677256f7..0a7399b6a 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -652,8 +652,8 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool { if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw) { - double const velScale = 6. / 19.; - auto const baseVel = !p->NotOnWater ? VEHICLETURN : +VEHICLETURN * velScale; + double const velScale = !p->NotOnWater? 1. : 6. / 19.; + auto const baseVel = +VEHICLETURN * velScale; if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 161b0ad6e..98fbb5c9d 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1100,6 +1100,7 @@ void shoot_d(DDukeActor* actor, int atwith) case FREEZEBLAST: sz += (3 << 8); + [[fallthrough]]; case RPG: shootrpg(actor, p, sx, sy, sz, sa, atwith); @@ -1258,11 +1259,12 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum if (p->gotweapon[k] && p->ammo_amount[k] > 0) { if (isPlutoPak()) // JBF 20040116: so we don't select grower with v1.3d + { if (k == SHRINKER_WEAPON && (p->subweapon & (1 << GROW_WEAPON))) k = GROW_WEAPON; if (isWorldTour() && k == FREEZE_WEAPON && (p->subweapon & (1 << FLAMETHROWER_WEAPON)) != 0) k = FLAMETHROWER_WEAPON; - + } j = k; break; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 0158dfdf7..0472f51f9 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -882,6 +882,7 @@ void shoot_r(DDukeActor* actor, int atwith) case SLINGBLADE: if (!isRRRA()) break; + [[fallthrough]]; case KNEE: case GROWSPARK: shootmelee(actor, p, sx, sy, sz, sa, atwith); @@ -1175,6 +1176,7 @@ void selectweapon_r(int snum, int weap) case CHICKEN_WEAPON: if (!isRRRA()) break; + [[fallthrough]]; case SHOTGUN_WEAPON: case RIFLEGUN_WEAPON: case CROSSBOW_WEAPON: @@ -1536,6 +1538,7 @@ void checkweapons_r(struct player_struct* p) { case CHICKEN_WEAPON: if (!isRRRA()) break; + [[fallthrough]]; case DYNAMITE_WEAPON: case CROSSBOW_WEAPON: spawn(p->GetActor(), EXPLOSION2); diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 3c9e3026c..2b81990cf 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -419,6 +419,7 @@ void prelevel_d(int g) case W_FORCEFIELD: for (j = 0; j < 3; j++) tloadtile(W_FORCEFIELD + j); + [[fallthrough]]; case W_FORCEFIELD + 1: case W_FORCEFIELD + 2: if (wal->shade > 31) @@ -427,6 +428,7 @@ void prelevel_d(int g) if (wal->lotag && wal->nextwall >= 0) wal->nextWall()->lotag = wal->lotag; + [[fallthrough]]; case BIGFORCE: diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 2a83812fa..fe51152c1 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -675,6 +675,7 @@ void prelevel_r(int g) { case RRTILE8464 + 1: if (!isRRRA()) break; + [[fallthrough]]; case DIPSWITCH + 1: case DIPSWITCH2 + 1: case PULLSWITCH + 1: diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index a56580f0f..b6059f66a 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -139,6 +139,7 @@ int check_activator_motion(int lotag) break; case SE_18_INCREMENTAL_SECTOR_RISE_FALL: if (isRRRA()) break; + [[fallthrough]]; case SE_20_STRETCH_BRIDGE: case SE_31_FLOOR_RISE_FALL: case SE_32_CEILING_RISE_FALL: @@ -1143,6 +1144,7 @@ void operateactivators(int low, int plnum) { case SE_18_INCREMENTAL_SECTOR_RISE_FALL: if (isRRRA()) break; + [[fallthrough]]; case SE_36_PROJ_SHOOTER: case SE_31_FLOOR_RISE_FALL: case SE_32_CEILING_RISE_FALL: diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index c8d63fd84..c639ab1ab 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -314,6 +314,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) return 0; } + [[fallthrough]]; case DIPSWITCH2: case DIPSWITCH2 + 1: case DIPSWITCH3: @@ -486,6 +487,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) { default: if (fi.isadoorwall(picnum) == 0) break; + [[fallthrough]]; case DIPSWITCH: case DIPSWITCH + 1: case TECHSWITCH: @@ -511,6 +513,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) if (numdips != correctdips) break; S_PlaySound3D(END_OF_LEVEL_WARN, ps[snum].GetActor(), &v); } + [[fallthrough]]; case DIPSWITCH2: case DIPSWITCH2 + 1: case DIPSWITCH3: @@ -673,6 +676,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw case W_FORCEFIELD + 1: case W_FORCEFIELD + 2: wal->extra = 1; // tell the forces to animate + [[fallthrough]]; case BIGFORCE: { updatesector(x, y, &sn); @@ -1211,6 +1215,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) } S_PlayActorSound(GLASS_HEAVYBREAK, targ); S_PlayActorSound(SQUISHED, targ); + [[fallthrough]]; case BOTTLE7: S_PlayActorSound(GLASS_BREAKING, targ); lotsofglass(targ, -1, 10); @@ -1314,6 +1319,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) case JURYGUY: S_PlayActorSound(s->lotag, targ); spawn(targ, s->hitag); + [[fallthrough]]; case SPACEMARINE: { s->extra -= pspr->extra; @@ -1367,6 +1373,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) targ = targ->GetOwner(); if (!targ) break; s = targ->s; + [[fallthrough]]; default: if ((s->cstat & 16) && s->hitag == 0 && s->lotag == 0 && s->statnum == 0) break; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 9ba6f577e..01801a954 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -441,6 +441,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) case RRTILE8464: case RRTILE8660: if (!isRRRA()) break; + [[fallthrough]]; case DIPSWITCH2: case DIPSWITCH2 + 1: case DIPSWITCH3: @@ -530,6 +531,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) break; case RRTILE8660: if (!isRRRA()) break; + [[fallthrough]]; case ACCESSSWITCH: case ACCESSSWITCH2: case SLOTDOOR: @@ -639,6 +641,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) break; case RRTILE8660: if (!isRRRA()) break; + [[fallthrough]]; case ACCESSSWITCH: case ACCESSSWITCH2: case SLOTDOOR: @@ -686,6 +689,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) { default: if (fi.isadoorwall(picnum) == 0) break; + [[fallthrough]]; case DIPSWITCH: case DIPSWITCH + 1: case TECHSWITCH: @@ -719,6 +723,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) case RRTILE8464: case RRTILE8660: if (!isRRRA()) break; + [[fallthrough]]; case DIPSWITCH2: case DIPSWITCH2 + 1: case DIPSWITCH3: @@ -839,6 +844,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) case SE_47_LIGHT_SWITCH: case SE_48_LIGHT_SWITCH: if (!isRRRA()) break; + [[fallthrough]]; case SE_12_LIGHT_SWITCH: sector[other->s->sectnum].floorpal = 0; other->temp_data[0]++; @@ -989,6 +995,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw { case RPG2: if (!isRRRA()) break; + [[fallthrough]]; case HEAVYHBOMB: case RADIUSEXPLOSION: case RPG: @@ -2126,6 +2133,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) { case RPG2: if (!isRRRA()) break; + [[fallthrough]]; case RADIUSEXPLOSION: case RPG: case FIRELASER: @@ -2151,6 +2159,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) { case RPG2: if (!isRRRA()) break; + [[fallthrough]]; case RADIUSEXPLOSION: case RPG: case FIRELASER: @@ -2203,6 +2212,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) break; case RRTILE1824: if (!isRRRA()) break; + [[fallthrough]]; case BOTTLE1: case BOTTLE2: case BOTTLE3: @@ -2249,6 +2259,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) case RRTILE2656: case RRTILE3172: if (!isRRRA()) break; + [[fallthrough]]; case BOTTLE7: S_PlayActorSound(GLASS_BREAKING, targ); lotsofglass(targ, -1, 10); @@ -2345,6 +2356,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) targ = targ->GetOwner(); if (!targ) break; s = targ->s; + [[fallthrough]]; default: if ((s->cstat & 16) && s->hitag == 0 && s->lotag == 0 && s->statnum == 0) break; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 4977e8439..324cdefba 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -706,6 +706,7 @@ void spawneffector(DDukeActor* actor) case SE_47_LIGHT_SWITCH: case SE_48_LIGHT_SWITCH: if (!isRRRA()) break; + [[fallthrough]]; case SE_12_LIGHT_SWITCH: t[1] = sectp->floorshade; @@ -915,6 +916,7 @@ void spawneffector(DDukeActor* actor) if (sectp->lotag && labs(sectp->ceilingz - sp->z) > 1024) sectp->lotag |= 32768; //If its open + [[fallthrough]]; case SE_8_UP_OPEN_DOOR_LIGHTS: //First, get the ceiling-floor shade @@ -952,6 +954,7 @@ void spawneffector(DDukeActor* actor) case SE_11_SWINGING_DOOR://Pivitor rotater if (sp->ang > 1024) t[3] = 2; else t[3] = -2; + [[fallthrough]]; case SE_0_ROTATING_SECTOR: case SE_2_EARTHQUAKE://Earthquakemakers case SE_5_BOSS://Boss Creature @@ -1090,8 +1093,10 @@ void spawneffector(DDukeActor* actor) } actor->lastvx = j; } + [[fallthrough]]; case SE_30_TWO_WAY_TRAIN: if (numplayers > 1) break; + [[fallthrough]]; case SE_0_ROTATING_SECTOR: case SE_1_PIVOT: case SE_5_BOSS: diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 4ef71354f..c3650d708 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -65,6 +65,7 @@ int spawn_d(int j, int pn) case BOSS3STAYPUT: case BOSS5STAYPUT: act->actorstayput = sp->sectnum; + [[fallthrough]]; case FIREFLY: case BOSS5: if (sp->picnum != FIREFLY) @@ -179,6 +180,7 @@ int spawn_d(int j, int pn) if(sectp->floorpicnum == FLOORSLIME || sectp->ceilingpicnum == FLOORSLIME) sp->pal = 7; + [[fallthrough]]; case NEON1: case NEON2: case NEON3: @@ -188,9 +190,11 @@ int spawn_d(int j, int pn) case DOMELITE: if(sp->picnum != WATERSPLASH2) sp->cstat |= 257; + [[fallthrough]]; case NUKEBUTTON: if(sp->picnum == DOMELITE) sp->cstat |= 257; + [[fallthrough]]; case JIBS1: case JIBS2: case JIBS3: @@ -279,6 +283,7 @@ int spawn_d(int j, int pn) case LAVAPOOL: if (!isWorldTour()) // Twentieth Anniversary World Tour return i; + [[fallthrough]]; case BLOODPOOL: case PUKE: @@ -307,6 +312,7 @@ int spawn_d(int j, int pn) sp->z = fz; sp->z -= 200; } + [[fallthrough]]; case FECES: if( j >= 0) @@ -348,6 +354,7 @@ int spawn_d(int j, int pn) act->temp_data[0] = 17; act->temp_data[2] = 0; act->temp_data[5] = sp->ang; + [[fallthrough]]; case SPACEMARINE: if(sp->picnum == SPACEMARINE) @@ -425,6 +432,7 @@ int spawn_d(int j, int pn) case PIPE6: sp->clipdist = 32; sp->cstat |= 257; + [[fallthrough]]; case OCEANSPRITE4: changespritestat(i,0); break; @@ -486,6 +494,8 @@ int spawn_d(int j, int pn) sp->yvel = sp->hitag; sp->hitag = -1; if(sp->picnum == PODFEM1) sp->extra <<= 1; + [[fallthrough]]; + case BLOODYPOLE: case QUEBALL: @@ -513,6 +523,7 @@ int spawn_d(int j, int pn) sp->shade = spj->shade; sp->pal = ps[spj->yvel].palookup; } + [[fallthrough]]; case DUKECAR: case HELECOPT: // if(sp->picnum == HELECOPT || sp->picnum == DUKECAR) sp->xvel = 1024; @@ -520,6 +531,7 @@ int spawn_d(int j, int pn) sp->extra = 1; sp->xvel = 292; sp->zvel = 360; + [[fallthrough]]; case RESPAWNMARKERRED: case BLIMP: @@ -533,9 +545,11 @@ int spawn_d(int j, int pn) sp->cstat |= 257; sp->clipdist = 128; } + [[fallthrough]]; case MIKE: if(sp->picnum == MIKE) sp->yvel = sp->hitag; + [[fallthrough]]; case WEATHERWARN: changespritestat(i,1); break; @@ -548,6 +562,7 @@ int spawn_d(int j, int pn) sp->xrepeat = sp->yrepeat = 3; sp->cstat = 16+(krand()&12); insertspriteq(act); + [[fallthrough]]; case MONEY: case MAIL: case PAPER: @@ -576,6 +591,7 @@ int spawn_d(int j, int pn) case RESPAWN: sp->extra = 66-13; + [[fallthrough]]; case MUSICANDSFX: if( ud.multimode < 2 && sp->pal == 1) { @@ -697,6 +713,7 @@ int spawn_d(int j, int pn) if(sp->picnum != WATERDRIP) sp->ang = krand()&2047; + [[fallthrough]]; case WATERDRIPSPLASH: @@ -734,6 +751,7 @@ int spawn_d(int j, int pn) break; } } + [[fallthrough]]; case WATERBUBBLEMAKER: if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) { // JBF 20030913: Pisses off move(), eg. in bobsp2 @@ -753,6 +771,7 @@ int spawn_d(int j, int pn) case SIDEBOLT1+3: t[0] = sp->xrepeat; t[1] = sp->yrepeat; + [[fallthrough]]; case MASTERSWITCH: if(sp->picnum == MASTERSWITCH) sp->cstat |= 32768; @@ -775,6 +794,7 @@ int spawn_d(int j, int pn) case COMMANDERSTAYPUT: case BOSS4STAYPUT: act->actorstayput = sp->sectnum; + [[fallthrough]]; case BOSS1: case BOSS2: case BOSS3: @@ -783,6 +803,7 @@ int spawn_d(int j, int pn) case GREENSLIME: if(sp->picnum == GREENSLIME) sp->extra = 1; + [[fallthrough]]; case DRONE: case LIZTROOPONTOILET: case LIZTROOPJUSTSIT: @@ -942,6 +963,7 @@ int spawn_d(int j, int pn) sp->xrepeat = sp->yrepeat = 9; sp->yvel = 4; + [[fallthrough]]; case REACTOR2: case REACTOR: case RECON: @@ -1006,6 +1028,7 @@ int spawn_d(int j, int pn) } sp->pal = 0; + [[fallthrough]]; case ACCESSCARD: @@ -1037,6 +1060,7 @@ int spawn_d(int j, int pn) case WATERFOUNTAIN: sp->lotag = 1; + [[fallthrough]]; case TREE1: case TREE2: @@ -1072,6 +1096,7 @@ int spawn_d(int j, int pn) if(gs.camerashitable) sp->cstat = 257; else sp->cstat = 0; + [[fallthrough]]; case GENERICPOLE: @@ -1095,6 +1120,7 @@ int spawn_d(int j, int pn) sp->xvel = -8; ssp(act, CLIPMASK0); } + [[fallthrough]]; case CEILINGSTEAM: changespritestat(i,STAT_STANDABLE); break; @@ -1163,6 +1189,7 @@ int spawn_d(int j, int pn) case CANWITHSOMETHING4: case RUBBERCAN: sp->extra = 0; + [[fallthrough]]; case EXPLODINGBARREL: case HORSEONSIDE: case FIREBARREL: @@ -1178,6 +1205,7 @@ int spawn_d(int j, int pn) makeitfall(act); if(j >= 0) act->SetOwner(actj); else act->SetOwner(act); + [[fallthrough]]; case EGG: if( ud.monsters_off == 1 && sp->picnum == EGG ) diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 18c4087ee..ec8016c4e 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -234,6 +234,7 @@ int spawn_r(int j, int pn) if(sectp->floorpicnum == FLOORSLIME || sectp->ceilingpicnum == FLOORSLIME) sp->pal = 7; + [[fallthrough]]; case NEON1: case NEON2: case NEON3: @@ -245,6 +246,7 @@ int spawn_r(int j, int pn) sp->cstat |= 257; if(sp->picnum == DOMELITE) sp->cstat |= 257; + [[fallthrough]]; case JIBS1: case JIBS2: case JIBS3: @@ -354,6 +356,7 @@ int spawn_r(int j, int pn) sp->shade = 127; } sp->cstat |= 32; + [[fallthrough]]; case BLOODSPLAT1: case BLOODSPLAT2: @@ -447,6 +450,7 @@ int spawn_r(int j, int pn) case TOUGHGAL: sp->yvel = sp->hitag; sp->hitag = -1; + [[fallthrough]]; case QUEBALL: case STRIPEBALL: if (sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) @@ -555,6 +559,7 @@ int spawn_r(int j, int pn) sp->extra = 1; sp->xvel = 292; sp->zvel = 360; + [[fallthrough]]; case RESPAWNMARKERRED: if(sp->picnum == RESPAWNMARKERRED) { @@ -566,6 +571,7 @@ int spawn_r(int j, int pn) sp->cstat |= 257; sp->clipdist = 128; } + [[fallthrough]]; case MIKE: if(sp->picnum == MIKE) sp->yvel = sp->hitag; @@ -580,6 +586,7 @@ int spawn_r(int j, int pn) sp->xrepeat = sp->yrepeat = 3; sp->cstat = 16+(krand()&12); insertspriteq(act); + [[fallthrough]]; case MONEY: if(sp->picnum == MONEY) { @@ -597,6 +604,7 @@ int spawn_r(int j, int pn) break; case RESPAWN: sp->extra = 66-13; + [[fallthrough]]; case MUSICANDSFX: if (ud.multimode < 2 && sp->pal == 1) { @@ -725,6 +733,7 @@ int spawn_r(int j, int pn) changespritestat(i, STAT_MISC); break; } + [[fallthrough]]; case WATERBUBBLEMAKER: sp->cstat |= 32768; changespritestat(i,6); @@ -735,6 +744,7 @@ int spawn_r(int j, int pn) case BOLT1+3: t[0] = sp->xrepeat; t[1] = sp->yrepeat; + [[fallthrough]]; case MASTERSWITCH: if(sp->picnum == MASTERSWITCH) sp->cstat |= 32768; @@ -773,6 +783,7 @@ int spawn_r(int j, int pn) else goto default_case; case SBMOVE: if (isRRRA()) goto default_case; + [[fallthrough]]; case BILLYRAYSTAYPUT: case BRAYSNIPER: @@ -784,6 +795,7 @@ int spawn_r(int j, int pn) case COOTSTAYPUT: rrra_stayput: act->actorstayput = sp->sectnum; + [[fallthrough]]; case BOULDER: case BOULDER1: case RAT: @@ -1101,6 +1113,7 @@ int spawn_r(int j, int pn) act->SetOwner(act); sp->xrepeat = sp->yrepeat = 9; sp->yvel = 4; + [[fallthrough]]; case REACTOR2: case REACTOR: case RECON: @@ -1111,6 +1124,7 @@ int spawn_r(int j, int pn) case MOTOAMMO: case BOATAMMO: if (!isRRRA()) goto default_case; + [[fallthrough]]; case ATOMICHEALTH: case STEROIDS: @@ -1175,6 +1189,7 @@ int spawn_r(int j, int pn) } sp->pal = 0; + [[fallthrough]]; case ACCESSCARD: @@ -1316,6 +1331,7 @@ int spawn_r(int j, int pn) break; case WATERFOUNTAIN: sp->lotag = 1; + [[fallthrough]]; case TREE1: case TREE2: case TIRE: @@ -1355,6 +1371,7 @@ int spawn_r(int j, int pn) sp->xvel = -8; ssp(act, CLIPMASK0); } + [[fallthrough]]; case CEILINGSTEAM: changeactorstat(act, STAT_STANDABLE); break; @@ -1442,6 +1459,7 @@ int spawn_r(int j, int pn) case CANWITHSOMETHING: case RUBBERCAN: sp->extra = 0; + [[fallthrough]]; case EXPLODINGBARREL: case HORSEONSIDE: case FIREBARREL: @@ -1457,6 +1475,7 @@ int spawn_r(int j, int pn) makeitfall(act); if(j >= 0) act->SetOwner(actj); else act->SetOwner(act); + [[fallthrough]]; case EGG: if( ud.monsters_off == 1 && sp->picnum == EGG )