GOB: Fix Missing Default Switch Cases

These are flagged by GCC if -Wswitch-default is enabled.
This commit is contained in:
D G Turner 2019-12-12 17:31:01 +00:00
parent f62dc99600
commit 799a088b6e
26 changed files with 158 additions and 0 deletions

View File

@ -381,6 +381,9 @@ void Draw::adjustCoords(char adjust, int16 *coord1, int16 *coord2) {
if (coord1)
*coord1 = *coord1 * 2 + 1;
break;
default:
break;
}
}

View File

@ -299,6 +299,9 @@ void Draw_Fascination::spriteOperation(int16 operation) {
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
break;
default:
break;
}
_spriteLeft = spriteLeft;

View File

@ -213,6 +213,8 @@ void Draw_v1::printTotText(int16 id) {
_backColor = cmd & 0xF;
spriteOperation(DRAW_FILLRECTABS);
break;
default:
break;
}
}
ptr += 2;
@ -485,6 +487,9 @@ void Draw_v1::spriteOperation(int16 operation) {
_destSpriteX, _destSpriteY, (_transparency == 0) ? -1 : 0);
break;
default:
break;
}
if (_renderFlags & RENDERFLAG_USEDELTAS) {

View File

@ -329,6 +329,8 @@ void Draw_v2::printTotText(int16 id) {
_backColor = cmd & 0xF;
spriteOperation(DRAW_FILLRECTABS);
break;
default:
break;
}
}
ptr += 2;
@ -916,6 +918,9 @@ void Draw_v2::spriteOperation(int16 operation) {
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
break;
default:
break;
}
_spriteLeft = spriteLeft;

View File

@ -174,6 +174,10 @@ void Expression::skipExpr(char stopToken) {
case OP_FUNC:
_vm->_game->_script->skip(1);
skipExpr(OP_END_EXPR);
break;
default:
break;
}
continue;
} // if ((operation >= OP_ARRAY_INT8) && (operation <= OP_FUNC))
@ -309,6 +313,9 @@ void Expression::printExpr_internal(char stopToken) {
debugN(5, "id(");
printExpr_internal(OP_END_EXPR);
break;
default:
break;
}
continue;
} // if ((operation >= OP_ARRAY_INT8) && (operation <= OP_FUNC))
@ -783,11 +790,17 @@ void Expression::loadValue(byte operation, uint32 varBase, const StackFrame &sta
_resultInt =
_vm->_util->getRandom(_resultInt);
break;
default:
break;
}
*stackFrame.opers = OP_LOAD_IMM_INT16;
*stackFrame.values = _resultInt;
break;
default:
break;
}
}
@ -823,6 +836,9 @@ void Expression::simpleArithmetic1(StackFrame &stackFrame) {
stackFrame.values[-2] &= stackFrame.values[0];
stackFrame.pop(2);
break;
default:
break;
}
}
@ -859,6 +875,9 @@ void Expression::simpleArithmetic2(StackFrame &stackFrame) {
stackFrame.values[-3] &= stackFrame.values[-1];
stackFrame.pop(2);
break;
default:
break;
}
}

View File

@ -721,6 +721,9 @@ void Goblin::adjustDest(int16 posX, int16 posY) {
case 3:
_pressedMapY -= resDelta;
break;
default:
break;
}
}
@ -1748,6 +1751,9 @@ void Goblin::animate(Mult::Mult_Object *obj) {
if (animData->frame >= framesCount)
animData->isPaused = 1;
break;
default:
break;
}
if ((animData->newState == -1) && (animData->frame >= framesCount)) {
@ -1873,6 +1879,9 @@ void Goblin::updateLayer1(Mult::Mult_AnimData *animData) {
case 23:
animData->layer = 21;
break;
default:
break;
}
}
@ -1905,6 +1914,9 @@ void Goblin::updateLayer2(Mult::Mult_AnimData *animData) {
case 23:
animData->layer = 24;
break;
default:
break;
}
}

View File

@ -396,6 +396,9 @@ void Goblin_v1::movePathFind(Mult::Mult_Object *obj,
gobDesc->curLookDir = 4;
_destItemId = -1;
break;
default:
break;
}
break;
@ -417,6 +420,9 @@ void Goblin_v1::movePathFind(Mult::Mult_Object *obj,
case 0:
gobDesc->nextState = 19;
break;
default:
break;
}
break;
}
@ -484,6 +490,9 @@ void Goblin_v1::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
case 24:
gobDesc->curLookDir = 6;
break;
default:
break;
}
}
@ -589,6 +598,9 @@ void Goblin_v1::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
case 38:
_gobPositions[_currentGoblin].y++;
break;
default:
break;
}
if (_currentGoblin == 1) {
@ -673,6 +685,9 @@ void Goblin_v1::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
case 38:
_gobPositions[_currentGoblin].y++;
break;
default:
break;
}
if (_currentGoblin == 1) {

View File

@ -354,6 +354,9 @@ void Goblin_v2::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
if (animData->frame >= framesCount)
animData->isPaused = 1;
break;
default:
break;
}
switch (animData->state) {
@ -404,6 +407,9 @@ void Goblin_v2::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
if (animData->pathExistence == 4)
animData->pathExistence = 5;
break;
default:
break;
}
if ((animData->newState != -1) && (animData->frame == framesCount) &&
@ -699,6 +705,9 @@ void Goblin_v2::advMovement(Mult::Mult_Object *obj, int8 state) {
obj->goblinX--;
obj->goblinY++;
break;
default:
break;
}
}

View File

@ -103,6 +103,9 @@ void Goblin_v3::advMovement(Mult::Mult_Object *obj, int8 state) {
obj->goblinX++;
obj->goblinY += 2;
break;
default:
break;
}
}

View File

@ -264,6 +264,9 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16
case 41:
animData->nextState = 31;
break;
default:
break;
}
break;
}
@ -373,6 +376,8 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16
case 7:
animData->nextState = 31;
break;
default:
break;
}
break;
}
@ -416,6 +421,9 @@ void Goblin_v4::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
if (animData->frame >= framesCount)
animData->isPaused = 1;
break;
default:
break;
}
switch (animData->state) {
@ -470,6 +478,9 @@ void Goblin_v4::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc,
if (animData->pathExistence == 4)
animData->pathExistence = 5;
break;
default:
break;
}
if ((animData->newState != -1) && (animData->frame == framesCount) &&
@ -595,6 +606,9 @@ int16 Goblin_v4::turnState(int16 state, uint16 dir) {
case 29:
dx = 2;
break;
default:
break;
}
switch (dir) {
@ -629,6 +643,9 @@ int16 Goblin_v4::turnState(int16 state, uint16 dir) {
case kDirSE:
cx = 5;
break;
default:
break;
}
return newStates[dx][cx];

View File

@ -1228,6 +1228,9 @@ uint16 Hotspots::handleInputs(int16 time, uint16 inputCount, uint16 &curInput,
if (curInput > 0)
curInput--;
break;
default:
break;
}
}
}
@ -1451,6 +1454,9 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
flags = ((uint16) kTypeClick) + (windowNum << 8) + (flags << 4);
break;
default:
break;
}
// Add the new hotspot

View File

@ -189,6 +189,9 @@ void Inter_Fascination::oFascin_assign(OpFuncParams &params) {
else
WRITE_VARO_STR(dest, _vm->_game->_script->getResultStr());
break;
default:
break;
}
}
}

View File

@ -155,6 +155,9 @@ void Inter_Playtoons::oPlaytoons_printText(OpFuncParams &params) {
sprintf(buf + i, "%s",
GET_VARO_STR(_vm->_game->_script->readVarIndex()));
break;
default:
break;
}
_vm->_game->_script->skip(1);
} else

View File

@ -901,6 +901,8 @@ void Inter_v1::o1_assign(OpFuncParams &params) {
WRITE_VARO_STR(dest, _vm->_game->_script->getResultStr());
break;
default:
break;
}
}
@ -969,6 +971,9 @@ void Inter_v1::o1_printText(OpFuncParams &params) {
sprintf(buf + i, "%s",
GET_VARO_STR(_vm->_game->_script->readVarIndex()));
break;
default:
break;
}
_vm->_game->_script->skip(1);
} else
@ -1059,6 +1064,9 @@ void Inter_v1::o1_palLoad(OpFuncParams &params) {
return;
}
break;
default:
break;
}
if ((cmd & 0x7F) == 0x30) {
@ -1164,6 +1172,9 @@ void Inter_v1::o1_palLoad(OpFuncParams &params) {
return;
}
break;
default:
break;
}
if (!_vm->_draw->_applyPal) {

View File

@ -757,6 +757,9 @@ void Inter_v2::o2_setGoblinState() {
(_vm->_scenery->_animBottom - _vm->_scenery->_animTop);
*(obj.pPosX) = obj.goblinX * _vm->_map->getTilesWidth();
break;
default:
break;
}
}
@ -1054,6 +1057,9 @@ void Inter_v2::o2_assign(OpFuncParams &params) {
else
WRITE_VARO_STR(dest, _vm->_game->_script->getResultStr());
break;
default:
break;
}
}
}
@ -1114,6 +1120,9 @@ void Inter_v2::o2_printText(OpFuncParams &params) {
sprintf(buf + i, "%s",
GET_VARO_STR(_vm->_game->_script->readVarIndex()));
break;
default:
break;
}
_vm->_game->_script->skip(1);
} else
@ -1283,6 +1292,9 @@ void Inter_v2::o2_getTotTextItemPart(OpFuncParams &params) {
case 4:
totData += 2;
break;
default:
break;
}
}

View File

@ -329,6 +329,9 @@ void Inter_v6::o6_assign(OpFuncParams &params) {
else
WRITE_VARO_STR(dest, _vm->_game->_script->getResultStr());
break;
default:
break;
}
}
}

View File

@ -92,6 +92,7 @@ void EvilFish::advance() {
switch (_state) {
case kStateNone:
default:
break;
case kStateSwimLeft:

View File

@ -715,6 +715,9 @@ void Penetration::createMap() {
_sub->sub = new Submarine(*_objects);
_sub->sub->setPosition(kPlayAreaX + kPlayAreaBorderWidth, kPlayAreaY + kPlayAreaBorderHeight);
break;
default:
break;
}
}
}

View File

@ -182,6 +182,9 @@ void Mult_v1::loadMult(int16 resId) {
case 5:
_vm->_game->_script->skip(_multData->sndKeys[i].freq * 2);
break;
default:
break;
}
}
@ -438,6 +441,9 @@ void Mult_v1::newCycleAnim(Mult_Object &animObj) {
animData.frame--;
animData.isPaused = 1;
break;
default:
break;
}
animData.newCycle = 1;
}

View File

@ -798,6 +798,9 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) {
case 10:
warning("Woodruff Stub: AnimType 10");
break;
default:
break;
}
animData.newCycle = 1;

View File

@ -96,6 +96,9 @@ void CharGenChild::advance() {
setPosition(x, y + 14);
}
break;
default:
break;
}
}

View File

@ -168,6 +168,9 @@ void Parents::handleFrameEvent() {
case 340:
playSound(kSoundCackle);
break;
default:
break;
}
}

View File

@ -300,6 +300,9 @@ char Script::evalExpr(int16 *pRes) {
case GOB_TRUE:
*pRes = 1;
break;
default:
break;
}
return type;

View File

@ -102,6 +102,7 @@ void BackgroundAtmosphere::getNextQueuePos() {
switch (_playMode) {
case Sound::kPlayModeLinear:
default:
_queuePos = (_queuePos + 1) % _queue.size();
break;

View File

@ -96,6 +96,8 @@ bool SoundDesc::load(SoundType type, byte *data, uint32 dSize) {
return loadSND(data, dSize);
case SOUND_WAV:
return loadWAV(data, dSize);
default:
break;
}
return false;

View File

@ -272,6 +272,8 @@ VariableReference &VariableReference::operator=(uint32 value) {
case Variables::kVariableType32:
_vars->writeOff32(_offset, value);
break;
default:
break;
}
}
return *this;
@ -286,6 +288,8 @@ VariableReference::operator uint32() {
return (uint32) _vars->readOff16(_offset);
case Variables::kVariableType32:
return _vars->readOff32(_offset);
default:
break;
}
}