[Scummvm-git-logs] scummvm master -> bd3e34983e00ee11d7093ec4ea9203d2998594d1
mgerhardy
martin.gerhardy at gmail.com
Sun Aug 15 22:27:33 UTC 2021
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
00cd369376 TWINE: fixed typo and simplified code
39823a94c7 TWINE: removed todo comment
1b749d2808 TWINE: removed todo comment about magic ball damage
738e211142 TWINE: cleanup comments
bd3e34983e TWINE: fixed life script parsing
Commit: 00cd36937645c2b080a891be6db1d22f2b07ec69
https://github.com/scummvm/scummvm/commit/00cd36937645c2b080a891be6db1d22f2b07ec69
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T00:15:01+02:00
Commit Message:
TWINE: fixed typo and simplified code
Changed paths:
engines/twine/scene/collision.cpp
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 7ec14d4750..414e7f60b3 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -251,7 +251,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
for (int32 a = 0; a < _engine->_scene->_sceneNumActors; a++) {
ActorStruct *actorTest = _engine->_scene->getActor(a);
- // aviod current processed actor
+ // avoid current processed actor
if (a != actorIdx && actorTest->_entity != -1 && !actor->_staticFlags.bComputeLowCollision && actorTest->_standOn != actorIdx) {
const IVec3 &minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
const IVec3 &maxsTest = actorTest->pos() + actorTest->_boudingBox.maxs;
@@ -278,19 +278,18 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
if (actor->_dynamicFlags.bIsHitting) {
const IVec3 &destPos = _engine->_movements->rotateActor(0, 200, actor->_angle);
+ mins = processActor + actor->_boudingBox.mins;
+ mins.x += destPos.x;
+ mins.z += destPos.z;
- mins.x = destPos.x + processActor.x + actor->_boudingBox.mins.x;
- mins.y = processActor.y + actor->_boudingBox.mins.y;
- mins.z = destPos.z + processActor.z + actor->_boudingBox.mins.z;
-
- maxs.x = destPos.x + processActor.x + actor->_boudingBox.maxs.x;
- maxs.y = processActor.y + actor->_boudingBox.maxs.y;
- maxs.z = destPos.z + processActor.z + actor->_boudingBox.maxs.z;
+ maxs = processActor + actor->_boudingBox.maxs;
+ maxs.x += destPos.x;
+ maxs.z += destPos.z;
for (int32 a = 0; a < _engine->_scene->_sceneNumActors; a++) {
const ActorStruct *actorTest = _engine->_scene->getActor(a);
- // aviod current processed actor
+ // avoid current processed actor
if (a != actorIdx && actorTest->_entity != -1 && !actorTest->_staticFlags.bIsHidden && actorTest->_standOn != actorIdx) {
const IVec3 minsTest = actorTest->pos() + actorTest->_boudingBox.mins;
const IVec3 maxsTest = actorTest->pos() + actorTest->_boudingBox.maxs;
Commit: 39823a94c791146e7d3665271fed075ab21563bd
https://github.com/scummvm/scummvm/commit/39823a94c791146e7d3665271fed075ab21563bd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T00:15:01+02:00
Commit Message:
TWINE: removed todo comment
Changed paths:
engines/twine/scene/collision.cpp
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 414e7f60b3..c7b42b6ca0 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -313,7 +313,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) {
+ if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= 0x7E00 && processActor.z <= 0x7E00) { // SCENE_SIZE_MAX
const BoundingBox &bbox = _engine->_actor->_processActorPtr->_boudingBox;
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShapeFull(processActor, bbox.maxs.y);
@@ -346,7 +346,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) {
+ if (processActor.x >= 0 && processActor.z >= 0 && processActor.x <= 0x7E00 && processActor.z <= 0x7E00) { // SCENE_SIZE_MAX
reajustActorPosition(brickShape);
brickShape = _engine->_grid->getBrickShape(processActor);
@@ -455,7 +455,6 @@ int32 Collision::checkExtraCollisionWithExtra(ExtraListStruct *extra, int32 extr
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
const ExtraListStruct *extraTest = &_engine->_extra->_extraList[i];
if (i != extraIdx && extraTest->info0 != -1) {
- // TODO: shouldn't this be extraTest->info0 as index?
const BoundingBox *testbbox = _engine->_resources->_spriteBoundingBox.bbox(++index);
const IVec3 minsTest = testbbox->mins + extraTest->pos;
const IVec3 maxsTest = testbbox->maxs + extraTest->pos;
Commit: 1b749d280869a6db45d713a77190e7575bf0ef44
https://github.com/scummvm/scummvm/commit/1b749d280869a6db45d713a77190e7575bf0ef44
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T00:15:01+02:00
Commit Message:
TWINE: removed todo comment about magic ball damage
verified the usage and the values against the disassembly of lbawin
Changed paths:
engines/twine/scene/extra.cpp
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index bd3e1fde4b..2345e5e5e0 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -344,7 +344,6 @@ void Extra::addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int3
int32 ballStrength = 0;
int32 extraIdx = -1;
- // TODO: check against MagicballStrengthType
switch (_engine->_gameState->_magicLevelIdx) {
case 0:
case 1:
Commit: 738e2111426bf1b5d9746e137234cc9eb3aa5e90
https://github.com/scummvm/scummvm/commit/738e2111426bf1b5d9746e137234cc9eb3aa5e90
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T00:22:43+02:00
Commit Message:
TWINE: cleanup comments
Changed paths:
engines/twine/scene/extra.cpp
engines/twine/scene/grid.h
engines/twine/script/script_life_v1.h
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 2345e5e5e0..1b1019f75a 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -131,7 +131,7 @@ void Extra::resetExtras() {
}
}
-void Extra::throwExtra(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle) { // InitFly
+void Extra::throwExtra(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle) {
extra->type |= ExtraType::FLY;
extra->lastPos = extra->pos;
@@ -149,7 +149,7 @@ void Extra::throwExtra(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32
extra->spawnTime = _engine->_lbaTime;
}
-int32 Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) { // InitSpecial
+int32 Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) {
const int16 flag = EXTRA_SPECIAL_MASK + (int16)type;
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
@@ -167,7 +167,6 @@ int32 Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) {
extra->pos.y = y;
extra->pos.z = z;
- // same as InitFly
throwExtra(extra, _engine->getRandomNumber(ANGLE_90) + ANGLE_45, _engine->getRandomNumber(ANGLE_360), 50, 20);
extra->strengthOfHit = 0;
@@ -223,7 +222,7 @@ int Extra::getBonusSprite(BonusParameter bonusParameter) const {
return bonusSprite;
}
-int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle, int32 type, int32 bonusAmount) { // ExtraBonus
+int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle, int32 type, int32 bonusAmount) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
if (extra->info0 != -1) {
@@ -240,7 +239,6 @@ int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle
extra->pos.y = y;
extra->pos.z = z;
- // same as InitFly
throwExtra(extra, xAngle, yAngle, 40, ToAngle(15));
extra->strengthOfHit = 0;
@@ -252,7 +250,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) { // ThrowExtra
+int32 Extra::addExtraThrow(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->info0 != -1) {
@@ -264,7 +262,6 @@ int32 Extra::addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spri
extra->pos.y = y;
extra->pos.z = z;
- // same as InitFly
throwExtra(extra, xAngle, yAngle, xRotPoint, extraAngle);
extra->strengthOfHit = strengthOfHit;
@@ -278,7 +275,7 @@ int32 Extra::addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spri
return -1;
}
-int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActorIdx, int32 finalAngle, int32 strengthOfHit) { // ExtraSearch
+int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActorIdx, int32 finalAngle, int32 strengthOfHit) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
if (extra->info0 != -1) {
@@ -406,7 +403,7 @@ void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int
++shapeDataIndex;
- renderRect.left = 0x7D00;
+ renderRect.left = 0x7D00; // SCENE_SIZE_MAX
renderRect.right = -0x7D00;
renderRect.top = 0x7D00;
renderRect.bottom = -0x7D00;
@@ -650,7 +647,6 @@ void Extra::processExtras() {
}
// process magic ball extra aiming for key
if (extra->type & ExtraType::MAGIC_BALL_KEY) {
- // int32 actorIdxAttacked = extra->lifeTime;
ExtraListStruct *extraKey = &_extraList[extra->payload.extraIdx];
const int32 extraIdx = extra->payload.extraIdx;
@@ -768,7 +764,7 @@ void Extra::processExtras() {
if (i == _engine->_gameState->_magicBallIdx) {
_engine->_sound->playSample(Samples::Hit, 1, extra->pos);
- // cant bounce with not magic points
+ // can't bounce with not magic points
if (_engine->_gameState->_magicBallNumBounce <= 0) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index 1250c767b8..fbb632d20a 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -75,9 +75,11 @@ struct BrickEntry {
#define BRICK_SIZE 512
#define BRICK_HEIGHT 256
-// short max
+// short max 32767 0x7FFF
+// 32256 0x7E00
+// 32000 0x7D00
#define SCENE_SIZE_MAX (BRICK_SIZE * GRID_SIZE_X - 1)
-// short min
+// short min -32768
#define SCENE_SIZE_MIN (-BRICK_SIZE * GRID_SIZE_X)
#define SCENE_SIZE_HALF (BRICK_SIZE * GRID_SIZE_X / 2)
#define SCENE_SIZE_HALFF (BRICK_SIZE * GRID_SIZE_X / 2.0f)
diff --git a/engines/twine/script/script_life_v1.h b/engines/twine/script/script_life_v1.h
index 58b86a6d52..2c77c9c00c 100644
--- a/engines/twine/script/script_life_v1.h
+++ b/engines/twine/script/script_life_v1.h
@@ -27,6 +27,7 @@
namespace TwinE {
+// SCENE_SIZE_MAX
#define MAX_TARGET_ACTOR_DISTANCE 0x7D00
class TwinEEngine;
Commit: bd3e34983e00ee11d7093ec4ea9203d2998594d1
https://github.com/scummvm/scummvm/commit/bd3e34983e00ee11d7093ec4ea9203d2998594d1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T00:27:00+02:00
Commit Message:
TWINE: fixed life script parsing
Changed paths:
engines/twine/script/script_life_v1.cpp
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 4be5156425..e941f6ed2a 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -475,7 +475,7 @@ static int32 lOFFSET(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x04
*/
static int32 lNEVERIF(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 valueSize = processLifeConditions(engine, ctx);
+ const int32 valueSize = processLifeConditions(engine, ctx);
processLifeOperators(engine, ctx, valueSize);
ctx.stream.seek(ctx.stream.readSint16LE()); // condition offset
return 0;
@@ -511,7 +511,7 @@ static int32 lRETURN(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x0C
*/
static int32 lIF(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 valueSize = processLifeConditions(engine, ctx);
+ const int32 valueSize = processLifeConditions(engine, ctx);
if (!processLifeOperators(engine, ctx, valueSize)) {
ctx.stream.seek(ctx.stream.readSint16LE()); // condition offset
} else {
@@ -526,7 +526,7 @@ static int32 lIF(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x0D
*/
static int32 lSWIF(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 valueSize = processLifeConditions(engine, ctx);
+ const int32 valueSize = processLifeConditions(engine, ctx);
if (!processLifeOperators(engine, ctx, valueSize)) {
ctx.stream.seek(ctx.stream.readSint16LE()); // condition offset
} else {
@@ -542,7 +542,7 @@ static int32 lSWIF(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x0E
*/
static int32 lONEIF(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 valueSize = processLifeConditions(engine, ctx);
+ const int32 valueSize = processLifeConditions(engine, ctx);
if (!processLifeOperators(engine, ctx, valueSize)) {
ctx.stream.seek(ctx.stream.readSint16LE()); // condition offset
} else {
@@ -567,7 +567,7 @@ static int32 lELSE(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x11
*/
static int32 lBODY(TwinEEngine *engine, LifeScriptContext &ctx) {
- BodyType bodyIdx = (BodyType)ctx.stream.readByte();
+ const BodyType bodyIdx = (BodyType)ctx.stream.readByte();
engine->_actor->initModelActor(bodyIdx, ctx.actorIdx);
return 0;
}
@@ -577,8 +577,8 @@ static int32 lBODY(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x12
*/
static int32 lBODY_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
- BodyType otherBodyIdx = (BodyType)ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
+ const BodyType otherBodyIdx = (BodyType)ctx.stream.readByte();
engine->_actor->initModelActor(otherBodyIdx, otherActorIdx);
return 0;
}
@@ -588,7 +588,7 @@ static int32 lBODY_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x13
*/
static int32 lANIM(TwinEEngine *engine, LifeScriptContext &ctx) {
- AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
+ const AnimationTypes animIdx = (AnimationTypes)ctx.stream.readByte();
engine->_animations->initAnim(animIdx, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, ctx.actorIdx);
return 0;
}
@@ -598,8 +598,8 @@ static int32 lANIM(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x14
*/
static int32 lANIM_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
- AnimationTypes otherAnimIdx = (AnimationTypes)ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
+ const AnimationTypes otherAnimIdx = (AnimationTypes)ctx.stream.readByte();
engine->_animations->initAnim(otherAnimIdx, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, otherActorIdx);
return 0;
}
@@ -618,7 +618,7 @@ static int32 lSET_LIFE(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x16
*/
static int32 lSET_LIFE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
engine->_scene->getActor(otherActorIdx)->_positionInLifeScript = ctx.stream.readSint16LE(); // offset
return 0;
}
@@ -637,7 +637,7 @@ static int32 lSET_TRACK(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x18
*/
static int32 lSET_TRACK_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
engine->_scene->getActor(otherActorIdx)->_positionInMoveScript = ctx.stream.readSint16LE(); // offset
return 0;
}
@@ -844,9 +844,9 @@ static int32 lUSE_ONE_LITTLE_KEY(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x28
*/
static int32 lGIVE_GOLD_PIECES(TwinEEngine *engine, LifeScriptContext &ctx) {
- int16 oldNumKashes = engine->_gameState->_inventoryNumKashes;
+ const int16 oldNumKashes = engine->_gameState->_inventoryNumKashes;
bool hideRange = false;
- int16 kashes = ctx.stream.readSint16LE();
+ const int16 kashes = ctx.stream.readSint16LE();
engine->_gameState->addKashes(-kashes);
@@ -945,7 +945,7 @@ static int32 lFOUND_OBJECT(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x2F
*/
static int32 lSET_DOOR_LEFT(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 distance = ctx.stream.readSint16LE();
+ const int32 distance = ctx.stream.readSint16LE();
ctx.actor->_angle = ANGLE_270;
ctx.actor->_pos.x = ctx.actor->_lastPos.x - distance;
@@ -960,7 +960,7 @@ static int32 lSET_DOOR_LEFT(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x30
*/
static int32 lSET_DOOR_RIGHT(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 distance = ctx.stream.readSint16LE();
+ const int32 distance = ctx.stream.readSint16LE();
ctx.actor->_angle = ANGLE_90;
ctx.actor->_pos.x = ctx.actor->_lastPos.x + distance;
@@ -975,7 +975,7 @@ static int32 lSET_DOOR_RIGHT(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x31
*/
static int32 lSET_DOOR_UP(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 distance = ctx.stream.readSint16LE();
+ const int32 distance = ctx.stream.readSint16LE();
ctx.actor->_angle = ANGLE_180;
ctx.actor->_pos.z = ctx.actor->_lastPos.z - distance;
@@ -990,7 +990,7 @@ static int32 lSET_DOOR_UP(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x32
*/
static int32 lSET_DOOR_DOWN(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 distance = ctx.stream.readSint16LE();
+ const int32 distance = ctx.stream.readSint16LE();
ctx.actor->_angle = ANGLE_0;
ctx.actor->_pos.z = ctx.actor->_lastPos.z + distance;
@@ -1005,7 +1005,7 @@ static int32 lSET_DOOR_DOWN(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x33
*/
static int32 lGIVE_BONUS(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 flag = ctx.stream.readByte();
+ const int32 flag = ctx.stream.readByte();
if (ctx.actor->_bonusParameter.cloverleaf || ctx.actor->_bonusParameter.kashes || ctx.actor->_bonusParameter.key || ctx.actor->_bonusParameter.lifepoints || ctx.actor->_bonusParameter.magicpoints) {
engine->_actor->processActorExtraBonus(ctx.actorIdx);
@@ -1023,7 +1023,7 @@ static int32 lGIVE_BONUS(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x34
*/
static int32 lCHANGE_CUBE(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 sceneIdx = ctx.stream.readByte();
+ const int32 sceneIdx = ctx.stream.readByte();
engine->_scene->_needChangeScene = sceneIdx;
engine->_scene->_heroPositionType = ScenePositionType::kScene;
return 0;
@@ -1034,7 +1034,7 @@ static int32 lCHANGE_CUBE(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x35
*/
static int32 lOBJ_COL(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 collision = ctx.stream.readByte();
+ const int32 collision = ctx.stream.readByte();
if (collision != 0) {
ctx.actor->_staticFlags.bComputeCollisionWithObj = 1;
} else {
@@ -1048,7 +1048,7 @@ static int32 lOBJ_COL(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x36
*/
static int32 lBRICK_COL(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 collision = ctx.stream.readByte();
+ const int32 collision = ctx.stream.readByte();
ctx.actor->_staticFlags.bComputeCollisionWithBricks = 0;
ctx.actor->_staticFlags.bComputeLowCollision = 0;
@@ -1067,7 +1067,7 @@ static int32 lBRICK_COL(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x37
*/
static int32 lOR_IF(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 valueSize = processLifeConditions(engine, ctx);
+ const int32 valueSize = processLifeConditions(engine, ctx);
if (processLifeOperators(engine, ctx, valueSize)) {
ctx.stream.seek(ctx.stream.readSint16LE()); // condition offset
} else {
@@ -1091,7 +1091,7 @@ static int32 lINVISIBLE(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x39
*/
static int32 lZOOM(TwinEEngine *engine, LifeScriptContext &ctx) {
- int zoomScreen = ctx.stream.readByte();
+ const int zoomScreen = ctx.stream.readByte();
if (zoomScreen && !engine->_redraw->_inSceneryView && engine->_cfgfile.SceZoom) {
engine->_screens->fadeToBlack(engine->_screens->_mainPaletteRGBA);
@@ -1143,8 +1143,8 @@ static int32 lSUB_MAGIC_POINT(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x3D
*/
static int32 lSET_LIFE_POINT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
- static int32 lifeValue = ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
+ const int32 lifeValue = ctx.stream.readByte();
engine->_scene->getActor(otherActorIdx)->setLife(lifeValue);
@@ -1156,8 +1156,8 @@ static int32 lSET_LIFE_POINT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x3E
*/
static int32 lSUB_LIFE_POINT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
- static int32 lifeValue = ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
+ const int32 lifeValue = ctx.stream.readByte();
ActorStruct *otherActor = engine->_scene->getActor(otherActorIdx);
otherActor->addLife(-lifeValue);
@@ -1173,8 +1173,8 @@ static int32 lSUB_LIFE_POINT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x3F
*/
static int32 lHIT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
- int32 strengthOfHit = ctx.stream.readByte();
+ const int32 otherActorIdx = ctx.stream.readByte();
+ const int32 strengthOfHit = ctx.stream.readByte();
engine->_actor->hitActor(ctx.actorIdx, otherActorIdx, strengthOfHit, engine->_scene->getActor(otherActorIdx)->_angle);
return 0;
}
@@ -1352,7 +1352,7 @@ static int32 lSET_GRM(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x4D
*/
static int32 lSAY_MESSAGE(TwinEEngine *engine, LifeScriptContext &ctx) {
- TextId textEntry = (TextId)ctx.stream.readSint16LE();
+ const TextId textEntry = (TextId)ctx.stream.readSint16LE();
engine->_redraw->addOverlay(OverlayType::koText, (int16)textEntry, 0, 0, ctx.actorIdx, OverlayPosType::koFollowActor, 2);
@@ -1367,8 +1367,8 @@ static int32 lSAY_MESSAGE(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x4E
*/
static int32 lSAY_MESSAGE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 otherActorIdx = ctx.stream.readByte();
- TextId textEntry = (TextId)ctx.stream.readSint16LE();
+ const int32 otherActorIdx = ctx.stream.readByte();
+ const TextId textEntry = (TextId)ctx.stream.readSint16LE();
engine->_redraw->addOverlay(OverlayType::koText, (int16)textEntry, 0, 0, otherActorIdx, OverlayPosType::koFollowActor, 2);
@@ -1393,7 +1393,7 @@ static int32 lFULL_POINT(TwinEEngine *engine, LifeScriptContext &ctx) {
* @note Opcode @c 0x50
*/
static int32 lBETA(TwinEEngine *engine, LifeScriptContext &ctx) {
- int32 newAngle = ctx.stream.readSint16LE();
+ const int32 newAngle = ctx.stream.readSint16LE();
ctx.actor->_angle = ToAngle(newAngle);
engine->_movements->clearRealAngle(ctx.actor);
return 0;
More information about the Scummvm-git-logs
mailing list