[Scummvm-git-logs] scummvm master -> 29319ce443d87fb712ef20faa7334d39e9866e34
mgerhardy
noreply at scummvm.org
Sun Jul 24 17:45:49 UTC 2022
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8207a8d570 TWINE: unified with original sources
cd7e3ec6e4 TWINE: renamed method to match original sources
99164665ba TWINE: fixed using the wrong penguin angle
8d3e9d6a75 TWINE: minor comment
f4713ad9f5 TWINE: original source code Box function performs clipping here
c3993fe6e7 TWINE: removed unused members
02c9f13f8a TWINE: renamed variable to match original sources
29319ce443 TWINE: added original function name
Commit: 8207a8d5709240c11a34191fc73bbc7d25dde271
https://github.com/scummvm/scummvm/commit/8207a8d5709240c11a34191fc73bbc7d25dde271
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:05:08+02:00
Commit Message:
TWINE: unified with original sources
Changed paths:
engines/twine/scene/movements.cpp
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 241ac87d957..977bffce3cf 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -141,10 +141,13 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
}
IVec3 Movements::rotateActor(int32 x, int32 z, int32 angle) {
- const double radians = AngleToRadians(angle);
- const int32 vx = (int32)(x * cos(radians) + z * sin(radians));
- const int32 vz = (int32)(-x * sin(radians) + z * cos(radians));
- return IVec3(vx, 0, vz);
+ if (angle) {
+ const double radians = AngleToRadians(angle);
+ const int32 vx = (int32)(x * cos(radians) + z * sin(radians));
+ const int32 vz = (int32)(z * cos(radians) - x * sin(radians));
+ return IVec3(vx, 0, vz);
+ }
+ return IVec3(x, 0, z);
}
void Movements::moveActor(int32 angleFrom, int32 angleTo, int32 speed, ActorMoveStruct *movePtr) const { // ManualRealAngle
Commit: cd7e3ec6e4c3b4958ed25bb4b3810bfad952057c
https://github.com/scummvm/scummvm/commit/cd7e3ec6e4c3b4958ed25bb4b3810bfad952057c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:05:36+02:00
Commit Message:
TWINE: renamed method to match original sources
Changed paths:
engines/twine/scene/movements.cpp
engines/twine/scene/movements.h
engines/twine/script/script_move_v1.cpp
engines/twine/twine.cpp
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 977bffce3cf..bc4ee6e2fbc 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -150,18 +150,18 @@ IVec3 Movements::rotateActor(int32 x, int32 z, int32 angle) {
return IVec3(x, 0, z);
}
-void Movements::moveActor(int32 angleFrom, int32 angleTo, int32 speed, ActorMoveStruct *movePtr) const { // ManualRealAngle
- const int16 from = ClampAngle(angleFrom);
- const int16 to = ClampAngle(angleTo);
+void Movements::initRealAngleConst(int32 start, int32 end, int32 duration, ActorMoveStruct *movePtr) const { // ManualRealAngle
+ const int16 cstart = ClampAngle(start);
+ const int16 cend = ClampAngle(end);
- movePtr->from = from;
- movePtr->to = to;
+ movePtr->from = cstart;
+ movePtr->to = cend;
- const int16 numOfStep = (from - to) * 64;
+ const int16 numOfStep = (cstart - cend) * 64;
int32 numOfStepInt = ABS(numOfStep);
numOfStepInt /= 64;
- numOfStepInt *= speed;
+ numOfStepInt *= duration;
numOfStepInt /= 256;
movePtr->numOfStep = (int16)numOfStepInt;
@@ -361,7 +361,7 @@ void Movements::processManualRotationExecution(int actorIdx) {
tempAngle = ANGLE_0;
}
- moveActor(actor->_angle, actor->_angle + tempAngle, actor->_speed, &actor->_move);
+ initRealAngleConst(actor->_angle, actor->_angle + tempAngle, actor->_speed, &actor->_move);
}
void Movements::processManualAction(int actorIdx) {
@@ -389,7 +389,7 @@ void Movements::processFollowAction(int actorIdx) {
if (actor->_staticFlags.bIsSpriteActor) {
actor->_angle = newAngle;
} else {
- moveActor(actor->_angle, newAngle, actor->_speed, &actor->_move);
+ initRealAngleConst(actor->_angle, newAngle, actor->_speed, &actor->_move);
}
}
@@ -401,7 +401,7 @@ void Movements::processRandomAction(int actorIdx) {
if (actor->brickCausesDamage()) {
const int32 angle = ClampAngle(actor->_angle + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90 + ANGLE_180);
- moveActor(actor->_angle, angle, actor->_speed, &actor->_move);
+ initRealAngleConst(actor->_angle, angle, actor->_speed, &actor->_move);
actor->_delayInMillis = _engine->getRandomNumber(300) + _engine->_lbaTime + 300;
_engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
}
@@ -410,7 +410,7 @@ void Movements::processRandomAction(int actorIdx) {
_engine->_animations->initAnim(AnimationTypes::kForward, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
if (_engine->_lbaTime > actor->_delayInMillis) {
const int32 angle = ClampAngle(actor->_angle + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90);
- moveActor(actor->_angle, angle, actor->_speed, &actor->_move);
+ initRealAngleConst(actor->_angle, angle, actor->_speed, &actor->_move);
actor->_delayInMillis = _engine->getRandomNumber(300) + _engine->_lbaTime + 300;
}
}
@@ -448,7 +448,7 @@ void Movements::processActorMovements(int32 actorIdx) {
tempAngle = -ANGLE_90;
}
- moveActor(actor->_angle, actor->_angle + tempAngle, actor->_speed, &actor->_move);
+ initRealAngleConst(actor->_angle, actor->_angle + tempAngle, actor->_speed, &actor->_move);
return;
}
if (!actor->_staticFlags.bIsSpriteActor) {
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index 363c21c9497..a82f706aaa2 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -182,12 +182,12 @@ public:
/**
* Move actor around the scene
- * @param angleFrom Current actor angle
- * @param angleTo Angle to rotate
- * @param speed Rotate speed
+ * @param start Current actor angle
+ * @param end Angle to rotate
+ * @param duration Rotate speed
* @param movePtr Pointer to process movements
*/
- void moveActor(int32 angleFrom, int32 angleTo, int32 speed, ActorMoveStruct *movePtr) const;
+ void initRealAngleConst(int32 start, int32 end, int32 duration, ActorMoveStruct *movePtr) const;
void processActorMovements(int32 actorIdx);
};
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index ad62059f9a4..3c60b28c9c9 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -125,7 +125,7 @@ static int32 mGOTO_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
if (ctx.actor->_staticFlags.bIsSpriteActor) {
ctx.actor->_angle = newAngle;
} else {
- engine->_movements->moveActor(ctx.actor->_angle, newAngle, ctx.actor->_speed, &ctx.actor->_move);
+ engine->_movements->initRealAngleConst(ctx.actor->_angle, newAngle, ctx.actor->_speed, &ctx.actor->_move);
}
if (engine->_movements->_targetActorDistance > 500) {
@@ -173,7 +173,7 @@ static int32 mANGLE(TwinEEngine *engine, MoveScriptContext &ctx) {
}
engine->_scene->_currentScriptValue = angle;
if (ctx.actor->_move.numOfStep == 0) {
- engine->_movements->moveActor(ctx.actor->_angle, angle, ctx.actor->_speed, &ctx.actor->_move);
+ engine->_movements->initRealAngleConst(ctx.actor->_angle, angle, ctx.actor->_speed, &ctx.actor->_move);
}
if (ctx.actor->_angle == angle) {
engine->_movements->clearRealAngle(ctx.actor);
@@ -255,7 +255,7 @@ static int32 mGOTO_SYM_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
if (ctx.actor->_staticFlags.bIsSpriteActor) {
ctx.actor->_angle = newAngle;
} else {
- engine->_movements->moveActor(ctx.actor->_angle, newAngle, ctx.actor->_speed, &ctx.actor->_move);
+ engine->_movements->initRealAngleConst(ctx.actor->_angle, newAngle, ctx.actor->_speed, &ctx.actor->_move);
}
if (engine->_movements->_targetActorDistance > 500) {
@@ -603,7 +603,7 @@ static int32 mFACE_HERO(TwinEEngine *engine, MoveScriptContext &ctx) {
engine->_scene->_currentScriptValue = angle;
if (engine->_scene->_currentScriptValue == -1 && ctx.actor->_move.numOfStep == 0) {
engine->_scene->_currentScriptValue = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->pos(), engine->_scene->_sceneHero->pos());
- engine->_movements->moveActor(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
+ engine->_movements->initRealAngleConst(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
ctx.stream.rewind(2);
ctx.stream.writeSint16LE(engine->_scene->_currentScriptValue);
}
@@ -641,7 +641,7 @@ static int32 mANGLE_RND(TwinEEngine *engine, MoveScriptContext &ctx) {
engine->_scene->_currentScriptValue = ClampAngle(newAngle - engine->getRandomNumber(val1));
}
- engine->_movements->moveActor(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
+ engine->_movements->initRealAngleConst(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
ctx.stream.rewind(2);
ctx.stream.writeSint16LE(engine->_scene->_currentScriptValue);
}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 98d653e70f6..e11c251f697 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -718,7 +718,7 @@ void TwinEEngine::processInventoryAction() {
_actor->initModelActor(BodyType::btNormal, _scene->_mecaPenguinIdx);
penguin->_dynamicFlags.bIsDead = 0;
penguin->setBrickShape(ShapeType::kNone);
- _movements->moveActor(penguin->_angle, penguin->_angle, penguin->_speed, &penguin->_move);
+ _movements->initRealAngleConst(penguin->_angle, penguin->_angle, penguin->_speed, &penguin->_move);
_gameState->removeItem(InventoryItems::kiPenguin);
penguin->_delayInMillis = _lbaTime + TO_SECONDS(30);
}
Commit: 99164665ba09fb09f6e855dbf1efb0faf33c250d
https://github.com/scummvm/scummvm/commit/99164665ba09fb09f6e855dbf1efb0faf33c250d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:06:29+02:00
Commit Message:
TWINE: fixed using the wrong penguin angle
Rotate(0, 800, ListObjet[NUM_PERSO].Beta) is the original source code line
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index e11c251f697..5f1e9679df0 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -704,7 +704,7 @@ void TwinEEngine::processInventoryAction() {
case kiPenguin: {
ActorStruct *penguin = _scene->getActor(_scene->_mecaPenguinIdx);
- const IVec3 &destPos = _movements->rotateActor(0, 800, penguin->_angle);
+ const IVec3 &destPos = _movements->rotateActor(0, 800, _scene->_sceneHero->_angle);
penguin->_pos = _scene->_sceneHero->_pos;
penguin->_pos.x += destPos.x;
Commit: 8d3e9d6a759e179d638212cbbcc04f17b5b58010
https://github.com/scummvm/scummvm/commit/8d3e9d6a759e179d638212cbbcc04f17b5b58010
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:12:22+02:00
Commit Message:
TWINE: minor comment
Changed paths:
engines/twine/renderer/redraw.h
diff --git a/engines/twine/renderer/redraw.h b/engines/twine/renderer/redraw.h
index a0f88d8c1a3..90233970ccd 100644
--- a/engines/twine/renderer/redraw.h
+++ b/engines/twine/renderer/redraw.h
@@ -51,7 +51,7 @@ struct OverlayListStruct {
int16 y = 0;
int16 info1 = 0; // text = actor | total coins
OverlayPosType posType = OverlayPosType::koNormal;
- int16 lifeTime = 0;
+ int16 lifeTime = 0; // life time in ticks - see TO_SECONDS()
};
struct DrawListStruct {
Commit: f4713ad9f56a016cf260ef0a9abcc33d48e0fc5c
https://github.com/scummvm/scummvm/commit/f4713ad9f56a016cf260ef0a9abcc33d48e0fc5c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:20:53+02:00
Commit Message:
TWINE: original source code Box function performs clipping here
Changed paths:
engines/twine/menu/interface.cpp
diff --git a/engines/twine/menu/interface.cpp b/engines/twine/menu/interface.cpp
index 1085bebb2e7..a7a98bc05e0 100644
--- a/engines/twine/menu/interface.cpp
+++ b/engines/twine/menu/interface.cpp
@@ -171,11 +171,15 @@ void Interface::drawTransparentBox(const Common::Rect &rect, int32 colorAdj) {
_engine->_frontVideoBuffer.addDirtyRect(r);
}
-void Interface::drawFilledRect(const Common::Rect &rect, uint8 colorIndex) {
+void Interface::drawFilledRect(const Common::Rect &rect, uint8 colorIndex) { // Box
if (!rect.isValidRect()) {
return;
}
- _engine->_frontVideoBuffer.fillRect(Common::Rect(rect.left, rect.top, rect.right + 1, rect.bottom + 1), colorIndex);
+ Common::Rect clipped(rect.left, rect.top, rect.right + 1, rect.bottom + 1);
+ if (_clip.isValidRect()) {
+ clipped.clip(_clip);
+ }
+ _engine->_frontVideoBuffer.fillRect(clipped, colorIndex);
}
bool Interface::setClip(const Common::Rect &rect) {
Commit: c3993fe6e73730f409f62432e4c4f64b5bb6333d
https://github.com/scummvm/scummvm/commit/c3993fe6e73730f409f62432e4c4f64b5bb6333d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:21:01+02:00
Commit Message:
TWINE: removed unused members
Changed paths:
engines/twine/renderer/redraw.h
diff --git a/engines/twine/renderer/redraw.h b/engines/twine/renderer/redraw.h
index 90233970ccd..43f39d3b365 100644
--- a/engines/twine/renderer/redraw.h
+++ b/engines/twine/renderer/redraw.h
@@ -66,10 +66,6 @@ struct DrawListStruct {
uint16 z = 0;
uint16 offset = 0;
- uint16 field_C = 0;
- uint16 field_E = 0;
- uint16 field_10 = 0;
-
inline bool operator==(const DrawListStruct& other) const {
return posValue == other.posValue;
}
Commit: 02c9f13f8a6ab043321e8dbadf66ff8b87b37df2
https://github.com/scummvm/scummvm/commit/02c9f13f8a6ab043321e8dbadf66ff8b87b37df2
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:27:43+02:00
Commit Message:
TWINE: renamed variable to match original sources
Changed paths:
engines/twine/holomap.cpp
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index c5284443840..dcbf48459cf 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -543,7 +543,7 @@ void Holomap::processHolomap() {
int32 time = _engine->_lbaTime;
int32 xRot = _locations[currentLocation].angleX;
int32 yRot = _locations[currentLocation].angleY;
- bool rotate = false;
+ bool automove = false;
bool redraw = true;
int waterPaletteChangeTimer = 0;
bool fadeInPalette = true;
@@ -561,7 +561,7 @@ void Holomap::processHolomap() {
currentLocation = nextLocation;
_engine->_text->drawHolomapLocation(_locations[currentLocation].textIndex);
time = _engine->_lbaTime;
- rotate = true;
+ automove = true;
}
} else if (_engine->_input->toggleActionIfActive(TwinEActionType::HolomapNext)) {
const int32 nextLocation = getNextHolomapLocation(currentLocation, 1);
@@ -569,31 +569,31 @@ void Holomap::processHolomap() {
currentLocation = nextLocation;
_engine->_text->drawHolomapLocation(_locations[currentLocation].textIndex);
time = _engine->_lbaTime;
- rotate = true;
+ automove = true;
}
}
if (_engine->_input->isActionActive(TwinEActionType::HolomapDown)) {
xRot += ANGLE_2;
- rotate = true;
+ automove = true;
time = _engine->_lbaTime;
} else if (_engine->_input->isActionActive(TwinEActionType::HolomapUp)) {
xRot -= ANGLE_2;
- rotate = true;
+ automove = true;
time = _engine->_lbaTime;
}
if (_engine->_input->isActionActive(TwinEActionType::HolomapRight)) {
yRot += ANGLE_2;
- rotate = true;
+ automove = true;
time = _engine->_lbaTime;
} else if (_engine->_input->isActionActive(TwinEActionType::HolomapLeft)) {
yRot -= ANGLE_2;
- rotate = true;
+ automove = true;
time = _engine->_lbaTime;
}
- if (rotate) {
+ if (automove) {
const int32 dt = _engine->_lbaTime - time;
xRot = _engine->_collision->clampedLerp(ClampAngle(xRot), _locations[currentLocation].angleX, 75, dt);
yRot = _engine->_collision->clampedLerp(ClampAngle(yRot), _locations[currentLocation].angleY, 75, dt);
@@ -622,14 +622,15 @@ void Holomap::processHolomap() {
renderHolomapSurfacePolygons(holomapImagePtr, holomapImageSize);
renderLocations(xRot, yRot, 0, true);
drawHolomapText(_engine->width() / 2, 25, "HoloMap");
- if (rotate) {
+ if (automove) {
+ // draw cursor
const Common::Rect &targetRect = _engine->centerOnScreen(40, 40);
- _engine->_menu->drawRectBorders(targetRect.left, cameraPosY - 20, targetRect.right, cameraPosY + 20);
+ _engine->_menu->drawRectBorders(targetRect.left, cameraPosY - 20, targetRect.right, cameraPosY + 20, 15, 15);
}
}
- if (rotate && xRot == _locations[currentLocation].angleX && yRot == _locations[currentLocation].angleY) {
- rotate = false;
+ if (automove && xRot == _locations[currentLocation].angleX && yRot == _locations[currentLocation].angleY) {
+ automove = false;
}
++_engine->_lbaTime;
Commit: 29319ce443d87fb712ef20faa7334d39e9866e34
https://github.com/scummvm/scummvm/commit/29319ce443d87fb712ef20faa7334d39e9866e34
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-07-24T19:45:24+02:00
Commit Message:
TWINE: added original function name
Changed paths:
engines/twine/renderer/renderer.cpp
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 9063bd88a19..4f51bb15500 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -383,7 +383,7 @@ static FORCEINLINE int16 clamp(int16 x, int16 a, int16 b) {
return x < a ? a : (x > b ? b : x);
}
-bool Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices) {
+bool Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices) { // ComputePolyMinMax
uint8 vertexParam1 = vertices[numVertices - 1].colorIndex;
int16 currentVertexX = vertices[numVertices - 1].x;
int16 currentVertexY = vertices[numVertices - 1].y;
More information about the Scummvm-git-logs
mailing list