[Scummvm-git-logs] scummvm master -> cf543baa73167e0ad84c518020e896a81d0c0aa1

mgerhardy noreply at scummvm.org
Thu Oct 17 12:31:38 UTC 2024


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7b3a068296 TWINE: renamed members
15553de743 TWINE: new animation debug category
cf543baa73 TWINE: improved collision debug logging


Commit: 7b3a068296488c8742e17aa5cb7e97115be28590
    https://github.com/scummvm/scummvm/commit/7b3a068296488c8742e17aa5cb7e97115be28590
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-17T14:31:11+02:00

Commit Message:
TWINE: renamed members

Changed paths:
    engines/twine/debugger/debugtools.cpp
    engines/twine/scene/gamestate.cpp
    engines/twine/scene/grid.cpp
    engines/twine/scene/scene.cpp
    engines/twine/scene/scene.h
    engines/twine/script/script_life.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index 1ca93908783..230495c392f 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -448,11 +448,11 @@ static void sceneDetailsWindows(TwinEEngine *engine) {
 		ImGuiEx::InputInt("Currently followed actor", &scene->_numObjFollow);
 
 		ImGui::Checkbox("Enable enhancements", &scene->_enableEnhancements);
-		ImGui::Checkbox("Render grid tiles", &scene->_enableGridTileRendering);
+		ImGui::Checkbox("Render grid tiles", &scene->_flagRenderGrid);
 		ImGuiEx::InputInt("Current script value", &scene->_currentScriptValue);
 		ImGuiEx::InputInt("Talking actor", &scene->_talkingActor);
 		ImGuiEx::InputInt("Cube jingle", &scene->_cubeJingle);
-		ImGuiEx::InputIVec3("New hero pos", scene->_newHeroPos);
+		ImGuiEx::InputIVec3("New hero pos", scene->_sceneStart);
 		ImGuiEx::InputInt("Alpha light", &scene->_alphaLight);
 		ImGuiEx::InputInt("Beta light", &scene->_betaLight);
 		ImGuiEx::InputInt("Fall Y position", &scene->_startYFalling);
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 4d8a41a5e06..3e61d50a99b 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -111,9 +111,9 @@ void GameState::initEngineVars() {
 	initGameStateVars();
 	initHeroVars();
 
-	_engine->_scene->_newHeroPos.x = 16 * SIZE_BRICK_XZ;
-	_engine->_scene->_newHeroPos.y = 24 * SIZE_BRICK_Y;
-	_engine->_scene->_newHeroPos.z = 16 * SIZE_BRICK_XZ;
+	_engine->_scene->_sceneStart.x = 16 * SIZE_BRICK_XZ;
+	_engine->_scene->_sceneStart.y = 24 * SIZE_BRICK_Y;
+	_engine->_scene->_sceneStart.z = 16 * SIZE_BRICK_XZ;
 
 	_engine->_scene->_numCube = SCENE_CEILING_GRID_FADE_1;
 	_engine->_scene->_newCube = LBA1SceneId::Citadel_Island_Prison;
@@ -194,9 +194,9 @@ bool GameState::loadGame(Common::SeekableReadStream *file) {
 	_magicLevelIdx = file->readByte();
 	setMagicPoints(file->readByte());
 	setLeafBoxes(file->readByte());
-	_engine->_scene->_newHeroPos.x = file->readSint16LE();
-	_engine->_scene->_newHeroPos.y = file->readSint16LE();
-	_engine->_scene->_newHeroPos.z = file->readSint16LE();
+	_engine->_scene->_sceneStart.x = file->readSint16LE();
+	_engine->_scene->_sceneStart.y = file->readSint16LE();
+	_engine->_scene->_sceneStart.z = file->readSint16LE();
 	_engine->_scene->_sceneHero->_beta = ToAngle(file->readSint16LE());
 	_engine->_actor->_previousHeroAngle = _engine->_scene->_sceneHero->_beta;
 	_engine->_scene->_sceneHero->_genBody = (BodyType)file->readByte();
@@ -266,9 +266,9 @@ bool GameState::saveGame(Common::WriteStream *file) {
 	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
-	file->writeSint16LE(_engine->_scene->_newHeroPos.x);
-	file->writeSint16LE(_engine->_scene->_newHeroPos.y);
-	file->writeSint16LE(_engine->_scene->_newHeroPos.z);
+	file->writeSint16LE(_engine->_scene->_sceneStart.x);
+	file->writeSint16LE(_engine->_scene->_sceneStart.y);
+	file->writeSint16LE(_engine->_scene->_sceneStart.z);
 	file->writeSint16LE(FromAngle(_engine->_scene->_sceneHero->_beta));
 	file->writeByte((uint8)_engine->_scene->_sceneHero->_genBody);
 
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 849a64c7359..d04c1cea3c0 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -680,7 +680,7 @@ void Grid::redrawGrid() { // AffGrille
 
 	memset(_brickInfoBuffer, 0, _brickInfoBufferSize);
 
-	if (!_engine->_scene->_enableGridTileRendering) {
+	if (!_engine->_scene->_flagRenderGrid) {
 		return;
 	}
 
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index da1da7a3fba..9e23e55745f 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -618,21 +618,20 @@ void Scene::changeCube() {
 
 	_engine->_text->initSceneTextBank();
 
-	debug(2, "Scene %i music track id: %i", _numCube, _cubeJingle);
 	if (_cubeJingle != 255) {
-		_engine->_music->playMusic(_cubeJingle);
+		// _engine->_music->fadeMusicMidi(1);
 	}
 
 	_engine->_grid->initGrid(_newCube);
 
 	if (_flagChgCube == ScenePositionType::kZone) {
-		_newHeroPos = _zoneHeroPos;
+		_sceneStart = _zoneHeroPos;
 	} else if (_flagChgCube == ScenePositionType::kScene || _flagChgCube == ScenePositionType::kNoPosition) {
-		_newHeroPos = _sceneHeroPos;
+		_sceneStart = _sceneHeroPos;
 	}
 
-	_sceneHero->_posObj = _newHeroPos;
-	_startYFalling = _newHeroPos.y;
+	_sceneHero->_posObj = _sceneStart;
+	_startYFalling = _sceneStart.y;
 
 	_engine->_renderer->setLightVector(_alphaLight, _betaLight, LBAAngles::ANGLE_0);
 
@@ -656,18 +655,24 @@ void Scene::changeCube() {
 	_engine->_grid->_cellingGridIdx = -1;
 	_engine->_redraw->_firstTime = true;
 	_engine->_cameraZone = false;
+	_newCube = SCENE_CEILING_GRID_FADE_1;
+	_flagChgCube = ScenePositionType::kNoPosition;
+	_flagRenderGrid = true;
+
+	_samplePlayed = 2 * 4 * 8;
+	_timerNextAmbiance = 0;
 
 	ActorStruct *followedActor = getActor(_numObjFollow);
 	_engine->_grid->centerOnActor(followedActor);
 
-	_engine->_screens->_flagFade = true;
 	_engine->_renderer->setLightVector(_alphaLight, _betaLight, LBAAngles::ANGLE_0);
 
-	_newCube = SCENE_CEILING_GRID_FADE_1;
-	_enableGridTileRendering = true;
-	_flagChgCube = ScenePositionType::kNoPosition;
 	_zoneHeroPos = IVec3();
-	_sampleAmbienceTime = 0;
+
+	debug(2, "Scene %i music track id: %i", _numCube, _cubeJingle);
+	if (_cubeJingle != 255) {
+		_engine->_music->playMusic(_cubeJingle);
+	}
 
 	_engine->_gameState->handleLateGameItems();
 }
@@ -715,7 +720,7 @@ void Scene::playSceneMusic() {
 }
 
 void Scene::processEnvironmentSound() {
-	if (_engine->timerRef < _sampleAmbienceTime) {
+	if (_engine->timerRef < _timerNextAmbiance) {
 		return;
 	}
 	int16 currentAmb = _engine->getRandomNumber(4); // random ambiance
@@ -743,7 +748,7 @@ void Scene::processEnvironmentSound() {
 	}
 
 	// compute next ambiance timer
-	_sampleAmbienceTime = _engine->timerRef + _engine->toSeconds(_engine->getRandomNumber(_sampleMinDelayRnd) + _sampleMinDelay);
+	_timerNextAmbiance = _engine->timerRef + _engine->toSeconds(_engine->getRandomNumber(_sampleMinDelayRnd) + _sampleMinDelay);
 }
 
 void Scene::processZoneExtraBonus(ZoneStruct *zone) {
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index a7b98423354..24b8db04096 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -136,7 +136,7 @@ private:
 	bool _isOutsideScene = false; // lba2
 
 	/** Timer for the next sample ambience in scene */
-	int32 _sampleAmbienceTime = 0;
+	int32 _timerNextAmbiance = 0;
 	int16 _sampleAmbiance[4]{0};
 	int16 _sampleRepeat[4]{0};
 	int16 _sampleRound[4]{0};
@@ -150,8 +150,8 @@ private:
 public:
 	int16 _cubeJingle = 0;
 private:
-	IVec3 _sceneHeroPos;
-	IVec3 _zoneHeroPos;
+	IVec3 _sceneHeroPos; // CubeStartX, CubeStartY, CubeStartZ
+	IVec3 _zoneHeroPos; // NewPosX, NewPosY, NewPosZ
 
 	int32 _currentGameOverScene = 0;
 
@@ -180,7 +180,7 @@ public:
 	uint8 _currentCubeX = 0; // lba2
 	uint8 _currentCubeY = 0; // lba2
 
-	IVec3 _newHeroPos;
+	IVec3 _sceneStart;
 
 	/** Hero Y coordinate before fall */
 	int16 _startYFalling = 0;
@@ -209,7 +209,7 @@ public:
 	int32 _sceneNumTracks = 0;
 	IVec3 _sceneTracks[NUM_MAX_TRACKS];
 
-	bool _enableGridTileRendering = true;
+	bool _flagRenderGrid = true; // FlagAffGrille
 
 	uint8 _listFlagCube[NUM_SCENES_FLAGS]{0}; // ListVarCube
 
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index 80c29415aa8..8fb85742147 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -2001,7 +2001,7 @@ int32 ScriptLife::lTHE_END(TwinEEngine *engine, LifeScriptContext &ctx) {
 	// TODO: lba2 has a different ending
 	engine->_scene->_numCube = LBA1SceneId::Polar_Island_Final_Battle;
 	engine->_actor->_heroBehaviour = engine->_actor->_previousHeroBehaviour;
-	engine->_scene->_newHeroPos.x = -1;
+	engine->_scene->_sceneStart.x = -1;
 	engine->_scene->_sceneHero->_beta = engine->_actor->_previousHeroAngle;
 	engine->autoSave();
 	return 1; // break;
@@ -2036,7 +2036,7 @@ int32 ScriptLife::lPROJ_3D(TwinEEngine *engine, LifeScriptContext &ctx) {
 	debugC(3, kDebugLevels::kDebugScriptsLife, "LIFE::PROJ_3D()");
 	// TODO: only used for credits scene? If not, then move the credits related code into the menu->showCredits method
 	engine->_screens->copyScreen(engine->_frontVideoBuffer, engine->_workVideoBuffer);
-	engine->_scene->_enableGridTileRendering = false;
+	engine->_scene->_flagRenderGrid = false;
 
 	engine->_renderer->setProjection(engine->width() / 2, engine->height() / 2, 128, 1024, 1024);
 	engine->_renderer->setFollowCamera(0, 1500, 0, 25, -128, 0, 13000);
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index e5771207aeb..03c27e1c83d 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -367,7 +367,7 @@ Common::Error TwinEEngine::run() {
 		}
 		case EngineState::LoadedGame:
 			debug("Loaded game");
-			if (_scene->_newHeroPos.x == -1) {
+			if (_scene->_sceneStart.x == -1) {
 				_scene->_flagChgCube = ScenePositionType::kNoPosition;
 			}
 			_text->_renderTextTriangle = false;
@@ -1166,7 +1166,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 			if (IS_HERO(a)) {
 				if (actor->_workFlags.bAnimEnded) {
 					if (_gameState->_inventoryNumLeafs > 0) { // use clover leaf automaticaly
-						_scene->_sceneHero->_posObj = _scene->_newHeroPos;
+						_scene->_sceneHero->_posObj = _scene->_sceneStart;
 
 						_scene->_newCube = _scene->_numCube;
 						_gameState->setMaxMagicPoints();
@@ -1189,9 +1189,9 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 						actor->setLife(getMaxLife());
 
 						if (_scene->_oldcube != _scene->_numCube) {
-							_scene->_newHeroPos.x = -1;
-							_scene->_newHeroPos.y = -1;
-							_scene->_newHeroPos.z = -1;
+							_scene->_sceneStart.x = -1;
+							_scene->_sceneStart.y = -1;
+							_scene->_sceneStart.z = -1;
 							_scene->_numCube = _scene->_oldcube;
 							_scene->stopRunningGame();
 						}


Commit: 15553de743df7593c917914cb84ab2693de67a5d
    https://github.com/scummvm/scummvm/commit/15553de743df7593c917914cb84ab2693de67a5d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-17T14:31:11+02:00

Commit Message:
TWINE: new animation debug category

Changed paths:
    engines/twine/detection.cpp
    engines/twine/scene/animations.cpp
    engines/twine/shared.h


diff --git a/engines/twine/detection.cpp b/engines/twine/detection.cpp
index 3162b7590d6..f36f8239755 100644
--- a/engines/twine/detection.cpp
+++ b/engines/twine/detection.cpp
@@ -43,6 +43,7 @@ static const DebugChannelDef debugFlagList[] = {
 	{TwinE::kDebugMovies, "movies", "Movies debugging"},
 	{TwinE::kDebugPalette, "palette", "Palette debugging"},
 	{TwinE::kDebugCollision, "collision", "Collision debugging"},
+	{TwinE::kDebugAnimation, "animation", "Animation debugging"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 8d501179a37..962592c8cff 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -285,6 +285,7 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 		return;
 	}
 	for (const EntityAnim::Action &action : *actions) {
+		debugC(1, TwinE::kDebugAnimation, "Execute animation action %d for actor %d", (int)action.type, actorIdx);
 		switch (action.type) {
 		case ActionType::ACTION_HITTING:
 			if (action.animFrame - 1 == actor->_frame) {
@@ -470,6 +471,8 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes
 	actor->_animStepBeta = LBAAngles::ANGLE_0;
 	actor->_animStep = IVec3();
 
+	debugC(1, TwinE::kDebugAnimation, "Change animation for actor %d to %d", actorIdx, newanim);
+
 	return true;
 }
 
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index ee18a11505f..7a9d46ac150 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -809,7 +809,8 @@ enum kDebugLevels {
 	kDebugInput = 1 << 5,
 	kDebugMovies = 1 << 6,
 	kDebugPalette = 1 << 7,
-	kDebugCollision = 1 << 8
+	kDebugCollision = 1 << 8,
+	kDebugAnimation = 1 << 9
 };
 
 } // namespace TwinE


Commit: cf543baa73167e0ad84c518020e896a81d0c0aa1
    https://github.com/scummvm/scummvm/commit/cf543baa73167e0ad84c518020e896a81d0c0aa1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-17T14:31:11+02:00

Commit Message:
TWINE: improved collision debug logging

Changed paths:
    engines/twine/scene/actor.cpp
    engines/twine/scene/collision.cpp


diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index c5e7defa4d6..8c92373bc2c 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -376,6 +376,7 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 hitforce, int32
 	}
 
 	actor->_hitBy = actorIdx;
+	debugC(1, TwinE::kDebugCollision, "Actor %d was hit by %d", actorIdxAttacked, actorIdx);
 
 	if (actor->_armor <= hitforce) {
 		if (actor->_genAnim == AnimationTypes::kBigHit || actor->_genAnim == AnimationTypes::kHit2) {
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index c798dc4ea59..736205fc3a6 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -270,6 +270,7 @@ int32 Collision::checkObjCol(int32 actorIdx) {
 	IVec3 mins = processActor + ptrobj->_boundingBox.mins;
 	IVec3 maxs = processActor + ptrobj->_boundingBox.maxs;
 
+	int32 oldObjCol = ptrobj->_objCol;
 	ptrobj->_objCol = -1;
 
 	for (int32 a = 0; a < _engine->_scene->_nbObjets; a++) {
@@ -282,7 +283,9 @@ int32 Collision::checkObjCol(int32 actorIdx) {
 
 			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) {
 				ptrobj->_objCol = a; // mark as collision with actor a
-
+				if (a != oldObjCol) {
+					debugC(1, TwinE::kDebugCollision, "Actor %d is colliding with %d", actorIdx, a);
+				}
 				if (ptrobjt->_flags.bIsCarrierActor) {
 					if (ptrobj->_workFlags.bIsFalling) {
 						// I touch a carrier




More information about the Scummvm-git-logs mailing list