[Scummvm-git-logs] scummvm master -> ee812fc49757f143110062a4cd4b75ce33dad1ac
mgerhardy
noreply at scummvm.org
Tue May 30 20:11:55 UTC 2023
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:
dc19459c1c TWINE: renamed variables and changed game flag array size
70b794cbb9 TWINE: split assignments
b29f0a0ef9 TWINE: implemented missing function copyInterAnim
04a56d78e9 TWINE: unified names with original source release
ee812fc497 TWINE: the initial position of an actor is set to SIZE_BRICK_Y
Commit: dc19459c1c3e4b0668e0f1212ce71daaff16cd69
https://github.com/scummvm/scummvm/commit/dc19459c1c3e4b0668e0f1212ce71daaff16cd69
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-05-30T20:45:18+02:00
Commit Message:
TWINE: renamed variables and changed game flag array size
Changed paths:
engines/twine/scene/gamestate.cpp
engines/twine/scene/gamestate.h
engines/twine/scene/scene.cpp
engines/twine/scene/scene.h
engines/twine/script/script_life.cpp
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 2b84d624768..f8fed4abff7 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -72,8 +72,8 @@ void GameState::initGameStateVars() {
_engine->_redraw->overlayList[i].info0 = -1;
}
- for (int32 i = 0; i < ARRAYSIZE(_engine->_scene->_sceneFlags); i++) {
- _engine->_scene->_sceneFlags[i] = 0;
+ for (int32 i = 0; i < ARRAYSIZE(_engine->_scene->_listFlagCube); i++) {
+ _engine->_scene->_listFlagCube[i] = 0;
}
clearGameFlags();
@@ -293,21 +293,21 @@ int16 GameState::getChapter() const {
if (_engine->isLBA1()) {
return _gameChapter;
}
- return _gameStateFlags[253];
+ return _listFlagGame[253];
}
void GameState::setGameFlag(uint8 index, uint8 value) {
- if (_gameStateFlags[index] == value) {
+ if (_listFlagGame[index] == value) {
return;
}
debug(2, "Set gameStateFlags[%u]=%u", index, value);
- _gameStateFlags[index] = value;
+ _listFlagGame[index] = value;
if (!value) {
return;
}
if ((index == GAMEFLAG_VIDEO_BAFFE || index == GAMEFLAG_VIDEO_BAFFE2 || index == GAMEFLAG_VIDEO_BAFFE3 || index == GAMEFLAG_VIDEO_BAFFE5) &&
- _gameStateFlags[GAMEFLAG_VIDEO_BAFFE] != 0 && _gameStateFlags[GAMEFLAG_VIDEO_BAFFE2] != 0 && _gameStateFlags[GAMEFLAG_VIDEO_BAFFE3] != 0 && _gameStateFlags[GAMEFLAG_VIDEO_BAFFE5] != 0) {
+ _listFlagGame[GAMEFLAG_VIDEO_BAFFE] != 0 && _listFlagGame[GAMEFLAG_VIDEO_BAFFE2] != 0 && _listFlagGame[GAMEFLAG_VIDEO_BAFFE3] != 0 && _listFlagGame[GAMEFLAG_VIDEO_BAFFE5] != 0) {
// all 4 slap videos
_engine->unlockAchievement("LBA_ACH_012");
} else if (index == GAMEFLAG_VIDEO_BATEAU2) {
@@ -659,12 +659,12 @@ void GameState::addLeafBoxes(int16 val) {
void GameState::clearGameFlags() {
debug(2, "Clear all gameStateFlags");
- Common::fill(&_gameStateFlags[0], &_gameStateFlags[NUM_GAME_FLAGS], 0);
+ Common::fill(&_listFlagGame[0], &_listFlagGame[NUM_GAME_FLAGS], 0);
}
uint8 GameState::hasGameFlag(uint8 index) const {
- debug(6, "Query gameStateFlags[%u]=%u", index, _gameStateFlags[index]);
- return _gameStateFlags[index];
+ debug(6, "Query gameStateFlags[%u]=%u", index, _listFlagGame[index]);
+ return _listFlagGame[index];
}
} // namespace TwinE
diff --git a/engines/twine/scene/gamestate.h b/engines/twine/scene/gamestate.h
index edd0adf21e5..2f7c21eeed9 100644
--- a/engines/twine/scene/gamestate.h
+++ b/engines/twine/scene/gamestate.h
@@ -68,8 +68,7 @@ private:
* 107: Set to 1 after Twinsen kills yellow groboclone in the Citadel Island Tavern (after the Tavern has
* been closed down). Makes the Tavern open again and groboclone not appear any more.
*/
- // TODO: why not NUM_GAME_FLAGS?
- uint8 _gameStateFlags[256]; // ListVarGame
+ uint8 _listFlagGame[NUM_GAME_FLAGS];
// only lba1 - lba2 uses 253 gameflag
int16 _gameChapter = 0;
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 3128041c78c..d66d9054892 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -452,8 +452,8 @@ bool Scene::initScene(int32 index) {
void Scene::resetScene() {
_engine->_extra->resetExtras();
- for (int32 i = 0; i < ARRAYSIZE(_sceneFlags); i++) {
- _sceneFlags[i] = 0;
+ for (int32 i = 0; i < ARRAYSIZE(_listFlagCube); i++) {
+ _listFlagCube[i] = 0;
}
for (int32 i = 0; i < OVERLAY_MAX_ENTRIES; i++) {
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index 378d487ae84..d77b97ef7d7 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -198,7 +198,7 @@ public:
bool _enableGridTileRendering = true;
- uint8 _sceneFlags[NUM_SCENES_FLAGS]{0};
+ uint8 _listFlagCube[NUM_SCENES_FLAGS]{0};
int32 _sceneNumZones = 0;
ZoneStruct _sceneZones[NUM_MAX_ZONES];
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index fbfb7d7765c..2a058b1b5c0 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -206,7 +206,7 @@ static ReturnType processLifeConditions(TwinEEngine *engine, LifeScriptContext &
int32 flagIdx = ctx.stream.readByte();
debugCN(3, kDebugLevels::kDebugScripts, "flag_cube(%i, ", flagIdx);
conditionValueSize = ReturnType::RET_U8;
- engine->_scene->_currentScriptValue = engine->_scene->_sceneFlags[flagIdx];
+ engine->_scene->_currentScriptValue = engine->_scene->_listFlagCube[flagIdx];
break;
}
case kcCONE_VIEW: {
@@ -1020,7 +1020,7 @@ int32 ScriptLife::lSET_FLAG_CUBE(TwinEEngine *engine, LifeScriptContext &ctx) {
const int32 flagValue = ctx.stream.readByte();
debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_FLAG_CUBE(%i, %i)", (int)flagIdx, (int)flagValue);
- engine->_scene->_sceneFlags[flagIdx] = flagValue;
+ engine->_scene->_listFlagCube[flagIdx] = flagValue;
return 0;
}
Commit: 70b794cbb93f357aa28684727fa0504465c0a227
https://github.com/scummvm/scummvm/commit/70b794cbb93f357aa28684727fa0504465c0a227
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-05-30T21:13:57+02:00
Commit Message:
TWINE: split assignments
Changed paths:
engines/twine/scene/animations.cpp
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 61434f551f8..e243a86c19a 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -653,7 +653,8 @@ void Animations::doAnim(int32 actorIdx) {
if (col != ShapeType::kNone) {
if (col == ShapeType::kSolid) {
- actor->_pos.y = processActor.y = (processActor.y / SIZE_BRICK_Y) * SIZE_BRICK_Y + SIZE_BRICK_Y; // go upper
+ processActor.y = (processActor.y / SIZE_BRICK_Y) * SIZE_BRICK_Y + SIZE_BRICK_Y; // go upper
+ actor->_pos.y = processActor.y;
} else {
collision->reajustPos(processActor, col);
}
Commit: b29f0a0ef927d0f6b0c6b6375d0cbbfc0ae311b0
https://github.com/scummvm/scummvm/commit/b29f0a0ef927d0f6b0c6b6375d0cbbfc0ae311b0
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-05-30T21:55:32+02:00
Commit Message:
TWINE: implemented missing function copyInterAnim
Changed paths:
engines/twine/parser/body.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
diff --git a/engines/twine/parser/body.cpp b/engines/twine/parser/body.cpp
index e5487a42b71..f6400e73fa4 100644
--- a/engines/twine/parser/body.cpp
+++ b/engines/twine/parser/body.cpp
@@ -186,10 +186,10 @@ bool BodyData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
bbox.maxs.y = stream.readSint16LE();
bbox.mins.z = stream.readSint16LE();
bbox.maxs.z = stream.readSint16LE();
+ offsetToData = stream.readSint16LE();
// using this value as the offset crashes the demo of lba1 - see https://bugs.scummvm.org/ticket/14294
- // const uint16 offset = stream.readUint16LE();
- // stream.skip(offset);
+ // stream.seek(offsetToData);
stream.seek(0x1A);
loadVertices(stream);
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 365da6c1bb4..c5541e7424b 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -189,6 +189,7 @@ void Actor::initBody(BodyType bodyIdx, int16 actorIdx) {
return;
}
+ const int32 oldBody = localActor->_body;
localActor->_body = newBody;
localActor->_genBody = bodyIdx;
@@ -217,11 +218,22 @@ void Actor::initBody(BodyType bodyIdx, int16 actorIdx) {
localActor->_boundingBox.mins.z = -size;
localActor->_boundingBox.maxs.z = size;
}
-#if 0
- if (oldbody != -1 && localActor->_anim != -1) {
- copyInterAnim(_engine->_resources->_bodyData[oldbody], _engine->_resources->_bodyData[localActor->_body]);
+ if (oldBody != -1 && localActor->_anim != -1) {
+ copyInterAnim(_engine->_resources->_bodyData[oldBody], _engine->_resources->_bodyData[localActor->_body]);
+ }
+}
+
+void Actor::copyInterAnim(const BodyData &src, BodyData &dest) {
+ if (!src.isAnimated() || !dest.isAnimated()) {
+ return;
+ }
+
+ const int16 numBones = MIN<int16>((int16)src.getNumBones(), (int16)dest.getNumBones());
+ for (int16 i = 0; i < numBones; ++i) {
+ const BoneFrame *srcBoneFrame = src.getBoneState(i);
+ BoneFrame *destBoneFrame = dest.getBoneState(i);
+ *destBoneFrame = *srcBoneFrame;
}
-#endif
}
void Actor::initActor(int16 actorIdx) {
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 3bca345b7fc..660bdd6d07d 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -24,6 +24,7 @@
#include "common/scummsys.h"
#include "twine/parser/anim.h"
+#include "twine/parser/body.h"
#include "twine/parser/entity.h"
#include "twine/shared.h"
@@ -139,6 +140,7 @@ private:
bool _brickCausesDamage = false;
EntityData _entityData;
+
public:
StaticFlagsStruct _staticFlags;
DynamicFlagsStruct _dynamicFlags;
@@ -272,6 +274,8 @@ private:
void loadBehaviourEntity(ActorStruct *actor, EntityData &entityData, int16 &bodyAnimIndex, int32 index);
+ void copyInterAnim(const BodyData &src, BodyData &dest);
+
public:
Actor(TwinEEngine *engine);
Commit: 04a56d78e947d850bdd98185a334ecf9c96f4210
https://github.com/scummvm/scummvm/commit/04a56d78e947d850bdd98185a334ecf9c96f4210
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-05-30T22:04:23+02:00
Commit Message:
TWINE: unified names with original source release
Changed paths:
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
engines/twine/scene/gamestate.cpp
engines/twine/scene/scene.cpp
engines/twine/script/script_life.cpp
engines/twine/twine.cpp
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index c5541e7424b..64699cb19fa 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -60,7 +60,7 @@ void Actor::restartHeroScene() {
sceneHero->_offsetTrack = -1;
sceneHero->_labelIdx = -1;
sceneHero->_offsetLife = 0;
- sceneHero->_zone = -1;
+ sceneHero->_zoneSce = -1;
sceneHero->_beta = _previousHeroAngle;
_engine->_movements->initRealAngle(sceneHero->_beta, sceneHero->_beta, LBAAngles::ANGLE_0, &sceneHero->realAngle);
@@ -274,8 +274,7 @@ void Actor::initActor(int16 actorIdx) {
actor->_offsetLife = 0;
}
-// InitObject
-void Actor::resetActor(int16 actorIdx) {
+void Actor::initObject(int16 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
*actor = ActorStruct();
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 660bdd6d07d..e82360cfc16 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -179,13 +179,13 @@ public:
int32 _hitBy = -1;
BonusParameter _bonusParameter;
int32 _beta = 0; // facing angle of actor. Minumum is 0 (SW). Going counter clock wise (BETA in original sources)
- int32 _speed = 40; // speed of movement
+ int32 _speed = 40; // SRot - speed of movement
ControlMode _controlMode = ControlMode::kNoMove;
int32 _delayInMillis = 0;
- int32 _cropLeft = 0;
- int32 _cropTop = 0;
- int32 _cropRight = 0;
- int32 _cropBottom = 0;
+ int32 _cropLeft = 0; // Info
+ int32 _cropTop = 0; // Info1
+ int32 _cropRight = 0; // Info2
+ int32 _cropBottom = 0; // Info3
int32 _followedActor = 0; // same as info3
int32 _bonusAmount = 0;
int32 _talkColor = COLOR_BLACK;
@@ -217,7 +217,7 @@ public:
* actor id we are standing on
*/
int32 _carryBy = -1;
- int32 _zone = -1;
+ int32 _zoneSce = -1;
int32 _animStepBeta = 0;
IVec3 _animStep;
@@ -337,7 +337,7 @@ public:
* Reset actor
* @param actorIdx actor index to init
*/
- void resetActor(int16 actorIdx);
+ void initObject(int16 actorIdx);
/**
* Process hit actor
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index f8fed4abff7..a2c824b7416 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -85,7 +85,7 @@ void GameState::initGameStateVars() {
}
void GameState::initHeroVars() {
- _engine->_actor->resetActor(OWN_ACTOR_SCENE_INDEX); // reset Hero
+ _engine->_actor->initObject(OWN_ACTOR_SCENE_INDEX); // reset Hero
_magicBall = -1;
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index d66d9054892..b1246b6d269 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -194,7 +194,7 @@ bool Scene::loadSceneLBA2() {
_nbObjets = (int16)stream.readUint16LE();
int cnt = 1;
for (int32 a = 1; a < _nbObjets; a++, cnt++) {
- _engine->_actor->resetActor(a);
+ _engine->_actor->initObject(a);
ActorStruct *act = &_sceneActors[a];
setActorStaticFlags(act, stream.readUint32LE());
@@ -325,7 +325,7 @@ bool Scene::loadSceneLBA1() {
_nbObjets = (int16)stream.readUint16LE();
int cnt = 1;
for (int32 a = 1; a < _nbObjets; a++, cnt++) {
- _engine->_actor->resetActor(a);
+ _engine->_actor->initObject(a);
ActorStruct *act = &_sceneActors[a];
setActorStaticFlags(act, stream.readUint16LE());
@@ -540,7 +540,7 @@ void Scene::changeScene() {
_engine->_actor->loadHeroEntities();
_sceneHero->_controlMode = ControlMode::kManual;
- _sceneHero->_zone = -1;
+ _sceneHero->_zoneSce = -1;
_sceneHero->_offsetLife = 0;
_sceneHero->_offsetTrack = -1;
_sceneHero->_labelIdx = -1;
@@ -708,7 +708,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
int32 currentY = actor->_pos.y;
int32 currentZ = actor->_pos.z;
- actor->_zone = -1;
+ actor->_zoneSce = -1;
bool tmpCellingGrid = false;
if (IS_HERO(actorIdx)) {
@@ -746,7 +746,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
}
break;
case ZoneType::kSceneric:
- actor->_zone = zone->num;
+ actor->_zoneSce = zone->num;
break;
case ZoneType::kGrid:
if (_currentlyFollowedActor == actorIdx) {
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index 2a058b1b5c0..2e79d6fa839 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -163,12 +163,12 @@ static ReturnType processLifeConditions(TwinEEngine *engine, LifeScriptContext &
}
case kcZONE:
debugCN(3, kDebugLevels::kDebugScripts, "zone(");
- engine->_scene->_currentScriptValue = ctx.actor->_zone;
+ engine->_scene->_currentScriptValue = ctx.actor->_zoneSce;
break;
case kcZONE_OBJ: {
int32 actorIdx = ctx.stream.readByte();
debugCN(3, kDebugLevels::kDebugScripts, "zone_obj(%i, ", actorIdx);
- engine->_scene->_currentScriptValue = engine->_scene->getActor(actorIdx)->_zone;
+ engine->_scene->_currentScriptValue = engine->_scene->getActor(actorIdx)->_zoneSce;
break;
}
case kcBODY:
@@ -1091,7 +1091,7 @@ int32 ScriptLife::lKILL_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
ActorStruct *otherActor = engine->_scene->getActor(otherActorIdx);
otherActor->_dynamicFlags.bIsDead = 1;
otherActor->_body = -1;
- otherActor->_zone = -1;
+ otherActor->_zoneSce = -1;
otherActor->setLife(0);
return 0;
@@ -1106,7 +1106,7 @@ int32 ScriptLife::lSUICIDE(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_actor->processActorCarrier(ctx.actorIdx);
ctx.actor->_dynamicFlags.bIsDead = 1;
ctx.actor->_body = -1;
- ctx.actor->_zone = -1;
+ ctx.actor->_zoneSce = -1;
ctx.actor->setLife(0);
return 0;
@@ -1617,7 +1617,7 @@ int32 ScriptLife::lINIT_PINGOUIN(TwinEEngine *engine, LifeScriptContext &ctx) {
ActorStruct *penguin = engine->_scene->getActor(penguinActor);
penguin->_dynamicFlags.bIsDead = 1;
penguin->_body = -1;
- penguin->_zone = -1;
+ penguin->_zoneSce = -1;
return 0;
}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 4fbb5a26013..5809cbcedb6 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1088,7 +1088,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_actor->processActorCarrier(a);
actor->_dynamicFlags.bIsDead = 1;
actor->_body = -1;
- actor->_zone = -1;
+ actor->_zoneSce = -1;
}
}
Commit: ee812fc49757f143110062a4cd4b75ce33dad1ac
https://github.com/scummvm/scummvm/commit/ee812fc49757f143110062a4cd4b75ce33dad1ac
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-05-30T22:05:09+02:00
Commit Message:
TWINE: the initial position of an actor is set to SIZE_BRICK_Y
... in the original sources
Changed paths:
engines/twine/scene/actor.cpp
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 64699cb19fa..89a9180622d 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -279,7 +279,7 @@ void Actor::initObject(int16 actorIdx) {
*actor = ActorStruct();
actor->_actorIdx = actorIdx;
- actor->_pos = IVec3(0, -1, 0);
+ actor->_pos = IVec3(0, SIZE_BRICK_Y, 0);
memset(&actor->_staticFlags, 0, sizeof(StaticFlagsStruct));
memset(&actor->_dynamicFlags, 0, sizeof(DynamicFlagsStruct));
More information about the Scummvm-git-logs
mailing list