[Scummvm-git-logs] scummvm master -> 2910ca52ec7c77320eda6cda335a49ff58c7f0e8
mgerhardy
martin.gerhardy at gmail.com
Mon Aug 9 09:25:27 UTC 2021
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
32ae394833 TWINE: renamed variables
4097d078ea TWINE: renamed HolomapProjectedPos members
c4ea145e05 TWINE: renamed member var
ba9f3a6de8 TWINE: use hex encoding for constant
f54675b4b0 TWINE: fixed high resolution character centering
9b43bb7bea TWINE: use constants
7ca64fe8c2 TWINE: prepare bodyflag for being compatible to lba2
3124f6b649 TWINE: removed unused and added new comments
b0b97971f1 TWINE: hide access to member
0cb42e8ad8 TWINE: converted assert to error()
25116a6eee TWINE: fixed warning
2910ca52ec TWINE: allow parsers to handle lba2
Commit: 32ae394833d75449d8b25ae961d2cc71b2ea31c9
https://github.com/scummvm/scummvm/commit/32ae394833d75449d8b25ae961d2cc71b2ea31c9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: renamed variables
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 2172f2b2d4..bb25d0a18b 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -231,14 +231,14 @@ void Holomap::renderHolomapSurfacePolygons() {
vertexCoordinates[2].x = pos3.x;
vertexCoordinates[2].y = pos3.y;
if (isTriangleVisible(vertexCoordinates)) {
- Vertex vertexAngles[3];
- vertexAngles[0].x = pos1.unk1;
- vertexAngles[0].y = pos1.unk2;
- vertexAngles[1].x = pos2.unk1;
- vertexAngles[1].y = pos2.unk2;
- vertexAngles[2].x = pos3.unk1;
- vertexAngles[2].y = pos3.unk2;
- _engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexAngles);
+ Vertex vertexCoordinates2[3];
+ vertexCoordinates2[0].x = pos1.unk1;
+ vertexCoordinates2[0].y = pos1.unk2;
+ vertexCoordinates2[1].x = pos2.unk1;
+ vertexCoordinates2[1].y = pos2.unk2;
+ vertexCoordinates2[2].x = pos3.unk1;
+ vertexCoordinates2[2].y = pos3.unk2;
+ _engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
}
const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 34];
@@ -250,14 +250,14 @@ void Holomap::renderHolomapSurfacePolygons() {
vertexCoordinates[2].x = pos6.x;
vertexCoordinates[2].y = pos6.y;
if (isTriangleVisible(vertexCoordinates)) {
- Vertex vertexAngles[3];
- vertexAngles[0].x = pos4.unk1;
- vertexAngles[0].y = pos4.unk2;
- vertexAngles[1].x = pos5.unk1;
- vertexAngles[1].y = pos5.unk2;
- vertexAngles[2].x = pos6.unk1;
- vertexAngles[2].y = pos6.unk2;
- _engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexAngles);
+ Vertex vertexCoordinates2[3];
+ vertexCoordinates2[0].x = pos4.unk1;
+ vertexCoordinates2[0].y = pos4.unk2;
+ vertexCoordinates2[1].x = pos5.unk1;
+ vertexCoordinates2[1].y = pos5.unk2;
+ vertexCoordinates2[2].x = pos6.unk1;
+ vertexCoordinates2[2].y = pos6.unk2;
+ _engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
}
}
}
@@ -524,7 +524,7 @@ void Holomap::processHolomap() {
int32 yRot = ClampAngle(_locations[currentLocation].angle.y);
bool rotate = false;
bool redraw = true;
- int local18 = 0;
+ int waterPaletteChangeTimer = 0;
bool fadeInPalette = true;
_engine->_input->enableKeyMap(holomapKeyMapId);
for (;;) {
@@ -579,16 +579,13 @@ void Holomap::processHolomap() {
redraw = true;
}
- if (!fadeInPalette && local18 < _engine->_lbaTime) {
- //const Common::Rect rect(170, 50, 470, 330);
- //_engine->_interface->setClip(rect);
+ if (!fadeInPalette && waterPaletteChangeTimer < _engine->_lbaTime) {
+ // animate the water surface
_engine->setPalette(192, 32, &_paletteHolomap[3 * _holomapPaletteIndex++]);
- //_engine->copyBlockPhys(rect);
- //_engine->_interface->resetClip();
if (_holomapPaletteIndex == 32) {
_holomapPaletteIndex = 0;
}
- local18 = _engine->_lbaTime + 3;
+ waterPaletteChangeTimer = _engine->_lbaTime + 3;
redraw = true;
}
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index d707e6c593..7e143b26c2 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1583,12 +1583,12 @@ void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2,
computeHolomapPolygon(yTop, (uint32)(uint16)angles2.y, yBottom, (uint32)(uint16)angles1.y, polygonTabPtr);
}
-void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexAngles[3]) {
+void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexCoordinates2[3]) {
int32 top = SCENE_SIZE_MAX;
int32 bottom = SCENE_SIZE_MIN;
- fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], vertexAngles[0], vertexAngles[1], top, bottom);
- fillHolomapPolygons(vertexCoordinates[1], vertexCoordinates[2], vertexAngles[1], vertexAngles[2], top, bottom);
- fillHolomapPolygons(vertexCoordinates[2], vertexCoordinates[0], vertexAngles[2], vertexAngles[0], top, bottom);
+ fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], vertexCoordinates2[0], vertexCoordinates2[1], top, bottom);
+ fillHolomapPolygons(vertexCoordinates[1], vertexCoordinates[2], vertexCoordinates2[1], vertexCoordinates2[2], top, bottom);
+ fillHolomapPolygons(vertexCoordinates[2], vertexCoordinates[0], vertexCoordinates2[2], vertexCoordinates2[0], top, bottom);
renderHolomapPolygons(top, bottom);
}
@@ -1615,7 +1615,7 @@ void Renderer::renderHolomapPolygons(int32 top, int32 bottom) {
const uint16 x_1_3 = *lholomap_polytab_1_3++;
const uint16 x_2_2 = *lholomap_polytab_2_2++;
const uint16 x_2_3 = *lholomap_polytab_2_3++;
- int16 width = right - left;
+ const int16 width = right - left;
if (width > 0) {
uint8 *pixelBufPtr = screenBufPtr + left;
const int32 iWidth = (int32)width;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 0b0afd967c..05fba3d281 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -266,7 +266,7 @@ public:
void renderInventoryItem(int32 x, int32 y, const BodyData &bodyData, int32 angle, int32 param);
- void renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexAngles[3]);
+ void renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexCoordinates2[3]);
};
inline void Renderer::setBaseRotationPos(int32 x, int32 y, int32 z) {
Commit: 4097d078ea9b2fa76e6f01d5d718f436c71392c1
https://github.com/scummvm/scummvm/commit/4097d078ea9b2fa76e6f01d5d718f436c71392c1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: renamed HolomapProjectedPos members
Changed paths:
engines/twine/holomap.cpp
engines/twine/holomap.h
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index bb25d0a18b..bddb8bc7ba 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -154,20 +154,20 @@ void Holomap::prepareHolomapProjectedPositions() {
for (int32 angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
int rotation = 0;
for (int32 i = 0; i < ANGLE_11_25; ++i) {
- _projectedSurfacePositions[projectedIndex].unk1 = _engine->_screens->crossDot(0, 0xffff, ANGLE_360 - 1, rotation);
+ _projectedSurfacePositions[projectedIndex].x2 = _engine->_screens->crossDot(0, 0xffff, ANGLE_360 - 1, rotation);
if (angle == ANGLE_90) {
- _projectedSurfacePositions[projectedIndex].unk2 = -1;
+ _projectedSurfacePositions[projectedIndex].y2 = -1;
} else {
- _projectedSurfacePositions[projectedIndex].unk2 = ((angle + ANGLE_90) * ANGLE_90) / 2;
+ _projectedSurfacePositions[projectedIndex].y2 = ((angle + ANGLE_90) * ANGLE_90) / 2;
}
rotation += ANGLE_11_25;
++projectedIndex;
}
- _projectedSurfacePositions[projectedIndex].unk1 = -1;
+ _projectedSurfacePositions[projectedIndex].x2 = -1;
if (angle == ANGLE_90) {
- _projectedSurfacePositions[projectedIndex].unk2 = -1;
+ _projectedSurfacePositions[projectedIndex].y2 = -1;
} else {
- _projectedSurfacePositions[projectedIndex].unk2 = ((angle + ANGLE_90) * ANGLE_90) / 2;
+ _projectedSurfacePositions[projectedIndex].y2 = ((angle + ANGLE_90) * ANGLE_90) / 2;
}
++projectedIndex;
}
@@ -189,16 +189,16 @@ void Holomap::prepareHolomapPolygons() {
++holomapSortArrayIdx;
}
_engine->_renderer->projectXYPositionOnScreen(_engine->_renderer->_destPos);
- _projectedSurfacePositions[_projectedSurfaceIndex].x = _engine->_renderer->_projPos.x;
- _projectedSurfacePositions[_projectedSurfaceIndex].y = _engine->_renderer->_projPos.y;
+ _projectedSurfacePositions[_projectedSurfaceIndex].x1 = _engine->_renderer->_projPos.x;
+ _projectedSurfacePositions[_projectedSurfaceIndex].y1 = _engine->_renderer->_projPos.y;
rotation += ANGLE_11_25;
++_projectedSurfaceIndex;
}
IVec3* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
_engine->_renderer->projectXYPositionOnScreen(_engine->_renderer->_destPos);
- _projectedSurfacePositions[_projectedSurfaceIndex].x = _engine->_renderer->_projPos.x;
- _projectedSurfacePositions[_projectedSurfaceIndex].y = _engine->_renderer->_projPos.y;
+ _projectedSurfacePositions[_projectedSurfaceIndex].x1 = _engine->_renderer->_projPos.x;
+ _projectedSurfacePositions[_projectedSurfaceIndex].y1 = _engine->_renderer->_projPos.y;
rotation += ANGLE_11_25;
++_projectedSurfaceIndex;
}
@@ -224,39 +224,39 @@ void Holomap::renderHolomapSurfacePolygons() {
const HolomapProjectedPos &pos2 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
const HolomapProjectedPos &pos3 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1];
Vertex vertexCoordinates[3];
- vertexCoordinates[0].x = pos1.x;
- vertexCoordinates[0].y = pos1.y;
- vertexCoordinates[1].x = pos2.x;
- vertexCoordinates[1].y = pos2.y;
- vertexCoordinates[2].x = pos3.x;
- vertexCoordinates[2].y = pos3.y;
+ vertexCoordinates[0].x = pos1.x1;
+ vertexCoordinates[0].y = pos1.y1;
+ vertexCoordinates[1].x = pos2.x1;
+ vertexCoordinates[1].y = pos2.y1;
+ vertexCoordinates[2].x = pos3.x1;
+ vertexCoordinates[2].y = pos3.y1;
if (isTriangleVisible(vertexCoordinates)) {
Vertex vertexCoordinates2[3];
- vertexCoordinates2[0].x = pos1.unk1;
- vertexCoordinates2[0].y = pos1.unk2;
- vertexCoordinates2[1].x = pos2.unk1;
- vertexCoordinates2[1].y = pos2.unk2;
- vertexCoordinates2[2].x = pos3.unk1;
- vertexCoordinates2[2].y = pos3.unk2;
+ vertexCoordinates2[0].x = pos1.x2;
+ vertexCoordinates2[0].y = pos1.y2;
+ vertexCoordinates2[1].x = pos2.x2;
+ vertexCoordinates2[1].y = pos2.y2;
+ vertexCoordinates2[2].x = pos3.x2;
+ vertexCoordinates2[2].y = pos3.y2;
_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
}
const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 34];
const HolomapProjectedPos &pos6 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1];
- vertexCoordinates[0].x = pos4.x;
- vertexCoordinates[0].y = pos4.y;
- vertexCoordinates[1].x = pos5.x;
- vertexCoordinates[1].y = pos5.y;
- vertexCoordinates[2].x = pos6.x;
- vertexCoordinates[2].y = pos6.y;
+ vertexCoordinates[0].x = pos4.x1;
+ vertexCoordinates[0].y = pos4.y1;
+ vertexCoordinates[1].x = pos5.x1;
+ vertexCoordinates[1].y = pos5.y1;
+ vertexCoordinates[2].x = pos6.x1;
+ vertexCoordinates[2].y = pos6.y1;
if (isTriangleVisible(vertexCoordinates)) {
Vertex vertexCoordinates2[3];
- vertexCoordinates2[0].x = pos4.unk1;
- vertexCoordinates2[0].y = pos4.unk2;
- vertexCoordinates2[1].x = pos5.unk1;
- vertexCoordinates2[1].y = pos5.unk2;
- vertexCoordinates2[2].x = pos6.unk1;
- vertexCoordinates2[2].y = pos6.unk2;
+ vertexCoordinates2[0].x = pos4.x2;
+ vertexCoordinates2[0].y = pos4.y2;
+ vertexCoordinates2[1].x = pos5.x2;
+ vertexCoordinates2[1].y = pos5.y2;
+ vertexCoordinates2[2].x = pos6.x2;
+ vertexCoordinates2[2].y = pos6.y2;
_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
}
}
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 1d583f61f3..6582999cc8 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -60,10 +60,10 @@ private:
HolomapSort _holomapSort[512];
struct HolomapProjectedPos {
- int16 x = 0;
- int16 y = 0;
- int16 unk1 = 0;
- int16 unk2 = 0;
+ int16 x1 = 0;
+ int16 y1 = 0;
+ int16 x2 = 0;
+ int16 y2 = 0;
};
HolomapProjectedPos _projectedSurfacePositions[561];
int _projectedSurfaceIndex = 0;
Commit: c4ea145e056fbee296915524392b4dc81180c910
https://github.com/scummvm/scummvm/commit/c4ea145e056fbee296915524392b4dc81180c910
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: renamed member var
Changed paths:
engines/twine/holomap.cpp
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index bddb8bc7ba..e6dc1d2942 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -346,7 +346,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
int32 frameTime = _engine->_lbaTime;
int16 trajAnimFrameIdx = 0;
- int32 local18 = 0;
+ int32 waterPaletteChangeTimer = 0;
bool fadeInPalette = true;
_engine->_input->enableKeyMap(holomapKeyMapId);
for (;;) {
@@ -356,16 +356,13 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
break;
}
- if (!fadeInPalette && local18 < _engine->_lbaTime) {
- //const Common::Rect rect(170, 50, 470, 330);
- //_engine->_interface->setClip(rect);
+ if (!fadeInPalette && waterPaletteChangeTimer < _engine->_lbaTime) {
+ // animate the water surface
_engine->setPalette(192, 32, &_paletteHolomap[3 * _holomapPaletteIndex++]);
- //_engine->copyBlockPhys(rect);
- //_engine->_interface->resetClip();
if (_holomapPaletteIndex == 32) {
_holomapPaletteIndex = 0;
}
- local18 = _engine->_lbaTime + 3;
+ waterPaletteChangeTimer = _engine->_lbaTime + 3;
}
renderHolomapVehicle(frameNumber, move, animTimerData, bodyData, animData);
Commit: ba9f3a6de8e016258318348f7dd3349146556654
https://github.com/scummvm/scummvm/commit/ba9f3a6de8e016258318348f7dd3349146556654
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: use hex encoding for constant
.. as this is used for the comparision later, too
Changed paths:
engines/twine/scene/grid.cpp
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index d843faa111..13b896c8c5 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -848,7 +848,7 @@ int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
return READ_LE_INT16(blockPtr);
}
- return 240;
+ return 0xF0;
}
void Grid::centerOnActor(const ActorStruct* actor) {
Commit: f54675b4b0c22dd9e96222c4aee59bda50d94ed5
https://github.com/scummvm/scummvm/commit/f54675b4b0c22dd9e96222c4aee59bda50d94ed5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: fixed high resolution character centering
... as well as grid tile rendering being centered on the screen
Changed paths:
engines/twine/scene/gamestate.cpp
engines/twine/scene/grid.cpp
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 33e772d9a4..cbc514c465 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -57,7 +57,7 @@ GameState::GameState(TwinEEngine *engine) : _engine(engine) {
}
void GameState::initEngineProjections() {
- _engine->_renderer->setOrthoProjection(311, 240, 512);
+ _engine->_renderer->setOrthoProjection(_engine->width() / 2 - 9, _engine->height() / 2, 512);
_engine->_renderer->setBaseTranslation(0, 0, 0);
_engine->_renderer->setBaseRotation(ANGLE_0, ANGLE_0, ANGLE_0);
_engine->_renderer->setLightVector(_engine->_scene->_alphaLight, _engine->_scene->_betaLight, ANGLE_0);
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 13b896c8c5..427bee481f 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -619,8 +619,8 @@ const uint8 *Grid::getBlockLibrary(int32 index) const {
}
void Grid::getBrickPos(int32 x, int32 y, int32 z) {
- _brickPixelPosX = (x - z) * 24 + 288; // x pos
- _brickPixelPosY = ((x + z) * 12) - (y * 15) + 215; // y pos
+ _brickPixelPosX = (x - z) * 24 + _engine->width() / 2 - 32;
+ _brickPixelPosY = ((x + z) * 12) - (y * 15) + _engine->height() / 2 - 25;
}
void Grid::drawColumnGrid(int32 blockIdx, int32 brickBlockIdx, int32 x, int32 y, int32 z) {
Commit: 9b43bb7bea6746b72f44b6c7c795ddc95cb55096
https://github.com/scummvm/scummvm/commit/9b43bb7bea6746b72f44b6c7c795ddc95cb55096
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: use constants
Changed paths:
engines/twine/scene/grid.cpp
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 427bee481f..a25a0748f5 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -619,8 +619,8 @@ const uint8 *Grid::getBlockLibrary(int32 index) const {
}
void Grid::getBrickPos(int32 x, int32 y, int32 z) {
- _brickPixelPosX = (x - z) * 24 + _engine->width() / 2 - 32;
- _brickPixelPosY = ((x + z) * 12) - (y * 15) + _engine->height() / 2 - 25;
+ _brickPixelPosX = (x - z) * 24 + _engine->width() / 2 - GRID_SIZE_X / 2;
+ _brickPixelPosY = ((x + z) * 12) - (y * 15) + _engine->height() / 2 - GRID_SIZE_Y;
}
void Grid::drawColumnGrid(int32 blockIdx, int32 brickBlockIdx, int32 x, int32 y, int32 z) {
Commit: 7ca64fe8c254a1560b21dd36bb52e5578f4fd9bf
https://github.com/scummvm/scummvm/commit/7ca64fe8c254a1560b21dd36bb52e5578f4fd9bf
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: prepare bodyflag for being compatible to lba2
Changed paths:
engines/twine/parser/body.h
diff --git a/engines/twine/parser/body.h b/engines/twine/parser/body.h
index a3f8cba601..f5ea64fd7f 100644
--- a/engines/twine/parser/body.h
+++ b/engines/twine/parser/body.h
@@ -103,24 +103,24 @@ private:
public:
union BodyFlags {
struct BitMask {
- uint16 unk1 : 1; // 1 << 0
- uint16 animated : 1; // 1 << 1
- uint16 unk3 : 1; // 1 << 2
- uint16 unk4 : 1; // 1 << 3
- uint16 unk5 : 1; // 1 << 4
- uint16 unk6 : 1; // 1 << 5
- uint16 unk7 : 1; // 1 << 6
- uint16 alreadyPrepared : 1; // 1 << 7
- uint16 unk9 : 1; // 1 << 8
- uint16 unk10 : 1; // 1 << 9
- uint16 unk11 : 1; // 1 << 10
- uint16 unk12 : 1; // 1 << 11
- uint16 unk13 : 1; // 1 << 12
- uint16 unk14 : 1; // 1 << 13
- uint16 unk15 : 1; // 1 << 14
- uint16 unk16 : 1; // 1 << 15
+ uint32 unk1 : 1; // 1 << 0
+ uint32 animated : 1; // 1 << 1
+ uint32 unk3 : 1; // 1 << 2
+ uint32 unk4 : 1; // 1 << 3
+ uint32 unk5 : 1; // 1 << 4
+ uint32 unk6 : 1; // 1 << 5
+ uint32 unk7 : 1; // 1 << 6
+ uint32 alreadyPrepared : 1; // 1 << 7
+ uint32 unk9 : 1; // 1 << 8
+ uint32 unk10 : 1; // 1 << 9
+ uint32 unk11 : 1; // 1 << 10
+ uint32 unk12 : 1; // 1 << 11
+ uint32 unk13 : 1; // 1 << 12
+ uint32 unk14 : 1; // 1 << 13
+ uint32 unk15 : 1; // 1 << 14
+ uint32 unk16 : 1; // 1 << 15
} mask;
- uint16 value;
+ uint32 value;
} bodyFlag;
BoundingBox bbox;
Commit: 3124f6b64921c7e26c8b09981c71a950d703addc
https://github.com/scummvm/scummvm/commit/3124f6b64921c7e26c8b09981c71a950d703addc
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: removed unused and added new comments
Changed paths:
engines/twine/scene/actor.h
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 9a74419d5c..09f95bade2 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -186,16 +186,16 @@ public:
int32 _entity = 0; // costumeIndex - index into bodyTable
BodyType _body = BodyType::btNormal;
AnimationTypes _anim = AnimationTypes::kAnimNone;
- AnimationTypes _animExtra = AnimationTypes::kStanding; //field_2
+ AnimationTypes _animExtra = AnimationTypes::kStanding;
AnimationTypes _animExtraPtr = AnimationTypes::kAnimNone;
- int32 _sprite = 0; // field_8
+ int32 _sprite = 0;
EntityData *_entityDataPtr = nullptr;
int16 _actorIdx = 0; // own actor index
IVec3 _pos;
- int32 _strengthOfHit = 0; // field_66
+ int32 _strengthOfHit = 0;
int32 _hitBy = 0;
- BonusParameter _bonusParameter; // field_10
+ BonusParameter _bonusParameter;
int32 _angle = 0; // facing angle of actor. Minumum is 0 (SW). Going counter clock wise
int32 _speed = 0;
ControlMode _controlMode = ControlMode::kNoMove;
@@ -205,9 +205,9 @@ public:
int32 _cropRight = 0;
int32 _cropBottom = 0;
int32 _followedActor = 0; // same as info3
- int32 _bonusAmount = 0; // field_12
+ int32 _bonusAmount = 0;
int32 _talkColor = COLOR_BLACK;
- int32 _armor = 0; // field_14
+ int32 _armor = 0;
int32 _life = 0;
IVec3 _collisionPos;
@@ -224,7 +224,13 @@ public:
int32 _currentLabelPtr = 0; // pointer to LABEL offset
int32 _pausedTrackPtr = 0;
+ /**
+ * colliding actor id
+ */
int32 _collision = 0;
+ /**
+ * actor id we are standing on
+ */
int32 _standOn = 0;
int32 _zone = 0;
@@ -233,9 +239,9 @@ public:
int32 _previousAnimIdx = 0;
int32 _doorStatus = 0;
int32 _animPosition = 0;
- AnimType _animType = AnimType::kAnimationTypeLoop; // field_78
+ AnimType _animType = AnimType::kAnimationTypeLoop;
int32 _spriteActorRotation = 0;
- int32 _brickSound = 0; // field_7A
+ int32 _brickSound = 0;
BoundingBox _boudingBox;
ActorMoveStruct _move;
Commit: b0b97971f1b6770624c09b2d7b86a46beae8c68d
https://github.com/scummvm/scummvm/commit/b0b97971f1b6770624c09b2d7b86a46beae8c68d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: hide access to member
Changed paths:
engines/twine/scene/grid.cpp
engines/twine/scene/grid.h
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index a25a0748f5..5c331e0ba9 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -593,10 +593,10 @@ bool Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, const uint8 *ptr
}
const uint8 *Grid::getBlockBufferGround(const IVec3 &pos, int32 &ground) {
- updateCollisionCoordinates(pos.x, pos.y, pos.z);
- const int32 tempX = _engine->_collision->_collision.x;
- int32 tempY = _engine->_collision->_collision.y;
- const int32 tempZ = _engine->_collision->_collision.z;
+ const IVec3 &collision = updateCollisionCoordinates(pos.x, pos.y, pos.z);
+ const int32 tempX = collision.x;
+ int32 tempY = collision.y;
+ const int32 tempZ = collision.z;
const uint8 *ptr = _blockBuffer + tempY * 2 + tempX * GRID_SIZE_Y * 2 + (tempZ * GRID_SIZE_X) * GRID_SIZE_Y * 2;
while (tempY) {
@@ -700,24 +700,24 @@ void Grid::redrawGrid() {
}
ShapeType Grid::getBrickShape(int32 x, int32 y, int32 z) {
- updateCollisionCoordinates(x, y, z);
+ const IVec3 &collision = updateCollisionCoordinates(x, y, z);
- if (_engine->_collision->_collision.x < 0 || _engine->_collision->_collision.x >= GRID_SIZE_X) {
+ if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
return ShapeType::kNone;
}
- if (_engine->_collision->_collision.y <= -1) {
+ if (collision.y <= -1) {
return ShapeType::kSolid;
}
- if (_engine->_collision->_collision.y < 0 || _engine->_collision->_collision.y >= GRID_SIZE_Y || _engine->_collision->_collision.z < 0 || _engine->_collision->_collision.z >= GRID_SIZE_Z) {
+ if (collision.y < 0 || collision.y >= GRID_SIZE_Y || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
return ShapeType::kNone;
}
uint8 *blockBufferPtr = _blockBuffer;
- blockBufferPtr += _engine->_collision->_collision.x * GRID_SIZE_Y * 2;
- blockBufferPtr += _engine->_collision->_collision.y * 2;
- blockBufferPtr += (_engine->_collision->_collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
+ blockBufferPtr += collision.x * GRID_SIZE_Y * 2;
+ blockBufferPtr += collision.y * 2;
+ blockBufferPtr += (collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
uint8 blockIdx = *blockBufferPtr;
@@ -735,31 +735,32 @@ ShapeType Grid::getBrickShape(int32 x, int32 y, int32 z) {
return (ShapeType) * (blockBufferPtr + 1);
}
-void Grid::updateCollisionCoordinates(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;
+ return _engine->_collision->_collision;
}
ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
- updateCollisionCoordinates(x, y, z);
+ const IVec3 &collision = updateCollisionCoordinates(x, y, z);
- if (_engine->_collision->_collision.x < 0 || _engine->_collision->_collision.x >= GRID_SIZE_X) {
+ if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
return ShapeType::kNone;
}
- if (_engine->_collision->_collision.y <= -1) {
+ if (collision.y <= -1) {
return ShapeType::kSolid;
}
- if (_engine->_collision->_collision.y < 0 || _engine->_collision->_collision.y >= GRID_SIZE_Y || _engine->_collision->_collision.z < 0 || _engine->_collision->_collision.z >= GRID_SIZE_Z) {
+ if (collision.y < 0 || collision.y >= GRID_SIZE_Y || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
return ShapeType::kNone;
}
uint8 *blockBufferPtr = _blockBuffer;
- blockBufferPtr += _engine->_collision->_collision.x * GRID_SIZE_Y * 2;
- blockBufferPtr += _engine->_collision->_collision.y * 2;
- blockBufferPtr += (_engine->_collision->_collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
+ blockBufferPtr += collision.x * GRID_SIZE_Y * 2;
+ blockBufferPtr += collision.y * 2;
+ blockBufferPtr += (collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
uint8 blockIdx = *blockBufferPtr;
@@ -775,7 +776,7 @@ ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
const ShapeType brickShape = (ShapeType)*blockPtr;
const int32 newY = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
- int32 currY = _engine->_collision->_collision.y;
+ int32 currY = collision.y;
for (int32 i = 0; i < newY; i++) {
if (currY >= GRID_SIZE_Y) {
@@ -795,7 +796,7 @@ ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
const ShapeType brickShape = (ShapeType) * (blockBufferPtr + 1);
const int32 newY = (y2 + (BRICK_HEIGHT - 1)) / BRICK_HEIGHT;
- int32 currY = _engine->_collision->_collision.y;
+ int32 currY = collision.y;
for (int32 i = 0; i < newY; i++) {
if (currY >= GRID_SIZE_Y) {
@@ -814,24 +815,24 @@ ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
}
int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
- updateCollisionCoordinates(x, y, z);
+ const IVec3 &collision = updateCollisionCoordinates(x, y, z);
- if (_engine->_collision->_collision.x < 0 || _engine->_collision->_collision.x >= GRID_SIZE_X) {
+ if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
return 0; // none
}
- if (_engine->_collision->_collision.y <= -1) {
+ if (collision.y <= -1) {
return 1; // solid
}
- if (_engine->_collision->_collision.y < 0 || _engine->_collision->_collision.y >= GRID_SIZE_Y || _engine->_collision->_collision.z < 0 || _engine->_collision->_collision.z >= GRID_SIZE_Z) {
+ if (collision.y < 0 || collision.y >= GRID_SIZE_Y || collision.z < 0 || collision.z >= GRID_SIZE_Z) {
return 0; // none
}
const uint8 *blockBufferPtr = _blockBuffer;
- blockBufferPtr += _engine->_collision->_collision.x * GRID_SIZE_Y * 2;
- blockBufferPtr += _engine->_collision->_collision.y * 2;
- blockBufferPtr += (_engine->_collision->_collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
+ blockBufferPtr += collision.x * GRID_SIZE_Y * 2;
+ blockBufferPtr += collision.y * 2;
+ blockBufferPtr += (collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
uint8 blockIdx = *blockBufferPtr;
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index 4ad16f643f..1d7cd5cfd0 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -180,7 +180,7 @@ private:
const BrickEntry* getBrickEntry(int32 j, int32 i) const;
- void updateCollisionCoordinates(int32 x, int32 y, int32 z);
+ const IVec3 &updateCollisionCoordinates(int32 x, int32 y, int32 z);
public:
Grid(TwinEEngine *engine);
~Grid();
Commit: 0cb42e8ad8903866d33f5f2c304cbcf3c5c6d620
https://github.com/scummvm/scummvm/commit/0cb42e8ad8903866d33f5f2c304cbcf3c5c6d620
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: converted assert to error()
Changed paths:
engines/twine/scene/scene.cpp
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 2562f1af45..c5c2743d3a 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -569,8 +569,9 @@ void Scene::changeScene() {
}
ActorStruct *Scene::getActor(int32 actorIdx) {
- assert(actorIdx >= 0);
- assert(actorIdx < NUM_MAX_ACTORS);
+ if (actorIdx < 0 || actorIdx >= NUM_MAX_ACTORS) {
+ error("Invalid actor id given: %i", actorIdx);
+ }
return &_sceneActors[actorIdx];
}
Commit: 25116a6eee0b2dbd34ac02377ba06cd8a145c203
https://github.com/scummvm/scummvm/commit/25116a6eee0b2dbd34ac02377ba06cd8a145c203
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:17+02:00
Commit Message:
TWINE: fixed warning
Changed paths:
engines/twine/parser/text.cpp
diff --git a/engines/twine/parser/text.cpp b/engines/twine/parser/text.cpp
index 6aebc80688..009959ea90 100644
--- a/engines/twine/parser/text.cpp
+++ b/engines/twine/parser/text.cpp
@@ -52,7 +52,7 @@ bool TextData::loadFromHQR(const char *name, TextBankId textBankId, int language
_texts[(int)textBankId].clear();
initCustomTexts(textBankId);
- const int numIdxEntries = indexStream->size() / 2;
+ const int numIdxEntries = (int)indexStream->size() / 2;
_texts[(int)textBankId].reserve(numIdxEntries + _texts[(int)textBankId].size());
for (int entry = 0; entry < numIdxEntries; ++entry) {
Commit: 2910ca52ec7c77320eda6cda335a49ff58c7f0e8
https://github.com/scummvm/scummvm/commit/2910ca52ec7c77320eda6cda335a49ff58c7f0e8
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-09T11:24:18+02:00
Commit Message:
TWINE: allow parsers to handle lba2
Changed paths:
engines/twine/holomap.cpp
engines/twine/parser/anim.cpp
engines/twine/parser/anim.h
engines/twine/parser/body.cpp
engines/twine/parser/body.h
engines/twine/parser/brick.cpp
engines/twine/parser/brick.h
engines/twine/parser/entity.cpp
engines/twine/parser/entity.h
engines/twine/parser/holomap.cpp
engines/twine/parser/holomap.h
engines/twine/parser/parser.cpp
engines/twine/parser/parser.h
engines/twine/parser/sprite.cpp
engines/twine/parser/sprite.h
engines/twine/parser/text.cpp
engines/twine/parser/text.h
engines/twine/resources/resources.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/actor.h
engines/twine/scene/gamestate.cpp
engines/twine/scene/scene.cpp
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index e6dc1d2942..73008bfe6b 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -339,9 +339,9 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
ActorMoveStruct move;
AnimTimerDataStruct animTimerData;
AnimData animData;
- animData.loadFromHQR(Resources::HQR_RESS_FILE, data->getAnimation());
+ animData.loadFromHQR(Resources::HQR_RESS_FILE, data->getAnimation(), _engine->isLBA1());
BodyData bodyData;
- bodyData.loadFromHQR(Resources::HQR_RESS_FILE, data->getModel());
+ bodyData.loadFromHQR(Resources::HQR_RESS_FILE, data->getModel(), _engine->isLBA1());
uint frameNumber = 0;
int32 frameTime = _engine->_lbaTime;
int16 trajAnimFrameIdx = 0;
diff --git a/engines/twine/parser/anim.cpp b/engines/twine/parser/anim.cpp
index f79d1f1fb8..3da3fdcd7c 100644
--- a/engines/twine/parser/anim.cpp
+++ b/engines/twine/parser/anim.cpp
@@ -52,7 +52,7 @@ void AnimData::loadKeyFrames(Common::SeekableReadStream &stream) {
}
}
-bool AnimData::loadFromStream(Common::SeekableReadStream &stream) {
+bool AnimData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
_numKeyframes = stream.readUint16LE();
_numBoneframes = stream.readUint16LE();
_loopFrame = stream.readUint16LE();
diff --git a/engines/twine/parser/anim.h b/engines/twine/parser/anim.h
index d8c9f5f16d..318ea6191f 100644
--- a/engines/twine/parser/anim.h
+++ b/engines/twine/parser/anim.h
@@ -62,7 +62,7 @@ private:
uint16 _loopFrame;
public:
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
const KeyFrame* getKeyframe(uint index) const;
const Common::Array<KeyFrame>& getKeyframes() const;
diff --git a/engines/twine/parser/body.cpp b/engines/twine/parser/body.cpp
index 715c380275..7d5201ebff 100644
--- a/engines/twine/parser/body.cpp
+++ b/engines/twine/parser/body.cpp
@@ -153,7 +153,7 @@ void BodyData::loadSpheres(Common::SeekableReadStream &stream) {
}
}
-bool BodyData::loadFromStream(Common::SeekableReadStream &stream) {
+bool BodyData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
bodyFlag.value = stream.readUint16LE();
bbox.mins.x = stream.readSint16LE();
bbox.maxs.x = stream.readSint16LE();
diff --git a/engines/twine/parser/body.h b/engines/twine/parser/body.h
index f5ea64fd7f..1b5d541b2a 100644
--- a/engines/twine/parser/body.h
+++ b/engines/twine/parser/body.h
@@ -178,7 +178,7 @@ public:
return _bones[boneIdx];
}
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
};
} // End of namespace TwinE
diff --git a/engines/twine/parser/brick.cpp b/engines/twine/parser/brick.cpp
index e81244d58a..a8de64376b 100644
--- a/engines/twine/parser/brick.cpp
+++ b/engines/twine/parser/brick.cpp
@@ -26,7 +26,7 @@
namespace TwinE {
-bool BrickData::loadFromStream(Common::SeekableReadStream &stream) {
+bool BrickData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
int width = stream.readByte();
int height = stream.readByte();
_offsetX = stream.readByte();
diff --git a/engines/twine/parser/brick.h b/engines/twine/parser/brick.h
index 44608edcb3..3cbaf553a7 100644
--- a/engines/twine/parser/brick.h
+++ b/engines/twine/parser/brick.h
@@ -38,7 +38,7 @@ private:
int _offsetY = 0;
public:
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
inline const Graphics::ManagedSurface &surface() const {
return _surface;
diff --git a/engines/twine/parser/entity.cpp b/engines/twine/parser/entity.cpp
index 778cbf986a..10af8296d7 100644
--- a/engines/twine/parser/entity.cpp
+++ b/engines/twine/parser/entity.cpp
@@ -155,7 +155,7 @@ bool EntityData::loadAnim(Common::SeekableReadStream &stream) {
return !stream.err();
}
-bool EntityData::loadFromStream(Common::SeekableReadStream &stream) {
+bool EntityData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
_animations.clear();
_bodies.clear();
do {
diff --git a/engines/twine/parser/entity.h b/engines/twine/parser/entity.h
index 893ee68f0c..f94efec628 100644
--- a/engines/twine/parser/entity.h
+++ b/engines/twine/parser/entity.h
@@ -76,7 +76,7 @@ private:
bool loadAnim(Common::SeekableReadStream &stream);
public:
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
const Common::Array<EntityAnim::Action> *getActions(AnimationTypes animation) const;
const EntityBody *getBody(const int index) const;
diff --git a/engines/twine/parser/holomap.cpp b/engines/twine/parser/holomap.cpp
index 3d7cb6e336..3d0dbee960 100644
--- a/engines/twine/parser/holomap.cpp
+++ b/engines/twine/parser/holomap.cpp
@@ -26,7 +26,7 @@
namespace TwinE {
-bool TrajectoryData::loadFromStream(Common::SeekableReadStream &stream) {
+bool TrajectoryData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
_trajectories.clear();
_trajectories.reserve(100); // this is the lba1 amount of trajectories
while (stream.pos() < stream.size()) {
diff --git a/engines/twine/parser/holomap.h b/engines/twine/parser/holomap.h
index 81a9650d68..ca84def84f 100644
--- a/engines/twine/parser/holomap.h
+++ b/engines/twine/parser/holomap.h
@@ -75,7 +75,7 @@ private:
Common::Array<Trajectory> _trajectories;
public:
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
const Trajectory *getTrajectory(uint index) const {
if (index >= _trajectories.size()) {
diff --git a/engines/twine/parser/parser.cpp b/engines/twine/parser/parser.cpp
index fac5b5b069..3ad297dc75 100644
--- a/engines/twine/parser/parser.cpp
+++ b/engines/twine/parser/parser.cpp
@@ -27,21 +27,21 @@
namespace TwinE {
-bool Parser::loadFromBuffer(const uint8 *buf, uint32 size) {
+bool Parser::loadFromBuffer(const uint8 *buf, uint32 size, bool lba1) {
if (size == 0) {
return false;
}
Common::MemoryReadStream stream(buf, size);
- return loadFromStream(stream);
+ return loadFromStream(stream, lba1);
}
-bool Parser::loadFromHQR(const char *name, int index) {
+bool Parser::loadFromHQR(const char *name, int index, bool lba1) {
Common::SeekableReadStream *stream = HQR::makeReadStream(name, index);
if (stream == nullptr) {
warning("Failed to load %s with index %i", name, index);
return false;
}
- if (!loadFromStream(*stream)) {
+ if (!loadFromStream(*stream, lba1)) {
delete stream;
return false;
}
diff --git a/engines/twine/parser/parser.h b/engines/twine/parser/parser.h
index d8d6b5343f..2f8b5cc23c 100644
--- a/engines/twine/parser/parser.h
+++ b/engines/twine/parser/parser.h
@@ -33,10 +33,10 @@ namespace TwinE {
class Parser {
public:
virtual ~Parser() {}
- virtual bool loadFromStream(Common::SeekableReadStream &stream) = 0;
+ virtual bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) = 0;
- bool loadFromBuffer(const uint8 *buf, uint32 size);
- bool loadFromHQR(const char *name, int index);
+ bool loadFromBuffer(const uint8 *buf, uint32 size, bool lba1);
+ bool loadFromHQR(const char *name, int index, bool lba1);
};
} // End of namespace TwinE
diff --git a/engines/twine/parser/sprite.cpp b/engines/twine/parser/sprite.cpp
index afc24ef99b..2cd9b769bd 100644
--- a/engines/twine/parser/sprite.cpp
+++ b/engines/twine/parser/sprite.cpp
@@ -26,7 +26,7 @@
namespace TwinE {
-bool SpriteBoundingBoxData::loadFromStream(Common::SeekableReadStream &stream) {
+bool SpriteBoundingBoxData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
const int32 size = stream.size();
const int32 amount = size / 16;
for (int32 i = 0; i < amount; ++i) {
@@ -46,7 +46,7 @@ bool SpriteBoundingBoxData::loadFromStream(Common::SeekableReadStream &stream) {
return !stream.err();
}
-bool SpriteData::loadFromStream(Common::SeekableReadStream &stream) {
+bool SpriteData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
stream.skip(8);
int width = stream.readByte();
int height = stream.readByte();
diff --git a/engines/twine/parser/sprite.h b/engines/twine/parser/sprite.h
index f8c61cde2d..b912565a0e 100644
--- a/engines/twine/parser/sprite.h
+++ b/engines/twine/parser/sprite.h
@@ -45,7 +45,7 @@ private:
Common::Array<SpriteDim> _dimensions;
public:
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
const BoundingBox *bbox(int index) const;
const SpriteDim *dim(int index) const;
@@ -72,7 +72,7 @@ private:
int _offsetY = 0;
public:
- bool loadFromStream(Common::SeekableReadStream &stream) override;
+ bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
inline const Graphics::ManagedSurface &surface() const {
return _surface;
diff --git a/engines/twine/parser/text.cpp b/engines/twine/parser/text.cpp
index 009959ea90..752f02c749 100644
--- a/engines/twine/parser/text.cpp
+++ b/engines/twine/parser/text.cpp
@@ -38,7 +38,7 @@ void TextData::initCustomTexts(TextBankId textBankId) {
}
}
-bool TextData::loadFromHQR(const char *name, TextBankId textBankId, int language, int entryCount) {
+bool TextData::loadFromHQR(const char *name, TextBankId textBankId, int language, bool lba1, int entryCount) {
const int langIdx = (int)textBankId * 2 + (entryCount * language);
Common::SeekableReadStream *indexStream = HQR::makeReadStream(name, langIdx + 0);
Common::SeekableReadStream *offsetStream = HQR::makeReadStream(name, langIdx + 1);
diff --git a/engines/twine/parser/text.h b/engines/twine/parser/text.h
index 899f63e16b..68ac839089 100644
--- a/engines/twine/parser/text.h
+++ b/engines/twine/parser/text.h
@@ -49,7 +49,7 @@ private:
// custom texts that are not included in the original game
void initCustomTexts(TextBankId textBankId);
public:
- bool loadFromHQR(const char *name, TextBankId textBankId, int language, int entryCount);
+ bool loadFromHQR(const char *name, TextBankId textBankId, int language, bool lba1, int entryCount);
const TextEntry *getText(TextBankId textBankId, TextId textIndex) const;
};
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index 4a51c38cce..e0a2b482fe 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -69,7 +69,7 @@ void Resources::preloadSprites() {
debug("preload %i sprites", numEntries);
for (int32 i = 0; i < numEntries; i++) {
_spriteSizeTable[i] = HQR::getAllocEntry(&_spriteTable[i], Resources::HQR_SPRITES_FILE, i);
- if (!_spriteData[i].loadFromBuffer(_spriteTable[i], _spriteSizeTable[i])) {
+ if (!_spriteData[i].loadFromBuffer(_spriteTable[i], _spriteSizeTable[i], _engine->isLBA1())) {
warning("Failed to load sprite %i", i);
}
}
@@ -83,7 +83,7 @@ void Resources::preloadAnimations() {
}
debug("preload %i animations", numEntries);
for (int32 i = 0; i < numEntries; i++) {
- _animData[i].loadFromHQR(Resources::HQR_ANIM_FILE, i);
+ _animData[i].loadFromHQR(Resources::HQR_ANIM_FILE, i, _engine->isLBA1());
}
}
@@ -131,7 +131,7 @@ void Resources::preloadInventoryItems() {
}
debug("preload %i inventory items", numEntries);
for (int32 i = 0; i < numEntries; i++) {
- _inventoryTable[i].loadFromHQR(Resources::HQR_INVOBJ_FILE, i);
+ _inventoryTable[i].loadFromHQR(Resources::HQR_INVOBJ_FILE, i, _engine->isLBA1());
}
}
@@ -153,7 +153,7 @@ void Resources::initResources() {
}
if (_engine->isLBA1()) {
- if (!_spriteBoundingBox.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_SPRITEBOXDATA)) {
+ if (!_spriteBoundingBox.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_SPRITEBOXDATA, _engine->isLBA1())) {
error("Failed to load sprite bounding box data");
}
}
@@ -168,23 +168,23 @@ void Resources::initResources() {
error("Failed to load holomap image");
}
- if (!holomapTwinsenModelPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOTWINMDL)) {
+ if (!holomapTwinsenModelPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOTWINMDL, _engine->isLBA1())) {
error("Failed to load holomap twinsen model");
}
- if (!holomapPointModelPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOPOINTMDL)) {
+ if (!holomapPointModelPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOPOINTMDL, _engine->isLBA1())) {
error("Failed to load holomap point model");
}
- if (!holomapArrowPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOARROWMDL)) {
+ if (!holomapArrowPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOARROWMDL, _engine->isLBA1())) {
error("Failed to load holomap arrow model");
}
- if (!holomapTwinsenArrowPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOTWINARROWMDL)) {
+ if (!holomapTwinsenArrowPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOTWINARROWMDL, _engine->isLBA1())) {
error("Failed to load holomap twinsen arrow model");
}
- if (!_trajectories.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOPOINTANIM)) {
+ if (!_trajectories.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_HOLOPOINTANIM, _engine->isLBA1())) {
error("Failed to parse trajectory data");
}
debug("preload %i trajectories", (int)_trajectories.getTrajectories().size());
@@ -196,7 +196,7 @@ void Resources::initResources() {
const int32 bodyCount = HQR::numEntries(Resources::HQR_BODY_FILE);
for (int32 i = 0; i < bodyCount; ++i) {
- if (!_bodyData[i].loadFromHQR(Resources::HQR_BODY_FILE, i)) {
+ if (!_bodyData[i].loadFromHQR(Resources::HQR_BODY_FILE, i, _engine->isLBA1())) {
error("HQR ERROR: Parsing body entity for model %i failed", i);
}
}
@@ -205,7 +205,7 @@ void Resources::initResources() {
const int32 textEntryCount = _engine->isLBA1() ? 28 : 30;
for (int32 i = 0; i < textEntryCount / 2; ++i) {
- if (!_textData.loadFromHQR(Resources::HQR_TEXT_FILE, (TextBankId)i, _engine->_cfgfile.LanguageId, textEntryCount)) {
+ if (!_textData.loadFromHQR(Resources::HQR_TEXT_FILE, (TextBankId)i, _engine->_cfgfile.LanguageId, _engine->isLBA1(), textEntryCount)) {
error("HQR ERROR: Parsing textbank %i failed", i);
}
}
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 2e8b45f63b..b715bf823d 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -69,7 +69,7 @@ void Actor::restartHeroScene() {
}
void Actor::loadBehaviourEntity(ActorStruct *actor, EntityData &entityData, int16 &bodyAnimIndex, int32 index) {
- if (!entityData.loadFromHQR(Resources::HQR_FILE3D_FILE, index)) {
+ if (!entityData.loadFromHQR(Resources::HQR_FILE3D_FILE, index, _engine->isLBA1())) {
error("Failed to load actor 3d data for index: %i", index);
}
@@ -374,11 +374,11 @@ void Actor::processActorExtraBonus(int32 actorIdx) { // GiveExtraBonus
}
}
-void ActorStruct::loadModel(int32 modelIndex) {
+void ActorStruct::loadModel(int32 modelIndex, bool lba1) {
_entity = modelIndex;
if (!_staticFlags.bIsSpriteActor) {
debug(1, "Init actor with model %i", modelIndex);
- if (!_entityData.loadFromHQR(Resources::HQR_FILE3D_FILE, modelIndex)) {
+ if (!_entityData.loadFromHQR(Resources::HQR_FILE3D_FILE, modelIndex, lba1)) {
error("Failed to load entity data for index %i", modelIndex);
}
_entityDataPtr = &_entityData;
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 09f95bade2..af24f7694c 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -171,7 +171,7 @@ public:
}
inline void setBrickCausesDamage() { _brickCausesDamage = true; }
inline bool brickCausesDamage() { return _brickCausesDamage; }
- void loadModel(int32 modelIndex);
+ void loadModel(int32 modelIndex, bool lba1);
void addLife(int32 val);
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index cbc514c465..4233413b2d 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -486,7 +486,7 @@ void GameState::processGameoverAnimation() {
_engine->setPalette(_engine->_screens->_paletteRGBA);
_engine->saveFrontBuffer();
BodyData gameOverPtr;
- if (!gameOverPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_GAMEOVERMDL)) {
+ if (!gameOverPtr.loadFromHQR(Resources::HQR_RESS_FILE, RESSHQR_GAMEOVERMDL, _engine->isLBA1())) {
return;
}
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index c5c2743d3a..9ce91d8876 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -192,7 +192,7 @@ bool Scene::loadSceneLBA2() {
ActorStruct *act = &_sceneActors[a];
setActorStaticFlags(act, stream.readUint32LE());
- act->loadModel(stream.readUint16LE());
+ act->loadModel(stream.readUint16LE(), false);
act->_body = (BodyType)stream.readSint16LE();
act->_anim = (AnimationTypes)stream.readByte();
@@ -323,7 +323,7 @@ bool Scene::loadSceneLBA1() {
ActorStruct *act = &_sceneActors[a];
setActorStaticFlags(act, stream.readUint16LE());
- act->loadModel(stream.readUint16LE());
+ act->loadModel(stream.readUint16LE(), true);
act->_body = (BodyType)stream.readByte();
act->_anim = (AnimationTypes)stream.readByte();
More information about the Scummvm-git-logs
mailing list