aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2011-06-22 08:11:18 +0200
committerStrangerke2011-06-22 08:11:18 +0200
commita307d405b6ddf4cb94d57e8365327667a6291bac (patch)
tree30ae3fac6d60e8ff14d2c96f5d0f398d9563820d
parentb5ad69d13cf531c2d4c841c043a89f732fc4d4e0 (diff)
downloadscummvm-rg350-a307d405b6ddf4cb94d57e8365327667a6291bac.tar.gz
scummvm-rg350-a307d405b6ddf4cb94d57e8365327667a6291bac.tar.bz2
scummvm-rg350-a307d405b6ddf4cb94d57e8365327667a6291bac.zip
CGE: suppress a couple of static, add ProgName and MergeExt
-rw-r--r--engines/cge/cge.cpp43
-rw-r--r--engines/cge/cge_main.cpp29
-rw-r--r--engines/cge/cge_main.h2
-rw-r--r--engines/cge/general.cpp18
-rw-r--r--engines/cge/gettext.cpp1
-rw-r--r--engines/cge/snail.cpp4
-rw-r--r--engines/cge/snail.h28
-rw-r--r--engines/cge/text.cpp2
-rw-r--r--engines/cge/text.h2
9 files changed, 89 insertions, 40 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index a34288b7e9..ef00d0e517 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -42,8 +42,9 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
: Engine(syst), _gameDescription(gameDescription) {
DebugMan.addDebugChannel(kCGEDebug, "general", "CGE general debug channel");
+
_console = new CGEConsole(this);
- Text = new TEXT(ProgName());
+ Text = new TEXT(ProgName(), 128);
Vga = new VGA(M13H);
Heart = new HEART;
Hero = new WALK(NULL);
@@ -72,10 +73,12 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
SP[1] = new BITMAP("SPK_R");
SP[2] = NULL;
LI[0] = new BITMAP("LITE0");
- LI[1] = new BITMAP("LITE1"),
- LI[2] = new BITMAP("LITE2"),
- LI[3] = new BITMAP("LITE3"),
+ LI[1] = new BITMAP("LITE1");
+ LI[2] = new BITMAP("LITE2");
+ LI[3] = new BITMAP("LITE3");
LI[4] = NULL;
+ Snail = new SNAIL(false);
+ Snail_ = new SNAIL(true);
OffUseCount = atoi(Text->getText(OFF_USE_COUNT));
@@ -87,6 +90,38 @@ CGEEngine::~CGEEngine() {
// Remove all of our debug levels here
DebugMan.clearAllDebugChannels();
+
+ _console = new CGEConsole(this);
+
+ delete Text;
+ delete Vga;
+ delete Heart;
+ delete Hero;
+ delete Sys;
+ delete PocLight;
+ delete Mouse;
+ for (int i = 0; i < POCKET_NX; i++)
+ delete Pocket[i];
+ delete Sprite;
+ delete MiniCave;
+ delete Shadow;
+ delete HorzLine;
+ delete InfoLine;
+ delete CavLight;
+ delete DebugLine;
+ delete MB[0];
+ delete HL[0];
+ delete MC[0];
+ delete MC[1];
+ delete PR[0];
+ delete SP[0];
+ delete SP[1];
+ delete LI[0];
+ delete LI[1];
+ delete LI[2];
+ delete LI[3];
+ delete Snail;
+ delete Snail_;
}
Common::Error CGEEngine::run() {
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 7c055548a3..ec8f743fe4 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -83,6 +83,9 @@ BMP_PTR PR[2];
BMP_PTR SP[3];
BMP_PTR LI[5];
+SNAIL *Snail;
+SNAIL *Snail_;
+
// 0.75 - 17II95 - full sound support
// 0.76 - 18II95 - small MiniEMS in DEMO,
// unhide CavLight in SNLEVEL
@@ -606,7 +609,7 @@ static void Quit(void) {
{ NULL, dummy }
};
- if (Snail.Idle() && ! Hero->Flags.Hide) {
+ if (Snail->Idle() && ! Hero->Flags.Hide) {
if (VMENU::Addr) {
SNPOST_(SNKILL, -1, 0, VMENU::Addr);
ResetQSwitch();
@@ -907,7 +910,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
Sprite->Step(x - '0');
break;
case F10 :
- if (Snail.Idle() && ! Hero->Flags.Hide)
+ if (Snail->Idle() && ! Hero->Flags.Hide)
StartCountDown();
break;
case 'J':
@@ -952,7 +955,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
PostMiniStep(cav - 1);
if (mask & L_UP) {
- if (cav && Snail.Idle() && Hero->TracePtr < 0)
+ if (cav && Snail->Idle() && Hero->TracePtr < 0)
SwitchCave(cav);
if (!HorzLine->Flags.Hide) {
@@ -964,7 +967,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
}
} else
{
- if (! Talk && Snail.Idle() && Hero
+ if (! Talk && Snail->Idle() && Hero
&& y >= MAP_TOP && y < MAP_TOP + MAP_HIG && ! Game) {
Hero->FindWay(XZ(x, y));
}
@@ -977,7 +980,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
void SYSTEM::Tick(void) {
if (! Startup) if (-- FunDel == 0) {
KillText();
- if (Snail.Idle()) {
+ if (Snail->Idle()) {
if (PAIN)
HeroCover(9);
else if (STARTUP::Core >= CORE_MID) {
@@ -1265,7 +1268,7 @@ void SPRITE::Touch(uint16 mask, int x, int y) {
mask &= ~L_UP;
mask |= R_UP;
}
- if ((mask & R_UP) && Snail.Idle()) {
+ if ((mask & R_UP) && Snail->Idle()) {
SPRITE *ps = (PocLight->SeqPtr) ? Pocket[PocPtr] : NULL;
if (ps) {
if (Flags.Kept || Hero->Distance(this) < MAX_DISTANCE) {
@@ -1305,7 +1308,7 @@ void SPRITE::Touch(uint16 mask, int x, int y) {
}
}
}
- if ((mask & L_UP) && Snail.Idle()) {
+ if ((mask & L_UP) && Snail->Idle()) {
if (Flags.Kept) {
int n;
for (n = 0; n < POCKET_NX; n ++) {
@@ -1549,8 +1552,8 @@ static void MainLoop(void) {
#endif
Vga->Show();
- Snail_.RunCom();
- Snail.RunCom();
+ Snail_->RunCom();
+ Snail->RunCom();
}
@@ -1695,9 +1698,9 @@ void Movie(const char *ext) {
Vga->ShowQ->Append(Mouse);
Heart->Enable = true;
KEYBOARD::SetClient(Sys);
- while (! Snail.Idle()) {
+ while (!Snail->Idle())
MainLoop();
- }
+
KEYBOARD::SetClient(NULL);
Heart->Enable = false;
SNPOST(SNCLEAR, -1, 0, NULL);
@@ -1731,13 +1734,13 @@ bool ShowTitle(const char *name) {
SelectPocket(-1);
Vga->Sunrise(SysPal);
- if (STARTUP::Mode < 2 && ! STARTUP::SoundOk) {
+ if (STARTUP::Mode < 2 && !STARTUP::SoundOk) {
Vga->CopyPage(1, 2);
Vga->CopyPage(0, 1);
Vga->ShowQ->Append(Mouse);
Heart->Enable = true;
Mouse->On();
- for (SelectSound(); ! Snail.Idle() || VMENU::Addr;)
+ for (SelectSound(); !Snail->Idle() || VMENU::Addr;)
MainLoop();
Mouse->Off();
Heart->Enable = false;
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index d2443a7e87..f3a95e786c 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -187,6 +187,8 @@ extern BMP_PTR MC[3];
extern BMP_PTR PR[2];
extern BMP_PTR SP[3];
extern BMP_PTR LI[5];
+extern SNAIL *Snail;
+extern SNAIL *Snail_;
} // End of namespace CGE
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 7e1653f61a..efca664b71 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -99,16 +99,26 @@ EC void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const vo
warning("STUB: _fqsort");
}
-const char *ProgName(const char *ext) {
- warning("STUB: ProgName");
- return NULL;
+const char *ProgName(const char *ext) {
+ warning("ProgName");
+
+ static Common::String buf = "CGE";
+ if (ext)
+ buf += ext;
+ return buf.c_str();
}
char *MergeExt(char *buf, const char *nam, const char *ext) {
// char dr[MAXDRIVE], di[MAXDIR], na[MAXFILE], ex[MAXEXT];
// fnmerge(buf, dr, di, na, (fnsplit(nam, dr, di, na, ex) & EXTENSION) ? ex : ext);
// return buf;
- warning("STUB: MergeExt");
+ warning("MergeExt");
+
+ strcpy(buf, nam);
+ char *dot = strrchr(buf, '.');
+ if (!dot)
+ strcat(buf, ext);
+
return buf;
}
diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp
index e11f4ff308..c1d54099f8 100644
--- a/engines/cge/gettext.cpp
+++ b/engines/cge/gettext.cpp
@@ -28,6 +28,7 @@
#include "cge/gettext.h"
#include "cge/keybd.h"
#include "cge/mouse.h"
+#include "cge/cge_main.h"
#include <string.h>
namespace CGE {
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 4675c6b848..2b36ca4325 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -55,8 +55,6 @@ bool Dark = false;
bool Game = false;
int Now = 1;
int Lev = -1;
-SNAIL Snail = false;
-SNAIL Snail_ = true;
extern SPRITE *PocLight;
@@ -359,7 +357,7 @@ void FeedSnail(SPRITE *spr, SNLIST snq) {
}
while (true) {
if (c->Com == SNTALK) {
- if ((Snail.TalkEnable = (c->Val != 0)) == false)
+ if ((Snail->TalkEnable = (c->Val != 0)) == false)
KillText();
}
if (c->Com == SNNEXT) {
diff --git a/engines/cge/snail.h b/engines/cge/snail.h
index 4255ea4e61..54c7809fda 100644
--- a/engines/cge/snail.h
+++ b/engines/cge/snail.h
@@ -42,9 +42,9 @@ namespace CGE {
#define POCKET_SX 8
#define POCKET_SY 3
-#define SNINSERT(c,r,v,p) Snail.InsCom(c,r,v,p)
-#define SNPOST(c,r,v,p) Snail.AddCom(c,r,v,p)
-#define SNPOST_(c,r,v,p) Snail_.AddCom(c,r,v,p)
+#define SNINSERT(c,r,v,p) Snail->InsCom(c,r,v,p)
+#define SNPOST(c,r,v,p) Snail->AddCom(c,r,v,p)
+#define SNPOST_(c,r,v,p) Snail_->AddCom(c,r,v,p)
typedef struct {
@@ -102,17 +102,17 @@ void SelectPocket(int n);
void PocFul(void);
-extern SCB Scb;
-extern bool Flag[4];
-extern bool Game;
-extern bool Dark;
-extern SNAIL Snail;
-extern SNAIL Snail_;
-extern int Now;
-extern int Lev;
-extern int MaxCave;
-extern int PocPtr;
-extern BAR Barriers[];
+extern SCB Scb;
+extern bool Flag[4];
+extern bool Game;
+extern bool Dark;
+//extern SNAIL *Snail;
+//extern SNAIL *Snail_;
+extern int Now;
+extern int Lev;
+extern int MaxCave;
+extern int PocPtr;
+extern BAR Barriers[];
extern struct HXY {
int X;
int Y;
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 4944d8529a..ee94983352 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -46,7 +46,7 @@ TEXT::TEXT(const char *fname, int size) {
Cache = new HAN[size];
MergeExt(FileName, fname, SAY_EXT);
if (!INI_FILE::Exist(FileName))
- error("No talk\n");
+ error("No talk (%s)\n", FileName);
for (Size = 0; Size < size; Size ++) {
Cache[Size].Ref = 0;
diff --git a/engines/cge/text.h b/engines/cge/text.h
index c778210304..64e3b1d669 100644
--- a/engines/cge/text.h
+++ b/engines/cge/text.h
@@ -61,7 +61,7 @@ class TEXT {
char *Load(int idx, int ref);
int Find(int ref);
public:
- TEXT(const char *fname, int size = 128);
+ TEXT(const char *fname, int size);
~TEXT(void);
void Clear(int from = 1, int upto = 0x7FFF);
void Preload(int from = 1, int upto = 0x7FFF);