aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorStrangerke2011-06-12 01:13:44 +0200
committerStrangerke2011-06-12 01:13:44 +0200
commit3bef49c003a888b935dc2aeaf2aa00e66249e71c (patch)
tree120d78ad2e1f1619d5fc0a2c350b572e39cc9d83 /engines/cge
parent92076d464148d2d6ecab544076bc10718a463c7b (diff)
downloadscummvm-rg350-3bef49c003a888b935dc2aeaf2aa00e66249e71c.tar.gz
scummvm-rg350-3bef49c003a888b935dc2aeaf2aa00e66249e71c.tar.bz2
scummvm-rg350-3bef49c003a888b935dc2aeaf2aa00e66249e71c.zip
CGE: Suppress VGA::Exit, some cleanup, add one missing source
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge_main.cpp56
-rw-r--r--engines/cge/general.h4
-rw-r--r--engines/cge/module.mk1
-rw-r--r--engines/cge/stdpal.cpp92
-rw-r--r--engines/cge/talk.cpp3
-rw-r--r--engines/cge/vga13h.cpp66
-rw-r--r--engines/cge/vga13h.h2
7 files changed, 142 insertions, 82 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index ebf3f3f9fd..4c3611650c 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -44,15 +44,12 @@
#include "cge/gettext.h"
#include "cge/mixer.h"
#include "cge/cge_main.h"
-//#include <alloc.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
-//#include <dir.h>
#include <fcntl.h>
-//#include <bios.h>
#include <io.h>
#include "common/str.h"
@@ -191,7 +188,7 @@ uint8 & CLUSTER::Cell (void)
bool CLUSTER::Protected (void)
{
if (A == Barriers[Now].Vert || B == Barriers[Now].Horz) return true;
- // TODO AsM
+ warning("STUB: CLUSTER::Protected()");
/*
_DX = (MAP_ZCNT << 8) + MAP_XCNT;
_BX = (uint16) this;
@@ -291,12 +288,14 @@ static void LoadGame (XFILE& file, bool tiny = false)
for (st = SavTab; st->Ptr; st ++)
{
- if (file.Error) VGA::Exit("Bad SVG");
+ if (file.Error)
+ error("Bad SVG");
file.Read((uint8 *) ((tiny || st->Flg) ? st->Ptr : &i), st->Len);
}
file.Read((uint8 *) &i, sizeof(i));
- if (i != SVGCHKSUM) VGA::Exit(BADSVG_TEXT);
+ if (i != SVGCHKSUM)
+ error(Text[BADSVG_TEXT]);
if (STARTUP::Core < CORE_HIG) Music = false;
if (STARTUP::SoundOk == 1 && STARTUP::Mode == 0)
{
@@ -316,7 +315,8 @@ static void LoadGame (XFILE& file, bool tiny = false)
S.Prev = S.Next = NULL;
spr = (scumm_stricmp(S.File+2, "MUCHA") == 0) ? new FLY(NULL)
: new SPRITE(NULL);
- if (spr == NULL) VGA::Exit("No core");
+ if (spr == NULL)
+ error("No core");
*spr = S;
VGA::SpareQ.Append(spr);
}
@@ -360,7 +360,8 @@ static void SaveGame (XFILE& file)
for (st = SavTab; st->Ptr; st ++)
{
- if (file.Error) VGA::Exit("Bad SVG");
+ if (file.Error)
+ error("Bad SVG");
file.Write((uint8 *) st->Ptr, st->Len);
}
@@ -585,7 +586,7 @@ void WALK::Park (void)
void WALK::FindWay (CLUSTER c)
{
- // TODO : Find1Way in ASM
+ warning("STUB: Find1Way");
/*
bool Find1Way(void);
extern uint16 Target;
@@ -845,6 +846,7 @@ static void PostMiniStep (int stp)
static int recent = -2;
//TODO Change the SNPOST message send to a special way to send function pointer
//if (MiniCave && stp != recent) SNPOST_(SNEXEC, -1, recent = stp, (void *)&MiniStep);
+ warning("STUB: PostMiniStep()");
}
@@ -1021,6 +1023,7 @@ void SwitchCave (int cav)
SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint
//TODO Change the SNPOST message send to a special way to send function pointer
//SNPOST(SNEXEC, -1, 0, (void *)&QGame); // switch cave
+ warning("SwitchCave() - SNPOST");
}
else
{
@@ -1043,6 +1046,7 @@ void SwitchCave (int cav)
SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint
//TODO Change the SNPOST message send to a special way to send function pointer
//SNPOST(SNEXEC, 0, 0, (void *)&XCave); // switch cave
+ warning("SwitchCave() - SNPOST");
}
}
}
@@ -1285,6 +1289,7 @@ static void SwitchMusic (void)
SNPOST_(SNSEQ, 122, (Music = false), NULL);
//TODO Change the SNPOST message send to a special way to send function pointer
// SNPOST(SNEXEC, -1, 0, (void *)&SelectSound);
+ warning("SwitchMusic() - SNPOST");
}
}
else
@@ -1699,9 +1704,8 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro
if (INI_FILE::Exist(line)) // sprite description file exist
{
INI_FILE sprf(line);
- if (sprf.Error)
- {
- VGA::Exit("Bad SPR", line);
+ if (sprf.Error) {
+ error("Bad SPR [%s]", line);
}
while ((len = sprf.Read((uint8*)line)) != 0)
@@ -1710,9 +1714,8 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro
if (len && line[len-1] == '\n') line[-- len] = '\0';
if (len == 0 || *line == '.') continue;
- if ((i = TakeEnum(Comd, strtok(line, " =\t"))) < 0)
- {
- VGA::Exit(NumStr("Bad line ######", lcnt), fname);
+ if ((i = TakeEnum(Comd, strtok(line, " =\t"))) < 0) {
+ error("%s [%s]", NumStr("Bad line ######", lcnt), fname);
}
switch (i)
@@ -1721,7 +1724,7 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro
break;
case 1 : // Type
if ((type = TakeEnum(Type, strtok(NULL, " \t,;/"))) < 0)
- VGA::Exit(NumStr("Bad line ######", lcnt), fname);
+ error("%s [%s]", NumStr("Bad line ######", lcnt), fname);
break;
case 2 : // Phase
++ shpcnt;
@@ -1738,9 +1741,7 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro
}
}
if (! shpcnt)
- {
- VGA::Exit("No shapes", fname);
- }
+ error("No shapes [%s]", fname);
}
else // no sprite description: mono-shaped sprite with only .BMP file
{
@@ -1767,9 +1768,7 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro
{
w->Goto(col, row);
if (Hero)
- {
- VGA::Exit("2nd HERO", fname);
- }
+ error("2nd HERO [%s]", fname);
Hero = w;
}
Sprite = w;
@@ -1792,7 +1791,7 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro
*/
case 4 : // LISSAJOUS
{
- VGA::Exit("Bad type", fname);
+ error("Bad type [%s]", fname);
/*
LISSAJOUS * l = new LISSAJOUS(NULL);
if (l)
@@ -1895,9 +1894,7 @@ static void LoadScript (const char *fname)
if (Sprite && BkG) Sprite->Flags.Back = true;
}
if (! ok)
- {
- VGA::Exit(NumStr("Bad INI line ######", lcnt), fname);
- }
+ error("%s [%s]", NumStr("Bad INI line ######", lcnt), fname);
}
@@ -1982,7 +1979,7 @@ void LoadUser (void)
Music = true;
CFILE file = CFILE(SVG0NAME, WRI);
SaveGame(file);
- VGA::Exit("Ok", SVG0NAME);
+ error("Ok [%s]", SVG0NAME);
}
}
LoadScript(ProgName(IN0_EXT));
@@ -2270,7 +2267,8 @@ void cge_main (void)
//Debug( memset((void *) (-K(4)), 0, K(1)); )
memset(Barriers, 0xFF, sizeof(Barriers));
- if (! Mouse.Exist) VGA::Exit(NO_MOUSE_TEXT);
+ if (! Mouse.Exist)
+ error("%s", Text[NO_MOUSE_TEXT]);
if (! SVG0FILE::Exist(SVG0NAME)) STARTUP::Mode = 2;
Debug( DebugLine.Flags.Hide = true; )
@@ -2291,7 +2289,7 @@ void cge_main (void)
if (FINIS) Movie("X03");
}
else Vga.Sunset();
- VGA::Exit(EXIT_OK_TEXT+FINIS);
+ error("%s", Text[EXIT_OK_TEXT+FINIS]);
}
} // End of namespace CGE
diff --git a/engines/cge/general.h b/engines/cge/general.h
index 4633ba2d3c..0d06d9b93d 100644
--- a/engines/cge/general.h
+++ b/engines/cge/general.h
@@ -49,7 +49,7 @@ namespace CGE {
-enum CPU { _8086, _80186, _80286, _80386, _80486 };
+//enum CPU { _8086, _80186, _80286, _80386, _80486 };
enum MEM_TYPE { BAD_MEM, EMS_MEM, NEAR_MEM, FAR_MEM };
enum ALLOC_MODE { FIRST_FIT, BEST_FIT, LAST_FIT };
enum IOMODE { REA, WRI, UPD };
@@ -244,7 +244,7 @@ CRYPT RCrypt;
MEM_TYPE MemType (void *mem);
unsigned FastRand (void);
unsigned FastRand (unsigned s);
-CPU Cpu (void);
+//CPU Cpu (void);
ALLOC_MODE SetAllocMode (ALLOC_MODE am);
uint16 atow (const char * a);
uint16 xtow (const char * x);
diff --git a/engines/cge/module.mk b/engines/cge/module.mk
index e028d7feb4..a74eb1a469 100644
--- a/engines/cge/module.mk
+++ b/engines/cge/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS := \
snail.o \
sound.o \
startup.o \
+ stdpal.o \
talk.o \
text.o \
vga13h.o \
diff --git a/engines/cge/stdpal.cpp b/engines/cge/stdpal.cpp
new file mode 100644
index 0000000000..8ceeddae3c
--- /dev/null
+++ b/engines/cge/stdpal.cpp
@@ -0,0 +1,92 @@
+/* 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/general.h"
+
+namespace CGE {
+
+ DAC StdPal[] = {// R G B
+ { 0, 60, 0}, // 198
+ { 0, 104, 0}, // 199
+ { 20, 172, 0}, // 200
+ { 82, 82, 0}, // 201
+ { 0, 132, 82}, // 202
+ { 132, 173, 82}, // 203
+ { 82, 0, 0}, // 204
+ { 206, 0, 24}, // 205
+ { 255, 33, 33}, // 206
+ { 123, 41, 0}, // 207
+ { 0, 41, 0}, // 208
+ { 0, 0, 82}, // 209
+ { 132, 0, 0}, // 210
+ { 255, 0, 0}, // 211
+ { 255, 66, 66}, // 212
+ { 148, 66, 16}, // 213
+ { 0, 82, 0}, // 214
+ { 0, 0,132}, // 215
+ { 173, 0, 0}, // 216
+ { 255, 49, 0}, // 217
+ { 255, 99, 99}, // 218
+ { 181, 107, 49}, // 219
+ { 0, 132, 0}, // 220
+ { 0, 0,255}, // 221
+ { 173, 41, 0}, // 222
+ { 255, 82, 0}, // 223
+ { 255, 132,132}, // 224
+ { 214, 148, 74}, // 225
+ { 41, 214, 0}, // 226
+ { 0, 82,173}, // 227
+ { 255, 214, 0}, // 228
+ { 247, 132, 49}, // 229
+ { 255, 165,165}, // 230
+ { 239, 198,123}, // 231
+ { 173, 214, 0}, // 232
+ { 0, 132,214}, // 233
+ { 57, 57, 57}, // 234
+ { 247, 189, 74}, // 235
+ { 255, 198,198}, // 236
+ { 255, 239,173}, // 237
+ { 214, 255,173}, // 238
+ { 82, 173,255}, // 239
+ { 107, 107,107}, // 240
+ { 247, 222, 99}, // 241
+ { 255, 0,255}, // 242
+ { 255, 132,255}, // 243
+ { 132, 132,173}, // 244
+ { 148, 247,255}, // 245
+ { 148, 148,148}, // 246
+ { 82, 0, 82}, // 247
+ { 112, 68,112}, // 248
+ { 176, 88,144}, // 249
+ { 214, 132,173}, // 250
+ { 206, 247,255}, // 251
+ { 198, 198,198}, // 252
+ { 0, 214,255}, // 253
+ { 96, 224,96 }, // 254
+ { 255, 255,255}, // 255
+ };
+} // End of namespace CGE
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 851b96cf99..9fd32ab7d2 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -245,7 +245,8 @@ BITMAP * TALK::Box (uint16 w, uint16 h)
if (w < 8) w = 8;
if (h < 8) h = 8;
b = farnew(uint8, n = w * h);
- if (! b) VGA::Exit("No core");
+ if (! b)
+ error("No core");
memset(b, TEXT_BG, n);
if (Mode)
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index d95be1d94c..6e08a9790d 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -585,7 +585,8 @@ void SPRITE::SetName (char * n)
if (n)
{
if ((Ext->Name = new char[strlen(n)+1]) != NULL) strcpy(Ext->Name, n);
- else VGA::Exit("No core", n);
+ else
+ error("No core [%s]", n);
}
}
}
@@ -624,9 +625,7 @@ SPRITE * SPRITE::Expand (void)
{
INI_FILE sprf(fname);
if (! OK(sprf))
- {
- VGA::Exit("Bad SPR", fname);
- }
+ error("Bad SPR [%s]", fname);
while ((len = sprf.Read((uint8*)line)) != 0)
{
@@ -649,7 +648,7 @@ SPRITE * SPRITE::Expand (void)
{
seq = (SEQ *) realloc(seq, (seqcnt + 1) * sizeof(*seq));
if (seq == NULL)
- VGA::Exit("No core", fname);
+ error("No core [%s]", fname);
SEQ * s = &seq[seqcnt ++];
s->Now = atoi(strtok(NULL, " \t,;/"));
if (s->Now > maxnow) maxnow = s->Now;
@@ -670,12 +669,13 @@ SPRITE * SPRITE::Expand (void)
if (NearPtr != NO_PTR)
{
nea = (SNAIL::COM *) realloc(nea, (neacnt + 1) * sizeof(*nea));
- if (nea == NULL) VGA::Exit("No core", fname);
+ if (nea == NULL)
+ error("No core [%s]", fname);
else
{
SNAIL::COM * c = &nea[neacnt ++];
if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0)
- VGA::Exit(NumStr("Bad NEAR in ######", lcnt), fname);
+ error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), fname);
c->Ref = atoi(strtok(NULL, " \t,;/"));
c->Val = atoi(strtok(NULL, " \t,;/"));
c->Ptr = NULL;
@@ -688,12 +688,13 @@ SPRITE * SPRITE::Expand (void)
if (TakePtr != NO_PTR)
{
tak = (SNAIL::COM *) realloc(tak, (takcnt + 1) * sizeof(*tak));
- if (tak == NULL) VGA::Exit("No core", fname);
+ if (tak == NULL)
+ error("No core [%s]", fname);
else
{
SNAIL::COM * c = &tak[takcnt ++];
if ((c->Com = (SNCOM) TakeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0)
- VGA::Exit(NumStr("Bad NEAR in ######", lcnt), fname);
+ error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), fname);
c->Ref = atoi(strtok(NULL, " \t,;/"));
c->Val = atoi(strtok(NULL, " \t,;/"));
c->Ptr = NULL;
@@ -711,8 +712,10 @@ SPRITE * SPRITE::Expand (void)
shplist[shpcnt] = NULL;
if (seq)
{
- if (maxnow >= shpcnt) VGA::Exit("Bad PHASE in SEQ", fname);
- if (maxnxt >= seqcnt) VGA::Exit("Bad JUMP in SEQ", fname);
+ if (maxnow >= shpcnt)
+ error("Bad PHASE in SEQ [%s]", fname);
+ if (maxnxt >= seqcnt)
+ error("Bad JUMP in SEQ [%s]", fname);
SetSeq(seq);
}
else SetSeq((ShpCnt == 1) ? Seq1 : Seq2);
@@ -938,10 +941,12 @@ BMP_PTR SPRITE::Ghost (void)
if (e->b1)
{
BMP_PTR bmp = new BITMAP(0, 0, (uint8 *)NULL);
- if (bmp == NULL) VGA::Exit("No core");
+ if (bmp == NULL)
+ error("No core");
bmp->W = e->b1->W;
bmp->H = e->b1->H;
- if ((bmp->B = farnew(HideDesc, bmp->H)) == NULL) VGA::Exit("No Core");
+ if ((bmp->B = farnew(HideDesc, bmp->H)) == NULL)
+ error("No Core");
bmp->V = (uint8 *) memcpy(bmp->B, e->b1->B, sizeof(HideDesc) * bmp->H);
// TODO offset correctly in the surface using y1 pitch and x1 and not via offset segment
//bmp->M = (uint8 *) MK_FP(e->y1, e->x1);
@@ -1589,43 +1594,8 @@ void VGA::CopyPage (uint16 d, uint16 s)
*/
}
-
-
-
-
-
-
-void VGA::Exit (const char * txt, const char * name)
-{
- // TODO Properly exit
- /*
- Msg = txt;
- Nam = name;
-
- #ifdef REPORT
- wtom(coreleft(), Report + NREP, 10, 5);
- dwtom(farcoreleft(), Report + FREP, 10, 6);
- #endif
- exit(0);
- */
-}
-
-
-
-
-void VGA::Exit (int tref, const char * name)
-{
- Exit(Text[tref], name);
-}
-
-
-
-
//--------------------------------------------------------------------------
-
-
-
void BITMAP::XShow (int x, int y)
{
// TODO XShow ASM
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index 0b9fa8596d..f1a4b498c4 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -274,8 +274,6 @@ public:
static void GetColors (DAC * tab);
static void SetColors (DAC * tab, int lum);
static void Clear (uint8 color = 0);
- static void Exit (const char * txt = NULL, const char * name = NULL);
- static void Exit (int tref, const char * name = NULL);
static void CopyPage (uint16 d, uint16 s = 3);
static void Sunrise (DAC * tab);
static void Sunset (void);