[Scummvm-git-logs] scummvm master -> 6bbc92ef532fbedf2d0594bb43f2f90bf3f06d17
mgerhardy
noreply at scummvm.org
Sat Jan 7 12:13:55 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6bbc92ef53 TWINE: renamed members and methods to match original sources
Commit: 6bbc92ef532fbedf2d0594bb43f2f90bf3f06d17
https://github.com/scummvm/scummvm/commit/6bbc92ef532fbedf2d0594bb43f2f90bf3f06d17
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-07T13:09:15+01:00
Commit Message:
TWINE: renamed members and methods to match original sources
Changed paths:
engines/twine/debugger/console.cpp
engines/twine/debugger/debug_scene.cpp
engines/twine/menu/menu.cpp
engines/twine/renderer/redraw.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
engines/twine/scene/animations.cpp
engines/twine/scene/collision.cpp
engines/twine/scene/extra.cpp
engines/twine/scene/extra.h
engines/twine/scene/gamestate.cpp
engines/twine/scene/gamestate.h
engines/twine/scene/movements.cpp
engines/twine/scene/movements.h
engines/twine/scene/scene.cpp
engines/twine/script/script_life_v1.cpp
engines/twine/script/script_life_v1.h
engines/twine/script/script_move_v1.cpp
engines/twine/script/script_move_v1.h
engines/twine/twine.cpp
diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index aa4cfe03593..e817d9b6d0b 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -136,7 +136,7 @@ bool TwinEConsole::doToggleSceneryView(int argc, const char **argv) {
}
bool TwinEConsole::doToggleAutoAggressive(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_actor->_autoAggressive, "auto aggressive\n")
+ TOGGLE_DEBUG(_engine->_actor->_combatAuto, "auto aggressive\n")
return true;
}
@@ -180,7 +180,7 @@ bool TwinEConsole::doSetTrackObject(int argc, const char **argv) {
const int32 otherActorIdx = atoi(argv[1]);
const int32 offset = atoi(argv[2]);
- _engine->_scene->getActor(otherActorIdx)->_positionInMoveScript = offset;
+ _engine->_scene->getActor(otherActorIdx)->_offsetTrack = offset;
return true;
}
diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_scene.cpp
index 78a995668e8..c3aa2be0a00 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_scene.cpp
@@ -144,7 +144,7 @@ bool DebugScene::displayActors() {
bool state = false;
for (int32 a = 0; a < _engine->_scene->_sceneNumActors; a++) {
const ActorStruct *actorPtr = _engine->_scene->getActor(a);
- const IVec3 &pos = actorPtr->pos();
+ const IVec3 &pos = actorPtr->posObj();
const BoundingBox &bbox = actorPtr->_boundingBox;
const ScenePositionsProjected &positions = calculateBoxPositions(pos + bbox.mins, pos + bbox.maxs);
if (!drawBox(positions, COLOR_WHITE)) {
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 970e10800fc..3749335cc2f 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -346,7 +346,7 @@ int16 Menu::drawButtons(MenuSettings *menuSettings, bool hover) {
int16 id = menuSettings->getButtonState(i);
switch (id) {
case MenuButtonTypes::kAggressiveMode:
- if (_engine->_actor->_autoAggressive) {
+ if (_engine->_actor->_combatAuto) {
menuSettings->setButtonTextId(i, TextId::kBehaviourAggressiveAuto);
} else {
menuSettings->setButtonTextId(i, TextId::kBehaviourAggressiveManual);
@@ -473,7 +473,7 @@ int32 Menu::processMenu(MenuSettings *menuSettings) {
switch (id) {
case MenuButtonTypes::kAggressiveMode:
if (_engine->_input->toggleActionIfActive(TwinEActionType::UILeft) || _engine->_input->toggleActionIfActive(TwinEActionType::UIRight) || _engine->_input->toggleActionIfActive(TwinEActionType::UIEnter)) {
- _engine->_actor->_autoAggressive = !_engine->_actor->_autoAggressive;
+ _engine->_actor->_combatAuto = !_engine->_actor->_combatAuto;
startMillis = loopMillis;
}
break;
@@ -948,7 +948,7 @@ void Menu::drawMagicPointsBar(int32 left, int32 right, int32 top, int32 barLeftP
}
const int32 barLeft = left + barLeftPadding;
const int32 barBottom = top + barHeight;
- const int32 barRight = _engine->_screens->lerp(barLeft, right, 80, _engine->_gameState->_inventoryMagicPoints);
+ const int32 barRight = _engine->_screens->lerp(barLeft, right, 80, _engine->_gameState->_magicPoint);
const Common::Rect pointsRect(barLeft, top, barRight, barBottom);
_engine->_interface->drawFilledRect(pointsRect, COLOR_75);
drawRectBorders(barLeft, top, barLeft + _engine->_gameState->_magicLevelIdx * 80, barBottom);
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index f39cdf62e3e..2f333da54b4 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -197,7 +197,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
// no redraw required
if (actor->_staticFlags.bIsBackgrounded && !bgRedraw) {
// get actor position on screen
- const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->pos() - _engine->_grid->_camera);
+ const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->posObj() - _engine->_grid->_camera);
// check if actor is visible on screen, otherwise don't display it
if (projPos.x > VIEW_X0 && projPos.x < VIEW_X1(_engine) && projPos.y > VIEW_Y0 && projPos.y < VIEW_Y1(_engine)) {
actor->_dynamicFlags.bIsDrawn = 1;
@@ -209,7 +209,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
continue;
}
// get actor position on screen
- const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->pos() - _engine->_grid->_camera);
+ const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->posObj() - _engine->_grid->_camera);
if ((actor->_staticFlags.bUsesClipping && projPos.x > -112 && projPos.x < _engine->width() + 112 && projPos.y > -50 && projPos.y < _engine->height() + 171) ||
((!actor->_staticFlags.bUsesClipping) && projPos.x > VIEW_X0 && projPos.x < VIEW_X1(_engine) && projPos.y > VIEW_Y0 && projPos.y < VIEW_Y1(_engine))) {
@@ -244,7 +244,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
drawList[drawListPos].y = actor->_pos.y - 1;
drawList[drawListPos].z = actor->_pos.z;
} else {
- const IVec3 shadowCoord = _engine->_movements->getShadowPosition(actor->pos());
+ const IVec3 shadowCoord = _engine->_movements->getShadowPosition(actor->posObj());
drawList[drawListPos].x = shadowCoord.x;
drawList[drawListPos].y = shadowCoord.y;
drawList[drawListPos].z = shadowCoord.z;
@@ -350,7 +350,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
_engine->_animations->setModelAnimation(actor->_animPosition, animData, _engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
}
- const IVec3 &delta = actor->pos() - _engine->_grid->_camera;
+ const IVec3 &delta = actor->posObj() - _engine->_grid->_camera;
Common::Rect renderRect;
if (actorIdx == OWN_ACTOR_SCENE_INDEX) {
@@ -395,7 +395,7 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
const uint8 *spritePtr = _engine->_resources->_spriteTable[actor->_body];
// get actor position on screen
- const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->pos() - _engine->_grid->_camera);
+ const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->posObj() - _engine->_grid->_camera);
const int32 spriteWidth = spriteData.surface().w;
const int32 spriteHeight = spriteData.surface().h;
@@ -492,8 +492,8 @@ void Redraw::correctZLevels(DrawListStruct *drawList, int32 drawListPos) {
return;
}
- IVec3 tmin = ptrobj->pos() + ptrobj->_boundingBox.mins;
- IVec3 tmax = ptrobj->pos() + ptrobj->_boundingBox.maxs;
+ IVec3 tmin = ptrobj->posObj() + ptrobj->_boundingBox.mins;
+ IVec3 tmax = ptrobj->posObj() + ptrobj->_boundingBox.maxs;
int32 twinsenpos = -1;
int32 twinsenz = -1;
for (int32 pos = 0; pos < drawListPos; ++pos) {
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index a5f8926764d..a1b3f9ad555 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -57,9 +57,9 @@ void Actor::restartHeroScene() {
sceneHero->_staticFlags.bCanFall = 1;
sceneHero->_armor = 1;
- sceneHero->_positionInMoveScript = -1;
+ sceneHero->_offsetTrack = -1;
sceneHero->_labelIdx = -1;
- sceneHero->_positionInLifeScript = 0;
+ sceneHero->_offsetLife = 0;
sceneHero->_zone = -1;
sceneHero->_angle = _previousHeroAngle;
@@ -142,7 +142,7 @@ void Actor::initSpriteActor(int32 actorIdx) {
}
TextId Actor::getTextIdForBehaviour() const {
- if (_heroBehaviour == HeroBehaviourType::kAggressive && _autoAggressive) {
+ if (_heroBehaviour == HeroBehaviourType::kAggressive && _combatAuto) {
return TextId::kBehaviourAggressiveAuto;
}
// the other values are matching the text ids
@@ -234,7 +234,7 @@ void Actor::initActor(int16 actorIdx) {
_engine->_movements->setActorAngleSafe(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_move);
if (actor->_staticFlags.bUsesClipping) {
- actor->_animStep = actor->pos();
+ actor->_animStep = actor->posObj();
}
} else {
actor->_body = -1;
@@ -252,9 +252,9 @@ void Actor::initActor(int16 actorIdx) {
_engine->_movements->setActorAngleSafe(actor->_angle, actor->_angle, ANGLE_0, &actor->_move);
}
- actor->_positionInMoveScript = -1;
+ actor->_offsetTrack = -1;
actor->_labelIdx = -1;
- actor->_positionInLifeScript = 0;
+ actor->_offsetLife = 0;
}
// InitObject
@@ -339,11 +339,11 @@ void Actor::giveExtraBonus(int32 actorIdx) {
return;
}
if (actor->_dynamicFlags.bIsDead) {
- _engine->_extra->addExtraBonus(actor->pos(), ANGLE_90, ANGLE_0, bonusSprite, actor->_bonusAmount);
- _engine->_sound->playSample(Samples::ItemPopup, 1, actor->pos(), actorIdx);
+ _engine->_extra->addExtraBonus(actor->posObj(), ANGLE_90, ANGLE_0, bonusSprite, actor->_bonusAmount);
+ _engine->_sound->playSample(Samples::ItemPopup, 1, actor->posObj(), actorIdx);
} else {
const ActorStruct *sceneHero = _engine->_scene->_sceneHero;
- const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->pos(), sceneHero->pos());
+ const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->posObj(), sceneHero->posObj());
const IVec3 pos(actor->_pos.x, actor->_pos.y + actor->_boundingBox.maxs.y, actor->_pos.z);
_engine->_extra->addExtraBonus(pos, ANGLE_70, angle, bonusSprite, actor->_bonusAmount);
_engine->_sound->playSample(Samples::ItemPopup, 1, pos, actorIdx);
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 90c249f96d0..dfa83bdb8fe 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -165,7 +165,7 @@ public:
bool isAttackAnimationActive() const;
bool isJumpAnimationActive() const;
- const IVec3 &pos() const;
+ const IVec3 &posObj() const;
int32 _body = -1; // costumeIndex - index into bodyTable
BodyType _genBody = BodyType::btNormal;
@@ -198,13 +198,13 @@ public:
IVec3 _processActor;
/** Previous process actor coordinate */
IVec3 _previousActor;
- IVec3 _collisionPos;
+ IVec3 _oldPos;
- int32 _positionInMoveScript = -1;
+ int32 _offsetTrack = -1;
uint8 *_moveScript = nullptr;
int32 _moveScriptSize = 0;
- int32 _positionInLifeScript = 0;
+ int32 _offsetLife = 0;
uint8 *_lifeScript = nullptr;
int32 _lifeScriptSize = 0;
@@ -236,7 +236,7 @@ public:
AnimTimerDataStruct _animTimerData;
};
-inline const IVec3 &ActorStruct::pos() const {
+inline const IVec3 &ActorStruct::posObj() const {
return _pos;
}
@@ -286,7 +286,7 @@ public:
HeroBehaviourType _heroBehaviour = HeroBehaviourType::kNormal; // Comportement
/** Hero auto aggressive mode */
- bool _autoAggressive = true;
+ bool _combatAuto = true;
/** Previous Hero behaviour */
HeroBehaviourType _previousHeroBehaviour = HeroBehaviourType::kNormal;
/** Previous Hero angle */
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index f3346feff33..e94238d4f03 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -283,22 +283,22 @@ void Animations::processAnimActions(int32 actorIdx) {
case ActionType::ACTION_SAMPLE:
case ActionType::ACTION_SAMPLE_FREQ:
if (action.animFrame == actor->_animPosition) {
- _engine->_sound->playSample(action.sampleIndex, 1, actor->pos(), actorIdx);
+ _engine->_sound->playSample(action.sampleIndex, 1, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_THROW_EXTRA_BONUS:
if (action.animFrame == actor->_animPosition) {
- _engine->_extra->addExtraThrow(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
+ _engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
}
break;
case ActionType::ACTION_THROW_MAGIC_BALL:
- if (_engine->_gameState->_magicBallIdx == -1 && action.animFrame == actor->_animPosition) {
+ if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_animPosition) {
_engine->_extra->addExtraThrowMagicball(actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle);
}
break;
case ActionType::ACTION_SAMPLE_REPEAT:
if (action.animFrame == actor->_animPosition) {
- _engine->_sound->playSample(action.sampleIndex, action.repeat, actor->pos(), actorIdx);
+ _engine->_sound->playSample(action.sampleIndex, action.repeat, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_THROW_SEARCH:
@@ -308,7 +308,7 @@ void Animations::processAnimActions(int32 actorIdx) {
break;
case ActionType::ACTION_THROW_ALPHA:
if (action.animFrame == actor->_animPosition) {
- _engine->_extra->addExtraThrow(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
+ _engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
}
break;
case ActionType::ACTION_SAMPLE_STOP:
@@ -319,13 +319,13 @@ void Animations::processAnimActions(int32 actorIdx) {
case ActionType::ACTION_LEFT_STEP:
if (action.animFrame == actor->_animPosition && (actor->_brickSound & 0xF0U) != 0xF0U) {
const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorBegin;
- _engine->_sound->playSample(sampleIdx, 1, actor->pos(), actorIdx);
+ _engine->_sound->playSample(sampleIdx, 1, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_RIGHT_STEP:
if (action.animFrame == actor->_animPosition && (actor->_brickSound & 0xF0U) != 0xF0U) {
const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorRightBegin;
- _engine->_sound->playSample(sampleIdx, 1, actor->pos(), actorIdx);
+ _engine->_sound->playSample(sampleIdx, 1, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_HERO_HITTING:
@@ -342,13 +342,13 @@ void Animations::processAnimActions(int32 actorIdx) {
const int32 throwY = action.distanceY + actor->_pos.y;
const int32 throwZ = destPos.z + actor->_pos.z;
- _engine->_extra->addExtraThrow(actorIdx, throwX, throwY, throwZ, action.spriteIndex,
+ _engine->_extra->throwExtra(actorIdx, throwX, throwY, throwZ, action.spriteIndex,
action.xAngle, action.yAngle + actor->_angle, action.xRotPoint, action.extraAngle, action.strength);
}
break;
case ActionType::ACTION_THROW_3D_ALPHA:
if (action.animFrame == actor->_animPosition) {
- const int32 distance = getDistance2D(actor->pos(), _engine->_scene->_sceneHero->pos());
+ const int32 distance = getDistance2D(actor->posObj(), _engine->_scene->_sceneHero->posObj());
const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->_pos.y, 0, _engine->_scene->_sceneHero->_pos.y, distance);
const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
@@ -357,7 +357,7 @@ void Animations::processAnimActions(int32 actorIdx) {
const int32 throwY = action.distanceY + actor->_pos.y;
const int32 throwZ = destPos.z + actor->_pos.z;
- _engine->_extra->addExtraThrow(actorIdx, throwX, throwY, throwZ, action.spriteIndex,
+ _engine->_extra->throwExtra(actorIdx, throwX, throwY, throwZ, action.spriteIndex,
action.xAngle + newAngle, action.yAngle + actor->_angle, action.xRotPoint, action.extraAngle, action.strength);
}
break;
@@ -372,7 +372,7 @@ void Animations::processAnimActions(int32 actorIdx) {
}
break;
case ActionType::ACTION_THROW_3D_MAGIC:
- if (_engine->_gameState->_magicBallIdx == -1 && action.animFrame == actor->_animPosition) {
+ if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_animPosition) {
const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
const int32 x = actor->_pos.x + destPos.x;
const int32 y = actor->_pos.y + action.distanceY;
@@ -469,7 +469,7 @@ void Animations::doAnim(int32 actorIdx) {
}
IVec3 &previousActor = actor->_previousActor;
- previousActor = actor->_collisionPos;
+ previousActor = actor->_oldPos;
IVec3 &processActor = actor->_processActor;
if (actor->_staticFlags.bIsSpriteActor) {
@@ -477,7 +477,7 @@ void Animations::doAnim(int32 actorIdx) {
actor->_dynamicFlags.bIsHitting = 1;
}
- processActor = actor->pos();
+ processActor = actor->posObj();
if (!actor->_dynamicFlags.bIsFalling) {
if (actor->_speed) {
@@ -582,7 +582,7 @@ void Animations::doAnim(int32 actorIdx) {
_currentStep.x = destPos.x;
_currentStep.z = destPos.z;
- processActor = actor->pos() + _currentStep - actor->_animStep;
+ processActor = actor->posObj() + _currentStep - actor->_animStep;
actor->_animStep = _currentStep;
@@ -634,8 +634,8 @@ void Animations::doAnim(int32 actorIdx) {
// actor standing on another actor
if (actor->_carryBy != -1) {
const ActorStruct *standOnActor = _engine->_scene->getActor(actor->_carryBy);
- processActor -= standOnActor->_collisionPos;
- processActor += standOnActor->pos();
+ processActor -= standOnActor->_oldPos;
+ processActor += standOnActor->posObj();
if (!collision->standingOnActor(actorIdx, actor->_carryBy)) {
actor->_carryBy = -1; // no longer standing on other actor
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 8a172e3e7c3..e5ca312b9b6 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -48,8 +48,8 @@ bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) const {
const IVec3 &mins1 = processActor + actor1->_boundingBox.mins;
const IVec3 &maxs1 = processActor + actor1->_boundingBox.maxs;
- const IVec3 &mins2 = actor2->pos() + actor2->_boundingBox.mins;
- const IVec3 &maxs2 = actor2->pos() + actor2->_boundingBox.maxs;
+ const IVec3 &mins2 = actor2->posObj() + actor2->_boundingBox.mins;
+ const IVec3 &maxs2 = actor2->posObj() + actor2->_boundingBox.maxs;
if (mins1.x >= maxs2.x) {
return false;
@@ -187,7 +187,7 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
IVec3 &processActor = actor->_processActor;
const IVec3 &previousActor = actor->_previousActor;
- const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(processActor, actorTest->pos());
+ const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(processActor, actorTest->posObj());
// protect against chain reactions
if (actorTest->_staticFlags.bCanBePushed && !actor->_staticFlags.bCanBePushed) {
@@ -207,8 +207,8 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
actorTest->_animStep.z = SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
}
} else {
- actorTest->_animStep.x = processActor.x - actor->_collisionPos.x;
- actorTest->_animStep.z = processActor.z - actor->_collisionPos.z;
+ actorTest->_animStep.x = processActor.x - actor->_oldPos.x;
+ actorTest->_animStep.z = processActor.z - actor->_oldPos.z;
}
}
@@ -234,12 +234,12 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
bool Collision::checkValidObjPos(int32 actorIdx) {
const ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- const int16 x0 = actor->pos().x + actor->_boundingBox.mins.x;
- const int16 x1 = actor->pos().x + actor->_boundingBox.maxs.x;
- const int16 y0 = actor->pos().y + actor->_boundingBox.mins.y;
- const int16 y1 = actor->pos().y + actor->_boundingBox.maxs.y;
- const int16 z0 = actor->pos().z + actor->_boundingBox.mins.z;
- const int16 z1 = actor->pos().z + actor->_boundingBox.maxs.z;
+ const int16 x0 = actor->posObj().x + actor->_boundingBox.mins.x;
+ const int16 x1 = actor->posObj().x + actor->_boundingBox.maxs.x;
+ const int16 y0 = actor->posObj().y + actor->_boundingBox.mins.y;
+ const int16 y1 = actor->posObj().y + actor->_boundingBox.maxs.y;
+ const int16 z0 = actor->posObj().z + actor->_boundingBox.mins.z;
+ const int16 z1 = actor->posObj().z + actor->_boundingBox.maxs.z;
if (x0 < 0 || x0 > SIZE_BRICK_XZ * 63) {
return false;
@@ -271,12 +271,12 @@ bool Collision::checkValidObjPos(int32 actorIdx) {
for (int32 n = 0; n < _engine->_scene->_sceneNumActors; ++n) {
const ActorStruct *actorTest = _engine->_scene->getActor(n);
if (n != actorIdx && actorTest->_body != -1 && !actor->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
- const int16 xt0 = actorTest->pos().x + actorTest->_boundingBox.mins.x;
- const int16 xt1 = actorTest->pos().x + actorTest->_boundingBox.maxs.x;
- const int16 yt0 = actorTest->pos().y + actorTest->_boundingBox.mins.y;
- const int16 yt1 = actorTest->pos().y + actorTest->_boundingBox.maxs.y;
- const int16 zt0 = actorTest->pos().z + actorTest->_boundingBox.mins.z;
- const int16 zt1 = actorTest->pos().z + actorTest->_boundingBox.maxs.z;
+ const int16 xt0 = actorTest->posObj().x + actorTest->_boundingBox.mins.x;
+ const int16 xt1 = actorTest->posObj().x + actorTest->_boundingBox.maxs.x;
+ const int16 yt0 = actorTest->posObj().y + actorTest->_boundingBox.mins.y;
+ const int16 yt1 = actorTest->posObj().y + actorTest->_boundingBox.maxs.y;
+ const int16 zt0 = actorTest->posObj().z + actorTest->_boundingBox.mins.z;
+ const int16 zt1 = actorTest->posObj().z + actorTest->_boundingBox.maxs.z;
if (x0 < xt1 && x1 > xt0 && y0 < yt1 && y1 > yt0 && z0 < zt1 && z1 > zt0) {
return false;
@@ -300,8 +300,8 @@ int32 Collision::checkObjCol(int32 actorIdx) {
// avoid current processed actor
if (a != actorIdx && actorTest->_body != -1 && !actor->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
- const IVec3 &minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
- const IVec3 &maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
+ const IVec3 &minsTest = actorTest->posObj() + actorTest->_boundingBox.mins;
+ const IVec3 &maxsTest = actorTest->posObj() + actorTest->_boundingBox.maxs;
if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
actor->_collision = a; // mark as collision with actor a
@@ -335,8 +335,8 @@ int32 Collision::checkObjCol(int32 actorIdx) {
// avoid current processed actor
if (a != actorIdx && actorTest->_body != -1 && !actorTest->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
- const IVec3 minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
- const IVec3 maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
+ const IVec3 minsTest = actorTest->posObj() + actorTest->_boundingBox.mins;
+ const IVec3 maxsTest = actorTest->posObj() + actorTest->_boundingBox.maxs;
if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
_engine->_actor->hitObj(actorIdx, a, actor->_strengthOfHit, actor->_angle + ANGLE_180);
actor->_dynamicFlags.bIsHitting = 0;
@@ -423,7 +423,7 @@ void Collision::receptionObj(int actorIdx) {
const int32 fall = _engine->_scene->_startYFalling - processActor.y;
if (fall >= SIZE_BRICK_Y * 8) {
- const IVec3 &actorPos = _engine->_actor->_processActorPtr->pos();
+ const IVec3 &actorPos = _engine->_actor->_processActorPtr->posObj();
_engine->_extra->initSpecial(actorPos.x, actorPos.y + 1000, actorPos.z, ExtraSpecialType::kHitStars);
if (fall >= SIZE_BRICK_Y * 16) {
_engine->_actor->_processActorPtr->setLife(0);
@@ -460,8 +460,8 @@ int32 Collision::extraCheckObjCol(ExtraListStruct *extra, int32 actorIdx) {
const ActorStruct *actorTest = _engine->_scene->getActor(a);
if (a != actorIdx && actorTest->_body != -1) {
- const IVec3 minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
- const IVec3 maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
+ const IVec3 minsTest = actorTest->posObj() + actorTest->_boundingBox.mins;
+ const IVec3 maxsTest = actorTest->posObj() + actorTest->_boundingBox.maxs;
if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
if (extra->strengthOfHit != 0) {
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index dd5f8adea02..b011c492b2b 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -77,7 +77,7 @@ const ExtraShape explodeCloudShape { ARRAYSIZE(explodeCloudData), explodeCloudDa
Extra::Extra(TwinEEngine *engine) : _engine(engine) {}
-int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit) { // ExtraSearch
+int32 Extra::extraSearch(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit) { // ExtraSearch
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
if (extra->sprite != -1) {
@@ -96,7 +96,7 @@ int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx
_engine->_movements->setActorAngle(ANGLE_0, maxSpeed, ANGLE_17, &extra->trackActorMove);
const ActorStruct *actor = _engine->_scene->getActor(targetActor);
- extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->pos());
+ extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->posObj());
return i;
}
return -1;
@@ -130,7 +130,7 @@ void Extra::resetExtras() {
}
}
-void Extra::throwExtra(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle) {
+void Extra::initFly(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle) {
extra->type |= ExtraType::FLY;
extra->lastPos = extra->pos;
@@ -166,7 +166,7 @@ int32 Extra::initSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) {
extra->pos.y = y;
extra->pos.z = z;
- throwExtra(extra, _engine->getRandomNumber(ANGLE_90) + ANGLE_45, _engine->getRandomNumber(ANGLE_360), 50, 20);
+ initFly(extra, _engine->getRandomNumber(ANGLE_90) + ANGLE_45, _engine->getRandomNumber(ANGLE_360), 50, 20);
extra->strengthOfHit = 0;
extra->payload.lifeTime = 100;
@@ -238,7 +238,7 @@ int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle
extra->pos.y = y;
extra->pos.z = z;
- throwExtra(extra, xAngle, yAngle, 40, ToAngle(15));
+ initFly(extra, xAngle, yAngle, 40, ToAngle(15));
extra->strengthOfHit = 0;
extra->payload.lifeTime = TO_SECONDS(20);
@@ -249,7 +249,7 @@ int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle
return -1;
}
-int32 Extra::addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle, int32 strengthOfHit) {
+int32 Extra::throwExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle, int32 strengthOfHit) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
if (extra->sprite != -1) {
@@ -261,7 +261,7 @@ int32 Extra::addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spri
extra->pos.y = y;
extra->pos.z = z;
- throwExtra(extra, xAngle, yAngle, xRotPoint, extraAngle);
+ initFly(extra, xAngle, yAngle, xRotPoint, extraAngle);
extra->strengthOfHit = strengthOfHit;
extra->spawnTime = _engine->_lbaTime;
@@ -292,7 +292,7 @@ int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spr
extra->strengthOfHit = strengthOfHit;
_engine->_movements->setActorAngle(ANGLE_0, finalAngle, ANGLE_17, &extra->trackActorMove);
const ActorStruct *actor = _engine->_scene->getActor(targetActorIdx);
- extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->pos());
+ extra->angle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->posObj());
return i;
}
@@ -300,7 +300,7 @@ int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spr
return -1;
}
-int32 Extra::findExtraKey() const {
+int32 Extra::searchBonusKey() const {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
const ExtraListStruct *extra = &_extraList[i];
if (extra->sprite == SPRITEHQR_KEY) {
@@ -311,7 +311,7 @@ int32 Extra::findExtraKey() const {
return -1;
}
-int32 Extra::addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx) {
+int32 Extra::extraSearchKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
if (extra->sprite != -1) {
@@ -359,38 +359,38 @@ void Extra::addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int3
break;
}
- _engine->_gameState->_magicBallNumBounce = ((_engine->_gameState->_inventoryMagicPoints - 1) / 20) + 1;
- if (_engine->_gameState->_inventoryMagicPoints == 0) {
- _engine->_gameState->_magicBallNumBounce = 0;
+ _engine->_gameState->_magicBallType = ((_engine->_gameState->_magicPoint - 1) / 20) + 1;
+ if (_engine->_gameState->_magicPoint == 0) {
+ _engine->_gameState->_magicBallType = 0;
}
- const int32 extraIdx = findExtraKey();
+ const int32 extraIdx = searchBonusKey();
if (extraIdx != -1) { // there is a key to aim
- _engine->_gameState->_magicBallNumBounce = 5;
+ _engine->_gameState->_magicBallType = 5;
}
- switch (_engine->_gameState->_magicBallNumBounce) {
+ switch (_engine->_gameState->_magicBallType) {
case 0:
- _engine->_gameState->_magicBallIdx = addExtraThrow(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
+ _engine->_gameState->_magicBall = throwExtra(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
break;
case 1:
- _engine->_gameState->_magicBallAuxBounce = 4;
- _engine->_gameState->_magicBallIdx = addExtraThrow(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
+ _engine->_gameState->_magicBallCount = 4;
+ _engine->_gameState->_magicBall = throwExtra(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
break;
case 2:
case 3:
case 4:
- _engine->_gameState->_magicBallNumBounce = 1;
- _engine->_gameState->_magicBallAuxBounce = 4;
- _engine->_gameState->_magicBallIdx = addExtraThrow(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
+ _engine->_gameState->_magicBallType = 1;
+ _engine->_gameState->_magicBallCount = 4;
+ _engine->_gameState->_magicBall = throwExtra(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
break;
case 5:
- _engine->_gameState->_magicBallIdx = addExtraAimingAtKey(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, extraIdx);
+ _engine->_gameState->_magicBall = extraSearchKey(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, extraIdx);
break;
}
- if (_engine->_gameState->_inventoryMagicPoints > 0) {
- _engine->_gameState->_inventoryMagicPoints--;
+ if (_engine->_gameState->_magicPoint > 0) {
+ _engine->_gameState->_magicPoint--;
}
}
@@ -518,7 +518,7 @@ void Extra::bounceExtra(ExtraListStruct *extra, int32 x, int32 y, int32 z) {
extra->spawnTime = _engine->_lbaTime;
}
-void Extra::processExtras() { // GereExtras
+void Extra::gereExtras() {
int32 currentExtraX = 0;
int32 currentExtraY = 0;
int32 currentExtraZ = 0;
@@ -563,7 +563,7 @@ void Extra::processExtras() { // GereExtras
// check if extra is out of scene
if (extra->pos.y < 0 || extra->pos.x < 0 || extra->pos.x > SCENE_SIZE_MAX || extra->pos.z < 0 || extra->pos.z > SCENE_SIZE_MAX) {
// if extra is Magic Ball
- if (i == _engine->_gameState->_magicBallIdx) {
+ if (i == _engine->_gameState->_magicBall) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
@@ -573,7 +573,7 @@ void Extra::processExtras() { // GereExtras
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z,
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z,
spriteIdx, OWN_ACTOR_SCENE_INDEX, 10000, 0);
}
@@ -604,7 +604,7 @@ void Extra::processExtras() { // GereExtras
currentExtraY = actor->_pos.y + 1000;
currentExtraZ = actor->_pos.z;
- const int32 tmpAngle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->pos());
+ const int32 tmpAngle = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos, actor->posObj());
const int32 angle = ClampAngle(tmpAngle - extra->angle);
if (angle > ANGLE_140 && angle < ANGLE_210) {
@@ -612,8 +612,8 @@ void Extra::processExtras() { // GereExtras
_engine->_actor->hitObj(actorIdx, actorIdxAttacked, extra->strengthOfHit, -1);
}
- if (i == _engine->_gameState->_magicBallIdx) {
- _engine->_gameState->_magicBallIdx = -1;
+ if (i == _engine->_gameState->_magicBall) {
+ _engine->_gameState->_magicBall = -1;
}
extra->sprite = -1;
@@ -636,8 +636,8 @@ void Extra::processExtras() { // GereExtras
_engine->_movements->setActorAngle(ANGLE_0, extra->destPos.z, ANGLE_17, &extra->trackActorMove);
if (actorIdxAttacked == _engine->_collision->extraCheckObjCol(extra, actorIdx)) {
- if (i == _engine->_gameState->_magicBallIdx) {
- _engine->_gameState->_magicBallIdx = -1;
+ if (i == _engine->_gameState->_magicBall) {
+ _engine->_gameState->_magicBall = -1;
}
extra->sprite = -1;
@@ -653,7 +653,7 @@ void Extra::processExtras() { // GereExtras
const int32 angle = ClampAngle(tmpAngle - extra->angle);
if (angle > ANGLE_140 && angle < ANGLE_210) {
- _engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->pos(), OWN_ACTOR_SCENE_INDEX);
+ _engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->posObj(), OWN_ACTOR_SCENE_INDEX);
if (extraKey->info1 > 1) {
const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(extraKey->pos - _engine->_grid->_camera);
@@ -666,7 +666,7 @@ void Extra::processExtras() { // GereExtras
extraKey->sprite = -1;
extra->sprite = -1;
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, SPRITEHQR_KEY, 0, 8000, 0);
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z, SPRITEHQR_KEY, 0, 8000, 0);
continue;
}
const int32 angle2 = _engine->_movements->getAngleAndSetTargetActorDistance(extra->pos.y, 0, extraKey->pos.y, _engine->_movements->_targetActorDistance);
@@ -685,8 +685,8 @@ void Extra::processExtras() { // GereExtras
_engine->_movements->setActorAngle(ANGLE_0, extra->destPos.z, ANGLE_17, &extra->trackActorMove);
- if (extraIdx == _engine->_collision->extraCheckExtraCol(extra, _engine->_gameState->_magicBallIdx)) {
- _engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->pos(), OWN_ACTOR_SCENE_INDEX);
+ if (extraIdx == _engine->_collision->extraCheckExtraCol(extra, _engine->_gameState->_magicBall)) {
+ _engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->posObj(), OWN_ACTOR_SCENE_INDEX);
if (extraKey->info1 > 1) {
const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(extraKey->pos - _engine->_grid->_camera);
@@ -699,7 +699,7 @@ void Extra::processExtras() { // GereExtras
extraKey->sprite = -1;
extra->sprite = -1;
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, SPRITEHQR_KEY, 0, 8000, 0);
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z, SPRITEHQR_KEY, 0, 8000, 0);
continue;
}
if (extraKey->sprite == -1) {
@@ -713,7 +713,7 @@ void Extra::processExtras() { // GereExtras
}
extra->sprite = -1;
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z,
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z,
spriteIdx, 0, 8000, 0);
continue;
}
@@ -722,7 +722,7 @@ void Extra::processExtras() { // GereExtras
if (extra->type & ExtraType::END_OBJ) {
if (_engine->_collision->extraCheckObjCol(extra, extra->payload.actorIdx) != -1) {
// if extra is Magic Ball
- if (i == _engine->_gameState->_magicBallIdx) {
+ if (i == _engine->_gameState->_magicBall) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
@@ -732,7 +732,7 @@ void Extra::processExtras() { // GereExtras
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z,
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z,
spriteIdx, 0, 10000, 0);
}
@@ -762,11 +762,11 @@ void Extra::processExtras() { // GereExtras
initSpecial(currentExtraX, currentExtraY, currentExtraZ, ExtraSpecialType::kExplodeCloud);
}
// if extra is magic ball
- if (i == _engine->_gameState->_magicBallIdx) {
+ if (i == _engine->_gameState->_magicBall) {
_engine->_sound->playSample(Samples::Hit, 1, extra->pos);
// can't bounce with not magic points
- if (_engine->_gameState->_magicBallNumBounce <= 0) {
+ if (_engine->_gameState->_magicBallType <= 0) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
@@ -776,15 +776,15 @@ void Extra::processExtras() { // GereExtras
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
extra->sprite = -1;
continue;
}
// if has magic points
- if (_engine->_gameState->_magicBallNumBounce == 1) {
- if (!_engine->_gameState->_magicBallAuxBounce--) {
+ if (_engine->_gameState->_magicBallType == 1) {
+ if (!_engine->_gameState->_magicBallCount--) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
@@ -794,7 +794,7 @@ void Extra::processExtras() { // GereExtras
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
+ _engine->_gameState->_magicBall = extraSearch(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
extra->sprite = -1;
continue;
diff --git a/engines/twine/scene/extra.h b/engines/twine/scene/extra.h
index 03dd3fe8d3d..6f1bd69da73 100644
--- a/engines/twine/scene/extra.h
+++ b/engines/twine/scene/extra.h
@@ -88,17 +88,17 @@ class Extra {
private:
TwinEEngine *_engine;
- void throwExtra(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle);
+ void initFly(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle);
void bounceExtra(ExtraListStruct *extra, int32 x, int32 y, int32 z);
- int32 findExtraKey() const;
- int32 addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx);
+ int32 searchBonusKey() const;
+ int32 extraSearchKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx);
void drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size, Common::Rect &renderRect);
public:
Extra(TwinEEngine *engine);
ExtraListStruct _extraList[EXTRA_MAX_ENTRIES];
- int32 addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit);
+ int32 extraSearch(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit);
/**
* Add extra explosion
@@ -108,7 +108,7 @@ public:
*/
int32 addExtraExplode(int32 x, int32 y, int32 z);
- inline int32 addExtraExplode(const IVec3 &pos) {
+ inline int32 extraExplo(const IVec3 &pos) {
return addExtraExplode(pos.x, pos.y, pos.z);
}
@@ -122,7 +122,7 @@ public:
return addExtraBonus(pos.x, pos.y, pos.z, xAngle, yAngle, type, bonusAmount);
}
- int32 addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle, int32 strengthOfHit);
+ int32 throwExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle, int32 strengthOfHit);
int32 addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActorIdx, int32 finalAngle, int32 strengthOfHit);
void addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle);
@@ -131,7 +131,7 @@ public:
int getBonusSprite(BonusParameter bonusParameter) const;
/** Process extras */
- void processExtras();
+ void gereExtras();
};
} // namespace TwinE
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 3d667f191dd..cf27ec151d8 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -85,13 +85,13 @@ void GameState::initGameStateVars() {
void GameState::initHeroVars() {
_engine->_actor->resetActor(OWN_ACTOR_SCENE_INDEX); // reset Hero
- _magicBallIdx = -1;
+ _magicBall = -1;
_inventoryNumLeafsBox = 2;
_inventoryNumLeafs = 2;
_inventoryNumKashes = 0;
_inventoryNumKeys = 0;
- _inventoryMagicPoints = 0;
+ _magicPoint = 0;
_usingSabre = false;
@@ -122,7 +122,7 @@ void GameState::initEngineVars() {
_inventoryNumLeafs = 0;
_inventoryNumLeafsBox = 2;
- _inventoryMagicPoints = 0;
+ _magicPoint = 0;
_inventoryNumKashes = 0;
_inventoryNumKeys = 0;
_inventoryNumGas = 0;
@@ -252,7 +252,7 @@ bool GameState::saveGame(Common::WriteStream *file) {
file->writeByte(_engine->_scene->_sceneHero->_life);
file->writeSint16LE(_inventoryNumKashes);
file->writeByte(_magicLevelIdx);
- file->writeByte(_inventoryMagicPoints);
+ file->writeByte(_magicPoint);
file->writeByte(_inventoryNumLeafsBox);
// we don't save the whole scene state - so we have to make sure that the hero is
// respawned at the start of the scene - and not at its current position
@@ -594,22 +594,22 @@ void GameState::addKashes(int16 val) {
}
int16 GameState::setMagicPoints(int16 val) {
- _inventoryMagicPoints = val;
- if (_inventoryMagicPoints > _magicLevelIdx * 20) {
- _inventoryMagicPoints = _magicLevelIdx * 20;
- } else if (_inventoryMagicPoints < 0) {
- _inventoryMagicPoints = 0;
+ _magicPoint = val;
+ if (_magicPoint > _magicLevelIdx * 20) {
+ _magicPoint = _magicLevelIdx * 20;
+ } else if (_magicPoint < 0) {
+ _magicPoint = 0;
}
- return _inventoryMagicPoints;
+ return _magicPoint;
}
int16 GameState::setMaxMagicPoints() {
- _inventoryMagicPoints = _magicLevelIdx * 20;
- return _inventoryMagicPoints;
+ _magicPoint = _magicLevelIdx * 20;
+ return _magicPoint;
}
void GameState::addMagicPoints(int16 val) {
- setMagicPoints(_inventoryMagicPoints + val);
+ setMagicPoints(_magicPoint + val);
}
int16 GameState::setLeafs(int16 val) {
diff --git a/engines/twine/scene/gamestate.h b/engines/twine/scene/gamestate.h
index b64916f9b6c..093e1131054 100644
--- a/engines/twine/scene/gamestate.h
+++ b/engines/twine/scene/gamestate.h
@@ -96,11 +96,11 @@ public:
int16 _gameChapter = 0;
/** Magic ball type index */
- int16 _magicBallIdx = 0;
+ int16 _magicBall = 0;
/** Magic ball num bounce */
- int16 _magicBallNumBounce = 0;
+ int16 _magicBallType = 0;
/** Magic ball auxiliar bounce number */
- int16 _magicBallAuxBounce = 0; // magicBallParam
+ int16 _magicBallCount = 0; // magicBallParam
/** Magic level index */
int16 _magicLevelIdx = 0;
@@ -113,7 +113,7 @@ public:
/** Store the number of inventory clover leafs */
int16 _inventoryNumLeafs = 0;
/** Store the number of inventory magic points */
- int16 _inventoryMagicPoints = 0;
+ int16 _magicPoint = 0;
/** Store the number of gas */
int16 _inventoryNumGas = 0;
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index bc4ee6e2fbc..38ea0a6b16c 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -223,7 +223,7 @@ bool Movements::processBehaviourExecution(int actorIdx) {
_engine->_animations->initAnim(AnimationTypes::kJump, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
break;
case HeroBehaviourType::kAggressive:
- if (_engine->_actor->_autoAggressive) {
+ if (_engine->_actor->_combatAuto) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
_lastJoyFlag = true;
actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
@@ -270,7 +270,7 @@ bool Movements::processAttackExecution(int actorIdx) {
if (!_engine->_gameState->_usingSabre) {
// Use Magic Ball
if (_engine->_gameState->hasItem(InventoryItems::kiMagicBall)) {
- if (_engine->_gameState->_magicBallIdx == -1) {
+ if (_engine->_gameState->_magicBall == -1) {
_engine->_animations->initAnim(AnimationTypes::kThrowBall, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
}
@@ -301,7 +301,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
if (actor->isAttackWeaponAnimationActive()) {
return;
}
- if (!_changedCursorKeys || _heroAction) {
+ if (!_changedCursorKeys || _actionNormal) {
// if walking should get stopped
if (!_engine->_input->isActionActive(TwinEActionType::MoveForward) && !_engine->_input->isActionActive(TwinEActionType::MoveBackward)) {
if (_lastJoyFlag && (_heroActionKey != _previousLoopActionKey || _changedCursorKeys != _previousChangedCursorKeys)) {
@@ -345,7 +345,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
void Movements::processManualRotationExecution(int actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- if (!_engine->_actor->_autoAggressive && actor->isAttackAnimationActive()) {
+ if (!_engine->_actor->_combatAuto && actor->isAttackAnimationActive()) {
// it is allowed to rotate in auto aggressive mode - but not in manual mode.
return;
}
@@ -366,9 +366,9 @@ void Movements::processManualRotationExecution(int actorIdx) {
void Movements::processManualAction(int actorIdx) {
if (IS_HERO(actorIdx)) {
- _heroAction = false;
+ _actionNormal = false;
if (_engine->_input->isHeroActionActive()) {
- _heroAction = processBehaviourExecution(actorIdx);
+ _actionNormal = processBehaviourExecution(actorIdx);
}
}
@@ -385,7 +385,7 @@ void Movements::processManualAction(int actorIdx) {
void Movements::processFollowAction(int actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
const ActorStruct *followedActor = _engine->_scene->getActor(actor->_followedActor);
- int32 newAngle = getAngleAndSetTargetActorDistance(actor->pos(), followedActor->pos());
+ int32 newAngle = getAngleAndSetTargetActorDistance(actor->posObj(), followedActor->posObj());
if (actor->_staticFlags.bIsSpriteActor) {
actor->_angle = newAngle;
} else {
@@ -418,8 +418,8 @@ void Movements::processRandomAction(int actorIdx) {
void Movements::processTrackAction(int actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- if (actor->_positionInMoveScript == -1) {
- actor->_positionInMoveScript = 0;
+ if (actor->_offsetTrack == -1) {
+ actor->_offsetTrack = 0;
}
}
@@ -430,7 +430,7 @@ void Movements::processSameXZAction(int actorIdx) {
actor->_pos.z = followedActor->_pos.z;
}
-void Movements::processActorMovements(int32 actorIdx) {
+void Movements::doDir(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
if (actor->_body == -1) {
return;
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index a82f706aaa2..e355ccfaa1a 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -113,7 +113,7 @@ private:
void processManualMovementExecution(int actorIdx);
void processManualRotationExecution(int actorIdx);
- bool _heroAction = false;
+ bool _actionNormal = false;
public:
Movements(TwinEEngine *engine);
@@ -189,11 +189,11 @@ public:
*/
void initRealAngleConst(int32 start, int32 end, int32 duration, ActorMoveStruct *movePtr) const;
- void processActorMovements(int32 actorIdx);
+ void doDir(int32 actorIdx);
};
inline bool Movements::shouldTriggerZoneAction() const {
- return _heroAction;
+ return _actionNormal;
}
} // namespace TwinE
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index c0bfba6701e..1e0ccb604e5 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -201,7 +201,7 @@ bool Scene::loadSceneLBA2() {
act->_pos.x = (int16)stream.readUint16LE();
act->_pos.y = (int16)stream.readUint16LE();
act->_pos.z = (int16)stream.readUint16LE();
- act->_collisionPos = act->pos();
+ act->_oldPos = act->posObj();
act->_strengthOfHit = stream.readByte();
setBonusParameterFlags(act, stream.readUint16LE());
act->_angle = (int16)stream.readUint16LE();
@@ -333,7 +333,7 @@ bool Scene::loadSceneLBA1() {
act->_pos.x = (int16)stream.readUint16LE();
act->_pos.y = (int16)stream.readUint16LE();
act->_pos.z = (int16)stream.readUint16LE();
- act->_collisionPos = act->pos();
+ act->_oldPos = act->posObj();
act->_strengthOfHit = stream.readByte();
setBonusParameterFlags(act, stream.readUint16LE());
act->_bonusParameter.givenNothing = 0;
@@ -396,11 +396,11 @@ bool Scene::loadSceneLBA1() {
if (_enableEnhancements) {
switch (_currentSceneIdx) {
case LBA1SceneId::Hamalayi_Mountains_landing_place:
- _sceneActors[21]._pos.x = _sceneActors[21]._collisionPos.x = 6656 + 256;
- _sceneActors[21]._pos.z = _sceneActors[21]._collisionPos.z = 768;
+ _sceneActors[21]._pos.x = _sceneActors[21]._oldPos.x = 6656 + 256;
+ _sceneActors[21]._pos.z = _sceneActors[21]._oldPos.z = 768;
break;
case LBA1SceneId::Principal_Island_outside_the_fortress:
- _sceneActors[29]._pos.z = _sceneActors[29]._collisionPos.z = 1795;
+ _sceneActors[29]._pos.z = _sceneActors[29]._oldPos.z = 1795;
#if 0
_sceneZones[15].mins.x = 1104;
_sceneZones[15].mins.z = 8448;
@@ -536,8 +536,8 @@ void Scene::changeScene() {
_sceneHero->_controlMode = ControlMode::kManual;
_sceneHero->_zone = -1;
- _sceneHero->_positionInLifeScript = 0;
- _sceneHero->_positionInMoveScript = -1;
+ _sceneHero->_offsetLife = 0;
+ _sceneHero->_offsetTrack = -1;
_sceneHero->_labelIdx = -1;
initScene(_needChangeScene);
@@ -586,7 +586,7 @@ void Scene::changeScene() {
ActorStruct *followedActor = getActor(_currentlyFollowedActor);
_engine->_grid->centerOnActor(followedActor);
- _engine->_gameState->_magicBallIdx = -1;
+ _engine->_gameState->_magicBall = -1;
_engine->_movements->_lastJoyFlag = true;
_engine->_grid->_useCellingGrid = -1;
_engine->_grid->_cellingGridIdx = -1;
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 5cb0a68a405..71694d67d48 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -59,8 +59,8 @@ struct LifeScriptContext {
uint8 *opcodePtr; // local opcode script pointer
LifeScriptContext(int32 _actorIdx, ActorStruct *_actor) : actorIdx(_actorIdx), actor(_actor), stream(_actor->_lifeScript, _actor->_lifeScriptSize) {
- assert(actor->_positionInLifeScript >= 0);
- stream.skip(_actor->_positionInLifeScript);
+ assert(actor->_offsetLife >= 0);
+ stream.skip(_actor->_offsetLife);
updateOpcodePos();
}
@@ -165,7 +165,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
} else {
// Returns int32, so we check for integer overflow
- int32 distance = getDistance2D(ctx.actor->pos(), otherActor->pos());
+ int32 distance = getDistance2D(ctx.actor->posObj(), otherActor->posObj());
if (ABS(distance) > MAX_TARGET_ACTOR_DISTANCE) {
engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
} else {
@@ -237,7 +237,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
}
if (ABS(targetActor->_pos.y - ctx.actor->_pos.y) < 1500) {
- newAngle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->pos(), targetActor->pos());
+ newAngle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->posObj(), targetActor->posObj());
if (ABS(engine->_movements->_targetActorDistance) > MAX_TARGET_ACTOR_DISTANCE) {
engine->_movements->_targetActorDistance = MAX_TARGET_ACTOR_DISTANCE;
}
@@ -331,7 +331,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
if (!targetActor->_dynamicFlags.bIsDead) {
// Returns int32, so we check for integer overflow
- int32 distance = getDistance3D(ctx.actor->pos(), targetActor->pos());
+ int32 distance = getDistance3D(ctx.actor->posObj(), targetActor->posObj());
if (ABS(distance) > MAX_TARGET_ACTOR_DISTANCE) {
engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
} else {
@@ -348,7 +348,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
break;
case kcMAGIC_POINTS:
debugCN(3, kDebugLevels::kDebugScripts, "magic_points(");
- engine->_scene->_currentScriptValue = engine->_gameState->_inventoryMagicPoints;
+ engine->_scene->_currentScriptValue = engine->_gameState->_magicPoint;
break;
case kcUSE_INVENTORY: {
int32 item = ctx.stream.readByte();
@@ -474,7 +474,7 @@ static int32 lEMPTY(TwinEEngine *engine, LifeScriptContext &ctx) {
*/
static int32 lEND(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::END()");
- ctx.actor->_positionInLifeScript = -1;
+ ctx.actor->_offsetLife = -1;
return 1; // break script
}
@@ -680,7 +680,7 @@ static int32 lANIM_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lSET_LIFE(TwinEEngine *engine, LifeScriptContext &ctx) {
const int16 offset = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_LIFE(%i)", (int)offset);
- ctx.actor->_positionInLifeScript = offset;
+ ctx.actor->_offsetLife = offset;
return 0;
}
@@ -692,7 +692,7 @@ static int32 lSET_LIFE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
const int32 otherActorIdx = ctx.stream.readByte();
const int16 offset = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_LIFE_OBJ(%i, %i)", (int)otherActorIdx, (int)offset);
- engine->_scene->getActor(otherActorIdx)->_positionInLifeScript = offset;
+ engine->_scene->getActor(otherActorIdx)->_offsetLife = offset;
return 0;
}
@@ -702,7 +702,7 @@ static int32 lSET_LIFE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
*/
static int32 lSET_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
const int16 offset = ctx.stream.readSint16LE();
- ctx.actor->_positionInMoveScript = offset;
+ ctx.actor->_offsetTrack = offset;
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_TRACK(%i)", (int)offset);
return 0;
}
@@ -714,7 +714,7 @@ static int32 lSET_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lSET_TRACK_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
const int32 otherActorIdx = ctx.stream.readByte();
const int16 offset = ctx.stream.readSint16LE();
- engine->_scene->getActor(otherActorIdx)->_positionInMoveScript = offset;
+ engine->_scene->getActor(otherActorIdx)->_offsetTrack = offset;
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_TRACK_OBJ(%i, %i)", (int)otherActorIdx, (int)offset);
return 0;
}
@@ -859,8 +859,8 @@ static int32 lCOMPORTEMENT(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x21
*/
static int32 lSET_COMPORTEMENT(TwinEEngine *engine, LifeScriptContext &ctx) {
- ctx.actor->_positionInLifeScript = ctx.stream.readSint16LE();
- debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_COMPORTEMENT(%i)", (int)ctx.actor->_positionInLifeScript);
+ ctx.actor->_offsetLife = ctx.stream.readSint16LE();
+ debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_COMPORTEMENT(%i)", (int)ctx.actor->_offsetLife);
return 0;
}
@@ -872,7 +872,7 @@ static int32 lSET_COMPORTEMENT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx)
const int32 otherActorIdx = ctx.stream.readByte();
const int16 pos = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_COMPORTEMENT_OBJ(%i, %i)", (int)otherActorIdx, (int)pos);
- engine->_scene->getActor(otherActorIdx)->_positionInLifeScript = pos;
+ engine->_scene->getActor(otherActorIdx)->_offsetLife = pos;
return 0;
}
@@ -980,7 +980,7 @@ static int32 lGIVE_GOLD_PIECES(TwinEEngine *engine, LifeScriptContext &ctx) {
*/
static int32 lEND_LIFE(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::END_LIFE()");
- ctx.actor->_positionInLifeScript = -1;
+ ctx.actor->_offsetLife = -1;
return 1; // break;
}
@@ -991,7 +991,7 @@ static int32 lEND_LIFE(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lSTOP_L_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::STOP_L_TRACK(%i)", (int)ctx.actor->_currentLabelPtr);
ctx.actor->_pausedTrackPtr = ctx.actor->_currentLabelPtr;
- ctx.actor->_positionInMoveScript = -1;
+ ctx.actor->_offsetTrack = -1;
return 0;
}
@@ -1001,7 +1001,7 @@ static int32 lSTOP_L_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
*/
static int32 lRESTORE_L_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::RESTORE_L_TRACK(%i)", (int)ctx.actor->_pausedTrackPtr);
- ctx.actor->_positionInMoveScript = ctx.actor->_pausedTrackPtr;
+ ctx.actor->_offsetTrack = ctx.actor->_pausedTrackPtr;
return 0;
}
@@ -1665,11 +1665,11 @@ static int32 lEXPLODE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "LIFE::EXPLODE_OBJ(%i)", (int)otherActorIdx);
const ActorStruct *otherActor = engine->_scene->getActor(otherActorIdx);
- IVec3 pos = otherActor->pos();
+ IVec3 pos = otherActor->posObj();
pos.x += engine->getRandomNumber(512) - 256;
pos.y += engine->getRandomNumber(256) - 128;
pos.z += engine->getRandomNumber(512) - 256;
- engine->_extra->addExtraExplode(pos);
+ engine->_extra->extraExplo(pos);
return 0;
}
@@ -2033,7 +2033,7 @@ ScriptLife::ScriptLife(TwinEEngine *engine) : _engine(engine) {
lTextYPos = 0;
}
-void ScriptLife::processLifeScript(int32 actorIdx) {
+void ScriptLife::doLife(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
int32 end = -2;
diff --git a/engines/twine/script/script_life_v1.h b/engines/twine/script/script_life_v1.h
index 236d71a3ada..25c147133de 100644
--- a/engines/twine/script/script_life_v1.h
+++ b/engines/twine/script/script_life_v1.h
@@ -42,7 +42,7 @@ public:
* Process actor life script
* @param actorIdx Current processed actor index
*/
- void processLifeScript(int32 actorIdx);
+ void doLife(int32 actorIdx);
};
} // namespace TwinE
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index 3c60b28c9c9..578333db552 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -43,8 +43,8 @@ struct MoveScriptContext {
Common::MemorySeekableReadWriteStream stream;
MoveScriptContext(int32 _actorIdx, ActorStruct *_actor) : actorIdx(_actorIdx), actor(_actor), stream(actor->_moveScript, actor->_moveScriptSize) {
- assert(actor->_positionInMoveScript >= 0);
- stream.skip(actor->_positionInMoveScript);
+ assert(actor->_offsetTrack >= 0);
+ stream.skip(actor->_offsetTrack);
}
void undo(int32 bytes) {
@@ -73,7 +73,7 @@ struct ScriptMoveFunction {
*/
static int32 mEND(TwinEEngine *engine, MoveScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "MOVE::END()");
- ctx.actor->_positionInMoveScript = -1;
+ ctx.actor->_offsetTrack = -1;
return 1;
}
@@ -155,7 +155,7 @@ static int32 mWAIT_ANIM(TwinEEngine *engine, MoveScriptContext &ctx) {
* @note Opcode @c 0x06
*/
static int32 mLOOP(TwinEEngine *engine, MoveScriptContext &ctx) {
- ctx.actor->_positionInMoveScript = 0;
+ ctx.actor->_offsetTrack = 0;
ctx.stream.seek(0);
debugC(3, kDebugLevels::kDebugScripts, "MOVE::LOOP()");
return 0;
@@ -224,7 +224,7 @@ static int32 mGOTO(TwinEEngine *engine, MoveScriptContext &ctx) {
const int16 pos = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "MOVE::GOTO(%i)", (int)pos);
if (pos == -1) {
- ctx.actor->_positionInMoveScript = -1;
+ ctx.actor->_offsetTrack = -1;
return 1;
}
ctx.stream.seek(pos);
@@ -237,7 +237,7 @@ static int32 mGOTO(TwinEEngine *engine, MoveScriptContext &ctx) {
*/
static int32 mSTOP(TwinEEngine *engine, MoveScriptContext &ctx) {
debugC(3, kDebugLevels::kDebugScripts, "MOVE::STOP()");
- ctx.actor->_positionInMoveScript = -1;
+ ctx.actor->_offsetTrack = -1;
return 1;
}
@@ -304,7 +304,7 @@ static int32 mWAIT_NUM_ANIM(TwinEEngine *engine, MoveScriptContext &ctx) {
static int32 mSAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "MOVE::SAMPLE(%i)", (int)sampleIdx);
- engine->_sound->playSample(sampleIdx, 1, ctx.actor->pos(), ctx.actorIdx);
+ engine->_sound->playSample(sampleIdx, 1, ctx.actor->posObj(), ctx.actorIdx);
return 0;
}
@@ -515,7 +515,7 @@ static int32 mWAIT_DOOR(TwinEEngine *engine, MoveScriptContext &ctx) {
static int32 mSAMPLE_RND(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "MOVE::SAMPLE_RND(%i)", (int)sampleIdx);
- engine->_sound->playSample(sampleIdx, 1, ctx.actor->pos(), ctx.actorIdx);
+ engine->_sound->playSample(sampleIdx, 1, ctx.actor->posObj(), ctx.actorIdx);
return 0;
}
@@ -527,7 +527,7 @@ static int32 mSAMPLE_ALWAYS(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "MOVE::SAMPLE_ALWAYS(%i)", (int)sampleIdx);
if (!engine->_sound->isSamplePlaying(sampleIdx)) { // if its not playing
- engine->_sound->playSample(sampleIdx, -1, ctx.actor->pos(), ctx.actorIdx);
+ engine->_sound->playSample(sampleIdx, -1, ctx.actor->posObj(), ctx.actorIdx);
}
return 0;
}
@@ -585,7 +585,7 @@ static int32 mREPEAT_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
static int32 mSIMPLE_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "MOVE::SIMPLE_SAMPLE(%i)", (int)sampleIdx);
- engine->_sound->playSample(sampleIdx, ctx.numRepeatSample, ctx.actor->pos(), ctx.actorIdx);
+ engine->_sound->playSample(sampleIdx, ctx.numRepeatSample, ctx.actor->posObj(), ctx.actorIdx);
ctx.numRepeatSample = 1;
return 0;
}
@@ -602,7 +602,7 @@ static int32 mFACE_HERO(TwinEEngine *engine, MoveScriptContext &ctx) {
}
engine->_scene->_currentScriptValue = angle;
if (engine->_scene->_currentScriptValue == -1 && ctx.actor->_move.numOfStep == 0) {
- engine->_scene->_currentScriptValue = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->pos(), engine->_scene->_sceneHero->pos());
+ engine->_scene->_currentScriptValue = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->posObj(), engine->_scene->_sceneHero->posObj());
engine->_movements->initRealAngleConst(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
ctx.stream.rewind(2);
ctx.stream.writeSint16LE(engine->_scene->_currentScriptValue);
@@ -696,7 +696,7 @@ static const ScriptMoveFunction function_map[] = {
ScriptMove::ScriptMove(TwinEEngine *engine) : _engine(engine) {
}
-void ScriptMove::processMoveScript(int32 actorIdx) {
+void ScriptMove::doTrack(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
int32 end = -2;
@@ -718,8 +718,8 @@ void ScriptMove::processMoveScript(int32 actorIdx) {
debugC(3, kDebugLevels::kDebugScripts, "MOVE::BREAK(%i)", actorIdx);
}
- if (ctx.actor->_positionInMoveScript != -1) {
- actor->_positionInMoveScript = ctx.stream.pos();
+ if (ctx.actor->_offsetTrack != -1) {
+ actor->_offsetTrack = ctx.stream.pos();
}
} while (end != 1);
debugC(3, kDebugLevels::kDebugScripts, "MOVE::END(%i)", actorIdx);
diff --git a/engines/twine/script/script_move_v1.h b/engines/twine/script/script_move_v1.h
index baba2f10a48..1a1239222d3 100644
--- a/engines/twine/script/script_move_v1.h
+++ b/engines/twine/script/script_move_v1.h
@@ -38,7 +38,7 @@ public:
* Process actor move script
* @param actorIdx Current processed actor index
*/
- void processMoveScript(int32 actorIdx);
+ void doTrack(int32 actorIdx);
};
} // namespace TwinE
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 17d0cdd4a63..62d7dd79e19 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -355,7 +355,7 @@ Common::Error TwinEEngine::run() {
}
}
- ConfMan.setBool("combatauto", _actor->_autoAggressive);
+ ConfMan.setBool("combatauto", _actor->_combatAuto);
ConfMan.setInt("shadow", _cfgfile.ShadowMode);
ConfMan.setBool("scezoom", _cfgfile.SceZoom);
ConfMan.setInt("polygondetails", _cfgfile.PolygonDetails);
@@ -492,7 +492,7 @@ void TwinEEngine::initConfigurations() {
_cfgfile.UseAutoSaving = ConfGetBoolOrDefault("useautosaving", false);
_cfgfile.WallCollision = ConfGetBoolOrDefault("wallcollision", false);
- _actor->_autoAggressive = ConfGetBoolOrDefault("combatauto", true);
+ _actor->_combatAuto = ConfGetBoolOrDefault("combatauto", true);
_cfgfile.ShadowMode = ConfGetIntOrDefault("shadow", 2);
_cfgfile.SceZoom = ConfGetBoolOrDefault("scezoom", false);
_cfgfile.PolygonDetails = ConfGetIntOrDefault("polygondetails", 2);
@@ -508,7 +508,7 @@ void TwinEEngine::initConfigurations() {
debug(1, "Debug: %s", (_cfgfile.Debug ? "true" : "false"));
debug(1, "UseAutoSaving: %s", (_cfgfile.UseAutoSaving ? "true" : "false"));
debug(1, "WallCollision: %s", (_cfgfile.WallCollision ? "true" : "false"));
- debug(1, "AutoAggressive: %s", (_actor->_autoAggressive ? "true" : "false"));
+ debug(1, "AutoAggressive: %s", (_actor->_combatAuto ? "true" : "false"));
debug(1, "ShadowMode: %i", _cfgfile.ShadowMode);
debug(1, "PolygonDetails: %i", _cfgfile.PolygonDetails);
debug(1, "SceZoom: %s", (_cfgfile.SceZoom ? "true" : "false"));
@@ -624,7 +624,7 @@ void TwinEEngine::unfreezeTime() {
void TwinEEngine::processActorSamplePosition(int32 actorIdx) {
const ActorStruct *actor = _scene->getActor(actorIdx);
const int32 channelIdx = _sound->getActorChannel(actorIdx);
- _sound->setSamplePosition(channelIdx, actor->pos());
+ _sound->setSamplePosition(channelIdx, actor->posObj());
}
void TwinEEngine::processBookOfBu() {
@@ -919,7 +919,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_scene->getActor(a)->_hitBy = -1;
}
- _extra->processExtras();
+ _extra->gereExtras();
for (int32 a = 0; a < _scene->_sceneNumActors; a++) {
ActorStruct *actor = _scene->getActor(a);
@@ -933,10 +933,10 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_animations->initAnim(AnimationTypes::kLandDeath, AnimType::kAnimationSet, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
actor->_controlMode = ControlMode::kNoMove;
} else {
- _sound->playSample(Samples::Explode, 1, actor->pos(), a);
+ _sound->playSample(Samples::Explode, 1, actor->posObj(), a);
if (a == _scene->_mecaPenguinIdx) {
- _extra->addExtraExplode(actor->pos());
+ _extra->extraExplo(actor->posObj());
}
}
@@ -945,12 +945,12 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
}
}
- _movements->processActorMovements(a);
+ _movements->doDir(a);
- actor->_collisionPos = actor->pos();
+ actor->_oldPos = actor->posObj();
- if (actor->_positionInMoveScript != -1) {
- _scriptMove->processMoveScript(a);
+ if (actor->_offsetTrack != -1) {
+ _scriptMove->doTrack(a);
}
_animations->doAnim(a);
@@ -959,8 +959,8 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_scene->checkZoneSce(a);
}
- if (actor->_positionInLifeScript != -1) {
- _scriptLife->processLifeScript(a);
+ if (actor->_offsetLife != -1) {
+ _scriptLife->doLife(a);
}
processActorSamplePosition(a);
@@ -980,14 +980,14 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
if (!_actor->_cropBottomScreen) {
_animations->initAnim(AnimationTypes::kDrawn, AnimType::kAnimationSet, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
}
- const IVec3 &projPos = _renderer->projectPositionOnScreen(actor->pos() - _grid->_camera);
+ const IVec3 &projPos = _renderer->projectPositionOnScreen(actor->posObj() - _grid->_camera);
actor->_controlMode = ControlMode::kNoMove;
actor->setLife(-1);
_actor->_cropBottomScreen = projPos.y;
actor->_staticFlags.bDoesntCastShadow = 1;
}
} else {
- _sound->playSample(Samples::Explode, 1, actor->pos(), a);
+ _sound->playSample(Samples::Explode, 1, actor->posObj(), a);
if (actor->_bonusParameter.cloverleaf || actor->_bonusParameter.kashes || actor->_bonusParameter.key || actor->_bonusParameter.lifepoints || actor->_bonusParameter.magicpoints) {
if (!actor->_bonusParameter.givenNothing) {
_actor->giveExtraBonus(a);
More information about the Scummvm-git-logs
mailing list