aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorStrangerke2011-06-20 00:13:41 +0200
committerStrangerke2011-06-20 00:13:41 +0200
commit40f95669aeb60a50c2736d71008f0e3461654f4f (patch)
treed4169b607f7f13d8645845a2aa1b1a1117d53710 /engines/cge
parent0fa5425aa847669e53197b1f9a570e37a7314f01 (diff)
downloadscummvm-rg350-40f95669aeb60a50c2736d71008f0e3461654f4f.tar.gz
scummvm-rg350-40f95669aeb60a50c2736d71008f0e3461654f4f.tar.bz2
scummvm-rg350-40f95669aeb60a50c2736d71008f0e3461654f4f.zip
CGE: As there's only one instance of VGA, suppress all the static keywords from it
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge_main.cpp122
-rw-r--r--engines/cge/mixer.cpp5
-rw-r--r--engines/cge/snail.cpp42
-rw-r--r--engines/cge/text.cpp7
-rw-r--r--engines/cge/vga13h.cpp43
-rw-r--r--engines/cge/vga13h.h47
-rw-r--r--engines/cge/vmenu.cpp5
7 files changed, 138 insertions, 133 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 6472cdef0b..c6c6a3961b 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -224,7 +224,7 @@ struct SAVTAB {
{ &Game, sizeof(Game), 1 }, // spare 2
{ &Game, sizeof(Game), 1 }, // spare 3
{ &Game, sizeof(Game), 1 }, // spare 4
- { &VGA::Mono, sizeof(VGA::Mono), 0 },
+// { &VGA::Mono, sizeof(VGA::Mono), 0 },
{ &Music, sizeof(Music), 1 },
{ volume, sizeof(volume), 1 },
{ Flag, sizeof(Flag), 1 },
@@ -273,12 +273,12 @@ static void LoadGame(XFILE &file, bool tiny = false) {
if (spr == NULL)
error("No core");
*spr = S;
- VGA::SpareQ.Append(spr);
+ Vga->SpareQ->Append(spr);
}
for (i = 0; i < POCKET_NX; i ++) {
register int r = pocref[i];
- Pocket[i] = (r < 0) ? NULL : VGA::SpareQ.Locate(r);
+ Pocket[i] = (r < 0) ? NULL : Vga->SpareQ->Locate(r);
}
}
}
@@ -311,7 +311,7 @@ static void SaveGame(XFILE &file) {
file.Write((uint8 *) & (i = SVGCHKSUM), sizeof(i));
- for (spr = VGA::SpareQ.First(); spr; spr = spr->Next)
+ for (spr = Vga->SpareQ->First(); spr; spr = spr->Next)
if (spr->Ref >= 1000)
if (!file.Error)
file.Write((uint8 *)spr, sizeof(*spr));
@@ -386,7 +386,7 @@ void WALK::Tick(void) {
if (Dir != NO_DIR) {
SPRITE *spr;
SYSTEM::FunTouch();
- for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) {
+ for (spr = Vga->ShowQ->First(); spr; spr = spr->Next) {
if (Distance(spr) < 2) {
if (! spr->Flags.Near) {
FeedSnail(spr, NEAR);
@@ -562,7 +562,7 @@ static void SetMapBrick(int x, int z) {
wtom(z, n + 3, 10, 2);
CLUSTER::Map[z][x] = 1;
s->SetName(n);
- VGA::ShowQ.Insert(s, VGA::ShowQ.First());
+ Vga->ShowQ->Insert(s, Vga->ShowQ->First());
}
}
@@ -667,13 +667,13 @@ void SYSTEM::FunTouch(void) {
static void ShowBak(int ref) {
- SPRITE *spr = VGA::SpareQ.Locate(ref);
+ SPRITE *spr = Vga->SpareQ->Locate(ref);
if (spr) {
BITMAP::Pal = SysPal;
spr->Expand();
BITMAP::Pal = NULL;
spr->Show(2);
- VGA::CopyPage(1, 2);
+ Vga->CopyPage(1, 2);
SYSTEM::SetPal();
spr->Contract();
}
@@ -688,7 +688,7 @@ static void CaveUp(void) {
ShowBak(BakRef);
LoadMapping();
Text->Preload(BakRef, BakRef + 1000);
- SPRITE *spr = VGA::SpareQ.First();
+ SPRITE *spr = Vga->SpareQ->First();
while (spr) {
SPRITE *n = spr->Next;
if (spr->Cave == Now || spr->Cave == 0)
@@ -718,18 +718,18 @@ static void CaveUp(void) {
if (! Dark)
Vga->Sunset();
- VGA::CopyPage(0, 1);
+ Vga->CopyPage(0, 1);
SelectPocket(-1);
if (Hero)
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(Hero));
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(Hero));
if (Shadow) {
- VGA::ShowQ.Remove(Shadow);
+ Vga->ShowQ->Remove(Shadow);
Shadow->MakeXlat(Glass(SysPal, 204, 204, 204));
- VGA::ShowQ.Insert(Shadow, Hero);
+ Vga->ShowQ->Insert(Shadow, Hero);
Shadow->Z = Hero->Z;
}
- FeedSnail(VGA::ShowQ.Locate(BakRef + 999), TAKE);
+ FeedSnail(Vga->ShowQ->Locate(BakRef + 999), TAKE);
Vga->Show();
Vga->CopyPage(1, 0);
Vga->Show();
@@ -747,12 +747,12 @@ static void CaveDown(void) {
if (! HorzLine.Flags.Hide)
SwitchMapping();
- for (spr = VGA::ShowQ.First(); spr;) {
+ for (spr = Vga->ShowQ->First(); spr;) {
SPRITE *n = spr->Next;
if (spr->Ref >= 1000 /*&& spr->Cave*/) {
if (spr->Ref % 1000 == 999)
FeedSnail(spr, TAKE);
- VGA::SpareQ.Append(VGA::ShowQ.Remove(spr));
+ Vga->SpareQ->Append(Vga->ShowQ->Remove(spr));
}
spr = n;
}
@@ -793,14 +793,15 @@ void SwitchCave(int cav) {
Hero->Step(0);
#ifndef DEMO
///// protection: auto-destruction on! ----------------------
- VGA::SpareQ.Show = STARTUP::Summa * (cav <= CAVE_MAX);
+ Vga->SpareQ->Show = STARTUP::Summa * (cav <= CAVE_MAX);
/////--------------------------------------------------------
#endif
}
CavLight.Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
CAVE_Y + ((Now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY);
KillText();
- if (! Startup) KeyClick();
+ if (! Startup)
+ KeyClick();
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
@@ -834,7 +835,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
break;
case 'F':
if (KEYBOARD::Key[ALT]) {
- SPRITE *m = VGA::ShowQ.Locate(17001);
+ SPRITE *m = Vga->ShowQ->Locate(17001);
if (m) {
m->Step(1);
m->Time = 216; // 3s
@@ -1017,9 +1018,9 @@ static void SpkClose(void) {
static void SwitchColorMode(void) {
- SNPOST_(SNSEQ, 121, VGA::Mono = ! VGA::Mono, NULL);
+ SNPOST_(SNSEQ, 121, Vga->Mono = !Vga->Mono, NULL);
KeyClick();
- VGA::SetColors(SysPal, 64);
+ Vga->SetColors(SysPal, 64);
}
@@ -1066,7 +1067,7 @@ static void TakeName(void) {
tn->Center();
tn->Goto(tn->X, tn->Y - 10);
tn->Z = 126;
- VGA::ShowQ.Insert(tn);
+ Vga->ShowQ->Insert(tn);
}
}
}
@@ -1085,7 +1086,7 @@ static void SwitchMapping(void) {
}
} else {
SPRITE *s;
- for (s = VGA::ShowQ.First(); s; s = s->Next)
+ for (s = Vga->ShowQ->First(); s; s = s->Next)
if (s->W == MAP_XGRID && s->H == MAP_ZGRID)
SNPOST_(SNKILL, -1, 0, s);
}
@@ -1104,7 +1105,7 @@ static void KillSprite(void) {
static void PushSprite(void) {
SPRITE *spr = Sprite->Prev;
if (spr) {
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(Sprite), spr);
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(Sprite), spr);
while (Sprite->Z > Sprite->Next->Z)
--Sprite->Z;
} else
@@ -1121,7 +1122,7 @@ static void PullSprite(void) {
ok = (!spr->Flags.Slav);
}
if (ok) {
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(Sprite), spr);
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(Sprite), spr);
if (Sprite->Prev)
while (Sprite->Z < Sprite->Prev->Z)
++Sprite->Z;
@@ -1197,7 +1198,7 @@ static void SayDebug(void) {
// sprite queue size
uint16 n = 0;
SPRITE *spr;
- for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) {
+ for (spr = Vga->ShowQ->First(); spr; spr = spr->Next) {
++ n;
if (spr == Sprite) {
*XSPR = ' ';
@@ -1463,7 +1464,7 @@ static void LoadSprite(const char *fname, int ref, int cav, int col = 0, int row
warning("LoadSprite: use of fnsplit");
Sprite->ShpCnt = shpcnt;
- VGA::SpareQ.Append(Sprite);
+ Vga->SpareQ->Append(Sprite);
}
}
@@ -1578,7 +1579,7 @@ static void RunGame(void) {
LoadHeroXY();
CavLight.Flags.Tran = true;
- VGA::ShowQ.Append(&CavLight);
+ Vga->ShowQ->Append(&CavLight);
CavLight.Flags.Hide = true;
static SEQ PocSeq[] = { { 0, 0, 0, 0, 20 },
@@ -1593,18 +1594,18 @@ static void RunGame(void) {
PocLight.Flags.Tran = true;
PocLight.Time = 1;
PocLight.Z = 120;
- VGA::ShowQ.Append(&PocLight);
+ Vga->ShowQ->Append(&PocLight);
SelectPocket(-1);
- VGA::ShowQ.Append(&Mouse);
+ Vga->ShowQ->Append(&Mouse);
// ___________
LoadUser();
// ~~~~~~~~~~~
- if ((Sprite = VGA::SpareQ.Locate(121)) != NULL)
- SNPOST_(SNSEQ, -1, VGA::Mono, Sprite);
- if ((Sprite = VGA::SpareQ.Locate(122)) != NULL)
+ if ((Sprite = Vga->SpareQ->Locate(121)) != NULL)
+ SNPOST_(SNSEQ, -1, Vga->Mono, Sprite);
+ if ((Sprite = Vga->SpareQ->Locate(122)) != NULL)
Sprite->Step(Music);
SNPOST_(SNSEQ, -1, Music, Sprite);
if (! Music)
@@ -1634,7 +1635,7 @@ static void RunGame(void) {
Shadow->Ref = 2;
Shadow->Flags.Tran = true;
Hero->Flags.Shad = true;
- VGA::ShowQ.Insert(VGA::SpareQ.Remove(Shadow), Hero);
+ Vga->ShowQ->Insert(Vga->SpareQ->Remove(Shadow), Hero);
}
}
}
@@ -1642,16 +1643,16 @@ static void RunGame(void) {
InfoLine.Goto(INFO_X, INFO_Y);
InfoLine.Flags.Tran = true;
InfoLine.Update(NULL);
- VGA::ShowQ.Insert(&InfoLine);
+ Vga->ShowQ->Insert(&InfoLine);
DebugLine.Z = 126;
- VGA::ShowQ.Insert(&DebugLine);
+ Vga->ShowQ->Insert(&DebugLine);
HorzLine.Y = MAP_TOP - (MAP_TOP > 0);
HorzLine.Z = 126;
- VGA::ShowQ.Insert(&HorzLine);
+ Vga->ShowQ->Insert(&HorzLine);
- Mouse.Busy = VGA::SpareQ.Locate(BUSY_REF);
+ Mouse.Busy = Vga->SpareQ->Locate(BUSY_REF);
if (Mouse.Busy)
ExpandSprite(Mouse.Busy);
@@ -1676,8 +1677,8 @@ static void RunGame(void) {
SNPOST(SNCLEAR, -1, 0, NULL);
SNPOST_(SNCLEAR, -1, 0, NULL);
Mouse.Off();
- VGA::ShowQ.Clear();
- VGA::SpareQ.Clear();
+ Vga->ShowQ->Clear();
+ Vga->SpareQ->Clear();
Hero = NULL;
Shadow = NULL;
}
@@ -1687,9 +1688,9 @@ void Movie(const char *ext) {
const char *fn = ProgName(ext);
if (INI_FILE::Exist(fn)) {
LoadScript(fn);
- ExpandSprite(VGA::SpareQ.Locate(999));
- FeedSnail(VGA::ShowQ.Locate(999), TAKE);
- VGA::ShowQ.Append(&Mouse);
+ ExpandSprite(Vga->SpareQ->Locate(999));
+ FeedSnail(Vga->ShowQ->Locate(999), TAKE);
+ Vga->ShowQ->Append(&Mouse);
HEART::Enable = true;
KEYBOARD::SetClient(Sys);
while (! Snail.Idle()) {
@@ -1699,8 +1700,8 @@ void Movie(const char *ext) {
HEART::Enable = false;
SNPOST(SNCLEAR, -1, 0, NULL);
SNPOST_(SNCLEAR, -1, 0, NULL);
- VGA::ShowQ.Clear();
- VGA::SpareQ.Clear();
+ Vga->ShowQ->Clear();
+ Vga->SpareQ->Clear();
}
}
@@ -1723,23 +1724,23 @@ bool ShowTitle(const char *name) {
}
Vga->Sunset();
- VGA::CopyPage(1, 2);
- VGA::CopyPage(0, 1);
+ Vga->CopyPage(1, 2);
+ Vga->CopyPage(0, 1);
SelectPocket(-1);
Vga->Sunrise(SysPal);
if (STARTUP::Mode < 2 && ! STARTUP::SoundOk) {
- VGA::CopyPage(1, 2);
- VGA::CopyPage(0, 1);
- VGA::ShowQ.Append(&Mouse);
+ Vga->CopyPage(1, 2);
+ Vga->CopyPage(0, 1);
+ Vga->ShowQ->Append(&Mouse);
HEART::Enable = true;
Mouse.On();
for (SelectSound(); ! Snail.Idle() || VMENU::Addr;)
MainLoop();
Mouse.Off();
HEART::Enable = false;
- VGA::ShowQ.Clear();
- VGA::CopyPage(0, 2);
+ Vga->ShowQ->Clear();
+ Vga->CopyPage(0, 2);
STARTUP::SoundOk = 2;
if (Music)
LoadMIDI(0);
@@ -1766,9 +1767,9 @@ bool ShowTitle(const char *name) {
#endif
//-----------------------------------------
Movie("X00"); // paylist
- VGA::CopyPage(1, 2);
- VGA::CopyPage(0, 1);
- VGA::ShowQ.Append(&Mouse);
+ Vga->CopyPage(1, 2);
+ Vga->CopyPage(0, 1);
+ Vga->ShowQ->Append(&Mouse);
//Mouse.On();
HEART::Enable = true;
for (TakeName(); GET_TEXT::Ptr;)
@@ -1779,15 +1780,15 @@ bool ShowTitle(const char *name) {
if (usr_ok)
strcat(UsrFnam, SVG_EXT);
//Mouse.Off();
- VGA::ShowQ.Clear();
- VGA::CopyPage(0, 2);
+ Vga->ShowQ->Clear();
+ Vga->CopyPage(0, 2);
#endif
if (usr_ok && STARTUP::Mode == 0) {
const char *n = UsrPath(UsrFnam);
if (CFILE::Exist(n)) {
CFILE file = CFILE(n, REA, RCrypt);
LoadGame(file, true); // only system vars
- VGA::SetColors(SysPal, 64);
+ Vga->SetColors(SysPal, 64);
Vga->Update();
if (FINIS) {
++ STARTUP::Mode;
@@ -1801,7 +1802,7 @@ bool ShowTitle(const char *name) {
if (STARTUP::Mode < 2)
Movie("X01"); // wink
- VGA::CopyPage(0, 2);
+ Vga->CopyPage(0, 2);
#ifdef DEMO
return true;
@@ -1844,7 +1845,8 @@ void cge_main(void) {
Movie(LGO_EXT);
if (ShowTitle("WELCOME")) {
#ifndef DEMO
- if (STARTUP::Mode == 1) Movie("X02"); // intro
+ if (STARTUP::Mode == 1)
+ Movie("X02"); // intro
#endif
RunGame();
Startup = 2;
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp
index 5b65eee9ca..c1b69d40c2 100644
--- a/engines/cge/mixer.cpp
+++ b/engines/cge/mixer.cpp
@@ -30,6 +30,7 @@
#include "cge/snail.h"
#include "cge/mouse.h"
#include "cge/snddrv.h"
+#include "cge/cge_main.h"
#include <string.h>
namespace CGE {
@@ -75,9 +76,9 @@ MIXER::MIXER(int x, int y) : SPRITE(NULL), Fall(MIX_FALL) {
}
Led[ArrayCount(Led) - 1]->Flags.BDel = true;
- VGA::ShowQ.Insert(this);
+ Vga->ShowQ->Insert(this);
for (i = 0; i < ArrayCount(Led); i ++)
- VGA::ShowQ.Insert(Led[i]);
+ Vga->ShowQ->Insert(Led[i]);
//--- reset balance
i = (SNDDrvInfo.VOL4.ML + SNDDrvInfo.VOL4.MR) / 2;
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 29ab11a36e..f40d2bc2fa 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -80,7 +80,7 @@ static void SNGame(SPRITE *spr, int num) {
int buref = 0;
int Stage = 0;
- for (dup[0] = VGA::ShowQ.First(); dup[0]; dup[0] = dup[0]->Next) {
+ for (dup[0] = Vga->ShowQ->First(); dup[0]; dup[0] = dup[0]->Next) {
buref = dup[0]->Ref;
if (buref / 1000 == 16 && buref % 100 == 6) {
Stage = (buref / 100) % 10;
@@ -88,8 +88,8 @@ static void SNGame(SPRITE *spr, int num) {
}
}
if (dup[1] == NULL) {
- dup[1] = VGA::ShowQ.Locate(16003); // pan
- dup[2] = VGA::ShowQ.Locate(16004); // pani
+ dup[1] = Vga->ShowQ->Locate(16003); // pan
+ dup[2] = Vga->ShowQ->Locate(16004); // pani
}
if (Game) { // continue game
@@ -172,10 +172,10 @@ static void SNGame(SPRITE *spr, int num) {
static int count = 0;
if (k == NULL) {
- k = VGA::ShowQ.Locate(20700);
- k1 = VGA::ShowQ.Locate(20701);
- k2 = VGA::ShowQ.Locate(20702);
- k3 = VGA::ShowQ.Locate(20703);
+ k = Vga->ShowQ->Locate(20700);
+ k1 = Vga->ShowQ->Locate(20701);
+ k2 = Vga->ShowQ->Locate(20702);
+ k3 = Vga->ShowQ->Locate(20703);
}
if (! Game) { // init
@@ -282,13 +282,13 @@ static void SNGame(SPRITE *spr, int num) {
void ExpandSprite(SPRITE *spr) {
if (spr)
- VGA::ShowQ.Insert(VGA::SpareQ.Remove(spr));
+ Vga->ShowQ->Insert(Vga->SpareQ->Remove(spr));
}
void ContractSprite(SPRITE *spr) {
if (spr)
- VGA::SpareQ.Append(VGA::ShowQ.Remove(spr));
+ Vga->SpareQ->Append(Vga->ShowQ->Remove(spr));
}
int FindPocket(SPRITE *spr) {
@@ -515,10 +515,10 @@ static void SNZTrim(SPRITE *spr) {
SPRITE *s;
HEART::Enable = false;
s = (spr->Flags.Shad) ? spr->Prev : NULL;
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(spr));
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(spr));
if (s) {
s->Z = spr->Z;
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(s), spr);
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(s), spr);
}
HEART::Enable = en;
}
@@ -636,7 +636,7 @@ void SNCover(SPRITE *spr, int xref) {
xspr->Goto(spr->X, spr->Y);
ExpandSprite(xspr);
if ((xspr->Flags.Shad = spr->Flags.Shad) == 1) {
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(spr->Prev), xspr);
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(spr->Prev), xspr);
spr->Flags.Shad = false;
}
FeedSnail(xspr, NEAR);
@@ -650,7 +650,7 @@ void SNUncover(SPRITE *spr, SPRITE *xspr) {
spr->Cave = xspr->Cave;
spr->Goto(xspr->X, xspr->Y);
if ((spr->Flags.Shad = xspr->Flags.Shad) == 1) {
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(xspr->Prev), spr);
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(xspr->Prev), spr);
xspr->Flags.Shad = false;
}
spr->Z = xspr->Z;
@@ -725,7 +725,7 @@ void SNSlave(SPRITE *spr, int ref) {
SNSend(slv, spr->Cave);
slv->Flags.Slav = true;
slv->Z = spr->Z;
- VGA::ShowQ.Insert(VGA::ShowQ.Remove(slv), spr->Next);
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(slv), spr->Next);
}
}
}
@@ -752,13 +752,13 @@ void SNKill(SPRITE *spr) {
}
SPRITE *nx = spr->Next;
Hide1(spr);
- VGA::ShowQ.Remove(spr);
+ Vga->ShowQ->Remove(spr);
MOUSE::ClrEvt(spr);
if (spr->Flags.Kill)
delete spr;
else {
spr->Cave = -1;
- VGA::SpareQ.Append(spr);
+ Vga->SpareQ->Append(spr);
}
if (nx)
if (nx->Flags.Slav)
@@ -826,7 +826,7 @@ static void SNLevel(SPRITE *spr, int lev) {
while (Lev < lev) {
SPRITE *spr;
++Lev;
- spr = VGA::SpareQ.Locate(100 + Lev);
+ spr = Vga->SpareQ->Locate(100 + Lev);
if (spr) {
spr->BackShow(true);
spr->Cave = 0;
@@ -863,19 +863,19 @@ void SNFlash(bool on) {
c = pal[i].B << 1;
pal[i].B = (c < 64) ? c : 63;
}
- VGA::SetColors(pal, 64);
+ Vga->SetColors(pal, 64);
}
} else
- VGA::SetColors(SysPal, 64);
+ Vga->SetColors(SysPal, 64);
Dark = false;
}
static void SNLight(bool in) {
if (in)
- VGA::Sunrise(SysPal);
+ Vga->Sunrise(SysPal);
else
- VGA::Sunset();
+ Vga->Sunset();
Dark = ! in;
}
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index bbb69839dd..4944d8529a 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -32,6 +32,7 @@
#include "cge/bitmaps.h"
#include "cge/game.h"
#include "cge/snail.h"
+#include "cge/cge_main.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -215,8 +216,8 @@ void Say(const char *txt, SPRITE *spr) {
spike->Step(east);
spike->Ref = SAY_REF;
- VGA::ShowQ.Insert(Talk, VGA::ShowQ.Last());
- VGA::ShowQ.Insert(spike, VGA::ShowQ.Last());
+ Vga->ShowQ->Insert(Talk, Vga->ShowQ->Last());
+ Vga->ShowQ->Insert(spike, Vga->ShowQ->Last());
}
}
@@ -231,7 +232,7 @@ void Inf(const char *txt) {
Talk->Goto(Talk->X, Talk->Y - 20);
Talk->Z = 126;
Talk->Ref = INF_REF;
- VGA::ShowQ.Insert(Talk, VGA::ShowQ.Last());
+ Vga->ShowQ->Insert(Talk, Vga->ShowQ->Last());
}
}
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 52015c27f1..54b34105d8 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -30,6 +30,7 @@
#include "cge/bitmap.h"
#include "cge/vol.h"
#include "cge/text.h"
+#include "cge/cge_main.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -213,8 +214,8 @@ RGB MkRGB(uint8 r, uint8 g, uint8 b) {
SPRITE *Locate(int ref) {
- SPRITE *spr = VGA::ShowQ.Locate(ref);
- return (spr) ? spr : VGA::SpareQ.Locate(ref);
+ SPRITE *spr = Vga->ShowQ->Locate(ref);
+ return (spr) ? spr : Vga->SpareQ->Locate(ref);
}
@@ -774,7 +775,7 @@ BMP_PTR SPRITE::Ghost(void) {
SPRITE *SpriteAt(int x, int y) {
- SPRITE *spr = NULL, * tail = VGA::ShowQ.Last();
+ SPRITE *spr = NULL, * tail = Vga->ShowQ->Last();
if (tail) {
for (spr = tail->Prev; spr; spr = spr->Prev)
if (! spr->Flags.Hide && ! spr->Flags.Tran)
@@ -888,17 +889,6 @@ SPRITE *QUEUE::Locate(int ref) {
}
-uint16 VGA::StatAdr = VGAST1_;
-uint16 VGA::OldMode = 0;
-uint16 *VGA::OldScreen = NULL;
-const char *VGA::Msg = NULL;
-const char *VGA::Nam = NULL;
-DAC *VGA::OldColors = NULL;
-DAC *VGA::NewColors = NULL;
-bool VGA::SetPal = false;
-int VGA::Mono = 0;
-QUEUE VGA::ShowQ = true, VGA::SpareQ = false;
-
// TODO: Was direct mapping to VGA buffers.. need to create scummvm surfaces for that
uint8 *VGA::Page[4] = { 0, 0, 0, 0 };
@@ -912,7 +902,13 @@ uint8 * VGA::Page[4] = { (uint8 *) MK_FP(SCR_SEG, 0x0000),
//extern const char Copr[];
VGA::VGA(int mode)
- : FrmCnt(0) {
+ : FrmCnt(0), OldMode(0), OldScreen(NULL), StatAdr(VGAST1_),
+ Msg(NULL), Nam(NULL), SetPal(false), Mono(0) {
+ OldColors = NULL;
+ NewColors = NULL;
+ ShowQ = new QUEUE(true);
+ SpareQ = new QUEUE(false);
+
bool std = true;
int i;
for (i = 10; i < 20; i ++) {
@@ -939,7 +935,7 @@ VGA::VGA(int mode)
OldMode = SetMode(mode);
SetColors();
Setup(VideoMode);
- Clear();
+ Clear(0);
}
}
@@ -948,7 +944,7 @@ VGA::~VGA(void) {
Mono = 0;
if (IsVga()) {
Common::String buffer = "";
- Clear();
+ Clear(0);
SetMode(OldMode);
SetColors();
RestoreScreen(OldScreen);
@@ -1154,7 +1150,7 @@ void VGA::SetColors(void) {
void VGA::Sunrise(DAC *tab) {
for (int i = 0; i <= 64; i += FADE_STEP) {
SetColors(tab, i);
- WaitVR();
+ WaitVR(true);
UpdateColors();
}
}
@@ -1165,19 +1161,19 @@ void VGA::Sunset(void) {
GetColors(tab);
for (int i = 64; i >= 0; i -= FADE_STEP) {
SetColors(tab, i);
- WaitVR();
+ WaitVR(true);
UpdateColors();
}
}
void VGA::Show(void) {
- SPRITE *spr = ShowQ.First();
+ SPRITE *spr = ShowQ->First();
- for (spr = ShowQ.First(); spr; spr = spr->Next)
+ for (spr = ShowQ->First(); spr; spr = spr->Next)
spr->Show();
Update();
- for (spr = ShowQ.First(); spr; spr = spr->Next)
+ for (spr = ShowQ->First(); spr; spr = spr->Next)
spr->Hide();
++ FrmCnt;
@@ -1228,7 +1224,8 @@ void VGA::Update(void) {
asm mov ah,byte ptr p+1
asm out dx,ax
*/
- if (! SpeedTest) WaitVR();
+ if (! SpeedTest)
+ WaitVR(true);
if (SetPal) {
UpdateColors();
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index 19453a4523..b467b0405f 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -228,7 +228,7 @@ class QUEUE {
SPRITE *Head, * Tail;
public:
bool Show;
- QUEUE(bool show = false);
+ QUEUE(bool show);
~QUEUE(void);
void Append(SPRITE *spr);
void Insert(SPRITE *spr, SPRITE *nxt);
@@ -247,32 +247,35 @@ public:
class VGA {
- static uint16 OldMode;
- static uint16 *OldScreen;
- static uint16 StatAdr;
- static bool SetPal;
- static DAC *OldColors, * NewColors;
- static int SetMode(int mode);
- static void UpdateColors(void);
- static void SetColors(void);
- static const char *Msg;
- static const char *Nam;
- static void SetStatAdr(void);
- static void WaitVR(bool on = true);
+ uint16 OldMode;
+ uint16 *OldScreen;
+ uint16 StatAdr;
+ bool SetPal;
+ DAC *OldColors, *NewColors;
+ const char *Msg;
+ const char *Nam;
+
+ int SetMode(int mode);
+ void UpdateColors(void);
+ void SetColors(void);
+ void SetStatAdr(void);
+ void WaitVR(bool on);
public:
uint32 FrmCnt;
- static QUEUE ShowQ, SpareQ;
- static int Mono;
+ QUEUE *ShowQ, *SpareQ;
+ int Mono;
static uint8 *Page[4];
- VGA(int mode = M13H);
+
+ VGA(int mode);
~VGA(void);
+
void Setup(VgaRegBlk *vrb);
- static void GetColors(DAC *tab);
- static void SetColors(DAC *tab, int lum);
- static void Clear(uint8 color = 0);
- static void CopyPage(uint16 d, uint16 s = 3);
- static void Sunrise(DAC *tab);
- static void Sunset(void);
+ void GetColors(DAC *tab);
+ void SetColors(DAC *tab, int lum);
+ void Clear(uint8 color);
+ void CopyPage(uint16 d, uint16 s);
+ void Sunrise(DAC *tab);
+ void Sunset(void);
void Show(void);
void Update(void);
};
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
index 4e1a3334bf..cb2c2013f4 100644
--- a/engines/cge/vmenu.cpp
+++ b/engines/cge/vmenu.cpp
@@ -27,6 +27,7 @@
#include "cge/vmenu.h"
#include "cge/mouse.h"
+#include "cge/cge_main.h"
#include <string.h>
namespace CGE {
@@ -112,10 +113,10 @@ VMENU::VMENU(CHOICE *list, int x, int y)
Center();
else
Goto(x - W / 2, y - (TEXT_VM + FONT_HIG / 2));
- VGA::ShowQ.Insert(this, VGA::ShowQ.Last());
+ Vga->ShowQ->Insert(this, Vga->ShowQ->Last());
Bar = new MENU_BAR(W - 2 * TEXT_HM);
Bar->Goto(X + TEXT_HM - MB_HM, Y + TEXT_VM - MB_VM);
- VGA::ShowQ.Insert(Bar, VGA::ShowQ.Last());
+ Vga->ShowQ->Insert(Bar, Vga->ShowQ->Last());
}