From 8b7a71a3f64d22a57cd984a7bda20b633588c811 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 20 Oct 2019 17:09:58 +0100 Subject: SWORD2: Fix Missing Default Switch Cases These are flagged by GCC if -Wswitch-default is enabled. --- engines/sword2/animation.cpp | 4 ++++ engines/sword2/controls.cpp | 9 +++++++++ engines/sword2/maketext.cpp | 2 ++ engines/sword2/mouse.cpp | 2 ++ engines/sword2/saveload.cpp | 2 ++ engines/sword2/screen.cpp | 9 ++++++++- engines/sword2/sound.cpp | 2 ++ 7 files changed, 29 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index d25133fe99..907e406b38 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -99,6 +99,8 @@ bool MoviePlayer::load(const char *name) { case kVideoDecoderMP2: filename = Common::String::format("%s.mp2", name); break; + default: + break; } // Need to switch to true color for PSX/MP2 videos @@ -243,6 +245,8 @@ void MoviePlayer::closeTextObject(uint32 index, Graphics::Surface *screen, uint1 case 4: \ WRITE_UINT32(dst, (c)); \ break; \ + default: \ + break; \ } void MoviePlayer::drawTextObject(uint32 index, Graphics::Surface *screen, uint16 pitch) { diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp index a4b540ac7b..3b34d42ffa 100644 --- a/engines/sword2/controls.cpp +++ b/engines/sword2/controls.cpp @@ -224,6 +224,9 @@ void FontRendererGui::drawText(byte *text, int x, int y, int alignment) { case kAlignCenter: x -= (textWidth / 2); break; + case kAlignLeft: + default: + break; } } @@ -365,6 +368,8 @@ int Dialog::runModal() { case RD_WHEELDOWN: _widgets[newHit]->onWheelDown(newMouseX, newMouseY); break; + default: + break; } } } @@ -463,6 +468,8 @@ void Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc) colTablePtr = _vm->fetchAnimHeader(file) + AnimHeader::size() + anim_head.noAnimFrames * CdtEntry::size(); break; + default: + break; } _sprites[state].x = x; @@ -1418,6 +1425,8 @@ int SaveRestoreDialog::runModal() { if (_vm->restoreGame(_selectedSlot) != SR_OK) result = 0; break; + default: + break; } } diff --git a/engines/sword2/maketext.cpp b/engines/sword2/maketext.cpp index 765ff0eaeb..f56495ec86 100644 --- a/engines/sword2/maketext.cpp +++ b/engines/sword2/maketext.cpp @@ -555,6 +555,8 @@ uint32 FontRenderer::buildNewBloc(byte *ascii, int16 x, int16 y, uint16 width, u x -= frame_head.width; y -= (frame_head.height) / 2; break; + default: + break; } // Ensure text sprite is a few pixels inside the visible screen diff --git a/engines/sword2/mouse.cpp b/engines/sword2/mouse.cpp index c5fed49347..ce050a2b25 100644 --- a/engines/sword2/mouse.cpp +++ b/engines/sword2/mouse.cpp @@ -408,6 +408,8 @@ void Mouse::systemMenuMouse() { dialog.runModal(); } break; + default: + break; } // Menu stays open on death screen. Otherwise it's closed. diff --git a/engines/sword2/saveload.cpp b/engines/sword2/saveload.cpp index 34f99923f7..05e8b5a12a 100644 --- a/engines/sword2/saveload.cpp +++ b/engines/sword2/saveload.cpp @@ -300,6 +300,8 @@ uint32 Sword2Engine::restoreFromBuffer(byte *buffer, uint32 size) { case 1575: // NicMegaC: scriptNo = 10; // script no.10 - 'player_is_nicoC' break; + default: + break; } _logic->runResScript(CUR_PLAYER_ID, scriptNo); diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp index fd8dca54f4..fb26c8222d 100644 --- a/engines/sword2/screen.cpp +++ b/engines/sword2/screen.cpp @@ -157,6 +157,8 @@ void Screen::setRenderLevel(int8 level) { // edge-blending + improved stretching _renderCaps = RDBLTFX_SPRITEBLEND | RDBLTFX_SHADOWBLEND | RDBLTFX_EDGEBLEND; break; + default: + break; } } @@ -609,6 +611,8 @@ void Screen::processImage(BuildUnit *build_unit) { if (Sword2Engine::isPsx()) colTablePtr++; // There is one additional byte to skip before the table in psx version break; + default: + break; } } @@ -1144,8 +1148,11 @@ void Screen::rollCredits() { spriteInfo.x = (RENDERWIDE - logoWidth) / 2; spriteInfo.w = logoWidth; spriteInfo.h = logoHeight; - } else + } else { spriteInfo.x = (RENDERWIDE - frame.width) / 2; + } + break; + default: break; } diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index 1e1687b1e6..0ac9de9caa 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -189,6 +189,8 @@ void Sound::processFxQueue() { // Once the looped FX has started we can ignore it, // but we can't close it since the WAV data is in use. break; + default: + break; } } } -- cgit v1.2.3