aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2011-07-12 08:02:18 +0200
committerStrangerke2011-07-12 08:02:18 +0200
commita524adcaee89678ba99b294fcbc5efdf9e137c04 (patch)
treea8f3086c4ee3222035dc069f55da11d94377f79c
parentdab96401ad352512a8ffa8c1d7baeb431ade7b8c (diff)
downloadscummvm-rg350-a524adcaee89678ba99b294fcbc5efdf9e137c04.tar.gz
scummvm-rg350-a524adcaee89678ba99b294fcbc5efdf9e137c04.tar.bz2
scummvm-rg350-a524adcaee89678ba99b294fcbc5efdf9e137c04.zip
CGE: Suppress isVga() and memType()
-rw-r--r--engines/cge/bitmap.cpp9
-rw-r--r--engines/cge/cfile.cpp3
-rw-r--r--engines/cge/general.cpp23
-rw-r--r--engines/cge/general.h9
-rw-r--r--engines/cge/snail.cpp5
-rw-r--r--engines/cge/vga13h.cpp65
6 files changed, 34 insertions, 80 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 48bfe1fafb..8474924366 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -144,8 +144,7 @@ Bitmap::Bitmap(const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL),
Bitmap::~Bitmap() {
- if (_m)
- free(_m);
+ free(_m);
delete[] _v;
}
@@ -156,8 +155,7 @@ Bitmap &Bitmap::operator = (const Bitmap &bmp) {
_h = bmp._h;
_m = NULL;
_map = 0;
- if (memType(_v) == FAR_MEM)
- free(_v);
+ free(_v);
if (v0 == NULL)
_v = NULL;
else {
@@ -178,8 +176,7 @@ uint16 Bitmap::moveVmap(uint8 *buf) {
uint16 vsiz = (uint8 *)_b - (uint8 *)_v;
uint16 siz = vsiz + _h * sizeof(HideDesc);
memcpy(buf, _v, siz);
- if (memType(_v) == FAR_MEM)
- free(_v);
+ free(_v);
_b = (HideDesc *)((_v = buf) + vsiz);
return siz;
}
diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp
index b235d552b2..f0a0ef3b8f 100644
--- a/engines/cge/cfile.cpp
+++ b/engines/cge/cfile.cpp
@@ -54,8 +54,7 @@ IoBuf::IoBuf(const char *name, IOMODE mode, CRYPT *crpt)
IoBuf::~IoBuf() {
if (_mode > REA)
writeBuff();
- if (_buff)
- free(_buff);
+ free(_buff);
}
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 6ed6884aba..f17ebf799c 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -267,29 +267,6 @@ bool IoHand::exist(const char *name) {
return f.exists(name);
}
-//#define EMS_ADR(a) (FP_SEG(a) > 0xA000)
-//#define HNODE_OK(p) (heapchecknode(p)==4)
-
-MEM_TYPE memType(void *mem) {
- /* if (FP_SEG(mem) == _DS) {
- if (heapchecknode((void *)mem)==4)
- return NEAR_MEM;
- } else {
- if (FP_SEG(mem) > 0xA000)
- return EMS_MEM;
- else if (farheapchecknode(mem)==4)
- return FAR_MEM;
- }
- return BAD_MEM;
- */
- warning("STUB: memType");
- return FAR_MEM;
-}
-
-bool isVga() {
- return true;
-}
-
void sndInit() {
warning("STUB: SNDInit");
}
diff --git a/engines/cge/general.h b/engines/cge/general.h
index 2eebc01c62..a3cc12080d 100644
--- a/engines/cge/general.h
+++ b/engines/cge/general.h
@@ -39,7 +39,6 @@ namespace CGE {
#define SEED 0xA5
-enum MEM_TYPE { BAD_MEM, EMS_MEM, NEAR_MEM, FAR_MEM };
enum IOMODE { REA, WRI, UPD };
struct Dac {
@@ -140,8 +139,6 @@ void swap(T &A, T &B) {
B = a;
}
-
-#ifdef __cplusplus
template <class T>
T max(T A, T B) {
return (A > B) ? A : B;
@@ -151,8 +148,6 @@ template <class T>
T min(T A, T B) {
return (A < B) ? A : B;
}
-#endif
-
class XFile {
public:
@@ -195,10 +190,8 @@ public:
// void SetTime (timeb t);
};
-
CRYPT XCrypt;
CRYPT RCrypt;
-MEM_TYPE memType(void *mem);
uint16 atow(const char *a);
uint16 xtow(const char *x);
char *wtom(uint16 val, char *str, int radix, int len);
@@ -209,8 +202,6 @@ long timer();
char *mergeExt(char *buf, const char *nam, const char *ext);
char *forceExt(char *buf, const char *nam, const char *ext);
int driveCD(unsigned drv);
-bool isVga();
-
// MISSING FUNCTIONS
void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *));
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index bc9d212468..a568110de7 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -381,7 +381,7 @@ void CGEEngine::feedSnail(Sprite *spr, SNLIST snq) {
if (c->_ptr)
break;
else
- ++c;
+ c++;
}
}
}
@@ -410,8 +410,7 @@ Snail::Snail(CGEEngine *vm, bool turbo)
}
Snail::~Snail() {
- if (_snList)
- free(_snList);
+ free(_snList);
}
void Snail::addCom(SNCOM com, int ref, int val, void *ptr) {
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index e85e13d20c..4d8b5bf628 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -621,12 +621,9 @@ Sprite *Sprite::contract() {
delete e->_shpList[i];
delete[] e->_shpList;
}
- if (memType(e->_seq) == NEAR_MEM)
- free(e->_seq);
- if (e->_near)
- free(e->_near);
- if (e->_take)
- free(e->_take);
+// free(e->_seq);
+ free(e->_near);
+ free(e->_take);
delete e;
_ext = NULL;
}
@@ -683,8 +680,7 @@ void Sprite::killXlat() {
if (_flags._xlat && _ext) {
BMP_PTR *b;
uint8 *m = (*_ext->_shpList)->_m;
- if (m)
- free(m);
+ free(m);
for (b = _ext->_shpList; *b; b++)
(*b)->_m = NULL;
@@ -967,42 +963,37 @@ Vga::Vga(int mode)
setStatAdr();
if (_statAdr != VGAST1_)
_mono++;
- if (isVga()) {
- _oldColors = farnew(Dac, 256);
- _newColors = farnew(Dac, 256);
- _oldScreen = SaveScreen();
- getColors(_oldColors);
- sunset();
- _oldMode = setMode(mode);
- setColors();
- setup(VideoMode);
- clear(0);
- }
+ _oldColors = farnew(Dac, 256);
+ _newColors = farnew(Dac, 256);
+ _oldScreen = SaveScreen();
+ getColors(_oldColors);
+ sunset();
+ _oldMode = setMode(mode);
+ setColors();
+ setup(VideoMode);
+ clear(0);
}
Vga::~Vga() {
_mono = 0;
- if (isVga()) {
- Common::String buffer = "";
+
+ Common::String buffer = "";
/*
- clear(0);
- setMode(_oldMode);
- setColors();
- restoreScreen(_oldScreen);
- sunrise(_oldColors);
+ clear(0);
+ setMode(_oldMode);
+ setColors();
+ restoreScreen(_oldScreen);
+ sunrise(_oldColors);
*/
- if (_oldColors)
- free(_oldColors);
- if (_newColors)
- free(_newColors);
- if (_msg)
- buffer = Common::String(_msg);
- if (_nam)
- buffer = buffer + " [" + _nam + "]";
-
- debugN("%s", buffer.c_str());
- }
+ free(_oldColors);
+ free(_newColors);
+ if (_msg)
+ buffer = Common::String(_msg);
+ if (_nam)
+ buffer = buffer + " [" + _nam + "]";
+
+ debugN("%s", buffer.c_str());
delete _showQ;
delete _spareQ;