[Scummvm-git-logs] scummvm master -> f24b71100b7e7c86ceb3cef2c2c85f2d0a26c465
bluegr
bluegr at gmail.com
Thu Sep 2 21:42:04 UTC 2021
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5df9601e18 CRYO: Add const to all static tables
a8cbad4c2e CRYO: Fix memory leaks
c955cc3c3d CRYO: Ensure all variables are initialised on startup
e022d80447 CRYO: Support Return to Launcher
f24b71100b CRYO: Remove unused variable
Commit: 5df9601e183cc7114934dc4065a32ff2e6e8b927
https://github.com/scummvm/scummvm/commit/5df9601e183cc7114934dc4065a32ff2e6e8b927
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-09-03T00:41:58+03:00
Commit Message:
CRYO: Add const to all static tables
Changed paths:
engines/cryo/eden.cpp
engines/cryo/eden_graphics.cpp
engines/cryo/eden_graphics.h
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 6c546a5a86..b5928eb120 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -50,7 +50,7 @@ namespace Cryo {
#define Z_DOWN -1
EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) {
- static uint8 statTab2CB1E[8][4] = {
+ static const uint8 statTab2CB1E[8][4] = {
{ 0x10, 0x81, 1, 0x90},
{ 0x90, 1, 0x81, 0x10},
{ 1, 0x90, 0x10, 0x81},
@@ -1553,10 +1553,10 @@ void EdenGame::moveAllDino() {
// Original name: newvallee
void EdenGame::newValley() {
- static int16 roomNumList[] = { 2075, 2080, 2119, -1};
+ static const int16 roomNumList[] = { 2075, 2080, 2119, -1};
perso_t *perso = &_persons[PER_UNKN_372];
- int16 *ptr = roomNumList;
+ const int16 *ptr = roomNumList;
int16 roomNum = *ptr++;
while (roomNum != -1) {
perso->_roomNum = roomNum;
@@ -3091,7 +3091,7 @@ void EdenGame::specialObjects(perso_t *perso, char objid) {
void (EdenGame::*dispFct)(perso_t *perso);
};
- static SpecialObject kSpecialObjectActions[] = {
+ static const SpecialObject kSpecialObjectActions[] = {
// persoType, objectId, dispFct
{ PersonFlags::pfType8, Objects::obShroom, &EdenGame::specialMushroom },
{ PersonFlags::pftTriceraptor, Objects::obNest, &EdenGame::specialEmptyNest },
@@ -3121,7 +3121,7 @@ void EdenGame::specialObjects(perso_t *perso, char objid) {
char characterType = perso->_flags & PersonFlags::pfTypeMask;
_curSpecialObject = &_objects[objid - 1];
- for (SpecialObject *spcObj = kSpecialObjectActions; spcObj->_characterType != -1; spcObj++) {
+ for (const SpecialObject *spcObj = kSpecialObjectActions; spcObj->_characterType != -1; spcObj++) {
if (spcObj->_objectId == objid && spcObj->_characterType == characterType) {
(this->*spcObj->dispFct)(perso);
break;
@@ -3399,7 +3399,8 @@ bool EdenGame::dial_scan(Dialog *dial) {
} else
my_bulle();
if (!dword_30B04) {
- static void (EdenGame::*talk_subject[])() = {
+ typedef void (EdenGame::*TalkSubject)();
+ static const TalkSubject talk_subject[] = {
&EdenGame::setChoiceYes,
&EdenGame::setChoiceNo,
&EdenGame::handleEloiDeparture,
@@ -4390,7 +4391,8 @@ void EdenGame::updateCursor() {
}
void EdenGame::mouse() {
- static void (EdenGame::*mouse_actions[])() = {
+ typedef void (EdenGame::*MouseAction)();
+ static const MouseAction mouse_actions[] = {
&EdenGame::actionMoveNorth,
&EdenGame::actionMoveEast,
&EdenGame::actionMoveSouth,
@@ -5969,7 +5971,7 @@ void EdenGame::incPhase() {
void (EdenGame::*disp)();
};
- static phase_t phases[] = {
+ static const phase_t phases[] = {
{ 65, &EdenGame::dialautoon },
{ 113, &EdenGame::phase113 },
{ 129, &EdenGame::dialautoon },
@@ -5999,7 +6001,7 @@ void EdenGame::incPhase() {
_globals->_phaseNum++;
debug("!!! next phase - %4X , room %4X", _globals->_phaseNum, _globals->_roomNum);
_globals->_phaseActionsCount = 0;
- for (phase_t *phase = phases; phase->_id != -1; phase++) {
+ for (const phase_t *phase = phases; phase->_id != -1; phase++) {
if (_globals->_phaseNum == phase->_id) {
(this->*phase->disp)();
break;
@@ -6128,7 +6130,8 @@ void EdenGame::phase561() {
}
void EdenGame::bigphase1() {
- static void (EdenGame::*bigphases[])() = {
+ typedef void (EdenGame::*Phase)();
+ static const Phase bigphases[] = {
&EdenGame::phase16,
&EdenGame::phase32,
&EdenGame::phase48,
@@ -6946,7 +6949,8 @@ uint16 EdenGame::operFalse(uint16 v1, uint16 v2) {
}
uint16 EdenGame::operation(byte op, uint16 v1, uint16 v2) {
- static uint16(EdenGame::*operations[16])(uint16, uint16) = {
+ typedef uint16 (EdenGame::*Operation)(uint16, uint16);
+ static const Operation operations[16] = {
&EdenGame::operIsEqual,
&EdenGame::operIsSmaller,
&EdenGame::operIsGreater,
diff --git a/engines/cryo/eden_graphics.cpp b/engines/cryo/eden_graphics.cpp
index 301bac409c..f826e47b86 100644
--- a/engines/cryo/eden_graphics.cpp
+++ b/engines/cryo/eden_graphics.cpp
@@ -880,10 +880,10 @@ void EdenGraphics::displayEffect1() {
// Original name: effet2
void EdenGraphics::displayEffect2() {
- static int16 pattern1[] = { 0, 1, 2, 3, 7, 11, 15, 14, 13, 12, 8, 4, 5, 6, 10, 9 };
- static int16 pattern2[] = { 0, 15, 1, 14, 2, 13, 3, 12, 7, 8, 11, 4, 5, 10, 6, 9 };
- static int16 pattern3[] = { 0, 2, 5, 7, 8, 10, 13, 15, 1, 3, 4, 6, 9, 11, 12, 14 };
- static int16 pattern4[] = { 0, 3, 15, 12, 1, 7, 14, 8, 2, 11, 13, 4, 5, 6, 10, 9 };
+ static const int16 pattern1[] = { 0, 1, 2, 3, 7, 11, 15, 14, 13, 12, 8, 4, 5, 6, 10, 9 };
+ static const int16 pattern2[] = { 0, 15, 1, 14, 2, 13, 3, 12, 7, 8, 11, 4, 5, 10, 6, 9 };
+ static const int16 pattern3[] = { 0, 2, 5, 7, 8, 10, 13, 15, 1, 3, 4, 6, 9, 11, 12, 14 };
+ static const int16 pattern4[] = { 0, 3, 15, 12, 1, 7, 14, 8, 2, 11, 13, 4, 5, 6, 10, 9 };
static int eff2pat = 0;
if (_game->_globals->_var103 == 69) {
@@ -1021,7 +1021,7 @@ void EdenGraphics::clearScreen() {
CLBlitter_UpdateScreen();
}
-void EdenGraphics::colimacon(int16 pattern[16]) {
+void EdenGraphics::colimacon(const int16 pattern[16]) {
int16 p, r27, r25;
int16 ww = _game->_vm->_screenView->_pitch;
@@ -1389,7 +1389,7 @@ void EdenGraphics::handleHNMSubtitles() {
#define SUB_LINE(start, end) \
(start), (end) | 0x8000
- static uint16 kFramesVid170[] = {
+ static const uint16 kFramesVid170[] = {
SUB_LINE(68, 120),
SUB_LINE(123, 196),
SUB_LINE(199, 274),
@@ -1409,13 +1409,13 @@ void EdenGraphics::handleHNMSubtitles() {
0xFFFF
};
- static uint16 kFramesVid83[] = {
+ static const uint16 kFramesVid83[] = {
SUB_LINE(99, 155),
SUB_LINE(157, 256),
0xFFFF
};
- static uint16 kFramesVid88[] = {
+ static const uint16 kFramesVid88[] = {
SUB_LINE(106, 173),
SUB_LINE(175, 244),
SUB_LINE(246, 350),
@@ -1423,7 +1423,7 @@ void EdenGraphics::handleHNMSubtitles() {
0xFFFF
};
- static uint16 kFramesVid89[] = {
+ static const uint16 kFramesVid89[] = {
SUB_LINE(126, 176),
SUB_LINE(178, 267),
SUB_LINE(269, 342),
@@ -1433,7 +1433,7 @@ void EdenGraphics::handleHNMSubtitles() {
0xFFFF
};
- static uint16 kFramesVid94[] = {
+ static const uint16 kFramesVid94[] = {
SUB_LINE(101, 213),
SUB_LINE(215, 353),
SUB_LINE(355, 455),
@@ -1445,7 +1445,7 @@ void EdenGraphics::handleHNMSubtitles() {
#undef SUB_LINE
- uint16 *frames = nullptr;
+ const uint16 *frames = nullptr;
perso_t *perso = nullptr;
switch (_game->_globals->_curVideoNum) {
@@ -1473,7 +1473,7 @@ void EdenGraphics::handleHNMSubtitles() {
assert(perso != nullptr);
assert(frames != nullptr);
- uint16 *frames_start = frames;
+ const uint16 *frames_start = frames;
uint16 frame;
while ((frame = *frames++) != 0xFFFF) {
if ((frame & ~0x8000) == _hnmFrameNum)
diff --git a/engines/cryo/eden_graphics.h b/engines/cryo/eden_graphics.h
index 30d726c1a3..18daf11d2c 100644
--- a/engines/cryo/eden_graphics.h
+++ b/engines/cryo/eden_graphics.h
@@ -225,7 +225,7 @@ private:
// Original name: effet4
void displayEffect4();
- void colimacon(int16 pattern[]);
+ void colimacon(const int16 pattern[]);
// Original name: rectanglenoir32
void blackRect32();
Commit: a8cbad4c2e233681c3edd3e1f491ab929219a9f3
https://github.com/scummvm/scummvm/commit/a8cbad4c2e233681c3edd3e1f491ab929219a9f3
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-09-03T00:41:58+03:00
Commit Message:
CRYO: Fix memory leaks
Changed paths:
engines/cryo/eden.cpp
engines/cryo/eden.h
engines/cryo/eden_graphics.cpp
engines/cryo/eden_graphics.h
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index b5928eb120..80fb15bef2 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -4064,6 +4064,12 @@ void EdenGame::freebuf() {
free(_gameFont);
free(_gameLipsync);
free(_musicBuf);
+
+ if (_soundAllocated) {
+ free(_voiceSamplesBuffer);
+ _voiceSamplesBuffer = nullptr;
+ _soundAllocated = false;
+ }
}
void EdenGame::EmergencyExit() {
@@ -4122,6 +4128,9 @@ void EdenGame::run() {
_musicPlayingFlag = false;
_musicEnabledFlag = false;
}
+
+ if (_vm->getPlatform() == Common::kPlatformMacintosh)
+ DELETEcharge_objet_mob(&_cube);
// LostEdenMac_SavePrefs();
}
@@ -7251,6 +7260,17 @@ void EdenGame::NEWcharge_objet_mob(Cube *cubep, int fileNum, byte *texturePtr) {
cubep->_vertices = vertices;
}
+void EdenGame::DELETEcharge_objet_mob(Cube *cubep) {
+ for (int i = 0; i < cubep->_num; i++) {
+ free(cubep->_faces[i]->_indices);
+ free(cubep->_faces[i]->_uv);
+ free(cubep->_faces[i]);
+ }
+ free(cubep->_faces);
+ free(cubep->_projection);
+ free(cubep->_vertices);
+}
+
int EdenGame::nextVal(char **ptr, char *error) {
char c = 0;
char *p = *ptr;
diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h
index 19c4a83996..947d29af1d 100644
--- a/engines/cryo/eden.h
+++ b/engines/cryo/eden.h
@@ -516,6 +516,7 @@ private:
void displayObject(Cube *cube);
void loadMap(int file_id, byte *buffer);
void NEWcharge_objet_mob(Cube *cube, int fileNum, byte *texturePtr);
+ void DELETEcharge_objet_mob(Cube *cubep);
static int nextVal(char **ptr, char *error);
void selectMap(int16 num);
void Eden_dep_and_rot();
diff --git a/engines/cryo/eden_graphics.cpp b/engines/cryo/eden_graphics.cpp
index f826e47b86..708fcb7cdc 100644
--- a/engines/cryo/eden_graphics.cpp
+++ b/engines/cryo/eden_graphics.cpp
@@ -63,6 +63,14 @@ EdenGraphics::EdenGraphics(EdenGame *game) : _game(game) {
_newColor.r = _newColor.g = _newColor.b = 0;
}
+EdenGraphics::~EdenGraphics() {
+ delete _underBarsView;
+ delete _view2;
+ delete _subtitlesView;
+ delete _underSubtitlesView;
+ delete _mainView;
+}
+
void EdenGraphics::SendPalette2Screen(int16 value) {
CLPalette_Send2Screen(_globalPalette, 0, value);
}
@@ -806,7 +814,7 @@ View *EdenGraphics::getUnderBarsView() {
}
void EdenGraphics::openWindow() {
- _underBarsView = new View(320, 40); //TODO: Who deletes these?
+ _underBarsView = new View(320, 40);
_underBarsView->_normal._width = 320;
_view2 = new View(32, 32);
diff --git a/engines/cryo/eden_graphics.h b/engines/cryo/eden_graphics.h
index 18daf11d2c..d7a22cd0c8 100644
--- a/engines/cryo/eden_graphics.h
+++ b/engines/cryo/eden_graphics.h
@@ -33,6 +33,7 @@ class HnmPlayer;
class EdenGraphics {
public:
EdenGraphics(EdenGame *game);
+ ~EdenGraphics();
// Original name: noclipax
void drawSprite(int16 index, int16 x, int16 y, bool withBlack = false, bool onSubtitle = false);
Commit: c955cc3c3def487d4d753cabb1c7329319ee7b85
https://github.com/scummvm/scummvm/commit/c955cc3c3def487d4d753cabb1c7329319ee7b85
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-09-03T00:41:58+03:00
Commit Message:
CRYO: Ensure all variables are initialised on startup
Changed paths:
engines/cryo/cryo.cpp
engines/cryo/cryo.h
engines/cryo/cryolib.cpp
engines/cryo/cryolib.h
engines/cryo/eden_graphics.cpp
engines/cryo/eden_graphics.h
diff --git a/engines/cryo/cryo.cpp b/engines/cryo/cryo.cpp
index c9caadbc50..1d63db7f52 100644
--- a/engines/cryo/cryo.cpp
+++ b/engines/cryo/cryo.cpp
@@ -47,6 +47,8 @@ CryoEngine::CryoEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engin
_showHotspots = false;
_timerTicks = 0;
+ _mouseButton = 0;
+
g_ed = this;
}
diff --git a/engines/cryo/cryo.h b/engines/cryo/cryo.h
index b28c8014b3..088f362671 100644
--- a/engines/cryo/cryo.h
+++ b/engines/cryo/cryo.h
@@ -82,6 +82,10 @@ public:
void getMousePosition(int16 *x, int16 *y);
void setMousePosition(int16 x, int16 y);
bool isMouseButtonDown();
+
+private:
+ int _mouseButton;
+ // byte _keyState[256];
};
extern CryoEngine *g_ed;
diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp
index 32a60b4d19..53e4c415fb 100644
--- a/engines/cryo/cryolib.cpp
+++ b/engines/cryo/cryolib.cpp
@@ -95,14 +95,18 @@ void View::centerIn(View *parent) {
}
///// CLPalette
-uint16 gIntervalLast, gIntervalFirst, gIntervalSet;
-int16 gMacintize = 0;
-color_t black_palette[256];
-color_t last_palette[256];
+static uint16 gIntervalLast, gIntervalFirst, gIntervalSet;
+static int16 gMacintize;
+static color_t last_palette[256];
void CLPalette_Init() {
+ gIntervalLast = 0;
+ gIntervalFirst = 0;
+ gIntervalSet = 0;
+ gMacintize = 0;
+
for (int16 i = 0; i < 256; i++)
- black_palette[i].r = black_palette[i].g = black_palette[i].b = 0;
+ last_palette[i].r = last_palette[i].g = last_palette[i].b = 0;
}
void CLPalette_SetLastPalette(color_t *palette, int16 first, int16 count) {
@@ -169,6 +173,13 @@ static uint16 newPaletteCount, newPaletteFirst;
static color_t *pNewPalette;
static bool useNewPalette;
+void CLBlitter_Init() {
+ newPaletteCount = 0;
+ newPaletteFirst = 0;
+ pNewPalette = nullptr;
+ useNewPalette = false;
+}
+
void CLBlitter_CopyViewRect(View *view1, View *view2, Common::Rect *rect1, Common::Rect *rect2) {
int dy = rect2->top;
int w = rect1->right - rect1->left + 1;
@@ -252,8 +263,6 @@ void CLBlitter_FillScreenView(unsigned int fill) {
}
///// events wrapper
-int _mouseButton;
-byte _keyState[256];
void CryoEngine::pollEvents() {
g_system->delayMillis(10);
@@ -316,6 +325,8 @@ void CLTimer_Action(void *arg) {
///// CRYOLib
void CRYOLib_ManagersInit() {
+ CLPalette_Init();
+ CLBlitter_Init();
g_system->getTimerManager()->installTimerProc(CLTimer_Action, 10000, nullptr, "100hz timer");
g_ed->_screenView->initDatas(g_ed->_screen.w, g_ed->_screen.h, g_ed->_screen.getPixels());
}
diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h
index ed569af550..e153a73f6b 100644
--- a/engines/cryo/cryolib.h
+++ b/engines/cryo/cryolib.h
@@ -74,6 +74,7 @@ struct color_t {
void SysBeep(int x);
void FlushEvents(int16 arg1, int16 arg2);
+void CLBlitter_Init();
void CLBlitter_CopyViewRect(View *view1, View *view2, Common::Rect *rect1, Common::Rect *rect2);
void CLBlitter_Send2ScreenNextCopy(color_t *palette, uint16 first, uint16 count);
void CLBlitter_OneBlackFlash();
diff --git a/engines/cryo/eden_graphics.cpp b/engines/cryo/eden_graphics.cpp
index 708fcb7cdc..dc9163fa7f 100644
--- a/engines/cryo/eden_graphics.cpp
+++ b/engines/cryo/eden_graphics.cpp
@@ -47,6 +47,7 @@ EdenGraphics::EdenGraphics(EdenGame *game) : _game(game) {
_subtitlesView = nullptr;
_underBarsView = nullptr;
_needToFade = false;
+ _eff2pat = 0;
_savedUnderSubtitles = false;
_underSubtitlesViewBuf = nullptr;
@@ -893,12 +894,11 @@ void EdenGraphics::displayEffect2() {
static const int16 pattern3[] = { 0, 2, 5, 7, 8, 10, 13, 15, 1, 3, 4, 6, 9, 11, 12, 14 };
static const int16 pattern4[] = { 0, 3, 15, 12, 1, 7, 14, 8, 2, 11, 13, 4, 5, 6, 10, 9 };
- static int eff2pat = 0;
if (_game->_globals->_var103 == 69) {
displayEffect4();
return;
}
- switch (++eff2pat) {
+ switch (++_eff2pat) {
case 1:
colimacon(pattern1);
break;
@@ -911,7 +911,7 @@ void EdenGraphics::displayEffect2() {
case 4:
default:
colimacon(pattern4);
- eff2pat = 0;
+ _eff2pat = 0;
break;
}
}
diff --git a/engines/cryo/eden_graphics.h b/engines/cryo/eden_graphics.h
index d7a22cd0c8..96ecd6a18e 100644
--- a/engines/cryo/eden_graphics.h
+++ b/engines/cryo/eden_graphics.h
@@ -202,6 +202,8 @@ private:
bool _needToFade;
+ int _eff2pat;
+
color3_t _newColor;
color_t _oldPalette[256]; // TODO palette_t ?
color_t _newPalette[256];
Commit: e022d804472f25d8362beeffd7be35b13e51762c
https://github.com/scummvm/scummvm/commit/e022d804472f25d8362beeffd7be35b13e51762c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-09-03T00:41:58+03:00
Commit Message:
CRYO: Support Return to Launcher
Changed paths:
engines/cryo/cryo.cpp
engines/cryo/cryo.h
engines/cryo/eden.cpp
diff --git a/engines/cryo/cryo.cpp b/engines/cryo/cryo.cpp
index 1d63db7f52..3f2aa3dba4 100644
--- a/engines/cryo/cryo.cpp
+++ b/engines/cryo/cryo.cpp
@@ -75,4 +75,8 @@ Common::Error CryoEngine::run() {
return Common::kNoError;
}
+bool CryoEngine::hasFeature(EngineFeature f) const {
+ return (f == kSupportsReturnToLauncher);
+}
+
} // End of namespace Cryo
diff --git a/engines/cryo/cryo.h b/engines/cryo/cryo.h
index 088f362671..7c1279167e 100644
--- a/engines/cryo/cryo.h
+++ b/engines/cryo/cryo.h
@@ -57,6 +57,7 @@ public:
~CryoEngine() override;
Common::Error run() override;
+ bool hasFeature(EngineFeature f) const override;
// Detection related functions
const ADGameDescription *_gameDescription;
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 80fb15bef2..573ea73125 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -5759,7 +5759,7 @@ void EdenGame::edenShudown() {
if (_globals->_displayFlags != DisplayFlags::dfFlag2)
gotoPanel();
_curSpot2 = icon + 7; //TODO
- edenQuit();
+ reallyquit();
}
void EdenGame::habitants(perso_t *perso) {
Commit: f24b71100b7e7c86ceb3cef2c2c85f2d0a26c465
https://github.com/scummvm/scummvm/commit/f24b71100b7e7c86ceb3cef2c2c85f2d0a26c465
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-09-03T00:41:58+03:00
Commit Message:
CRYO: Remove unused variable
Changed paths:
engines/cryo/cryo.h
engines/cryo/cryolib.cpp
diff --git a/engines/cryo/cryo.h b/engines/cryo/cryo.h
index 7c1279167e..617cb28225 100644
--- a/engines/cryo/cryo.h
+++ b/engines/cryo/cryo.h
@@ -86,7 +86,6 @@ public:
private:
int _mouseButton;
- // byte _keyState[256];
};
extern CryoEngine *g_ed;
diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp
index 53e4c415fb..da9aa7e44a 100644
--- a/engines/cryo/cryolib.cpp
+++ b/engines/cryo/cryolib.cpp
@@ -278,7 +278,6 @@ void CryoEngine::pollEvents() {
case Common::EVENT_KEYDOWN:
return;
case Common::EVENT_KEYUP:
- // _keyState[(byte)toupper(event.kbd.ascii)] = false;
return;
case Common::EVENT_LBUTTONDOWN:
_mouseButton = 1;
More information about the Scummvm-git-logs
mailing list