[Scummvm-git-logs] scummvm master -> 6d400a4a38209d304f3d9fcc123544ed3fe89a80
somaen
noreply at scummvm.org
Sun Nov 29 23:55:16 UTC 2026
This automated email contains information about 16 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
17a9f190fd WATCHMAKER: Fix a few mistakes made during porting
94817f5afe WATCHMAKER: Fix t3dV3F::operator-
cbe5e79d03 WATCHMAKER: Default to fast file, and make it safe to disable
bc26b55746 WATCHMAKER: Avoid double-free in SerializableDynamicArray
33de12ecf6 WATCHMAKER: Avoid OOB in the CameraGrid-handling
bcaf5e018d WATCHMAKER: Unstub random number handling
b3e8cb5e1f WATCHMAKER: Account for MSVC alignment padding when reading in structs.
c9a7b37885 WATCHMAKER: Re-enable back-face culling
6479f70fae WATCHMAKER: Implement movie materials properly.
322f39a6e9 WATCHMAKER: Read meshlinks properly.
a332146f09 WATCHMAKER: Set clear-color to black.
6dd0aa18e4 WATCHMAKER: Correct the component extraction macros
94d20c3272 WATCHMAKER: Draw screen space triangles in screen space.
3ec065a473 WATCHMAKER: Give the renderer the game's fonts.
748a540387 WATCHMAKER: Implement rSetBitmapName
6d400a4a38 WATCHMAKER: Apply MSVC alignment in savegame loading.
Commit: 17a9f190fdc2c0ce4c0accf26d04502a14898743
https://github.com/scummvm/scummvm/commit/17a9f190fdc2c0ce4c0accf26d04502a14898743
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:39:18+01:00
Commit Message:
WATCHMAKER: Fix a few mistakes made during porting
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/animation.cpp
engines/watchmaker/3d/material.cpp
engines/watchmaker/ll/ll_mesh.cpp
diff --git a/engines/watchmaker/3d/animation.cpp b/engines/watchmaker/3d/animation.cpp
index d2c612158bd..af3a0c4ecd6 100644
--- a/engines/watchmaker/3d/animation.cpp
+++ b/engines/watchmaker/3d/animation.cpp
@@ -142,7 +142,7 @@ uint8 GetLightDirection(t3dV3F *dest, uint8 pos) {
for (const auto &light : pLights) {
if (light.Dir.x && light.Dir.z) {
dest->x = light.Dir.x;
- dest->z = light.Dir.x;
+ dest->z = light.Dir.z;
return pos;
}
}
@@ -713,7 +713,7 @@ uint8 CompareLightPosition(char *roomname, uint8 pos1, t3dV3F *pos2, t3dF32 acce
for (auto &light : pLights) {
if (light.Pos.x && light.Pos.z) {
p1.x = light.Pos.x;
- p1.y = light.Pos.y;
+ p1.y = CurFloorY;
p1.z = light.Pos.z;
foundLight = true;
break;
diff --git a/engines/watchmaker/3d/material.cpp b/engines/watchmaker/3d/material.cpp
index 96563100683..bb27e061685 100644
--- a/engines/watchmaker/3d/material.cpp
+++ b/engines/watchmaker/3d/material.cpp
@@ -80,9 +80,9 @@ void gMaterial::addColor(unsigned char r_add, unsigned char g_add, unsigned char
gg = this->g;
bb = this->b;
- rr += r;
- gg += g;
- bb += b;
+ rr += r_add;
+ gg += g_add;
+ bb += b_add;
rr = MIN(MAX(rr, 0), 255);
gg = MIN(MAX(gg, 0), 255);
diff --git a/engines/watchmaker/ll/ll_mesh.cpp b/engines/watchmaker/ll/ll_mesh.cpp
index 05bab5e7e8a..1cfd1c45a81 100644
--- a/engines/watchmaker/ll/ll_mesh.cpp
+++ b/engines/watchmaker/ll/ll_mesh.cpp
@@ -848,7 +848,7 @@ void SetMeshMaterialMovieFrame(t3dMESH *m, int8 op, int32 newframe) {
* ChangeMeshMaterialFlags
* --------------------------------------------------*/
void ChangeMeshMaterialFlag(t3dMESH *m, int8 add, uint32 newflag) {
- if (!m || m->hasFaceMaterial()) return;
+ if (!m || !m->hasFaceMaterial()) return;
if (add > 0) {
m->FList[0].getMaterial()->addProperty(newflag);
Commit: 94817f5afe8c58f71e14b85c245b4a4fc8aae539
https://github.com/scummvm/scummvm/commit/94817f5afe8c58f71e14b85c245b4a4fc8aae539
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:39:18+01:00
Commit Message:
WATCHMAKER: Fix t3dV3F::operator-
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/types3d.h
diff --git a/engines/watchmaker/3d/types3d.h b/engines/watchmaker/3d/types3d.h
index 10cae96913f..21071c1d584 100644
--- a/engines/watchmaker/3d/types3d.h
+++ b/engines/watchmaker/3d/types3d.h
@@ -65,9 +65,9 @@ public:
}
t3dV3F operator-(const t3dV3F &rhs) const {
return t3dV3F(
- x + rhs.x,
- y + rhs.y,
- z + rhs.z
+ x - rhs.x,
+ y - rhs.y,
+ z - rhs.z
);
}
t3dV3F operator-() const {
Commit: cbe5e79d03cbe8ab801649f3531607692d4d14f6
https://github.com/scummvm/scummvm/commit/cbe5e79d03cbe8ab801649f3531607692d4d14f6
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:39:19+01:00
Commit Message:
WATCHMAKER: Default to fast file, and make it safe to disable
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/work_dirs.cpp
diff --git a/engines/watchmaker/work_dirs.cpp b/engines/watchmaker/work_dirs.cpp
index 97163eb5eea..2bbd5750eac 100644
--- a/engines/watchmaker/work_dirs.cpp
+++ b/engines/watchmaker/work_dirs.cpp
@@ -36,7 +36,7 @@ Common::SharedPtr<Common::SeekableReadStream> WorkDirs::resolveFile(const Common
}
}
Common::SharedPtr<Common::SeekableReadStream> stream = nullptr;
- if (!noFastFile) {
+ if (!noFastFile && _fastFile) {
stream = _fastFile->resolve(converted.c_str());
if (stream) {
return stream;
@@ -67,7 +67,8 @@ static bool readKeyValuePair(Common::SeekableReadStream &stream, Common::String
}
WorkDirs::WorkDirs(const Common::String &filename) {
- if (LoaderFlags & T3D_FASTFILE) {
+ // Always use fast file by default, unless in debug-mode
+ if (!(LoaderFlags & T3D_DEBUGMODE)) {
_fastFile = Common::SharedPtr<FastFile>(new FastFile(WmGameDataPak_FilePath));
}
auto fcfg = openFile(filename.c_str());
Commit: bc26b55746edc04f8cb44fdc453cf0a4eb2cac74
https://github.com/scummvm/scummvm/commit/bc26b55746edc04f8cb44fdc453cf0a4eb2cac74
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:39:19+01:00
Commit Message:
WATCHMAKER: Avoid double-free in SerializableDynamicArray
SerializableDynamicArray owns the _array, which means that
the default shallow-copying caused double-frees when used
to assign a size to a zero-sized instance.
We skip implementing any logic for retaining existing data,
as the only current use case is to set a size for an instance
that was originally sized to 0.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/globvar.h
engines/watchmaker/init/nl_init.cpp
engines/watchmaker/struct.h
diff --git a/engines/watchmaker/globvar.h b/engines/watchmaker/globvar.h
index 9e66d8cae16..bef982f9ef3 100644
--- a/engines/watchmaker/globvar.h
+++ b/engines/watchmaker/globvar.h
@@ -233,8 +233,8 @@ struct Init : public SerializableAsset {
uint16 numNames = stream.readUint16LE();
uint16 numRoles = stream.readUint16LE();
- _creditsNames = SerializableDynamicArray<SCreditsName>(numNames);
- _creditsRoles = SerializableDynamicArray<SCreditsRole>(numRoles);
+ _creditsNames.resize(numNames);
+ _creditsRoles.resize(numRoles);
_creditsNames.loadFromStream(stream);
_creditsRoles.loadFromStream(stream);
diff --git a/engines/watchmaker/init/nl_init.cpp b/engines/watchmaker/init/nl_init.cpp
index 33210f6c41b..022583ad8f2 100644
--- a/engines/watchmaker/init/nl_init.cpp
+++ b/engines/watchmaker/init/nl_init.cpp
@@ -1571,7 +1571,7 @@ int StructureInitializer::ParseCredits(char *s) {
done = TRUE;
break;
case 1:
- _init._creditsRoles = SerializableDynamicArray<SCreditsRole>((Credits_numRoles + 1));
+ _init._creditsRoles.resize(Credits_numRoles + 1);
len = _parser->ReadArgument(str);
if (len) {
@@ -1586,7 +1586,7 @@ int StructureInitializer::ParseCredits(char *s) {
if (!(curflags & CF_STATIC)) curflags = CF_NULL;
break;
case 2:
- _init._creditsNames = SerializableDynamicArray<SCreditsName>((Credits_numNames + 1));
+ _init._creditsNames.resize(Credits_numNames + 1);
len = _parser->ReadArgument(str);
if (len) {
diff --git a/engines/watchmaker/struct.h b/engines/watchmaker/struct.h
index 1d488607124..e215a0fbdc2 100644
--- a/engines/watchmaker/struct.h
+++ b/engines/watchmaker/struct.h
@@ -107,6 +107,19 @@ public:
~SerializableDynamicArray() {
delete[] _array;
}
+ // Owns _array, so copying would free it twice; use resize() instead.
+ SerializableDynamicArray(const SerializableDynamicArray &) = delete;
+ SerializableDynamicArray &operator=(const SerializableDynamicArray &) = delete;
+ void resize(uint32 size) {
+ // Since there are limited use cases for this, we assume that
+ // this is only used to give a 0-sized array a size:
+ if (_size != 0) {
+ error("Resizing arrays with non-zero length not implemented");
+ }
+ delete[] _array;
+ _size = size;
+ _array = new T[size] {};
+ }
uint32 size() const {
return _size;
}
Commit: 33de12ecf6b98551e4fda65cd17db78e7ede77cd
https://github.com/scummvm/scummvm/commit/33de12ecf6b98551e4fda65cd17db78e7ede77cd
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:14+01:00
Commit Message:
WATCHMAKER: Avoid OOB in the CameraGrid-handling
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/t3d_body.h
engines/watchmaker/classes/do_camera.cpp
diff --git a/engines/watchmaker/3d/t3d_body.h b/engines/watchmaker/3d/t3d_body.h
index 5d8352e7c65..600181c26ed 100644
--- a/engines/watchmaker/3d/t3d_body.h
+++ b/engines/watchmaker/3d/t3d_body.h
@@ -97,6 +97,7 @@ private:
void initNormals(Common::SeekableReadStream &stream);
public:
t3dCAMERA *PickCamera(uint8 in);
+ uint8 cameraGridCell(int32 col, int32 row);
Common::Array<t3dPLIGHT> getPositionalLight(uint8 pos);
t3dBODY *loadFromStream(WGame &game, const Common::String &pname, Common::SeekableReadStream &stream, uint32 LoaderFlags);
diff --git a/engines/watchmaker/classes/do_camera.cpp b/engines/watchmaker/classes/do_camera.cpp
index 18177a92add..e611215ec4f 100644
--- a/engines/watchmaker/classes/do_camera.cpp
+++ b/engines/watchmaker/classes/do_camera.cpp
@@ -73,6 +73,14 @@ t3dCAMERA *t3dBODY::PickCamera(uint8 in) {
return (&CameraTable[0]);
}
+uint8 t3dBODY::cameraGridCell(int32 col, int32 row) {
+ // The original's range checks around these reads used || and never
+ // rejected anything; treat cells outside the grid as free (255), as
+ // those checks intended.
+ if (col < 0 || row < 0 || col >= CameraGrid.Col || row >= CameraGrid.Row)
+ return 255;
+ return CameraGrid.Grid[col + row * CameraGrid.Col];
+}
/* -----------------06/07/98 16.55-------------------
* GetRealCharPos
@@ -737,19 +745,15 @@ void CameraMan::ProcessCamera(WGame &game) {
// Se non e' valida esco
if (!ForcedCamera && ((col < 0 || row < 0) || (col >= croom->CameraGrid.Col) || (row >= croom->CameraGrid.Row))) return;
// Prendo l'indice della nuova stanza e se e' in una zona libera esce
- cc = croom->CameraGrid.Grid[col + row * croom->CameraGrid.Col];
+ cc = croom->cameraGridCell(col, row);
// Se e' in zona libera e la vecchia telecamera era in zona libera, ricerca a spirale
if ((cc == 255) && (t3dLastCameraIndex == 255)) {
for (a = 1; a < 10; a++) {
for (b = -a; b <= a; b++) {
- if ((col + b) >= 0 || (row + a) >= 0 || (col + b) < croom->CameraGrid.Col || (row + a) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col + b + (row + a) * croom->CameraGrid.Col]) != 255) break;
- if ((col + b) >= 0 || (row - a) >= 0 || (col + b) < croom->CameraGrid.Col || (row - a) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col + b + (row - a) * croom->CameraGrid.Col]) != 255) break;
- if ((col + a) >= 0 || (row + b) >= 0 || (col + a) < croom->CameraGrid.Col || (row + b) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col + a + (row + b) * croom->CameraGrid.Col]) != 255) break;
- if ((col - a) >= 0 || (row + b) >= 0 || (col - a) < croom->CameraGrid.Col || (row + b) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col - a + (row + b) * croom->CameraGrid.Col]) != 255) break;
+ if ((cc = croom->cameraGridCell(col + b, row + a)) != 255) break;
+ if ((cc = croom->cameraGridCell(col + b, row - a)) != 255) break;
+ if ((cc = croom->cameraGridCell(col + a, row + b)) != 255) break;
+ if ((cc = croom->cameraGridCell(col - a, row + b)) != 255) break;
}
if (cc != 255) break;
}
@@ -873,19 +877,15 @@ uint8 CameraMan::GetCameraIndexUnderPlayer(int32 pl) {
// Se non e' valida esco
if (((col < 0 || row < 0) || (col >= croom->CameraGrid.Col) || (row >= croom->CameraGrid.Row))) return (255);
// Prendo l'indice della nuova stanza e se e' in una zona libera esce
- cc = croom->CameraGrid.Grid[col + row * croom->CameraGrid.Col];
+ cc = croom->cameraGridCell(col, row);
// Se e' in zona libera e la vecchia telecamera era in zona libera, ricerca a spirale
if (cc == 255) {
for (a = 1; a < 10; a++) {
for (b = -a; b <= a; b++) {
- if ((col + b) >= 0 || (row + a) >= 0 || (col + b) < croom->CameraGrid.Col || (row + a) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col + b + (row + a) * croom->CameraGrid.Col]) != 255) break;
- if ((col + b) >= 0 || (row - a) >= 0 || (col + b) < croom->CameraGrid.Col || (row - a) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col + b + (row - a) * croom->CameraGrid.Col]) != 255) break;
- if ((col + a) >= 0 || (row + b) >= 0 || (col + a) < croom->CameraGrid.Col || (row + b) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col + a + (row + b) * croom->CameraGrid.Col]) != 255) break;
- if ((col - a) >= 0 || (row + b) >= 0 || (col - a) < croom->CameraGrid.Col || (row + b) < croom->CameraGrid.Row)
- if ((cc = croom->CameraGrid.Grid[col - a + (row + b) * croom->CameraGrid.Col]) != 255) break;
+ if ((cc = croom->cameraGridCell(col + b, row + a)) != 255) break;
+ if ((cc = croom->cameraGridCell(col + b, row - a)) != 255) break;
+ if ((cc = croom->cameraGridCell(col + a, row + b)) != 255) break;
+ if ((cc = croom->cameraGridCell(col - a, row + b)) != 255) break;
}
if (cc != 255) break;
}
Commit: bcaf5e018da9c17452e52ae119882a975d2d57d2
https://github.com/scummvm/scummvm/commit/bcaf5e018da9c17452e52ae119882a975d2d57d2
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:16+01:00
Commit Message:
WATCHMAKER: Unstub random number handling
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/t2d/expr.cpp
diff --git a/engines/watchmaker/t2d/expr.cpp b/engines/watchmaker/t2d/expr.cpp
index ccbf677494a..bf858cbd266 100644
--- a/engines/watchmaker/t2d/expr.cpp
+++ b/engines/watchmaker/t2d/expr.cpp
@@ -24,15 +24,13 @@
#include "watchmaker/t2d/expr.h"
#include "watchmaker/windows_hacks.h"
#include "watchmaker/globvar.h"
+#include "watchmaker/game.h"
#define MAX_VISEMA 1000
#define MIN_VISEMA_LENG 70
-#define RandomInt(Max) (rand()%(Max+1))
-#define RandomFloat(Max) ((float)rand()/MAX_RAND)*Max)
-
#define VIS_DEFAULT_TIME -10
#define VIS_NULL -999
@@ -47,6 +45,13 @@
namespace Watchmaker {
+// Random integer in [0, max], like the original's rand() % (max + 1).
+static int RandomInt(int max) {
+ if (max <= 0)
+ return 0;
+ return (int)_vm->_rnd->getRandomNumber(max);
+}
+
struct SilbsStruct {
const char *Text;
int Res[3];
@@ -612,10 +617,7 @@ bool PauseOnPause(int32 n) {
i = 0;
while ((TimeXVis < MIN_VISEMA_LENG) && (TimeXVis != 0)) {
CICLECONTROL(i);
- error("TODO: Randomness");
-#if 0
Rnd = LastVis + RandomInt(WavePause[j][2] - LastVis - 1);
-#endif
if (VisemaBuf[Rnd].Visema != 0)
VisemaBuf[Rnd].TimeLeng = VIS_NULL;
if (TrueVisemaDist(VisemaBuf, LastVis, WavePause[j][2]) == 0) break;
@@ -675,10 +677,8 @@ int VisemaRecon(int32 n) {
// FIXME: condition never happen
//if (Text==NULL) return -1;
- error("TODO: Randomness");
-#if 0
- srand((unsigned int)time(NULL));
-#endif
+ // Original game would do srand(time(NULL)) here,
+ // we rely on the engine's random source.
VisemaBuf[RPos].Visema = 0;
VisemaBuf[RPos++].TimeLeng = VIS_NULL;
@@ -707,10 +707,7 @@ int VisemaRecon(int32 n) {
LastVis = 0;
break;
case 15:
- error("TODO: Randomness");
-#if 0
Rnd = RandomInt(100);
-#endif
if (Rnd < 15) VisemaBuf[RPos].Visema = 15;
else if (Rnd < 30) VisemaBuf[RPos].Visema = 15;
VisemaBuf[RPos++].TimeLeng = VIS_DEFAULT_TIME;
Commit: b3e8cb5e1f6a54740b11371d369b86203aca7753
https://github.com/scummvm/scummvm/commit/b3e8cb5e1f6a54740b11371d369b86203aca7753
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:16+01:00
Commit Message:
WATCHMAKER: Account for MSVC alignment padding when reading in structs.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/struct.h
diff --git a/engines/watchmaker/struct.h b/engines/watchmaker/struct.h
index e215a0fbdc2..eb842e6ffce 100644
--- a/engines/watchmaker/struct.h
+++ b/engines/watchmaker/struct.h
@@ -187,9 +187,11 @@ public:
room = stream.readByte();
goroom = stream.readByte();
ninv = stream.readByte();
+ stream.skip(1); // Alignment padding
flags = stream.readUint16LE();
pos = stream.readByte();
meshlink_int.loadFromStream(stream);
+ stream.skip(1); // Alignment padding
// HACK:
for (int i = 0; i < MAX_OBJ_MESHLINKS; i++) {
meshlink[i] = (char*)meshlink_int.rawArray()[i].rawArray();
@@ -269,9 +271,11 @@ public:
atframe.loadFromStream(stream);
flags = stream.readUint32LE();
active = stream.readSint16LE();
+ stream.skip(2); // Alignment padding
obj = stream.readSint32LE();
pos = stream.readByte();
cam = stream.readByte();
+ stream.skip(2); // Alignment padding
}
};
@@ -288,6 +292,7 @@ struct SSound : public SerializableAsset {
stream.read(name, T3D_NAMELEN);
flags = stream.readByte();
meshlink.loadFromStream(stream);
+ stream.skip(3); // Alignment padding
ConeInside = stream.readUint32LE();
ConeOutside = stream.readUint32LE();
ConeOutsideVolume = stream.readSint32LE();
@@ -327,6 +332,7 @@ struct SItemCommand : public SerializableAsset {
void loadFromStream(Common::SeekableReadStream &stream) override {
com = stream.readByte();
+ stream.skip(1); // Alignment padding
param1 = stream.readUint16LE();
param2 = stream.readUint16LE();
}
@@ -350,6 +356,7 @@ struct SDialog : public SerializableAsset {
void loadFromStream(Common::SeekableReadStream &stream) override {
flags = stream.readUint16LE();
+ stream.skip(2); // Alignment padding
obj = stream.readSint32LE();
AltPosSco.loadFromStream(stream);
AltCamSco.loadFromStream(stream);
@@ -395,6 +402,7 @@ struct SDiary : public SerializableAsset {
cur = stream.readUint16LE();
end_hideobj = stream.readUint16LE();
item.loadFromStream(stream);
+ stream.skip(2); // Alignment padding
}
};
@@ -573,6 +581,7 @@ struct SCreditsName : public SerializableAsset {
stream.read(name, 64);
role = stream.readUint16LE();
flags = stream.readByte();
+ stream.skip(1); // Alignment padding
}
};
Commit: c9a7b37885863bb629a7bf588a2d541c197790e6
https://github.com/scummvm/scummvm/commit/c9a7b37885863bb629a7bf588a2d541c197790e6
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:17+01:00
Commit Message:
WATCHMAKER: Re-enable back-face culling
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/geometry.cpp
diff --git a/engines/watchmaker/3d/geometry.cpp b/engines/watchmaker/3d/geometry.cpp
index 3f056b510d4..d8ae4767666 100644
--- a/engines/watchmaker/3d/geometry.cpp
+++ b/engines/watchmaker/3d/geometry.cpp
@@ -2839,9 +2839,7 @@ bool t3dTransformBody(t3dBODY *b) {
//f
t3dV3F Sight;
t3dVectTransformInv(&Sight, &t3dCurCamera->Source, &b->MeshTable[0].Matrix);
-#if 0
t3dBackfaceCulling(b->NList, b->NumNormals/*+b->NumVerticesNormals*/, &Sight);
-#endif
// t3dBackfaceCulling(b->NList, b->NumNormals/*+b->NumVerticesNormals*/, &t3dCurCamera->Source);
//f
//Setting up transformation matrices. Mesh-Translation for moved/moveable objects
Commit: 6479f70fae098ed120537d8edd0336d6a6abbe40
https://github.com/scummvm/scummvm/commit/6479f70fae098ed120537d8edd0336d6a6abbe40
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:17+01:00
Commit Message:
WATCHMAKER: Implement movie materials properly.
Pausing was not honoured, and the logic for advancing frames
was entirely missing.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/material.cpp
engines/watchmaker/render.cpp
diff --git a/engines/watchmaker/3d/material.cpp b/engines/watchmaker/3d/material.cpp
index bb27e061685..e3c64fecd2b 100644
--- a/engines/watchmaker/3d/material.cpp
+++ b/engines/watchmaker/3d/material.cpp
@@ -234,7 +234,7 @@ void rRemoveMaterial(Common::SharedPtr<gMaterial> &m) {
void rAddToMaterialList(gMaterial &mat, signed short int ViewMatrixNum) {
gBatchBlock *bb = nullptr;
- if ((mat.Flags & T3D_MATERIAL_MOVIE)) {
+ if ((mat.Flags & T3D_MATERIAL_MOVIE) && !(mat.Flags & T3D_MATERIAL_MOVIEPAUSED) && mat.Movie) {
warning("Movie: %s %d", mat.Movie->_name.c_str(), mat.Texture->ID);
mat.Movie->updateMovie();
}
diff --git a/engines/watchmaker/render.cpp b/engines/watchmaker/render.cpp
index f49ad13cda8..7dd8df451e2 100644
--- a/engines/watchmaker/render.cpp
+++ b/engines/watchmaker/render.cpp
@@ -118,8 +118,29 @@ uint16 rRGBAToTextureFormat(unsigned int r, unsigned int g, unsigned int b, unsi
}
bool rSetMovieFrame(MaterialPtr mat, uint32 dwCurrFrame) {
- warning("STUBBED: rSetMovieFrame");
- return false;
+ if (!mat)
+ return false;
+
+ if (dwCurrFrame == 0xFFFF) {
+ mat->clearFlag(T3D_MATERIAL_MOVIEPAUSED);
+ return true;
+ }
+
+ mat->addProperty(T3D_MATERIAL_MOVIEPAUSED);
+
+ if (!mat->Movie)
+ error("No movie set in Material");
+ mat->Movie->_startTime = 0;
+
+ if (mat->Movie->_numFrames == 0)
+ error("0 sized movie");
+
+ // The original doesn't range check; clamp to avoid reading past the
+ // frame table.
+ if (dwCurrFrame >= mat->Movie->_numFrames)
+ dwCurrFrame = mat->Movie->_numFrames - 1;
+
+ return mat->Movie->setFrame(dwCurrFrame);
}
int rCreateSurface(unsigned int dimx, unsigned int dimy, unsigned char flags) {
@@ -180,8 +201,9 @@ void rSetBitmapName(unsigned int id, const char *s) {
}
uint32 rGetMovieFrame(MaterialPtr mat) {
- error("STUBBED: rGetMovieFrame");
- return 0;
+ if (!mat || !mat->Movie)
+ return 0;
+ return mat->Movie->_curFrame;
}
Commit: 322f39a6e9d35244dc2164b16b3629f79b2f3fb0
https://github.com/scummvm/scummvm/commit/322f39a6e9d35244dc2164b16b3629f79b2f3fb0
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:17+01:00
Commit Message:
WATCHMAKER: Read meshlinks properly.
The previous attempt ended up writing the vtable
into the meshlinks instead of the actual strings.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/struct.h
diff --git a/engines/watchmaker/struct.h b/engines/watchmaker/struct.h
index eb842e6ffce..7c9868c6715 100644
--- a/engines/watchmaker/struct.h
+++ b/engines/watchmaker/struct.h
@@ -62,6 +62,13 @@ inline void loadArrayFromStream(Common::SeekableReadStream &stream, uint8 array[
}
}
+template<>
+inline void loadArrayFromStream(Common::SeekableReadStream &stream, char array[], uint32 size) {
+ for (uint32 i = 0; i < size; i++) {
+ array[i] = stream.readByte();
+ }
+}
+
template<>
inline void loadArrayFromStream(Common::SeekableReadStream &stream, uint16 array[], uint32 size) {
for (uint32 i = 0; i < size; i++) {
@@ -261,10 +268,11 @@ public:
}
void loadFromStream(Common::SeekableReadStream &stream) override {
- SerializableArray<SerializableArray<uint8, T3D_NAMELEN>, MAX_SUBANIMS> meshlink_raw;
+ SerializableArray<SerializableArray<char, T3D_NAMELEN>, MAX_SUBANIMS> meshlink_raw;
meshlink_raw.loadFromStream(stream);
for (int i = 0; i < MAX_SUBANIMS; i++) {
- meshlink[i] = (const char*)meshlink_raw.rawArray();
+ const char *link = meshlink_raw.rawArray()[i].rawArray();
+ meshlink[i] = Common::String(link, Common::strnlen(link, T3D_NAMELEN));
}
name.loadFromStream(stream);
RoomName.loadFromStream(stream);
Commit: a332146f09c81f8bde2ded7a963803946b18fb75
https://github.com/scummvm/scummvm/commit/a332146f09c81f8bde2ded7a963803946b18fb75
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:17+01:00
Commit Message:
WATCHMAKER: Set clear-color to black.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/render/opengl_2d.cpp
engines/watchmaker/render.cpp
diff --git a/engines/watchmaker/3d/render/opengl_2d.cpp b/engines/watchmaker/3d/render/opengl_2d.cpp
index cfb10da878c..37a82fb91a4 100644
--- a/engines/watchmaker/3d/render/opengl_2d.cpp
+++ b/engines/watchmaker/3d/render/opengl_2d.cpp
@@ -143,7 +143,6 @@ bool gClipToBlitterViewport(int *sposx, int *sposy, int *sdimx, int *sdimy,
void renderTexture(WGame &game, gTexture &bitmap, Common::Rect srcRect, Common::Rect dstRect) {
checkGlError("Entering renderTexture");
- glClearColor(0, 0, 1, 0);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
diff --git a/engines/watchmaker/render.cpp b/engines/watchmaker/render.cpp
index 7dd8df451e2..a8ffe4998e7 100644
--- a/engines/watchmaker/render.cpp
+++ b/engines/watchmaker/render.cpp
@@ -96,8 +96,7 @@ bool rClearBuffers(char flags) {
//bool clearBack = flags & rCLEARBACKBUFFER;
bool clearScreen = flags & rCLEARSCREENBUFFER;
- // Picking green to make the clear color easy to spot.
- glClearColor(0, 1, 0, 1);
+ glClearColor(0, 0, 0, 1);
GLbitfield mask = (clearStencil ? GL_STENCIL_BUFFER_BIT : 0) | (clearDepth ? GL_DEPTH_BUFFER_BIT : 0) | (clearScreen ? GL_COLOR_BUFFER_BIT : 0);
glClear(mask);
return checkGlError("rClearBuffers");
Commit: 6dd0aa18e49e9fd865c532eceb54a829ee699bdf
https://github.com/scummvm/scummvm/commit/6dd0aa18e49e9fd865c532eceb54a829ee699bdf
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:17+01:00
Commit Message:
WATCHMAKER: Correct the component extraction macros
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/windows_hacks.h
diff --git a/engines/watchmaker/windows_hacks.h b/engines/watchmaker/windows_hacks.h
index 5f12b605026..64821ee7ce0 100644
--- a/engines/watchmaker/windows_hacks.h
+++ b/engines/watchmaker/windows_hacks.h
@@ -28,11 +28,12 @@
namespace Watchmaker {
// HACKY:
-#define RGBA_MAKE(r, g, b, a) ((r << 24) | (g << 16) | (b << 8) | a)
-#define RGBA_GETRED(rgba) (rgba & (0xFF << 24) )
-#define RGBA_GETGREEN(rgba) (rgba & (0xFF << 16) )
-#define RGBA_GETBLUE(rgba) (rgba & (0xFF << 8) )
-#define RGBA_GETALPHA(rgba) (rgba & (0xFF << 0) )
+#define RGBA_MAKE(r, g, b, a) ((r << 16) | (g << 8) | (b << 0) | (a << 24))
+constexpr uint8 rgbaGetComponent(uint32 rgba, uint8 offset) { return ((rgba & (0xFF << offset)) >> offset); }
+constexpr uint8 RGBA_GETRED(uint32 rgba) { return rgbaGetComponent(rgba, 16); }
+constexpr uint8 RGBA_GETGREEN(uint32 rgba) { return rgbaGetComponent(rgba, 8); }
+constexpr uint8 RGBA_GETBLUE(uint32 rgba) { return rgbaGetComponent(rgba, 0); }
+constexpr uint8 RGBA_GETALPHA(uint32 rgba) { return rgbaGetComponent(rgba, 24); }
#define TRUE true
#define FALSE false
typedef short WORD;
Commit: 94d20c3272eb99986c87c33883b4b092ec8dd1f2
https://github.com/scummvm/scummvm/commit/94d20c3272eb99986c87c33883b4b092ec8dd1f2
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:18+01:00
Commit Message:
WATCHMAKER: Draw screen space triangles in screen space.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/3d/render/opengl_renderer.cpp
diff --git a/engines/watchmaker/3d/render/opengl_renderer.cpp b/engines/watchmaker/3d/render/opengl_renderer.cpp
index b20a617fa23..548c68ca8a8 100644
--- a/engines/watchmaker/3d/render/opengl_renderer.cpp
+++ b/engines/watchmaker/3d/render/opengl_renderer.cpp
@@ -82,13 +82,34 @@ void OpenGLRenderer::drawIndexedPrimitivesVBO(PrimitiveType primitiveType, Commo
void OpenGLRenderer::drawPrimitives(PrimitiveType primitiveType, Vertex *vertices, int numPrimitives) {
assert(primitiveType == PrimitiveType::TRIANGLE);
+
+ // These are D3DFVF_TLVERTEX vertices: already transformed to screen pixels,
+ // and coloured by their diffuse colour alone (no texture is set).
+ GLint viewport[4];
+ glGetIntegerv(GL_VIEWPORT, viewport);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, viewport[2], viewport[3], 0, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ GLboolean texturing = glIsEnabled(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_2D);
+
glBegin(GL_TRIANGLES);
for (int i = 0; i < numPrimitives; i++) {
auto &vertex = vertices[i];
- glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ glColor4ub(RGBA_GETRED(vertex.color), RGBA_GETGREEN(vertex.color), RGBA_GETBLUE(vertex.color), RGBA_GETALPHA(vertex.color));
glVertex3f(vertex.sx, vertex.sy, -vertex.sz);
}
glEnd();
+ if (texturing)
+ glEnable(GL_TEXTURE_2D);
+ glPopMatrix();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
glFlush();
}
void OpenGLRenderer::drawIndexedPrimitivesVBO(PrimitiveType primitiveType, int VBO, int firstVertex, int numVertices, uint16 *faces, uint32 numFaces) {
Commit: 3ec065a4737754a17a23e4a46ab02ca981fdcac7
https://github.com/scummvm/scummvm/commit/3ec065a4737754a17a23e4a46ab02ca981fdcac7
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:18+01:00
Commit Message:
WATCHMAKER: Give the renderer the game's fonts.
Without this the game crashes at the very first subtitle.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/renderer.cpp
diff --git a/engines/watchmaker/renderer.cpp b/engines/watchmaker/renderer.cpp
index 5111e0e29c8..ff89f3a999d 100644
--- a/engines/watchmaker/renderer.cpp
+++ b/engines/watchmaker/renderer.cpp
@@ -42,6 +42,7 @@ namespace Watchmaker {
Renderer::Renderer(WGame *game, sdl_wrapper *wrapper) : _2dStuff(this), sdl(wrapper), _game(game) {
_workDirs = &game->workDirs;
+ _fonts = &game->_fonts;
}
// blitter info
Commit: 748a54038706c809c069b6660fce10f31994cd6c
https://github.com/scummvm/scummvm/commit/748a54038706c809c069b6660fce10f31994cd6c
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:18+01:00
Commit Message:
WATCHMAKER: Implement rSetBitmapName
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/render.cpp
diff --git a/engines/watchmaker/render.cpp b/engines/watchmaker/render.cpp
index a8ffe4998e7..5ca0d3ee8f6 100644
--- a/engines/watchmaker/render.cpp
+++ b/engines/watchmaker/render.cpp
@@ -195,7 +195,8 @@ void rReleaseAllTextures(unsigned int NotFlags) {
}
void rSetBitmapName(unsigned int id, const char *s) {
- error("STUBBED: rSetBitmapName");
+ if (_vm && _vm->_renderer && id < MAX_BITMAP_LIST)
+ _vm->_renderer->_bitmapList.bitmaps[id].name = s;
return;
}
Commit: 6d400a4a38209d304f3d9fcc123544ed3fe89a80
https://github.com/scummvm/scummvm/commit/6d400a4a38209d304f3d9fcc123544ed3fe89a80
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2026-11-30T00:51:18+01:00
Commit Message:
WATCHMAKER: Apply MSVC alignment in savegame loading.
The data structures were fwriten straight to file,
so we must take into account their actual memory
layout in MSVC.
Since skipping the intro loads a savegame, this fixes some
issues there.
Assisted-by: Claude:claude-opus-5-5
Changed paths:
engines/watchmaker/ll/ll_mesh.cpp
engines/watchmaker/saveload.cpp
engines/watchmaker/struct.h
diff --git a/engines/watchmaker/ll/ll_mesh.cpp b/engines/watchmaker/ll/ll_mesh.cpp
index 1cfd1c45a81..cd8f0eddff6 100644
--- a/engines/watchmaker/ll/ll_mesh.cpp
+++ b/engines/watchmaker/ll/ll_mesh.cpp
@@ -549,6 +549,7 @@ SMeshModifier::SMeshModifier(Common::SeekableReadStream &stream) {
HaloesStatus = stream.readByte(); // TODO: Signed.
stream.read(stringBuffer, T3D_NAMELEN);
animName = stringBuffer;
+ stream.skip(1); // Realign to 4-byte alignment (MSVC6)
}
SMeshModifier::SMeshModifier(const char *name, int16 com, void *p) {
diff --git a/engines/watchmaker/saveload.cpp b/engines/watchmaker/saveload.cpp
index f2bbf4936cd..590118e2531 100644
--- a/engines/watchmaker/saveload.cpp
+++ b/engines/watchmaker/saveload.cpp
@@ -402,8 +402,6 @@ bool DataLoad(WGame &game, const Common::String &FileName, uint8 slot) {
init.Obj[i].flags = stream->readUint16LE();
init.Obj[i].pos = stream->readByte();
}
- // HACK? (Something is off between 0.92 and the saves in the retail, leading to a slight skew.
- stream->seek(92, SEEK_CUR);
for (int i = 0; i < MAX_ICONS; i++) {
init.InvObj[i].name = stream->readUint16LE();
init.InvObj[i].examine.loadFromStream(*stream);
diff --git a/engines/watchmaker/struct.h b/engines/watchmaker/struct.h
index 7c9868c6715..b7890e8e51c 100644
--- a/engines/watchmaker/struct.h
+++ b/engines/watchmaker/struct.h
@@ -423,9 +423,15 @@ struct SPlayerStand {
SPlayerStand() = default;
SPlayerStand(Common::SeekableReadStream &stream) {
pos = stream.readByte();
+ stream.skip(3); // Alignment (MSVC6)
an = stream.readSint32LE();
cr = stream.readSint32LE();
bnd = stream.readUint16LE();
+ char name[T3D_NAMELEN]{};
+ stream.read(name, T3D_NAMELEN);
+ name[T3D_NAMELEN - 1] = '\0';
+ this->roomName = name;
+ stream.skip(2); // Alignment (MSVC6)
}
};
More information about the Scummvm-git-logs
mailing list