diff options
| author | Strangerke | 2011-08-19 19:48:49 +0200 | 
|---|---|---|
| committer | Strangerke | 2011-08-19 19:48:49 +0200 | 
| commit | 8ff904c6b576eda37930b020e39855c1fd261b2f (patch) | |
| tree | 390edc117114c3194d57a8145e4faa34aa85b26d | |
| parent | df122cec1779659365f4f3bddb67b6b635620822 (diff) | |
| download | scummvm-rg350-8ff904c6b576eda37930b020e39855c1fd261b2f.tar.gz scummvm-rg350-8ff904c6b576eda37930b020e39855c1fd261b2f.tar.bz2 scummvm-rg350-8ff904c6b576eda37930b020e39855c1fd261b2f.zip | |
CGE: clean up bitmap class. Suppress useless methods, functions, defines...
| -rw-r--r-- | engines/cge/bitmap.cpp | 116 | ||||
| -rw-r--r-- | engines/cge/bitmap.h | 5 | ||||
| -rw-r--r-- | engines/cge/cge_main.cpp | 4 | ||||
| -rw-r--r-- | engines/cge/events.cpp | 4 | ||||
| -rw-r--r-- | engines/cge/jbw.h | 1 | ||||
| -rw-r--r-- | engines/cge/mixer.cpp | 4 | ||||
| -rw-r--r-- | engines/cge/vga13h.cpp | 20 | 
7 files changed, 22 insertions, 132 deletions
| diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index e497828788..b7e9eec2fc 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -48,36 +48,18 @@ void Bitmap::deinit() {  }  #pragma argsused -Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL), _map(0) { -	debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%s, %s)", fname, rem ? "true" : "false"); +Bitmap::Bitmap(const char *fname) : _m(NULL), _v(NULL), _map(0) { +	debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%s)", fname);  	char pat[kMaxPath];  	forceExt(pat, fname, ".VBM"); -#if (BMP_MODE < 2) -	if (rem && PIC_FILE::exist(pat)) { +	if (PIC_FILE::exist(pat)) {  		PIC_FILE file(pat);  		if ((file._error == 0) && (!loadVBM(&file)))  			error("Bad VBM [%s]", fname); -	} else -#endif -	{ -#if (BMP_MODE) -		forceExt(pat, fname, ".BMP"); -		PIC_FILE file(pat); -		if (file._error == 0) { -			if (loadBMP(&file)) { -				code(); -				if (rem) { -					free(_m); -					_m = NULL; -				} -			} else -				error("Bad BMP [%s]", fname); -		} -#else +	} else {  		error("Bad VBM [%s]", fname); -#endif  	}  } @@ -88,7 +70,6 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 *map) : _w(w), _h(h), _m(map), _v(NULL)  		code();  } -  // following routine creates filled rectangle  // immediately as VGA video chunks, in near memory as fast as possible,  // especially for text line real time display @@ -117,7 +98,7 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill)  	*(uint16 *)(v + psiz - 2) = TO_LE_16(kBmpEOI);            // plane trailer uint16 -	// Repliccate planes +	// Replicate planes  	for (destP = v + psiz; destP < (v + 4 * psiz); destP += psiz)  		Common::copy(v, v + psiz, destP); @@ -134,7 +115,6 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill)  	_b = b;  } -  Bitmap::Bitmap(const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL), _map(0) {  	debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(bmp)");  	uint8 *v0 = bmp._v; @@ -372,35 +352,6 @@ bool Bitmap::solidAt(int16 x, int16 y) {  	}  } - -bool Bitmap::saveVBM(XFile *f) { -	debugC(1, kCGEDebugBitmap, "Bitmap::saveVBM(f)"); - -	uint16 p = (_pal != NULL), -	       n = ((uint16)(((uint8 *)_b) - _v)) + _h * sizeof(HideDesc); -	if (f->_error == 0) -		f->write((uint8 *)&p, sizeof(p)); - -	if (f->_error == 0) -		f->write((uint8 *)&n, sizeof(n)); - -	if (f->_error == 0) -		f->write((uint8 *)&_w, sizeof(_w)); - -	if (f->_error == 0) -		f->write((uint8 *)&_h, sizeof(_h)); - -	if (f->_error == 0) -		if (p) -			f->write((uint8 *)_pal, 256 * 3); - -	if (f->_error == 0) -		f->write(_v, n); - -	return (f->_error == 0); -} - -  bool Bitmap::loadVBM(XFile *f) {  	debugC(5, kCGEDebugBitmap, "Bitmap::loadVBM(f)"); @@ -448,61 +399,4 @@ bool Bitmap::loadVBM(XFile *f) {  	return (f->_error == 0);  } -bool Bitmap::loadBMP(XFile *f) { -	debugC(1, kCGEDebugBitmap, "Bitmap::loadBMP(f)"); - -	struct { -		char BM[2]; -		union { int16 len; int32 len_; }; -		union { int16 _06; int32 _06_; }; -		union { int16 hdr; int32 hdr_; }; -		union { int16 _0E; int32 _0E_; }; -		union { int16 wid; int32 wid_; }; -		union { int16 hig; int32 hig_; }; -		union { int16 _1A; int32 _1A_; }; -		union { int16 _1E; int32 _1E_; }; -		union { int16 _22; int32 _22_; }; -		union { int16 _26; int32 _26_; }; -		union { int16 _2A; int32 _2A_; }; -		union { int16 _2E; int32 _2E_; }; -		union { int16 _32; int32 _32_; }; -	} hea; - -	Bgr4 bpal[256]; - -	f->read((byte *)&hea, sizeof(hea)); -	if (f->_error == 0) { -		if (hea.hdr == 0x436L) { -			int16 i = (hea.hdr - sizeof(hea)) / sizeof(Bgr4); -			f->read((byte *)&bpal, sizeof(bpal)); -			if (f->_error == 0) { -				if (_pal) { -					for (i = 0; i < 256; i++) { -						_pal[i]._r = bpal[i]._R; -						_pal[i]._g = bpal[i]._G; -						_pal[i]._b = bpal[i]._B; -					} -					_pal = NULL; -				} -				_h = hea.hig; -				_w = hea.wid; -				if ((_m = (byte *) malloc(sizeof(byte) * (_h * _w))) != NULL) { -					int16 r = (4 - (hea.wid & 3)) % 4; -					byte buf[3]; -					for (i = _h - 1; i >= 0; i--) { -						f->read(_m + (_w * i), _w); -						if (r && f->_error == 0) -							f->read(buf, r); -						if (f->_error) -							break; -					} -					if (i < 0) -						return true; -				} -			} -		} -	} -	return false; -} -  } // End of namespace CGE diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index 30e11d08ec..7604cb8081 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -60,7 +60,6 @@ struct HideDesc {  #include "common/pack-end.h"  class Bitmap { -	bool loadBMP(XFile *f);  	bool loadVBM(XFile *f);  public:  	static Dac *_pal; @@ -71,7 +70,7 @@ public:  	int32 _map;  	HideDesc *_b; -	Bitmap(const char *fname, bool rem); +	Bitmap(const char *fname);  	Bitmap(uint16 w, uint16 h, uint8 *map);  	Bitmap(uint16 w, uint16 h, uint8 fill);  	Bitmap(const Bitmap &bmp); @@ -79,14 +78,12 @@ public:  	static void init();  	static void deinit(); -	Bitmap *flipH();  	Bitmap *code();  	Bitmap &operator = (const Bitmap &bmp);  	void hide(int16 x, int16 y);  	void show(int16 x, int16 y);  	void xShow(int16 x, int16 y);  	bool solidAt(int16 x, int16 y); -	bool saveVBM(XFile *f);  	uint16 moveVmap(uint8 *buf);  }; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 5b98b0a4e8..e64fc382ee 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -478,7 +478,7 @@ Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {  	_flags._bDel = false;  	BitmapPtr *MB = new BitmapPtr[2]; -	MB[0] = new Bitmap("BRICK", true); +	MB[0] = new Bitmap("BRICK");  	MB[1] = NULL;  	setShapeList(MB);  } @@ -1632,7 +1632,7 @@ bool CGEEngine::showTitle(const char *name) {  	Bitmap::_pal = Vga::_sysPal;  	BitmapPtr *LB = new BitmapPtr[2]; -	LB[0] = new Bitmap(name, true); +	LB[0] = new Bitmap(name);  	LB[1] = NULL;  	Bitmap::_pal = NULL;  	bool userOk = false; diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index ea2515ef2e..f414bd048a 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -169,8 +169,8 @@ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0)  	setSeq(seq);  	BitmapPtr *MC = new BitmapPtr[3]; -	MC[0] = new Bitmap("MOUSE", true); -	MC[1] = new Bitmap("DUMMY", true); +	MC[0] = new Bitmap("MOUSE"); +	MC[1] = new Bitmap("DUMMY");  	MC[2] = NULL;  	setShapeList(MC); diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 128a92f594..0ba8a1956b 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -35,7 +35,6 @@ namespace CGE {  // Defines found in cge.mak  #define INI_FILE VFile // Or is it CFile?  #define PIC_FILE VFile -#define BMP_MODE 0  //  #define kMaxFile      128 diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index ba24f832c3..7a07f99c6e 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -41,7 +41,7 @@ bool Mixer::_appear = false;  Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(kMixFall), _vm(vm) {  	_appear = true; -	_mb[0] = new Bitmap("VOLUME", true); +	_mb[0] = new Bitmap("VOLUME");  	_mb[1] = NULL;  	setShapeList(_mb);  	setName(_text->getText(kMixName)); @@ -59,7 +59,7 @@ Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(kMixFall), _  	for (i = 0; i < kMixMax; i++) {  		static char fn[] = "V00";  		wtom(i, fn + 1, 10, 2); -		_lb[i] = new Bitmap(fn, true); +		_lb[i] = new Bitmap(fn);  		ls[i]._now = ls[i]._next = i;  		ls[i]._dx = ls[i]._dy = ls[i]._dly = 0;  	} diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index ad2415caaf..d963622b13 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -289,7 +289,7 @@ Sprite *Sprite::expand() {  							++_shpCnt;  						} -						shplist[shpcnt++] = new Bitmap(strtok(NULL, " \t,;/"), true); +						shplist[shpcnt++] = new Bitmap(strtok(NULL, " \t,;/"));  						break;  					}  					case 2 : { // Seq @@ -344,7 +344,7 @@ Sprite *Sprite::expand() {  					}  				}  			} else { // no sprite description: try to read immediately from .BMP -				shplist[shpcnt++] = new Bitmap(_file, true); +				shplist[shpcnt++] = new Bitmap(_file);  			}  			shplist[shpcnt] = NULL;  			if (seq) { @@ -1041,7 +1041,7 @@ void Bitmap::hide(int16 x, int16 y) {  HorizLine::HorizLine(CGEEngine *vm): Sprite(vm, NULL) {  	// Set the sprite list  	BitmapPtr *HL = new BitmapPtr[2]; -	HL[0] = new Bitmap("HLINE", true); +	HL[0] = new Bitmap("HLINE");  	HL[1] = NULL;  	setShapeList(HL); @@ -1050,7 +1050,7 @@ HorizLine::HorizLine(CGEEngine *vm): Sprite(vm, NULL) {  CavLight::CavLight(CGEEngine *vm): Sprite(vm, NULL) {  	// Set the sprite list  	BitmapPtr *PR = new BitmapPtr[2]; -	PR[0] = new Bitmap("PRESS", true); +	PR[0] = new Bitmap("PRESS");  	PR[1] = NULL;  	setShapeList(PR); @@ -1059,8 +1059,8 @@ CavLight::CavLight(CGEEngine *vm): Sprite(vm, NULL) {  Spike::Spike(CGEEngine *vm): Sprite(vm, NULL) {  	// Set the sprite list  	BitmapPtr *SP = new BitmapPtr[3]; -	SP[0] = new Bitmap("SPK_L", true); -	SP[1] = new Bitmap("SPK_R", true); +	SP[0] = new Bitmap("SPK_L"); +	SP[1] = new Bitmap("SPK_R");  	SP[2] = NULL;  	setShapeList(SP); @@ -1069,10 +1069,10 @@ Spike::Spike(CGEEngine *vm): Sprite(vm, NULL) {  PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) {  	// Set the sprite list  	BitmapPtr *LI = new BitmapPtr[5]; -	LI[0] = new Bitmap("LITE0", true); -	LI[1] = new Bitmap("LITE1", true); -	LI[2] = new Bitmap("LITE2", true); -	LI[3] = new Bitmap("LITE3", true); +	LI[0] = new Bitmap("LITE0"); +	LI[1] = new Bitmap("LITE1"); +	LI[2] = new Bitmap("LITE2"); +	LI[3] = new Bitmap("LITE3");  	LI[4] = NULL;  	setShapeList(LI); | 
