[Scummvm-git-logs] scummvm master -> 613d8e342d867e44743145dcd1addcfd6dcdf9db
mgerhardy
noreply at scummvm.org
Sat Jun 11 12:58:07 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
613d8e342d TWINE: renamed a few more methods and defines
Commit: 613d8e342d867e44743145dcd1addcfd6dcdf9db
https://github.com/scummvm/scummvm/commit/613d8e342d867e44743145dcd1addcfd6dcdf9db
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-06-11T14:52:19+02:00
Commit Message:
TWINE: renamed a few more methods and defines
Changed paths:
engines/twine/audio/sound.cpp
engines/twine/renderer/redraw.cpp
engines/twine/renderer/renderer.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
engines/twine/scene/animations.cpp
engines/twine/scene/collision.cpp
engines/twine/scene/collision.h
engines/twine/scene/extra.cpp
engines/twine/scene/extra.h
engines/twine/scene/gamestate.cpp
engines/twine/scene/grid.cpp
engines/twine/scene/grid.h
engines/twine/scene/movements.cpp
engines/twine/scene/scene.cpp
engines/twine/script/script_life_v1.cpp
engines/twine/twine.cpp
diff --git a/engines/twine/audio/sound.cpp b/engines/twine/audio/sound.cpp
index 84ae7170497..bdea8884f85 100644
--- a/engines/twine/audio/sound.cpp
+++ b/engines/twine/audio/sound.cpp
@@ -50,9 +50,9 @@ void Sound::setSamplePosition(int32 channelIdx, int32 x, int32 y, int32 z) {
if (channelIdx < 0 || channelIdx >= NUM_CHANNELS) {
return;
}
- const int32 camX = _engine->_grid->_newCamera.x * BRICK_SIZE;
- const int32 camY = _engine->_grid->_newCamera.y * BRICK_HEIGHT;
- const int32 camZ = _engine->_grid->_newCamera.z * BRICK_SIZE;
+ const int32 camX = _engine->_grid->_newCamera.x * SIZE_BRICK_XZ;
+ const int32 camY = _engine->_grid->_newCamera.y * SIZE_BRICK_Y;
+ const int32 camZ = _engine->_grid->_newCamera.z * SIZE_BRICK_XZ;
int32 distance = getDistance3D(camX, camY, camZ, x, y, z);
distance = _engine->_collision->getAverageValue(0, distance, 10000, 255);
const byte targetVolume = CLIP<byte>(255 - distance, 0, 255);
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 011a11d7c1b..b47809f72e1 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -156,7 +156,7 @@ void Redraw::sortDrawingList(DrawListStruct *list, int32 listSize) const {
}
}
-void Redraw::addOverlay(OverlayType type, int16 info0, int16 x, int16 y, int16 info1, OverlayPosType posType, int16 lifeTime) {
+void Redraw::addOverlay(OverlayType type, int16 info0, int16 x, int16 y, int16 info1, OverlayPosType posType, int16 lifeTime) { // InitIncrustDisp
for (int32 i = 0; i < ARRAYSIZE(overlayList); i++) {
OverlayListStruct *overlay = &overlayList[i];
if (overlay->info0 == -1) {
@@ -198,7 +198,6 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
if (actor->_staticFlags.bIsBackgrounded && !bgRedraw) {
// get actor position on screen
const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(actor->pos() - _engine->_grid->_camera);
-
// check if actor is visible on screen, otherwise don't display it
if (projPos.x > -50 && projPos.x < _engine->width() + 40 && projPos.y > -30 && projPos.y < _engine->height() + 100) {
actor->_dynamicFlags.bIsDrawn = 1;
@@ -215,26 +214,26 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
if ((actor->_staticFlags.bUsesClipping && projPos.x > -112 && projPos.x < _engine->width() + 112 && projPos.y > -50 && projPos.y < _engine->height() + 171) ||
((!actor->_staticFlags.bUsesClipping) && projPos.x > -50 && projPos.x < _engine->width() + 40 && projPos.y > -30 && projPos.y < _engine->height() + 100)) {
- int32 tmpVal = actor->_pos.z + actor->_pos.x - _engine->_grid->_camera.x - _engine->_grid->_camera.z;
+ int32 ztri = actor->_pos.z + actor->_pos.x - _engine->_grid->_camera.x - _engine->_grid->_camera.z;
// if actor is above another actor
if (actor->_carryBy != -1) {
const ActorStruct *standOnActor = _engine->_scene->getActor(actor->_carryBy);
- tmpVal = standOnActor->_pos.x - _engine->_grid->_camera.x + standOnActor->_pos.z - _engine->_grid->_camera.z + 2;
+ ztri = standOnActor->_pos.x - _engine->_grid->_camera.x + standOnActor->_pos.z - _engine->_grid->_camera.z + 2;
}
if (actor->_staticFlags.bIsSpriteActor) {
drawList[drawListPos].type = DrawListType::DrawActorSprites;
drawList[drawListPos].actorIdx = a;
if (actor->_staticFlags.bUsesClipping) {
- tmpVal = actor->_animStep.x - _engine->_grid->_camera.x + actor->_animStep.z - _engine->_grid->_camera.z;
+ ztri = actor->_animStep.x - _engine->_grid->_camera.x + actor->_animStep.z - _engine->_grid->_camera.z;
}
} else {
drawList[drawListPos].type = 0;
drawList[drawListPos].actorIdx = a;
}
- drawList[drawListPos].posValue = tmpVal;
+ drawList[drawListPos].posValue = ztri;
drawListPos++;
@@ -251,7 +250,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
drawList[drawListPos].z = shadowCoord.z;
}
- drawList[drawListPos].posValue = tmpVal - 1; // save the shadow entry in the _drawList
+ drawList[drawListPos].posValue = ztri - 1; // save the shadow entry in the _drawList
drawList[drawListPos].type = DrawListType::DrawShadows;
drawList[drawListPos].actorIdx = 0;
drawList[drawListPos].offset = 1;
@@ -269,7 +268,7 @@ int32 Redraw::fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw) {
int32 Redraw::fillExtraDrawingList(DrawListStruct *drawList, int32 drawListPos) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_engine->_extra->_extraList[i];
- if (extra->info0 == -1) {
+ if (extra->sprite == -1) {
continue;
}
if (extra->type & ExtraType::TIME_IN) {
@@ -290,7 +289,7 @@ int32 Redraw::fillExtraDrawingList(DrawListStruct *drawList, int32 drawListPos)
drawList[drawListPos].type = DrawListType::DrawExtras;
drawListPos++;
- if (_engine->_cfgfile.ShadowMode == 2 && !(extra->info0 & EXTRA_SPECIAL_MASK)) {
+ if (_engine->_cfgfile.ShadowMode == 2 && !(extra->sprite & EXTRA_SPECIAL_MASK)) {
const IVec3 &shadowCoord = _engine->_movements->getShadowPosition(extra->pos);
drawList[drawListPos].posValue = tmpVal - 1;
@@ -326,9 +325,9 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
_engine->_grid->drawSprite(renderRect.left, renderRect.top, _engine->_resources->_spriteShadowPtr, drawCmd.offset);
- const int32 tmpX = (drawCmd.x + BRICK_HEIGHT) / BRICK_SIZE;
- const int32 tmpY = drawCmd.y / BRICK_HEIGHT;
- const int32 tmpZ = (drawCmd.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpX = (drawCmd.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ const int32 tmpY = drawCmd.y / SIZE_BRICK_Y;
+ const int32 tmpZ = (drawCmd.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_engine->_grid->drawOverModelActor(tmpX, tmpY, tmpZ);
@@ -363,9 +362,9 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
if (_engine->_interface->setClip(renderRect)) {
actor->_dynamicFlags.bIsDrawn = 1;
- const int32 tempX = (actor->_pos.x + BRICK_HEIGHT) / BRICK_SIZE;
- int32 tempY = actor->_pos.y / BRICK_HEIGHT;
- const int32 tempZ = (actor->_pos.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tempX = (actor->_pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ int32 tempY = actor->_pos.y / SIZE_BRICK_Y;
+ const int32 tempZ = (actor->_pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
if (actor->brickShape() != ShapeType::kNone) {
tempY++;
}
@@ -418,14 +417,14 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
actor->_dynamicFlags.bIsDrawn = 1;
if (actor->_staticFlags.bUsesClipping) {
- const int32 tmpX = (actor->_animStep.x + BRICK_HEIGHT) / BRICK_SIZE;
- const int32 tmpY = actor->_animStep.y / BRICK_HEIGHT;
- const int32 tmpZ = (actor->_animStep.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpX = (actor->_animStep.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ const int32 tmpY = actor->_animStep.y / SIZE_BRICK_Y;
+ const int32 tmpZ = (actor->_animStep.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_engine->_grid->drawOverSpriteActor(tmpX, tmpY, tmpZ);
} else {
- const int32 tmpX = (actor->_pos.x + actor->_boundingBox.maxs.x + BRICK_HEIGHT) / BRICK_SIZE;
- int32 tmpY = actor->_pos.y / BRICK_HEIGHT;
- const int32 tmpZ = (actor->_pos.z + actor->_boundingBox.maxs.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpX = (actor->_pos.x + actor->_boundingBox.maxs.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ int32 tmpY = actor->_pos.y / SIZE_BRICK_Y;
+ const int32 tmpZ = (actor->_pos.z + actor->_boundingBox.maxs.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
if (actor->brickShape() != ShapeType::kNone) {
tmpY++;
}
@@ -451,15 +450,15 @@ void Redraw::processDrawListExtras(const DrawListStruct &drawCmd) {
const IVec3 &projPos = _engine->_renderer->projectPositionOnScreen(extra->pos - _engine->_grid->_camera);
Common::Rect renderRect;
- if (extra->info0 & EXTRA_SPECIAL_MASK) {
+ if (extra->sprite & EXTRA_SPECIAL_MASK) {
_engine->_extra->drawExtraSpecial(extraIdx, projPos.x, projPos.y, renderRect);
} else {
- const SpriteData &spritePtr = _engine->_resources->_spriteData[extra->info0];
+ const SpriteData &spritePtr = _engine->_resources->_spriteData[extra->sprite];
const int32 spriteWidth = spritePtr.surface().w;
const int32 spriteHeight = spritePtr.surface().h;
// calculate sprite position on screen
- const SpriteDim *dim = _engine->_resources->_spriteBoundingBox.dim(extra->info0);
+ const SpriteDim *dim = _engine->_resources->_spriteBoundingBox.dim(extra->sprite);
renderRect.left = projPos.x + dim->x;
renderRect.top = projPos.y + dim->y;
renderRect.right = renderRect.left + spriteWidth;
@@ -469,9 +468,9 @@ void Redraw::processDrawListExtras(const DrawListStruct &drawCmd) {
}
if (_engine->_interface->setClip(renderRect)) {
- const int32 tmpX = (extra->pos.x + BRICK_HEIGHT) / BRICK_SIZE;
- const int32 tmpY = extra->pos.y / BRICK_HEIGHT;
- const int32 tmpZ = (extra->pos.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 tmpX = (extra->pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ const int32 tmpY = extra->pos.y / SIZE_BRICK_Y;
+ const int32 tmpZ = (extra->pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_engine->_grid->drawOverModelActor(tmpX, tmpY, tmpZ);
addRedrawArea(_engine->_interface->_clip);
@@ -671,7 +670,7 @@ void Redraw::renderText() {
addRedrawArea(redraw);
}
-void Redraw::redrawEngineActions(bool bgRedraw) {
+void Redraw::redrawEngineActions(bool bgRedraw) { // AffScene
int32 tmp_projPosX = _projPosScreen.x;
int32 tmp_projPosY = _projPosScreen.y;
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 28f16cf4672..9063bd88a19 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -62,7 +62,7 @@ void Renderer::init(int32 w, int32 h) {
_holomap_polytab_2_3 = &_polyTab[_engine->height() * 5];
}
-IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) {
+IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) { // ProjettePoint
if (_isUsingOrthoProjection) {
_projPos.x = ((cX - cZ) * 24) / ISO_SCALE + _orthoProjPos.x;
_projPos.y = (((cX + cZ) * 12) - cY * 30) / ISO_SCALE + _orthoProjPos.y;
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 1efb80b8150..9bc2a7ae684 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -272,7 +272,7 @@ void Actor::resetActor(int16 actorIdx) {
_engine->_movements->setActorAngleSafe(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_move);
}
-void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit, int32 angle) {
+void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit, int32 angle) {
ActorStruct *actor = _engine->_scene->getActor(actorIdxAttacked);
if (actor->_life <= 0) {
return;
@@ -304,7 +304,7 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
}
}
- _engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
+ _engine->_extra->initSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
if (!actorIdxAttacked) {
_engine->_movements->_lastJoyFlag = true;
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 0cb1107294e..0ee77cdea7b 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -348,7 +348,7 @@ public:
* @param strengthOfHit actor hitting strength of hit
* @param angle angle of actor hitting
*/
- void hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit, int32 angle);
+ void hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit, int32 angle);
/** Process actor carrier */
void processActorCarrier(int32 actorIdx);
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 57464bc7000..25a73830436 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -550,8 +550,8 @@ void Animations::doAnim(int32 actorIdx) {
processActor += actor->_animStep;
if (actor->_staticFlags.bUseMiniZv) {
- processActor.x = ((processActor.x / (BRICK_SIZE / 4)) * (BRICK_SIZE / 4));
- processActor.z = ((processActor.z / (BRICK_SIZE / 4)) * (BRICK_SIZE / 4));
+ processActor.x = ((processActor.x / (SIZE_BRICK_XZ / 4)) * (SIZE_BRICK_XZ / 4));
+ processActor.z = ((processActor.z / (SIZE_BRICK_XZ / 4)) * (SIZE_BRICK_XZ / 4));
}
actor->_animStep = IVec3();
@@ -652,15 +652,15 @@ void Animations::doAnim(int32 actorIdx) {
ShapeType brickShape = _engine->_grid->worldColBrick(previousActor);
if (brickShape != ShapeType::kNone) {
- if (brickShape != ShapeType::kSolid) {
+ if (brickShape == ShapeType::kSolid) {
+ actor->_pos.y = processActor.y = (processActor.y / SIZE_BRICK_Y) * SIZE_BRICK_Y + SIZE_BRICK_Y; // go upper
+ } else {
_engine->_collision->reajustPos(processActor, brickShape);
- } else { // this shouldn't happen (collision should avoid it)
- actor->_pos.y = processActor.y = (processActor.y / BRICK_HEIGHT) * BRICK_HEIGHT + BRICK_HEIGHT; // go upper
}
}
if (actor->_staticFlags.bComputeCollisionWithObj) {
- _engine->_collision->checkCollisionWithActors(actorIdx);
+ _engine->_collision->checkObjCol(actorIdx);
}
if (actor->_carryBy != -1 && actor->_dynamicFlags.bIsFalling) {
@@ -694,8 +694,8 @@ void Animations::doAnim(int32 actorIdx) {
destPos.z += processActor.z;
if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= SCENE_SIZE_MAX && destPos.z <= SCENE_SIZE_MAX) {
- if (_engine->_grid->worldColBrick(destPos.x, processActor.y + BRICK_HEIGHT, destPos.z) != ShapeType::kNone && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
- _engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
+ if (_engine->_grid->worldColBrick(destPos.x, processActor.y + SIZE_BRICK_Y, destPos.z) != ShapeType::kNone && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
+ _engine->_extra->initSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
initAnim(AnimationTypes::kBigHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
if (IS_HERO(_currentlyProcessedActorIdx)) {
@@ -714,10 +714,10 @@ void Animations::doAnim(int32 actorIdx) {
if (brickShape == ShapeType::kSolid) {
if (actor->_dynamicFlags.bIsFalling) {
_engine->_collision->receptionObj();
- processActor.y = (_engine->_collision->_collision.y * BRICK_HEIGHT) + BRICK_HEIGHT;
+ processActor.y = (_engine->_collision->_collision.y * SIZE_BRICK_Y) + SIZE_BRICK_Y;
} else {
if (IS_HERO(actorIdx) && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_anim == AnimationTypes::kForward && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
- _engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
+ _engine->_extra->initSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
initAnim(AnimationTypes::kBigHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
_engine->_movements->_lastJoyFlag = true;
actor->addLife(-1);
@@ -759,15 +759,15 @@ void Animations::doAnim(int32 actorIdx) {
if (IS_HERO(actorIdx) && _engine->_scene->_startYFalling == 0) {
_engine->_scene->_startYFalling = processActor.y;
- int32 y = processActor.y - 1 - BRICK_HEIGHT;
+ int32 y = processActor.y - 1 - SIZE_BRICK_Y;
while (y > 0 && ShapeType::kNone == _engine->_grid->worldColBrick(processActor.x, y, processActor.z)) {
- y -= BRICK_HEIGHT;
+ y -= SIZE_BRICK_Y;
}
- y = (y + BRICK_HEIGHT) & ~(BRICK_HEIGHT - 1);
+ y = (y + SIZE_BRICK_Y) & ~(SIZE_BRICK_Y - 1);
int32 fallHeight = processActor.y - y;
- if (fallHeight <= (2 * BRICK_HEIGHT) && actor->_anim == AnimationTypes::kForward) {
+ if (fallHeight <= (2 * SIZE_BRICK_Y) && actor->_anim == AnimationTypes::kForward) {
actor->_dynamicFlags.bWasWalkingBeforeFalling = 1;
} else {
initAnim(AnimationTypes::kFall, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
@@ -786,7 +786,7 @@ void Animations::doAnim(int32 actorIdx) {
}
} else {
if (actor->_staticFlags.bComputeCollisionWithObj) {
- _engine->_collision->checkCollisionWithActors(actorIdx);
+ _engine->_collision->checkObjCol(actorIdx);
}
}
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 65a1c8cd3c5..e8050e1f485 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -63,7 +63,7 @@ bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) const {
return false;
}
- if (mins1.y <= (maxs2.y - BRICK_HEIGHT)) {
+ if (mins1.y <= (maxs2.y - SIZE_BRICK_Y)) {
return false;
}
@@ -82,7 +82,7 @@ bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) const {
return true;
}
-int32 Collision::getAverageValue(int32 start, int32 end, int32 maxDelay, int32 delay) const {
+int32 Collision::getAverageValue(int32 start, int32 end, int32 maxDelay, int32 delay) const { // BoundRegleTrois
if (delay <= 0) {
return start;
}
@@ -99,9 +99,9 @@ void Collision::reajustPos(IVec3 &processActor, ShapeType brickShape) const {
return;
}
- const int32 xw = (_collision.x * BRICK_SIZE) - BRICK_HEIGHT;
- const int32 yw = _collision.y * BRICK_HEIGHT;
- const int32 zw = (_collision.z * BRICK_SIZE) - BRICK_HEIGHT;
+ const int32 xw = (_collision.x * SIZE_BRICK_XZ) - SIZE_BRICK_Y;
+ const int32 yw = _collision.y * SIZE_BRICK_Y;
+ const int32 zw = (_collision.z * SIZE_BRICK_XZ) - SIZE_BRICK_Y;
// double-side stairs
switch (brickShape) {
@@ -134,28 +134,28 @@ void Collision::reajustPos(IVec3 &processActor, ShapeType brickShape) const {
}
break;
case ShapeType::kDoubleSideStairsLeft1:
- if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ if (SIZE_BRICK_XZ - (processActor.x - xw) > processActor.z - zw) {
brickShape = ShapeType::kStairsBottomLeft;
} else {
brickShape = ShapeType::kStairsTopLeft;
}
break;
case ShapeType::kDoubleSideStairsRight1:
- if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ if (SIZE_BRICK_XZ - (processActor.x - xw) > processActor.z - zw) {
brickShape = ShapeType::kStairsBottomRight;
} else {
brickShape = ShapeType::kStairsTopRight;
}
break;
case ShapeType::kDoubleSideStairsLeft2:
- if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ if (SIZE_BRICK_XZ - (processActor.x - xw) > processActor.z - zw) {
brickShape = ShapeType::kStairsTopLeft;
} else {
brickShape = ShapeType::kStairsBottomLeft;
}
break;
case ShapeType::kDoubleSideStairsRight2:
- if (BRICK_SIZE - (processActor.x - xw) > processActor.z - zw) {
+ if (SIZE_BRICK_XZ - (processActor.x - xw) > processActor.z - zw) {
brickShape = ShapeType::kStairsTopRight;
} else {
brickShape = ShapeType::kStairsBottomRight;
@@ -167,16 +167,16 @@ void Collision::reajustPos(IVec3 &processActor, ShapeType brickShape) const {
switch (brickShape) {
case ShapeType::kStairsTopLeft:
- processActor.y = yw + getAverageValue(0, BRICK_HEIGHT, BRICK_SIZE, processActor.x - xw);
+ processActor.y = yw + getAverageValue(0, SIZE_BRICK_Y, SIZE_BRICK_XZ, processActor.x - xw);
break;
case ShapeType::kStairsTopRight:
- processActor.y = yw + getAverageValue(0, BRICK_HEIGHT, BRICK_SIZE, processActor.z - zw);
+ processActor.y = yw + getAverageValue(0, SIZE_BRICK_Y, SIZE_BRICK_XZ, processActor.z - zw);
break;
case ShapeType::kStairsBottomLeft:
- processActor.y = yw + getAverageValue(BRICK_HEIGHT, 0, BRICK_SIZE, processActor.z - zw);
+ processActor.y = yw + getAverageValue(SIZE_BRICK_Y, 0, SIZE_BRICK_XZ, processActor.z - zw);
break;
case ShapeType::kStairsBottomRight:
- processActor.y = yw + getAverageValue(BRICK_HEIGHT, 0, BRICK_SIZE, processActor.x - xw);
+ processActor.y = yw + getAverageValue(SIZE_BRICK_Y, 0, SIZE_BRICK_XZ, processActor.x - xw);
break;
default:
break;
@@ -194,16 +194,16 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
if (actorTest->_staticFlags.bUseMiniZv) {
if (newAngle >= ANGLE_45 && newAngle < ANGLE_135 && actor->_angle >= ANGLE_45 && actor->_angle < ANGLE_135) {
- actorTest->_animStep.x = BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.x = SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
}
if (newAngle >= ANGLE_135 && newAngle < ANGLE_225 && actor->_angle >= ANGLE_135 && actor->_angle < ANGLE_225) {
- actorTest->_animStep.z = -BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.z = -SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
}
if (newAngle >= ANGLE_225 && newAngle < ANGLE_315 && actor->_angle >= ANGLE_225 && actor->_angle < ANGLE_315) {
- actorTest->_animStep.x = -BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.x = -SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
}
if ((newAngle >= ANGLE_315 || newAngle < ANGLE_45) && (actor->_angle >= ANGLE_315 || actor->_angle < ANGLE_45)) {
- actorTest->_animStep.z = BRICK_SIZE / 4 + BRICK_SIZE / 8;
+ actorTest->_animStep.z = SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
}
} else {
actorTest->_animStep.x = processActor.x - actor->_collisionPos.x;
@@ -230,7 +230,7 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
}
}
-int32 Collision::checkCollisionWithActors(int32 actorIdx) {
+int32 Collision::checkObjCol(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
IVec3 &processActor = actor->_processActor;
@@ -257,7 +257,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
continue;
}
} else if (standingOnActor(actorIdx, a)) {
- _engine->_actor->hitActor(actorIdx, a, 1, -1);
+ _engine->_actor->hitObj(actorIdx, a, 1, -1);
}
handlePushing(minsTest, maxsTest, actor, actorTest);
}
@@ -282,7 +282,7 @@ int32 Collision::checkCollisionWithActors(int32 actorIdx) {
const IVec3 minsTest = actorTest->pos() + actorTest->_boundingBox.mins;
const IVec3 maxsTest = actorTest->pos() + actorTest->_boundingBox.maxs;
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) {
- _engine->_actor->hitActor(actorIdx, a, actor->_strengthOfHit, actor->_angle + ANGLE_180);
+ _engine->_actor->hitObj(actorIdx, a, actor->_strengthOfHit, actor->_angle + ANGLE_180);
actor->_dynamicFlags.bIsHitting = 0;
}
}
@@ -362,16 +362,16 @@ void Collision::receptionObj() {
const IVec3 &processActor = _engine->_actor->_processActorPtr->_processActor;
const int32 fall = _engine->_scene->_startYFalling - processActor.y;
- if (fall >= BRICK_HEIGHT * 8) {
+ if (fall >= SIZE_BRICK_Y * 8) {
const IVec3 &actorPos = _engine->_actor->_processActorPtr->pos();
- _engine->_extra->addExtraSpecial(actorPos.x, actorPos.y + 1000, actorPos.z, ExtraSpecialType::kHitStars);
- if (fall >= BRICK_HEIGHT * 16) {
+ _engine->_extra->initSpecial(actorPos.x, actorPos.y + 1000, actorPos.z, ExtraSpecialType::kHitStars);
+ if (fall >= SIZE_BRICK_Y * 16) {
_engine->_actor->_processActorPtr->setLife(0);
} else {
_engine->_actor->_processActorPtr->addLife(-1);
}
_engine->_animations->initAnim(AnimationTypes::kLandingHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
- } else if (fall > 2 * BRICK_HEIGHT) {
+ } else if (fall > 2 * SIZE_BRICK_Y) {
_engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
} else {
if (_engine->_actor->_processActorPtr->_dynamicFlags.bWasWalkingBeforeFalling) {
@@ -391,8 +391,8 @@ void Collision::receptionObj() {
_engine->_actor->_processActorPtr->_dynamicFlags.bWasWalkingBeforeFalling = 0;
}
-int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 actorIdx) {
- const BoundingBox *bbox = _engine->_resources->_spriteBoundingBox.bbox(extra->info0);
+int32 Collision::extraCheckObjCol(ExtraListStruct *extra, int32 actorIdx) {
+ const BoundingBox *bbox = _engine->_resources->_spriteBoundingBox.bbox(extra->sprite);
const IVec3 mins = bbox->mins + extra->pos;
const IVec3 maxs = bbox->maxs + extra->pos;
@@ -405,7 +405,7 @@ int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 act
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) {
if (extra->strengthOfHit != 0) {
- _engine->_actor->hitActor(actorIdx, a, extra->strengthOfHit, -1);
+ _engine->_actor->hitObj(actorIdx, a, extra->strengthOfHit, -1);
}
return a;
@@ -416,7 +416,7 @@ int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 act
return -1;
}
-bool Collision::checkExtraCollisionWithBricks(int32 x, int32 y, int32 z, const IVec3 &oldPos) {
+bool Collision::fullWorldColBrick(int32 x, int32 y, int32 z, const IVec3 &oldPos) {
if (_engine->_grid->worldColBrick(oldPos) != ShapeType::kNone) {
return true;
}
@@ -440,15 +440,15 @@ bool Collision::checkExtraCollisionWithBricks(int32 x, int32 y, int32 z, const I
return false;
}
-int32 Collision::checkExtraCollisionWithExtra(ExtraListStruct *extra, int32 extraIdx) const {
- int32 index = extra->info0;
+int32 Collision::extraCheckExtraCol(ExtraListStruct *extra, int32 extraIdx) const {
+ int32 index = extra->sprite;
const BoundingBox *bbox = _engine->_resources->_spriteBoundingBox.bbox(index);
const IVec3 mins = bbox->mins + extra->pos;
const IVec3 maxs = bbox->maxs + extra->pos;
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
const ExtraListStruct *extraTest = &_engine->_extra->_extraList[i];
- if (i != extraIdx && extraTest->info0 != -1) {
+ if (i != extraIdx && extraTest->sprite != -1) {
const BoundingBox *testbbox = _engine->_resources->_spriteBoundingBox.bbox(++index);
const IVec3 minsTest = testbbox->mins + extraTest->pos;
const IVec3 maxsTest = testbbox->maxs + extraTest->pos;
diff --git a/engines/twine/scene/collision.h b/engines/twine/scene/collision.h
index 97e5a7c2e26..db8f3af74dc 100644
--- a/engines/twine/scene/collision.h
+++ b/engines/twine/scene/collision.h
@@ -66,7 +66,7 @@ public:
* Check collision with actors
* @param actorIx Current process actor index
*/
- int32 checkCollisionWithActors(int32 actorIdx);
+ int32 checkObjCol(int32 actorIdx);
/**
* Check Hero collision with bricks
@@ -94,17 +94,17 @@ public:
* @param extra to process
* @param actorIdx actor to check collision
*/
- int32 checkExtraCollisionWithActors(ExtraListStruct *extra, int32 actorIdx);
+ int32 extraCheckObjCol(ExtraListStruct *extra, int32 actorIdx);
/** Check extra collision with bricks */
- bool checkExtraCollisionWithBricks(int32 x, int32 y, int32 z, const IVec3 &oldPos);
+ bool fullWorldColBrick(int32 x, int32 y, int32 z, const IVec3 &oldPos);
/**
* Check extra collision with another extra
* @param extra to process
* @param extraIdx extra index to check collision
*/
- int32 checkExtraCollisionWithExtra(ExtraListStruct *extra, int32 extraIdx) const;
+ int32 extraCheckExtraCol(ExtraListStruct *extra, int32 extraIdx) const;
};
} // namespace TwinE
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 9f651c16750..c08ce9ee6c3 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -77,13 +77,13 @@ const ExtraShape explodeCloudShape { ARRAYSIZE(explodeCloudData), explodeCloudDa
Extra::Extra(TwinEEngine *engine) : _engine(engine) {}
-int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit) {
+int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit) { // ExtraSearch
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
- if (extra->info0 != -1) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = spriteIdx;
+ extra->sprite = spriteIdx;
extra->type = ExtraType::SEARCH_OBJ;
extra->info1 = 0;
extra->pos.x = x;
@@ -105,10 +105,10 @@ int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx
int32 Extra::addExtraExplode(int32 x, int32 y, int32 z) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
- if (extra->info0 != -1) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = SPRITEHQR_EXPLOSION_FIRST_FRAME;
+ extra->sprite = SPRITEHQR_EXPLOSION_FIRST_FRAME;
extra->type = ExtraType::TIME_OUT | ExtraType::EXPLOSION;
extra->info1 = 0;
extra->pos.x = x;
@@ -125,7 +125,7 @@ int32 Extra::addExtraExplode(int32 x, int32 y, int32 z) {
void Extra::resetExtras() {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
- extra->info0 = -1;
+ extra->sprite = -1;
extra->info1 = 1;
}
}
@@ -148,15 +148,15 @@ 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) {
+int32 Extra::initSpecial(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++) {
ExtraListStruct *extra = &_extraList[i];
- if (extra->info0 != -1) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = flag;
+ extra->sprite = flag;
extra->info1 = 0;
if (type == ExtraSpecialType::kHitStars) {
@@ -224,10 +224,10 @@ int Extra::getBonusSprite(BonusParameter bonusParameter) const {
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) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = type;
+ extra->sprite = type;
extra->type = ExtraType::STOP_COL | ExtraType::TAKABLE | ExtraType::WAIT_SOME_TIME;
if (type != SPRITEHQR_KEY) {
@@ -252,10 +252,10 @@ int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle
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) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = spriteIdx;
+ extra->sprite = spriteIdx;
extra->type = ExtraType::END_OBJ | ExtraType::END_COL | ExtraType::IMPACT | ExtraType::WAIT_NO_COL;
extra->pos.x = x;
extra->pos.y = y;
@@ -277,10 +277,10 @@ int32 Extra::addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spri
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) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = spriteIdx;
+ extra->sprite = spriteIdx;
extra->type = ExtraType::SEARCH_OBJ;
extra->info1 = 0;
extra->pos.x = x;
@@ -303,7 +303,7 @@ int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spr
int32 Extra::findExtraKey() const {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
const ExtraListStruct *extra = &_extraList[i];
- if (extra->info0 == SPRITEHQR_KEY) {
+ if (extra->sprite == SPRITEHQR_KEY) {
return i;
}
}
@@ -314,10 +314,10 @@ int32 Extra::findExtraKey() const {
int32 Extra::addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx) {
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
- if (extra->info0 != -1) {
+ if (extra->sprite != -1) {
continue;
}
- extra->info0 = spriteIdx;
+ extra->sprite = spriteIdx;
extra->type = ExtraType::MAGIC_BALL_KEY;
extra->info1 = 0;
extra->pos.x = x;
@@ -479,7 +479,7 @@ void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int
void Extra::drawExtraSpecial(int32 extraIdx, int32 x, int32 y, Common::Rect &renderRect) {
ExtraListStruct *extra = &_extraList[extraIdx];
- ExtraSpecialType specialType = (ExtraSpecialType)(extra->info0 & (EXTRA_SPECIAL_MASK - 1));
+ ExtraSpecialType specialType = (ExtraSpecialType)(extra->sprite & (EXTRA_SPECIAL_MASK - 1));
switch (specialType) {
case ExtraSpecialType::kHitStars:
@@ -498,7 +498,7 @@ void Extra::drawExtraSpecial(int32 extraIdx, int32 x, int32 y, Common::Rect &ren
}
}
-void Extra::processMagicballBounce(ExtraListStruct *extra, int32 x, int32 y, int32 z) {
+void Extra::bounceExtra(ExtraListStruct *extra, int32 x, int32 y, int32 z) {
if (_engine->_grid->worldColBrick(x, extra->pos.y, z) != ShapeType::kNone) {
extra->destPos.y = -extra->destPos.y;
}
@@ -519,32 +519,32 @@ void Extra::processMagicballBounce(ExtraListStruct *extra, int32 x, int32 y, int
extra->spawnTime = _engine->_lbaTime;
}
-void Extra::processExtras() {
+void Extra::processExtras() { // GereExtras
int32 currentExtraX = 0;
int32 currentExtraY = 0;
int32 currentExtraZ = 0;
for (int32 i = 0; i < EXTRA_MAX_ENTRIES; i++) {
ExtraListStruct *extra = &_extraList[i];
- if (extra->info0 == -1) {
+ if (extra->sprite == -1) {
continue;
}
// process extra life time
if (extra->type & ExtraType::TIME_OUT) {
if (extra->payload.lifeTime + extra->spawnTime <= _engine->_lbaTime) {
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
}
// reset extra
if (extra->type & ExtraType::ONE_FRAME) {
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
const int32 deltaT = _engine->_lbaTime - extra->spawnTime;
if (extra->type & ExtraType::EXPLOSION) {
- extra->info0 = _engine->_collision->getAverageValue(SPRITEHQR_EXPLOSION_FIRST_FRAME, 100, 30, deltaT);
+ extra->sprite = _engine->_collision->getAverageValue(SPRITEHQR_EXPLOSION_FIRST_FRAME, 100, 30, deltaT);
continue;
}
// process extra moving
@@ -567,21 +567,22 @@ void Extra::processExtras() {
if (i == _engine->_gameState->_magicBallIdx) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
- if (extra->info0 == SPRITEHQR_MAGICBALL_GREEN) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
spriteIdx = SPRITEHQR_MAGICBALL_GREEN_TRANS;
}
- if (extra->info0 == SPRITEHQR_MAGICBALL_RED) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_RED) {
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
+ _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z,
+ spriteIdx, OWN_ACTOR_SCENE_INDEX, 10000, 0);
}
// if can take extra on ground
if (extra->type & ExtraType::TAKABLE) {
extra->type &= ~(ExtraType::FLY | ExtraType::STOP_COL);
} else {
- extra->info0 = -1;
+ extra->sprite = -1;
}
continue;
@@ -609,14 +610,14 @@ void Extra::processExtras() {
if (angle > ANGLE_140 && angle < ANGLE_210) {
if (extra->strengthOfHit) {
- _engine->_actor->hitActor(actorIdx, actorIdxAttacked, extra->strengthOfHit, -1);
+ _engine->_actor->hitObj(actorIdx, actorIdxAttacked, extra->strengthOfHit, -1);
}
if (i == _engine->_gameState->_magicBallIdx) {
_engine->_gameState->_magicBallIdx = -1;
}
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
@@ -635,12 +636,12 @@ void Extra::processExtras() {
_engine->_movements->setActorAngle(ANGLE_0, extra->destPos.z, ANGLE_17, &extra->trackActorMove);
- if (actorIdxAttacked == _engine->_collision->checkExtraCollisionWithActors(extra, actorIdx)) {
+ if (actorIdxAttacked == _engine->_collision->extraCheckObjCol(extra, actorIdx)) {
if (i == _engine->_gameState->_magicBallIdx) {
_engine->_gameState->_magicBallIdx = -1;
}
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
}
@@ -663,9 +664,9 @@ void Extra::processExtras() {
_engine->_redraw->addOverlay(OverlayType::koSprite, SPRITEHQR_KEY, 10, 30, 0, OverlayPosType::koNormal, 2);
_engine->_gameState->addKeys(extraKey->info1);
- extraKey->info0 = -1;
+ extraKey->sprite = -1;
- extra->info0 = -1;
+ extra->sprite = -1;
_engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, SPRITEHQR_KEY, 0, 8000, 0);
continue;
}
@@ -685,7 +686,7 @@ void Extra::processExtras() {
_engine->_movements->setActorAngle(ANGLE_0, extra->destPos.z, ANGLE_17, &extra->trackActorMove);
- if (extraIdx == _engine->_collision->checkExtraCollisionWithExtra(extra, _engine->_gameState->_magicBallIdx)) {
+ if (extraIdx == _engine->_collision->extraCheckExtraCol(extra, _engine->_gameState->_magicBallIdx)) {
_engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->pos(), OWN_ACTOR_SCENE_INDEX);
if (extraKey->info1 > 1) {
@@ -696,56 +697,58 @@ void Extra::processExtras() {
_engine->_redraw->addOverlay(OverlayType::koSprite, SPRITEHQR_KEY, 10, 30, 0, OverlayPosType::koNormal, 2);
_engine->_gameState->addKeys(extraKey->info1);
- extraKey->info0 = -1;
+ extraKey->sprite = -1;
- extra->info0 = -1;
+ extra->sprite = -1;
_engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, SPRITEHQR_KEY, 0, 8000, 0);
continue;
}
- if (extraKey->info0 == -1) {
+ if (extraKey->sprite == -1) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
- if (extra->info0 == SPRITEHQR_MAGICBALL_GREEN) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
spriteIdx = SPRITEHQR_MAGICBALL_GREEN_TRANS;
}
- if (extra->info0 == SPRITEHQR_MAGICBALL_RED) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_RED) {
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- extra->info0 = -1;
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 8000, 0);
+ extra->sprite = -1;
+ _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z,
+ spriteIdx, 0, 8000, 0);
continue;
}
}
// process extra collision with actors
if (extra->type & ExtraType::END_OBJ) {
- if (_engine->_collision->checkExtraCollisionWithActors(extra, extra->payload.actorIdx) != -1) {
+ if (_engine->_collision->extraCheckObjCol(extra, extra->payload.actorIdx) != -1) {
// if extra is Magic Ball
if (i == _engine->_gameState->_magicBallIdx) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
- if (extra->info0 == SPRITEHQR_MAGICBALL_GREEN) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
spriteIdx = SPRITEHQR_MAGICBALL_GREEN_TRANS;
}
- if (extra->info0 == SPRITEHQR_MAGICBALL_RED) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_RED) {
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
- _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
+ _engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z,
+ spriteIdx, 0, 10000, 0);
}
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
}
// process extra collision with scene ground
if (extra->type & ExtraType::END_COL) {
- bool process = false;
+ bool flagcol = false;
- if (_engine->_collision->checkExtraCollisionWithBricks(currentExtraX, currentExtraY, currentExtraZ, extra->pos)) {
+ if (_engine->_collision->fullWorldColBrick(currentExtraX, currentExtraY, currentExtraZ, extra->pos)) {
// if not touch the ground
if (!(extra->type & ExtraType::WAIT_NO_COL)) {
- process = true;
+ flagcol = true;
}
} else {
// if touch the ground
@@ -754,10 +757,10 @@ void Extra::processExtras() {
}
}
- if (process) {
+ if (flagcol) {
// show explode cloud
if (extra->type & ExtraType::IMPACT) {
- addExtraSpecial(currentExtraX, currentExtraY, currentExtraZ, ExtraSpecialType::kExplodeCloud);
+ initSpecial(currentExtraX, currentExtraY, currentExtraZ, ExtraSpecialType::kExplodeCloud);
}
// if extra is magic ball
if (i == _engine->_gameState->_magicBallIdx) {
@@ -767,16 +770,16 @@ void Extra::processExtras() {
if (_engine->_gameState->_magicBallNumBounce <= 0) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
- if (extra->info0 == SPRITEHQR_MAGICBALL_GREEN) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
spriteIdx = SPRITEHQR_MAGICBALL_GREEN_TRANS;
}
- if (extra->info0 == SPRITEHQR_MAGICBALL_RED) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_RED) {
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
_engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
@@ -785,22 +788,22 @@ void Extra::processExtras() {
if (!_engine->_gameState->_magicBallAuxBounce--) {
int32 spriteIdx = SPRITEHQR_MAGICBALL_YELLOW_TRANS;
- if (extra->info0 == SPRITEHQR_MAGICBALL_GREEN) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_GREEN) {
spriteIdx = SPRITEHQR_MAGICBALL_GREEN_TRANS;
}
- if (extra->info0 == SPRITEHQR_MAGICBALL_RED) {
+ if (extra->sprite == SPRITEHQR_MAGICBALL_RED) {
spriteIdx = SPRITEHQR_MAGICBALL_RED_TRANS;
}
_engine->_gameState->_magicBallIdx = addExtra(-1, extra->pos.x, extra->pos.y, extra->pos.z, spriteIdx, 0, 10000, 0);
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
- processMagicballBounce(extra, currentExtraX, currentExtraY, currentExtraZ);
+ bounceExtra(extra, currentExtraX, currentExtraY, currentExtraZ);
}
} else {
- extra->info0 = -1;
+ extra->sprite = -1;
continue;
}
}
@@ -809,7 +812,7 @@ void Extra::processExtras() {
if (extra->type & ExtraType::STOP_COL) {
bool process = false;
- if (_engine->_collision->checkExtraCollisionWithBricks(currentExtraX, currentExtraY, currentExtraZ, extra->pos)) {
+ if (_engine->_collision->fullWorldColBrick(currentExtraX, currentExtraY, currentExtraZ, extra->pos)) {
// if not touch the ground
if (!(extra->type & ExtraType::WAIT_NO_COL)) {
process = true;
@@ -822,8 +825,8 @@ void Extra::processExtras() {
}
if (process) {
- const BoundingBox *bbox = _engine->_resources->_spriteBoundingBox.bbox(extra->info0);
- extra->pos.y = (_engine->_collision->_collision.y * BRICK_HEIGHT) + BRICK_HEIGHT - bbox->mins.y;
+ const BoundingBox *bbox = _engine->_resources->_spriteBoundingBox.bbox(extra->sprite);
+ extra->pos.y = (_engine->_collision->_collision.y * SIZE_BRICK_Y) + SIZE_BRICK_Y - bbox->mins.y;
extra->type &= ~(ExtraType::STOP_COL | ExtraType::FLY);
continue;
}
@@ -831,7 +834,7 @@ void Extra::processExtras() {
// get extras on ground
if ((extra->type & ExtraType::TAKABLE) && !(extra->type & ExtraType::FLY)) {
// if hero touch extra
- if (_engine->_collision->checkExtraCollisionWithActors(extra, -1) == 0) {
+ if (_engine->_collision->extraCheckObjCol(extra, -1) == 0) {
_engine->_sound->playSample(Samples::ItemFound, 1, extra->pos);
const IVec3 &projPos = _engine->_renderer->_projPos;
@@ -841,21 +844,21 @@ void Extra::processExtras() {
_engine->_redraw->addOverlay(OverlayType::koNumber, extra->info1, projPos.x, projPos.y, fontColor, OverlayPosType::koNormal, 2);
}
- _engine->_redraw->addOverlay(OverlayType::koSprite, extra->info0, 10, 30, 0, OverlayPosType::koNormal, 2);
+ _engine->_redraw->addOverlay(OverlayType::koSprite, extra->sprite, 10, 30, 0, OverlayPosType::koNormal, 2);
- if (extra->info0 == SPRITEHQR_KASHES) {
+ if (extra->sprite == SPRITEHQR_KASHES) {
_engine->_gameState->addKashes(extra->info1);
- } else if (extra->info0 == SPRITEHQR_LIFEPOINTS) {
+ } else if (extra->sprite == SPRITEHQR_LIFEPOINTS) {
_engine->_scene->_sceneHero->addLife(extra->info1);
- } else if (extra->info0 == SPRITEHQR_MAGICPOINTS && _engine->_gameState->_magicLevelIdx) {
+ } else if (extra->sprite == SPRITEHQR_MAGICPOINTS && _engine->_gameState->_magicLevelIdx) {
_engine->_gameState->addMagicPoints(extra->info1 * 2);
- } else if (extra->info0 == SPRITEHQR_KEY) {
+ } else if (extra->sprite == SPRITEHQR_KEY) {
_engine->_gameState->addKeys(extra->info1);
- } else if (extra->info0 == SPRITEHQR_CLOVERLEAF) {
+ } else if (extra->sprite == SPRITEHQR_CLOVERLEAF) {
_engine->_gameState->addLeafs(extra->info1);
}
- extra->info0 = -1;
+ extra->sprite = -1;
}
}
}
diff --git a/engines/twine/scene/extra.h b/engines/twine/scene/extra.h
index d6a6d7b83b5..03dd3fe8d3d 100644
--- a/engines/twine/scene/extra.h
+++ b/engines/twine/scene/extra.h
@@ -62,7 +62,7 @@ enum ExtraType {
};
struct ExtraListStruct {
- int16 info0 = 0; /**< a value of -1 indicates that this instance is free to use */
+ int16 sprite = 0; /**< a value of -1 indicates that this instance is free to use */
IVec3 pos;
IVec3 lastPos;
IVec3 destPos;
@@ -89,7 +89,7 @@ private:
TwinEEngine *_engine;
void throwExtra(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle);
- void processMagicballBounce(ExtraListStruct *extra, int32 x, int32 y, int32 z);
+ void bounceExtra(ExtraListStruct *extra, int32 x, int32 y, int32 z);
int32 findExtraKey() const;
int32 addExtraAimingAtKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx);
void drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size, Common::Rect &renderRect);
@@ -115,7 +115,7 @@ public:
/** Reset all used extras */
void resetExtras();
- int32 addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type);
+ int32 initSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type);
int32 addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle, int32 type, int32 bonusAmount);
inline int32 addExtraBonus(const IVec3 &pos, int32 xAngle, int32 yAngle, int32 type, int32 bonusAmount) {
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 1aa230e5112..d5b0bbbd746 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -110,9 +110,9 @@ void GameState::initEngineVars() {
initGameStateVars();
initHeroVars();
- _engine->_scene->_newHeroPos.x = 16 * BRICK_SIZE;
- _engine->_scene->_newHeroPos.y = 24 * BRICK_HEIGHT;
- _engine->_scene->_newHeroPos.z = 16 * BRICK_SIZE;
+ _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->_currentSceneIdx = SCENE_CEILING_GRID_FADE_1;
_engine->_scene->_needChangeScene = LBA1SceneId::Citadel_Island_Prison;
@@ -316,9 +316,9 @@ void GameState::processFoundItem(InventoryItems item) {
_engine->saveFrontBuffer();
IVec3 itemCamera;
- itemCamera.x = _engine->_grid->_newCamera.x * BRICK_SIZE;
- itemCamera.y = _engine->_grid->_newCamera.y * BRICK_HEIGHT;
- itemCamera.z = _engine->_grid->_newCamera.z * BRICK_SIZE;
+ itemCamera.x = _engine->_grid->_newCamera.x * SIZE_BRICK_XZ;
+ itemCamera.y = _engine->_grid->_newCamera.y * SIZE_BRICK_Y;
+ itemCamera.z = _engine->_grid->_newCamera.z * SIZE_BRICK_XZ;
BodyData &bodyData = _engine->_resources->_bodyData[_engine->_scene->_sceneHero->_body];
const IVec3 bodyPos = _engine->_scene->_sceneHero->_pos - itemCamera;
@@ -326,12 +326,12 @@ void GameState::processFoundItem(InventoryItems item) {
_engine->_renderer->renderIsoModel(bodyPos, ANGLE_0, ANGLE_45, ANGLE_0, bodyData, modelRect);
_engine->_interface->setClip(modelRect);
- const int32 itemX = (_engine->_scene->_sceneHero->_pos.x + BRICK_HEIGHT) / BRICK_SIZE;
- int32 itemY = _engine->_scene->_sceneHero->_pos.y / BRICK_HEIGHT;
+ const int32 itemX = (_engine->_scene->_sceneHero->_pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ int32 itemY = _engine->_scene->_sceneHero->_pos.y / SIZE_BRICK_Y;
if (_engine->_scene->_sceneHero->brickShape() != ShapeType::kNone) {
itemY++;
}
- const int32 itemZ = (_engine->_scene->_sceneHero->_pos.z + BRICK_HEIGHT) / BRICK_SIZE;
+ const int32 itemZ = (_engine->_scene->_sceneHero->_pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_engine->_grid->drawOverModelActor(itemX, itemY, itemZ);
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index a8304a68ca9..d62ba879ee4 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -40,7 +40,7 @@
namespace TwinE {
Grid::Grid(TwinEEngine *engine) : _engine(engine) {
- _blockBufferSize = GRID_SIZE_X * GRID_SIZE_Z * GRID_SIZE_Y * sizeof(BlockEntry);
+ _blockBufferSize = SIZE_CUBE_X * SIZE_CUBE_Z * SIZE_CUBE_Y * sizeof(BlockEntry);
_blockBuffer = (uint8 *)malloc(_blockBufferSize);
}
@@ -395,13 +395,13 @@ void Grid::createCellingGridColumn(const uint8 *gridEntry, uint32 gridEntrySize,
void Grid::createGridMap() {
int32 blockOffset = 0;
- for (int32 z = 0; z < GRID_SIZE_Z; z++) {
- const int32 gridIdx = z * GRID_SIZE_X;
+ for (int32 z = 0; z < SIZE_CUBE_Z; z++) {
+ const int32 gridIdx = z * SIZE_CUBE_X;
- for (int32 x = 0; x < GRID_SIZE_X; x++) {
+ for (int32 x = 0; x < SIZE_CUBE_X; x++) {
const int32 gridOffset = READ_LE_UINT16(_currentGrid + 2 * (x + gridIdx));
createGridColumn(_currentGrid + gridOffset, _currentGridSize - gridOffset, _blockBuffer + blockOffset, _blockBufferSize - blockOffset);
- blockOffset += 2 * GRID_SIZE_Y;
+ blockOffset += 2 * SIZE_CUBE_Y;
}
}
}
@@ -410,16 +410,16 @@ void Grid::createCellingGridMap(const uint8 *gridPtr, int32 gridPtrSize) {
int32 currGridOffset = 0;
int32 blockOffset = 0;
- for (int32 z = 0; z < GRID_SIZE_Z; z++) {
+ for (int32 z = 0; z < SIZE_CUBE_Z; z++) {
const uint8 *tempGridPtr = gridPtr + currGridOffset;
- for (int32 x = 0; x < GRID_SIZE_X; x++) {
+ for (int32 x = 0; x < SIZE_CUBE_X; x++) {
const int gridOffset = READ_LE_UINT16(tempGridPtr);
tempGridPtr += 2;
createCellingGridColumn(gridPtr + gridOffset, gridPtrSize - gridOffset, _blockBuffer + blockOffset, _blockBufferSize - blockOffset);
- blockOffset += 2 * GRID_SIZE_Y;
+ blockOffset += 2 * SIZE_CUBE_Y;
}
- currGridOffset += GRID_SIZE_X + GRID_SIZE_Z;
+ currGridOffset += SIZE_CUBE_X + SIZE_CUBE_Z;
}
}
@@ -584,9 +584,9 @@ bool Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, const uint8 *ptr
const uint8 *Grid::getBlockBufferGround(const IVec3 &pos, int32 &ground) {
const IVec3 &collision = updateCollisionCoordinates(pos.x, pos.y, pos.z);
const uint8 *ptr = _blockBuffer
- + collision.y * sizeof(int16)
- + collision.x * GRID_SIZE_Y * sizeof(int16)
- + collision.z * GRID_SIZE_X * GRID_SIZE_Y * sizeof(int16);
+ + collision.y * 2
+ + collision.x * SIZE_CUBE_Y * 2
+ + collision.z * SIZE_CUBE_X * SIZE_CUBE_Y * 2;
int32 collisionY = collision.y;
while (collisionY) {
@@ -598,7 +598,7 @@ const uint8 *Grid::getBlockBufferGround(const IVec3 &pos, int32 &ground) {
}
_engine->_collision->_collision.y = collisionY;
- ground = (int16)((collisionY + 1) * BRICK_HEIGHT);
+ ground = (int16)((collisionY + 1) * SIZE_BRICK_Y);
return ptr;
}
@@ -613,11 +613,11 @@ const BlockData *Grid::getBlockLibrary(int32 blockIdx) const {
}
void Grid::getBrickPos(int32 x, int32 y, int32 z, int32 &posx, int32 &posy) const {
- posx = (x - z) * 24 + _engine->width() / 2 - GRID_SIZE_X / 2;
- posy = ((x + z) * 12) - (y * 15) + _engine->height() / 2 - GRID_SIZE_Y;
+ posx = (x - z) * 24 + _engine->width() / 2 - SIZE_CUBE_X / 2;
+ posy = ((x + z) * 12) - (y * 15) + _engine->height() / 2 - SIZE_CUBE_Y;
}
-void Grid::drawColumnGrid(int32 blockIdx, int32 brickBlockIdx, int32 x, int32 y, int32 z) {
+void Grid::drawColumnGrid(int32 blockIdx, int32 brickBlockIdx, int32 x, int32 y, int32 z) { // AffBrickBlock
const BlockDataEntry *blockPtr = getBlockPointer(blockIdx, brickBlockIdx);
const uint8 brickShape = blockPtr->brickShape;
const uint8 brickSound = blockPtr->brickType;
@@ -668,10 +668,10 @@ void Grid::drawColumnGrid(int32 blockIdx, int32 brickBlockIdx, int32 x, int32 y,
_brickInfoBuffer[brickBuffIdx]++;
}
-void Grid::redrawGrid() {
- _camera.x = _newCamera.x * BRICK_SIZE;
- _camera.y = _newCamera.y * BRICK_HEIGHT;
- _camera.z = _newCamera.z * BRICK_SIZE;
+void Grid::redrawGrid() { // AffGrille
+ _camera.x = _newCamera.x * SIZE_BRICK_XZ;
+ _camera.y = _newCamera.y * SIZE_BRICK_Y;
+ _camera.z = _newCamera.z * SIZE_BRICK_XZ;
memset(_brickInfoBuffer, 0, _brickInfoBufferSize);
@@ -679,9 +679,9 @@ void Grid::redrawGrid() {
return;
}
- for (int32 z = 0; z < GRID_SIZE_Z; z++) {
- for (int32 x = 0; x < GRID_SIZE_X; x++) {
- for (int32 y = 0; y < GRID_SIZE_Y; y++) {
+ for (int32 z = 0; z < SIZE_CUBE_Z; z++) {
+ for (int32 x = 0; x < SIZE_CUBE_X; x++) {
+ for (int32 y = 0; y < SIZE_CUBE_Y; y++) {
const BlockEntry entry = getBlockEntry(x, y, z);
if (entry.blockIdx) {
drawColumnGrid(entry.blockIdx, entry.brickBlockIdx, x, y, z);
@@ -693,9 +693,9 @@ void Grid::redrawGrid() {
BlockEntry Grid::getBlockEntry(int32 x, int32 y, int32 z) const {
const uint8 *blockBufferPtr = _blockBuffer;
- blockBufferPtr += x * GRID_SIZE_Y * 2;
+ blockBufferPtr += x * SIZE_CUBE_Y * 2;
blockBufferPtr += y * 2;
- blockBufferPtr += (z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
+ blockBufferPtr += (z * SIZE_CUBE_X * 2) * SIZE_CUBE_Y;
BlockEntry entry;
entry.blockIdx = *blockBufferPtr;
@@ -706,7 +706,7 @@ BlockEntry Grid::getBlockEntry(int32 x, int32 y, int32 z) const {
ShapeType Grid::worldColBrick(int32 x, int32 y, int32 z) {
const IVec3 &collision = updateCollisionCoordinates(x, y, z);
- if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
+ if (collision.x < 0 || collision.x >= SIZE_CUBE_X) {
return ShapeType::kNone;
}
@@ -714,7 +714,7 @@ ShapeType Grid::worldColBrick(int32 x, int32 y, int32 z) {
return ShapeType::kSolid;
}
- if (collision.y < 0 || collision.y >= GRID_SIZE_Y || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
+ if (collision.y < 0 || collision.y >= SIZE_CUBE_Y || collision.z < 0 || collision.z >= SIZE_CUBE_Z) {
return ShapeType::kNone;
}
@@ -727,9 +727,9 @@ ShapeType Grid::worldColBrick(int32 x, int32 y, int32 z) {
}
const IVec3 &Grid::updateCollisionCoordinates(int32 x, int32 y, int32 z) {
- _engine->_collision->_collision.x = (x + BRICK_HEIGHT) / BRICK_SIZE;
- _engine->_collision->_collision.y = y / BRICK_HEIGHT;
- _engine->_collision->_collision.z = (z + BRICK_HEIGHT) / BRICK_SIZE;
+ _engine->_collision->_collision.x = (x + DEMI_BRICK_XZ) / SIZE_BRICK_XZ;
+ _engine->_collision->_collision.y = y / SIZE_BRICK_Y;
+ _engine->_collision->_collision.z = (z + DEMI_BRICK_XZ) / SIZE_BRICK_XZ;
return _engine->_collision->_collision;
}
@@ -740,14 +740,14 @@ ShapeType Grid::fullWorldColBrick(int32 x, int32 y, int32 z, int32 y2) {
return ShapeType::kSolid;
}
- if (collision.x < 0 || collision.x >= GRID_SIZE_X || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
+ if (collision.x < 0 || collision.x >= SIZE_CUBE_X || collision.z < 0 || collision.z >= SIZE_CUBE_Z) {
return ShapeType::kNone;
}
uint8 *pCube = _blockBuffer;
- pCube += collision.x * GRID_SIZE_Y * 2;
+ pCube += collision.x * SIZE_CUBE_Y * 2;
pCube += collision.y * 2;
- pCube += collision.z * (GRID_SIZE_X * GRID_SIZE_Y * 2);
+ pCube += collision.z * (SIZE_CUBE_X * SIZE_CUBE_Y * 2);
uint8 block = *pCube;
@@ -760,9 +760,9 @@ ShapeType Grid::fullWorldColBrick(int32 x, int32 y, int32 z, int32 y2) {
brickShape = (ShapeType) * (pCube + 1);
}
- int32 ymax = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
+ int32 ymax = (y2 + (SIZE_BRICK_Y - 1)) / SIZE_BRICK_Y;
// check full height
- for (y = collision.y; ymax > 0 && y < (GRID_SIZE_Y - 1); --ymax, y++) {
+ for (y = collision.y; ymax > 0 && y < (SIZE_CUBE_Y - 1); --ymax, y++) {
pCube += 2;
if (READ_LE_INT16(pCube)) {
return ShapeType::kSolid;
@@ -775,7 +775,7 @@ ShapeType Grid::fullWorldColBrick(int32 x, int32 y, int32 z, int32 y2) {
uint8 Grid::worldCodeBrick(int32 x, int32 y, int32 z) {
const IVec3 &collision = updateCollisionCoordinates(x, y, z);
- if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
+ if (collision.x < 0 || collision.x >= SIZE_CUBE_X) {
return 0; // none
}
@@ -783,7 +783,7 @@ uint8 Grid::worldCodeBrick(int32 x, int32 y, int32 z) {
return 1; // solid
}
- if (collision.y < 0 || collision.y >= GRID_SIZE_Y || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
+ if (collision.y < 0 || collision.y >= SIZE_CUBE_Y || collision.z < 0 || collision.z >= SIZE_CUBE_Z) {
return 0; // none
}
@@ -797,9 +797,9 @@ uint8 Grid::worldCodeBrick(int32 x, int32 y, int32 z) {
}
void Grid::centerOnActor(const ActorStruct* actor) {
- _newCamera.x = (actor->_pos.x + BRICK_HEIGHT) / BRICK_SIZE;
- _newCamera.y = (actor->_pos.y + BRICK_HEIGHT) / BRICK_HEIGHT;
- _newCamera.z = (actor->_pos.z + BRICK_HEIGHT) / BRICK_SIZE;
+ _newCamera.x = (actor->_pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+ _newCamera.y = (actor->_pos.y + SIZE_BRICK_Y) / SIZE_BRICK_Y;
+ _newCamera.z = (actor->_pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
_engine->_redraw->_reqBgRedraw = true;
}
@@ -812,21 +812,21 @@ void Grid::centerScreenOnActor() {
}
ActorStruct *actor = _engine->_scene->getActor(_engine->_scene->_currentlyFollowedActor);
- _engine->_renderer->projectPositionOnScreen(actor->_pos.x - (_newCamera.x * BRICK_SIZE),
- actor->_pos.y - (_newCamera.y * BRICK_HEIGHT),
- actor->_pos.z - (_newCamera.z * BRICK_SIZE));
+ _engine->_renderer->projectPositionOnScreen(actor->_pos.x - (_newCamera.x * SIZE_BRICK_XZ),
+ actor->_pos.y - (_newCamera.y * SIZE_BRICK_Y),
+ actor->_pos.z - (_newCamera.z * SIZE_BRICK_XZ));
// TODO: these border values should get scaled for higher resolutions
if (_engine->_renderer->_projPos.x < 80 || _engine->_renderer->_projPos.x >= _engine->width() - 60 || _engine->_renderer->_projPos.y < 80 || _engine->_renderer->_projPos.y >= _engine->height() - 50) {
- _newCamera.x = ((actor->_pos.x + BRICK_HEIGHT) / BRICK_SIZE) + (((actor->_pos.x + BRICK_HEIGHT) / BRICK_SIZE) - _newCamera.x) / 2;
- _newCamera.y = actor->_pos.y / BRICK_HEIGHT;
- _newCamera.z = ((actor->_pos.z + BRICK_HEIGHT) / BRICK_SIZE) + (((actor->_pos.z + BRICK_HEIGHT) / BRICK_SIZE) - _newCamera.z) / 2;
+ _newCamera.x = ((actor->_pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ) + (((actor->_pos.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ) - _newCamera.x) / 2;
+ _newCamera.y = actor->_pos.y / SIZE_BRICK_Y;
+ _newCamera.z = ((actor->_pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ) + (((actor->_pos.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ) - _newCamera.z) / 2;
- if (_newCamera.x >= GRID_SIZE_X) {
- _newCamera.x = GRID_SIZE_X - 1;
+ if (_newCamera.x >= SIZE_CUBE_X) {
+ _newCamera.x = SIZE_CUBE_X - 1;
}
- if (_newCamera.z >= GRID_SIZE_Z) {
- _newCamera.z = GRID_SIZE_Z - 1;
+ if (_newCamera.z >= SIZE_CUBE_Z) {
+ _newCamera.z = SIZE_CUBE_Z - 1;
}
_engine->_redraw->_reqBgRedraw = true;
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index 66687809eac..96574d1b0cc 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -67,27 +67,26 @@ struct BrickEntry {
/** Total number of bricks allowed in the game */
#define NUM_BRICKS 9000
-/** Grip X size */
-#define GRID_SIZE_X 64
-/** Grip Y size */
-#define GRID_SIZE_Y 25
-/** Grip Z size */
-#define GRID_SIZE_Z GRID_SIZE_X
+/** Grid X size */
+#define SIZE_CUBE_X 64
+/** Grid Y size */
+#define SIZE_CUBE_Y 25
+/** Grid Z size */
+#define SIZE_CUBE_Z SIZE_CUBE_X
#define ISO_SCALE 512
-// xz
-#define BRICK_SIZE 512
-// y
-#define BRICK_HEIGHT 256
-
+#define SIZE_BRICK_XZ 512
+#define SIZE_BRICK_Y 256
+#define DEMI_BRICK_XZ 256
+#define DEMI_BRICK_Y 128
// short max 32767 0x7FFF
// 32256 0x7E00
// 32000 0x7D00
-#define SCENE_SIZE_MAX (BRICK_SIZE * (GRID_SIZE_X - 1))
+#define SCENE_SIZE_MAX (SIZE_BRICK_XZ * (SIZE_CUBE_X - 1))
// 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)
+#define SCENE_SIZE_MIN (-SIZE_BRICK_XZ * SIZE_CUBE_X)
+#define SCENE_SIZE_HALF (SIZE_BRICK_XZ * SIZE_CUBE_X / 2)
+#define SCENE_SIZE_HALFF (SIZE_BRICK_XZ * SIZE_CUBE_X / 2.0f)
#define MAXBRICKS 150
@@ -196,7 +195,7 @@ public:
IVec3 _newCamera;
/** Current grid camera x, y and z coordinates */
- IVec3 _camera;
+ IVec3 _camera; // WorldXCube WorldYCube
/** Flag to know if the engine is using celling grids */
int16 _useCellingGrid = 0;
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 6c9d29842d9..547703642df 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -37,7 +37,7 @@ namespace TwinE {
Movements::Movements(TwinEEngine *engine) : _engine(engine) {}
-IVec3 Movements::getShadowPosition(const IVec3 &pos) {
+IVec3 Movements::getShadowPosition(const IVec3 &pos) { // GetShadow
IVec3 shadowCoord;
const uint8 *ptr = _engine->_grid->getBlockBufferGround(pos, shadowCoord.y);
shadowCoord.x = pos.x;
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index ec6427e57a7..f1430e5ca9b 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -778,7 +778,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
destPos.z += actor->_processActor.z;
if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= SCENE_SIZE_MAX && destPos.z <= SCENE_SIZE_MAX) {
- if (_engine->_grid->worldColBrick(destPos.x, actor->_pos.y + BRICK_HEIGHT, destPos.z) != ShapeType::kNone) {
+ if (_engine->_grid->worldColBrick(destPos.x, actor->_pos.y + SIZE_BRICK_Y, destPos.z) != ShapeType::kNone) {
_currentActorInZone = true;
if (actor->_pos.y >= ABS(zone->mins.y + zone->maxs.y) / 2) {
_engine->_animations->initAnim(AnimationTypes::kTopLadder, AnimType::kAnimationAllThen, AnimationTypes::kStanding, actorIdx); // reached end of ladder
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 36ff9358350..ef26f6eec37 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1308,7 +1308,7 @@ static int32 lHIT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
const int32 otherActorIdx = ctx.stream.readByte();
const int32 strengthOfHit = ctx.stream.readByte();
debugC(3, kDebugLevels::kDebugScripts, "LIFE::HIT_OBJ(%i, %i)", (int)otherActorIdx, (int)strengthOfHit);
- engine->_actor->hitActor(ctx.actorIdx, otherActorIdx, strengthOfHit, engine->_scene->getActor(otherActorIdx)->_angle);
+ engine->_actor->hitObj(ctx.actorIdx, otherActorIdx, strengthOfHit, engine->_scene->getActor(otherActorIdx)->_angle);
return 0;
}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index c47d7172b5e..8db49789640 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -712,7 +712,7 @@ void TwinEEngine::processInventoryAction() {
penguin->_angle = _scene->_sceneHero->_angle;
- if (!_collision->checkCollisionWithActors(_scene->_mecaPenguinIdx)) {
+ if (!_collision->checkObjCol(_scene->_mecaPenguinIdx)) {
penguin->setLife(kActorMaxLife);
penguin->_genBody = BodyType::btNone;
_actor->initModelActor(BodyType::btNormal, _scene->_mecaPenguinIdx);
More information about the Scummvm-git-logs
mailing list