[Scummvm-git-logs] scummvm master -> 2597018b1ea32b1bdf7b87c978baf90b760ae4af
mgerhardy
martin.gerhardy at gmail.com
Sun Mar 7 20:07:23 UTC 2021
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c0886d1c57 TWINE: minor optimization in baseMatrixTranspose
cdd8276d37 TWINE: use SWAP in sortDrawingList
a69702fd9c TWINE: show mouse cursor in debug window
a56d919041 TWINE: fixed debug menu text rendering
675711b837 TWINE: reduced array size for projected holomap surface vectors
2597018b1e TWINE: removed shadeAngleTab3 pointer
Commit: c0886d1c570518891ceeaccbc1aab09175b31cea
https://github.com/scummvm/scummvm/commit/c0886d1c570518891ceeaccbc1aab09175b31cea
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-07T21:06:39+01:00
Commit Message:
TWINE: minor optimization in baseMatrixTranspose
Changed paths:
engines/twine/renderer/renderer.cpp
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 8af65e04a7..061f227331 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -141,16 +141,9 @@ void Renderer::setOrthoProjection(int32 x, int32 y, int32 z) {
}
void Renderer::baseMatrixTranspose() {
- const Matrix tmpMatrix = baseMatrix;
- baseMatrix.row1[0] = tmpMatrix.row1[0];
- baseMatrix.row1[1] = tmpMatrix.row2[0];
- baseMatrix.row1[2] = tmpMatrix.row3[0];
- baseMatrix.row2[0] = tmpMatrix.row1[1];
- baseMatrix.row2[1] = tmpMatrix.row2[1];
- baseMatrix.row2[2] = tmpMatrix.row3[1];
- baseMatrix.row3[0] = tmpMatrix.row1[2];
- baseMatrix.row3[1] = tmpMatrix.row2[2];
- baseMatrix.row3[2] = tmpMatrix.row3[2];
+ SWAP(baseMatrix.row1[1], baseMatrix.row2[0]);
+ SWAP(baseMatrix.row1[2], baseMatrix.row3[0]);
+ SWAP(baseMatrix.row2[2], baseMatrix.row3[1]);
}
void Renderer::setBaseRotation(int32 x, int32 y, int32 z, bool transpose) {
Commit: cdd8276d3721e3550481a4f02ea3305f16288324
https://github.com/scummvm/scummvm/commit/cdd8276d3721e3550481a4f02ea3305f16288324
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-07T21:06:39+01:00
Commit Message:
TWINE: use SWAP in sortDrawingList
Changed paths:
engines/twine/renderer/redraw.cpp
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 9b70c59f31..2532133c0d 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -24,6 +24,7 @@
#include "common/memstream.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/util.h"
#include "graphics/surface.h"
#include "twine/audio/sound.h"
#include "twine/debugger/debug_scene.h"
@@ -150,10 +151,7 @@ void Redraw::sortDrawingList(DrawListStruct *list, int32 listSize) {
for (int32 i = 0; i < listSize - 1; i++) {
for (int32 j = 0; j < listSize - 1 - i; j++) {
if (list[j + 1].posValue < list[j].posValue) {
- DrawListStruct tempStruct;
- memcpy(&tempStruct, &list[j + 1], sizeof(DrawListStruct));
- memcpy(&list[j + 1], &list[j], sizeof(DrawListStruct));
- memcpy(&list[j], &tempStruct, sizeof(DrawListStruct));
+ SWAP(list[j + 1], list[j]);
}
}
}
Commit: a69702fd9cf7fa16724b3b570c7c37d107e736b8
https://github.com/scummvm/scummvm/commit/a69702fd9cf7fa16724b3b570c7c37d107e736b8
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-07T21:06:39+01:00
Commit Message:
TWINE: show mouse cursor in debug window
Changed paths:
engines/twine/debugger/debug.cpp
diff --git a/engines/twine/debugger/debug.cpp b/engines/twine/debugger/debug.cpp
index 4753038f56..419fb5d7a4 100644
--- a/engines/twine/debugger/debug.cpp
+++ b/engines/twine/debugger/debug.cpp
@@ -420,6 +420,7 @@ void Debug::debugProcessWindow() {
int32 colorIdx = 4;
int32 count = 0;
+ ScopedCursor cursor(_engine);
_engine->_screens->copyScreen(_engine->frontVideoBuffer, _engine->workVideoBuffer);
debugResetButtonsState();
Commit: a56d9190410e4257cd3a462b55755d05b73aff4d
https://github.com/scummvm/scummvm/commit/a56d9190410e4257cd3a462b55755d05b73aff4d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-07T21:06:39+01:00
Commit Message:
TWINE: fixed debug menu text rendering
Changed paths:
engines/twine/debugger/debug.cpp
engines/twine/debugger/debug.h
engines/twine/twine.cpp
diff --git a/engines/twine/debugger/debug.cpp b/engines/twine/debugger/debug.cpp
index 419fb5d7a4..3c48688218 100644
--- a/engines/twine/debugger/debug.cpp
+++ b/engines/twine/debugger/debug.cpp
@@ -47,10 +47,10 @@ void Debug::debugFillButton(int32 x, int32 y, int32 width, int32 height, int8 co
}
}
-void Debug::debugDrawButton(const Common::Rect &rect, const char *text, int32 textLeft, int32 textRight, int32 isActive, int8 color) {
+void Debug::debugDrawButton(const Common::Rect &rect, const char *text, int32 textLeft, int32 textTop, int32 isActive, int8 color) {
debugFillButton(rect.left + 1, rect.top + 1, rect.right - rect.left - 1, rect.bottom - rect.top - 1, color);
_engine->_menu->drawBox(rect);
- _engine->drawText(textLeft, textRight, text, 0);
+ _engine->drawText(textLeft, textTop, text, 0);
_engine->copyBlockPhys(rect);
}
@@ -407,7 +407,7 @@ void Debug::debugPlasmaWindow(const char *text, int32 color) {
}
const int32 textSize = _engine->_text->getTextSize(text);
_engine->_text->drawText((_engine->width() / 2) - (textSize / 2), 10, text);
- const Common::Rect rect(5, 5, 634, 50);
+ const Common::Rect rect(5, 5, _engine->width() - 5, 50);
_engine->_menu->drawBox(rect);
_engine->copyBlockPhys(rect);
}
diff --git a/engines/twine/debugger/debug.h b/engines/twine/debugger/debug.h
index e9f568e1d8..1952f36510 100644
--- a/engines/twine/debugger/debug.h
+++ b/engines/twine/debugger/debug.h
@@ -81,7 +81,7 @@ private:
DebugWindowStruct debugWindows[10];
int32 numDebugWindows = 0;
void debugFillButton(int32 x, int32 y, int32 width, int32 height, int8 color);
- void debugDrawButton(const Common::Rect &rect, const char *text, int32 textLeft, int32 textRight, int32 isActive, int8 color);
+ void debugDrawButton(const Common::Rect &rect, const char *text, int32 textLeft, int32 textTop, int32 isActive, int8 color);
void debugDrawWindowBox(const Common::Rect &rect, int32 alpha);
void debugDrawWindowButtons(int32 w);
void debugDrawWindow(int32 w);
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index eb7321fd11..e0670c5b57 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1133,12 +1133,12 @@ void TwinEEngine::drawText(int32 x, int32 y, const char *string, int32 center) {
if (!font) {
return;
}
- int width = 100;
+ int width = 180;
const Common::String text(string);
font->drawString(&frontVideoBuffer, text,
x, y, width,
frontVideoBuffer.format.RGBToColor(255, 255, 255),
- center ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft);
+ center ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft, 0, false);
}
const char *TwinEEngine::getGameId() const {
Commit: 675711b837b36440d0d284817bb3f656cfff6ffe
https://github.com/scummvm/scummvm/commit/675711b837b36440d0d284817bb3f656cfff6ffe
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-07T21:06:39+01:00
Commit Message:
TWINE: reduced array size for projected holomap surface vectors
Changed paths:
engines/twine/holomap.cpp
engines/twine/holomap.h
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 368901f3a2..e80d11a09b 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -191,9 +191,9 @@ void Holomap::prepareHolomapPolygons() {
rotation += ANGLE_11_25;
++_projectedSurfaceIndex;
}
- assert(holomapSortArrayIdx <= ARRAYSIZE(_holomapSort));
- assert(holomapSurfaceArrayIdx <= ARRAYSIZE(_holomapSurface));
- assert(_projectedSurfaceIndex <= ARRAYSIZE(_projectedSurfacePositions));
+ assert(holomapSortArrayIdx == ARRAYSIZE(_holomapSort));
+ assert(holomapSurfaceArrayIdx == ARRAYSIZE(_holomapSurface));
+ assert(_projectedSurfaceIndex == ARRAYSIZE(_projectedSurfacePositions));
qsort(_holomapSort, ARRAYSIZE(_holomapSort), sizeof(HolomapSort), sortHolomapSurfaceCoordsByDepth);
}
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 0c4765b4f8..8b408ce6d8 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -84,7 +84,7 @@ private:
int16 unk1 = 0;
int16 unk2 = 0;
};
- HolomapProjectedPos _projectedSurfacePositions[2048];
+ HolomapProjectedPos _projectedSurfacePositions[561];
int _projectedSurfaceIndex = 0;
struct TrajectoryData {
Commit: 2597018b1ea32b1bdf7b87c978baf90b760ae4af
https://github.com/scummvm/scummvm/commit/2597018b1ea32b1bdf7b87c978baf90b760ae4af
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-07T21:06:39+01:00
Commit Message:
TWINE: removed shadeAngleTab3 pointer
Changed paths:
engines/twine/renderer/renderer.cpp
engines/twine/renderer/renderer.h
engines/twine/renderer/shadeangletab.h
engines/twine/scene/movements.cpp
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 061f227331..1cd1ce8828 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -42,7 +42,7 @@ namespace TwinE {
#define RENDERTYPE_DRAWPOLYGON 1
#define RENDERTYPE_DRAWSPHERE 2
-Renderer::Renderer(TwinEEngine *engine) : _engine(engine), shadeAngleTab3(&shadeAngleTable[384]) {
+Renderer::Renderer(TwinEEngine *engine) : _engine(engine) {
}
Renderer::~Renderer() {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 8525b07dac..d64d40efda 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -405,8 +405,6 @@ public:
Vec3 destPos;
Vec3 getHolomapRotation(const int32 angleX, const int32 angleY, const int32 angleZ) const;
- const int16 *const shadeAngleTab3;
-
void setLightVector(int32 angleX, int32 angleY, int32 angleZ);
void getBaseRotationPosition(int32 x, int32 y, int32 z);
diff --git a/engines/twine/renderer/shadeangletab.h b/engines/twine/renderer/shadeangletab.h
index 02a2d1b4db..17b3006fe1 100644
--- a/engines/twine/renderer/shadeangletab.h
+++ b/engines/twine/renderer/shadeangletab.h
@@ -28,6 +28,9 @@
namespace TwinE {
+/**
+ * @brief Caches sin cos table for all possible angles (0-1024 = 0-360 degree)
+ */
const int16 shadeAngleTable[ANGLE_360] = {
0, // tab1
101,
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 095dca22b1..4e8a2bc53d 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -24,6 +24,7 @@
#include "common/textconsole.h"
#include "twine/input.h"
#include "twine/renderer/renderer.h"
+#include "twine/renderer/shadeangletab.h"
#include "twine/scene/actor.h"
#include "twine/scene/animations.h"
#include "twine/scene/collision.h"
@@ -112,15 +113,15 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
const int32 destAngle = (difZ * SCENE_SIZE_HALF) / targetActorDistance;
- int32 startAngle = ANGLE_0;
+ int32 startAngle = ANGLE_135;
// stopAngle = 0x100;
- while (_engine->_renderer->shadeAngleTab3[startAngle] > destAngle) {
+ while (shadeAngleTable[startAngle] > destAngle) {
startAngle++;
}
- if (_engine->_renderer->shadeAngleTab3[startAngle] != destAngle) {
- if ((_engine->_renderer->shadeAngleTab3[startAngle - 1] + _engine->_renderer->shadeAngleTab3[startAngle]) / 2 <= destAngle) {
+ if (shadeAngleTable[startAngle] != destAngle) {
+ if ((shadeAngleTable[startAngle - 1] + shadeAngleTable[startAngle]) / 2 <= destAngle) {
startAngle--;
}
}
More information about the Scummvm-git-logs
mailing list