[Scummvm-git-logs] scummvm master -> eb1fafcc2e87626fb6c52141928ae268fca78b5e
mgerhardy
martin.gerhardy at gmail.com
Sat Nov 14 14:55:26 UTC 2020
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
37054b47fc TWINE: started to convert the left/right mouse buttons to keymapper actions
ae88727681 TWINE: minor cleanup
b2c62f285a TWINE: convert to boolean
7055b58342 TWINE: minor cleanup
46212955bc TWINE: reduced code duplication
7eac628d27 TWINE: converted ShapeType to enum class
c5aa1dacc0 TWINE: converted ControlMode to enum class
6063119af2 TWINE: converted AnimationTypes to enum class
bf102aa02c TWINE: use IS_HERO macro
c2551974a7 TWINE: fixed toggling the jetpack
88aebb8313 TWINE: converted HeroBehaviourType to enum class
eb1fafcc2e TWINE: converted ExtraSpecialType to enum class
Commit: 37054b47fcec699fd00ba75284701f3c3018e811
https://github.com/scummvm/scummvm/commit/37054b47fcec699fd00ba75284701f3c3018e811
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:44+01:00
Commit Message:
TWINE: started to convert the left/right mouse buttons to keymapper actions
Changed paths:
engines/twine/debug.cpp
engines/twine/input.cpp
engines/twine/input.h
engines/twine/metaengine.cpp
engines/twine/movements.cpp
diff --git a/engines/twine/debug.cpp b/engines/twine/debug.cpp
index 1cf70ec667..2b4edc3eb2 100644
--- a/engines/twine/debug.cpp
+++ b/engines/twine/debug.cpp
@@ -417,15 +417,10 @@ void Debug::debugPlasmaWindow(const char *text, int32 color) {
}
void Debug::debugProcessWindow() {
- if (_engine->_input->rightMouse) {
- int32 quit = 0;
+ if (_engine->_input->toggleActionIfActive(TwinEActionType::DebugMenu)) {
const char *text = "Game Debug Window";
- int32 color = 64;
int32 colorIdx = 4;
int32 count = 0;
- MouseStatusStruct mouseData;
- _engine->_input->rightMouse = 0;
- _engine->_input->leftMouse = 0;
_engine->_screens->copyScreen(_engine->frontVideoBuffer, _engine->workVideoBuffer);
@@ -435,14 +430,15 @@ void Debug::debugProcessWindow() {
}
debugDrawWindows();
- do {
+ for (;;) {
_engine->readKeys();
if (_engine->shouldQuit()) {
- quit = 1;
+ break;
}
+ MouseStatusStruct mouseData;
_engine->_input->getMousePositions(&mouseData);
- if (mouseData.left) {
+ if (_engine->_input->toggleActionIfActive(TwinEActionType::DebugMenuActivate)) {
int type = 0;
if ((type = debugProcessButton(mouseData.x, mouseData.y)) != NO_ACTION) { // process menu item
if (debugTypeUseMenu(type)) {
@@ -453,7 +449,6 @@ void Debug::debugProcessWindow() {
debugRefreshButtons(type);
debugSetActions(type);
}
- mouseData.left = 0;
}
// draw window plasma effect
@@ -461,7 +456,7 @@ void Debug::debugProcessWindow() {
colorIdx++;
count = 0;
}
- color = colorIdx * 16;
+ int32 color = colorIdx * 16;
if (color >= 240) {
color = 64;
colorIdx = 4;
@@ -469,14 +464,14 @@ void Debug::debugProcessWindow() {
debugPlasmaWindow(text, color);
// quit
- if (mouseData.right) {
- quit = 1;
+ if (_engine->_input->toggleActionIfActive(TwinEActionType::DebugMenu)) {
+ break;
}
_engine->_system->delayMillis(1000 / 25); // rest
count++;
- } while (!quit);
+ }
_engine->_redraw->reqBgRedraw = true;
}
}
diff --git a/engines/twine/input.cpp b/engines/twine/input.cpp
index 50fe2569ca..dcf2dd8404 100644
--- a/engines/twine/input.cpp
+++ b/engines/twine/input.cpp
@@ -131,6 +131,8 @@ static constexpr const struct ActionMapping {
{DebugGridCameraPressDown, 0x2C},
{DebugGridCameraPressLeft, 0x1F},
{DebugGridCameraPressRight, 0x2D},
+ {DebugMenu, 0x00},
+ {DebugMenuActivate, 0x00},
{QuickBehaviourNormal, 0x3B},
{QuickBehaviourAthletic, 0x3C},
{QuickBehaviourAggressive, 0x3D},
@@ -164,6 +166,12 @@ static_assert(ARRAYSIZE(twineactions) == TwinEActionType::Max, "Unexpected actio
uint8 Input::processCustomEngineEventStart(const Common::Event &event) {
if (!_engine->cfgfile.Debug) {
switch (event.customType) {
+ case TwinEActionType::DebugGridCameraPressUp:
+ case TwinEActionType::DebugGridCameraPressDown:
+ case TwinEActionType::DebugGridCameraPressLeft:
+ case TwinEActionType::DebugGridCameraPressRight:
+ case TwinEActionType::DebugMenu:
+ case TwinEActionType::DebugMenuActivate:
case TwinEActionType::NextRoom:
case TwinEActionType::PreviousRoom:
case TwinEActionType::ApplyCellingGrid:
@@ -199,12 +207,6 @@ void Input::readKeys() {
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
localKey = processCustomEngineEventStart(event);
break;
- case Common::EVENT_LBUTTONDOWN:
- leftMouse = 1;
- break;
- case Common::EVENT_RBUTTONDOWN:
- rightMouse = 1;
- break;
default:
break;
}
@@ -234,10 +236,6 @@ void Input::getMousePositions(MouseStatusStruct *mouseData) {
Common::Point point = g_system->getEventManager()->getMousePos();
mouseData->x = point.x;
mouseData->y = point.y;
- mouseData->left = leftMouse;
- mouseData->right = rightMouse;
- leftMouse = 0;
- rightMouse = 0;
}
} // namespace TwinE
diff --git a/engines/twine/input.h b/engines/twine/input.h
index bef0b44a8a..76d519fe0a 100644
--- a/engines/twine/input.h
+++ b/engines/twine/input.h
@@ -47,6 +47,8 @@ enum TwinEActionType {
DebugGridCameraPressDown,
DebugGridCameraPressLeft,
DebugGridCameraPressRight,
+ DebugMenu,
+ DebugMenuActivate,
QuickBehaviourNormal,
QuickBehaviourAthletic,
QuickBehaviourAggressive,
@@ -81,8 +83,6 @@ enum TwinEActionType {
};
struct MouseStatusStruct {
- int32 left = 0;
- int32 right = 0;
int32 x = 0;
int32 y = 0;
};
@@ -111,8 +111,6 @@ public:
int16 cursorKeys = 0;
int16 pressedKey = 0;
- int16 leftMouse = 0;
- int16 rightMouse = 0;
/**
* @brief Dependent on the context we are currently in the game, we might want to disable certain keymaps.
diff --git a/engines/twine/metaengine.cpp b/engines/twine/metaengine.cpp
index 338954eeaa..898842d557 100644
--- a/engines/twine/metaengine.cpp
+++ b/engines/twine/metaengine.cpp
@@ -209,6 +209,16 @@ Common::KeymapArray TwinEMetaEngine::initKeymaps(const char *target) const {
act->addDefaultInputMapping("c");
gameKeyMap->addAction(act);
+ act = new Action("DEBUGMENU", _("Debug Menu"));
+ act->setCustomEngineActionEvent(TwinEActionType::DebugMenu);
+ act->addDefaultInputMapping("MOUSE_RIGHT");
+ gameKeyMap->addAction(act);
+
+ act = new Action("DEBUGMENUEXEC", _("Debug Menu Execute"));
+ act->setCustomEngineActionEvent(TwinEActionType::DebugMenuActivate);
+ act->addDefaultInputMapping("MOUSE_LEFT");
+ gameKeyMap->addAction(act);
+
act = new Action("NORMALBEHAVIOUR", _("Normal Behaviour"));
act->setCustomEngineActionEvent(TwinEActionType::QuickBehaviourNormal);
act->addDefaultInputMapping("F1");
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index a935d1d097..f95c3b305d 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -275,13 +275,13 @@ void Movements::processManualAction(int actorIdx) {
_engine->_animations->initAnim(kRightPunch, 1, 0, actorIdx);
}
- if (_engine->_input->toggleActionIfActive(TwinEActionType::MoveForward)) {
+ if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
_engine->_animations->initAnim(kKick, 1, 0, actorIdx);
}
}
break;
case kDiscrete:
- _engine->_animations->initAnim(kHide, 0, 255, actorIdx);
+ _engine->_animations->initAnim(kHide, 0, 255, actorIdx);
break;
case kProtoPack:
break;
Commit: ae887276810bad79021827fe062f1957429add0e
https://github.com/scummvm/scummvm/commit/ae887276810bad79021827fe062f1957429add0e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:44+01:00
Commit Message:
TWINE: minor cleanup
Changed paths:
engines/twine/movements.cpp
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index f95c3b305d..e6bf6c67ae 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -172,7 +172,7 @@ int32 Movements::getRealValue(ActorMoveStruct *movePtr) {
return movePtr->to;
}
- if (!(_engine->lbaTime - movePtr->timeOfChange < movePtr->numOfStep)) {
+ if (_engine->lbaTime - movePtr->timeOfChange >= movePtr->numOfStep) {
movePtr->numOfStep = 0;
return movePtr->to;
}
@@ -338,7 +338,7 @@ void Movements::processManualAction(int actorIdx) {
if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
heroMoved = true;
- if (actor->anim == 0) {
+ if (actor->anim == kStanding) {
_engine->_animations->initAnim(kTurnLeft, 0, 255, actorIdx);
} else {
if (!actor->dynamicFlags.bIsRotationByAnim) {
@@ -347,7 +347,7 @@ void Movements::processManualAction(int actorIdx) {
}
} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
heroMoved = true;
- if (actor->anim == 0) {
+ if (actor->anim == kStanding) {
_engine->_animations->initAnim(kTurnRight, 0, 255, actorIdx);
} else {
if (!actor->dynamicFlags.bIsRotationByAnim) {
Commit: b2c62f285a144800b1882459377afe73e3267cb9
https://github.com/scummvm/scummvm/commit/b2c62f285a144800b1882459377afe73e3267cb9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:44+01:00
Commit Message:
TWINE: convert to boolean
Changed paths:
engines/twine/movements.cpp
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index e6bf6c67ae..f8effc05ae 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -94,16 +94,16 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
int32 difX = x2 - x1;
const int32 newX = difX * difX;
- int32 flag;
+ bool flag;
// Exchange X and Z
if (newX < newZ) {
const int32 tmpEx = difX;
difX = difZ;
difZ = tmpEx;
- flag = 1;
+ flag = true;
} else {
- flag = 0;
+ flag = false;
}
targetActorDistance = (int32)sqrt((int64)newX + (int64)newZ);
@@ -133,7 +133,7 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
finalAngle = -finalAngle;
}
- if (flag == 1) {
+ if (flag) {
finalAngle = -finalAngle + 0x100;
}
Commit: 7055b5834247173bd9646dc697167fab6a830aa5
https://github.com/scummvm/scummvm/commit/7055b5834247173bd9646dc697167fab6a830aa5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:44+01:00
Commit Message:
TWINE: minor cleanup
Changed paths:
engines/twine/actor.cpp
engines/twine/collision.cpp
engines/twine/renderer.h
engines/twine/resources.h
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index dfdb697b90..a7fd9f7cdc 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -205,6 +205,7 @@ int32 Actor::initBody(int32 bodyIdx, int32 actorIdx, ActorBoundingBox &actorBoun
if (idx == bodyIdx) {
const int16 bodyIndex = stream.readUint16LE();
+ // TODO: move into resources class
int32 index;
if (!(bodyIndex & 0x8000)) {
index = currentPositionInBodyPtrTab;
diff --git a/engines/twine/collision.cpp b/engines/twine/collision.cpp
index aa436ad5b8..9a6a5f8116 100644
--- a/engines/twine/collision.cpp
+++ b/engines/twine/collision.cpp
@@ -103,11 +103,11 @@ int32 Collision::getAverageValue(int32 var0, int32 var1, int32 var2, int32 var3)
return var1;
}
- return ((((var1 - var0) * var3) / var2) + var0);
+ return (((var1 - var0) * var3) / var2) + var0;
}
void Collision::reajustActorPosition(int32 brickShape) {
- if (!brickShape) {
+ if (brickShape == kNone) {
return;
}
diff --git a/engines/twine/renderer.h b/engines/twine/renderer.h
index 3806faedc0..fd5dab600e 100644
--- a/engines/twine/renderer.h
+++ b/engines/twine/renderer.h
@@ -36,7 +36,9 @@
#define POLYGONTYPE_DITHER 8
namespace TwinE {
+
class TwinEEngine;
+
class Renderer {
private:
TwinEEngine *_engine;
diff --git a/engines/twine/resources.h b/engines/twine/resources.h
index 9f77ee637a..2fac100477 100644
--- a/engines/twine/resources.h
+++ b/engines/twine/resources.h
@@ -104,6 +104,7 @@ namespace TwinE {
#define NUM_SAMPLES 243
class TwinEEngine;
+
class Resources {
private:
TwinEEngine *_engine;
Commit: 46212955bc090332a7f2c5fc14ca4e895c974153
https://github.com/scummvm/scummvm/commit/46212955bc090332a7f2c5fc14ca4e895c974153
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:44+01:00
Commit Message:
TWINE: reduced code duplication
Changed paths:
engines/twine/actor.cpp
engines/twine/actor.h
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index a7fd9f7cdc..3e81f45e5c 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -291,26 +291,24 @@ void Actor::initModelActor(int32 bodyIdx, int16 actorIdx) {
} else {
Common::MemoryReadStream stream(bodyTable[localActor->entity], bodyTableSize[localActor->entity]);
stream.skip(2);
- int16 var1 = stream.readSint16LE();
- int16 var2 = stream.readSint16LE();
+ const int16 var1 = stream.readSint16LE();
+ const int16 var2 = stream.readSint16LE();
localActor->boudingBox.y.bottomLeft = stream.readSint16LE();
localActor->boudingBox.y.topRight = stream.readSint16LE();
- int16 var3 = stream.readSint16LE();
- int16 var4 = stream.readSint16LE();
+ const int16 var3 = stream.readSint16LE();
+ const int16 var4 = stream.readSint16LE();
int32 result = 0;
+ const int32 result1 = var2 - var1;
+ const int32 result2 = var4 - var3;
if (localActor->staticFlags.bUseMiniZv) {
- int32 result1 = var2 - var1; // take smaller for bound
- int32 result2 = var4 - var3;
-
+ // take smaller for bound
result = MIN(result1, result2);
result = ABS(result);
result >>= 1;
} else {
- int32 result1 = var2 - var1; // take average for bound
- int32 result2 = var4 - var3;
-
+ // take average for bound
result = result2 + result1;
result = ABS(result);
result >>= 2;
@@ -322,11 +320,13 @@ void Actor::initModelActor(int32 bodyIdx, int16 actorIdx) {
localActor->boudingBox.z.topRight = result;
}
- if (currentIndex == -1)
+ if (currentIndex == -1) {
return;
+ }
- if (localActor->previousAnimIdx == -1)
+ if (localActor->previousAnimIdx == -1) {
return;
+ }
_engine->_renderer->copyActorInternAnim(bodyTable[currentIndex], bodyTable[localActor->entity]);
}
@@ -334,7 +334,7 @@ void Actor::initModelActor(int32 bodyIdx, int16 actorIdx) {
void Actor::initActor(int16 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- if (actor->staticFlags.bIsSpriteActor) { // if sprite actor
+ if (actor->staticFlags.bIsSpriteActor) {
if (actor->strengthOfHit != 0) {
actor->dynamicFlags.bIsHitting = 1;
}
diff --git a/engines/twine/actor.h b/engines/twine/actor.h
index cc95edfe48..147790fe9d 100644
--- a/engines/twine/actor.h
+++ b/engines/twine/actor.h
@@ -126,6 +126,7 @@ struct StaticFlagsStruct {
uint16 bDoesntCastShadow : 1; // 0x1000
uint16 bIsBackgrounded : 1; // 0x2000
uint16 bIsCarrierActor : 1; // 0x4000
+ // take smaller value for bound, or if not set take average for bound
uint16 bUseMiniZv : 1; // 0x8000
};
Commit: 7eac628d274209f0ec4ffeb4eba5246918e510f0
https://github.com/scummvm/scummvm/commit/7eac628d274209f0ec4ffeb4eba5246918e510f0
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: converted ShapeType to enum class
Changed paths:
A engines/twine/shared.h
engines/twine/actor.cpp
engines/twine/actor.h
engines/twine/animations.cpp
engines/twine/collision.cpp
engines/twine/collision.h
engines/twine/extra.cpp
engines/twine/gamestate.cpp
engines/twine/grid.cpp
engines/twine/grid.h
engines/twine/menu.cpp
engines/twine/movements.cpp
engines/twine/redraw.cpp
engines/twine/scene.cpp
engines/twine/twine.cpp
engines/twine/twine.h
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index 3e81f45e5c..bccd5905a3 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -395,7 +395,7 @@ void Actor::resetActor(int16 actorIdx) {
actor->info2 = 0;
actor->info3 = 0;
- actor->brickShape = 0;
+ actor->setBrickShape(ShapeType::kNone);
actor->collision = -1;
actor->standOn = -1;
actor->zone = -1;
diff --git a/engines/twine/actor.h b/engines/twine/actor.h
index 147790fe9d..8ab80ca60d 100644
--- a/engines/twine/actor.h
+++ b/engines/twine/actor.h
@@ -24,6 +24,7 @@
#define TWINE_ACTOR_H
#include "common/scummsys.h"
+#include "twine/shared.h"
namespace TwinE {
@@ -163,15 +164,23 @@ enum ControlMode {
};
/** Actors structure */
-struct ActorStruct {
+class ActorStruct {
+private:
+ ShapeType _brickShape = ShapeType::kNone; // field_3
+ bool _brickCausesDamage = false;
+public:
StaticFlagsStruct staticFlags;
DynamicFlagsStruct dynamicFlags;
+ inline ShapeType brickShape() const { return _brickShape; }
+ inline void setBrickShape(ShapeType shapeType) { _brickShape = shapeType; _brickCausesDamage = false; }
+ inline void setBrickCausesDamage() { _brickCausesDamage = true; }
+ inline bool brickCausesDamage() { return _brickCausesDamage; }
+
int32 entity = 0; // costumeIndex
int32 body = 0;
AnimationTypes anim = kAnimNone;
int32 animExtra = 0; //field_2
- int32 brickShape = 0; // field_3
const uint8 *animExtraPtr = nullptr;
int32 sprite = 0; // field_8
uint8 *entityDataPtr = nullptr;
@@ -293,7 +302,7 @@ public:
/** Actor shadow Z coordinate */
int32 shadowZ = 0;
/** Actor shadow collition type - brick shape */
- int8 shadowCollisionType = 0; // shadowVar
+ ShapeType shadowCollisionType = ShapeType::kNone; // shadowVar
HeroBehaviourType heroBehaviour = kNormal;
/** Hero auto agressive mode */
diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index ce8a189baf..f20f4f484f 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -953,13 +953,12 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
// actor collisions with bricks
if (actor->staticFlags.bComputeCollisionWithBricks) {
- int32 brickShape;
_engine->_collision->collisionY = 0;
- brickShape = _engine->_grid->getBrickShape(_engine->_movements->previousActorX, _engine->_movements->previousActorY, _engine->_movements->previousActorZ);
+ ShapeType brickShape = _engine->_grid->getBrickShape(_engine->_movements->previousActorX, _engine->_movements->previousActorY, _engine->_movements->previousActorZ);
- if (brickShape) {
- if (brickShape != kSolid) {
+ if (brickShape != ShapeType::kNone) {
+ if (brickShape != ShapeType::kSolid) {
_engine->_collision->reajustActorPosition(brickShape);
} /*else { // this shouldn't happen (collision should avoid it)
actor->y = processActorY = (processActorY / 256) * 256 + 256; // go upper
@@ -1002,7 +1001,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
_engine->_renderer->destZ += _engine->_movements->processActorZ;
if (_engine->_renderer->destX >= 0 && _engine->_renderer->destZ >= 0 && _engine->_renderer->destX <= 0x7E00 && _engine->_renderer->destZ <= 0x7E00) {
- if (_engine->_grid->getBrickShape(_engine->_renderer->destX, _engine->_movements->processActorY + 256, _engine->_renderer->destZ) && _engine->cfgfile.WallCollision == 1) { // avoid wall hit damage
+ if (_engine->_grid->getBrickShape(_engine->_renderer->destX, _engine->_movements->processActorY + 256, _engine->_renderer->destZ) != ShapeType::kNone && _engine->cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
initAnim(kBigHit, 2, 0, currentlyProcessedActorIdx);
@@ -1016,15 +1015,15 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
}
brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
- actor->brickShape = brickShape;
+ actor->setBrickShape(brickShape);
- if (brickShape) {
- if (brickShape == kSolid) {
+ if (brickShape != ShapeType::kNone) {
+ if (brickShape == ShapeType::kSolid) {
if (actor->dynamicFlags.bIsFalling) {
_engine->_collision->stopFalling();
_engine->_movements->processActorY = (_engine->_collision->collisionY << 8) + 0x100;
} else {
- if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour == kAthletic && actor->anim == brickShape && _engine->cfgfile.WallCollision == 1) { // avoid wall hit damage
+ if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour == kAthletic && actor->anim == AnimationTypes::kForward && _engine->cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
initAnim(kBigHit, 2, 0, currentlyProcessedActorIdx);
_engine->_movements->heroMoved = true;
@@ -1032,17 +1031,18 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
}
// no Z coordinate issue
- if (!_engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->previousActorZ)) {
+ if (_engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->previousActorZ) == ShapeType::kNone) {
_engine->_movements->processActorZ = _engine->_movements->previousActorZ;
}
// no X coordinate issue
- if (!_engine->_grid->getBrickShape(_engine->_movements->previousActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ)) {
+ if (_engine->_grid->getBrickShape(_engine->_movements->previousActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ) == ShapeType::kNone) {
_engine->_movements->processActorX = _engine->_movements->previousActorX;
}
// X and Z with issue, no move
- if (_engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->previousActorZ) && _engine->_grid->getBrickShape(_engine->_movements->previousActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ)) {
+ if (_engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->previousActorZ) != ShapeType::kNone &&
+ _engine->_grid->getBrickShape(_engine->_movements->previousActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ) != ShapeType::kNone) {
return;
}
}
@@ -1059,7 +1059,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
if (actor->staticFlags.bCanFall && actor->standOn == -1) {
brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY - 1, _engine->_movements->processActorZ);
- if (brickShape) {
+ if (brickShape != ShapeType::kNone) {
if (actor->dynamicFlags.bIsFalling) {
_engine->_collision->stopFalling();
}
@@ -1090,7 +1090,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
}
if (_engine->_collision->causeActorDamage) {
- actor->brickShape |= 0x80;
+ actor->setBrickCausesDamage();
}
// check and fix actor bounding position
diff --git a/engines/twine/collision.cpp b/engines/twine/collision.cpp
index 9a6a5f8116..38e9ca64dc 100644
--- a/engines/twine/collision.cpp
+++ b/engines/twine/collision.cpp
@@ -106,8 +106,8 @@ int32 Collision::getAverageValue(int32 var0, int32 var1, int32 var2, int32 var3)
return (((var1 - var0) * var3) / var2) + var0;
}
-void Collision::reajustActorPosition(int32 brickShape) {
- if (brickShape == kNone) {
+void Collision::reajustActorPosition(ShapeType brickShape) {
+ if (brickShape == ShapeType::kNone) {
return;
}
@@ -116,84 +116,84 @@ void Collision::reajustActorPosition(int32 brickShape) {
const int32 brkZ = (collisionZ << 9) - 0x100;
// double-side stairs
- if (brickShape >= kDoubleSideStairsTop1 && brickShape <= kDoubleSideStairsRight2) {
+ if (brickShape >= ShapeType::kDoubleSideStairsTop1 && brickShape <= ShapeType::kDoubleSideStairsRight2) {
switch (brickShape) {
- case kDoubleSideStairsTop1:
+ case ShapeType::kDoubleSideStairsTop1:
if (_engine->_movements->processActorZ - collisionZ <= _engine->_movements->processActorX - collisionX) {
- brickShape = kStairsTopLeft;
+ brickShape = ShapeType::kStairsTopLeft;
} else {
- brickShape = kStairsTopRight;
+ brickShape = ShapeType::kStairsTopRight;
}
break;
- case kDoubleSideStairsBottom1:
+ case ShapeType::kDoubleSideStairsBottom1:
if (_engine->_movements->processActorZ - collisionZ <= _engine->_movements->processActorX - collisionX) {
- brickShape = kStairsBottomLeft;
+ brickShape = ShapeType::kStairsBottomLeft;
} else {
- brickShape = kStairsBottomRight;
+ brickShape = ShapeType::kStairsBottomRight;
}
break;
- case kDoubleSideStairsLeft1:
+ case ShapeType::kDoubleSideStairsLeft1:
if (512 - _engine->_movements->processActorX - collisionX <= _engine->_movements->processActorZ - collisionZ) {
- brickShape = kStairsTopLeft;
+ brickShape = ShapeType::kStairsTopLeft;
} else {
- brickShape = kStairsBottomLeft;
+ brickShape = ShapeType::kStairsBottomLeft;
}
break;
- case kDoubleSideStairsRight1:
+ case ShapeType::kDoubleSideStairsRight1:
if (512 - _engine->_movements->processActorX - collisionX <= _engine->_movements->processActorZ - collisionZ) {
- brickShape = kStairsTopRight;
+ brickShape = ShapeType::kStairsTopRight;
} else {
- brickShape = kStairsBottomRight;
+ brickShape = ShapeType::kStairsBottomRight;
}
break;
- case kDoubleSideStairsTop2:
+ case ShapeType::kDoubleSideStairsTop2:
if (_engine->_movements->processActorX - collisionX >= _engine->_movements->processActorZ - collisionZ) {
- brickShape = kStairsTopRight;
+ brickShape = ShapeType::kStairsTopRight;
} else {
- brickShape = kStairsTopLeft;
+ brickShape = ShapeType::kStairsTopLeft;
}
break;
- case kDoubleSideStairsBottom2:
+ case ShapeType::kDoubleSideStairsBottom2:
if (_engine->_movements->processActorZ - collisionZ <= _engine->_movements->processActorX - collisionX) {
- brickShape = kStairsBottomRight;
+ brickShape = ShapeType::kStairsBottomRight;
} else {
- brickShape = kStairsBottomLeft;
+ brickShape = ShapeType::kStairsBottomLeft;
}
break;
- case kDoubleSideStairsLeft2:
+ case ShapeType::kDoubleSideStairsLeft2:
if (512 - _engine->_movements->processActorX - collisionX <= _engine->_movements->processActorZ - collisionZ) {
- brickShape = kStairsBottomLeft;
+ brickShape = ShapeType::kStairsBottomLeft;
} else {
- brickShape = kStairsTopLeft;
+ brickShape = ShapeType::kStairsTopLeft;
}
break;
- case kDoubleSideStairsRight2:
+ case ShapeType::kDoubleSideStairsRight2:
if (512 - _engine->_movements->processActorX - collisionX <= _engine->_movements->processActorZ - collisionZ) {
- brickShape = kStairsBottomRight;
+ brickShape = ShapeType::kStairsBottomRight;
} else {
- brickShape = kStairsTopRight;
+ brickShape = ShapeType::kStairsTopRight;
}
break;
default:
if (_engine->cfgfile.Debug) {
- debug("Brick Shape %d unsupported", brickShape);
+ debug("Brick Shape %d unsupported", (int)brickShape);
}
break;
}
}
- if (brickShape >= kStairsTopLeft && brickShape <= kStairsBottomRight) {
+ if (brickShape >= ShapeType::kStairsTopLeft && brickShape <= ShapeType::kStairsBottomRight) {
switch (brickShape) {
- case kStairsTopLeft:
+ case ShapeType::kStairsTopLeft:
_engine->_movements->processActorY = brkY + getAverageValue(0, 256, 512, _engine->_movements->processActorX - brkX);
break;
- case kStairsTopRight:
+ case ShapeType::kStairsTopRight:
_engine->_movements->processActorY = brkY + getAverageValue(0, 256, 512, _engine->_movements->processActorZ - brkZ);
break;
- case kStairsBottomLeft:
+ case ShapeType::kStairsBottomLeft:
_engine->_movements->processActorY = brkY + getAverageValue(256, 0, 512, _engine->_movements->processActorZ - brkZ);
break;
- case kStairsBottomRight:
+ case ShapeType::kStairsBottomRight:
_engine->_movements->processActorY = brkY + getAverageValue(256, 0, 512, _engine->_movements->processActorX - brkX);
break;
default:
@@ -382,7 +382,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
}
void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 damageMask) {
- int32 brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
+ ShapeType brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
_engine->_movements->processActorX += x;
_engine->_movements->processActorY += y;
@@ -392,14 +392,14 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShapeFull(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ, _engine->_actor->processActorPtr->boudingBox.y.topRight);
- if (brickShape == kSolid) {
+ if (brickShape == ShapeType::kSolid) {
causeActorDamage |= damageMask;
brickShape = _engine->_grid->getBrickShapeFull(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->previousActorZ + z, _engine->_actor->processActorPtr->boudingBox.y.topRight);
- if (brickShape == kSolid) {
+ if (brickShape == ShapeType::kSolid) {
brickShape = _engine->_grid->getBrickShapeFull(x + _engine->_movements->previousActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ, _engine->_actor->processActorPtr->boudingBox.y.topRight);
- if (brickShape != kSolid) {
+ if (brickShape != ShapeType::kSolid) {
processCollisionX = _engine->_movements->previousActorX;
}
} else {
@@ -414,7 +414,7 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
}
void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 damageMask) {
- int32 brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
+ ShapeType brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
_engine->_movements->processActorX += x;
_engine->_movements->processActorY += y;
@@ -424,14 +424,14 @@ void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 d
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
- if (brickShape == kSolid) {
+ if (brickShape == ShapeType::kSolid) {
causeActorDamage |= damageMask;
brickShape = _engine->_grid->getBrickShape(_engine->_movements->processActorX, _engine->_movements->processActorY, _engine->_movements->previousActorZ + z);
- if (brickShape == kSolid) {
+ if (brickShape == ShapeType::kSolid) {
brickShape = _engine->_grid->getBrickShape(x + _engine->_movements->previousActorX, _engine->_movements->processActorY, _engine->_movements->processActorZ);
- if (brickShape != kSolid) {
+ if (brickShape != ShapeType::kSolid) {
processCollisionX = _engine->_movements->previousActorX;
}
} else {
@@ -504,7 +504,7 @@ int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 act
}
bool Collision::checkExtraCollisionWithBricks(int32 x, int32 y, int32 z, int32 oldX, int32 oldY, int32 oldZ) {
- if (_engine->_grid->getBrickShape(oldX, oldY, oldZ)) {
+ if (_engine->_grid->getBrickShape(oldX, oldY, oldZ) != ShapeType::kNone) {
return true;
}
@@ -512,15 +512,15 @@ bool Collision::checkExtraCollisionWithBricks(int32 x, int32 y, int32 z, int32 o
const int32 averageY = ABS(y + oldY) / 2;
const int32 averageZ = ABS(z + oldZ) / 2;
- if (_engine->_grid->getBrickShape(averageX, averageY, averageZ)) {
+ if (_engine->_grid->getBrickShape(averageX, averageY, averageZ) != ShapeType::kNone) {
return true;
}
- if (_engine->_grid->getBrickShape(ABS(oldX + averageX) / 2, ABS(oldY + averageY) / 2, ABS(oldZ + averageZ) / 2)) {
+ if (_engine->_grid->getBrickShape(ABS(oldX + averageX) / 2, ABS(oldY + averageY) / 2, ABS(oldZ + averageZ) / 2) != ShapeType::kNone) {
return true;
}
- if (_engine->_grid->getBrickShape(ABS(x + averageX) / 2, ABS(y + averageY) / 2, ABS(z + averageZ) / 2)) {
+ if (_engine->_grid->getBrickShape(ABS(x + averageX) / 2, ABS(y + averageY) / 2, ABS(z + averageZ) / 2) != ShapeType::kNone) {
return true;
}
diff --git a/engines/twine/collision.h b/engines/twine/collision.h
index e383ed17df..f6031d23ae 100644
--- a/engines/twine/collision.h
+++ b/engines/twine/collision.h
@@ -65,7 +65,7 @@ public:
* Reajust actor position in scene according with brick shape bellow actor
* @param brickShape Shape of brick bellow the actor
*/
- void reajustActorPosition(int32 brickShape);
+ void reajustActorPosition(ShapeType brickShape);
/**
* Check collision with actors
diff --git a/engines/twine/extra.cpp b/engines/twine/extra.cpp
index 70df761754..f8698e1672 100644
--- a/engines/twine/extra.cpp
+++ b/engines/twine/extra.cpp
@@ -516,13 +516,13 @@ void Extra::drawExtraSpecial(int32 extraIdx, int32 x, int32 y) {
}
void Extra::processMagicballBounce(ExtraListStruct *extra, int32 x, int32 y, int32 z) {
- if (_engine->_grid->getBrickShape(x, extra->y, z)) {
+ if (_engine->_grid->getBrickShape(x, extra->y, z) != ShapeType::kNone) {
extra->destY = -extra->destY;
}
- if (_engine->_grid->getBrickShape(extra->x, y, z)) {
+ if (_engine->_grid->getBrickShape(extra->x, y, z) != ShapeType::kNone) {
extra->destX = -extra->destX;
}
- if (_engine->_grid->getBrickShape(x, y, extra->z)) {
+ if (_engine->_grid->getBrickShape(x, y, extra->z) != ShapeType::kNone) {
extra->destZ = -extra->destZ;
}
diff --git a/engines/twine/gamestate.cpp b/engines/twine/gamestate.cpp
index c748364a2c..d7046d2530 100644
--- a/engines/twine/gamestate.cpp
+++ b/engines/twine/gamestate.cpp
@@ -280,7 +280,7 @@ void GameState::processFoundItem(int32 item) {
const int32 itemX = (_engine->_scene->sceneHero->x + 0x100) >> 9;
int32 itemY = _engine->_scene->sceneHero->y >> 8;
- if (_engine->_scene->sceneHero->brickShape & 0x7F) {
+ if (_engine->_scene->sceneHero->brickShape() != ShapeType::kNone) {
itemY++;
}
const int32 itemZ = (_engine->_scene->sceneHero->z + 0x100) >> 9;
diff --git a/engines/twine/grid.cpp b/engines/twine/grid.cpp
index 6d121385b0..39225bfacf 100644
--- a/engines/twine/grid.cpp
+++ b/engines/twine/grid.cpp
@@ -651,19 +651,19 @@ void Grid::redrawGrid() {
}
}
-int32 Grid::getBrickShape(int32 x, int32 y, int32 z) {
+ShapeType Grid::getBrickShape(int32 x, int32 y, int32 z) {
updateCollisionCoordinates(x, y, z);
if (_engine->_collision->collisionX < 0 || _engine->_collision->collisionX >= GRID_SIZE_X) {
- return 0;
+ return ShapeType::kNone;
}
if (_engine->_collision->collisionY <= -1) {
- return 1;
+ return ShapeType::kSolid;
}
if (_engine->_collision->collisionY < 0 || _engine->_collision->collisionY >= GRID_SIZE_Y || _engine->_collision->collisionZ < 0 || _engine->_collision->collisionZ >= GRID_SIZE_Z) {
- return 0;
+ return ShapeType::kNone;
}
uint8 *blockBufferPtr = blockBuffer;
@@ -682,9 +682,9 @@ int32 Grid::getBrickShape(int32 x, int32 y, int32 z) {
const uint8 tmpBrickIdx = *(blockBufferPtr + 1);
blockPtr = blockPtr + tmpBrickIdx * 4;
- return *blockPtr;
+ return (ShapeType)*blockPtr;
}
- return *(blockBufferPtr + 1);
+ return (ShapeType)*(blockBufferPtr + 1);
}
void Grid::updateCollisionCoordinates(int32 x, int32 y, int32 z) {
@@ -693,19 +693,19 @@ void Grid::updateCollisionCoordinates(int32 x, int32 y, int32 z) {
_engine->_collision->collisionZ = (z + 0x100) >> 9;
}
-int32 Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
+ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
updateCollisionCoordinates(x, y, z);
if (_engine->_collision->collisionX < 0 || _engine->_collision->collisionX >= GRID_SIZE_X) {
- return 0;
+ return ShapeType::kNone;
}
if (_engine->_collision->collisionY <= -1) {
- return 1;
+ return ShapeType::kSolid;
}
if (_engine->_collision->collisionY < 0 || _engine->_collision->collisionY >= GRID_SIZE_Y || _engine->_collision->collisionZ < 0 || _engine->_collision->collisionZ >= GRID_SIZE_Z) {
- return 0;
+ return ShapeType::kNone;
}
uint8 *blockBufferPtr = blockBuffer;
@@ -724,7 +724,7 @@ int32 Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
uint8 tmpBrickIdx = *(blockBufferPtr + 1);
blockPtr = blockPtr + tmpBrickIdx * 4;
- uint8 brickShape = *blockPtr;
+ ShapeType brickShape = (ShapeType)*blockPtr;
int32 newY = (y2 + 255) >> 8;
int32 currY = _engine->_collision->collisionY;
@@ -738,13 +738,13 @@ int32 Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
currY++;
if (READ_LE_INT16(blockBufferPtr) != 0) {
- return 1;
+ return ShapeType::kSolid;
}
}
return brickShape;
}
- uint8 brickShape = *(blockBufferPtr + 1);
+ ShapeType brickShape = (ShapeType)*(blockBufferPtr + 1);
int32 newY = (y2 + 255) >> 8;
int32 currY = _engine->_collision->collisionY;
@@ -758,26 +758,26 @@ int32 Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
currY++;
if (READ_LE_INT16(blockBufferPtr) != 0) {
- return 1;
+ return ShapeType::kSolid;
}
}
- return 0;
+ return ShapeType::kNone;
}
int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) { // getPos2
updateCollisionCoordinates(x, y, z);
if (_engine->_collision->collisionX < 0 || _engine->_collision->collisionX >= GRID_SIZE_X) {
- return 0;
+ return 0; // none
}
if (_engine->_collision->collisionY <= -1) {
- return 1;
+ return 1; // solid
}
if (_engine->_collision->collisionY < 0 || _engine->_collision->collisionY >= GRID_SIZE_Y || _engine->_collision->collisionZ < 0 || _engine->_collision->collisionZ >= GRID_SIZE_Z) {
- return 0;
+ return 0; // none
}
const uint8 *blockBufferPtr = blockBuffer;
@@ -800,7 +800,7 @@ int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) { // getPos2
return READ_LE_INT16(blockPtr);
}
- return 0xF0;
+ return 240;
}
} // namespace TwinE
diff --git a/engines/twine/grid.h b/engines/twine/grid.h
index 66298ddec2..ef2351aa4d 100644
--- a/engines/twine/grid.h
+++ b/engines/twine/grid.h
@@ -24,29 +24,10 @@
#define TWINE_GRID_H
#include "common/scummsys.h"
-#include "twine/actor.h"
+#include "twine/shared.h"
namespace TwinE {
-enum ShapeType {
- kNone = 0,
- kSolid = 1,
- kStairsTopLeft = 2,
- kStairsTopRight = 3,
- kStairsBottomLeft = 4,
- kStairsBottomRight = 5,
- kDoubleSideStairsTop1 = 6,
- kDoubleSideStairsBottom1 = 7,
- kDoubleSideStairsLeft1 = 8,
- kDoubleSideStairsRight1 = 9,
- kDoubleSideStairsTop2 = 10,
- kDoubleSideStairsBottom2 = 11,
- kDoubleSideStairsLeft2 = 12,
- kDoubleSideStairsRight2 = 13,
- kFlatBottom1 = 14,
- kFlatBottom2 = 15
-};
-
/** Block fragment entry */
struct BlockEntry {
/** Block library index */
@@ -291,9 +272,9 @@ public:
/** Redraw grid background */
void redrawGrid();
- int32 getBrickShape(int32 x, int32 y, int32 z);
+ ShapeType getBrickShape(int32 x, int32 y, int32 z);
- int32 getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2);
+ ShapeType getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2);
int32 getBrickSoundType(int32 x, int32 y, int32 z);
};
diff --git a/engines/twine/menu.cpp b/engines/twine/menu.cpp
index 6008abd6c5..97322f0642 100644
--- a/engines/twine/menu.cpp
+++ b/engines/twine/menu.cpp
@@ -693,7 +693,7 @@ int32 Menu::giveupMenu() {
_engine->_sound->pauseSamples();
MenuSettings *localMenu;
- if (_engine->cfgfile.UseAutoSaving == 1) {
+ if (_engine->cfgfile.UseAutoSaving) {
localMenu = &giveUpMenuState;
} else {
localMenu = &giveUpMenuWithSaveState;
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index f8effc05ae..47d197bdea 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -44,10 +44,10 @@ void Movements::getShadowPosition(int32 x, int32 y, int32 z) {
if (*ptr) {
const uint8 *blockPtr = _engine->_grid->getBlockLibrary(*ptr - 1) + 3 + *(ptr + 1) * 4;
- const uint8 brickShape = *((const uint8 *)(blockPtr));
+ const ShapeType brickShape = (ShapeType)*((const uint8 *)(blockPtr));
_engine->_actor->shadowCollisionType = brickShape;
} else {
- _engine->_actor->shadowCollisionType = 0;
+ _engine->_actor->shadowCollisionType = ShapeType::kNone;
}
_engine->_collision->reajustActorPosition(_engine->_actor->shadowCollisionType);
@@ -389,7 +389,7 @@ void Movements::processRandomAction(int actorIdx) {
return;
}
- if (actor->brickShape & 0x80) {
+ if (actor->brickCausesDamage()) {
moveActor(actor->angle, (((_engine->getRandomNumber() & 0x100) + (actor->angle - 0x100)) & 0x3FF), actor->speed, &actor->move);
actor->info0 = _engine->getRandomNumber(300) + _engine->lbaTime + 300;
_engine->_animations->initAnim(kStanding, 0, 255, actorIdx);
diff --git a/engines/twine/redraw.cpp b/engines/twine/redraw.cpp
index 4a4204d5a3..bd20617062 100644
--- a/engines/twine/redraw.cpp
+++ b/engines/twine/redraw.cpp
@@ -380,7 +380,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
const int32 tempX = (actor2->x + 0x100) >> 9;
int32 tempY = actor2->y >> 8;
- if (actor2->brickShape & 0x7F) {
+ if (actor2->brickShape() != ShapeType::kNone) {
tempY++;
}
@@ -472,7 +472,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
} else {
const int32 tmpX = (actor2->x + actor2->boudingBox.x.topRight + 0x100) >> 9;
int32 tmpY = actor2->y >> 8;
- if (actor2->brickShape & 0x7F) {
+ if (actor2->brickShape() != ShapeType::kNone) {
tmpY++;
}
const int32 tmpZ = (actor2->z + actor2->boudingBox.z.topRight + 0x100) >> 9;
diff --git a/engines/twine/scene.cpp b/engines/twine/scene.cpp
index fffd89b7a6..18d04ea9d6 100644
--- a/engines/twine/scene.cpp
+++ b/engines/twine/scene.cpp
@@ -513,7 +513,7 @@ void Scene::processActorZones(int32 actorIdx) {
_engine->_renderer->destZ += _engine->_movements->processActorZ;
if (_engine->_renderer->destX >= 0 && _engine->_renderer->destZ >= 0 && _engine->_renderer->destX <= 0x7E00 && _engine->_renderer->destZ <= 0x7E00) {
- if (_engine->_grid->getBrickShape(_engine->_renderer->destX, actor->y + 0x100, _engine->_renderer->destZ)) {
+ if (_engine->_grid->getBrickShape(_engine->_renderer->destX, actor->y + 0x100, _engine->_renderer->destZ) != ShapeType::kNone) {
currentActorInZone = true;
if (actor->y >= ABS(zone->bottomLeft.y + zone->topRight.y) / 2) {
_engine->_animations->initAnim(kTopLadder, 2, 0, actorIdx); // reached end of ladder
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
new file mode 100644
index 0000000000..c1bdaaa92e
--- /dev/null
+++ b/engines/twine/shared.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TWINE_SHARED_H
+#define TWINE_SHARED_H
+
+#include "common/scummsys.h"
+
+namespace TwinE {
+
+enum class ShapeType {
+ kNone = 0,
+ kSolid = 1,
+ kStairsTopLeft = 2,
+ kStairsTopRight = 3,
+ kStairsBottomLeft = 4,
+ kStairsBottomRight = 5,
+ kDoubleSideStairsTop1 = 6,
+ kDoubleSideStairsBottom1 = 7,
+ kDoubleSideStairsLeft1 = 8,
+ kDoubleSideStairsRight1 = 9,
+ kDoubleSideStairsTop2 = 10,
+ kDoubleSideStairsBottom2 = 11,
+ kDoubleSideStairsLeft2 = 12,
+ kDoubleSideStairsRight2 = 13,
+ kFlatBottom1 = 14,
+ kFlatBottom2 = 15
+};
+
+}
+
+#endif
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 3c0f840bfa..4e5081e52f 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -561,7 +561,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
pinguin->body = -1;
_actor->initModelActor(0, _scene->mecaPinguinIdx);
pinguin->dynamicFlags.bIsDead = 0; // &= 0xDF
- pinguin->brickShape = 0;
+ pinguin->setBrickShape(ShapeType::kNone);
_movements->moveActor(pinguin->angle, pinguin->angle, pinguin->speed, &pinguin->move);
_gameState->gameFlags[InventoryItems::kiPinguin] = 0; // byte_50D89 = 0;
pinguin->info0 = lbaTime + 1500;
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 24799e1585..528931bb0a 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -106,11 +106,11 @@ struct ConfigFile {
// these settings are not available in the original version
/** Use cross fade effect while changing images, or be as the original */
- int32 CrossFade = 0;
+ bool CrossFade = false;
/** Flag to toggle Wall Collision */
- int32 WallCollision = 0;
+ bool WallCollision = false;
/** Use original autosaving system or save when you want */
- int32 UseAutoSaving = 0;
+ bool UseAutoSaving = false;
// these settings can be changed in-game - and must be persisted
/** Shadow mode type, value: all, character only, none */
Commit: c5aa1dacc0a2e0c1c9f268ced2e2f307a603e5bc
https://github.com/scummvm/scummvm/commit/c5aa1dacc0a2e0c1c9f268ced2e2f307a603e5bc
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: converted ControlMode to enum class
Changed paths:
engines/twine/actor.h
engines/twine/movements.cpp
diff --git a/engines/twine/actor.h b/engines/twine/actor.h
index 8ab80ca60d..f16a0d3368 100644
--- a/engines/twine/actor.h
+++ b/engines/twine/actor.h
@@ -152,7 +152,7 @@ struct DynamicFlagsStruct {
};
/** Control mode types */
-enum ControlMode {
+enum class ControlMode {
kNoMove = 0,
kManual = 1,
kFollow = 2,
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index 47d197bdea..20d5540ea8 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -454,27 +454,27 @@ void Movements::processActorMovements(int32 actorIdx) {
* will literally not move, but rather that it's Track Script (also called Move Script) is
* initially stopped. The Actor may move if it is assigned a moving animation.
*/
- case kNoMove:
- case kFollow2: // unused
- case kTrackAttack: // unused
+ case ControlMode::kNoMove:
+ case ControlMode::kFollow2: // unused
+ case ControlMode::kTrackAttack: // unused
break;
- case kManual:
+ case ControlMode::kManual:
processManualAction(actorIdx);
break;
- case kFollow:
+ case ControlMode::kFollow:
processFollowAction(actorIdx);
break;
- case kTrack:
+ case ControlMode::kTrack:
processTrackAction(actorIdx);
break;
- case kSameXZ:
+ case ControlMode::kSameXZ:
processSameXZAction(actorIdx);
break;
- case kRandom:
+ case ControlMode::kRandom:
processRandomAction(actorIdx);
break;
default:
- warning("Unknown control mode %d", actor->controlMode);
+ warning("Unknown control mode %d", (int)actor->controlMode);
break;
}
}
Commit: 6063119af2cc8855ca9e3deae7ea9200a5e6d0c9
https://github.com/scummvm/scummvm/commit/6063119af2cc8855ca9e3deae7ea9200a5e6d0c9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: converted AnimationTypes to enum class
Changed paths:
engines/twine/actor.cpp
engines/twine/actor.h
engines/twine/animations.cpp
engines/twine/animations.h
engines/twine/collision.cpp
engines/twine/movements.cpp
engines/twine/scene.cpp
engines/twine/script_life_v1.cpp
engines/twine/script_move_v1.cpp
engines/twine/shared.h
engines/twine/twine.cpp
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index bccd5905a3..ef64740d53 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -154,10 +154,10 @@ void Actor::setBehaviour(int32 behaviour) {
initModelActor(bodyIdx, 0);
- _engine->_scene->sceneHero->anim = kAnimNone;
+ _engine->_scene->sceneHero->anim = AnimationTypes::kAnimNone;
_engine->_scene->sceneHero->animType = 0;
- _engine->_animations->initAnim(kStanding, 0, 255, 0);
+ _engine->_animations->initAnim(AnimationTypes::kStanding, 0, AnimationTypes::kAnimInvalid, 0);
}
void Actor::initSpriteActor(int32 actorIdx) {
@@ -359,7 +359,7 @@ void Actor::initActor(int16 actorIdx) {
actor->animType = 0;
if (actor->entity != -1) {
- _engine->_animations->initAnim(actor->anim, 0, 255, actorIdx);
+ _engine->_animations->initAnim(actor->anim, 0, AnimationTypes::kAnimInvalid, actorIdx);
}
_engine->_movements->setActorAngleSafe(actor->angle, actor->angle, 0, &actor->move);
@@ -374,7 +374,7 @@ void Actor::resetActor(int16 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
actor->body = 0;
- actor->anim = kStanding;
+ actor->anim = AnimationTypes::kStanding;
actor->x = 0;
actor->y = -1;
actor->z = 0;
@@ -430,9 +430,9 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
actor->hitBy = actorIdx;
if (actor->armor <= strengthOfHit) {
- if (actor->anim == kBigHit || actor->anim == kHit2) {
+ if (actor->anim == AnimationTypes::kBigHit || actor->anim == AnimationTypes::kHit2) {
const int32 tmpAnimPos = actor->animPosition;
- if (actor->animExtra) {
+ if (actor->animExtra != AnimationTypes::kStanding) {
_engine->_animations->processAnimActions(actorIdxAttacked);
}
@@ -443,9 +443,9 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
}
if (_engine->getRandomNumber() & 1) {
- _engine->_animations->initAnim(kHit2, 3, 255, actorIdxAttacked);
+ _engine->_animations->initAnim(AnimationTypes::kHit2, 3, AnimationTypes::kAnimInvalid, actorIdxAttacked);
} else {
- _engine->_animations->initAnim(kBigHit, 3, 255, actorIdxAttacked);
+ _engine->_animations->initAnim(AnimationTypes::kBigHit, 3, AnimationTypes::kAnimInvalid, actorIdxAttacked);
}
}
@@ -461,7 +461,7 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
actor->life = 0;
}
} else {
- _engine->_animations->initAnim(kHit, 3, 255, actorIdxAttacked);
+ _engine->_animations->initAnim(AnimationTypes::kHit, 3, AnimationTypes::kAnimInvalid, actorIdxAttacked);
}
}
diff --git a/engines/twine/actor.h b/engines/twine/actor.h
index f16a0d3368..9728fe2821 100644
--- a/engines/twine/actor.h
+++ b/engines/twine/actor.h
@@ -81,35 +81,6 @@ struct AnimTimerDataStruct {
int32 time = 0;
};
-enum AnimationTypes {
- kAnimNone = -1,
- kStanding = 0,
- kForward = 1,
- kBackward = 2,
- kTurnLeft = 3,
- kTurnRight = 4,
- kHit = 5,
- kBigHit = 6,
- kFall = 7,
- kLanding = 8,
- kLandingHit = 9,
- kLandDeath = 10,
- kAction = 11,
- kClimbLadder = 12,
- kTopLadder = 13,
- kJump = 14,
- kThrowBall = 15,
- kHide = 16,
- kKick = 17,
- kRightPunch = 18,
- kLeftPunch = 19,
- kFoundItem = 20,
- kDrawn = 21,
- kHit2 = 22,
- kSabreAttack = 23,
- kSabreUnknown = 24,
-};
-
/** Actors static flags structure */
struct StaticFlagsStruct {
uint16 bComputeCollisionWithObj : 1; // 0x0001
@@ -151,18 +122,6 @@ struct DynamicFlagsStruct {
uint16 bUnk8000 : 1; // 0x8000 unused
};
-/** Control mode types */
-enum class ControlMode {
- kNoMove = 0,
- kManual = 1,
- kFollow = 2,
- kTrack = 3,
- kFollow2 = 4,
- kTrackAttack = 5,
- kSameXZ = 6,
- kRandom = 7
-};
-
/** Actors structure */
class ActorStruct {
private:
@@ -179,8 +138,8 @@ public:
int32 entity = 0; // costumeIndex
int32 body = 0;
- AnimationTypes anim = kAnimNone;
- int32 animExtra = 0; //field_2
+ AnimationTypes anim = AnimationTypes::kAnimNone;
+ AnimationTypes animExtra = AnimationTypes::kStanding; //field_2
const uint8 *animExtraPtr = nullptr;
int32 sprite = 0; // field_8
uint8 *entityDataPtr = nullptr;
diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index f20f4f484f..242aa539c1 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -330,7 +330,7 @@ int32 Animations::getBodyAnimIndex(AnimationTypes animIdx, int32 actorIdx) {
uint8 *ptr = (bodyPtr + 1);
if (type == 3) {
- if (animIdx == *bodyPtr) {
+ if (animIdx == (AnimationTypes)*bodyPtr) {
ptr++;
uint16 realAnimIdx = READ_LE_INT16(ptr);
ptr += 2;
@@ -668,7 +668,7 @@ void Animations::processAnimActions(int32 actorIdx) {
}
}
-bool Animations::initAnim(AnimationTypes newAnim, int16 animType, uint8 animExtra, int32 actorIdx) {
+bool Animations::initAnim(AnimationTypes newAnim, int16 animType, AnimationTypes animExtra, int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
if (actor->entity == -1) {
return false;
@@ -682,8 +682,8 @@ bool Animations::initAnim(AnimationTypes newAnim, int16 animType, uint8 animExtr
return true;
}
- if (animExtra == 255 && actor->animType != 2) {
- animExtra = (uint8)actor->anim;
+ if (animExtra == AnimationTypes::kAnimInvalid && actor->animType != 2) {
+ animExtra = actor->anim;
}
int32 animIndex = getBodyAnimIndex(newAnim, actorIdx);
@@ -702,8 +702,8 @@ bool Animations::initAnim(AnimationTypes newAnim, int16 animType, uint8 animExtr
animExtra = actor->anim;
- if (animExtra == 15 || animExtra == 7 || animExtra == 8 || animExtra == 9) {
- animExtra = 0;
+ if (animExtra == AnimationTypes::kThrowBall || animExtra == AnimationTypes::kFall || animExtra == AnimationTypes::kLanding || animExtra == AnimationTypes::kLandingHit) {
+ animExtra = AnimationTypes::kStanding;
}
}
@@ -994,7 +994,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
}
// process wall hit while running
- if (_engine->_collision->causeActorDamage && !actor->dynamicFlags.bIsFalling && !currentlyProcessedActorIdx && _engine->_actor->heroBehaviour == kAthletic && actor->anim == kForward) {
+ if (_engine->_collision->causeActorDamage && !actor->dynamicFlags.bIsFalling && !currentlyProcessedActorIdx && _engine->_actor->heroBehaviour == HeroBehaviourType::kAthletic && actor->anim == AnimationTypes::kForward) {
_engine->_movements->rotateActor(actor->boudingBox.x.bottomLeft, actor->boudingBox.z.bottomLeft, actor->angle + 0x580);
_engine->_renderer->destX += _engine->_movements->processActorX;
@@ -1003,7 +1003,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
if (_engine->_renderer->destX >= 0 && _engine->_renderer->destZ >= 0 && _engine->_renderer->destX <= 0x7E00 && _engine->_renderer->destZ <= 0x7E00) {
if (_engine->_grid->getBrickShape(_engine->_renderer->destX, _engine->_movements->processActorY + 256, _engine->_renderer->destZ) != ShapeType::kNone && _engine->cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
- initAnim(kBigHit, 2, 0, currentlyProcessedActorIdx);
+ initAnim(AnimationTypes::kBigHit, 2, AnimationTypes::kStanding, currentlyProcessedActorIdx);
if (IS_HERO(currentlyProcessedActorIdx)) {
_engine->_movements->heroMoved = true;
@@ -1025,7 +1025,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
} else {
if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour == kAthletic && actor->anim == AnimationTypes::kForward && _engine->cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
- initAnim(kBigHit, 2, 0, currentlyProcessedActorIdx);
+ initAnim(AnimationTypes::kBigHit, 2, AnimationTypes::kStanding, currentlyProcessedActorIdx);
_engine->_movements->heroMoved = true;
actor->life--;
}
@@ -1073,7 +1073,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
_engine->_scene->heroYBeforeFall = _engine->_movements->processActorY;
}
- initAnim(kFall, 0, 255, actorIdx);
+ initAnim(AnimationTypes::kFall, 0, AnimationTypes::kAnimInvalid, actorIdx);
}
}
}
diff --git a/engines/twine/animations.h b/engines/twine/animations.h
index de8a75eb01..1e41850189 100644
--- a/engines/twine/animations.h
+++ b/engines/twine/animations.h
@@ -122,7 +122,7 @@ public:
* @param animExtra animation actions extra data
* @param actorIdx actor index
*/
- bool initAnim(AnimationTypes newAnim, int16 animType, uint8 animExtra, int32 actorIdx);
+ bool initAnim(AnimationTypes newAnim, int16 animType, AnimationTypes animExtra, int32 actorIdx);
/**
* Process acotr animation actions
diff --git a/engines/twine/collision.cpp b/engines/twine/collision.cpp
index 38e9ca64dc..8477eae618 100644
--- a/engines/twine/collision.cpp
+++ b/engines/twine/collision.cpp
@@ -452,16 +452,16 @@ void Collision::stopFalling() { // ReceptionObj()
if (fall >= 2048) {
_engine->_extra->addExtraSpecial(_engine->_actor->processActorPtr->x, _engine->_actor->processActorPtr->y + 1000, _engine->_actor->processActorPtr->z, kHitStars);
_engine->_actor->processActorPtr->life--;
- _engine->_animations->initAnim(kLandingHit, 2, 0, _engine->_animations->currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLandingHit, 2, AnimationTypes::kStanding, _engine->_animations->currentlyProcessedActorIdx);
} else if (fall > 10) {
- _engine->_animations->initAnim(kLanding, 2, 0, _engine->_animations->currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLanding, 2, AnimationTypes::kStanding, _engine->_animations->currentlyProcessedActorIdx);
} else {
- _engine->_animations->initAnim(kStanding, 0, 0, _engine->_animations->currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kStanding, 0, AnimationTypes::kStanding, _engine->_animations->currentlyProcessedActorIdx);
}
_engine->_scene->heroYBeforeFall = 0;
} else {
- _engine->_animations->initAnim(kLanding, 2, _engine->_actor->processActorPtr->animExtra, _engine->_animations->currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLanding, 2, _engine->_actor->processActorPtr->animExtra, _engine->_animations->currentlyProcessedActorIdx);
}
_engine->_actor->processActorPtr->dynamicFlags.bIsFalling = 0;
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index 20d5540ea8..cd19b6f661 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -246,42 +246,42 @@ void Movements::processManualAction(int actorIdx) {
heroAction = true;
break;
case kAthletic:
- _engine->_animations->initAnim(kJump, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kJump, 1, AnimationTypes::kStanding, actorIdx);
break;
case kAggressive:
if (_engine->_actor->autoAgressive) {
heroMoved = true;
actor->angle = getRealAngle(&actor->move);
// TODO: previousLoopActionKey must be handled properly
- if (!previousLoopActionKey || actor->anim == kStanding) {
+ if (!previousLoopActionKey || actor->anim == AnimationTypes::kStanding) {
const int32 aggresiveMode = _engine->getRandomNumber(3);
switch (aggresiveMode) {
case 0:
- _engine->_animations->initAnim(kKick, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kKick, 1, AnimationTypes::kStanding, actorIdx);
break;
case 1:
- _engine->_animations->initAnim(kRightPunch, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kRightPunch, 1, AnimationTypes::kStanding, actorIdx);
break;
case 2:
- _engine->_animations->initAnim(kLeftPunch, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLeftPunch, 1, AnimationTypes::kStanding, actorIdx);
break;
}
}
} else {
if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
- _engine->_animations->initAnim(kLeftPunch, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLeftPunch, 1, AnimationTypes::kStanding, actorIdx);
} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
- _engine->_animations->initAnim(kRightPunch, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kRightPunch, 1, AnimationTypes::kStanding, actorIdx);
}
if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
- _engine->_animations->initAnim(kKick, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kKick, 1, AnimationTypes::kStanding, actorIdx);
}
}
break;
case kDiscrete:
- _engine->_animations->initAnim(kHide, 0, 255, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kHide, 0, AnimationTypes::kAnimInvalid, actorIdx);
break;
case kProtoPack:
break;
@@ -293,7 +293,7 @@ void Movements::processManualAction(int actorIdx) {
if (!_engine->_gameState->usingSabre) { // Use Magic Ball
if (_engine->_gameState->gameFlags[InventoryItems::kiMagicBall]) {
if (_engine->_gameState->magicBallIdx == -1) {
- _engine->_animations->initAnim(kThrowBall, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kThrowBall, 1, AnimationTypes::kStanding, actorIdx);
}
heroMoved = true;
@@ -304,7 +304,7 @@ void Movements::processManualAction(int actorIdx) {
_engine->_actor->initModelActor(InventoryItems::kiUseSabre, actorIdx);
}
- _engine->_animations->initAnim(kSabreAttack, 1, 0, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kSabreAttack, 1, AnimationTypes::kStanding, actorIdx);
heroMoved = true;
actor->angle = getRealAngle(&actor->move);
@@ -320,7 +320,7 @@ void Movements::processManualAction(int actorIdx) {
if (heroActionKey != heroPressedKey || loopCursorKeys != heroPressedKey2) {
if (heroMoved) {
- _engine->_animations->initAnim(kStanding, 0, 255, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kStanding, 0, AnimationTypes::kAnimInvalid, actorIdx);
}
}
@@ -328,18 +328,18 @@ void Movements::processManualAction(int actorIdx) {
if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
if (!_engine->_scene->currentActorInZone) {
- _engine->_animations->initAnim(kForward, 0, 255, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kForward, 0, AnimationTypes::kAnimInvalid, actorIdx);
}
heroMoved = true;
} else if (_engine->_input->isActionActive(TwinEActionType::MoveBackward)) {
- _engine->_animations->initAnim(kBackward, 0, 255, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kBackward, 0, AnimationTypes::kAnimInvalid, actorIdx);
heroMoved = true;
}
if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
heroMoved = true;
- if (actor->anim == kStanding) {
- _engine->_animations->initAnim(kTurnLeft, 0, 255, actorIdx);
+ if (actor->anim == AnimationTypes::kStanding) {
+ _engine->_animations->initAnim(AnimationTypes::kTurnLeft, 0, AnimationTypes::kAnimInvalid, actorIdx);
} else {
if (!actor->dynamicFlags.bIsRotationByAnim) {
actor->angle = getRealAngle(&actor->move);
@@ -347,8 +347,8 @@ void Movements::processManualAction(int actorIdx) {
}
} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
heroMoved = true;
- if (actor->anim == kStanding) {
- _engine->_animations->initAnim(kTurnRight, 0, 255, actorIdx);
+ if (actor->anim == AnimationTypes::kStanding) {
+ _engine->_animations->initAnim(AnimationTypes::kTurnRight, 0, AnimationTypes::kAnimInvalid, actorIdx);
} else {
if (!actor->dynamicFlags.bIsRotationByAnim) {
actor->angle = getRealAngle(&actor->move);
@@ -392,11 +392,11 @@ void Movements::processRandomAction(int actorIdx) {
if (actor->brickCausesDamage()) {
moveActor(actor->angle, (((_engine->getRandomNumber() & 0x100) + (actor->angle - 0x100)) & 0x3FF), actor->speed, &actor->move);
actor->info0 = _engine->getRandomNumber(300) + _engine->lbaTime + 300;
- _engine->_animations->initAnim(kStanding, 0, 255, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kStanding, 0, AnimationTypes::kAnimInvalid, actorIdx);
}
if (!actor->move.numOfStep) {
- _engine->_animations->initAnim(kForward, 0, 255, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kForward, 0, AnimationTypes::kAnimInvalid, actorIdx);
if (_engine->lbaTime > actor->info0) {
moveActor(actor->angle, (((_engine->getRandomNumber() & 0x100) + (actor->angle - 0x100)) & 0x3FF), actor->speed, &actor->move);
actor->info0 = _engine->getRandomNumber(300) + _engine->lbaTime + 300;
diff --git a/engines/twine/scene.cpp b/engines/twine/scene.cpp
index 18d04ea9d6..a1d1b55896 100644
--- a/engines/twine/scene.cpp
+++ b/engines/twine/scene.cpp
@@ -492,7 +492,7 @@ void Scene::processActorZones(int32 actorIdx) {
break;
case kObject:
if (IS_HERO(actorIdx) && _engine->_movements->heroAction) {
- _engine->_animations->initAnim(kAction, 1, 0, 0);
+ _engine->_animations->initAnim(AnimationTypes::kAction, 1, AnimationTypes::kStanding, 0);
processZoneExtraBonus(zone);
}
break;
@@ -507,7 +507,7 @@ void Scene::processActorZones(int32 actorIdx) {
}
break;
case kLadder:
- if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour != kProtoPack && (actor->anim == kForward || actor->anim == kTopLadder || actor->anim == kClimbLadder)) {
+ if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour != kProtoPack && (actor->anim == AnimationTypes::kForward || actor->anim == AnimationTypes::kTopLadder || actor->anim == AnimationTypes::kClimbLadder)) {
_engine->_movements->rotateActor(actor->boudingBox.x.bottomLeft, actor->boudingBox.z.bottomLeft, actor->angle + 0x580);
_engine->_renderer->destX += _engine->_movements->processActorX;
_engine->_renderer->destZ += _engine->_movements->processActorZ;
@@ -516,9 +516,9 @@ void Scene::processActorZones(int32 actorIdx) {
if (_engine->_grid->getBrickShape(_engine->_renderer->destX, actor->y + 0x100, _engine->_renderer->destZ) != ShapeType::kNone) {
currentActorInZone = true;
if (actor->y >= ABS(zone->bottomLeft.y + zone->topRight.y) / 2) {
- _engine->_animations->initAnim(kTopLadder, 2, 0, actorIdx); // reached end of ladder
+ _engine->_animations->initAnim(AnimationTypes::kTopLadder, 2, AnimationTypes::kStanding, actorIdx); // reached end of ladder
} else {
- _engine->_animations->initAnim(kClimbLadder, 0, 255, actorIdx); // go up in ladder
+ _engine->_animations->initAnim(AnimationTypes::kClimbLadder, 0, AnimationTypes::kAnimInvalid, actorIdx); // go up in ladder
}
}
}
diff --git a/engines/twine/script_life_v1.cpp b/engines/twine/script_life_v1.cpp
index ff8f789574..9de01aa7e0 100644
--- a/engines/twine/script_life_v1.cpp
+++ b/engines/twine/script_life_v1.cpp
@@ -191,11 +191,11 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
break;
}
case kcANIM:
- engine->_scene->currentScriptValue = ctx.actor->anim;
+ engine->_scene->currentScriptValue = (int16)ctx.actor->anim;
break;
case kcANIM_OBJ: {
int32 actorIdx = ctx.stream.readByte();
- engine->_scene->currentScriptValue = engine->_scene->getActor(actorIdx)->anim;
+ engine->_scene->currentScriptValue = (int16)engine->_scene->getActor(actorIdx)->anim;
break;
}
case kcL_TRACK:
@@ -545,7 +545,7 @@ static int32 lBODY_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
/*0x13*/
static int32 lANIM(TwinEEngine *engine, LifeScriptContext &ctx) {
AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
- engine->_animations->initAnim(animIdx, 0, 0, ctx.actorIdx);
+ engine->_animations->initAnim(animIdx, 0, AnimationTypes::kStanding, ctx.actorIdx);
return 0;
}
@@ -553,7 +553,7 @@ static int32 lANIM(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lANIM_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
int32 otherActorIdx = ctx.stream.readByte();
AnimationTypes otherAnimIdx = (AnimationTypes)ctx.stream.readByte();
- engine->_animations->initAnim(otherAnimIdx, 0, 0, otherActorIdx);
+ engine->_animations->initAnim(otherAnimIdx, 0, AnimationTypes::kStanding, otherActorIdx);
return 0;
}
@@ -654,7 +654,7 @@ static int32 lCAM_FOLLOW(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lSET_BEHAVIOUR(TwinEEngine *engine, LifeScriptContext &ctx) {
const int32 behavior = ctx.stream.readByte();
- engine->_animations->initAnim(kStanding, 0, 255, 0);
+ engine->_animations->initAnim(AnimationTypes::kStanding, 0, AnimationTypes::kAnimInvalid, 0);
engine->_actor->setBehaviour(behavior);
return 0;
@@ -1371,9 +1371,9 @@ static int32 lMESSAGE_SENDELL(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lANIM_SET(TwinEEngine *engine, LifeScriptContext &ctx) {
AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
- ctx.actor->anim = kAnimNone;
+ ctx.actor->anim = AnimationTypes::kAnimNone;
ctx.actor->previousAnimIdx = -1;
- engine->_animations->initAnim(animIdx, 0, 0, ctx.actorIdx);
+ engine->_animations->initAnim(animIdx, 0, AnimationTypes::kStanding, ctx.actorIdx);
return 0;
}
diff --git a/engines/twine/script_move_v1.cpp b/engines/twine/script_move_v1.cpp
index e579f1c3da..f42e6866d1 100644
--- a/engines/twine/script_move_v1.cpp
+++ b/engines/twine/script_move_v1.cpp
@@ -89,7 +89,7 @@ static int32 mBODY(TwinEEngine *engine, MoveScriptContext &ctx) {
/*0x03*/
static int32 mANIM(TwinEEngine *engine, MoveScriptContext &ctx) {
AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
- if (engine->_animations->initAnim(animIdx, 0, 0, ctx.actorIdx)) {
+ if (engine->_animations->initAnim(animIdx, 0, AnimationTypes::kStanding, ctx.actorIdx)) {
return 0;
}
ctx.undo(1);
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index c1bdaaa92e..4105f58190 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -46,6 +46,49 @@ enum class ShapeType {
kFlatBottom2 = 15
};
+/** Control mode types */
+enum class ControlMode {
+ kNoMove = 0,
+ kManual = 1,
+ kFollow = 2,
+ kTrack = 3,
+ kFollow2 = 4,
+ kTrackAttack = 5,
+ kSameXZ = 6,
+ kRandom = 7
+};
+
+enum class AnimationTypes {
+ kAnimNone = -1,
+ kStanding = 0,
+ kForward = 1,
+ kBackward = 2,
+ kTurnLeft = 3,
+ kTurnRight = 4,
+ kHit = 5,
+ kBigHit = 6,
+ kFall = 7,
+ kLanding = 8,
+ kLandingHit = 9,
+ kLandDeath = 10,
+ kAction = 11,
+ kClimbLadder = 12,
+ kTopLadder = 13,
+ kJump = 14,
+ kThrowBall = 15,
+ kHide = 16,
+ kKick = 17,
+ kRightPunch = 18,
+ kLeftPunch = 19,
+ kFoundItem = 20,
+ kDrawn = 21,
+ kHit2 = 22,
+ kSabreAttack = 23,
+ kSabreUnknown = 24,
+
+ kAnimInvalid = 255
+};
+
}
#endif
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 4e5081e52f..4d53b5846d 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -508,7 +508,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_actor->setBehaviour(kNormal);
}
_actor->initModelActor(InventoryItems::kiUseSabre, 0);
- _animations->initAnim(kSabreUnknown, 1, 0, 0);
+ _animations->initAnim(AnimationTypes::kSabreUnknown, 1, AnimationTypes::kStanding, 0);
_gameState->usingSabre = true;
}
@@ -693,7 +693,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
if (!actor->dynamicFlags.bIsDead) {
if (actor->life == 0) {
if (a == 0) { // if its hero who died
- _animations->initAnim(kLandDeath, 4, 0, 0);
+ _animations->initAnim(AnimationTypes::kLandDeath, 4, AnimationTypes::kStanding, 0);
actor->controlMode = ControlMode::kNoMove;
} else {
_sound->playSample(Samples::Explode, getRandomNumber(2000) + 3096, 1, actor->x, actor->y, actor->z, a);
@@ -735,25 +735,15 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
}
if (actor->staticFlags.bCanDrown) {
- int32 brickSound;
- brickSound = _grid->getBrickSoundType(actor->x, actor->y - 1, actor->z);
+ int32 brickSound = _grid->getBrickSoundType(actor->x, actor->y - 1, actor->z);
actor->brickSound = brickSound;
if ((brickSound & 0xF0) == 0xF0) {
- if ((brickSound & 0xF) == 1) {
- if (a) { // all other actors
- int32 rnd = getRandomNumber(2000) + 3096;
- _sound->playSample(Samples::Explode, rnd, 1, actor->x, actor->y, actor->z, a);
- if (actor->bonusParameter & 0x1F0) {
- if (!(actor->bonusParameter & 1)) {
- _actor->processActorExtraBonus(a);
- }
- actor->life = 0;
- }
- } else { // if Hero
- if (_actor->heroBehaviour != 4 || (brickSound & 0x0F) != actor->anim) {
+ if ((brickSound & 0x0F) == 1) {
+ if (IS_HERO(a)) {
+ if (_actor->heroBehaviour != HeroBehaviourType::kProtoPack || actor->anim != AnimationTypes::kForward) {
if (!_actor->cropBottomScreen) {
- _animations->initAnim(kDrawn, 4, 0, 0);
+ _animations->initAnim(AnimationTypes::kDrawn, 4, AnimationTypes::kStanding, 0);
_renderer->projectPositionOnScreen(actor->x - _grid->cameraX, actor->y - _grid->cameraY, actor->z - _grid->cameraZ);
_actor->cropBottomScreen = _renderer->projPosY;
}
@@ -763,6 +753,15 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_actor->cropBottomScreen = _renderer->projPosY;
actor->staticFlags.bCanDrown |= 0x10;
}
+ } else {
+ const int32 rnd = getRandomNumber(2000) + 3096;
+ _sound->playSample(Samples::Explode, rnd, 1, actor->x, actor->y, actor->z, a);
+ if (actor->bonusParameter & 0x1F0) {
+ if (!(actor->bonusParameter & 1)) {
+ _actor->processActorExtraBonus(a);
+ }
+ actor->life = 0;
+ }
}
}
}
Commit: bf102aa02cbf7e0a9541b16d498e547d4735ccbf
https://github.com/scummvm/scummvm/commit/bf102aa02cbf7e0a9541b16d498e547d4735ccbf
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: use IS_HERO macro
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 4d53b5846d..6f2b820415 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -692,7 +692,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
if (!actor->dynamicFlags.bIsDead) {
if (actor->life == 0) {
- if (a == 0) { // if its hero who died
+ if (IS_HERO(a)) {
_animations->initAnim(AnimationTypes::kLandDeath, 4, AnimationTypes::kStanding, 0);
actor->controlMode = ControlMode::kNoMove;
} else {
@@ -768,7 +768,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
}
if (actor->life <= 0) {
- if (!a) { // if its Hero
+ if (IS_HERO(a)) {
if (actor->dynamicFlags.bAnimEnded) {
if (_gameState->inventoryNumLeafs > 0) { // use clover leaf automaticaly
_scene->sceneHero->x = _scene->newHeroX;
Commit: c2551974a7422641936ae855ccb1055d0732c287
https://github.com/scummvm/scummvm/commit/c2551974a7422641936ae855ccb1055d0732c287
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: fixed toggling the jetpack
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 6f2b820415..910e0a2cd4 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -619,7 +619,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
}
// use Proto-Pack
- if (_input->isActionActive(TwinEActionType::UseProtoPack, false) && _gameState->gameFlags[InventoryItems::kiProtoPack] == 1) {
+ if (_input->toggleActionIfActive(TwinEActionType::UseProtoPack) && _gameState->gameFlags[InventoryItems::kiProtoPack] == 1) {
if (_gameState->gameFlags[InventoryItems::kiBookOfBu]) {
_scene->sceneHero->body = 0;
} else {
Commit: 88aebb831324a115b18ff6a897ce7005284fde32
https://github.com/scummvm/scummvm/commit/88aebb831324a115b18ff6a897ce7005284fde32
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: converted HeroBehaviourType to enum class
Changed paths:
engines/twine/actor.cpp
engines/twine/actor.h
engines/twine/animations.cpp
engines/twine/gamestate.cpp
engines/twine/menu.cpp
engines/twine/menu.h
engines/twine/movements.cpp
engines/twine/scene.cpp
engines/twine/script_life_v1.cpp
engines/twine/shared.h
engines/twine/twine.cpp
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index ef64740d53..581abf2b59 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -118,30 +118,30 @@ void Actor::loadHeroEntities() {
_engine->_scene->sceneHero->animExtraPtr = _engine->_animations->currentActorAnimExtraPtr;
}
-void Actor::setBehaviour(int32 behaviour) {
+void Actor::setBehaviour(HeroBehaviourType behaviour) {
switch (behaviour) {
- case kNormal:
- heroBehaviour = kNormal;
+ case HeroBehaviourType::kNormal:
+ heroBehaviour = behaviour;
_engine->_scene->sceneHero->entityDataPtr = heroEntityNORMAL;
_engine->_scene->sceneHero->entityDataSize = heroEntityNORMALSize;
break;
- case kAthletic:
- heroBehaviour = kAthletic;
+ case HeroBehaviourType::kAthletic:
+ heroBehaviour = behaviour;
_engine->_scene->sceneHero->entityDataPtr = heroEntityATHLETIC;
_engine->_scene->sceneHero->entityDataSize = heroEntityATHLETICSize;
break;
- case kAggressive:
- heroBehaviour = kAggressive;
+ case HeroBehaviourType::kAggressive:
+ heroBehaviour = behaviour;
_engine->_scene->sceneHero->entityDataPtr = heroEntityAGGRESSIVE;
_engine->_scene->sceneHero->entityDataSize = heroEntityAGGRESSIVESize;
break;
- case kDiscrete:
- heroBehaviour = kDiscrete;
+ case HeroBehaviourType::kDiscrete:
+ heroBehaviour = behaviour;
_engine->_scene->sceneHero->entityDataPtr = heroEntityDISCRETE;
_engine->_scene->sceneHero->entityDataSize = heroEntityDISCRETESize;
break;
- case kProtoPack:
- heroBehaviour = kProtoPack;
+ case HeroBehaviourType::kProtoPack:
+ heroBehaviour = behaviour;
_engine->_scene->sceneHero->entityDataPtr = heroEntityPROTOPACK;
_engine->_scene->sceneHero->entityDataSize = heroEntityPROTOPACKSize;
break;
@@ -179,11 +179,11 @@ void Actor::initSpriteActor(int32 actorIdx) {
}
int32 Actor::getTextIdForBehaviour() const {
- if (_engine->_actor->heroBehaviour == kAggressive && _engine->_actor->autoAgressive) {
+ if (_engine->_actor->heroBehaviour == HeroBehaviourType::kAggressive && _engine->_actor->autoAgressive) {
return TextId::kBehaviourAgressiveAuto;
}
// the other values are matching the text ids
- return _engine->_actor->heroBehaviour;
+ return (int32)_engine->_actor->heroBehaviour;
}
int32 Actor::initBody(int32 bodyIdx, int32 actorIdx, ActorBoundingBox &actorBoundingBox) {
@@ -254,8 +254,8 @@ void Actor::initModelActor(int32 bodyIdx, int16 actorIdx) {
return;
}
- if (IS_HERO(actorIdx) && heroBehaviour == kProtoPack && localActor->armor != 0 && localActor->armor != 1) {
- setBehaviour(kNormal);
+ if (IS_HERO(actorIdx) && heroBehaviour == HeroBehaviourType::kProtoPack && localActor->armor != 0 && localActor->armor != 1) {
+ setBehaviour(HeroBehaviourType::kNormal);
}
ActorBoundingBox actorBoundingBox;
diff --git a/engines/twine/actor.h b/engines/twine/actor.h
index 9728fe2821..9a749e11eb 100644
--- a/engines/twine/actor.h
+++ b/engines/twine/actor.h
@@ -34,26 +34,6 @@ namespace TwinE {
/** Total number of bodies allowed in the game */
#define NUM_BODIES 200
-/** Hero behaviour
- * <li> NORMAL: Talk / Read / Search / Use
- * <li> ATHLETIC: Jump
- * <li> AGGRESSIVE:
- * Auto mode : Fight
- * Manual mode : While holding the spacebar down
- * UP / RIGHT / LEFT will manually select
- * different punch/kick options
- * <li> DISCREET: Kneel down to hide
- *
- * @note The values must match the @c TextId indices
- */
-enum HeroBehaviourType {
- kNormal = 0,
- kAthletic = 1,
- kAggressive = 2,
- kDiscrete = 3,
- kProtoPack = 4
-};
-
/** Actors move structure */
struct ActorMoveStruct {
int16 from = 0;
@@ -263,11 +243,11 @@ public:
/** Actor shadow collition type - brick shape */
ShapeType shadowCollisionType = ShapeType::kNone; // shadowVar
- HeroBehaviourType heroBehaviour = kNormal;
+ HeroBehaviourType heroBehaviour = HeroBehaviourType::kNormal;
/** Hero auto agressive mode */
bool autoAgressive = true;
/** Previous Hero behaviour */
- HeroBehaviourType previousHeroBehaviour = kNormal;
+ HeroBehaviourType previousHeroBehaviour = HeroBehaviourType::kNormal;
/** Previous Hero angle */
int16 previousHeroAngle = 0;
@@ -306,7 +286,7 @@ public:
* Set hero behaviour
* @param behaviour behaviour value to set
*/
- void setBehaviour(int32 behaviour);
+ void setBehaviour(HeroBehaviourType behaviour);
/** Preload all sprites */
void preloadSprites();
diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index 242aa539c1..02eec566b7 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -1023,7 +1023,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
_engine->_collision->stopFalling();
_engine->_movements->processActorY = (_engine->_collision->collisionY << 8) + 0x100;
} else {
- if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour == kAthletic && actor->anim == AnimationTypes::kForward && _engine->cfgfile.WallCollision) { // avoid wall hit damage
+ if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour == HeroBehaviourType::kAthletic && actor->anim == AnimationTypes::kForward && _engine->cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
initAnim(AnimationTypes::kBigHit, 2, AnimationTypes::kStanding, currentlyProcessedActorIdx);
_engine->_movements->heroMoved = true;
diff --git a/engines/twine/gamestate.cpp b/engines/twine/gamestate.cpp
index d7046d2530..193aa9a02c 100644
--- a/engines/twine/gamestate.cpp
+++ b/engines/twine/gamestate.cpp
@@ -145,9 +145,9 @@ void GameState::initEngineVars() {
_engine->_scene->sceneTextBank = TextBankId::Options_and_menus;
_engine->_scene->currentlyFollowedActor = OWN_ACTOR_SCENE_INDEX;
- _engine->_actor->heroBehaviour = kNormal;
+ _engine->_actor->heroBehaviour = HeroBehaviourType::kNormal;
_engine->_actor->previousHeroAngle = 0;
- _engine->_actor->previousHeroBehaviour = kNormal;
+ _engine->_actor->previousHeroBehaviour = HeroBehaviourType::kNormal;
}
bool GameState::loadGame(Common::SeekableReadStream *file) {
@@ -231,7 +231,7 @@ bool GameState::saveGame(Common::WriteStream *file) {
file->write(gameFlags, NUM_GAME_FLAGS);
file->writeByte(_engine->_scene->currentSceneIdx);
file->writeByte(gameChapter);
- file->writeByte(_engine->_actor->heroBehaviour);
+ file->writeByte((byte)_engine->_actor->heroBehaviour);
file->writeByte(_engine->_scene->sceneHero->life);
file->writeSint16LE(inventoryNumKashes);
file->writeByte(magicLevelIdx);
diff --git a/engines/twine/menu.cpp b/engines/twine/menu.cpp
index 97322f0642..edb51e851b 100644
--- a/engines/twine/menu.cpp
+++ b/engines/twine/menu.cpp
@@ -785,20 +785,20 @@ void Menu::drawInfoMenu(int16 left, int16 top) {
// TODO: convert cantDrawBox to bool
void Menu::drawBehaviour(HeroBehaviourType behaviour, int32 angle, int16 cantDrawBox) {
- int32 boxLeft = behaviour * 110 + 110;
+ int32 boxLeft = (int32)behaviour * 110 + 110;
int32 boxRight = boxLeft + 99;
int32 boxTop = 110;
int32 boxBottom = 229;
- uint8 *currentAnim = _engine->_resources->animTable[_engine->_actor->heroAnimIdx[behaviour]];
- int32 currentAnimState = behaviourAnimState[behaviour];
+ uint8 *currentAnim = _engine->_resources->animTable[_engine->_actor->heroAnimIdx[(byte)behaviour]];
+ int16 currentAnimState = behaviourAnimState[(byte)behaviour];
- if (_engine->_animations->setModelAnimation(currentAnimState, currentAnim, behaviourEntity, &behaviourAnimData[behaviour])) {
+ if (_engine->_animations->setModelAnimation(currentAnimState, currentAnim, behaviourEntity, &behaviourAnimData[(byte)behaviour])) {
currentAnimState++; // keyframe
if (currentAnimState >= _engine->_animations->getNumKeyframes(currentAnim)) {
currentAnimState = _engine->_animations->getStartKeyframe(currentAnim);
}
- behaviourAnimState[behaviour] = currentAnimState;
+ behaviourAnimState[(byte)behaviour] = currentAnimState;
}
if (cantDrawBox == 0) {
@@ -833,21 +833,19 @@ void Menu::drawBehaviour(HeroBehaviourType behaviour, int32 angle, int16 cantDra
_engine->_interface->loadClip();
}
+void Menu::prepareAndDrawBehaviour(int32 angle, HeroBehaviourType behaviour) {
+ _engine->_animations->setAnimAtKeyframe(behaviourAnimState[(byte)behaviour], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[(byte)behaviour]], behaviourEntity, &behaviourAnimData[(byte)behaviour]);
+ drawBehaviour(behaviour, angle, 0);
+}
+
void Menu::drawBehaviourMenu(int32 angle) {
drawBox(100, 100, 550, 290);
_engine->_interface->drawTransparentBox(101, 101, 549, 289, 2);
- _engine->_animations->setAnimAtKeyframe(behaviourAnimState[kNormal], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[kNormal]], behaviourEntity, &behaviourAnimData[kNormal]);
- drawBehaviour(kNormal, angle, 0);
-
- _engine->_animations->setAnimAtKeyframe(behaviourAnimState[kAthletic], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[kAthletic]], behaviourEntity, &behaviourAnimData[kAthletic]);
- drawBehaviour(kAthletic, angle, 0);
-
- _engine->_animations->setAnimAtKeyframe(behaviourAnimState[kAggressive], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[kAggressive]], behaviourEntity, &behaviourAnimData[kAggressive]);
- drawBehaviour(kAggressive, angle, 0);
-
- _engine->_animations->setAnimAtKeyframe(behaviourAnimState[kDiscrete], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[kDiscrete]], behaviourEntity, &behaviourAnimData[kDiscrete]);
- drawBehaviour(kDiscrete, angle, 0);
+ prepareAndDrawBehaviour(angle, HeroBehaviourType::kNormal);
+ prepareAndDrawBehaviour(angle, HeroBehaviourType::kAthletic);
+ prepareAndDrawBehaviour(angle, HeroBehaviourType::kAggressive);
+ prepareAndDrawBehaviour(angle, HeroBehaviourType::kDiscrete);
drawInfoMenu(100, 300);
@@ -855,17 +853,17 @@ void Menu::drawBehaviourMenu(int32 angle) {
}
void Menu::processBehaviourMenu() {
- if (_engine->_actor->heroBehaviour == kProtoPack) {
+ if (_engine->_actor->heroBehaviour == HeroBehaviourType::kProtoPack) {
_engine->_sound->stopSamples();
- _engine->_actor->setBehaviour(kNormal);
+ _engine->_actor->setBehaviour(HeroBehaviourType::kNormal);
}
behaviourEntity = _engine->_actor->bodyTable[_engine->_scene->sceneHero->entity];
- _engine->_actor->heroAnimIdx[kNormal] = _engine->_actor->heroAnimIdxNORMAL;
- _engine->_actor->heroAnimIdx[kAthletic] = _engine->_actor->heroAnimIdxATHLETIC;
- _engine->_actor->heroAnimIdx[kAggressive] = _engine->_actor->heroAnimIdxAGGRESSIVE;
- _engine->_actor->heroAnimIdx[kDiscrete] = _engine->_actor->heroAnimIdxDISCRETE;
+ _engine->_actor->heroAnimIdx[(byte)HeroBehaviourType::kNormal] = _engine->_actor->heroAnimIdxNORMAL;
+ _engine->_actor->heroAnimIdx[(byte)HeroBehaviourType::kAthletic] = _engine->_actor->heroAnimIdxATHLETIC;
+ _engine->_actor->heroAnimIdx[(byte)HeroBehaviourType::kAggressive] = _engine->_actor->heroAnimIdxAGGRESSIVE;
+ _engine->_actor->heroAnimIdx[(byte)HeroBehaviourType::kDiscrete] = _engine->_actor->heroAnimIdxDISCRETE;
_engine->_movements->setActorAngleSafe(_engine->_scene->sceneHero->angle, _engine->_scene->sceneHero->angle - 256, 50, &moveMenu);
@@ -880,7 +878,7 @@ void Menu::processBehaviourMenu() {
HeroBehaviourType tmpHeroBehaviour = _engine->_actor->heroBehaviour;
- _engine->_animations->setAnimAtKeyframe(behaviourAnimState[_engine->_actor->heroBehaviour], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[_engine->_actor->heroBehaviour]], behaviourEntity, &behaviourAnimData[_engine->_actor->heroBehaviour]);
+ _engine->_animations->setAnimAtKeyframe(behaviourAnimState[(byte)_engine->_actor->heroBehaviour], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[(byte)_engine->_actor->heroBehaviour]], behaviourEntity, &behaviourAnimData[(byte)_engine->_actor->heroBehaviour]);
int32 tmpTime = _engine->lbaTime;
@@ -894,10 +892,10 @@ void Menu::processBehaviourMenu() {
heroBehaviour++;
}
- if (heroBehaviour < kNormal) {
- heroBehaviour = kDiscrete;
- } else if (heroBehaviour >= kProtoPack) {
- heroBehaviour = kNormal;
+ if (heroBehaviour < (int)HeroBehaviourType::kNormal) {
+ heroBehaviour = (int)HeroBehaviourType::kDiscrete;
+ } else if (heroBehaviour >= (int)HeroBehaviourType::kProtoPack) {
+ heroBehaviour = (int)HeroBehaviourType::kNormal;
}
_engine->_actor->heroBehaviour = (HeroBehaviourType)heroBehaviour;
@@ -906,7 +904,7 @@ void Menu::processBehaviourMenu() {
drawBehaviour(tmpHeroBehaviour, _engine->_scene->sceneHero->angle, 1);
tmpHeroBehaviour = _engine->_actor->heroBehaviour;
_engine->_movements->setActorAngleSafe(_engine->_scene->sceneHero->angle, _engine->_scene->sceneHero->angle - 256, 50, &moveMenu);
- _engine->_animations->setAnimAtKeyframe(behaviourAnimState[_engine->_actor->heroBehaviour], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[_engine->_actor->heroBehaviour]], behaviourEntity, &behaviourAnimData[_engine->_actor->heroBehaviour]);
+ _engine->_animations->setAnimAtKeyframe(behaviourAnimState[(byte)_engine->_actor->heroBehaviour], _engine->_resources->animTable[_engine->_actor->heroAnimIdx[(byte)_engine->_actor->heroBehaviour]], behaviourEntity, &behaviourAnimData[(byte)_engine->_actor->heroBehaviour]);
}
drawBehaviour(_engine->_actor->heroBehaviour, -1, 1);
diff --git a/engines/twine/menu.h b/engines/twine/menu.h
index 78569e8fd3..91dd952488 100644
--- a/engines/twine/menu.h
+++ b/engines/twine/menu.h
@@ -169,6 +169,7 @@ private:
void drawInfoMenu(int16 left, int16 top);
void drawBehaviour(HeroBehaviourType behaviour, int32 angle, int16 cantDrawBox);
void drawInventoryItems();
+ void prepareAndDrawBehaviour(int32 angle, HeroBehaviourType behaviour);
void drawBehaviourMenu(int32 angle);
void drawItem(int32 item);
/**
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index cd19b6f661..44047d5558 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -242,13 +242,13 @@ void Movements::processManualAction(int actorIdx) {
// Process hero actions
if (_engine->_input->isActionActive(TwinEActionType::ExecuteBehaviourAction)) {
switch (_engine->_actor->heroBehaviour) {
- case kNormal:
+ case HeroBehaviourType::kNormal:
heroAction = true;
break;
- case kAthletic:
+ case HeroBehaviourType::kAthletic:
_engine->_animations->initAnim(AnimationTypes::kJump, 1, AnimationTypes::kStanding, actorIdx);
break;
- case kAggressive:
+ case HeroBehaviourType::kAggressive:
if (_engine->_actor->autoAgressive) {
heroMoved = true;
actor->angle = getRealAngle(&actor->move);
@@ -280,10 +280,10 @@ void Movements::processManualAction(int actorIdx) {
}
}
break;
- case kDiscrete:
+ case HeroBehaviourType::kDiscrete:
_engine->_animations->initAnim(AnimationTypes::kHide, 0, AnimationTypes::kAnimInvalid, actorIdx);
break;
- case kProtoPack:
+ case HeroBehaviourType::kProtoPack:
break;
}
}
diff --git a/engines/twine/scene.cpp b/engines/twine/scene.cpp
index a1d1b55896..9db9262963 100644
--- a/engines/twine/scene.cpp
+++ b/engines/twine/scene.cpp
@@ -507,7 +507,7 @@ void Scene::processActorZones(int32 actorIdx) {
}
break;
case kLadder:
- if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour != kProtoPack && (actor->anim == AnimationTypes::kForward || actor->anim == AnimationTypes::kTopLadder || actor->anim == AnimationTypes::kClimbLadder)) {
+ if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour != HeroBehaviourType::kProtoPack && (actor->anim == AnimationTypes::kForward || actor->anim == AnimationTypes::kTopLadder || actor->anim == AnimationTypes::kClimbLadder)) {
_engine->_movements->rotateActor(actor->boudingBox.x.bottomLeft, actor->boudingBox.z.bottomLeft, actor->angle + 0x580);
_engine->_renderer->destX += _engine->_movements->processActorX;
_engine->_renderer->destZ += _engine->_movements->processActorZ;
diff --git a/engines/twine/script_life_v1.cpp b/engines/twine/script_life_v1.cpp
index 9de01aa7e0..f019d698ff 100644
--- a/engines/twine/script_life_v1.cpp
+++ b/engines/twine/script_life_v1.cpp
@@ -240,7 +240,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
engine->_scene->currentScriptValue = engine->_movements->targetActorDistance;
}
} else {
- if (engine->_actor->heroBehaviour == kDiscrete) {
+ if (engine->_actor->heroBehaviour == HeroBehaviourType::kDiscrete) {
int32 heroAngle;
heroAngle = ctx.actor->angle + 0x480 - newAngle + 0x400;
@@ -296,7 +296,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
engine->_scene->currentScriptValue = engine->_gameState->inventoryNumKashes;
break;
case kcBEHAVIOUR:
- engine->_scene->currentScriptValue = engine->_actor->heroBehaviour;
+ engine->_scene->currentScriptValue = (int16)engine->_actor->heroBehaviour;
break;
case kcCHAPTER:
engine->_scene->currentScriptValue = engine->_gameState->gameChapter;
@@ -652,7 +652,7 @@ static int32 lCAM_FOLLOW(TwinEEngine *engine, LifeScriptContext &ctx) {
/*0x1E*/
static int32 lSET_BEHAVIOUR(TwinEEngine *engine, LifeScriptContext &ctx) {
- const int32 behavior = ctx.stream.readByte();
+ const HeroBehaviourType behavior = (HeroBehaviourType)ctx.stream.readByte();
engine->_animations->initAnim(AnimationTypes::kStanding, 0, AnimationTypes::kAnimInvalid, 0);
engine->_actor->setBehaviour(behavior);
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 4105f58190..65733bdf31 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -89,6 +89,26 @@ enum class AnimationTypes {
kAnimInvalid = 255
};
+/** Hero behaviour
+ * <li> NORMAL: Talk / Read / Search / Use
+ * <li> ATHLETIC: Jump
+ * <li> AGGRESSIVE:
+ * Auto mode : Fight
+ * Manual mode : While holding the spacebar down
+ * UP / RIGHT / LEFT will manually select
+ * different punch/kick options
+ * <li> DISCREET: Kneel down to hide
+ *
+ * @note The values must match the @c TextId indices
+ */
+enum class HeroBehaviourType {
+ kNormal = 0,
+ kAthletic = 1,
+ kAggressive = 2,
+ kDiscrete = 3,
+ kProtoPack = 4
+};
+
}
#endif
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 910e0a2cd4..8c00533e83 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -504,8 +504,8 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
break;
case kiUseSabre:
if (_scene->sceneHero->body != InventoryItems::kiUseSabre) {
- if (_actor->heroBehaviour == kProtoPack) {
- _actor->setBehaviour(kNormal);
+ if (_actor->heroBehaviour == HeroBehaviourType::kProtoPack) {
+ _actor->setBehaviour(HeroBehaviourType::kNormal);
}
_actor->initModelActor(InventoryItems::kiUseSabre, 0);
_animations->initAnim(AnimationTypes::kSabreUnknown, 1, AnimationTypes::kStanding, 0);
@@ -540,10 +540,10 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_scene->sceneHero->body = 1;
}
- if (_actor->heroBehaviour == kProtoPack) {
- _actor->setBehaviour(kNormal);
+ if (_actor->heroBehaviour == HeroBehaviourType::kProtoPack) {
+ _actor->setBehaviour(HeroBehaviourType::kNormal);
} else {
- _actor->setBehaviour(kProtoPack);
+ _actor->setBehaviour(HeroBehaviourType::kProtoPack);
}
break;
case kiPinguin: {
@@ -626,10 +626,10 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_scene->sceneHero->body = 1;
}
- if (_actor->heroBehaviour == kProtoPack) {
- _actor->setBehaviour(kNormal);
+ if (_actor->heroBehaviour == HeroBehaviourType::kProtoPack) {
+ _actor->setBehaviour(HeroBehaviourType::kNormal);
} else {
- _actor->setBehaviour(kProtoPack);
+ _actor->setBehaviour(HeroBehaviourType::kProtoPack);
}
}
Commit: eb1fafcc2e87626fb6c52141928ae268fca78b5e
https://github.com/scummvm/scummvm/commit/eb1fafcc2e87626fb6c52141928ae268fca78b5e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-14T15:54:45+01:00
Commit Message:
TWINE: converted ExtraSpecialType to enum class
Changed paths:
engines/twine/actor.cpp
engines/twine/animations.cpp
engines/twine/collision.cpp
engines/twine/extra.cpp
engines/twine/extra.h
engines/twine/shared.h
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index 581abf2b59..85ea2c2a23 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -449,7 +449,7 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
}
}
- _engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
+ _engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, ExtraSpecialType::kHitStars);
if (!actorIdxAttacked) {
_engine->_movements->heroMoved = true;
diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index 02eec566b7..49b1b11f52 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -1002,7 +1002,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
if (_engine->_renderer->destX >= 0 && _engine->_renderer->destZ >= 0 && _engine->_renderer->destX <= 0x7E00 && _engine->_renderer->destZ <= 0x7E00) {
if (_engine->_grid->getBrickShape(_engine->_renderer->destX, _engine->_movements->processActorY + 256, _engine->_renderer->destZ) != ShapeType::kNone && _engine->cfgfile.WallCollision) { // avoid wall hit damage
- _engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
+ _engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, ExtraSpecialType::kHitStars);
initAnim(AnimationTypes::kBigHit, 2, AnimationTypes::kStanding, currentlyProcessedActorIdx);
if (IS_HERO(currentlyProcessedActorIdx)) {
@@ -1024,7 +1024,7 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
_engine->_movements->processActorY = (_engine->_collision->collisionY << 8) + 0x100;
} else {
if (IS_HERO(actorIdx) && _engine->_actor->heroBehaviour == HeroBehaviourType::kAthletic && actor->anim == AnimationTypes::kForward && _engine->cfgfile.WallCollision) { // avoid wall hit damage
- _engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, kHitStars);
+ _engine->_extra->addExtraSpecial(actor->x, actor->y + 1000, actor->z, ExtraSpecialType::kHitStars);
initAnim(AnimationTypes::kBigHit, 2, AnimationTypes::kStanding, currentlyProcessedActorIdx);
_engine->_movements->heroMoved = true;
actor->life--;
diff --git a/engines/twine/collision.cpp b/engines/twine/collision.cpp
index 8477eae618..b5443b6d15 100644
--- a/engines/twine/collision.cpp
+++ b/engines/twine/collision.cpp
@@ -450,7 +450,7 @@ void Collision::stopFalling() { // ReceptionObj()
const int32 fall = _engine->_scene->heroYBeforeFall - _engine->_movements->processActorY;
if (fall >= 2048) {
- _engine->_extra->addExtraSpecial(_engine->_actor->processActorPtr->x, _engine->_actor->processActorPtr->y + 1000, _engine->_actor->processActorPtr->z, kHitStars);
+ _engine->_extra->addExtraSpecial(_engine->_actor->processActorPtr->x, _engine->_actor->processActorPtr->y + 1000, _engine->_actor->processActorPtr->z, ExtraSpecialType::kHitStars);
_engine->_actor->processActorPtr->life--;
_engine->_animations->initAnim(AnimationTypes::kLandingHit, 2, AnimationTypes::kStanding, _engine->_animations->currentlyProcessedActorIdx);
} else if (fall > 10) {
diff --git a/engines/twine/extra.cpp b/engines/twine/extra.cpp
index f8698e1672..ebb005f7cd 100644
--- a/engines/twine/extra.cpp
+++ b/engines/twine/extra.cpp
@@ -179,7 +179,7 @@ void Extra::throwExtra(ExtraListStruct *extra, int32 var1, int32 var2, int32 var
}
void Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) { // InitSpecial
- const int16 flag = 0x8000 + type;
+ const int16 flag = 0x8000 + (int16)type;
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &extraList[i];
@@ -189,7 +189,7 @@ void Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) {
extra->info0 = flag;
extra->info1 = 0;
- if (type == kHitStars) {
+ if (type == ExtraSpecialType::kHitStars) {
extra->type = 9;
extra->x = x;
@@ -203,7 +203,7 @@ void Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) {
extra->lifeTime = _engine->lbaTime;
extra->actorIdx = 100;
}
- if (type == kExplodeCloud) {
+ if (type == ExtraSpecialType::kExplodeCloud) {
extra->type = 1;
extra->x = x;
@@ -493,16 +493,14 @@ void Extra::drawSpecialShape(const int16 *shapeTable, int32 x, int32 y, int32 co
}
void Extra::drawExtraSpecial(int32 extraIdx, int32 x, int32 y) {
- int32 specialType;
ExtraListStruct *extra = &extraList[extraIdx];
-
- specialType = extra->info0 & 0x7FFF;
+ ExtraSpecialType specialType = (ExtraSpecialType)(extra->info0 & 0x7FFF);
switch (specialType) {
- case kHitStars:
+ case ExtraSpecialType::kHitStars:
drawSpecialShape(hitStarsShapeTable, x, y, 15, (_engine->lbaTime << 5) & 0x300, 4);
break;
- case kExplodeCloud: {
+ case ExtraSpecialType::kExplodeCloud: {
int32 cloudTime = 1 + _engine->lbaTime - extra->lifeTime;
if (cloudTime > 32) {
@@ -775,7 +773,7 @@ void Extra::processExtras() {
if (process) {
// show explode cloud
if (extra->type & 0x100) {
- addExtraSpecial(currentExtraX, currentExtraY, currentExtraZ, kExplodeCloud);
+ addExtraSpecial(currentExtraX, currentExtraY, currentExtraZ, ExtraSpecialType::kExplodeCloud);
}
// if extra is magic ball
if (i == _engine->_gameState->magicBallIdx) {
diff --git a/engines/twine/extra.h b/engines/twine/extra.h
index af5dd90e32..c37de565f2 100644
--- a/engines/twine/extra.h
+++ b/engines/twine/extra.h
@@ -53,11 +53,6 @@ struct ExtraListStruct {
int16 info1 = 0; // field_20
};
-enum ExtraSpecialType {
- kHitStars = 0,
- kExplodeCloud = 1
-};
-
class TwinEEngine;
class Extra {
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 65733bdf31..6906cd90e1 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -109,6 +109,11 @@ enum class HeroBehaviourType {
kProtoPack = 4
};
+enum class ExtraSpecialType {
+ kHitStars = 0,
+ kExplodeCloud = 1
+};
+
}
#endif
More information about the Scummvm-git-logs
mailing list