From 4010c23d69fc8b8e361ff8ba69dc2325775efbcc Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Mon, 7 Dec 2020 17:00:17 +0100 Subject: [PATCH] TWINE: replaced magic numbers --- engines/twine/actor.cpp | 4 ++-- engines/twine/animations.cpp | 10 +++++----- engines/twine/redraw.h | 2 +- engines/twine/scene.cpp | 2 +- engines/twine/script_life_v1.cpp | 2 +- engines/twine/shared.h | 2 ++ engines/twine/twine.cpp | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp index e6e4439deaa..b34e18924e3 100644 --- a/engines/twine/actor.cpp +++ b/engines/twine/actor.cpp @@ -492,12 +492,12 @@ void Actor::processActorExtraBonus(int32 actorIdx) { // GiveExtraBonus return; } if (actor->dynamicFlags.bIsDead) { - _engine->_extra->addExtraBonus(actor->x, actor->y, actor->z, ANGLE_90, 0, bonusSprite, actor->bonusAmount); + _engine->_extra->addExtraBonus(actor->x, actor->y, actor->z, ANGLE_90, ANGLE_0, bonusSprite, actor->bonusAmount); _engine->_sound->playSample(Samples::ItemPopup, 1, actor->x, actor->y, actor->z, actorIdx); } else { ActorStruct *sceneHero = _engine->_scene->sceneHero; const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->x, actor->z, sceneHero->x, sceneHero->z); - _engine->_extra->addExtraBonus(actor->x, actor->y + actor->boudingBox.y.topRight, actor->z, 200, angle, bonusSprite, actor->bonusAmount); + _engine->_extra->addExtraBonus(actor->x, actor->y + actor->boudingBox.y.topRight, actor->z, ANGLE_70, angle, bonusSprite, actor->bonusAmount); _engine->_sound->playSample(Samples::ItemPopup, 1, actor->x, actor->y + actor->boudingBox.y.topRight, actor->z, actorIdx); } } diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp index d3fbd6323f7..8f6dbb24135 100644 --- a/engines/twine/animations.cpp +++ b/engines/twine/animations.cpp @@ -40,11 +40,11 @@ namespace TwinE { static const int32 magicLevelStrengthOfHit[] = { - kNoBallStrength, - kYellowBallStrength, - kGreenBallStrength, - kRedBallStrength, - kFireBallStrength, + MagicballStrengthType::kNoBallStrength, + MagicballStrengthType::kYellowBallStrength, + MagicballStrengthType::kGreenBallStrength, + MagicballStrengthType::kRedBallStrength, + MagicballStrengthType::kFireBallStrength, 0 }; diff --git a/engines/twine/redraw.h b/engines/twine/redraw.h index 3a8d3b0db4c..c47f58800ce 100644 --- a/engines/twine/redraw.h +++ b/engines/twine/redraw.h @@ -49,7 +49,7 @@ struct OverlayListStruct { int16 info0 = 0; // sprite/3d model entry | number | number range int16 x = 0; int16 y = 0; - int16 info1 = 0; // followed actor | total coins + int16 info1 = 0; // text = actor | total coins OverlayPosType posType = OverlayPosType::koNormal; int16 lifeTime = 0; }; diff --git a/engines/twine/scene.cpp b/engines/twine/scene.cpp index 99cec049ee3..c2970ffc5f5 100644 --- a/engines/twine/scene.cpp +++ b/engines/twine/scene.cpp @@ -447,7 +447,7 @@ void Scene::processZoneExtraBonus(ZoneStruct *zone) { const int16 amount = zone->infoData.Bonus.amount; const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(ABS(zone->topRight.x + zone->bottomLeft.x) / 2, ABS(zone->topRight.z + zone->bottomLeft.z) / 2, sceneHero->x, sceneHero->z); - const int32 index = _engine->_extra->addExtraBonus(ABS(zone->topRight.x + zone->bottomLeft.x) / 2, zone->topRight.y, ABS(zone->topRight.z + zone->bottomLeft.z) / 2, 180, angle, bonusSprite, amount); + const int32 index = _engine->_extra->addExtraBonus(ABS(zone->topRight.x + zone->bottomLeft.x) / 2, zone->topRight.y, ABS(zone->topRight.z + zone->bottomLeft.z) / 2, ANGLE_63, angle, bonusSprite, amount); if (index != -1) { _engine->_extra->extraList[index].type |= 0x400; diff --git a/engines/twine/script_life_v1.cpp b/engines/twine/script_life_v1.cpp index b6adde5c305..ee3a48beeed 100644 --- a/engines/twine/script_life_v1.cpp +++ b/engines/twine/script_life_v1.cpp @@ -1331,7 +1331,7 @@ static int32 lSET_HOLO_POS(TwinEEngine *engine, LifeScriptContext &ctx) { static int32 location = ctx.stream.readByte(); engine->_holomap->setHolomapPosition(location); if (engine->_gameState->hasItem(InventoryItems::kiHolomap)) { - engine->_redraw->addOverlay(OverlayType::koInventoryItem, 0, 0, 0, 0, OverlayPosType::koNormal, 3); + engine->_redraw->addOverlay(OverlayType::koInventoryItem, InventoryItems::kiHolomap, 0, 0, 0, OverlayPosType::koNormal, 3); } return 0; diff --git a/engines/twine/shared.h b/engines/twine/shared.h index 6af695bf550..c3e837f363c 100644 --- a/engines/twine/shared.h +++ b/engines/twine/shared.h @@ -123,6 +123,8 @@ enum class ExtraSpecialType { #define ANGLE_180 512 #define ANGLE_135 384 #define ANGLE_90 256 +#define ANGLE_70 200 +#define ANGLE_63 180 #define ANGLE_45 128 #define ANGLE_0 0 diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp index 017d5d7b7a7..f0c466eff2e 100644 --- a/engines/twine/twine.cpp +++ b/engines/twine/twine.cpp @@ -570,7 +570,7 @@ void TwinEEngine::processInventoryAction() { _scene->sceneHero->life = 50; _gameState->inventoryMagicPoints = _gameState->magicLevelIdx * 20; _gameState->inventoryNumLeafs--; - _redraw->addOverlay(OverlayType::koInventoryItem, 27, 0, 0, 0, OverlayPosType::koNormal, 3); + _redraw->addOverlay(OverlayType::koInventoryItem, InventoryItems::kiCloverLeaf, 0, 0, 0, OverlayPosType::koNormal, 3); } } break;