[Scummvm-git-logs] scummvm master -> d78295a8caba1e47343bc72f04a75b2ba3a4c7d6
mgerhardy
noreply at scummvm.org
Tue Nov 16 19:04:00 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2fd077dd74 TWINE: renamed some members to match the source release
d78295a8ca TWINE: Game is slow when VSYNC is ON
Commit: 2fd077dd740a404481f76c61cea230ad04325fcf
https://github.com/scummvm/scummvm/commit/2fd077dd740a404481f76c61cea230ad04325fcf
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-11-16T20:05:20+01:00
Commit Message:
TWINE: renamed some members to match the source release
fixed SCENE_SIZE_MAX and getBrickShapeFull according to source release
Changed paths:
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/grid.cpp
engines/twine/scene/grid.h
engines/twine/scene/movements.cpp
engines/twine/scene/movements.h
engines/twine/scene/scene.cpp
engines/twine/scene/scene.h
engines/twine/script/script_life_v1.cpp
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 5bf6c2a066..d67007e8a0 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -219,8 +219,8 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
int32 tmpVal = actor->_pos.z + actor->_pos.x - _engine->_grid->_camera.x - _engine->_grid->_camera.z;
// if actor is above another actor
- if (actor->_standOn != -1) {
- const ActorStruct *standOnActor = _engine->_scene->getActor(actor->_standOn);
+ if (actor->_carryBy != -1) {
+ const ActorStruct *standOnActor = _engine->_scene->getActor(actor->_carryBy);
tmpVal = standOnActor->_pos.x - _engine->_grid->_camera.x + standOnActor->_pos.z - _engine->_grid->_camera.z + 2;
}
@@ -241,7 +241,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
// if use shadows
if (_engine->_cfgfile.ShadowMode != 0 && !(actor->_staticFlags.bDoesntCastShadow)) {
- if (actor->_standOn != -1) {
+ if (actor->_carryBy != -1) {
_engine->_actor->_shadowCoord.x = actor->_pos.x;
_engine->_actor->_shadowCoord.y = actor->_pos.y - 1;
_engine->_actor->_shadowCoord.z = actor->_pos.z;
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index aecae0cbcd..440f5a2e18 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -280,7 +280,7 @@ void Actor::resetActor(int16 actorIdx) {
actor->setBrickShape(ShapeType::kNone);
actor->_collision = -1;
- actor->_standOn = -1;
+ actor->_carryBy = -1;
actor->_zone = -1;
memset(&actor->_staticFlags, 0, sizeof(StaticFlagsStruct));
@@ -338,7 +338,7 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
_engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
if (!actorIdxAttacked) {
- _engine->_movements->_heroMoved = true;
+ _engine->_movements->_lastJoyFlag = true;
}
actor->_life -= strengthOfHit;
@@ -356,8 +356,8 @@ void Actor::processActorCarrier(int32 actorIdx) {
return;
}
for (int32 a = 0; a < _engine->_scene->_sceneNumActors; a++) {
- if (actor->_standOn == actorIdx) {
- actor->_standOn = -1;
+ if (actor->_carryBy == actorIdx) {
+ actor->_carryBy = -1;
}
}
}
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index a6dfc64870..6f7e9594c9 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -216,7 +216,7 @@ public:
/**
* actor id we are standing on
*/
- int32 _standOn = 0;
+ int32 _carryBy = 0;
int32 _zone = 0;
int32 _lastRotationAngle = ANGLE_0;
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index f481af79b7..9a0f0fc54c 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -629,13 +629,13 @@ void Animations::processActorAnimations(int32 actorIdx) {
}
// actor standing on another actor
- if (actor->_standOn != -1) {
- const ActorStruct *standOnActor = _engine->_scene->getActor(actor->_standOn);
+ if (actor->_carryBy != -1) {
+ const ActorStruct *standOnActor = _engine->_scene->getActor(actor->_carryBy);
processActor -= standOnActor->_collisionPos;
processActor += standOnActor->pos();
- if (!_engine->_collision->standingOnActor(actorIdx, actor->_standOn)) {
- actor->_standOn = -1; // no longer standing on other actor
+ if (!_engine->_collision->standingOnActor(actorIdx, actor->_carryBy)) {
+ actor->_carryBy = -1; // no longer standing on other actor
}
}
@@ -663,7 +663,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
_engine->_collision->checkCollisionWithActors(actorIdx);
}
- if (actor->_standOn != -1 && actor->_dynamicFlags.bIsFalling) {
+ if (actor->_carryBy != -1 && actor->_dynamicFlags.bIsFalling) {
_engine->_collision->stopFalling();
}
@@ -686,19 +686,19 @@ void Animations::processActorAnimations(int32 actorIdx) {
}
// process wall hit while running
- if (_engine->_collision->_causeActorDamage && !actor->_dynamicFlags.bIsFalling && !_currentlyProcessedActorIdx && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_anim == AnimationTypes::kForward) {
+ if (_engine->_collision->_causeActorDamage && !actor->_dynamicFlags.bIsFalling && IS_HERO(_currentlyProcessedActorIdx) && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_anim == AnimationTypes::kForward) {
IVec3 destPos = _engine->_movements->rotateActor(actor->_boudingBox.mins.x, actor->_boudingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
destPos.x += processActor.x;
destPos.z += processActor.z;
- if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= 0x7E00 && destPos.z <= 0x7E00) { // SCENE_SIZE_MAX
+ if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= SCENE_SIZE_MAX && destPos.z <= SCENE_SIZE_MAX) {
if (_engine->_grid->getBrickShape(destPos.x, processActor.y + BRICK_HEIGHT, destPos.z) != ShapeType::kNone && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
initAnim(AnimationTypes::kBigHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
if (IS_HERO(_currentlyProcessedActorIdx)) {
- _engine->_movements->_heroMoved = true;
+ _engine->_movements->_lastJoyFlag = true;
}
actor->addLife(-1);
@@ -718,25 +718,19 @@ void Animations::processActorAnimations(int32 actorIdx) {
if (IS_HERO(actorIdx) && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_anim == AnimationTypes::kForward && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
initAnim(AnimationTypes::kBigHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
- _engine->_movements->_heroMoved = true;
+ _engine->_movements->_lastJoyFlag = true;
actor->addLife(-1);
}
// no Z coordinate issue
- if (_engine->_grid->getBrickShape(processActor.x, processActor.y, previousActor.z) == ShapeType::kNone) {
+ if (_engine->_grid->getBrickShape(processActor.x, processActor.y, previousActor.z) != ShapeType::kNone) {
+ if (_engine->_grid->getBrickShape(previousActor.x, processActor.y, processActor.z) != ShapeType::kNone) {
+ return;
+ } else {
+ processActor.x = previousActor.x;
+ }
processActor.z = previousActor.z;
}
-
- // no X coordinate issue
- if (_engine->_grid->getBrickShape(previousActor.x, processActor.y, processActor.z) == ShapeType::kNone) {
- processActor.x = previousActor.x;
- }
-
- // X and Z with issue, no move
- if (_engine->_grid->getBrickShape(processActor.x, processActor.y, previousActor.z) != ShapeType::kNone &&
- _engine->_grid->getBrickShape(previousActor.x, processActor.y, processActor.z) != ShapeType::kNone) {
- return;
- }
}
} else {
if (actor->_dynamicFlags.bIsFalling) {
@@ -748,7 +742,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
actor->_dynamicFlags.bIsFalling = 0;
} else {
- if (actor->_staticFlags.bCanFall && actor->_standOn == -1) {
+ if (actor->_staticFlags.bCanFall && actor->_carryBy == -1) {
brickShape = _engine->_grid->getBrickShape(processActor.x, processActor.y - 1, processActor.z);
if (brickShape != ShapeType::kNone) {
@@ -761,9 +755,8 @@ void Animations::processActorAnimations(int32 actorIdx) {
if (!actor->_dynamicFlags.bIsRotationByAnim) {
actor->_dynamicFlags.bIsFalling = 1;
- if (IS_HERO(actorIdx) && _engine->_scene->_heroYBeforeFall == 0) {
- _engine->_scene->_heroYBeforeFall = processActor.y;
-
+ if (IS_HERO(actorIdx) && _engine->_scene->_startYFalling == 0) {
+ _engine->_scene->_startYFalling = processActor.y;
int32 y = processActor.y - 1 - BRICK_HEIGHT;
while (y > 0 && ShapeType::kNone == _engine->_grid->getBrickShape(processActor.x, y, processActor.z)) {
y -= BRICK_HEIGHT;
@@ -812,12 +805,12 @@ void Animations::processActorAnimations(int32 actorIdx) {
processActor.z = 0;
}
- if (processActor.x > 0x7E00) { // SCENE_SIZE_MAX
- processActor.x = 0x7E00;
+ if (processActor.x > SCENE_SIZE_MAX) {
+ processActor.x = SCENE_SIZE_MAX;
}
- if (processActor.z > 0x7E00) { // SCENE_SIZE_MAX
- processActor.z = 0x7E00;
+ if (processActor.z > SCENE_SIZE_MAX) {
+ processActor.z = SCENE_SIZE_MAX;
}
actor->_pos = processActor;
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 7e2fb0857c..b713865433 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -253,7 +253,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
ActorStruct *actorTest = _engine->_scene->getActor(a);
// avoid current processed actor
- if (a != actorIdx && actorTest->_entity != -1 && !actor->_staticFlags.bComputeLowCollision && actorTest->_standOn != actorIdx) {
+ if (a != actorIdx && actorTest->_entity != -1 && !actor->_staticFlags.bComputeLowCollision && actorTest->_carryBy != actorIdx) {
const IVec3 &minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
const IVec3 &maxsTest = actorTest->pos() + actorTest->_boudingBox.maxs;
@@ -263,7 +263,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
if (actorTest->_staticFlags.bIsCarrierActor) {
if (actor->_dynamicFlags.bIsFalling || standingOnActor(actorIdx, a)) {
processActor.y = maxsTest.y - actor->_boudingBox.mins.y + 1;
- actor->_standOn = a;
+ actor->_carryBy = a;
} else {
handlePushing(minsTest, maxsTest, actor, actorTest);
}
@@ -291,7 +291,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
const ActorStruct *actorTest = _engine->_scene->getActor(a);
// avoid current processed actor
- if (a != actorIdx && actorTest->_entity != -1 && !actorTest->_staticFlags.bIsHidden && actorTest->_standOn != actorIdx) {
+ if (a != actorIdx && actorTest->_entity != -1 && !actorTest->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
const IVec3 minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
const IVec3 maxsTest = actorTest->pos() + actorTest->_boudingBox.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) {
@@ -314,7 +314,7 @@ void Collision::checkHeroCollisionWithBricks(int32 x, int32 y, int32 z, int32 da
processActor.y += y;
processActor.z += z;
- if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= 0x7E00 && processActor.z <= 0x7E00) { // SCENE_SIZE_MAX
+ if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= SCENE_SIZE_MAX && processActor.z <= SCENE_SIZE_MAX) {
const BoundingBox &bbox = _engine->_actor->_processActorPtr->_boudingBox;
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShapeFull(processActor, bbox.maxs.y);
@@ -347,7 +347,7 @@ void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 d
processActor.y += y;
processActor.z += z;
- if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= 0x7E00 && processActor.z <= 0x7E00) { // SCENE_SIZE_MAX
+ if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= SCENE_SIZE_MAX && processActor.z <= SCENE_SIZE_MAX) {
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShape(processActor);
@@ -373,7 +373,7 @@ void Collision::checkActorCollisionWithBricks(int32 x, int32 y, int32 z, int32 d
void Collision::stopFalling() { // ReceptionObj()
if (IS_HERO(_engine->_animations->_currentlyProcessedActorIdx)) {
const IVec3 &processActor = _engine->_movements->_processActor;
- const int32 fall = _engine->_scene->_heroYBeforeFall - processActor.y;
+ const int32 fall = _engine->_scene->_startYFalling - processActor.y;
if (fall >= BRICK_HEIGHT * 8) {
const IVec3 &actorPos = _engine->_actor->_processActorPtr->pos();
@@ -395,7 +395,7 @@ void Collision::stopFalling() { // ReceptionObj()
}
}
- _engine->_scene->_heroYBeforeFall = 0;
+ _engine->_scene->_startYFalling = 0;
} else {
_engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, _engine->_actor->_processActorPtr->_animExtra, _engine->_animations->_currentlyProcessedActorIdx);
}
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 3bbe0a139a..08673a48ba 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -563,7 +563,7 @@ void Extra::processExtras() {
extra->pos.z = extra->destPos.z * deltaT + extra->lastPos.z;
// check if extra is out of scene
- if (extra->pos.y < 0 || extra->pos.x < 0 || extra->pos.x > 0x7E00 || extra->pos.z < 0 || extra->pos.z > 0x7E00) { // SCENE_SIZE_MAX
+ 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) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index eea31b1b8b..4c3234d1e3 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -728,67 +728,40 @@ const IVec3 &Grid::updateCollisionCoordinates(int32 x, int32 y, int32 z) {
ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
const IVec3 &collision = updateCollisionCoordinates(x, y, z);
- if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
- return ShapeType::kNone;
- }
-
if (collision.y <= -1) {
return ShapeType::kSolid;
}
- if (collision.y < 0 || collision.y >= GRID_SIZE_Y || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
+ if (collision.x < 0 || collision.x >= GRID_SIZE_X || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
return ShapeType::kNone;
}
uint8 *blockBufferPtr = _blockBuffer;
blockBufferPtr += collision.x * GRID_SIZE_Y * 2;
blockBufferPtr += collision.y * 2;
- blockBufferPtr += (collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
+ blockBufferPtr += collision.z * (GRID_SIZE_X * GRID_SIZE_Y * 2);
uint8 blockIdx = *blockBufferPtr;
+ ShapeType brickShape;
if (blockIdx) {
const uint8 tmpBrickIdx = *(blockBufferPtr + 1);
const BlockDataEntry *blockPtr = getBlockPointer(blockIdx, tmpBrickIdx);
- const ShapeType brickShape = (ShapeType)blockPtr->brickShape;
-
- const int32 newY = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
- int32 currY = collision.y;
-
- for (int32 i = 0; i < newY; i++) {
- if (currY >= GRID_SIZE_Y) {
- return brickShape;
- }
-
- blockBufferPtr += 2;
- currY++;
-
- if (READ_LE_INT16(blockBufferPtr) != 0) {
- return ShapeType::kSolid;
- }
- }
-
- return brickShape;
+ brickShape = (ShapeType)blockPtr->brickShape;
+ } else {
+ brickShape = (ShapeType) * (blockBufferPtr + 1);
}
- const ShapeType brickShape = (ShapeType) * (blockBufferPtr + 1);
-
- const int32 newY = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
- int32 currY = collision.y;
-
- for (int32 i = 0; i < newY; i++) {
- if (currY >= GRID_SIZE_Y) {
- return brickShape;
- }
+ int32 ymax = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
+ // check full height
+ for (y = collision.y; ymax > 0 && y < (GRID_SIZE_Y - 1); --ymax, y++) {
blockBufferPtr += 2;
- currY++;
-
- if (READ_LE_INT16(blockBufferPtr) != 0) {
+ if (READ_LE_INT16(blockBufferPtr)) {
return ShapeType::kSolid;
}
}
- return ShapeType::kNone;
+ return brickShape;
}
uint8 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index 014fcabe68..4c99576cfd 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -81,7 +81,7 @@ struct BrickEntry {
// short max 32767 0x7FFF
// 32256 0x7E00
// 32000 0x7D00
-#define SCENE_SIZE_MAX (BRICK_SIZE * GRID_SIZE_X - 1)
+#define SCENE_SIZE_MAX (BRICK_SIZE * (GRID_SIZE_X - 1))
// short min -32768
#define SCENE_SIZE_MIN (-BRICK_SIZE * GRID_SIZE_X)
#define SCENE_SIZE_HALF (BRICK_SIZE * GRID_SIZE_X / 2)
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index d740f48927..1e0e816e5d 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -223,7 +223,7 @@ bool Movements::processBehaviourExecution(int actorIdx) {
case HeroBehaviourType::kAggressive:
if (_engine->_actor->_autoAggressive) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- _heroMoved = true;
+ _lastJoyFlag = true;
actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
// TODO: previousLoopActionKey must be handled properly
if (!_previousLoopActionKey || actor->_anim == AnimationTypes::kStanding) {
@@ -244,13 +244,13 @@ bool Movements::processBehaviourExecution(int actorIdx) {
} else {
if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
_engine->_animations->initAnim(AnimationTypes::kLeftPunch, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
- _heroMoved = true;
+ _lastJoyFlag = true;
} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
_engine->_animations->initAnim(AnimationTypes::kRightPunch, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
- _heroMoved = true;
+ _lastJoyFlag = true;
} else if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
_engine->_animations->initAnim(AnimationTypes::kKick, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
- _heroMoved = true;
+ _lastJoyFlag = true;
}
}
break;
@@ -302,21 +302,21 @@ void Movements::processManualMovementExecution(int actorIdx) {
if (!_changedCursorKeys || _heroAction) {
// if walking should get stopped
if (!_engine->_input->isActionActive(TwinEActionType::MoveForward) && !_engine->_input->isActionActive(TwinEActionType::MoveBackward)) {
- if (_heroMoved && (_heroActionKey != _previousLoopActionKey || _changedCursorKeys != _previousChangedCursorKeys)) {
+ if (_lastJoyFlag && (_heroActionKey != _previousLoopActionKey || _changedCursorKeys != _previousChangedCursorKeys)) {
_engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
}
}
- _heroMoved = false;
+ _lastJoyFlag = false;
if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
if (!_engine->_scene->_currentActorInZone) {
_engine->_animations->initAnim(AnimationTypes::kForward, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
}
- _heroMoved = true;
+ _lastJoyFlag = true;
} else if (_engine->_input->isActionActive(TwinEActionType::MoveBackward)) {
_engine->_animations->initAnim(AnimationTypes::kBackward, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
- _heroMoved = true;
+ _lastJoyFlag = true;
}
if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
@@ -327,7 +327,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
}
}
- _heroMoved = true;
+ _lastJoyFlag = true;
} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
if (actor->_anim == AnimationTypes::kStanding) {
_engine->_animations->initAnim(AnimationTypes::kTurnRight, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
@@ -336,7 +336,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
}
}
- _heroMoved = true;
+ _lastJoyFlag = true;
}
}
}
@@ -372,7 +372,7 @@ void Movements::processManualAction(int actorIdx) {
if (_engine->_input->isActionActive(TwinEActionType::ThrowMagicBall) && !_engine->_gameState->inventoryDisabled()) {
if (processAttackExecution(actorIdx)) {
- _heroMoved = true;
+ _lastJoyFlag = true;
}
}
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index ae53dc35d4..65ca59e416 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -126,7 +126,7 @@ public:
*/
bool shouldTriggerZoneAction() const;
- bool _heroMoved = false;
+ bool _lastJoyFlag = false;
/** Process actor coordinate */
IVec3 _processActor;
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 4bd28e9d68..0aab58dc7f 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -543,7 +543,7 @@ void Scene::changeScene() {
}
_sceneHero->_pos = _newHeroPos;
- _heroYBeforeFall = _newHeroPos.y;
+ _startYFalling = _newHeroPos.y;
_engine->_renderer->setLightVector(_alphaLight, _betaLight, ANGLE_0);
@@ -568,7 +568,7 @@ void Scene::changeScene() {
_engine->_grid->centerOnActor(followedActor);
_engine->_gameState->_magicBallIdx = -1;
- _engine->_movements->_heroMoved = true;
+ _engine->_movements->_lastJoyFlag = true;
_engine->_grid->_useCellingGrid = -1;
_engine->_grid->_cellingGridIdx = -1;
_engine->_screens->_lockPalette = false;
@@ -753,7 +753,7 @@ void Scene::processActorZones(int32 actorIdx) {
destPos.x += _engine->_movements->_processActor.x;
destPos.z += _engine->_movements->_processActor.z;
- if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= 0x7E00 && destPos.z <= 0x7E00) { // SCENE_SIZE_MAX
+ if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= SCENE_SIZE_MAX && destPos.z <= SCENE_SIZE_MAX) {
if (_engine->_grid->getBrickShape(destPos.x, actor->_pos.y + ANGLE_90, destPos.z) != ShapeType::kNone) {
_currentActorInZone = true;
if (actor->_pos.y >= ABS(zone->mins.y + zone->maxs.y) / 2) {
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index 487f26cca1..9e275c46ba 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -179,7 +179,7 @@ public:
IVec3 _newHeroPos;
/** Hero Y coordinate before fall */
- int16 _heroYBeforeFall = 0;
+ int16 _startYFalling = 0;
/** Hero type of position in scene */
ScenePositionType _heroPositionType = ScenePositionType::kNoPosition; // twinsenPositionModeInNewCube
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index ac8ea064e8..a14d9b29a3 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -356,7 +356,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
engine->_scene->_currentScriptValue = engine->_gameState->_inventoryNumGas;
break;
case kcCARRIED_BY:
- engine->_scene->_currentScriptValue = ctx.actor->_standOn;
+ engine->_scene->_currentScriptValue = ctx.actor->_carryBy;
break;
case kcCDROM:
engine->_scene->_currentScriptValue = 1;
Commit: d78295a8caba1e47343bc72f04a75b2ba3a4c7d6
https://github.com/scummvm/scummvm/commit/d78295a8caba1e47343bc72f04a75b2ba3a4c7d6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-11-16T20:05:20+01:00
Commit Message:
TWINE: Game is slow when VSYNC is ON
https://bugs.scummvm.org/ticket/13066
I'm still not 100% sure on the speed of the game. I've compared with videos like this one:
https://www.youtube.com/watch?v=YdTCwx9hAvo
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 3c19a72d81..a25ca8c9e5 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -710,7 +710,9 @@ void TwinEEngine::processOptionsMenu() {
}
int32 TwinEEngine::runGameEngine() { // mainLoopInteration
- FrameMarker frame(this, 0);
+ g_system->delayMillis(2);
+
+ FrameMarker frame(this, 60);
_input->enableKeyMap(mainKeyMapId);
readKeys();
@@ -1024,13 +1026,8 @@ bool TwinEEngine::gameEngineLoop() {
_movements->setActorAngle(ANGLE_0, -ANGLE_90, ANGLE_1, &_loopMovePtr);
while (_quitGame == -1) {
- uint32 start = g_system->getMillis();
-
- while (g_system->getMillis() < start + _cfgfile.Fps) {
- if (runGameEngine()) {
- return true;
- }
- g_system->delayMillis(1);
+ if (runGameEngine()) {
+ return true;
}
_lbaTime++;
if (shouldQuit()) {
More information about the Scummvm-git-logs
mailing list