[Scummvm-git-logs] scummvm master -> e15f409d4cc696dd84afed36fda8ae5d439b600a
mgerhardy
noreply at scummvm.org
Mon Feb 17 21:18:52 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e15f409d4c TWINE: initialize lba2 struct members and plug a memory leak
Commit: e15f409d4cc696dd84afed36fda8ae5d439b600a
https://github.com/scummvm/scummvm/commit/e15f409d4cc696dd84afed36fda8ae5d439b600a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2025-02-17T22:18:36+01:00
Commit Message:
TWINE: initialize lba2 struct members and plug a memory leak
Changed paths:
engines/twine/holomap_v2.h
engines/twine/scene/buggy.h
engines/twine/scene/dart.h
engines/twine/scene/extra.cpp
engines/twine/twine.cpp
diff --git a/engines/twine/holomap_v2.h b/engines/twine/holomap_v2.h
index 7a8fd41c577..d35d1056fd1 100644
--- a/engines/twine/holomap_v2.h
+++ b/engines/twine/holomap_v2.h
@@ -43,17 +43,17 @@ public:
virtual ~HolomapV2() = default;
struct Location {
- int32 X; // Position Island X Y Z
- int32 Y;
- int32 Z;
- int32 Alpha; // Position Planet Alpha, Beta and Altitude
- int32 Beta;
- int32 Alt;
- int32 Mess;
- int8 ObjFix; // Eventual Obj Inventory 3D (FREE NOT USED!)
- uint8 FlagHolo; // Flag for Planet display, active, etc.
- uint8 Planet;
- uint8 Island;
+ int32 X = 0; // Position Island X Y Z
+ int32 Y = 0;
+ int32 Z = 0;
+ int32 Alpha = 0; // Position Planet Alpha, Beta and Altitude
+ int32 Beta = 0;
+ int32 Alt = 0;
+ int32 Mess = 0;
+ int8 ObjFix = 0; // Eventual Obj Inventory 3D (FREE NOT USED!)
+ uint8 FlagHolo = 0u; // Flag for Planet display, active, etc.
+ uint8 Planet = 0u;
+ uint8 Island = 0u;
};
static_assert(sizeof(Location) == 32, "Invalid Location size");
Location _locations[MAX_OBJECTIF + MAX_CUBE];
diff --git a/engines/twine/scene/buggy.h b/engines/twine/scene/buggy.h
index 98540a26491..7f2186f06c7 100644
--- a/engines/twine/scene/buggy.h
+++ b/engines/twine/scene/buggy.h
@@ -41,26 +41,26 @@ private:
public:
#define MAX_BUGGYS 2
struct S_ONE_WHEEL {
- int32 Angle;
- int32 X;
- int32 Y;
- int32 Z;
+ int32 Angle = 0;
+ int32 X = 0;
+ int32 Y = 0;
+ int32 Z = 0;
};
typedef struct {
- int32 X;
- int32 Y;
- int32 Z;
- int32 Cube;
- int32 Beta;
- int32 Alpha;
- int32 Gamma;
+ int32 X = 0;
+ int32 Y = 0;
+ int32 Z = 0;
+ int32 Cube = 0;
+ int32 Beta = 0;
+ int32 Alpha = 0;
+ int32 Gamma = 0;
S_ONE_WHEEL Wheel[4];
- int32 BetaWheel;
- int32 SpeedInc;
- int32 SpeedRot;
- int32 Speed;
- int32 LastTimer;
+ int32 BetaWheel = 0;
+ int32 SpeedInc = 0;
+ int32 SpeedRot = 0;
+ int32 Speed = 0;
+ int32 LastTimer = 0;
} S_BUGGY;
// TODO: rename and hide
diff --git a/engines/twine/scene/dart.h b/engines/twine/scene/dart.h
index 158e2c087e4..9498116bfe9 100644
--- a/engines/twine/scene/dart.h
+++ b/engines/twine/scene/dart.h
@@ -38,21 +38,21 @@ private:
public:
struct T_DART {
- int32 PosX;
- int32 PosY;
- int32 PosZ;
- int32 Alpha;
- int32 Beta;
- int32 Body;
- int32 NumCube; // Number of the cube in which the dart is located
- uint32 Flags;
+ int32 PosX = 0;
+ int32 PosY = 0;
+ int32 PosZ = 0;
+ int32 Alpha = 0;
+ int32 Beta = 0;
+ int32 Body = 0;
+ int32 NumCube = 0; // Number of the cube in which the dart is located
+ uint32 Flags = 0u;
- int32 XMin; // ZV of the darts
- int32 YMin;
- int32 ZMin;
- int32 XMax;
- int32 YMax;
- int32 ZMax;
+ int32 XMin = 0; // ZV of the darts
+ int32 YMin = 0;
+ int32 ZMin = 0;
+ int32 XMax = 0;
+ int32 YMax = 0;
+ int32 ZMax = 0;
};
T_DART ListDart[MAX_DARTS];
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 0b93bd2c3b4..0ac2ee8f21a 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -384,6 +384,7 @@ void Extra::addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int3
_engine->_gameState->_magicBall = throwExtra(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, xAngle, yAngle, xRotPoint, extraAngle, ballStrength);
break;
case 5:
+ assert(extraIdx != -1);
_engine->_gameState->_magicBall = extraSearchKey(OWN_ACTOR_SCENE_INDEX, x, y, z, ballSprite, extraIdx);
break;
}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index bf680d2f1d8..7406aa16a7d 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -223,6 +223,10 @@ TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flag
if (isLBA1()) {
_scriptLife = new ScriptLifeV1(this);
_scriptMove = new ScriptMoveV1(this);
+ _buggy = nullptr;
+ _dart = nullptr;
+ _rain = nullptr;
+ _wagon = nullptr;
_holomap = new HolomapV1(this);
} else {
_scriptLife = new ScriptLifeV2(this);
@@ -261,6 +265,10 @@ TwinEEngine::~TwinEEngine() {
delete _screens;
delete _scriptLife;
delete _scriptMove;
+ delete _buggy;
+ delete _dart;
+ delete _rain;
+ delete _wagon;
delete _holomap;
delete _sound;
delete _text;
More information about the Scummvm-git-logs
mailing list