aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2011-06-20 23:40:22 +0200
committerStrangerke2011-06-20 23:40:22 +0200
commit6dc29e4a0489a62498653a880f38369ce05d41f8 (patch)
treeade5ca48edfb8a6408d3a6702d1acf86afcc86bb /engines
parent77d4dcade26a69a6e2ebcc69a4224059c450f3e4 (diff)
downloadscummvm-rg350-6dc29e4a0489a62498653a880f38369ce05d41f8.tar.gz
scummvm-rg350-6dc29e4a0489a62498653a880f38369ce05d41f8.tar.bz2
scummvm-rg350-6dc29e4a0489a62498653a880f38369ce05d41f8.zip
CGE: Remove some statics
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/cge.cpp10
-rw-r--r--engines/cge/cge_main.cpp76
-rw-r--r--engines/cge/cge_main.h25
-rw-r--r--engines/cge/game.h4
-rw-r--r--engines/cge/mixer.cpp5
-rw-r--r--engines/cge/mouse.cpp1
-rw-r--r--engines/cge/snail.cpp20
-rw-r--r--engines/cge/vga13h.cpp1
8 files changed, 73 insertions, 69 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index f28be8b224..04a950faf0 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -30,8 +30,11 @@
#include "common/fs.h"
#include "engines/util.h"
#include "cge/cge.h"
+#include "cge/vga13h.h"
#include "cge/cge_main.h"
#include "cge/text.h"
+#include "cge/bitmaps.h"
+
namespace CGE {
@@ -43,7 +46,12 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
Text = new TEXT(ProgName());
Vga = new VGA(M13H);
Heart = new HEART;
-
+ Hero = new WALK(NULL);
+ Sys = new SYSTEM();
+ PocLight = new SPRITE(LI);
+ Mouse = new MOUSE;
+ for (int i = 0; i < POCKET_NX; i++)
+ Pocket[i] = new SPRITE(NULL);
OffUseCount = atoi(Text->getText(OFF_USE_COUNT));
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 3c1cb28b14..5817c1436b 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -61,8 +61,13 @@ namespace CGE {
extern uint16 _stklen = (STACK_SIZ * 2);
-VGA *Vga;
+VGA *Vga;
HEART *Heart;
+WALK *Hero;
+SYSTEM *Sys;
+SPRITE *PocLight;
+MOUSE *Mouse;
+SPRITE *Pocket[POCKET_NX];
// 0.75 - 17II95 - full sound support
// 0.76 - 18II95 - small MiniEMS in DEMO,
@@ -109,13 +114,8 @@ bool JBW = false;
DAC *SysPal = farnew(DAC, PAL_CNT);
//-------------------------------------------------------------------------
-SPRITE PocLight = LI;
-SPRITE *Pocket[POCKET_NX] = { NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- };
int PocPtr = 0;
-MOUSE Mouse;
static SPRITE *Sprite = NULL;
static SPRITE *MiniCave = NULL;
static SPRITE *Shadow = NULL;
@@ -387,9 +387,9 @@ void WALK::Tick(void) {
if (Dir != NO_DIR) {
SPRITE *spr;
- SYSTEM::FunTouch();
+ Sys->FunTouch();
for (spr = Vga->ShowQ->First(); spr; spr = spr->Next) {
- if (Distance(spr) < 2) {
+ if (Distance(spr) < 2) {
if (! spr->Flags.Near) {
FeedSnail(spr, NEAR);
spr->Flags.Near = true;
@@ -582,7 +582,6 @@ static void NextStep(void);
static void SaveMapping(void);
-WALK *Hero = NULL;
static INFO_LINE InfoLine = INFO_W;
static SPRITE CavLight = PR;
@@ -645,10 +644,6 @@ static void PostMiniStep(int stp) {
warning("STUB: PostMiniStep()");
}
-
-int SYSTEM::FunDel = HEROFUN0;
-
-
void SYSTEM::SetPal(void) {
int i;
DAC *p = SysPal + 256 - ArrayCount(StdPal);
@@ -675,7 +670,7 @@ static void ShowBak(int ref) {
BITMAP::Pal = NULL;
spr->Show(2);
Vga->CopyPage(1, 2);
- SYSTEM::SetPal();
+ Sys->SetPal();
spr->Contract();
}
}
@@ -737,7 +732,7 @@ static void CaveUp(void) {
Vga->Sunrise(SysPal);
Dark = false;
if (! Startup)
- Mouse.On();
+ Mouse->On();
Heart->Enable = true;
}
@@ -788,7 +783,7 @@ void SwitchCave(int cav) {
warning("SwitchCave() - SNPOST");
} else {
Now = cav;
- Mouse.Off();
+ Mouse->Off();
if (Hero) {
Hero->Park();
Hero->Step(0);
@@ -811,6 +806,11 @@ void SwitchCave(int cav) {
}
}
+SYSTEM::SYSTEM() : SPRITE(NULL) {
+ FunDel = HEROFUN0;
+ SetPal();
+ Tick();
+}
void SYSTEM::Touch(uint16 mask, int x, int y) {
static int pp = 0;
@@ -880,7 +880,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
Hero->Step(TSEQ + 3);
break;
case F9:
- SYSTEM::FunDel = 1;
+ Sys->FunDel = 1;
break;
case 'X':
if (KEYBOARD::Key[ALT])
@@ -1191,8 +1191,8 @@ static void SayDebug(void) {
t = t1;
}
- dwtom(Mouse.X, ABSX, 10, 3);
- dwtom(Mouse.Y, ABSY, 10, 3);
+ dwtom(Mouse->X, ABSX, 10, 3);
+ dwtom(Mouse->Y, ABSY, 10, 3);
// dwtom(coreleft(), NFRE, 10, 5);
// dwtom(farcoreleft(), FFRE, 10, 6);
@@ -1249,7 +1249,7 @@ static void OptionTouch(int opt, uint16 mask) {
#pragma argsused
void SPRITE::Touch(uint16 mask, int x, int y) {
- SYSTEM::FunTouch();
+ Sys->FunTouch();
if ((mask & ATTN) == 0) {
InfoLine.Update(Name());
if (mask & (R_DN | L_DN))
@@ -1265,7 +1265,7 @@ void SPRITE::Touch(uint16 mask, int x, int y) {
mask |= R_UP;
}
if ((mask & R_UP) && Snail.Idle()) {
- SPRITE *ps = (PocLight.SeqPtr) ? Pocket[PocPtr] : NULL;
+ SPRITE *ps = (PocLight->SeqPtr) ? Pocket[PocPtr] : NULL;
if (ps) {
if (Flags.Kept || Hero->Distance(this) < MAX_DISTANCE) {
if (Works(ps)) {
@@ -1591,14 +1591,14 @@ static void RunGame(void) {
{ 1, 6, 0, 0, 4 },
{ 0, 1, 0, 0, 16 },
};
- PocLight.SetSeq(PocSeq);
- PocLight.Flags.Tran = true;
- PocLight.Time = 1;
- PocLight.Z = 120;
- Vga->ShowQ->Append(&PocLight);
+ PocLight->SetSeq(PocSeq);
+ PocLight->Flags.Tran = true;
+ PocLight->Time = 1;
+ PocLight->Z = 120;
+ Vga->ShowQ->Append(PocLight);
SelectPocket(-1);
- Vga->ShowQ->Append(&Mouse);
+ Vga->ShowQ->Append(Mouse);
// ___________
LoadUser();
@@ -1653,9 +1653,9 @@ static void RunGame(void) {
HorzLine.Z = 126;
Vga->ShowQ->Insert(&HorzLine);
- Mouse.Busy = Vga->SpareQ->Locate(BUSY_REF);
- if (Mouse.Busy)
- ExpandSprite(Mouse.Busy);
+ Mouse->Busy = Vga->SpareQ->Locate(BUSY_REF);
+ if (Mouse->Busy)
+ ExpandSprite(Mouse->Busy);
Startup = 0;
@@ -1677,7 +1677,7 @@ static void RunGame(void) {
Heart->Enable = false;
SNPOST(SNCLEAR, -1, 0, NULL);
SNPOST_(SNCLEAR, -1, 0, NULL);
- Mouse.Off();
+ Mouse->Off();
Vga->ShowQ->Clear();
Vga->SpareQ->Clear();
Hero = NULL;
@@ -1691,7 +1691,7 @@ void Movie(const char *ext) {
LoadScript(fn);
ExpandSprite(Vga->SpareQ->Locate(999));
FeedSnail(Vga->ShowQ->Locate(999), TAKE);
- Vga->ShowQ->Append(&Mouse);
+ Vga->ShowQ->Append(Mouse);
Heart->Enable = true;
KEYBOARD::SetClient(Sys);
while (! Snail.Idle()) {
@@ -1733,12 +1733,12 @@ bool ShowTitle(const char *name) {
if (STARTUP::Mode < 2 && ! STARTUP::SoundOk) {
Vga->CopyPage(1, 2);
Vga->CopyPage(0, 1);
- Vga->ShowQ->Append(&Mouse);
+ Vga->ShowQ->Append(Mouse);
Heart->Enable = true;
- Mouse.On();
+ Mouse->On();
for (SelectSound(); ! Snail.Idle() || VMENU::Addr;)
MainLoop();
- Mouse.Off();
+ Mouse->Off();
Heart->Enable = false;
Vga->ShowQ->Clear();
Vga->CopyPage(0, 2);
@@ -1770,7 +1770,7 @@ bool ShowTitle(const char *name) {
Movie("X00"); // paylist
Vga->CopyPage(1, 2);
Vga->CopyPage(0, 1);
- Vga->ShowQ->Append(&Mouse);
+ Vga->ShowQ->Append(Mouse);
//Mouse.On();
Heart->Enable = true;
for (TakeName(); GET_TEXT::Ptr;)
@@ -1829,9 +1829,9 @@ void cge_main(void) {
//Debug( memset((void *) (-K(4)), 0, K(1)); )
memset(Barriers, 0xFF, sizeof(Barriers));
- if (! Mouse.Exist)
+ if (!Mouse->Exist)
error("%s", Text->getText(NO_MOUSE_TEXT));
- if (! SVG0FILE::Exist(SVG0NAME))
+ if (!SVG0FILE::Exist(SVG0NAME))
STARTUP::Mode = 2;
DebugLine.Flags.Hide = true;
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index 0afdc0f820..3eb38cafce 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -30,6 +30,7 @@
#include "cge/wav.h"
#include "cge/vga13h.h"
+#include "cge/mouse.h"
namespace CGE {
@@ -119,15 +120,14 @@ namespace CGE {
class SYSTEM : public SPRITE {
int lum;
public:
- static int FunDel;
- static void SetPal(void);
- static void FunTouch(void);
- SYSTEM(void) : SPRITE(NULL) {
- SetPal();
- Tick();
- }
+ int FunDel;
+
+ SYSTEM();
+
+ void SetPal();
+ void FunTouch();
void Touch(uint16 mask, int x, int y);
- void Tick(void);
+ void Tick();
};
@@ -161,17 +161,18 @@ public:
CLUSTER XZ(int x, int y);
CLUSTER XZ(COUPLE xy);
-
-extern WALK *Hero;
-
-
void ExpandSprite(SPRITE *spr);
void ContractSprite(SPRITE *spr);
void cge_main(void);
+extern WALK *Hero;
extern VGA *Vga;
extern HEART *Heart;
+extern SYSTEM *Sys;
extern int OffUseCount;
+extern SPRITE *PocLight;
+extern MOUSE *Mouse;
+extern SPRITE *Pocket[];
} // End of namespace CGE
diff --git a/engines/cge/game.h b/engines/cge/game.h
index 1bc24e1fd9..1d65d0c767 100644
--- a/engines/cge/game.h
+++ b/engines/cge/game.h
@@ -40,14 +40,10 @@ namespace CGE {
#define TBound(s) (s->Y <= 0)
#define BBound(s) (s->Y+s->H >= SCR_HIG - PAN_HIG)
-
-extern SPRITE *Sys;
-
int Sinus(long x);
uint8 *Glass(DAC *pal, uint8 r, uint8 g, uint8 b);
uint8 *Mark(DAC *pal);
-
class FLY : public SPRITE {
static int L, T, R, B;
public:
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp
index c1b69d40c2..6a3a45553a 100644
--- a/engines/cge/mixer.cpp
+++ b/engines/cge/mixer.cpp
@@ -35,7 +35,7 @@
namespace CGE {
-extern MOUSE Mouse;
+extern MOUSE *Mouse;
bool MIXER::Appear = false;
@@ -114,7 +114,8 @@ void MIXER::Touch(uint16 mask, int x, int y) {
void MIXER::Tick(void) {
- int x = Mouse.X, y = Mouse.Y;
+ int x = Mouse->X;
+ int y = Mouse->Y;
if (SpriteAt(x, y) == this) {
Fall = MIX_FALL;
if (Flags.Hold)
diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp
index 78e686ff95..8ad12742d3 100644
--- a/engines/cge/mouse.cpp
+++ b/engines/cge/mouse.cpp
@@ -27,6 +27,7 @@
#include "cge/mouse.h"
#include "cge/text.h"
+#include "cge/cge_main.h"
namespace CGE {
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index afe73b4d24..4675c6b848 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -58,7 +58,7 @@ int Lev = -1;
SNAIL Snail = false;
SNAIL Snail_ = true;
-extern SPRITE PocLight;
+extern SPRITE *PocLight;
//-------------------------------------------------------------------------
// SPRITE * Pocket[POCKET_NX]={ NULL, NULL, NULL, NULL,
@@ -68,8 +68,6 @@ extern SPRITE PocLight;
extern SPRITE *Pocket[];
extern int PocPtr;
extern DAC *SysPal;
-extern MOUSE Mouse;
-
static void SNGame(SPRITE *spr, int num) {
switch (num) {
@@ -300,18 +298,18 @@ int FindPocket(SPRITE *spr) {
void SelectPocket(int n) {
- if (n < 0 || (PocLight.SeqPtr && PocPtr == n)) {
- PocLight.Step(0);
+ if (n < 0 || (PocLight->SeqPtr && PocPtr == n)) {
+ PocLight->Step(0);
n = FindPocket(NULL);
if (n >= 0)
PocPtr = n;
} else {
if (Pocket[n] != NULL) {
PocPtr = n;
- PocLight.Step(1);
+ PocLight->Step(1);
}
}
- PocLight.Goto(POCKET_X + PocPtr * POCKET_DX + POCKET_SX, POCKET_Y + POCKET_SY);
+ PocLight->Goto(POCKET_X + PocPtr * POCKET_DX + POCKET_SX, POCKET_Y + POCKET_SY);
}
@@ -903,9 +901,9 @@ static void SNReach(SPRITE *spr, int mode) {
static void SNMouse(bool on) {
if (on)
- Mouse.On();
+ Mouse->On();
else
- Mouse.Off();
+ Mouse->Off();
}
@@ -960,13 +958,13 @@ void SNAIL::RunCom(void) {
if (sprel == Hero && sprel->SeqTest(-1))
sprel->Step(HTALK);
Say(Text->getText(snc->Val), sprel);
- SYSTEM::FunDel = HEROFUN0;
+ Sys->FunDel = HEROFUN0;
}
break;
case SNINF :
if (TalkEnable) {
Inf(Text->getText(snc->Val));
- SYSTEM::FunDel = HEROFUN0;
+ Sys->FunDel = HEROFUN0;
}
break;
case SNTIME :
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index a8a0c5faf0..349f412ca0 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -69,7 +69,6 @@ static VgaRegBlk VideoMode[] = {
bool SpeedTest = false;
SEQ Seq1[] = { { 0, 0, 0, 0, 0 } };
SEQ Seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } };
-SPRITE *Sys = NULL;
extern "C" void SNDMIDIPlay(void);