aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorStrangerke2011-06-11 23:27:27 +0200
committerStrangerke2011-06-11 23:27:27 +0200
commit92076d464148d2d6ecab544076bc10718a463c7b (patch)
treea94404cbbf10b1b7a7416609770bdbdb8dc41b3a /engines/cge
parent11264a60a7dc8e3e04b5b73f6794269f097010ff (diff)
downloadscummvm-rg350-92076d464148d2d6ecab544076bc10718a463c7b.tar.gz
scummvm-rg350-92076d464148d2d6ecab544076bc10718a463c7b.tar.bz2
scummvm-rg350-92076d464148d2d6ecab544076bc10718a463c7b.zip
CGE: Remove DROP() macro
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/bitmap.cpp31
-rw-r--r--engines/cge/btfile.cpp18
-rw-r--r--engines/cge/cfile.cpp20
-rw-r--r--engines/cge/drop.h28
-rw-r--r--engines/cge/jbw.h2
-rw-r--r--engines/cge/snail.cpp4
-rw-r--r--engines/cge/sound.cpp12
-rw-r--r--engines/cge/talk.cpp6
-rw-r--r--engines/cge/vga13h.cpp3
-rw-r--r--engines/cge/vga13h.h2
-rw-r--r--engines/cge/vol.cpp18
11 files changed, 28 insertions, 116 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 10f19029d6..1201b84fc6 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -33,17 +33,6 @@
#include "cge/vol.h"
#endif
-
-#ifndef DROP_H
-// TODO replace printf by scummvm equivalent
-#define DROP(m,n) {}
-//#define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); }
-#endif
-
-
-//#include <alloc.h>
-//#include <dir.h>
-//#include <mem.h>
#include <dos.h>
#include "cge/cfile.h"
#include "common/system.h"
@@ -73,7 +62,7 @@ BITMAP::BITMAP (const char * fname, bool rem)
PIC_FILE file(pat);
if (file.Error == 0)
if (! VBMLoad(&file))
- DROP("Bad VBM", fname);
+ error("Bad VBM [%s]", fname);
}
else
#endif
@@ -92,10 +81,11 @@ BITMAP::BITMAP (const char * fname, bool rem)
M = NULL;
}
}
- else DROP("Bad BMP", fname);
+ else
+ error("Bad BMP [%s]", fname);
}
#else
- DROP("Bad VBM", fname);
+ error("Bad VBM [%s]", fname);
#endif
}
}
@@ -127,7 +117,8 @@ BITMAP::BITMAP (uint16 w, uint16 h, uint8 fill)
uint16 psiz = H * lsiz; // - last gape, but + plane trailer
uint8 * v = new uint8[4 * psiz // the same for 4 planes
+ H * sizeof(*B)]; // + room for wash table
- if (v == NULL) DROP("No core", NULL);
+ if (v == NULL)
+ error("No core");
* (uint16 *) v = CPY | dsiz; // data chunk hader
memset(v+2, fill, dsiz); // data bytes
@@ -160,7 +151,8 @@ BITMAP::BITMAP (const BITMAP& bmp)
uint16 vsiz = (uint8*)(bmp.B) - (uint8*)(v0);
uint16 siz = vsiz + H * sizeof(HideDesc);
uint8 * v1 = farnew(uint8, siz);
- if (v1 == NULL) DROP("No core", NULL);
+ if (v1 == NULL)
+ error("No core");
memcpy(v1, v0, siz);
B = (HideDesc *) ((V = v1) + vsiz);
}
@@ -198,7 +190,8 @@ BITMAP& BITMAP::operator = (const BITMAP& bmp)
uint16 vsiz = (uint8*)bmp.B - (uint8*)v0;
uint16 siz = vsiz + H * sizeof(HideDesc);
uint8 * v1 = farnew(uint8, siz);
- if (v1 == NULL) DROP("No core", NULL);
+ if (v1 == NULL)
+ error("No core");
memcpy(v1, v0, siz);
B = (HideDesc *) ((V = v1) + vsiz);
}
@@ -337,7 +330,7 @@ BMP_PTR BITMAP::Code (void)
V = farnew(uint8, sizV + H * sizeof(*B));
if (! V)
{
- DROP("No core", NULL);
+ error("No core");
}
B = (HideDesc *) (V + sizV);
}
@@ -442,7 +435,7 @@ bool BITMAP::VBMSave (XFILE * f)
bool BITMAP::VBMLoad (XFILE * f)
{
- uint16 p, n;
+ uint16 p = 0, n = 0;
if (f->Error == 0) f->Read((uint8 *)&p, sizeof(p));
if (f->Error == 0) f->Read((uint8 *)&n, sizeof(n));
if (f->Error == 0) f->Read((uint8 *)&W, sizeof(W));
diff --git a/engines/cge/btfile.cpp b/engines/cge/btfile.cpp
index 1851068e2d..7c61157eba 100644
--- a/engines/cge/btfile.cpp
+++ b/engines/cge/btfile.cpp
@@ -31,23 +31,8 @@
#include "common/str.h"
#include <string.h>
-
-
-#ifdef DROP_H
- #include "cge/drop.h"
-#else
- #include <stdio.h>
- #include <stdlib.h>
-#endif
-
namespace CGE {
-#ifndef DROP_H
- // TODO replace printf by scummvm equivalent
-#define DROP(m,n)
- //#define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); }
-#endif
-
#ifndef BT_SIZE
#define BT_SIZE K(1)
#endif
@@ -70,7 +55,8 @@ BTFILE::BTFILE (const char * name, IOMODE mode, CRYPT * crpt)
Buff[i].PgNo = BT_NONE;
Buff[i].Indx = -1;
Buff[i].Updt = FALSE;
- if (Buff[i].Page == NULL) DROP("No core", NULL);
+ if (Buff[i].Page == NULL)
+ error("No core");
}
}
diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp
index 4d555c979d..1a23c3d0f9 100644
--- a/engines/cge/cfile.cpp
+++ b/engines/cge/cfile.cpp
@@ -29,24 +29,10 @@
#include <dos.h>
#include <fcntl.h>
#include <string.h>
-//#include <alloc.h>
#include "common/system.h"
-#ifdef DROP_H
- #include "cge/drop.h"
-#else
- #include <stdio.h>
- #include <stdlib.h>
-#endif
-
namespace CGE {
-#ifndef DROP_H
- //TODO Replace by scummvm printf
-#define DROP(m,n) {}
- //#define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); }
-#endif
-
IOBUF::IOBUF (IOMODE mode, CRYPT * crpt)
: IOHAND(mode, crpt),
BufMark(0),
@@ -54,7 +40,8 @@ IOBUF::IOBUF (IOMODE mode, CRYPT * crpt)
Lim(0)
{
Buff = farnew(uint8, IOBUF_SIZE);
- if (Buff == NULL) DROP("No core for I/O", NULL);
+ if (Buff == NULL)
+ error("No core for I/O");
}
@@ -72,7 +59,8 @@ IOBUF::IOBUF (const char * name, IOMODE mode, CRYPT * crpt)
Lim(0)
{
Buff = farnew(uint8, IOBUF_SIZE);
- if (Buff == NULL) DROP("No core for I/O", name);
+ if (Buff == NULL)
+ error("No core for I/O [%s]", name);
}
diff --git a/engines/cge/drop.h b/engines/cge/drop.h
deleted file mode 100644
index bdd08b6810..0000000000
--- a/engines/cge/drop.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This code is based on original Soltys source code
- * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
- */
-
-#include "cge/vga13h.h"
diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h
index 8f6e0ea44e..bb01017d00 100644
--- a/engines/cge/jbw.h
+++ b/engines/cge/jbw.h
@@ -36,8 +36,6 @@ namespace CGE {
#define INI_FILE VFILE
#define PIC_FILE VFILE
#define BMP_MODE 0
-#define DROP {} // TODO error handling
-#define DROP_H
#define BEL 7
#define BS 8
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 733acb2398..c63ba824b4 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -82,8 +82,8 @@ static void SNGame (SPRITE * spr, int num)
#define STAGES 8
#define DRESSED 3
static SPRITE * dup[3] = { NULL, NULL, NULL };
- int buref;
- int Stage;
+ int buref = 0;
+ int Stage = 0;
for (dup[0] = VGA::ShowQ.First(); dup[0]; dup[0] = dup[0]->Next)
{
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index 11385c12e3..d40789beee 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -29,25 +29,13 @@
#include "cge/startup.h"
#include "cge/sound.h"
-#ifdef DROP_H
- #include "cge/drop.h"
-#else
- #include <stdio.h>
- #include <stdlib.h>
-#endif
-
#include "cge/text.h"
#include "cge/cfile.h"
#include "cge/vol.h"
-//#include <alloc.h>
namespace CGE {
-#ifndef DROP_H
- #define DROP(m,n) { printf("%s [%s]\n", m, n); _exit(1); }
-#endif
-
bool Music = true;
FX Fx = 16; // must precede SOUND!!
SOUND Sound;
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index d305d1d27e..851b96cf99 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -60,7 +60,8 @@ FONT::FONT (const char * name)
Map = farnew(uint8, MAP_SIZ);
Pos = farnew(uint16, POS_SIZ);
Wid = farnew(uint8, WID_SIZ);
- if (Map == NULL || Pos == NULL || Wid == NULL) DROP("No core", NULL);
+ if (Map == NULL || Pos == NULL || Wid == NULL)
+ error("No core");
MergeExt(Path, name, FONT_EXT);
Load();
}
@@ -180,7 +181,7 @@ void TALK::Update (const char * tx)
{
uint16 vmarg = (Mode) ? TEXT_VM : 0;
uint16 hmarg = (Mode) ? TEXT_HM : 0;
- uint16 mw, mh, ln = vmarg;
+ uint16 mw = 0, mh, ln = vmarg;
const char * p;
uint8 * m;
@@ -188,7 +189,6 @@ void TALK::Update (const char * tx)
{
uint16 k = 2 * hmarg;
mh = 2 * vmarg + FONT_HIG;
- mw = 0;
for (p = tx; *p; p ++)
{
if (*p == '|' || *p == '\n')
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 86b04bfe0c..d95be1d94c 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -600,7 +600,8 @@ SPRITE * SPRITE::Expand (void)
{
bool enbl = HEART::Enable;
HEART::Enable = false;
- if ((Ext = new SPREXT) == NULL) DROP("No core", NULL);
+ if ((Ext = new SPREXT) == NULL)
+ error("No core");
if (*File)
{
static const char * Comd[] = { "Name", "Phase", "Seq", "Near", "Take", NULL };
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index 40dfc41a12..0b9fa8596d 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -295,7 +295,7 @@ template <class CBLK>
uint8 Closest (CBLK * pal, CBLK x)
{
#define f(col,lum) ((((uint16)(col))<<8)/lum)
- uint16 i, dif = 0xFFFF, found;
+ uint16 i, dif = 0xFFFF, found = 0;
uint16 L = x.R + x.G + x.B; if (! L) ++ L;
uint16 R = f(x.R, L), G = f(x.G, L), B = f(x.B, L);
for (i = 0; i < 256; i ++)
diff --git a/engines/cge/vol.cpp b/engines/cge/vol.cpp
index 40490f2271..9af2efe8f3 100644
--- a/engines/cge/vol.cpp
+++ b/engines/cge/vol.cpp
@@ -26,29 +26,14 @@
*/
#include "cge/vol.h"
-//#include <alloc.h>
#include "common/system.h"
#include "common/str.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#ifdef DROP_H
- #include "cge/drop.h"
-#else
- #include <stdio.h>
-#endif
-
namespace CGE {
-#ifndef DROP_H
- // TODO Replace printf by scummvm equivalent
-
- #define DROP(m,n) { }
- //#define DROP(m,n) { printf("%s [%s]\n", (m), (n)); _exit(1); }
-#endif
-
-
#ifdef VOL_UPD
BTFILE VFILE::Cat(CAT_NAME, UPD, CRP);
VOLBASE DAT::File(DAT_NAME, UPD, CRP);
@@ -68,7 +53,8 @@ VFILE::VFILE (const char * name, IOMODE mode)
{
if (mode == REA)
{
- if (Dat.File.Error || Cat.Error) DROP("Bad volume data", NULL);
+ if (Dat.File.Error || Cat.Error)
+ error("Bad volume data");
BT_KEYPACK * kp = Cat.Find(name);
if (scumm_stricmp(kp->Key, name) != 0) Error = 1;
EndMark = (BufMark = BegMark = kp->Mark) + kp->Size;