mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
KYRA: (EOB) - fix some valgrind warnings
This commit is contained in:
parent
816b40ebf8
commit
68ed8b9598
@ -183,7 +183,7 @@ EobCoreEngine::~EobCoreEngine() {
|
||||
delete[] _itemTypes;
|
||||
if (_itemNames) {
|
||||
for (int i = 0; i < 130; i++)
|
||||
delete _itemNames[i];
|
||||
delete[] _itemNames[i];
|
||||
}
|
||||
delete[] _itemNames;
|
||||
delete[] _flyingObjects;
|
||||
@ -218,6 +218,9 @@ EobCoreEngine::~EobCoreEngine() {
|
||||
|
||||
delete _gui;
|
||||
_gui = 0;
|
||||
delete _screen;
|
||||
_screen = 0;
|
||||
|
||||
delete[] _menuDefs;
|
||||
_menuDefs = 0;
|
||||
|
||||
@ -227,6 +230,8 @@ EobCoreEngine::~EobCoreEngine() {
|
||||
_timer = 0;
|
||||
delete _debugger;
|
||||
_debugger = 0;
|
||||
delete _txt;
|
||||
_txt = 0;
|
||||
}
|
||||
|
||||
Common::Error EobCoreEngine::init() {
|
||||
@ -672,6 +677,8 @@ void EobCoreEngine::releaseItemsAndDecorationsShapes() {
|
||||
delete []_firebeamShapes;
|
||||
}
|
||||
|
||||
delete[] _redSplatShape;
|
||||
delete[] _greenSplatShape;
|
||||
delete[] _deadCharShape;
|
||||
delete[] _disabledCharGrid;
|
||||
delete[] _blackBoxSmallGrid;
|
||||
@ -1214,18 +1221,15 @@ void EobCoreEngine::setWeaponSlotStatus(int charIndex, int mode, int slot) {
|
||||
gui_drawCharPortraitWithStats(charIndex);
|
||||
}
|
||||
|
||||
void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char *str1, ...) {
|
||||
void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char *str1, va_list &args) {
|
||||
_dialogueNumButtons = numStr;
|
||||
_dialogueButtonString[0] = str1;
|
||||
_dialogueHighlightedButton = 0;
|
||||
|
||||
va_list args;
|
||||
va_start(args, str1);
|
||||
const char **sp = va_arg(args, const char**);
|
||||
va_end(args);
|
||||
for (int i = 1; i < numStr; i++) {
|
||||
if (sp[i - 1])
|
||||
_dialogueButtonString[i] = sp[i - 1];
|
||||
const char *tmp = va_arg(args, const char*);
|
||||
if (tmp)
|
||||
_dialogueButtonString[i] = tmp;
|
||||
else
|
||||
_dialogueNumButtons = numStr = i;
|
||||
}
|
||||
|
@ -757,7 +757,7 @@ protected:
|
||||
bool _configHpBarGraphs;
|
||||
|
||||
// text
|
||||
void setupDialogueButtons(int presetfirst, int numStr, const char *str1, ...);
|
||||
void setupDialogueButtons(int presetfirst, int numStr, const char *str1, va_list &args);
|
||||
void initDialogueSequence();
|
||||
void restoreAfterDialogueSequence();
|
||||
void drawSequenceBitmap(const char *file, int destRect, int x1, int y1, int flags);
|
||||
|
@ -225,6 +225,8 @@ LoLEngine::~LoLEngine() {
|
||||
_gui = 0;
|
||||
delete _tim;
|
||||
_tim = 0;
|
||||
delete _txt;
|
||||
_txt = 0;
|
||||
|
||||
delete[] _itemsInPlay;
|
||||
delete[] _itemProperties;
|
||||
@ -298,6 +300,8 @@ LoLEngine::~LoLEngine() {
|
||||
_doorShapes[i] = 0;
|
||||
}
|
||||
|
||||
releaseDecorations();
|
||||
|
||||
delete[] _automapShapes;
|
||||
|
||||
for (Common::Array<const TIMOpcode*>::iterator i = _timIntroOpcodes.begin(); i != _timIntroOpcodes.end(); ++i)
|
||||
|
@ -915,6 +915,7 @@ private:
|
||||
void assignBlockObject(LevelBlockProperty *l, uint16 item);
|
||||
int assignLevelDecorationShapes(int index);
|
||||
uint8 *getLevelDecorationShapes(int index);
|
||||
void releaseDecorations(int first = 0, int num = 400);
|
||||
void restoreTempDataAdjustMonsterStrength(int index);
|
||||
void loadBlockProperties(const char *cmzFile);
|
||||
const uint8 *getBlockFileData(int levelIndex);
|
||||
|
@ -149,9 +149,6 @@ LolEobBaseEngine::~LolEobBaseEngine() {
|
||||
delete[] _levelDecorationData;
|
||||
delete[] _levelDecorationProperties;
|
||||
delete[] _levelBlockProperties;
|
||||
|
||||
delete _txt;
|
||||
_txt = 0;
|
||||
}
|
||||
|
||||
Common::Error LolEobBaseEngine::init() {
|
||||
|
@ -1092,18 +1092,22 @@ void EobCoreEngine::drawSceneShapes(int start) {
|
||||
}
|
||||
|
||||
void EobCoreEngine::drawDecorations(int index) {
|
||||
static const int16 *dscWalls[] = { 0, 0, &_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown,
|
||||
&_sceneDrawVarRight, &_sceneDrawVarDown, 0, &_sceneDrawVarDown, &_sceneDrawVarLeft, &_sceneDrawVarDown,
|
||||
&_sceneDrawVarLeft, 0, 0, &_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, &_sceneDrawVarRight,
|
||||
&_sceneDrawVarDown, 0, &_sceneDrawVarDown, &_sceneDrawVarLeft, &_sceneDrawVarDown, &_sceneDrawVarLeft,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0, &_sceneDrawVarDown, &_sceneDrawVarLeft,
|
||||
0, &_sceneDrawVarRight, &_sceneDrawVarDown, 0, 0, &_sceneDrawVarLeft
|
||||
static const int16 *dscWalls[] = {
|
||||
0, 0, &_sceneDrawVarDown, &_sceneDrawVarRight,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarLeft, &_sceneDrawVarDown, &_sceneDrawVarLeft,
|
||||
0, 0, &_sceneDrawVarDown, &_sceneDrawVarRight,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarLeft, &_sceneDrawVarDown, &_sceneDrawVarLeft,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarRight, &_sceneDrawVarDown, 0,
|
||||
&_sceneDrawVarDown, &_sceneDrawVarLeft, 0, &_sceneDrawVarRight,
|
||||
&_sceneDrawVarDown, 0, 0, &_sceneDrawVarLeft
|
||||
};
|
||||
|
||||
for (int i = 1; i >= 0; i--) {
|
||||
int s = index * 2 + i;
|
||||
if (dscWalls[s]) {
|
||||
int d = *dscWalls[s];
|
||||
int16 d = *dscWalls[s];
|
||||
int8 l = _wllShapeMap[_visibleBlocks[index]->walls[d]];
|
||||
|
||||
uint8 *shapeData = 0;
|
||||
|
@ -200,6 +200,7 @@ int LoLEngine::assignLevelDecorationShapes(int index) {
|
||||
if (pv) {
|
||||
_levelDecorationProperties[o].shapeIndex[i] = pv;
|
||||
} else {
|
||||
releaseDecorations(_lvlShapeIndex, 1);
|
||||
_levelDecorationShapes[_lvlShapeIndex] = getLevelDecorationShapes(t);
|
||||
p1[t] = _lvlShapeIndex;
|
||||
_levelDecorationProperties[o].shapeIndex[i] = _lvlShapeIndex++;
|
||||
@ -232,6 +233,13 @@ uint8 *LoLEngine::getLevelDecorationShapes(int shapeIndex) {
|
||||
return res;
|
||||
}
|
||||
|
||||
void LoLEngine::releaseDecorations(int first, int num) {
|
||||
for (int i = first; i < (first + num); i++) {
|
||||
delete[] _levelDecorationShapes[i];
|
||||
_levelDecorationShapes[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LoLEngine::loadBlockProperties(const char *cmzFile) {
|
||||
memset(_levelBlockProperties, 0, 1024 * sizeof(LevelBlockProperty));
|
||||
_screen->loadBitmap(cmzFile, 2, 2, 0);
|
||||
|
@ -848,7 +848,8 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
|
||||
void Screen::copyPage(uint8 srcPage, uint8 dstPage) {
|
||||
uint8 *src = getPagePtr(srcPage);
|
||||
uint8 *dst = getPagePtr(dstPage);
|
||||
memcpy(dst, src, SCREEN_W * SCREEN_H);
|
||||
if (src != dst)
|
||||
memcpy(dst, src, SCREEN_W * SCREEN_H);
|
||||
copyOverlayRegion(0, 0, 0, 0, SCREEN_W, SCREEN_H, srcPage, dstPage);
|
||||
|
||||
if (dstPage == 0 || dstPage == 1)
|
||||
|
@ -46,6 +46,7 @@ Screen_Eob::Screen_Eob(EobCoreEngine *vm, OSystem *system) : Screen(vm, system)
|
||||
_gfxCol = 0;
|
||||
_customDimTable = 0;
|
||||
_dsTempPage = 0;
|
||||
_curDimIndex = 0;
|
||||
}
|
||||
|
||||
Screen_Eob::~Screen_Eob() {
|
||||
@ -266,7 +267,7 @@ uint8 *Screen_Eob::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4b
|
||||
uint8 *colorMap = new uint8[0x100];
|
||||
memset (colorMap, 0xff, 0x100);
|
||||
|
||||
shapesize = h * (w << 2) + 0x14;
|
||||
shapesize = h * (w << 2) + 20;
|
||||
shp = new uint8[shapesize];
|
||||
memset (shp, 0, shapesize);
|
||||
uint8 *dst = shp;
|
||||
@ -673,14 +674,13 @@ const uint8 *Screen_Eob::scaleShapeStep(const uint8 *shp) {
|
||||
i = -i;
|
||||
|
||||
_dsScaleTmp = (i << 4) | (i & 0x0f);
|
||||
memcpy(d, shp, 16);
|
||||
d += 16;
|
||||
shp += 16;
|
||||
for (int ii = 0; ii < 16; ii++)
|
||||
*d++ = *shp++;
|
||||
|
||||
_dsDiv = w2 / 3;
|
||||
_dsRem = w2 % 3;
|
||||
|
||||
do {
|
||||
while (--h) {
|
||||
scaleShapeProcessLine(d, shp);
|
||||
if (!--h)
|
||||
break;
|
||||
@ -688,7 +688,7 @@ const uint8 *Screen_Eob::scaleShapeStep(const uint8 *shp) {
|
||||
if (!--h)
|
||||
break;
|
||||
shp += w2;
|
||||
} while (--h);
|
||||
}
|
||||
|
||||
return (const uint8 *) _dsTempPage;
|
||||
}
|
||||
@ -1100,15 +1100,14 @@ void Screen_Eob::drawShapeSetPixel(uint8 * dst, uint8 c) {
|
||||
void Screen_Eob::scaleShapeProcessLine(uint8 *&dst, const uint8 *&src) {
|
||||
for (int i = 0; i < _dsDiv; i++) {
|
||||
*dst++ = *src++;
|
||||
*dst++ = READ_BE_UINT16(src) >> 4;
|
||||
*dst++ = (READ_BE_UINT16(src) >> 4) & 0xff;
|
||||
src += 2;
|
||||
}
|
||||
|
||||
if (_dsRem == 1) {
|
||||
*dst++ = *src++;
|
||||
*dst++ = _dsScaleTmp;
|
||||
|
||||
} if (_dsRem == 2) {
|
||||
} else if (_dsRem == 2) {
|
||||
*dst++ = (src[0] & 0xf0) | (src[1] >> 4);
|
||||
src += 2;
|
||||
*dst++ = _dsScaleTmp;
|
||||
|
@ -893,6 +893,7 @@ TIMInterpreter_LoL::TIMInterpreter_LoL(LoLEngine *engine, Screen_v2 *screen_v2,
|
||||
|
||||
_screen = engine->_screen;
|
||||
|
||||
delete _animator;
|
||||
_animator = new TimAnimator(engine, screen_v2, system, true);
|
||||
|
||||
_drawPage2 = 0;
|
||||
|
@ -951,7 +951,7 @@ DarkmoonSequenceHelper::~DarkmoonSequenceHelper() {
|
||||
delete _palettes[11];
|
||||
|
||||
for (int i = 0; i < 30; i++)
|
||||
delete _shapes[i];
|
||||
delete[] _shapes[i];
|
||||
delete[] _shapes;
|
||||
|
||||
_screen->clearCurPage();
|
||||
|
Loading…
x
Reference in New Issue
Block a user