TWINE: renamed variables to match original sources

This commit is contained in:
Martin Gerhardy 2023-02-01 19:21:57 +01:00
parent 0517e015fc
commit ddb73bc158
3 changed files with 24 additions and 24 deletions

View File

@ -136,7 +136,7 @@ struct BonusParameter {
class ActorStruct {
private:
ShapeType _col = ShapeType::kNone; // collision
bool _brickCausesDamage = false; // TODO: this is a bitmask with multiple values in the original source
bool _brickCausesDamage = false;
EntityData _entityData;
public:
@ -191,7 +191,7 @@ public:
/** Process actor coordinate Nxw, Nyw, Nzw */
IVec3 _processActor;
IVec3 _oldPos;
IVec3 _oldPos; // OldPosX, OldPosY, OldPosZ
int32 _offsetTrack = -1;
uint8 *_moveScript = nullptr;

View File

@ -667,9 +667,6 @@ void Animations::doAnim(int32 actorIdx) {
collision->receptionObj(processActor, actorIdx);
}
// TODO: hack to fix tank-not-moving bug https://bugs.scummvm.org/ticket/13177
// remove processActorSave
const IVec3 processActorSave = processActor;
collision->setCollisionPos(processActor);
if (IS_HERO(actorIdx) && !actor->_staticFlags.bComputeLowCollision) {
@ -679,15 +676,18 @@ void Animations::doAnim(int32 actorIdx) {
col1 |= collision->doCornerReajustTwinkel(actor, processActor, oldPos, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
col1 |= collision->doCornerReajustTwinkel(actor, processActor, oldPos, 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(processActor, oldPos, actor->_boundingBox.mins.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 1);
col1 |= collision->doCornerReajust(processActor, oldPos, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.mins.z, 2);
col1 |= collision->doCornerReajust(processActor, oldPos, actor->_boundingBox.maxs.x, actor->_boundingBox.mins.y, actor->_boundingBox.maxs.z, 4);
col1 |= collision->doCornerReajust(processActor, oldPos, 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;
// 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

View File

@ -231,43 +231,43 @@ void Collision::handlePushing(IVec3 &processActor, const IVec3 &oldPos, const IV
}
bool Collision::checkValidObjPos(int32 actorIdx) {
const ActorStruct *actor = _engine->_scene->getActor(actorIdx);
const ActorStruct *ptrobj = _engine->_scene->getActor(actorIdx);
const IVec3 m0 = actor->posObj() + actor->_boundingBox.mins;
const IVec3 m1 = actor->posObj() + actor->_boundingBox.maxs;
const IVec3 m0 = ptrobj->posObj() + ptrobj->_boundingBox.mins;
const IVec3 m1 = ptrobj->posObj() + ptrobj->_boundingBox.maxs;
if (m0.x < 0 || m0.x > SIZE_BRICK_XZ * 63) {
if (m0.x < 0 || m0.x > SIZE_BRICK_XZ * (SIZE_CUBE_X - 1)) {
return false;
}
if (m1.x < 0 || m1.x > SIZE_BRICK_XZ * 63) {
if (m1.x < 0 || m1.x > SIZE_BRICK_XZ * (SIZE_CUBE_X - 1)) {
return false;
}
if (m0.z < 0 || m0.z > SIZE_BRICK_XZ * 63) {
if (m0.z < 0 || m0.z > SIZE_BRICK_XZ * (SIZE_CUBE_X - 1)) {
return false;
}
if (m1.z < 0 || m1.z > SIZE_BRICK_XZ * 63) {
if (m1.z < 0 || m1.z > SIZE_BRICK_XZ * (SIZE_CUBE_X - 1)) {
return false;
}
Grid *grid = _engine->_grid;
if (grid->worldColBrickFull(m0.x, m0.y, m0.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
if (grid->worldColBrickFull(m0.x, m0.y, m0.z, ptrobj->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
return false;
}
if (grid->worldColBrickFull(m1.x, m0.y, m0.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
if (grid->worldColBrickFull(m1.x, m0.y, m0.z, ptrobj->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
return false;
}
if (grid->worldColBrickFull(m1.x, m0.y, m1.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
if (grid->worldColBrickFull(m1.x, m0.y, m1.z, ptrobj->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
return false;
}
if (grid->worldColBrickFull(m0.x, m0.y, m1.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
if (grid->worldColBrickFull(m0.x, m0.y, m1.z, ptrobj->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
return false;
}
for (int32 n = 0; n < _engine->_scene->_nbObjets; ++n) {
const ActorStruct *actorTest = _engine->_scene->getActor(n);
if (n != actorIdx && actorTest->_body != -1 && !actor->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
const IVec3 &t0 = actorTest->posObj() + actorTest->_boundingBox.mins;
const IVec3 &t1 = actorTest->posObj() + actorTest->_boundingBox.maxs;
const ActorStruct *ptrobjt = _engine->_scene->getActor(n);
if (n != actorIdx && ptrobjt->_body != -1 && !ptrobj->_staticFlags.bIsHidden && ptrobjt->_carryBy != actorIdx) {
const IVec3 &t0 = ptrobjt->posObj() + ptrobjt->_boundingBox.mins;
const IVec3 &t1 = ptrobjt->posObj() + ptrobjt->_boundingBox.maxs;
if (m0.x < t1.x && m1.x > t0.x && m0.y < t1.y && m1.y > t0.y && m0.z < t1.z && m1.z > t0.z) {
return false;
}