From 0233b503f1e74b15350f71d7d906e10091ac2688 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Aug 2016 00:31:34 +0200 Subject: DM: Some more work on GCC warnings --- engines/dm/movesens.cpp | 23 +++++++++----- engines/dm/projexpl.cpp | 10 ++++-- engines/dm/sounds.cpp | 82 ++++++++++++++++++++++++++----------------------- engines/dm/sounds.h | 4 +++ engines/dm/text.cpp | 4 ++- engines/dm/timeline.cpp | 5 ++- 6 files changed, 78 insertions(+), 50 deletions(-) (limited to 'engines') diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 57bd51f6af..e961ecaab9 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -587,10 +587,14 @@ bool MovesensMan::f266_moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMa AL0700_i_SecondaryDirection = returnNextVal(AL0699_ui_PrimaryDirection); for (int16 i = 0; i < 4; ++i) L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[i] = 0; - if (L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[returnPrevVal(AL0699_ui_PrimaryDirection)] = L0707_auc_ChampionOrCreatureOrdinalInCell[AL0699_ui_PrimaryDirection]) { + + L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[returnPrevVal(AL0699_ui_PrimaryDirection)] = L0707_auc_ChampionOrCreatureOrdinalInCell[AL0699_ui_PrimaryDirection]; + if (L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[returnPrevVal(AL0699_ui_PrimaryDirection)]) { L0703_B_CheckDestinationSquareProjectileImpacts = true; } - if (L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[returnNextVal(AL0700_i_SecondaryDirection)] = L0707_auc_ChampionOrCreatureOrdinalInCell[AL0700_i_SecondaryDirection]) { + + L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[returnNextVal(AL0700_i_SecondaryDirection)] = L0707_auc_ChampionOrCreatureOrdinalInCell[AL0700_i_SecondaryDirection]; + if (L0706_auc_IntermediaryChampionOrCreatureOrdinalInCell[returnNextVal(AL0700_i_SecondaryDirection)]) { L0703_B_CheckDestinationSquareProjectileImpacts = true; } if (!L0707_auc_ChampionOrCreatureOrdinalInCell[AL0699_ui_PrimaryDirection]) { @@ -700,19 +704,25 @@ int16 MovesensMan::f262_getTeleporterRotatedGroupResult(Teleporter* teleporter, L0686_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(thing); L0683_i_Rotation = teleporter->getRotation(); L0684_ui_GroupDirections = _vm->_groupMan->f147_getGroupDirections(L0686_ps_Group, mapIndex); - if (L0689_B_AbsoluteRotation = teleporter->getAbsoluteRotation()) { + + L0689_B_AbsoluteRotation = teleporter->getAbsoluteRotation(); + if (L0689_B_AbsoluteRotation) { L0685_ui_UpdatedGroupDirections = L0683_i_Rotation; } else { L0685_ui_UpdatedGroupDirections = M21_normalizeModulo4(L0684_ui_GroupDirections + L0683_i_Rotation); } - if ((L0687_ui_UpdatedGroupCells = _vm->_groupMan->f145_getGroupCells(L0686_ps_Group, mapIndex)) != k255_CreatureTypeSingleCenteredCreature) { + + L0687_ui_UpdatedGroupCells = _vm->_groupMan->f145_getGroupCells(L0686_ps_Group, mapIndex); + if (L0687_ui_UpdatedGroupCells != k255_CreatureTypeSingleCenteredCreature) { L0690_ui_GroupCells = L0687_ui_UpdatedGroupCells; L0691_i_CreatureSize = getFlag(g243_CreatureInfo[L0686_ps_Group->_type]._attributes, k0x0003_MaskCreatureInfo_size); L0692_i_RelativeRotation = M21_normalizeModulo4(4 + L0685_ui_UpdatedGroupDirections - L0684_ui_GroupDirections); for (L0688_i_CreatureIndex = 0; L0688_i_CreatureIndex <= L0686_ps_Group->getCount(); L0688_i_CreatureIndex++) { L0685_ui_UpdatedGroupDirections = _vm->_groupMan->f178_getGroupValueUpdatedWithCreatureValue(L0685_ui_UpdatedGroupDirections, L0688_i_CreatureIndex, L0689_B_AbsoluteRotation ? L0683_i_Rotation : M21_normalizeModulo4(L0684_ui_GroupDirections + L0683_i_Rotation)); - if ((L0691_i_CreatureSize == k0_MaskCreatureSizeQuarter) && (L0692_i_RelativeRotation = !L0689_B_AbsoluteRotation)) { - L0692_i_RelativeRotation = L0683_i_Rotation; + if (L0691_i_CreatureSize == k0_MaskCreatureSizeQuarter) { + L0692_i_RelativeRotation = !L0689_B_AbsoluteRotation; + if (L0692_i_RelativeRotation) + L0692_i_RelativeRotation = L0683_i_Rotation; } if (L0692_i_RelativeRotation) { L0687_ui_UpdatedGroupCells = _vm->_groupMan->f178_getGroupValueUpdatedWithCreatureValue(L0687_ui_UpdatedGroupCells, L0688_i_CreatureIndex, M21_normalizeModulo4(L0690_ui_GroupCells + L0692_i_RelativeRotation)); @@ -733,7 +743,6 @@ Thing MovesensMan::f263_getTeleporterRotatedProjectileThing(Teleporter* teleport int16 L0693_i_UpdatedDirection; int16 L0694_i_Rotation; - L0693_i_UpdatedDirection = _g400_moveResultDir; L0694_i_Rotation = teleporter->getRotation(); if (teleporter->getAbsoluteRotation()) { diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 95e3165907..2ca7be1951 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -129,6 +129,9 @@ T0217004: L0509_B_RemovePotion = true; L0508_i_PotionPower = ((Potion *)L0491_ps_Group)->getPower(); L0492_ps_Potion = (Potion *)L0491_ps_Group; + break; + default: + break; } } L0505_B_CreateExplosionOnImpact = (L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) && (L0486_T_ProjectileAssociatedThing != Thing::_explSlime) && (L0486_T_ProjectileAssociatedThing != Thing::_explPoisonBolt); @@ -190,7 +193,8 @@ T0217004: if (getFlag(L0493_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (L0486_T_ProjectileAssociatedThing != Thing::_explHarmNonMaterial)) { return false; } - if (L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense) { + L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense; + if (L0488_i_Attack) { if ((AL0487_i_Outcome = _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _g366_projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { _vm->_groupMan->f209_processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); } @@ -466,8 +470,8 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { 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) || - ((Square(AL0516_ui_Square).getType() == k6_ElementTypeFakeWall) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || - ((Square(AL0516_ui_Square).getType() == k3_ElementTypeStairs) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_ElementTypeStairs))) { + ((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))) { if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } diff --git a/engines/dm/sounds.cpp b/engines/dm/sounds.cpp index c041715fd3..fe53f110ef 100644 --- a/engines/dm/sounds.cpp +++ b/engines/dm/sounds.cpp @@ -47,50 +47,56 @@ SoundMan* SoundMan::getSoundMan(DMEngine* vm, const DMADGameDescription* gameVer } } -SoundMan::SoundMan(DMEngine* vm) : _vm(vm) {} +void SoundMan::initConstants() { + Sound sounds[k34_D13_soundCount] = { + Sound(533, 112, 11, 3, 6), /* k00_soundMETALLIC_THUD 0 */ + Sound(534, 112, 15, 0, 3), /* k01_soundSWITCH 1 */ + Sound(535, 112, 72, 3, 6), /* k02_soundDOOR_RATTLE 2 */ + Sound(550, 112, 60, 3, 5), /* k03_soundATTACK_PAIN_RAT_HELLHOUND_RED_DRAGON 3 */ + Sound(536, 112, 10, 3, 6), /* k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM 4 */ + Sound(537, 112, 99, 3, 7), /* k05_soundSTRONG_EXPLOSION 5 */ + Sound(539, 112, 110, 3, 6), /* k06_soundSCREAM 6 */ + Sound(551, 112, 55, 3, 5), /* k07_soundATTACK_MUMMY_GHOST_RIVE 7 */ + Sound(540, 112, 2, 3, 6), /* k08_soundSWALLOW 8 */ + Sound(541, 112, 80, 3, 6), /* k09_soundCHAMPION_0_DAMAGED 9 */ + Sound(542, 112, 82, 3, 6), /* k10_soundCHAMPION_1_DAMAGED 10 */ + Sound(543, 112, 84, 3, 6), /* k11_soundCHAMPION_2_DAMAGED 11 */ + Sound(544, 112, 86, 3, 6), /* k12_soundCHAMPION_3_DAMAGED 12 */ + Sound(545, 112, 95, 3, 6), /* k13_soundSPELL 13 */ + Sound(552, 112, 57, 3, 5), /* k14_soundATTACK_SCREAMER_OITU 14 */ + Sound(553, 112, 52, 3, 5), /* k15_soundATTACK_GIANT_SCORPION_SCORPION 15 */ + Sound(546, 112, 40, 2, 4), /* k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT 16 */ + Sound(547, 112, 70, 1, 4), /* k17_soundBUZZ 17 */ + Sound(549, 138, 75, 3, 6), /* k18_soundPARTY_DAMAGED 18 */ + Sound(554, 112, 50, 3, 5), /* k19_soundATTACK_MAGENTA_WORM_WORM 19 */ + Sound(537, 112, 98, 0, 4), /* k20_soundWEAK_EXPLOSION 20 */ + Sound(555, 112, 96, 2, 4), /* k21_soundATTACK_GIGGLER 21 */ + Sound(563, 138, 24, 0, 4), /* k22_soundMOVE_ANIMATED_ARMOUR_DETH_KNIGHT 22 Atari ST: not present */ + Sound(564, 138, 21, 0, 4), /* k23_soundMOVE_COUATL_GIANT_WASP_MUNCHER 23 Atari ST: not present */ + Sound(565, 138, 23, 0, 4), /* k24_soundMOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON 24 Atari ST: not present */ + Sound(566, 138, 105, 0, 4), /* k25_soundBLOW_HORN 25 Atari ST: not present */ + Sound(567, 138, 27, 0, 4), /* k26_soundMOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU 26 Atari ST: not present */ + Sound(568, 138, 28, 0, 4), /* k27_soundMOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL 27 Atari ST: not present */ + Sound(569, 138, 106, 0, 4), /* k28_soundWAR_CRY 28 Atari ST: not present */ + Sound(570, 138, 56, 0, 4), /* k29_soundATTACK_ROCK_ROCKPILE 29 Atari ST: not present */ + Sound(571, 138, 58, 0, 4), /* k30_soundATTACK_WATER_ELEMENTAL 30 Atari ST: not present */ + Sound(572, 112, 53, 0, 4), /* k31_soundATTACK_COUATL 31 Atari ST: not present */ + Sound(573, 138, 29, 0, 4), /* k32_soundMOVE_RED_DRAGON 32 Atari ST: not present */ + Sound(574, 150, 22, 0, 4) /* k33_soundMOVE_SKELETON 33 Atari ST: not present */ + }; + for (int i = 0; i < k34_D13_soundCount; i++) + g60_sounds[i] = sounds[i]; +} + +SoundMan::SoundMan(DMEngine* vm) : _vm(vm) { + initConstants(); +} SoundMan::~SoundMan() { for (uint16 i = 0; i < k34_D13_soundCount; ++i) delete[] _gK24_soundData[i]._firstSample; } - -Sound g60_sounds[k34_D13_soundCount] = { -Sound(533, 112, 11, 3, 6), /* k00_soundMETALLIC_THUD 0 */ -Sound(534, 112, 15, 0, 3), /* k01_soundSWITCH 1 */ -Sound(535, 112, 72, 3, 6), /* k02_soundDOOR_RATTLE 2 */ -Sound(550, 112, 60, 3, 5), /* k03_soundATTACK_PAIN_RAT_HELLHOUND_RED_DRAGON 3 */ -Sound(536, 112, 10, 3, 6), /* k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM 4 */ -Sound(537, 112, 99, 3, 7), /* k05_soundSTRONG_EXPLOSION 5 */ -Sound(539, 112, 110, 3, 6), /* k06_soundSCREAM 6 */ -Sound(551, 112, 55, 3, 5), /* k07_soundATTACK_MUMMY_GHOST_RIVE 7 */ -Sound(540, 112, 2, 3, 6), /* k08_soundSWALLOW 8 */ -Sound(541, 112, 80, 3, 6), /* k09_soundCHAMPION_0_DAMAGED 9 */ -Sound(542, 112, 82, 3, 6), /* k10_soundCHAMPION_1_DAMAGED 10 */ -Sound(543, 112, 84, 3, 6), /* k11_soundCHAMPION_2_DAMAGED 11 */ -Sound(544, 112, 86, 3, 6), /* k12_soundCHAMPION_3_DAMAGED 12 */ -Sound(545, 112, 95, 3, 6), /* k13_soundSPELL 13 */ -Sound(552, 112, 57, 3, 5), /* k14_soundATTACK_SCREAMER_OITU 14 */ -Sound(553, 112, 52, 3, 5), /* k15_soundATTACK_GIANT_SCORPION_SCORPION 15 */ -Sound(546, 112, 40, 2, 4), /* k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT 16 */ -Sound(547, 112, 70, 1, 4), /* k17_soundBUZZ 17 */ -Sound(549, 138, 75, 3, 6), /* k18_soundPARTY_DAMAGED 18 */ -Sound(554, 112, 50, 3, 5), /* k19_soundATTACK_MAGENTA_WORM_WORM 19 */ -Sound(537, 112, 98, 0, 4), /* k20_soundWEAK_EXPLOSION 20 */ -Sound(555, 112, 96, 2, 4), /* k21_soundATTACK_GIGGLER 21 */ -Sound(563, 138, 24, 0, 4), /* k22_soundMOVE_ANIMATED_ARMOUR_DETH_KNIGHT 22 Atari ST: not present */ -Sound(564, 138, 21, 0, 4), /* k23_soundMOVE_COUATL_GIANT_WASP_MUNCHER 23 Atari ST: not present */ -Sound(565, 138, 23, 0, 4), /* k24_soundMOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON 24 Atari ST: not present */ -Sound(566, 138, 105, 0, 4), /* k25_soundBLOW_HORN 25 Atari ST: not present */ -Sound(567, 138, 27, 0, 4), /* k26_soundMOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU 26 Atari ST: not present */ -Sound(568, 138, 28, 0, 4), /* k27_soundMOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL 27 Atari ST: not present */ -Sound(569, 138, 106, 0, 4), /* k28_soundWAR_CRY 28 Atari ST: not present */ -Sound(570, 138, 56, 0, 4), /* k29_soundATTACK_ROCK_ROCKPILE 29 Atari ST: not present */ -Sound(571, 138, 58, 0, 4), /* k30_soundATTACK_WATER_ELEMENTAL 30 Atari ST: not present */ -Sound(572, 112, 53, 0, 4), /* k31_soundATTACK_COUATL 31 Atari ST: not present */ -Sound(573, 138, 29, 0, 4), /* k32_soundMOVE_RED_DRAGON 32 Atari ST: not present */ -Sound(574, 150, 22, 0, 4)}; /* k33_soundMOVE_SKELETON 33 Atari ST: not present */ - void SoundMan::f503_loadSounds() { for (uint16 soundIndex = 0; soundIndex < k34_D13_soundCount; ++soundIndex) { SoundData *soundData = _gK24_soundData + soundIndex; diff --git a/engines/dm/sounds.h b/engines/dm/sounds.h index adbc019027..3c8c6cdd5c 100644 --- a/engines/dm/sounds.h +++ b/engines/dm/sounds.h @@ -48,6 +48,7 @@ public: byte _softDistance; Sound(int16 index, byte period, byte priority, byte loudDist, byte softDist) : _graphicIndex(index), _period(period), _priority(priority), _loudDistance(loudDist), _softDistance(softDist) {} + Sound() : _graphicIndex(0), _period(0), _priority(0), _loudDistance(0), _softDistance(0) {} }; // @ Sound class PendingSound { @@ -78,6 +79,9 @@ public: virtual void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol); // @ F0060_SOUND_Play void f65_playPendingSound(); // @ F0065_SOUND_PlayPendingSound_CPSD bool f505_soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 *rightVolume); // @ F0505_SOUND_GetVolume + + Sound g60_sounds[k34_D13_soundCount]; + void initConstants(); }; class SoundMan_Atari: public SoundMan { diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index 8e9b1a1336..1fe6a49d25 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -218,11 +218,13 @@ void TextMan::f443_endgamePrintString(int16 x, int16 y, Color textColor, char* t char L1408_ac_ModifiedString[50]; L1407_pc_Character = L1408_ac_ModifiedString; - while (*L1407_pc_Character = *text++) { + *L1407_pc_Character = *text++; + while (*L1407_pc_Character) { if ((*L1407_pc_Character >= 'A') && (*L1407_pc_Character <= 'Z')) { *L1407_pc_Character -= 64; /* Use the same font as the one used for scrolls */ } L1407_pc_Character++; + *L1407_pc_Character = *text++; } f53_printToLogicalScreen(x, y, textColor, k12_ColorDarkestGray, L1408_ac_ModifiedString); } diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index e23e878a7c..4ada95fe2a 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -1013,9 +1013,12 @@ void Timeline::f257_timelineProcessEvent70_light(TimelineEvent* event) { if ((AL0674_i_LightPower = event->_B._lightPower) == 0) { return; } - if (L0675_B_NegativeLightPower = (AL0674_i_LightPower < 0)) { + + L0675_B_NegativeLightPower = (AL0674_i_LightPower < 0); + if (L0675_B_NegativeLightPower) { AL0674_i_LightPower = -AL0674_i_LightPower; } + L0673_i_WeakerLightPower = AL0674_i_LightPower - 1; AL0674_i_LightAmount = _vm->_championMan->_lightPowerToLightAmount[AL0674_i_LightPower] - _vm->_championMan->_lightPowerToLightAmount[L0673_i_WeakerLightPower]; if (L0675_B_NegativeLightPower) { -- cgit v1.2.3