[Scummvm-git-logs] scummvm master -> 1b34bf6e0af90cd892ae31fa4bcb4170d542903b
mgerhardy
martin.gerhardy at gmail.com
Mon Aug 16 15:06:57 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a56f760727 TWINE: converted todo comment
1b34bf6e0a TWINE: fixed parts of holomap planet rendering
Commit: a56f760727898e1e6d22cfb06c03c7e1f04de423
https://github.com/scummvm/scummvm/commit/a56f760727898e1e6d22cfb06c03c7e1f04de423
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T17:06:52+02:00
Commit Message:
TWINE: converted todo comment
verified with disassembly of lbawin and dotemu
Changed paths:
engines/twine/script/script_life_v1.cpp
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index e941f6ed2a..598f5afbdf 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1229,7 +1229,8 @@ static int32 lINC_CLOVER_BOX(TwinEEngine *engine, LifeScriptContext &ctx) {
*/
static int32 lSET_USED_INVENTORY(TwinEEngine *engine, LifeScriptContext &ctx) {
const int32 item = ctx.stream.readByte();
- if (item < InventoryItems::kKeypad) { // TODO: this looks wrong - why only up to keypad?
+ // Only up to keypad. lbawin and dotemu are doing this, too
+ if (item < InventoryItems::kKeypad) {
engine->_gameState->_inventoryFlags[item] = 1;
}
return 0;
Commit: 1b34bf6e0af90cd892ae31fa4bcb4170d542903b
https://github.com/scummvm/scummvm/commit/1b34bf6e0af90cd892ae31fa4bcb4170d542903b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-16T17:06:52+02:00
Commit Message:
TWINE: fixed parts of holomap planet rendering
Changed paths:
engines/twine/holomap.cpp
engines/twine/renderer/renderer.cpp
engines/twine/renderer/renderer.h
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index dcc82bcc3c..dbe349ffaa 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -188,7 +188,7 @@ void Holomap::prepareHolomapPolygons() {
_holomapSort[holomapSortArrayIdx].projectedPosIdx = _projectedSurfaceIndex;
++holomapSortArrayIdx;
}
- const IVec3 &projPos = _engine->_renderer->projectXYPositionOnScreen(destPos);
+ const IVec3 &projPos = _engine->_renderer->projectHolomapPositionOnScreen(destPos);
_projectedSurfacePositions[_projectedSurfaceIndex].x1 = projPos.x;
_projectedSurfacePositions[_projectedSurfaceIndex].y1 = projPos.y;
rotation += ANGLE_11_25;
@@ -196,7 +196,7 @@ void Holomap::prepareHolomapPolygons() {
}
IVec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
const IVec3 &destPos = _engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
- const IVec3 &projPos = _engine->_renderer->projectXYPositionOnScreen(destPos);
+ const IVec3 &projPos = _engine->_renderer->projectHolomapPositionOnScreen(destPos);
_projectedSurfacePositions[_projectedSurfaceIndex].x1 = projPos.x;
_projectedSurfacePositions[_projectedSurfaceIndex].y1 = projPos.y;
rotation += ANGLE_11_25;
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 74fe275ef4..2662f1d7ed 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -65,26 +65,28 @@ void Renderer::init(int32 w, int32 h) {
_holomap_polytab_1_3_ptr = _holomap_polytab_1_3;
}
-IVec3 Renderer::projectXYPositionOnScreen(int32 x, int32 y, int32 z) {
+IVec3 Renderer::projectHolomapPositionOnScreen(const IVec3 &pos) {
+ int32 x = pos.x;
+ int32 y = pos.y;
+ int32 z = pos.z;
if (_isUsingOrthoProjection) {
_projPos.x = ((x - z) * 24) / BRICK_SIZE + _orthoProjPos.x;
- _projPos.y = y;
+ _projPos.y = (x + z) * 12 + y * -30 + _orthoProjPos.y;
return _projPos;
}
- int32 cz = _baseRotPos.z - z;
- if (-1 < cz) {
- const int32 xdelta = x - _baseRotPos.x;
- int32 posZ = cz + _cameraDepthOffset;
- if (posZ < 0) {
- posZ = 0x7FFF;
- }
- _projPos.x = (xdelta * _cameraScaleY) / posZ + _orthoProjPos.x;
- _projPos.y = y - _baseRotPos.y;
+ const int32 cz = _baseRotPos.z - z;
+ if (cz < 0) {
+ _projPos.x = 0;
+ _projPos.y = 0;
return _projPos;
}
- _projPos.x = 0;
- _projPos.y = 0;
- return _projPos;
+ int32 posZ = cz + _cameraDepthOffset;
+ if (posZ <= 0 || 0x7FFF < posZ) {
+ posZ = 0x7FFF;
+ }
+ _projPos.y = _orthoProjPos.y - (_cameraScaleZ * y) / posZ;
+ _projPos.x = ((_cameraScaleY * x) / posZ) + _orthoProjPos.x;
+ return _projPos;
}
IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 2bc00f7415..5e9b61d51e 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -232,10 +232,7 @@ public:
IVec3 &projectPositionOnScreen(int32 cX, int32 cY, int32 cZ);
- inline IVec3 projectXYPositionOnScreen(const IVec3& pos) {
- return projectXYPositionOnScreen(pos.x, pos.y, pos.z);
- }
- IVec3 projectXYPositionOnScreen(int32 x,int32 y,int32 z);
+ IVec3 projectHolomapPositionOnScreen(const IVec3& pos);
void setCameraPosition(int32 x, int32 y, int32 depthOffset, int32 scaleY, int32 scaleZ);
void setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ, int32 rotPosX, int32 rotPosY, int32 rotPosZ, int32 param6);
IVec3 updateCameraAnglePositions(int zShift = 0);
More information about the Scummvm-git-logs
mailing list