From 9a148a27cc44ba089e57ea07996a868c89c2287f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Jul 2011 08:09:16 +0200 Subject: CGE: Remove macro farnew --- engines/cge/bitmap.cpp | 6 +++--- engines/cge/cfile.cpp | 4 ++-- engines/cge/cge.h | 1 + engines/cge/jbw.h | 1 - engines/cge/snail.cpp | 4 ++-- engines/cge/talk.cpp | 9 +++++---- engines/cge/vga13h.cpp | 4 ++-- engines/cge/vmenu.cpp | 11 ++++++----- 8 files changed, 21 insertions(+), 19 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index f280f61e3e..29fc4fd8d6 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -142,7 +142,7 @@ Bitmap::Bitmap(const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL), if (v0) { uint16 vsiz = (uint8 *)(bmp._b) - (uint8 *)(v0); uint16 siz = vsiz + _h * sizeof(HideDesc); - uint8 *v1 = farnew(uint8, siz); + uint8 *v1 = (uint8 *) malloc(sizeof(uint8) * siz); if (v1 == NULL) error("No core"); memcpy(v1, v0, siz); @@ -173,7 +173,7 @@ Bitmap &Bitmap::operator = (const Bitmap &bmp) { else { uint16 vsiz = (uint8 *)bmp._b - (uint8 *)v0; uint16 siz = vsiz + _h * sizeof(HideDesc); - uint8 *v1 = farnew(uint8, siz); + uint8 *v1 = (uint8 *) malloc(sizeof(uint8) * siz); if (v1 == NULL) error("No core"); memcpy(v1, v0, siz); @@ -486,7 +486,7 @@ bool Bitmap::loadBMP(XFile *f) { } _h = hea.hig; _w = hea.wid; - if ((_m = farnew(byte, _h * _w)) != NULL) { + 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--) { diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp index af29ec5df7..5cbf078610 100644 --- a/engines/cge/cfile.cpp +++ b/engines/cge/cfile.cpp @@ -40,7 +40,7 @@ IoBuf::IoBuf(IOMODE mode, CRYPT *crpt) _lim(0) { debugC(1, kDebugFile, "IoBuf::IoBuf(%d, crpt)", mode); - _buff = farnew(uint8, IOBUF_SIZE); + _buff = (uint8 *) malloc(sizeof(uint8) * IOBUF_SIZE); if (_buff == NULL) error("No core for I/O"); } @@ -53,7 +53,7 @@ IoBuf::IoBuf(const char *name, IOMODE mode, CRYPT *crpt) _lim(0) { debugC(1, kDebugFile, "IoBuf::IoBuf(%s, %d, crpt)", name, mode); - _buff = farnew(uint8, IOBUF_SIZE); + _buff = (uint8 *) malloc(sizeof(uint8) * IOBUF_SIZE); if (_buff == NULL) error("No core for I/O [%s]", name); } diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 431dcc79ad..011e08bb31 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -236,6 +236,7 @@ public: void snZTrim(Sprite *spr); protected: int _recentStep; + private: CGEConsole *_console; void setup(); diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 74084fb905..89bcb2b03e 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -55,7 +55,6 @@ namespace CGE { #define IsAlNum(c) (IsAlpha(c) || IsDigit(c)) #define IsHxDig(c) (IsDigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f')) -#define farnew(t, n) ((t *) malloc(sizeof(t) * (n))) #define ArrayCount(a) (sizeof(a) / sizeof((a)[0])) #define MAX_TIMER 0x1800B0L diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 1393daa392..b0f56be476 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -417,7 +417,7 @@ const char *Snail::_comTxt[] = { Snail::Snail(CGEEngine *vm, bool turbo) : _turbo(turbo), _busy(false), _textDelay(false), _timerExpiry(0), _talkEnable(true), - _head(0), _tail(0), _snList(farnew(Com, 256)), _vm(vm) { + _head(0), _tail(0), _snList((Com *) malloc(sizeof(Com) * 256)), _vm(vm) { } Snail::~Snail() { @@ -888,7 +888,7 @@ void CGEEngine::snFlash(bool on) { debugC(1, kDebugEngine, "CGEEngine::snFlash(%s)", on ? "true" : "false"); if (on) { - Dac *pal = farnew(Dac, PAL_CNT); + Dac *pal = (Dac *) malloc(sizeof(Dac) * PAL_CNT); if (pal) { memcpy(pal, Vga::_sysPal, PAL_SIZ); for (int i = 0; i < PAL_CNT; i++) { diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index aa342f8216..c00e7f3a88 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -33,9 +33,9 @@ namespace CGE { Font::Font(const char *name) { - _map = farnew(uint8, kMapSize); - _pos = farnew(uint16, kPosSize); - _wid = farnew(uint8, kWidSize); + _map = (uint8 *) malloc(sizeof(uint8) * kMapSize); + _pos = (uint16 *) malloc(sizeof(uint16) * kPosSize); + _wid = (uint8 *) malloc(sizeof(uint8) * kWidSize); if ((_map == NULL) || (_pos == NULL) || (_wid == NULL)) error("No core"); mergeExt(_path, name, kFontExt); @@ -190,7 +190,8 @@ Bitmap *Talk::box(uint16 w, uint16 h) { w = 8; if (h < 8) h = 8; - b = farnew(uint8, n = w * h); + n = w * h; + b = (uint8 *) malloc(sizeof(uint8) * n); if (! b) error("No core"); memset(b, kTextColBG, n); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index ca6a9e3bdd..6fc17dc37b 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -986,8 +986,8 @@ Vga::Vga(int mode) setStatAdr(); if (_statAdr != VGAST1_) _mono++; - _oldColors = farnew(Dac, 256); - _newColors = farnew(Dac, 256); + _oldColors = (Dac *) malloc(sizeof(Dac) * PAL_CNT); + _newColors = (Dac *) malloc(sizeof(Dac) * PAL_CNT); _oldScreen = SaveScreen(); getColors(_oldColors); sunset(); diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index bc5e5cfb6c..c65ec6957e 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -32,15 +32,16 @@ namespace CGE { MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { - int h = kFontHigh + 2 * kMenuBarVM, i = (w += 2 * kMenuBarHM) * h; - uint8 *p = farnew(uint8, i), * p1, * p2; + int h = kFontHigh + 2 * kMenuBarVM; + int i = (w += 2 * kMenuBarHM) * h; + uint8 *p = (uint8 *) malloc(sizeof(uint8) * i); memset(p + w, TRANS, i - 2 * w); memset(p, kMenuBarLT, w); memset(p + i - w, kMenuBarRB, w); - p1 = p; - p2 = p + i - 1; - for (i = 0; i < h; i++) { + uint8 *p1 = p; + uint8 *p2 = p + i - 1; + for (int cpt = 0; cpt < h; cpt++) { *p1 = kMenuBarLT; *p2 = kMenuBarRB; p1 += w; -- cgit v1.2.3