[Scummvm-git-logs] scummvm master -> a2ab724e1b1dadd8ebf54f86dee14d091d3d85fa
mgerhardy
noreply at scummvm.org
Tue Oct 8 10:15:15 UTC 2024
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4ad6a6961c TWINE: fixed a few collision related issues
af35f3f150 TWINE: removed hack from issue #13177
5b33f309ae TWINE: use addLife even for hit damage
a2ab724e1b TWINE: mark the penguin in the debug window
Commit: 4ad6a6961cff13bc421e0ce19c5ed1c225b4e9a6
https://github.com/scummvm/scummvm/commit/4ad6a6961cff13bc421e0ce19c5ed1c225b4e9a6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T11:25:18+02:00
Commit Message:
TWINE: fixed a few collision related issues
Skeletons hitboxes may be glitched: https://bugs.scummvm.org/ticket/15387
Tank is stuck: https://bugs.scummvm.org/ticket/13177
Bulldozer driven by Twinsen can get stuck behind truck (soft lock): https://bugs.scummvm.org/ticket/15388
Changed paths:
engines/twine/debugger/debugtools.cpp
engines/twine/menu/menu.cpp
engines/twine/parser/entity.cpp
engines/twine/parser/entity.h
engines/twine/renderer/redraw.cpp
engines/twine/resources/resources.cpp
engines/twine/resources/resources.h
engines/twine/scene/actor.cpp
engines/twine/scene/animations.cpp
engines/twine/scene/gamestate.cpp
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index bf6216e5cec..5982240a052 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -320,7 +320,7 @@ static void actorDetailsWindow(int &actorIdx, TwinEEngine *engine) {
if (actor->_body != -1) {
ImGui::SeparatorText("Body");
- BodyData &bodyData = engine->_resources->getBodyData(actor->_body);
+ BodyData &bodyData = actor->_entityDataPtr->getBody(actor->_body);
ImGuiEx::InputBoundingBox(actor->_body, "Bounding box", bodyData.bbox);
}
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index e4f14a92a6f..38126ca307e 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1210,7 +1210,7 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
_engine->_actor->setBehaviour(HeroBehaviourType::kNormal);
}
- _behaviourEntity = &_engine->_resources->getBodyData(_engine->_scene->_sceneHero->_body);
+ _behaviourEntity = &_engine->_scene->_sceneHero->_entityDataPtr->getBody(_engine->_scene->_sceneHero->_body);
_engine->_actor->_heroAnimIdx[(byte)HeroBehaviourType::kNormal] = _engine->_actor->_heroAnimIdxNORMAL;
_engine->_actor->_heroAnimIdx[(byte)HeroBehaviourType::kAthletic] = _engine->_actor->_heroAnimIdxATHLETIC;
diff --git a/engines/twine/parser/entity.cpp b/engines/twine/parser/entity.cpp
index 6632313a27c..c9ced316bfb 100644
--- a/engines/twine/parser/entity.cpp
+++ b/engines/twine/parser/entity.cpp
@@ -21,6 +21,7 @@
#include "twine/parser/entity.h"
#include "common/stream.h"
+#include "twine/resources/resources.h"
#include "twine/shared.h"
namespace TwinE {
@@ -31,6 +32,9 @@ bool EntityData::loadBody(Common::SeekableReadStream &stream, bool lba1) {
const int64 pos = stream.pos();
uint8 size = stream.readByte();
body.hqrBodyIndex = (int16)stream.readUint16LE();
+ if (!body.body.loadFromHQR(TwineResource(Resources::HQR_BODY_FILE, body.hqrBodyIndex), lba1)) {
+ error("Failed to load body with index: %i", body.hqrBodyIndex);
+ }
const uint8 numActions = stream.readByte();
for (uint8 i = 0U; i < numActions; ++i) {
if ((ActionType)stream.readByte() == ActionType::ACTION_ZV) {
@@ -307,6 +311,15 @@ const Common::Array<EntityAnim::Action> *EntityData::getActions(AnimationTypes a
return nullptr;
}
+BodyData &EntityData::getBody(int index) {
+ for (EntityBody &body : _bodies) {
+ if (body.index == index) {
+ return body.body;
+ }
+ }
+ error("Could not find body for index: %i", index);
+}
+
const EntityBody *EntityData::getEntityBody(const int index) const {
for (const EntityBody &body : _bodies) {
if (body.index == index) {
diff --git a/engines/twine/parser/entity.h b/engines/twine/parser/entity.h
index a7e8a04ea44..6b8a7043494 100644
--- a/engines/twine/parser/entity.h
+++ b/engines/twine/parser/entity.h
@@ -25,6 +25,7 @@
#include "common/array.h"
#include "common/memstream.h"
#include "common/stream.h"
+#include "twine/parser/body.h"
#include "twine/parser/parser.h"
#include "twine/shared.h"
@@ -34,6 +35,7 @@ struct EntityBody {
int index; /**< index in file3d.hqr */
ActorBoundingBox actorBoundingBox;
int hqrBodyIndex; /**< index in body.hqr */
+ BodyData body;
};
struct EntityAnim {
@@ -94,6 +96,7 @@ public:
const Common::Array<EntityAnim::Action> *getActions(AnimationTypes animation) const;
const EntityBody *getEntityBody(const int index) const;
+ BodyData &getBody(int index);
int32 getAnimIndex(AnimationTypes animation) const;
const Common::Array<EntityBody> &getBodies() const {
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 0dddb862c4d..9c113c985ec 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -404,7 +404,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
if (actor->_anim >= 0) {
const AnimData &animData = _engine->_resources->_animData[actor->_anim];
- _engine->_animations->doSetInterAnimObjet(actor->_frame, animData, _engine->_resources->getBodyData(actor->_body), &actor->_animTimerData);
+ _engine->_animations->doSetInterAnimObjet(actor->_frame, animData, actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
}
const IVec3 &delta = actor->posObj() - _engine->_grid->_worldCube;
@@ -416,7 +416,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
}
}
- if (!_engine->_renderer->affObjetIso(delta.x, delta.y, delta.z, LBAAngles::ANGLE_0, actor->_beta, LBAAngles::ANGLE_0, _engine->_resources->getBodyData(actor->_body), renderRect)) {
+ if (!_engine->_renderer->affObjetIso(delta.x, delta.y, delta.z, LBAAngles::ANGLE_0, actor->_beta, LBAAngles::ANGLE_0, actor->_entityDataPtr->getBody(actor->_body), renderRect)) {
return;
}
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index b5155077cbc..4e7a4de5d38 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -230,17 +230,6 @@ void Resources::initResources() {
preloadSamples();
preloadInventoryItems();
- const int32 bodyCount = HQR::numEntries(Resources::HQR_BODY_FILE);
- const int32 maxBodies = _engine->isLBA1() ? 200 : NUM_BODIES;
- if (bodyCount > maxBodies) {
- error("Max body count exceeded: %i", bodyCount);
- }
- for (int32 i = 0; i < bodyCount; ++i) {
- if (!_bodyData[i].loadFromHQR(TwineResource(Resources::HQR_BODY_FILE, i), _engine->isLBA1())) {
- error("HQR ERROR: Parsing body entity for model %i failed", i);
- }
- }
-
loadMovieInfo();
const int32 textEntryCount = _engine->isLBA1() ? 28 : 30;
@@ -252,10 +241,6 @@ void Resources::initResources() {
debug("Loaded %i text banks", textEntryCount / 2);
}
-BodyData &Resources::getBodyData(int index) {
- return _bodyData[index];
-}
-
const TextEntry *Resources::getText(TextBankId textBankId, TextId index) const {
return _textData.getText(textBankId, index);
}
diff --git a/engines/twine/resources/resources.h b/engines/twine/resources/resources.h
index f9d83abb4fe..fbb8439c87c 100644
--- a/engines/twine/resources/resources.h
+++ b/engines/twine/resources/resources.h
@@ -150,9 +150,6 @@ private:
TextData _textData;
Anim3DSData _anim3DSData;
-
- /** Actors 3D body table - size of NUM_BODIES */
- BodyData _bodyData[NUM_BODIES];
public:
Resources(TwinEEngine *engine) : _engine(engine) {}
~Resources();
@@ -174,8 +171,6 @@ public:
AnimData _animData[NUM_ANIMS];
- BodyData &getBodyData(int index);
-
/** Table with all loaded samples */
uint8 *_samplesTable[NUM_SAMPLES]{nullptr};
/** Table with all loaded samples sizes */
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index b71934a5229..9c4ab9f20cd 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -239,7 +239,7 @@ int32 Actor::searchBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &acto
return -1;
}
actorBoundingBox = body->actorBoundingBox;
- return body->hqrBodyIndex;
+ return (int)bodyIdx;
}
void Actor::initBody(BodyType bodyIdx, int16 actorIdx) {
@@ -275,7 +275,7 @@ void Actor::initBody(BodyType bodyIdx, int16 actorIdx) {
if (actorBoundingBox.hasBoundingBox) {
localActor->_boundingBox = actorBoundingBox.bbox;
} else {
- const BodyData &bd = _engine->_resources->getBodyData(localActor->_body);
+ const BodyData &bd = localActor->_entityDataPtr->getBody(localActor->_body);
localActor->_boundingBox = bd.bbox;
int32 size = 0;
@@ -298,7 +298,7 @@ void Actor::initBody(BodyType bodyIdx, int16 actorIdx) {
localActor->_boundingBox.maxs.z = size;
}
if (oldBody != -1 && localActor->_anim != -1) {
- copyInterAnim(_engine->_resources->getBodyData(oldBody), _engine->_resources->getBodyData(localActor->_body));
+ copyInterAnim(localActor->_entityDataPtr->getBody(oldBody), localActor->_entityDataPtr->getBody(localActor->_body));
}
}
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 328a62cb8e5..66eb0df9eda 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -434,10 +434,10 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes
if (actor->_anim == -1) {
// if no previous animation
- setAnimObjet(0, _engine->_resources->_animData[newanim], _engine->_resources->getBodyData(actor->_body), &actor->_animTimerData);
+ setAnimObjet(0, _engine->_resources->_animData[newanim], actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
} else {
// interpolation between animations
- stockInterAnim(_engine->_resources->getBodyData(actor->_body), &actor->_animTimerData);
+ stockInterAnim(actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
}
actor->_anim = newanim;
@@ -562,7 +562,7 @@ void Animations::doAnim(int32 actorIdx) {
const AnimData &animData = _engine->_resources->_animData[actor->_anim];
bool keyFramePassed = false;
- if (_engine->_resources->getBodyData(actor->_body).isAnimated()) {
+ if (actor->_entityDataPtr->getBody(actor->_body).isAnimated()) {
keyFramePassed = setInterDepObjet(actor->_frame, animData, &actor->_animTimerData);
}
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 6d5a614b082..90521c386aa 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -346,7 +346,7 @@ void GameState::doFoundObj(InventoryItems item) {
itemCamera.y = _engine->_grid->_newCamera.y * SIZE_BRICK_Y;
itemCamera.z = _engine->_grid->_newCamera.z * SIZE_BRICK_XZ;
- BodyData &bodyData = _engine->_resources->getBodyData(_engine->_scene->_sceneHero->_body);
+ BodyData &bodyData = _engine->_scene->_sceneHero->_entityDataPtr->getBody(_engine->_scene->_sceneHero->_body);
const IVec3 bodyPos = _engine->_scene->_sceneHero->_posObj - itemCamera;
Common::Rect modelRect;
_engine->_renderer->renderIsoModel(bodyPos, LBAAngles::ANGLE_0, LBAAngles::ANGLE_45, LBAAngles::ANGLE_0, bodyData, modelRect);
Commit: af35f3f150a5ae4b4418dced1e922a4889265cef
https://github.com/scummvm/scummvm/commit/af35f3f150a5ae4b4418dced1e922a4889265cef
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T11:25:23+02:00
Commit Message:
TWINE: removed hack from issue #13177
https://bugs.scummvm.org/ticket/13177
get the helper with debug commands
set_game_flag 77 0
set_game_flag 89 1
set_game_flag 74 1
change_scene 63
toggle_god_mode
force the track 2 for actor 1 (the tank) to start without playing the scene
change_scene 63
scene_actor 1
toggle_free_camera
set_track_obj 1 2
Changed paths:
engines/twine/scene/animations.cpp
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 66eb0df9eda..7339842ce5e 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -677,19 +677,11 @@ void Animations::doAnim(int32 actorIdx) {
col1 |= collision->doCornerReajustTwinkel(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
col1 |= collision->doCornerReajustTwinkel(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
} else {
- // TODO: hack to fix tank-not-moving bug https://bugs.scummvm.org/ticket/13177
- // remove processActorSave
- const IVec3 processActorSave = processActor;
-
// check other actors collisions with bricks
col1 |= collision->doCornerReajust(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
col1 |= collision->doCornerReajust(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
col1 |= collision->doCornerReajust(actor, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
col1 |= collision->doCornerReajust(actor, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 8);
- // TODO: hack to fix tank-not-moving bug https://bugs.scummvm.org/ticket/13177
- if (actorIdx == 1 && _engine->_scene->_currentSceneIdx == LBA1SceneId::Hamalayi_Mountains_2nd_fighting_scene) {
- processActor = processActorSave;
- }
}
// process wall hit while running
Commit: 5b33f309ae9502c09ea4d6fac3dbaa4a87a81ac4
https://github.com/scummvm/scummvm/commit/5b33f309ae9502c09ea4d6fac3dbaa4a87a81ac4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T11:54:24+02:00
Commit Message:
TWINE: use addLife even for hit damage
Changed paths:
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 9c4ab9f20cd..62f86f6599a 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -406,10 +406,7 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 hitforce, int32
_engine->_movements->_lastJoyFlag = true;
}
- actor->_lifePoint -= hitforce;
- if (actor->_lifePoint < 0) {
- actor->_lifePoint = 0;
- }
+ actor->addLife(-hitforce);
} else {
_engine->_animations->initAnim(AnimationTypes::kHit, AnimType::kAnimationInsert, AnimationTypes::kAnimInvalid, actorIdxAttacked);
}
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 4c5610c43be..969a9869806 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -263,6 +263,8 @@ inline void ActorStruct::setLife(int32 val) {
_lifePoint = val;
if (_lifePoint > _maxLife) {
_lifePoint = _maxLife;
+ } else if (_lifePoint < 0) {
+ _lifePoint = 0;
}
}
Commit: a2ab724e1b1dadd8ebf54f86dee14d091d3d85fa
https://github.com/scummvm/scummvm/commit/a2ab724e1b1dadd8ebf54f86dee14d091d3d85fa
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T12:14:18+02:00
Commit Message:
TWINE: mark the penguin in the debug window
Changed paths:
engines/twine/debugger/debugtools.cpp
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index 5982240a052..ea90458d612 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -220,6 +220,9 @@ static void actorDetailsWindow(int &actorIdx, TwinEEngine *engine) {
if (ImGui::BeginCombo("Actor", currentActorLabel.c_str())) {
for (int i = 0; i < engine->_scene->_nbObjets; ++i) {
Common::String label = Common::String::format("Actor %i", i);
+ if (engine->_scene->_mecaPenguinIdx == i) {
+ label += " (Penguin)";
+ }
const bool selected = i == actorIdx;
if (ImGui::Selectable(label.c_str(), selected)) {
actorIdx = i;
More information about the Scummvm-git-logs
mailing list