diff --git a/src/common/TilesetManager.h b/src/common/TilesetManager.h index e23ffe691..b361c1a75 100644 --- a/src/common/TilesetManager.h +++ b/src/common/TilesetManager.h @@ -43,7 +43,6 @@ class CTileset private: char szName[256]; char szTilesetPath[1024]; - char szGfxPack[256]; SDL_Surface * sSurfaces[3]; gfxSprite sSprites[3]; diff --git a/src/common/input.cpp b/src/common/input.cpp index b6011f1f4..d20556680 100644 --- a/src/common/input.cpp +++ b/src/common/input.cpp @@ -117,7 +117,6 @@ void CPlayerInput::Update(SDL_Event event, short iGameState) for (short iPlayer = -1; iPlayer < MAX_PLAYERS; iPlayer++) { CInputControl * inputControl; COutputControl * outputControl; - short iPlayerID = iPlayer; short iDeviceID = DEVICE_KEYBOARD; //Allow keyboard input from player 1 at all times (even when he is configured to use joystick) @@ -125,7 +124,6 @@ void CPlayerInput::Update(SDL_Event event, short iGameState) if (iGameState == 1 && inputControls[0]->iDevice != DEVICE_KEYBOARD) { inputControl = &game_values.inputConfiguration[0][0].inputGameControls[1]; outputControl = &outputControls[0]; - iPlayerID = 0; iDeviceID = game_values.inputConfiguration[0][0].iDevice; } else { continue; diff --git a/src/common/map.cpp b/src/common/map.cpp index 822b5b0ce..5a6a280b3 100644 --- a/src/common/map.cpp +++ b/src/common/map.cpp @@ -437,27 +437,13 @@ void DrawPlatform(short pathtype, TilesetTile ** tiles, short startX, short star CMap::CMap() - : iNumMapItems(0) - , iNumMapHazards(0) - , platforms(nullptr) - , iNumPlatforms(0) - , warpexits() - , maxConnection(0) + : warpexits() , tilebltrect() , bltrect() , drawareas() - , numdrawareas(0) , iSwitches() , racegoallocations() , flagbaselocations() - , iTileAnimationTimer(0) - , iTileAnimationFrame(0) - , iAnimatedBackgroundLayers(0) - , animatedFrontmapSurface(nullptr) - , animatedBackmapSurface(nullptr) - , animatedTilesSurface(nullptr) - , iAnimatedTileCount(0) - , numwarpexits(0) {} CMap::~CMap() diff --git a/src/common/map.h b/src/common/map.h index 96a06eeb1..407463e45 100644 --- a/src/common/map.h +++ b/src/common/map.h @@ -297,11 +297,11 @@ class CMap short eyecandy[3]; short musicCategoryID; - short iNumMapItems; - short iNumMapHazards; + short iNumMapItems = 0; + short iNumMapHazards = 0; - short iNumRaceGoals; - short iNumFlagBases; + short iNumRaceGoals = 0; + short iNumFlagBases = 0; private: @@ -317,8 +317,8 @@ class CMap std::vector animatedtiles; - MovingPlatform ** platforms; - short iNumPlatforms; + MovingPlatform ** platforms = nullptr; + short iNumPlatforms = 0; std::list tempPlatforms; @@ -330,17 +330,17 @@ class CMap short totalspawnsize[NUMSPAWNAREATYPES]; Warp warpdata[MAPWIDTH][MAPHEIGHT]; - short numwarpexits; //number of warp exits + short numwarpexits = 0; //number of warp exits WarpExit warpexits[MAXWARPS]; short warplocktimer[10]; bool warplocked[10]; - short maxConnection; + short maxConnection = 0; SDL_Rect tilebltrect; SDL_Rect bltrect; SDL_Rect drawareas[MAXDRAWAREAS]; - short numdrawareas; + short numdrawareas = 0; short iSwitches[4]; std::list switchBlocks[8]; @@ -351,17 +351,16 @@ class CMap Point flagbaselocations[4]; - short iTileAnimationTimer; - short iTileAnimationFrame; + short iTileAnimationTimer = 0; + short iTileAnimationFrame = 0; - short iAnimatedBackgroundLayers; - SDL_Surface * animatedFrontmapSurface; - SDL_Surface * animatedBackmapSurface; + short iAnimatedBackgroundLayers = 0; + SDL_Surface * animatedFrontmapSurface = nullptr; + SDL_Surface * animatedTilesSurface = nullptr; - SDL_Surface * animatedTilesSurface; - - short iAnimatedTileCount; + short iAnimatedTileCount = 0; short iAnimatedVectorIndices[NUM_FRAMES_BETWEEN_TILE_ANIMATION + 1]; + SDL_Surface * animatedBackmapSurface = nullptr; std::list platformdrawlayer[5]; diff --git a/src/leveleditor/leveleditor.cpp b/src/leveleditor/leveleditor.cpp index d303b73a1..d274cdd10 100644 --- a/src/leveleditor/leveleditor.cpp +++ b/src/leveleditor/leveleditor.cpp @@ -418,9 +418,9 @@ int main(int argc, char *argv[]) if (cmd.debug) { cmd::show_windows_console(); } - if (!cmd.data_root.empty()) + if (!cmd.data_root.empty()) { RootDataDirectory = cmd.data_root; - + } smw = new CGame(RootDataDirectory.c_str()); rm = new CResourceManager(); @@ -869,12 +869,6 @@ int editor_edit() if (fExiting) { //handle messages while (SDL_PollEvent(&event)) { - #if defined(USE_SDL2) || defined(__EMSCRIPTEN__) - const Uint8 * keystate = SDL_GetKeyboardState(NULL); - #else - Uint8 * keystate = SDL_GetKeyState(NULL); - #endif - switch (event.type) { case SDL_KEYDOWN: { #ifdef USE_SDL2 diff --git a/src/smw/GSSplashScreen.cpp b/src/smw/GSSplashScreen.cpp index 778af7b56..2ed9f3f30 100644 --- a/src/smw/GSSplashScreen.cpp +++ b/src/smw/GSSplashScreen.cpp @@ -188,9 +188,10 @@ void SplashScreenState::update() #ifndef _XBOX case SDLK_F4: - if (loop_event.key.keysym.mod & (KMOD_LALT | KMOD_RALT)) + if (loop_event.key.keysym.mod & (KMOD_LALT | KMOD_RALT)) { game_values.gamestate = GS_QUIT; return; + } break; case SDLK_INSERT: diff --git a/src/smw/gamemodes.cpp b/src/smw/gamemodes.cpp index 9a73d9a11..7bb9239f8 100644 --- a/src/smw/gamemodes.cpp +++ b/src/smw/gamemodes.cpp @@ -1113,7 +1113,6 @@ void CGM_ShyGuyTag::think() //Award points to non shyguys if (shyguycount > 0) { if (++scorecounter >= game_values.pointspeed) { - bool playwarning = false; scorecounter = 0; CPlayer * pCheckWinner = NULL; diff --git a/src/smw/objectgame.cpp b/src/smw/objectgame.cpp index 98c35f23f..5ef36776e 100644 --- a/src/smw/objectgame.cpp +++ b/src/smw/objectgame.cpp @@ -1365,10 +1365,11 @@ void MO_SuperFireball::update() setXf(fx + velx); setYf(fy + vely); - if (ix < 0) + if (ix < 0) { setXi(ix + smw->ScreenWidth); - else if (ix > smw->ScreenWidth - 1) + } else if (ix > smw->ScreenWidth - 1) { setXi(ix - smw->ScreenWidth); + } if (iy > smw->ScreenHeight|| iy < -ih || --ttl <= 0) removeifprojectile(this, false, true); @@ -5998,18 +5999,9 @@ bool CO_ThrowBox::collide(CPlayer * player) return false; } - if (HasKillVelocity()) { - short flipx = 0; - - if (player->ix + PW < 320 && ix > 320) - flipx = smw->ScreenWidth; - else if (ix + iw < 320 && player->ix > 320) - flipx = -smw->ScreenWidth; + if (HasKillVelocity() && player->globalID != iPlayerID) + return KillPlayer(player); - if (player->globalID != iPlayerID) { - return KillPlayer(player); - } - } /* //Kill player when another player is holding the box else diff --git a/src/smw/objects/MysteryMushroomTempPlayer.h b/src/smw/objects/MysteryMushroomTempPlayer.h index 05a995f53..be9b1d682 100644 --- a/src/smw/objects/MysteryMushroomTempPlayer.h +++ b/src/smw/objects/MysteryMushroomTempPlayer.h @@ -21,17 +21,12 @@ class MysteryMushroomTempPlayer float fOldX, fOldY; float velx, vely; - bool bobomb; - short powerup; - short burnupstarttimer, burnuptimer; - bool inair, onice, invincible; - short invincibletimer; + bool inair, onice; MovingPlatform * platform; - short iCapeFrameX, iCapeFrameY, iCapeTimer, iCapeYOffset; short gamepowerup; short iOldPowerupX, iOldPowerupY; diff --git a/src/smw/objects/moving/IceBlast.h b/src/smw/objects/moving/IceBlast.h index a12be2658..8cba3786f 100644 --- a/src/smw/objects/moving/IceBlast.h +++ b/src/smw/objects/moving/IceBlast.h @@ -12,7 +12,6 @@ class MO_IceBlast : public IO_MovingObject void draw(); private: - short colorOffset; short ttl; Spotlight * sSpotlight; }; diff --git a/src/smw/objects/moving/SledgeHammer.h b/src/smw/objects/moving/SledgeHammer.h index 495f0d3fa..49e6087d2 100644 --- a/src/smw/objects/moving/SledgeHammer.h +++ b/src/smw/objects/moving/SledgeHammer.h @@ -17,7 +17,6 @@ class MO_SledgeHammer : public IO_MovingObject short colorOffset; private: - short ttl; bool fSuper; }; diff --git a/src/smw/player.cpp b/src/smw/player.cpp index 258e61f43..231de2bc6 100644 --- a/src/smw/player.cpp +++ b/src/smw/player.cpp @@ -1857,11 +1857,8 @@ short CPlayer::KilledPlayer(CPlayer * killed, short deathstyle, killstyle style, if (killed->state != player_ready) return player_kill_none; - bool fSoundPlayed = false; - if (game_values.gamemode->chicken == killer && style != kill_style_pow) { + if (game_values.gamemode->chicken == killer && style != kill_style_pow) ifSoundOnPlay(rm->sfx_chicken); - fSoundPlayed = true; - } if (killed->frozen) deathstyle = death_style_shatter; diff --git a/src/smw/uicustomcontrol.cpp b/src/smw/uicustomcontrol.cpp index d33d064b5..5f0e12909 100644 --- a/src/smw/uicustomcontrol.cpp +++ b/src/smw/uicustomcontrol.cpp @@ -1866,10 +1866,8 @@ MI_BonusWheel::~MI_BonusWheel() { delete miContinueButton; - if (miBonusImages) { - for (int iImage = 0; iImage < NUMBONUSITEMSONWHEEL; iImage++) - delete miBonusImages[iImage]; - } + for (int iImage = 0; iImage < NUMBONUSITEMSONWHEEL; iImage++) + delete miBonusImages[iImage]; if (miPlayerImages) { for (int iPlayer = 0; iPlayer < iNumPlayers; iPlayer++) diff --git a/src/smw/uicustomcontrol.h b/src/smw/uicustomcontrol.h index dbc0b942e..1d03d3aea 100644 --- a/src/smw/uicustomcontrol.h +++ b/src/smw/uicustomcontrol.h @@ -528,7 +528,6 @@ class MI_World : public UI_Control void UseCloud(bool fUseCloud); short iState; - bool fItemPopup; short iStateTransition[4]; short iItemPopupDrawY[4]; short iPopupOffsets[4]; diff --git a/src/worldeditor/worldeditor.cpp b/src/worldeditor/worldeditor.cpp index c5825dafe..41c017653 100644 --- a/src/worldeditor/worldeditor.cpp +++ b/src/worldeditor/worldeditor.cpp @@ -1069,12 +1069,6 @@ int editor_edit() if (fExiting) { //handle messages while (SDL_PollEvent(&event)) { - #if defined(USE_SDL2) || defined(__EMSCRIPTEN__) - const Uint8 * keystate = SDL_GetKeyboardState(NULL); - #else - Uint8 * keystate = SDL_GetKeyState(NULL); - #endif - switch (event.type) { case SDL_KEYDOWN: { #ifdef USE_SDL2