Skip to content

Commit

Permalink
DM: Fix some more GCC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and Bendegúz Nagy committed Aug 26, 2016
1 parent 857d4e7 commit 5bd4464
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 42 deletions.
10 changes: 5 additions & 5 deletions engines/dm/inventory.cpp
Expand Up @@ -553,8 +553,8 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) {

_g422_objDescTextYpos = 87;

uint16 potentialAttribMask;
uint16 actualAttribMask;
uint16 potentialAttribMask = 0;
uint16 actualAttribMask = 0;
switch (thingType) {
case k5_WeaponThingType: {
potentialAttribMask = k0x0008_DescriptionMaskCursed | k0x0002_DescriptionMaskPoisoned | k0x0004_DescriptionMaskBroken;
Expand Down Expand Up @@ -588,9 +588,9 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) {
case k10_JunkThingType: {
if ((iconIndex >= k8_IconIndiceJunkWater) && (iconIndex <= k9_IconIndiceJunkWaterSkin)) {
potentialAttribMask = 0;
char *descString_EN_ANY[4] = {"(EMPTY)", "(ALMOST EMPTY)", "(ALMOST FULL)", "(FULL)"};
char *descString_DE_DEU[4] = {"(LEER)", "(FAST LEER)", "(FAST VOLL)", "(VOLL)"};
char *descString_FR_FRA[4] = {"(VIDE)", "(PRESQUE VIDE)", "(PRESQUE PLEINE)", "(PLEINE)"};
const char *descString_EN_ANY[4] = {"(EMPTY)", "(ALMOST EMPTY)", "(ALMOST FULL)", "(FULL)"};
const char *descString_DE_DEU[4] = {"(LEER)", "(FAST LEER)", "(FAST VOLL)", "(VOLL)"};
const char *descString_FR_FRA[4] = {"(VIDE)", "(PRESQUE VIDE)", "(PRESQUE PLEINE)", "(PLEINE)"};

Junk *junk = (Junk *)rawThingPtr;
switch (_vm->getGameLanguage()) { // localized
Expand Down
51 changes: 30 additions & 21 deletions engines/dm/menus.cpp
Expand Up @@ -282,25 +282,23 @@ void MenuMan::f387_drawActionArea() {
_g508_refreshActionArea = false;
}

const char *g490_ChampionActionNames[44] = { // @ G0490_ac_Graphic560_ActionNames
"N", "BLOCK", "CHOP", "X", "BLOW HORN", "FLIP", "PUNCH",
"KICK", "WAR CRY", "STAB", "CLIMB DOWN", "FREEZE LIFE",
"HIT", "SWING", "STAB", "THRUST", "JAB", "PARRY", "HACK",
"BERZERK", "FIREBALL", "DISPELL", "CONFUSE", "LIGHTNING",
"DISRUPT", "MELEE", "X", "INVOKE", "SLASH", "CLEAVE",
"BASH", "STUN", "SHOOT", "SPELLSHIELD", "FIRESHIELD",
"FLUXCAGE", "HEAL", "CALM", "LIGHT", "WINDOW", "SPIT",
"BRANDISH", "THROW", "FUSE"};

const char* MenuMan::f384_getActionName(ChampionAction actionIndex) {
const char *g490_ChampionActionNames[44] = { // @ G0490_ac_Graphic560_ActionNames
"N", "BLOCK", "CHOP", "X", "BLOW HORN", "FLIP", "PUNCH",
"KICK", "WAR CRY", "STAB", "CLIMB DOWN", "FREEZE LIFE",
"HIT", "SWING", "STAB", "THRUST", "JAB", "PARRY", "HACK",
"BERZERK", "FIREBALL", "DISPELL", "CONFUSE", "LIGHTNING",
"DISRUPT", "MELEE", "X", "INVOKE", "SLASH", "CLEAVE",
"BASH", "STUN", "SHOOT", "SPELLSHIELD", "FIRESHIELD",
"FLUXCAGE", "HEAL", "CALM", "LIGHT", "WINDOW", "SPIT",
"BRANDISH", "THROW", "FUSE"
};

return (actionIndex == k255_ChampionActionNone) ? "" : g490_ChampionActionNames[actionIndex];
}


Box g504_BoxSpellAreaControls = Box(233, 319, 42, 49); // @ G0504_s_Graphic560_Box_SpellAreaControls

void MenuMan::f393_drawSpellAreaControls(ChampionIndex champIndex) {

static Box boxSpellAreaControls(233, 319, 42, 49); // @ G0504_s_Graphic560_Box_SpellAreaControls

Champion *champ = &_vm->_championMan->_champions[champIndex];
_vm->_displayMan->_g578_useByteBoxCoordinates = false;
Expand All @@ -309,7 +307,7 @@ void MenuMan::f393_drawSpellAreaControls(ChampionIndex champIndex) {
int16 champHP2 = _vm->_championMan->_champions[2]._currHealth;
int16 champHP3 = _vm->_championMan->_champions[3]._currHealth;
_vm->_eventMan->f78_showMouse();
_vm->_displayMan->D24_fillScreenBox(g504_BoxSpellAreaControls, k0_ColorBlack);
_vm->_displayMan->D24_fillScreenBox(boxSpellAreaControls, k0_ColorBlack);
switch (champIndex) {
case 0:
_vm->_eventMan->f6_highlightScreenBox(233, 277, 42, 49);
Expand Down Expand Up @@ -361,6 +359,9 @@ void MenuMan::f393_drawSpellAreaControls(ChampionIndex champIndex) {
}
_vm->_eventMan->f6_highlightScreenBox(275, 319, 42, 49);
_vm->_textMan->f53_printToLogicalScreen(277, 48, k0_ColorBlack, k4_ColorCyan, champ->_name);
break;
default:
break;
}
_vm->_eventMan->f77_hideMouse();
}
Expand Down Expand Up @@ -443,7 +444,8 @@ void MenuMan::f457_drawEnabledMenus() {
_g509_actionAreaContainsIcons = true;
}
f387_drawActionArea();
if (AL1462_i_InventoryChampionOrdinal = _vm->_inventoryMan->_g432_inventoryChampionOrdinal) {
AL1462_i_InventoryChampionOrdinal = _vm->_inventoryMan->_g432_inventoryChampionOrdinal;
if (AL1462_i_InventoryChampionOrdinal) {
_vm->_inventoryMan->_g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone);
_vm->_inventoryMan->f355_toggleInventory((ChampionIndex)_vm->M1_ordinalToIndex(AL1462_i_InventoryChampionOrdinal));
} else {
Expand Down Expand Up @@ -501,7 +503,8 @@ int16 MenuMan::f412_getChampionSpellCastResult(uint16 champIndex) {
if (!(L1270_ps_Champion->_currHealth)) {
return k0_spellCastFailure;
}
if ((L1271_ps_Spell = f409_getSpellFromSymbols((unsigned char *)L1270_ps_Champion->_symbols)) == 0) {
L1271_ps_Spell = f409_getSpellFromSymbols((unsigned char *)L1270_ps_Champion->_symbols);
if (L1271_ps_Spell == 0) {
f410_menusPrintSpellFailureMessage(L1270_ps_Champion, k1_spellCastSuccess, 0);
return k0_spellCastFailure;
}
Expand Down Expand Up @@ -1276,9 +1279,10 @@ bool MenuMan::f407_isActionPerformed(uint16 champIndex, int16 actionIndex) {
case k10_ChampionActionClimbDown:
L1251_i_MapX = _vm->_dungeonMan->_g306_partyMapX;
L1252_i_MapY = _vm->_dungeonMan->_g307_partyMapY;
L1251_i_MapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_g308_partyDir], L1252_i_MapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir];
L1251_i_MapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_g308_partyDir];
L1252_i_MapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir];
/* CHANGE6_00_FIX The presence of a group over the pit is checked so that you cannot climb down a pit with the rope if there is a group levitating over it */
if ((_vm->_dungeonMan->f151_getSquare(L1251_i_MapX, L1252_i_MapY).getType() == k2_ElementTypePit) && (_vm->_groupMan->f175_groupGetThing(L1251_i_MapX, L1252_i_MapY) == Thing::_endOfList)) {
if ((_vm->_dungeonMan->f151_getSquare(L1251_i_MapX, L1252_i_MapY).getType() == k2_PitElemType) && (_vm->_groupMan->f175_groupGetThing(L1251_i_MapX, L1252_i_MapY) == Thing::_endOfList)) {
/* BUG0_77 The party moves forward when using the rope in front of a closed pit. The engine does not check whether the pit is open before moving the party over the pit. This is not consistent with the behavior when using the rope in front of a corridor where nothing happens */
_vm->_moveSens->_g402_useRopeToClimbDownPit = true;
_vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, L1251_i_MapX, L1252_i_MapY);
Expand Down Expand Up @@ -1311,7 +1315,8 @@ bool MenuMan::f407_isActionPerformed(uint16 champIndex, int16 actionIndex) {
break;
case k42_ChampionActionThrow:
f406_setChampionDirectionToPartyDirection(L1247_ps_Champion);
if (AL1245_B_ActionPerformed = _vm->_championMan->isObjectThrown(champIndex, k1_ChampionSlotActionHand, (L1247_ps_Champion->_cell == returnNextVal(_vm->_dungeonMan->_g308_partyDir)) || (L1247_ps_Champion->_cell == returnOppositeDir(_vm->_dungeonMan->_g308_partyDir)))) {
AL1245_B_ActionPerformed = _vm->_championMan->isObjectThrown(champIndex, k1_ChampionSlotActionHand, (L1247_ps_Champion->_cell == returnNextVal(_vm->_dungeonMan->_g308_partyDir)) || (L1247_ps_Champion->_cell == (ViewCell)returnOppositeDir(_vm->_dungeonMan->_g308_partyDir)));
if (AL1245_B_ActionPerformed) {
_vm->_timeline->_g370_events[L1247_ps_Champion->_enableActionEventIndex]._B._slotOrdinal = _vm->M0_indexToOrdinal(k1_ChampionSlotActionHand);
}
}
Expand Down Expand Up @@ -1355,6 +1360,9 @@ void MenuMan::f405_decrementCharges(Champion* champ) {
if (L1243_ps_Junk->getChargeCount()) {
L1243_ps_Junk->setChargeCount(L1243_ps_Junk->getChargeCount() - 1);
}
break;
default:
break;
}
_vm->_championMan->drawChangedObjectIcons();
}
Expand Down Expand Up @@ -1463,7 +1471,8 @@ bool MenuMan::f402_isMeleeActionPerformed(int16 champIndex, Champion* champ, int
_vm->_sound->f064_SOUND_RequestPlay_CPSD(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k1_soundModePlayIfPrioritized);
if (_g517_actionTargetGroupThing == Thing::_endOfList)
goto T0402010;
if (L1238_i_CreatureOrdinal = _vm->_groupMan->f177_getMeleeTargetCreatureOrdinal(targetMapX, targetMapY, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, AL1236_ui_ChampionCell = champ->_cell)) {
L1238_i_CreatureOrdinal = _vm->_groupMan->f177_getMeleeTargetCreatureOrdinal(targetMapX, targetMapY, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, AL1236_ui_ChampionCell = champ->_cell);
if (L1238_i_CreatureOrdinal) {
switch (M21_normalizeModulo4(AL1236_ui_ChampionCell + 4 - champ->_dir)) {
case k2_ViewCellBackRight: /* Champion is on the back right of the square and tries to attack a creature in the front right of its square */
AL1237_ui_CellDelta = 3;
Expand Down
31 changes: 18 additions & 13 deletions engines/dm/movesens.cpp
Expand Up @@ -363,7 +363,8 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16
_vm->_dungeonMan->f173_setCurrentMap(L0714_ui_MapIndexSource);
AL0727_ui_Outcome = _vm->_groupMan->f191_getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->f156_getThingData(thing), mapX, mapY, 20, false);
_vm->_dungeonMan->f173_setCurrentMap(L0715_ui_MapIndexDestination);
if (L0722_B_FallKilledGroup = (AL0727_ui_Outcome == k2_outcomeKilledAllCreaturesInGroup))
L0722_B_FallKilledGroup = (AL0727_ui_Outcome == k2_outcomeKilledAllCreaturesInGroup);
if (L0722_B_FallKilledGroup)
break;
if (AL0727_ui_Outcome == k1_outcomeKilledSomeCreaturesInGroup) {
_vm->_groupMan->f187_dropMovingCreatureFixedPossession(thing, destMapX, destMapY);
Expand Down Expand Up @@ -782,7 +783,9 @@ void MovesensMan::f276_sensorProcessThingAdditionOrRemoval(uint16 mapX, uint16 m
if ((!addThing) && (L0767_i_ThingType != kM1_PartyThingType)) {
_vm->_dungeonMan->f164_unlinkThingFromList(thing, Thing(0), mapX, mapY);
}
if (Square(L0777_ui_Square = _vm->_dungeonMan->_g271_currMapData[mapX][mapY]).getType() == k0_ElementTypeWall) {

L0777_ui_Square = _vm->_dungeonMan->_g271_currMapData[mapX][mapY];
if (Square(L0777_ui_Square).getType() == k0_ElementTypeWall) {
L0770_ui_SensorTriggeredCell = thing.getCell();
} else {
L0770_ui_SensorTriggeredCell = kM1_CellAny; // this will wrap around
Expand Down Expand Up @@ -822,7 +825,8 @@ void MovesensMan::f276_sensorProcessThingAdditionOrRemoval(uint16 mapX, uint16 m
}
L0766_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(mapX, mapY);
while (L0766_T_Thing != Thing::_endOfList) {
if ((L0771_ui_ThingType = (L0766_T_Thing).getType()) == k3_SensorThingType) {
L0771_ui_ThingType = (L0766_T_Thing).getType();
if (L0771_ui_ThingType == k3_SensorThingType) {
L0769_ps_Sensor = (Sensor *)_vm->_dungeonMan->f156_getThingData(L0766_T_Thing);
if ((L0769_ps_Sensor)->getType() == k0_SensorDisabled)
goto T0276079;
Expand Down Expand Up @@ -857,7 +861,7 @@ void MovesensMan::f276_sensorProcessThingAdditionOrRemoval(uint16 mapX, uint16 m
goto T0276079;
break;
case k5_SensorFloorPartyOnStairs:
if ((L0767_i_ThingType != kM1_PartyThingType) || (Square(L0777_ui_Square).getType() != k3_ElementTypeStairs))
if ((L0767_i_ThingType != kM1_PartyThingType) || (Square(L0777_ui_Square).getType() != k3_StairsElemType))
goto T0276079;
break;
case k6_SensorFloorGroupGenerator:
Expand All @@ -874,7 +878,7 @@ void MovesensMan::f276_sensorProcessThingAdditionOrRemoval(uint16 mapX, uint16 m
case k9_SensorFloorVersionChecker:
if ((L0767_i_ThingType != kM1_PartyThingType) || !addThing || partySquare)
goto T0276079;
// Strangerke: 20 is a harcoded version of the game. later version uses 21. Not present in the original dungeons anyway.
// Strangerke: 20 is a hardcoded version of the game. later version uses 21. Not present in the original dungeons anyway.
L0768_B_TriggerSensor = (L0779_i_SensorData <= 20);
break;
default:
Expand All @@ -901,15 +905,15 @@ void MovesensMan::f276_sensorProcessThingAdditionOrRemoval(uint16 mapX, uint16 m
}
}
L0768_B_TriggerSensor ^= L0769_ps_Sensor->getRevertEffectA();
if ((L0778_i_Effect = L0769_ps_Sensor->getEffectA()) == k3_SensorEffHold) {
L0778_i_Effect = L0769_ps_Sensor->getEffectA();
if (L0778_i_Effect == k3_SensorEffHold) {
L0778_i_Effect = L0768_B_TriggerSensor ? k0_SensorEffSet : k1_SensorEffClear;
} else {
if (!L0768_B_TriggerSensor)
goto T0276079;
}
if (L0769_ps_Sensor->getAudibleA()) {
} else if (!L0768_B_TriggerSensor)
goto T0276079;

if (L0769_ps_Sensor->getAudibleA())
_vm->_sound->f064_SOUND_RequestPlay_CPSD(k01_soundSWITCH, mapX, mapY, k1_soundModePlayIfPrioritized);
}

f272_sensorTriggerEffect(L0769_ps_Sensor, L0778_i_Effect, mapX, mapY, (uint16)kM1_CellAny); // this will wrap around
goto T0276079;
}
Expand Down Expand Up @@ -939,7 +943,8 @@ bool MovesensMan::f274_sensorIsObjcetInPartyPossession(int16 objectType) {
for (L0743_ui_SlotIndex = k0_ChampionSlotReadyHand; (L0743_ui_SlotIndex < k30_ChampionSlotChest_1) && !L0748_B_LeaderHandObjectProcessed; L0743_ui_SlotIndex++) {
L0744_T_Thing = *L0746_pT_Thing++;
T0274003:
if ((L0747_i_ObjectType = _vm->_objectMan->f32_getObjectType(L0744_T_Thing)) == objectType) {
L0747_i_ObjectType = _vm->_objectMan->f32_getObjectType(L0744_T_Thing);
if (L0747_i_ObjectType == objectType) {
return true;
}
if (L0747_i_ObjectType == k144_IconIndiceContainerChestClosed) {
Expand Down
11 changes: 8 additions & 3 deletions engines/dm/projexpl.cpp
Expand Up @@ -465,13 +465,18 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) {
L0520_ps_Projectile->_attack -= AL0516_ui_StepEnergy;
}
}
if (L0522_B_ProjectileMovesToOtherSquare = ((L0517_ui_ProjectileDirection = L0519_ps_Event->_C._projectile.getDir()) == (L0518_ui_Cell = (L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)).getCell())) || (returnNextVal(L0517_ui_ProjectileDirection) == L0518_ui_Cell)) {
L0517_ui_ProjectileDirection = L0519_ps_Event->_C._projectile.getDir();
L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot);
L0518_ui_Cell = L0515_T_ProjectileThingNewCell.getCell();
L0522_B_ProjectileMovesToOtherSquare = (L0517_ui_ProjectileDirection == L0518_ui_Cell) || (returnNextVal(L0517_ui_ProjectileDirection) == L0518_ui_Cell);
if (L0522_B_ProjectileMovesToOtherSquare) {
L0525_i_SourceMapX = L0523_i_DestinationMapX;
L0526_i_SourceMapY = L0524_i_DestinationMapY;
L0523_i_DestinationMapX += _vm->_dirIntoStepCountEast[L0517_ui_ProjectileDirection], L0524_i_DestinationMapY += _vm->_dirIntoStepCountNorth[L0517_ui_ProjectileDirection];
if ((Square(AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte()).getType() == k0_ElementTypeWall) ||
AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte();
if ((Square(AL0516_ui_Square).getType() == k0_WallElemType) ||
((Square(AL0516_ui_Square).getType() == k6_FakeWallElemType) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) ||
((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_ElementTypeStairs))) {
((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_StairsElemType))) {
if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) {
return;
}
Expand Down

0 comments on commit 5bd4464

Please sign in to comment.