[Scummvm-git-logs] scummvm master -> 4e11622195aeb5c06a070e7746998579e2295acc

somaen noreply at scummvm.org
Sat Apr 29 21:43:09 UTC 2023


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cbb0a52281 WATCHMAKER: Resolve Windows build errors
876ef461f3 WATCHMAKER: Clear some warnings
4e11622195 WATCHMAKER: Fix mismatched delete/delete[] call


Commit: cbb0a52281caf2f1540a5138f3234735a1a31acd
    https://github.com/scummvm/scummvm/commit/cbb0a52281caf2f1540a5138f3234735a1a31acd
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2023-04-29T23:31:56+02:00

Commit Message:
WATCHMAKER: Resolve Windows build errors

Changed paths:
    engines/watchmaker/3d/animation.cpp
    engines/watchmaker/3d/geometry.cpp
    engines/watchmaker/3d/loader.cpp
    engines/watchmaker/classes/do_camera.cpp
    engines/watchmaker/classes/do_dialog.cpp
    engines/watchmaker/classes/do_keyboard.cpp
    engines/watchmaker/classes/do_system.cpp
    engines/watchmaker/t2d/t2d.cpp
    engines/watchmaker/walk/walk.cpp


diff --git a/engines/watchmaker/3d/animation.cpp b/engines/watchmaker/3d/animation.cpp
index 3965988aa86..487d174903d 100644
--- a/engines/watchmaker/3d/animation.cpp
+++ b/engines/watchmaker/3d/animation.cpp
@@ -156,7 +156,8 @@ uint8 GetLightDirection(t3dV3F *dest, uint8 pos) {
  *                  t3dLoadAnimation
  * --------------------------------------------------*/
 int8 t3dLoadAnimation(WGame &game, const char *s, t3dMESH *mesh, uint16 Flag) {
-	uint32 nf, nb, i, j, k, h, older, ScaleAnim, CurPreloadedAnim;
+	uint32 nf, nb, i, k, h, older, len, ScaleAnim, CurPreloadedAnim;
+	uint32 j = 0;
 	t3dLOADANIM *p;
 	t3dLOADBONE *bone;
 	t3dBONEANIM *db;
@@ -560,12 +561,12 @@ t3dBODY *LoadShadowMeshes(WGame &game, const char *pname, t3dBODY *Body) {
 t3dCHARACTER *t3dLoadCharacter(WGame &game, const char *pname, uint16 num) {
 	warning("LoadCharacter(%s)", pname);
 	uint8   Mirror = 1;
-	uint16  n = 0, f;
+	uint16  numBody = 0, f, i;
 	t3dV3F tmp;
 	//  gVertex *v;
 
 	t3dCHARACTER *b = new t3dCHARACTER[1] {};
-	b->Body = _vm->_roomManager->loadRoom(pname, b->Body, &n, (T3D_NOLIGHTMAPS | T3D_NORECURSION | T3D_NOVOLUMETRICLIGHTS | T3D_NOCAMERAS | T3D_STATIC_SET0 | T3D_STATIC_SET1));
+	b->Body = _vm->_roomManager->loadRoom(pname, b->Body, &numBody, (T3D_NOLIGHTMAPS | T3D_NORECURSION | T3D_NOVOLUMETRICLIGHTS | T3D_NOCAMERAS | T3D_STATIC_SET0 | T3D_STATIC_SET1));
 	if (!b->Body) {
 		delete b;
 		return nullptr;
diff --git a/engines/watchmaker/3d/geometry.cpp b/engines/watchmaker/3d/geometry.cpp
index 2814c8ebc7f..2dee4ddf7f7 100644
--- a/engines/watchmaker/3d/geometry.cpp
+++ b/engines/watchmaker/3d/geometry.cpp
@@ -1018,7 +1018,7 @@ void t3dAddBlend(t3dF32 AddPercent, t3dMESH *mesh) {
  *                  t3dCalcMeshBones
  * --------------------------------------------------*/
 void t3dCalcMeshBones(t3dMESH *mesh, int32 last) {
-	int16 TempFrame;
+	int16 TempFrame = 0;
 	if (!mesh) return;
 
 	if (last) {
@@ -2731,22 +2731,22 @@ void t3dAnimLights(t3dBODY *b) {
 	if (b->LightTable[0].Type & T3D_LIGHT_ALLLIGHTSOFF)
 		return;
 
-	t3dCalcHalos(b);                                                        //Calculate flare/halos for lights
+	t3dCalcHalos(b); // Calculate flare/halos for lights
 
-	int k = 0;
 	bProcessLights = 0;
-	while ((k < b->NumLights())) {
-		t3dLIGHT &l = b->LightTable[k];
+	int light = 0;
+	while ((light < b->NumLights())) {
+		t3dLIGHT &l = b->LightTable[light];
 		if (l.Type & T3D_LIGHT_CANDLESMOKE)
 			t3dRaiseSmoke(&l.Source, l.Particle.get());
 		else if (l.Type & T3D_LIGHT_PULSE) {
 			error("TODO: Pulsing lights");
 #if 0
-			bProcessLights = 1;
-			l.LightRandomizer = -rand() % ((int32)(l.Color.x + l.Color.y + l.Color.z) / 12);
+		bProcessLights = 1;
+		l.LightRandomizer = -rand() % ((int32)(l.Color.x + l.Color.y + l.Color.z) / 12);
 #endif
 		}
-		k++;
+		light++;
 	}
 
 	if (bProcessLights) {
@@ -2798,18 +2798,19 @@ void t3dCheckMaterialVB(MaterialPtr mat) {
 	if (!mat || (mat->NumAllocatedVerts() < 3))
 		return ;
 
-	int i;
-	for (i = 0; i < mat->NumAllocatedMesh; i++)
-		if (*(mat->FlagsList[i]) & T3D_MESH_UPDATEVB)
-			break;
-
-	if (i >= mat->NumAllocatedMesh)
-		return ;
+	{
+		int i = 0;
+		for (; i < mat->NumAllocatedMesh; i++)
+			if (*(mat->FlagsList[i]) & T3D_MESH_UPDATEVB)
+				break;
 
+		if (i >= mat->NumAllocatedMesh)
+			return;
+	}
 	//warning("TODO: Implement t3dCheckMaterialVB");
 //	gv = rLockVertexPtr(mat->VB, DDLOCK_WRITEONLY | DDLOCK_NOSYSLOCK);
 	mat->VBO->_buffer.clear();
-	for (i = 0; i < mat->NumAllocatedVerts(); i++) {
+	for (int i = 0; i < mat->NumAllocatedVerts(); i++) {
 		auto vert = *mat->VertsList[i];
 		mat->VBO->_buffer.push_back(vert);
 		//memcpy(gv, mat->VertsList[i], sizeof(gVertex));
diff --git a/engines/watchmaker/3d/loader.cpp b/engines/watchmaker/3d/loader.cpp
index 4b57f29e19a..e7e8e188507 100644
--- a/engines/watchmaker/3d/loader.cpp
+++ b/engines/watchmaker/3d/loader.cpp
@@ -256,8 +256,8 @@ RoomManager *RoomManager::create(WGame *game) {
 t3dBODY* RoomManagerImplementation::loadRoom(const Common::String &pname, t3dBODY *b, uint16 *NumBody, uint32 LoaderFlags) {
 	warning("t3dLoadRoom(%s, b, %d, %d)", pname.c_str(), *NumBody, LoaderFlags);
 	struct _t3dLOADLIST *l;
-	t3dBODY *r, *rez;
-	uint16 num, i;
+	t3dBODY *r = nullptr;
+	t3dBODY *rez = nullptr;
 
 	// reset everything that was previously in the load list
 	for (int i = 0; i < MAX_T3D_LOADLIST_ITEMS; i++) {
@@ -268,7 +268,7 @@ t3dBODY* RoomManagerImplementation::loadRoom(const Common::String &pname, t3dBOD
 	addToLoadList(nullptr, pname, LoaderFlags);
 
 	while ((l = getFromLoadList())) {
-		num = 0;
+		uint16 num = 0;
 		if (l->m) {
 			if ((rez = _vm->_roomManager->checkIfAlreadyLoaded(l->pname)))
 				l->m->PortalList = rez;
@@ -287,7 +287,7 @@ t3dBODY* RoomManagerImplementation::loadRoom(const Common::String &pname, t3dBOD
 	}
 
 	if (!(LoaderFlags & T3D_NORECURSION)) {
-		for (i = 0; i < NumLoadedFiles; i++)
+		for (uint16 i = 0; i < NumLoadedFiles; i++)
 			if (LoadedFiles[i].b)
 				t3dCalcRejectedMeshFromPortal(LoadedFiles[i].b);
 	}
diff --git a/engines/watchmaker/classes/do_camera.cpp b/engines/watchmaker/classes/do_camera.cpp
index e574579f679..8d1e9fa8455 100644
--- a/engines/watchmaker/classes/do_camera.cpp
+++ b/engines/watchmaker/classes/do_camera.cpp
@@ -165,7 +165,7 @@ void HandleCameraCarrello(t3dBODY *croom) {
 	t3dF32 dist, mindist;
 	t3dV3F pt, i, b;
 	int16 j;
-	uint8 bcc;
+	uint8 bcc = false;
 
 	if (!Player || !croom || !t3dCurCamera) return;
 
diff --git a/engines/watchmaker/classes/do_dialog.cpp b/engines/watchmaker/classes/do_dialog.cpp
index 575fff49dfd..985b926fa55 100644
--- a/engines/watchmaker/classes/do_dialog.cpp
+++ b/engines/watchmaker/classes/do_dialog.cpp
@@ -495,7 +495,7 @@ void UpdateDialogMenu(WGame &game, int16 dmx, int16 dmy, uint8 db) {
  * --------------------------------------------------*/
 void PaintDialog(WGame &game) {
 	int32 a, ca1, ca2;
-	int32 tx, ty;
+	int32 tx = 0, ty = 0;
 	FontColor tc;
 	Init &init = game.init;
 
diff --git a/engines/watchmaker/classes/do_keyboard.cpp b/engines/watchmaker/classes/do_keyboard.cpp
index 04ae0a491e4..a2efe4d26cc 100644
--- a/engines/watchmaker/classes/do_keyboard.cpp
+++ b/engines/watchmaker/classes/do_keyboard.cpp
@@ -80,23 +80,23 @@ void ProcessKBInput() {
 #endif
 }
 
-bool KeyDown(unsigned char key) {
-	if (KeyTable[(key)] & 0x80)
+bool KeyDown(Common::KeyCode key) {
+	if (KeyTable[key] & 0x80)
 		return TRUE;
 	else
 		return FALSE;
 }
 
-bool KeyUp(unsigned char key) {
-	if (KeyTable[(key)] & 0x10) {
-		KeyTable[(key)] = 0;
+bool KeyUp(Common::KeyCode key) {
+	if (KeyTable[key] & 0x10) {
+		KeyTable[key] = 0;
 		return TRUE;
 	} else
 		return FALSE;
 }
 
-void KeyClear(unsigned char key) {
-	KeyTable[(key)] = 0;
+void KeyClear(Common::KeyCode key) {
+	KeyTable[key] = 0;
 }
 
 bool DInputExclusiveMouse() {
@@ -711,4 +711,4 @@ void doClock33(WGame &game, int32 obj, t3dV3F *mp) {
 	t3dPlaneNormal(&l->BBoxNormal[5], &l->BBox[5].p, &l->BBox[1].p, &l->BBox[7].p);      //Right
 }
 
-} // End of namespace Watchmaker
\ No newline at end of file
+} // End of namespace Watchmaker
diff --git a/engines/watchmaker/classes/do_system.cpp b/engines/watchmaker/classes/do_system.cpp
index f3522c12aa4..5cd6c0907be 100644
--- a/engines/watchmaker/classes/do_system.cpp
+++ b/engines/watchmaker/classes/do_system.cpp
@@ -354,7 +354,7 @@ void TitoliCoda_ShowStatic(WGame &game, char initialize) {
 	FontKind f;
 	int32 width, height, bpp;
 	uint32 next_time;
-	uint32 cur_time;
+	uint32 cur_time = 0;
 	uint32 time_inc;    //incremento tra l'apparizione di un ruolo e il successivo
 	Init &init = game.init;
 
@@ -681,7 +681,7 @@ void NextMessage(WGame &game) {
  *                  UpdateIntroText
  * --------------------------------------------------*/
 void UpdateIntroText(uint8 com, int32 cur, int32 max, int32 orig) {
-	int32 sx, sy, ix, iy, dx;
+	int32 sx = 0, sy = 0, ix = 0, iy = 0, dx = 0;
 
 	max --;
 	if ((com == EFFECT_MOVEIN_T2) || (com == EFFECT_MOVEOUT_T2)) dx = rT2.dx;
diff --git a/engines/watchmaker/t2d/t2d.cpp b/engines/watchmaker/t2d/t2d.cpp
index edad9b45519..a8130c65e90 100644
--- a/engines/watchmaker/t2d/t2d.cpp
+++ b/engines/watchmaker/t2d/t2d.cpp
@@ -1070,8 +1070,8 @@ void doT2DKeyboard(WGame &game) {
 				break;
 
 			case T2D_WIN_COMPUTER_SEARCH: {
-				Common::String *String;
-				int Max;
+				Common::String *String = nullptr;
+				int Max = 0;
 				switch (WhatText) {
 				case  0:
 					break;
@@ -1267,12 +1267,12 @@ void doT2DMouseMainMenu(WGame &game, t2dWINDOW *w) {
 void doT2DMouse(WGame &game) {
 	struct SRect t;
 	struct SDDBitmap *d, *d1, *d2;
-	t2dWINDOW *w;
-	t2dBUTTON *b;
-	int32 a, i;
+	t2dWINDOW *w = nullptr;
+	t2dBUTTON *b = nullptr;
+	int32 a = 0, i = 0;
 	char Name[MAX_PATH];
 	//Variabili per gestione scrolling
-	int32 StartY, DimY;
+	int32 StartY = 0, DimY = 0;
 	SYSTEMTIME sysTime;
 	char Text[1000];
 	int16 mouse_x, mouse_y;
@@ -1440,9 +1440,9 @@ void doT2DMouse(WGame &game) {
 						if (WinActive[i] == CurButtonWin) break;
 					if (i == a) break;
 					for (; i < a; i++) {
-						int32 t = WinActive[i];
+						int32 temp = WinActive[i];
 						WinActive[i] = WinActive[i + 1];
-						WinActive[i + 1] = t;
+						WinActive[i + 1] = temp;
 					}
 					ResetScreenBuffer();
 					return;
@@ -5343,18 +5343,18 @@ void doT2D(WGame &game) {
 					StartSound(game, wPDAALERT);
 
 					if (StartAcquiring != i28WALKMANOK) {
-						t2dBUTTON *b;
-
-						b = &w->bt[T2D_BT_PDA_TONE_WIN];
-						b->on = false;
-						b = &w->bt[T2D_BT_PDA_TONE_HELP];
-						b->on = false;
-						b = &w->bt[T2D_BT_PDA_TONE_EXIT];
-						b->on = false;
-						b = &w->bt[T2D_BT_PDA_TONE_ACQUIRE];
-						b->on = false;
-						b = &w->bt[T2D_BT_PDA_TONE_PROCESS];
-						b->on = false;
+						t2dBUTTON *button = nullptr;
+
+						button = &w->bt[T2D_BT_PDA_TONE_WIN];
+						button->on = false;
+						button = &w->bt[T2D_BT_PDA_TONE_HELP];
+						button->on = false;
+						button = &w->bt[T2D_BT_PDA_TONE_EXIT];
+						button->on = false;
+						button = &w->bt[T2D_BT_PDA_TONE_ACQUIRE];
+						button->on = false;
+						button = &w->bt[T2D_BT_PDA_TONE_PROCESS];
+						button->on = false;
 
 						SetHelpWin(game._fonts, &PDA_Tone_Acquire_Help_Func, 2, Sentence[init.Obj[oTONERHELP].text[4]], " ");
 						_vm->_messageSystem.doEvent(EventClass::MC_T2D, ME_T2DSETWINDOW, MP_DEFAULT, T2D_WIN_PDA_HELP, 0, true, nullptr, nullptr, nullptr);
diff --git a/engines/watchmaker/walk/walk.cpp b/engines/watchmaker/walk/walk.cpp
index 9118722daa5..1d8b48d8c2e 100644
--- a/engines/watchmaker/walk/walk.cpp
+++ b/engines/watchmaker/walk/walk.cpp
@@ -110,7 +110,7 @@ int FindAttachedPanel(int32 oc, int srcp, int destp) {
 void PointOut(int32 oc, t3dCAMERA *Camera) {
 	t3dCHARACTER *Act = Character[oc];
 	t3dWALK *w = &Act->Walk;
-	float x, z;
+	float x = 0, z = 0;
 	float inters;
 	float temp;
 	float nx, nz;


Commit: 876ef461f3eacbabf13a24de0d261dc2df46d88e
    https://github.com/scummvm/scummvm/commit/876ef461f3eacbabf13a24de0d261dc2df46d88e
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2023-04-29T23:38:32+02:00

Commit Message:
WATCHMAKER: Clear some warnings

Changed paths:
    engines/watchmaker/3d/animation.cpp
    engines/watchmaker/struct.h


diff --git a/engines/watchmaker/3d/animation.cpp b/engines/watchmaker/3d/animation.cpp
index 487d174903d..49ea35085dc 100644
--- a/engines/watchmaker/3d/animation.cpp
+++ b/engines/watchmaker/3d/animation.cpp
@@ -156,7 +156,7 @@ uint8 GetLightDirection(t3dV3F *dest, uint8 pos) {
  *                  t3dLoadAnimation
  * --------------------------------------------------*/
 int8 t3dLoadAnimation(WGame &game, const char *s, t3dMESH *mesh, uint16 Flag) {
-	uint32 nf, nb, i, k, h, older, len, ScaleAnim, CurPreloadedAnim;
+	uint32 nf, nb, i, k, h, older, ScaleAnim, CurPreloadedAnim;
 	uint32 j = 0;
 	t3dLOADANIM *p;
 	t3dLOADBONE *bone;
@@ -561,7 +561,7 @@ t3dBODY *LoadShadowMeshes(WGame &game, const char *pname, t3dBODY *Body) {
 t3dCHARACTER *t3dLoadCharacter(WGame &game, const char *pname, uint16 num) {
 	warning("LoadCharacter(%s)", pname);
 	uint8   Mirror = 1;
-	uint16  numBody = 0, f, i;
+	uint16  numBody = 0, f;
 	t3dV3F tmp;
 	//  gVertex *v;
 
@@ -709,7 +709,7 @@ uint8 CompareLightPosition(char *roomname, uint8 pos1, t3dV3F *pos2, t3dF32 acce
 
 	auto pLights = t->getPositionalLight(pos1);
 	bool foundLight = false;
-	for (auto light : pLights) {
+	for (auto &light : pLights) {
 		if (light.Pos.x && light.Pos.z) {
 			p1.x = light.Pos.x;
 			p1.y = light.Pos.y;
diff --git a/engines/watchmaker/struct.h b/engines/watchmaker/struct.h
index ea75f37cad2..b7e9fb81dd6 100644
--- a/engines/watchmaker/struct.h
+++ b/engines/watchmaker/struct.h
@@ -202,10 +202,10 @@ struct SInvObject : public SerializableAsset {
 };
 
 struct SAtFrame : public SerializableAsset {
-	uint8 type;                             // ATFTEXT, ATFSND, ATFEVENT
-	uint8 anim;                             // solo se subanim e' attiva
-	int16 nframe;                          // 10000 se attraversa portale
-	uint16 index;
+	uint8 type = 0;                             // ATFTEXT, ATFSND, ATFEVENT
+	uint8 anim = 0;                             // solo se subanim e' attiva
+	int16 nframe = 0;                          // 10000 se attraversa portale
+	uint16 index = 0;
 
 	void loadFromStream(Common::SeekableReadStream &stream) override {
 		type = stream.readByte();
@@ -477,8 +477,8 @@ struct message {
 	int16 wparam1 = 0;                     // t3dS16 parameter 1
 	int16 wparam2 = 0;                     // t3dS16 parameter 2
 	union {
-		int32 lparam[3];               // long parameter
-		t3dF32 fparam[3];               // float parameter
+		int32 lparam[3] = {}; // long parameter
+		t3dF32 fparam[3]; // float parameter
 	};
 	message() = default;
 	message(EventClass _classe, uint8 _event, uint16 _flags) : classe(_classe), event(_event), flags(_flags) {}
@@ -504,7 +504,7 @@ struct SCreditsName : public SerializableAsset {
 };
 
 struct SCreditsRole : public SerializableAsset {
-	char role[48];
+	char role[48] = {};
 	uint8 flags = 0;
 
 	void loadFromStream(Common::SeekableReadStream &stream) override {


Commit: 4e11622195aeb5c06a070e7746998579e2295acc
    https://github.com/scummvm/scummvm/commit/4e11622195aeb5c06a070e7746998579e2295acc
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2023-04-29T23:38:33+02:00

Commit Message:
WATCHMAKER: Fix mismatched delete/delete[] call

Changed paths:
    engines/watchmaker/3d/animation.cpp


diff --git a/engines/watchmaker/3d/animation.cpp b/engines/watchmaker/3d/animation.cpp
index 49ea35085dc..44c09d26743 100644
--- a/engines/watchmaker/3d/animation.cpp
+++ b/engines/watchmaker/3d/animation.cpp
@@ -568,7 +568,7 @@ t3dCHARACTER *t3dLoadCharacter(WGame &game, const char *pname, uint16 num) {
 	t3dCHARACTER *b = new t3dCHARACTER[1] {};
 	b->Body = _vm->_roomManager->loadRoom(pname, b->Body, &numBody, (T3D_NOLIGHTMAPS | T3D_NORECURSION | T3D_NOVOLUMETRICLIGHTS | T3D_NOCAMERAS | T3D_STATIC_SET0 | T3D_STATIC_SET1));
 	if (!b->Body) {
-		delete b;
+		delete[] b;
 		return nullptr;
 	}
 	b->Mesh = &b->Body->MeshTable[0];




More information about the Scummvm-git-logs mailing list