CGE: Suppress isVga() and memType()

This commit is contained in:
Strangerke 2011-07-12 08:02:18 +02:00
parent dab96401ad
commit a524adcaee
6 changed files with 35 additions and 81 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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");
}

View File

@ -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 *));

View File

@ -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) {

View File

@ -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 = "";
/*
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());
}
Common::String buffer = "";
/*
clear(0);
setMode(_oldMode);
setColors();
restoreScreen(_oldScreen);
sunrise(_oldColors);
*/
free(_oldColors);
free(_newColors);
if (_msg)
buffer = Common::String(_msg);
if (_nam)
buffer = buffer + " [" + _nam + "]";
debugN("%s", buffer.c_str());
delete _showQ;
delete _spareQ;