aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2011-06-29 00:35:21 +0200
committerStrangerke2011-06-29 00:35:21 +0200
commit290305ad4320a489d6dc98279433e0d3b3a7de40 (patch)
tree789a74aef3deab500f4485833f44e03a917202d1 /engines
parente25f9c71f525a0feba28648a93846d7c9435f6e2 (diff)
downloadscummvm-rg350-290305ad4320a489d6dc98279433e0d3b3a7de40.tar.gz
scummvm-rg350-290305ad4320a489d6dc98279433e0d3b3a7de40.tar.bz2
scummvm-rg350-290305ad4320a489d6dc98279433e0d3b3a7de40.zip
CGE: Cleanup : Start renaming. Add BMPLoad() function
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/bitmap.cpp56
-rw-r--r--engines/cge/bitmap.h8
-rw-r--r--engines/cge/cge.cpp32
-rw-r--r--engines/cge/cge_main.cpp366
-rw-r--r--engines/cge/cge_main.h32
-rw-r--r--engines/cge/game.cpp2
-rw-r--r--engines/cge/game.h2
-rw-r--r--engines/cge/general.cpp7
-rw-r--r--engines/cge/gettext.cpp2
-rw-r--r--engines/cge/gettext.h2
-rw-r--r--engines/cge/keybd.cpp6
-rw-r--r--engines/cge/keybd.h4
-rw-r--r--engines/cge/mixer.cpp6
-rw-r--r--engines/cge/mixer.h6
-rw-r--r--engines/cge/mouse.cpp7
-rw-r--r--engines/cge/mouse.h12
-rw-r--r--engines/cge/snail.cpp176
-rw-r--r--engines/cge/talk.cpp4
-rw-r--r--engines/cge/talk.h2
-rw-r--r--engines/cge/text.cpp14
-rw-r--r--engines/cge/text.h6
-rw-r--r--engines/cge/vga13h.cpp382
-rw-r--r--engines/cge/vga13h.h132
-rw-r--r--engines/cge/vmenu.cpp2
24 files changed, 674 insertions, 594 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 943f1cf154..10fc9a4df6 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -139,6 +139,7 @@ BITMAP::~BITMAP(void) {
break;
case FAR_MEM :
free(V);
+ default:
break;
}
}
@@ -419,4 +420,59 @@ bool BITMAP::VBMLoad(XFILE *f) {
B = (HideDesc *)(V + n - H * sizeof(HideDesc));
return (f->Error == 0);
}
+
+bool BITMAP::BMPLoad (XFILE * f) {
+ struct {
+ char BM[2];
+ union { int16 len; int32 len_; };
+ union { int16 _06; int32 _06_; };
+ union { int16 hdr; int32 hdr_; };
+ union { int16 _0E; int32 _0E_; };
+ union { int16 wid; int32 wid_; };
+ union { int16 hig; int32 hig_; };
+ union { int16 _1A; int32 _1A_; };
+ union { int16 _1E; int32 _1E_; };
+ union { int16 _22; int32 _22_; };
+ union { int16 _26; int32 _26_; };
+ union { int16 _2A; int32 _2A_; };
+ union { int16 _2E; int32 _2E_; };
+ union { int16 _32; int32 _32_; };
+ } hea;
+ BGR4 bpal[256];
+
+ f->Read((byte *)&hea, sizeof(hea));
+ if (f->Error == 0) {
+ if (hea.hdr == 0x436L) {
+ int16 i = (hea.hdr - sizeof(hea)) / sizeof(BGR4);
+ f->Read((byte *)&bpal, sizeof(bpal));
+ if (f->Error == 0) {
+ if (Pal) {
+ for (i = 0; i < 256; i ++) {
+ Pal[i].R = bpal[i].R;
+ Pal[i].G = bpal[i].G;
+ Pal[i].B = bpal[i].B;
+ }
+ Pal = NULL;
+ }
+ H = hea.hig;
+ W = hea.wid;
+ if ((M = farnew(byte, H * W)) != NULL) {
+ int16 r = (4 - (hea.wid & 3)) % 4;
+ byte buf[3]; int i;
+ for (i = H-1; i >= 0; i --) {
+ f->Read(M + (W * i), W);
+ if (r && f->Error == 0)
+ f->Read(buf, r);
+ if (f->Error)
+ break;
+ }
+ if (i < 0)
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
} // End of namespace CGE
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index 13e28f4369..e114760e2a 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -41,7 +41,7 @@ namespace CGE {
#include "common/pack-start.h"
-typedef struct {
+struct BGR4 {
uint16 b : 2;
uint16 B : 6;
uint16 g : 2;
@@ -49,13 +49,13 @@ typedef struct {
uint16 r : 2;
uint16 R : 6;
uint16 Z : 8;
-} BGR4;
+};
-typedef struct {
+struct HideDesc {
uint16 skip;
uint16 hide;
-} HideDesc;
+};
#include "common/pack-end.h"
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index f2bebef258..07638ebdd8 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -63,19 +63,19 @@ void CGEEngine::setup() {
// Initialise engine objects
Text = new TEXT(this, ProgName(), 128);
Vga = new VGA(M13H);
- Heart = new HEART;
+ _heart = new Heart;
Hero = new WALK(this, NULL);
Sys = new SYSTEM(this);
- PocLight = new SPRITE(this, LI);
+ _pocLight = new Sprite(this, LI);
Mouse = new MOUSE(this);
for (int i = 0; i < POCKET_NX; i++)
- Pocket[i] = new SPRITE(this, NULL);
- Sprite = new SPRITE(this, NULL);
- MiniCave = new SPRITE(this, NULL);
- Shadow = new SPRITE(this, NULL);
- HorzLine = new SPRITE(this, HL);
+ _pocket[i] = new Sprite(this, NULL);
+ _sprite = new Sprite(this, NULL);
+ _miniCave = new Sprite(this, NULL);
+ _shadow = new Sprite(this, NULL);
+ _horzLine = new Sprite(this, HL);
InfoLine = new INFO_LINE(this, INFO_W);
- CavLight = new SPRITE(this, PR);
+ _cavLight = new Sprite(this, PR);
DebugLine = new INFO_LINE(this, SCR_WID);
MB[0] = new BITMAP("BRICK");
MB[1] = NULL;
@@ -117,19 +117,19 @@ CGEEngine::~CGEEngine() {
// Delete engine objects
delete Text;
delete Vga;
- delete Heart;
+ delete _heart;
delete Hero;
delete Sys;
- delete PocLight;
+ delete _pocLight;
delete Mouse;
for (int i = 0; i < POCKET_NX; i++)
- delete Pocket[i];
- delete Sprite;
- delete MiniCave;
- delete Shadow;
- delete HorzLine;
+ delete _pocket[i];
+ delete _sprite;
+ delete _miniCave;
+ delete _shadow;
+ delete _horzLine;
delete InfoLine;
- delete CavLight;
+ delete _cavLight;
delete DebugLine;
delete MB[0];
delete HL[0];
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index c415258ad8..ece6ec5adb 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -25,56 +25,55 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
-#include "cge/general.h"
-#include "cge/boot.h"
-#include "cge/ident.h"
-#include "cge/sound.h"
-#include "cge/startup.h"
-#include "cge/config.h"
-#include "cge/vga13h.h"
-#include "cge/snail.h"
-#include "cge/text.h"
-#include "cge/game.h"
-#include "cge/mouse.h"
-#include "cge/keybd.h"
-#include "cge/cfile.h"
-#include "cge/vol.h"
-#include "cge/talk.h"
-#include "cge/vmenu.h"
-#include "cge/gettext.h"
-#include "cge/mixer.h"
-#include "cge/cge_main.h"
-#include "cge/cge.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-
+#include "cge/general.h"
+#include "cge/boot.h"
+#include "cge/ident.h"
+#include "cge/sound.h"
+#include "cge/startup.h"
+#include "cge/config.h"
+#include "cge/vga13h.h"
+#include "cge/snail.h"
+#include "cge/text.h"
+#include "cge/game.h"
+#include "cge/mouse.h"
+#include "cge/keybd.h"
+#include "cge/cfile.h"
+#include "cge/vol.h"
+#include "cge/talk.h"
+#include "cge/vmenu.h"
+#include "cge/gettext.h"
+#include "cge/mixer.h"
+#include "cge/cge_main.h"
+#include "cge/cge.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
#include "common/str.h"
namespace CGE {
-#define STACK_SIZ (K(2))
-#define SVGCHKSUM (1956 + Now + OldLev + Game + Music + DemoText)
+#define STACK_SIZ (K(2))
+#define SVGCHKSUM (1956 + Now + OldLev + Game + Music + DemoText)
-#define SVG0NAME ("{{INIT}}" SVG_EXT)
-#define SVG0FILE INI_FILE
+#define SVG0NAME ("{{INIT}}" SVG_EXT)
+#define SVG0FILE INI_FILE
extern uint16 _stklen = (STACK_SIZ * 2);
VGA *Vga;
-HEART *Heart;
+Heart *_heart;
WALK *Hero;
SYSTEM *Sys;
-SPRITE *PocLight;
+Sprite *_pocLight;
MOUSE *Mouse;
-SPRITE *Pocket[POCKET_NX];
-SPRITE *Sprite;
-SPRITE *MiniCave;
-SPRITE *Shadow;
-SPRITE *HorzLine;
+Sprite *_pocket[POCKET_NX];
+Sprite *_sprite;
+Sprite *_miniCave;
+Sprite *_shadow;
+Sprite *_horzLine;
INFO_LINE *InfoLine;
-SPRITE *CavLight;
+Sprite *_cavLight;
INFO_LINE *DebugLine;
BMP_PTR MB[2];
@@ -146,11 +145,11 @@ HXY HeroXY[CAVE_MAX] = {{0, 0}};
BAR Barriers[1 + CAVE_MAX] = { { 0xFF, 0xFF } };
-extern int FindPocket(SPRITE *);
+extern int FindPocket(Sprite *);
extern DAC StdPal[58];
-void FeedSnail(SPRITE *spr, SNLIST snq); // defined in SNAIL
+void FeedSnail(Sprite *spr, SNLIST snq); // defined in SNAIL
uint8 CLUSTER::Map[MAP_ZCNT][MAP_XCNT];
@@ -223,11 +222,13 @@ CLUSTER XZ(COUPLE xy) {
int pocref[POCKET_NX];
uint8 volume[2];
-struct SAVTAB {
+struct SavTab {
void *Ptr;
int Len;
uint8 Flg;
-} SavTab[] = {
+};
+
+SavTab _savTab[] = {
{ &Now, sizeof(Now), 1 },
{ &OldLev, sizeof(OldLev), 1 },
{ &DemoText, sizeof(DemoText), 1 },
@@ -248,11 +249,11 @@ struct SAVTAB {
void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
- SAVTAB *st;
- SPRITE *spr;
+ SavTab *st;
+ Sprite *spr;
int i;
- for (st = SavTab; st->Ptr; st++) {
+ for (st = _savTab; st->Ptr; st++) {
if (file.Error)
error("Bad SVG");
file.Read((uint8 *)((tiny || st->Flg) ? st->Ptr : &i), st->Len);
@@ -273,7 +274,7 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
if (! tiny) { // load sprites & pocket
while (! file.Error) {
- SPRITE S(this, NULL);
+ Sprite S(this, NULL);
uint16 n = file.Read((uint8 *) &S, sizeof(S));
if (n != sizeof(S))
@@ -281,7 +282,7 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
S.Prev = S.Next = NULL;
spr = (scumm_stricmp(S.File + 2, "MUCHA") == 0) ? new FLY(this, NULL)
- : new SPRITE(this, NULL);
+ : new Sprite(this, NULL);
if (spr == NULL)
error("No core");
*spr = S;
@@ -290,7 +291,7 @@ void CGEEngine::LoadGame(XFILE &file, bool tiny = false) {
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);
}
}
}
@@ -303,19 +304,19 @@ static void SaveSound(void) {
static void SaveGame(XFILE &file) {
- SAVTAB *st;
- SPRITE *spr;
+ SavTab *st;
+ Sprite *spr;
int i;
for (i = 0; i < POCKET_NX; i++) {
- register SPRITE *s = Pocket[i];
- pocref[i] = (s) ? s->Ref : -1;
+ register Sprite *s = _pocket[i];
+ pocref[i] = (s) ? s->_ref : -1;
}
volume[0] = SNDDrvInfo.VOL2.D;
volume[1] = SNDDrvInfo.VOL2.M;
- for (st = SavTab; st->Ptr; st++) {
+ for (st = _savTab; st->Ptr; st++) {
if (file.Error)
error("Bad SVG");
file.Write((uint8 *) st->Ptr, st->Len);
@@ -324,7 +325,7 @@ static void SaveGame(XFILE &file) {
file.Write((uint8 *) & (i = SVGCHKSUM), sizeof(i));
for (spr = Vga->SpareQ->First(); spr; spr = spr->Next)
- if (spr->Ref >= 1000)
+ if (spr->_ref >= 1000)
if (!file.Error)
file.Write((uint8 *)spr, sizeof(*spr));
}
@@ -385,7 +386,7 @@ int FindLevel;
WALK::WALK(CGEEngine *vm, BMP_PTR *shpl)
- : SPRITE(vm, shpl), Dir(NO_DIR), TracePtr(-1), _vm(vm) {
+ : Sprite(vm, shpl), Dir(NO_DIR), TracePtr(-1), _vm(vm) {
}
@@ -396,7 +397,7 @@ void WALK::Tick(void) {
Here = XZ(X + W / 2, Y + H);
if (Dir != NO_DIR) {
- SPRITE *spr;
+ Sprite *spr;
Sys->FunTouch();
for (spr = Vga->ShowQ->First(); spr; spr = spr->Next) {
if (Distance(spr) < 2) {
@@ -434,7 +435,7 @@ void WALK::Tick(void) {
}
-int WALK::Distance(SPRITE *spr) {
+int WALK::Distance(Sprite *spr) {
int dx, dz;
dx = spr->X - (X + W - WALKSIDE);
if (dx < 0)
@@ -502,7 +503,7 @@ void WALK::FindWay(CLUSTER c) {
}
-void WALK::FindWay(SPRITE *spr) {
+void WALK::FindWay(Sprite *spr) {
if (spr && spr != this) {
int x = spr->X, z = spr->Z;
if (spr->Flags.East)
@@ -516,12 +517,12 @@ void WALK::FindWay(SPRITE *spr) {
}
-bool WALK::Lower(SPRITE *spr) {
+bool WALK::Lower(Sprite *spr) {
return (spr->Y > Y + (H * 3) / 5);
}
-void WALK::Reach(SPRITE *spr, int mode) {
+void WALK::Reach(Sprite *spr, int mode) {
if (spr) {
Hero->FindWay(spr);
if (mode < 0) {
@@ -542,7 +543,7 @@ void WALK::Reach(SPRITE *spr, int mode) {
}
-class SQUARE : public SPRITE {
+class SQUARE : public Sprite {
public:
SQUARE(CGEEngine *vm);
void Touch(uint16 mask, int x, int y);
@@ -552,14 +553,14 @@ private:
SQUARE::SQUARE(CGEEngine *vm)
- : SPRITE(vm, MB), _vm(vm) {
+ : Sprite(vm, MB), _vm(vm) {
Flags.Kill = true;
Flags.BDel = false;
}
void SQUARE::Touch(uint16 mask, int x, int y) {
- SPRITE::Touch(mask, x, y);
+ Sprite::Touch(mask, x, y);
if (mask & L_UP) {
XZ(X + x, Y + y).Cell() = 0;
SNPOST_(SNKILL, -1, 0, this);
@@ -632,14 +633,14 @@ static void AltCtrlDel(void) {
static void MiniStep(int stp) {
if (stp < 0)
- MiniCave->Flags.Hide = true;
+ _miniCave->Flags.Hide = true;
else {
&*Mini;
*MiniShp[0] = *MiniShpList[stp];
if (Fx.Current)
&*(Fx.Current->EAddr());
- MiniCave->Flags.Hide = false;
+ _miniCave->Flags.Hide = false;
}
}
@@ -670,7 +671,7 @@ 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 = VGA::SysPal;
spr->Expand();
@@ -691,11 +692,11 @@ 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)
- if (spr->Ref != BakRef) {
+ Sprite *n = spr->Next;
+ if (spr->_cave == Now || spr->_cave == 0)
+ if (spr->_ref != BakRef) {
if (spr->Flags.Back)
spr->BackShow();
else
@@ -726,11 +727,11 @@ static void CaveUp(void) {
if (Hero)
Vga->ShowQ->Insert(Vga->ShowQ->Remove(Hero));
- if (Shadow) {
- Vga->ShowQ->Remove(Shadow);
- Shadow->MakeXlat(Glass(VGA::SysPal, 204, 204, 204));
- Vga->ShowQ->Insert(Shadow, Hero);
- Shadow->Z = Hero->Z;
+ if (_shadow) {
+ Vga->ShowQ->Remove(_shadow);
+ _shadow->MakeXlat(Glass(VGA::SysPal, 204, 204, 204));
+ Vga->ShowQ->Insert(_shadow, Hero);
+ _shadow->Z = Hero->Z;
}
FeedSnail(Vga->ShowQ->Locate(BakRef + 999), TAKE);
Vga->Show();
@@ -741,19 +742,19 @@ static void CaveUp(void) {
if (! Startup)
Mouse->On();
- Heart->Enable = true;
+ _heart->_enable = true;
}
void CGEEngine::CaveDown() {
- SPRITE *spr;
- if (! HorzLine->Flags.Hide)
+ Sprite *spr;
+ if (!_horzLine->Flags.Hide)
SwitchMapping();
for (spr = Vga->ShowQ->First(); spr;) {
- SPRITE *n = spr->Next;
- if (spr->Ref >= 1000 /*&& spr->Cave*/) {
- if (spr->Ref % 1000 == 999)
+ 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));
}
@@ -782,7 +783,7 @@ void CGEEngine::QGame() {
void CGEEngine::SwitchCave(int cav) {
if (cav != Now) {
- Heart->Enable = false;
+ _heart->_enable = false;
if (cav < 0) {
SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint
//TODO Change the SNPOST message send to a special way to send function pointer
@@ -799,7 +800,7 @@ void CGEEngine::SwitchCave(int cav) {
Vga->SpareQ->Show = STARTUP::Summa * (cav <= CAVE_MAX);
/////--------------------------------------------------------
}
- CavLight->Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
+ _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)
@@ -812,7 +813,7 @@ void CGEEngine::SwitchCave(int cav) {
}
}
-SYSTEM::SYSTEM(CGEEngine *vm) : SPRITE(vm, NULL), _vm(vm) {
+SYSTEM::SYSTEM(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
FunDel = HEROFUN0;
SetPal();
Tick();
@@ -841,7 +842,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
@@ -905,8 +906,8 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
case '7':
case '8':
case '9':
- if (Sprite)
- Sprite->Step(x - '0');
+ if (_sprite)
+ _sprite->Step(x - '0');
break;
case F10 :
if (Snail->Idle() && ! Hero->Flags.Hide)
@@ -957,7 +958,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) {
if (cav && Snail->Idle() && Hero->TracePtr < 0)
_vm->SwitchCave(cav);
- if (!HorzLine->Flags.Hide) {
+ if (!_horzLine->Flags.Hide) {
if (y >= MAP_TOP && y < MAP_TOP + MAP_HIG) {
int8 x1, z1;
XZ(x, y).Split(x1, z1);
@@ -1079,7 +1080,7 @@ void CGEEngine::TakeName() {
void CGEEngine::SwitchMapping() {
- if (HorzLine->Flags.Hide) {
+ if (_horzLine->Flags.Hide) {
int i;
for (i = 0; i < MAP_ZCNT; i++) {
int j;
@@ -1089,29 +1090,29 @@ void CGEEngine::SwitchMapping() {
}
}
} else {
- SPRITE *s;
+ Sprite *s;
for (s = Vga->ShowQ->First(); s; s = s->Next)
if (s->W == MAP_XGRID && s->H == MAP_ZGRID)
SNPOST_(SNKILL, -1, 0, s);
}
- HorzLine->Flags.Hide = ! HorzLine->Flags.Hide;
+ _horzLine->Flags.Hide = !_horzLine->Flags.Hide;
}
static void KillSprite(void) {
- Sprite->Flags.Kill = true;
- Sprite->Flags.BDel = true;
- SNPOST_(SNKILL, -1, 0, Sprite);
- Sprite = NULL;
+ _sprite->Flags.Kill = true;
+ _sprite->Flags.BDel = true;
+ SNPOST_(SNKILL, -1, 0, _sprite);
+ _sprite = NULL;
}
static void PushSprite(void) {
- SPRITE *spr = Sprite->Prev;
+ Sprite *spr = _sprite->Prev;
if (spr) {
- Vga->ShowQ->Insert(Vga->ShowQ->Remove(Sprite), spr);
- while (Sprite->Z > Sprite->Next->Z)
- --Sprite->Z;
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(_sprite), spr);
+ while (_sprite->Z > _sprite->Next->Z)
+ --_sprite->Z;
} else
SNPOST_(SNSOUND, -1, 2, NULL);
}
@@ -1119,24 +1120,24 @@ static void PushSprite(void) {
static void PullSprite(void) {
bool ok = false;
- SPRITE *spr = Sprite->Next;
+ Sprite *spr = _sprite->Next;
if (spr) {
spr = spr->Next;
if (spr)
ok = (!spr->Flags.Slav);
}
if (ok) {
- Vga->ShowQ->Insert(Vga->ShowQ->Remove(Sprite), spr);
- if (Sprite->Prev)
- while (Sprite->Z < Sprite->Prev->Z)
- ++Sprite->Z;
+ Vga->ShowQ->Insert(Vga->ShowQ->Remove(_sprite), spr);
+ if (_sprite->Prev)
+ while (_sprite->Z < _sprite->Prev->Z)
+ ++_sprite->Z;
} else
SNPOST_(SNSOUND, -1, 2, NULL);
}
static void NextStep(void) {
- SNPOST_(SNSTEP, 0, 0, Sprite);
+ SNPOST_(SNSTEP, 0, 0, _sprite);
}
@@ -1199,18 +1200,18 @@ static void SayDebug(void) {
// sprite queue size
uint16 n = 0;
- SPRITE *spr;
+ Sprite *spr;
for (spr = Vga->ShowQ->First(); spr; spr = spr->Next) {
++ n;
- if (spr == Sprite) {
+ if (spr == _sprite) {
*XSPR = ' ';
dwtom(n, SP_N, 10, 2);
- dwtom(Sprite->X, SP_X, 10, 3);
- dwtom(Sprite->Y, SP_Y, 10, 3);
- dwtom(Sprite->Z, SP_Z, 10, 3);
- dwtom(Sprite->W, SP_W, 10, 3);
- dwtom(Sprite->H, SP_H, 10, 3);
- dwtom(*(uint16 *)(&Sprite->Flags), SP_F, 16, 2);
+ dwtom(_sprite->X, SP_X, 10, 3);
+ dwtom(_sprite->Y, SP_Y, 10, 3);
+ dwtom(_sprite->Z, SP_Z, 10, 3);
+ dwtom(_sprite->W, SP_W, 10, 3);
+ dwtom(_sprite->H, SP_H, 10, 3);
+ dwtom(*(uint16 *)(&_sprite->Flags), SP_F, 16, 2);
}
}
dwtom(n, SP_S, 10, 2);
@@ -1249,14 +1250,14 @@ void CGEEngine::OptionTouch(int opt, uint16 mask) {
#pragma argsused
-void SPRITE::Touch(uint16 mask, int x, int y) {
+void Sprite::Touch(uint16 mask, int x, int y) {
Sys->FunTouch();
if ((mask & ATTN) == 0) {
InfoLine->Update(Name());
if (mask & (R_DN | L_DN))
- Sprite = this;
- if (Ref / 10 == 12) {
- _vm->OptionTouch(Ref % 10, mask);
+ _sprite = this;
+ if (_ref / 10 == 12) {
+ _vm->OptionTouch(_ref % 10, mask);
return;
}
if (Flags.Syst)
@@ -1266,7 +1267,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)) {
@@ -1309,7 +1310,7 @@ void SPRITE::Touch(uint16 mask, int x, int y) {
if (Flags.Kept) {
int n;
for (n = 0; n < POCKET_NX; n++) {
- if (Pocket[n] == this) {
+ if (_pocket[n] == this) {
SelectPocket(n);
break;
}
@@ -1388,9 +1389,9 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
// make sprite of choosen type
switch (type) {
case 1 : { // AUTO
- Sprite = new SPRITE(this, NULL);
- if (Sprite) {
- Sprite->Goto(col, row);
+ _sprite = new Sprite(this, NULL);
+ if (_sprite) {
+ _sprite->Goto(col, row);
//Sprite->Time = 1;//-----------$$$$$$$$$$$$$$$$
}
break;
@@ -1403,7 +1404,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
error("2nd HERO [%s]", fname);
Hero = w;
}
- Sprite = w;
+ _sprite = w;
break;
}
/*
@@ -1418,7 +1419,7 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
n->Cx = 3;
n->Goto(col, row);
}
- Sprite = n;
+ _sprite = n;
break;
*/
case 4 : { // LISSAJOUS
@@ -1436,37 +1437,37 @@ void CGEEngine::LoadSprite(const char *fname, int ref, int cav, int col = 0, int
*(long *) &l->Dx = 0; // movex * cnt
l->Goto(col, row);
}
- Sprite = l;
+ _sprite = l;
*/
break;
}
case 5 : { // FLY
FLY *f = new FLY(this, NULL);
- Sprite = f;
+ _sprite = f;
//////Sprite->Time = 1;//-----------$$$$$$$$$$$$$$
break;
}
default: { // DEAD
- Sprite = new SPRITE(this, NULL);
- if (Sprite)
- Sprite->Goto(col, row);
+ _sprite = new Sprite(this, NULL);
+ if (_sprite)
+ _sprite->Goto(col, row);
break;
}
}
- if (Sprite) {
- Sprite->Ref = ref;
- Sprite->Cave = cav;
- Sprite->Z = pos;
- Sprite->Flags.East = east;
- Sprite->Flags.Port = port;
- Sprite->Flags.Tran = tran;
- Sprite->Flags.Kill = true;
- Sprite->Flags.BDel = true;
- //fnsplit(fname, NULL, NULL, Sprite->File, NULL);
+ if (_sprite) {
+ _sprite->_ref = ref;
+ _sprite->_cave = cav;
+ _sprite->Z = pos;
+ _sprite->Flags.East = east;
+ _sprite->Flags.Port = port;
+ _sprite->Flags.Tran = tran;
+ _sprite->Flags.Kill = true;
+ _sprite->Flags.BDel = true;
+ //fnsplit(fname, NULL, NULL, _sprite->File, NULL);
warning("LoadSprite: use of fnsplit");
- Sprite->ShpCnt = shpcnt;
- Vga->SpareQ->Append(Sprite);
+ _sprite->ShpCnt = shpcnt;
+ Vga->SpareQ->Append(_sprite);
}
}
@@ -1521,10 +1522,10 @@ void CGEEngine::LoadScript(const char *fname) {
ok = true; // no break: OK
- Sprite = NULL;
+ _sprite = NULL;
LoadSprite(SpN, SpI, SpA, SpX, SpY, SpZ);
- if (Sprite && BkG)
- Sprite->Flags.Back = true;
+ if (_sprite && BkG)
+ _sprite->Flags.Back = true;
}
if (! ok)
error("%s [%s]", NumStr("Bad INI line ######", lcnt), fname);
@@ -1579,11 +1580,11 @@ void CGEEngine::RunGame() {
Text->Preload(100, 1000);
LoadHeroXY();
- CavLight->Flags.Tran = true;
- Vga->ShowQ->Append(CavLight);
- CavLight->Flags.Hide = true;
+ _cavLight->Flags.Tran = true;
+ Vga->ShowQ->Append(_cavLight);
+ _cavLight->Flags.Hide = true;
- static SEQ PocSeq[] = { { 0, 0, 0, 0, 20 },
+ static Seq pocSeq[] = { { 0, 0, 0, 0, 20 },
{ 1, 2, 0, 0, 4 },
{ 2, 3, 0, 0, 4 },
{ 3, 4, 0, 0, 16 },
@@ -1591,11 +1592,11 @@ void CGEEngine::RunGame() {
{ 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);
@@ -1604,11 +1605,11 @@ void CGEEngine::RunGame() {
LoadUser();
// ~~~~~~~~~~~
- 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 ((_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)
KillMIDI();
@@ -1616,12 +1617,12 @@ void CGEEngine::RunGame() {
uint8 *ptr = (uint8 *) &*Mini;
if (ptr != NULL) {
LoadSprite("MINI", -1, 0, MINI_X, MINI_Y);
- ExpandSprite(MiniCave = Sprite); // NULL is ok
- if (MiniCave) {
- MiniCave->Flags.Hide = true;
- MiniCave->MoveShapes(ptr);
- MiniShp[0] = new BITMAP(*MiniCave->Shp());
- MiniShpList = MiniCave->SetShapeList(MiniShp);
+ ExpandSprite(_miniCave = _sprite); // NULL is ok
+ if (_miniCave) {
+ _miniCave->Flags.Hide = true;
+ _miniCave->MoveShapes(ptr);
+ MiniShp[0] = new BITMAP(*_miniCave->Shp());
+ MiniShpList = _miniCave->SetShapeList(MiniShp);
PostMiniStep(-1);
}
}
@@ -1632,11 +1633,11 @@ void CGEEngine::RunGame() {
Hero->Goto(HeroXY[Now - 1].X, HeroXY[Now - 1].Y);
if (INI_FILE::Exist("00SHADOW.SPR")) {
LoadSprite("00SHADOW", -1, 0, Hero->X + 14, Hero->Y + 51);
- if ((Shadow = Sprite) != NULL) {
- Shadow->Ref = 2;
- Shadow->Flags.Tran = true;
+ if ((_shadow = _sprite) != NULL) {
+ _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);
}
}
}
@@ -1649,9 +1650,9 @@ void CGEEngine::RunGame() {
DebugLine->Z = 126;
Vga->ShowQ->Insert(DebugLine);
- HorzLine->Y = MAP_TOP - (MAP_TOP > 0);
- HorzLine->Z = 126;
- Vga->ShowQ->Insert(HorzLine);
+ _horzLine->Y = MAP_TOP - (MAP_TOP > 0);
+ _horzLine->Z = 126;
+ Vga->ShowQ->Insert(_horzLine);
Mouse->Busy = Vga->SpareQ->Locate(BUSY_REF);
if (Mouse->Busy)
@@ -1659,8 +1660,8 @@ void CGEEngine::RunGame() {
Startup = 0;
- SNPOST(SNLEVEL, -1, OldLev, &CavLight);
- CavLight->Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
+ SNPOST(SNLEVEL, -1, OldLev, &_cavLight);
+ _cavLight->Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
CAVE_Y + ((Now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY);
CaveUp();
@@ -1674,14 +1675,14 @@ void CGEEngine::RunGame() {
}
KEYBOARD::SetClient(NULL);
- Heart->Enable = false;
+ _heart->_enable = false;
SNPOST(SNCLEAR, -1, 0, NULL);
SNPOST_(SNCLEAR, -1, 0, NULL);
Mouse->Off();
Vga->ShowQ->Clear();
Vga->SpareQ->Clear();
Hero = NULL;
- Shadow = NULL;
+ _shadow = NULL;
}
@@ -1692,13 +1693,13 @@ void CGEEngine::Movie(const char *ext) {
ExpandSprite(Vga->SpareQ->Locate(999));
FeedSnail(Vga->ShowQ->Locate(999), TAKE);
Vga->ShowQ->Append(Mouse);
- Heart->Enable = true;
+ _heart->_enable = true;
KEYBOARD::SetClient(Sys);
while (!Snail->Idle())
MainLoop();
KEYBOARD::SetClient(NULL);
- Heart->Enable = false;
+ _heart->_enable = false;
SNPOST(SNCLEAR, -1, 0, NULL);
SNPOST_(SNCLEAR, -1, 0, NULL);
Vga->ShowQ->Clear();
@@ -1713,7 +1714,7 @@ bool CGEEngine::ShowTitle(const char *name) {
BITMAP::Pal = NULL;
bool usr_ok = false;
- SPRITE D(this, LB);
+ Sprite D(this, LB);
D.Flags.Kill = true;
D.Flags.BDel = true;
D.Center();
@@ -1734,12 +1735,12 @@ bool CGEEngine::ShowTitle(const char *name) {
Vga->CopyPage(1, 2);
Vga->CopyPage(0, 1);
Vga->ShowQ->Append(Mouse);
- Heart->Enable = true;
+ _heart->_enable = true;
Mouse->On();
for (SelectSound(); !Snail->Idle() || VMENU::Addr;)
MainLoop();
Mouse->Off();
- Heart->Enable = false;
+ _heart->_enable = false;
Vga->ShowQ->Clear();
Vga->CopyPage(0, 2);
STARTUP::SoundOk = 2;
@@ -1771,10 +1772,10 @@ bool CGEEngine::ShowTitle(const char *name) {
Vga->CopyPage(0, 1);
Vga->ShowQ->Append(Mouse);
//Mouse.On();
- Heart->Enable = true;
+ _heart->_enable = true;
for (TakeName(); GET_TEXT::Ptr;)
MainLoop();
- Heart->Enable = false;
+ _heart->_enable = false;
if (KEYBOARD::Last() == Enter && *UsrFnam)
usr_ok = true;
if (usr_ok)
@@ -1831,11 +1832,12 @@ void CGEEngine::cge_main(void) {
if (!Mouse->Exist)
error("%s", Text->getText(NO_MOUSE_TEXT));
+
if (!SVG0FILE::Exist(SVG0NAME))
STARTUP::Mode = 2;
DebugLine->Flags.Hide = true;
- HorzLine->Flags.Hide = true;
+ _horzLine->Flags.Hide = true;
//srand((uint16) Timer());
Sys = new SYSTEM(this);
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index 146c3cb6c9..8b2f87aad9 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -113,7 +113,7 @@ namespace CGE {
#define FINIS (Flag[3])
-class SYSTEM : public SPRITE {
+class SYSTEM : public Sprite {
int lum;
public:
int FunDel;
@@ -139,7 +139,7 @@ public:
};
-class WALK : public SPRITE {
+class WALK : public Sprite {
public:
CLUSTER Here;
int TracePtr;
@@ -148,12 +148,12 @@ public:
WALK(CGEEngine *vm, BMP_PTR *shpl);
void Tick(void);
void FindWay(CLUSTER c);
- void FindWay(SPRITE *spr);
- int Distance(SPRITE *spr);
+ void FindWay(Sprite *spr);
+ int Distance(Sprite *spr);
void Turn(DIR d);
void Park(void);
- bool Lower(SPRITE *spr);
- void Reach(SPRITE *spr, int mode = -1);
+ bool Lower(Sprite *spr);
+ void Reach(Sprite *spr, int mode = -1);
private:
CGEEngine *_vm;
@@ -163,23 +163,23 @@ private:
CLUSTER XZ(int x, int y);
CLUSTER XZ(COUPLE xy);
-void ExpandSprite(SPRITE *spr);
-void ContractSprite(SPRITE *spr);
+void ExpandSprite(Sprite *spr);
+void ContractSprite(Sprite *spr);
extern WALK *Hero;
extern VGA *Vga;
-extern HEART *Heart;
+extern Heart *_heart;
extern SYSTEM *Sys;
extern int OffUseCount;
-extern SPRITE *PocLight;
+extern Sprite *_pocLight;
extern MOUSE *Mouse;
-extern SPRITE *Pocket[];
-extern SPRITE *Sprite;
-extern SPRITE *MiniCave;
-extern SPRITE *Shadow;
-extern SPRITE *HorzLine;
+extern Sprite *_pocket[];
+extern Sprite *_sprite;
+extern Sprite *_miniCave;
+extern Sprite *_shadow;
+extern Sprite *_horzLine;
extern INFO_LINE *InfoLine;
-extern SPRITE *CavLight;
+extern Sprite *_cavLight;
extern INFO_LINE *DebugLine;
extern BMP_PTR MB[2];
extern BMP_PTR MB[2];
diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp
index 21e8ceddeb..a5b82f1e8d 100644
--- a/engines/cge/game.cpp
+++ b/engines/cge/game.cpp
@@ -68,7 +68,7 @@ int FLY::L = 20,
FLY::FLY(CGEEngine *vm, BITMAP **shpl)
- : SPRITE(vm, shpl), Tx(0), Ty(0), _vm(vm) {
+ : Sprite(vm, shpl), Tx(0), Ty(0), _vm(vm) {
Step(new_random(2));
Goto(L + new_random(R - L - W), T + new_random(B - T - H));
}
diff --git a/engines/cge/game.h b/engines/cge/game.h
index 7892b1c93f..fb4dad6fae 100644
--- a/engines/cge/game.h
+++ b/engines/cge/game.h
@@ -44,7 +44,7 @@ int Sinus(long x);
uint8 *Glass(DAC *pal, uint8 r, uint8 g, uint8 b);
uint8 *Mark(DAC *pal);
-class FLY : public SPRITE {
+class FLY : public Sprite {
static int L, T, R, B;
public:
int Tx, Ty;
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 1bf4bcd982..428498923e 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -136,8 +136,6 @@ char *ForceExt(char *buf, const char *nam, const char *ext) {
return buf;
}
-
-#define BUF ((uint8 *) buf)
static unsigned Seed = 1;
unsigned FastRand(void) {
@@ -237,7 +235,10 @@ uint16 IOHAND::Read(void *buf, uint16 len) {
return 0;
uint16 bytesRead = _file->read(buf, len);
- if (Crypt) Seed = Crypt(buf, len, Seed);
+ if (!bytesRead)
+ error("Read %s - %d bytes", _file->getName(), len);
+ if (Crypt)
+ Seed = Crypt(buf, len, Seed);
return bytesRead;
}
diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp
index d444b75ab4..f891b9c092 100644
--- a/engines/cge/gettext.cpp
+++ b/engines/cge/gettext.cpp
@@ -116,7 +116,7 @@ void GET_TEXT::Touch(uint16 mask, int x, int y) {
break;
}
} else
- SPRITE::Touch(mask, x, y);
+ Sprite::Touch(mask, x, y);
}
} // End of namespace CGE
diff --git a/engines/cge/gettext.h b/engines/cge/gettext.h
index c868232677..33210758af 100644
--- a/engines/cge/gettext.h
+++ b/engines/cge/gettext.h
@@ -41,7 +41,7 @@ class GET_TEXT : public TALK {
char Buff[GTMAX + 2], * Text;
uint16 Size, Len;
uint16 Cntr;
- SPRITE *OldKeybClient;
+ Sprite *OldKeybClient;
void (*Click)();
public:
static GET_TEXT *Ptr;
diff --git a/engines/cge/keybd.cpp b/engines/cge/keybd.cpp
index c912555949..4aee394e07 100644
--- a/engines/cge/keybd.cpp
+++ b/engines/cge/keybd.cpp
@@ -30,8 +30,8 @@
namespace CGE {
-SPRITE *KEYBOARD::Client = NULL;
-uint8 KEYBOARD::Key[0x60] = { 0 };
+Sprite *KEYBOARD::Client = NULL;
+uint8 KEYBOARD::Key[0x60] = { 0 };
uint16 KEYBOARD::Current = 0;
uint16 KEYBOARD::Code[0x60] = {
0, Esc, '1', '2', '3',
@@ -78,7 +78,7 @@ KEYBOARD::~KEYBOARD(void) {
}
-SPRITE *KEYBOARD::SetClient(SPRITE *spr) {
+Sprite *KEYBOARD::SetClient(Sprite *spr) {
Swap(Client, spr);
return spr;
}
diff --git a/engines/cge/keybd.h b/engines/cge/keybd.h
index f2fa595be2..2cdbd558d8 100644
--- a/engines/cge/keybd.h
+++ b/engines/cge/keybd.h
@@ -46,14 +46,14 @@ public:
static void NewKeyboard(...);
static uint16 Code[0x60];
static uint16 Current;
- static SPRITE *Client;
+ static Sprite *Client;
static uint8 Key[0x60];
static uint16 Last(void) {
uint16 cur = Current;
Current = 0;
return cur;
}
- static SPRITE *SetClient(SPRITE *spr);
+ static Sprite *SetClient(Sprite *spr);
KEYBOARD(void);
~KEYBOARD(void);
};
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp
index ecdd2b7533..c1f688babd 100644
--- a/engines/cge/mixer.cpp
+++ b/engines/cge/mixer.cpp
@@ -40,7 +40,7 @@ extern MOUSE *Mouse;
bool MIXER::Appear = false;
-MIXER::MIXER(CGEEngine *vm, int x, int y) : SPRITE(vm, NULL), Fall(MIX_FALL), _vm(vm) {
+MIXER::MIXER(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), Fall(MIX_FALL), _vm(vm) {
Appear = true;
mb[0] = new BITMAP("VOLUME");
mb[1] = NULL;
@@ -65,7 +65,7 @@ MIXER::MIXER(CGEEngine *vm, int x, int y) : SPRITE(vm, NULL), Fall(MIX_FALL), _v
lb[i] = NULL;
for (i = 0; i < ArrayCount(Led); i++) {
- register SPRITE *spr = new SPRITE(_vm, lb);
+ register Sprite *spr = new Sprite(_vm, lb);
spr->SetSeq(ls);
spr->Goto(x + 2 + 12 * i, y + 8);
spr->Flags.Tran = true;
@@ -98,7 +98,7 @@ MIXER::~MIXER(void) {
#pragma argsused
void MIXER::Touch(uint16 mask, int x, int y) {
- SPRITE::Touch(mask, x, y);
+ Sprite::Touch(mask, x, y);
if (mask & L_UP) {
uint8 *vol = (&SNDDrvInfo.VOL2.D) + (x < W / 2);
if (y < MIX_BHIG) {
diff --git a/engines/cge/mixer.h b/engines/cge/mixer.h
index d589aceaea..d42d25ca24 100644
--- a/engines/cge/mixer.h
+++ b/engines/cge/mixer.h
@@ -39,11 +39,11 @@ namespace CGE {
#define MIX_BHIG 6 // mixer button high
#define MIX_NAME 105 // sprite name
-class MIXER : public SPRITE {
+class MIXER : public Sprite {
BMP_PTR mb[2];
BMP_PTR lb[MIX_MAX + 1];
- SEQ ls[MIX_MAX];
- SPRITE *Led[2];
+ Seq ls[MIX_MAX];
+ Sprite *Led[2];
int Fall;
void Update(void);
public:
diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp
index 10953291f2..cb94e926c5 100644
--- a/engines/cge/mouse.cpp
+++ b/engines/cge/mouse.cpp
@@ -39,8 +39,8 @@ MOUSE_FUN *MOUSE::OldMouseFun = NULL;
uint16 MOUSE::OldMouseMask = 0;
-MOUSE::MOUSE(CGEEngine *vm, BITMAP **shpl) : SPRITE(vm, shpl), Busy(NULL), Hold(NULL), hx(0), _vm(vm) {
- static SEQ ms[] = {
+MOUSE::MOUSE(CGEEngine *vm, BITMAP **shpl) : Sprite(vm, shpl), Busy(NULL), Hold(NULL), hx(0), _vm(vm) {
+ static Seq ms[] = {
{ 0, 0, 0, 0, 1 },
{ 1, 1, 0, 0, 1 }
};
@@ -58,6 +58,7 @@ MOUSE::MOUSE(CGEEngine *vm, BITMAP **shpl) : SPRITE(vm, shpl), Busy(NULL), Hold(
Z = 127;
Step(1);
*/
+ Exist = true;
warning("STUB: MOUSE::MOUSE");
}
@@ -131,7 +132,7 @@ void MOUSE::Off(void) {
}
-void MOUSE::ClrEvt(SPRITE *spr) {
+void MOUSE::ClrEvt(Sprite *spr) {
if (spr) {
uint16 e;
for (e = EvtTail; e != EvtHead; e = (e + 1) % EVT_MAX)
diff --git a/engines/cge/mouse.h b/engines/cge/mouse.h
index 61503fadd1..28152b7f29 100644
--- a/engines/cge/mouse.h
+++ b/engines/cge/mouse.h
@@ -48,7 +48,7 @@ extern TALK *Talk;
struct EVENT {
uint16 Msk;
uint16 X, Y;
- SPRITE *Ptr;
+ Sprite *Ptr;
};
extern EVENT Evt[EVT_MAX];
@@ -56,24 +56,24 @@ extern uint16 EvtHead, EvtTail;
typedef void (MOUSE_FUN)(void);
-class MOUSE : public SPRITE {
+class MOUSE : public Sprite {
static MOUSE_FUN *OldMouseFun;
static MOUSE_FUN NewMouseFun;
static uint16 OldMouseMask;
- SPRITE *Hold;
+ Sprite *Hold;
int hx, hy;
//void SetFun (void);
//void ResetFun (void);
public:
bool Exist;
int Buttons;
- SPRITE *Busy;
- //SPRITE * Touched;
+ Sprite *Busy;
+ //Sprite *Touched;
MOUSE(CGEEngine *vm, BITMAP **shpl = MC);
~MOUSE();
void On();
void Off();
- static void ClrEvt(SPRITE *spr = NULL);
+ static void ClrEvt(Sprite *spr = NULL);
void Tick();
private:
CGEEngine *_vm;
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 0137ab4cfa..1cb53d2024 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -56,27 +56,27 @@ bool Game = false;
int Now = 1;
int Lev = -1;
-extern SPRITE *PocLight;
+extern Sprite *_pocLight;
//-------------------------------------------------------------------------
// SPRITE * Pocket[POCKET_NX]={ NULL, NULL, NULL, NULL,
// NULL, NULL, NULL, NULL, };
// int PocPtr = 0;
//-------------------------------------------------------------------------
-extern SPRITE *Pocket[];
+extern Sprite *_pocket[];
extern int PocPtr;
-static void SNGame(SPRITE *spr, int num) {
+static void SNGame(Sprite *spr, int num) {
switch (num) {
case 1 : {
#define STAGES 8
#define DRESSED 3
- static SPRITE *dup[3] = { NULL, NULL, NULL };
+ static Sprite *dup[3] = { NULL, NULL, NULL };
int buref = 0;
int Stage = 0;
for (dup[0] = Vga->ShowQ->First(); dup[0]; dup[0] = dup[0]->Next) {
- buref = dup[0]->Ref;
+ buref = dup[0]->_ref;
if (buref / 1000 == 16 && buref % 100 == 6) {
Stage = (buref / 100) % 10;
break;
@@ -163,7 +163,7 @@ static void SNGame(SPRITE *spr, int num) {
break;
//--------------------------------------------------------------------
case 2 : {
- static SPRITE *k = NULL, * k1, * k2, * k3;
+ static Sprite *k = NULL, * k1, * k2, * k3;
static int count = 0;
if (k == NULL) {
@@ -181,7 +181,7 @@ static void SNGame(SPRITE *spr, int num) {
k2->Step(new_random(6));
k3->Step(new_random(6));
///--------------------
- if (spr->Ref == 1 && KEYBOARD::Key[ALT]) {
+ if (spr->_ref == 1 && KEYBOARD::Key[ALT]) {
k1->Step(5);
k2->Step(5);
k3->Step(5);
@@ -190,7 +190,7 @@ static void SNGame(SPRITE *spr, int num) {
SNPOST(SNSETZ, 20700, 0, NULL);
bool hit = (k1->SeqPtr + k2->SeqPtr + k3->SeqPtr == 15);
if (hit) {
- if (spr->Ref == 1) {
+ if (spr->_ref == 1) {
SNPOST(SNSAY, 1, 20003, NULL); // hura!
SNPOST(SNSEQ, 20011, 2, NULL); // kamera won
SNPOST(SNSEND, 20701, -1, NULL); // k1 won
@@ -223,7 +223,7 @@ static void SNGame(SPRITE *spr, int num) {
}
++ count;
}
- switch (spr->Ref) {
+ switch (spr->_ref) {
case 1 :
SNPOST(SNSAY, 20001, 20011, NULL); // zapro
SNPOST(SNSEQ, 20001, 1, NULL); // rzu
@@ -275,38 +275,38 @@ static void SNGame(SPRITE *spr, int num) {
}
-void ExpandSprite(SPRITE *spr) {
+void ExpandSprite(Sprite *spr) {
if (spr)
Vga->ShowQ->Insert(Vga->SpareQ->Remove(spr));
}
-void ContractSprite(SPRITE *spr) {
+void ContractSprite(Sprite *spr) {
if (spr)
Vga->SpareQ->Append(Vga->ShowQ->Remove(spr));
}
-int FindPocket(SPRITE *spr) {
+int FindPocket(Sprite *spr) {
for (int i = 0; i < POCKET_NX; i++)
- if (Pocket[i] == spr)
+ if (_pocket[i] == spr)
return i;
return -1;
}
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) {
+ 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);
}
@@ -320,7 +320,7 @@ void PocFul(void) {
}
-void Hide1(SPRITE *spr) {
+void Hide1(Sprite *spr) {
SNPOST_(SNGHOST, -1, 0, spr->Ghost());
}
@@ -334,7 +334,7 @@ void SNGhost(BITMAP *bmp) {
}
-void FeedSnail(SPRITE *spr, SNLIST snq) {
+void FeedSnail(Sprite *spr, SNLIST snq) {
if (spr)
if (spr->Active()) {
uint8 ptr = (snq == TAKE) ? spr->TakePtr : spr->NearPtr;
@@ -360,7 +360,7 @@ void FeedSnail(SPRITE *spr, SNLIST snq) {
KillText();
}
if (c->Com == SNNEXT) {
- SPRITE *s = (c->Ref < 0) ? spr : Locate(c->Ref);
+ Sprite *s = (c->Ref < 0) ? spr : Locate(c->Ref);
if (s) {
uint8 *idx = (snq == TAKE) ? &s->TakePtr : &s->NearPtr;
if (*idx != NO_PTR) {
@@ -387,7 +387,7 @@ void FeedSnail(SPRITE *spr, SNLIST snq) {
break;
}
if (c->Com == SNIF) {
- SPRITE *s = (c->Ref < 0) ? spr : Locate(c->Ref);
+ Sprite *s = (c->Ref < 0) ? spr : Locate(c->Ref);
if (s) { // sprite extsts
if (! s->SeqTest(-1))
c = comtab + c->Val; // not parked
@@ -475,52 +475,52 @@ void SNAIL::InsCom(SNCOM com, int ref, int val, void *ptr) {
}
-static void SNNNext(SPRITE *sprel, int p) {
+static void SNNNext(Sprite *sprel, int p) {
if (sprel)
if (sprel->NearPtr != NO_PTR)
sprel->NearPtr = p;
}
-static void SNTNext(SPRITE *sprel, int p) {
+static void SNTNext(Sprite *sprel, int p) {
if (sprel)
if (sprel->TakePtr != NO_PTR)
sprel->TakePtr = p;
}
-static void SNRNNext(SPRITE *sprel, int p) {
+static void SNRNNext(Sprite *sprel, int p) {
if (sprel)
if (sprel->NearPtr != NO_PTR)
sprel->NearPtr += p;
}
-static void SNRTNext(SPRITE *sprel, int p) {
+static void SNRTNext(Sprite *sprel, int p) {
if (sprel)
if (sprel->TakePtr != NO_PTR)
sprel->TakePtr += p;
}
-static void SNZTrim(SPRITE *spr) {
+static void SNZTrim(Sprite *spr) {
if (spr)
if (spr->Active()) {
- bool en = Heart->Enable;
- SPRITE *s;
- Heart->Enable = false;
+ bool en = _heart->_enable;
+ Sprite *s;
+ _heart->_enable = false;
s = (spr->Flags.Shad) ? spr->Prev : NULL;
Vga->ShowQ->Insert(Vga->ShowQ->Remove(spr));
if (s) {
s->Z = spr->Z;
Vga->ShowQ->Insert(Vga->ShowQ->Remove(s), spr);
}
- Heart->Enable = en;
+ _heart->_enable = en;
}
}
-static void SNHide(SPRITE *spr, int val) {
+static void SNHide(Sprite *spr, int val) {
if (spr) {
spr->Flags.Hide = (val >= 0) ? (val != 0) : (! spr->Flags.Hide);
if (spr->Flags.Shad)
@@ -529,19 +529,19 @@ static void SNHide(SPRITE *spr, int val) {
}
-static void SNRmNear(SPRITE *spr) {
+static void SNRmNear(Sprite *spr) {
if (spr)
spr->NearPtr = NO_PTR;
}
-static void SNRmTake(SPRITE *spr) {
+static void SNRmTake(Sprite *spr) {
if (spr)
spr->TakePtr = NO_PTR;
}
-void SNSeq(SPRITE *spr, int val) {
+void SNSeq(Sprite *spr, int val) {
if (spr) {
if (spr == Hero && val == 0)
Hero->Park();
@@ -551,30 +551,30 @@ void SNSeq(SPRITE *spr, int val) {
}
-void SNRSeq(SPRITE *spr, int val) {
+void SNRSeq(Sprite *spr, int val) {
if (spr)
SNSeq(spr, spr->SeqPtr + val);
}
-void SNSend(SPRITE *spr, int val) {
+void SNSend(Sprite *spr, int val) {
if (spr) {
- int was = spr->Cave;
+ int was = spr->_cave;
bool was1 = (was == 0 || was == Now);
bool val1 = (val == 0 || val == Now);
- spr->Cave = val;
+ spr->_cave = val;
if (val1 != was1) {
if (was1) {
if (spr->Flags.Kept) {
int n = FindPocket(spr);
if (n >= 0)
- Pocket[n] = NULL;
+ _pocket[n] = NULL;
}
Hide1(spr);
ContractSprite(spr);
spr->Flags.Slav = false;
} else {
- if (spr->Ref % 1000 == 0)
+ if (spr->_ref % 1000 == 0)
BITMAP::Pal = VGA::SysPal;
if (spr->Flags.Back)
spr->BackShow(true);
@@ -587,22 +587,22 @@ void SNSend(SPRITE *spr, int val) {
}
-void SNSwap(SPRITE *spr, int xref) {
- SPRITE *xspr = Locate(xref);
+void SNSwap(Sprite *spr, int xref) {
+ Sprite *xspr = Locate(xref);
if (spr && xspr) {
- int was = spr->Cave;
- int xwas = xspr->Cave;
+ int was = spr->_cave;
+ int xwas = xspr->_cave;
bool was1 = (was == 0 || was == Now);
bool xwas1 = (xwas == 0 || xwas == Now);
- Swap(spr->Cave, xspr->Cave);
+ Swap(spr->_cave, xspr->_cave);
Swap(spr->X, xspr->X);
Swap(spr->Y, xspr->Y);
Swap(spr->Z, xspr->Z);
if (spr->Flags.Kept) {
int n = FindPocket(spr);
if (n >= 0)
- Pocket[n] = xspr;
+ _pocket[n] = xspr;
xspr->Flags.Kept = true;
xspr->Flags.Port = false;
}
@@ -622,12 +622,12 @@ void SNSwap(SPRITE *spr, int xref) {
}
-void SNCover(SPRITE *spr, int xref) {
- SPRITE *xspr = Locate(xref);
+void SNCover(Sprite *spr, int xref) {
+ Sprite *xspr = Locate(xref);
if (spr && xspr) {
spr->Flags.Hide = true;
xspr->Z = spr->Z;
- xspr->Cave = spr->Cave;
+ xspr->_cave = spr->_cave;
xspr->Goto(spr->X, spr->Y);
ExpandSprite(xspr);
if ((xspr->Flags.Shad = spr->Flags.Shad) == 1) {
@@ -639,10 +639,10 @@ void SNCover(SPRITE *spr, int xref) {
}
-void SNUncover(SPRITE *spr, SPRITE *xspr) {
+void SNUncover(Sprite *spr, Sprite *xspr) {
if (spr && xspr) {
spr->Flags.Hide = false;
- spr->Cave = xspr->Cave;
+ 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);
@@ -666,25 +666,25 @@ void SNSetY0(int cav, int y0) {
}
-void SNSetXY(SPRITE *spr, uint16 xy) {
+void SNSetXY(Sprite *spr, uint16 xy) {
if (spr)
spr->Goto(xy % SCR_WID, xy / SCR_WID);
}
-void SNRelX(SPRITE *spr, int x) {
+void SNRelX(Sprite *spr, int x) {
if (spr && Hero)
spr->Goto(Hero->X + x, spr->Y);
}
-void SNRelY(SPRITE *spr, int y) {
+void SNRelY(Sprite *spr, int y) {
if (spr && Hero)
spr->Goto(spr->X, Hero->Y + y);
}
-void SNRelZ(SPRITE *spr, int z) {
+void SNRelZ(Sprite *spr, int z) {
if (spr && Hero) {
spr->Z = Hero->Z + z;
SNZTrim(spr);
@@ -692,19 +692,19 @@ void SNRelZ(SPRITE *spr, int z) {
}
-void SNSetX(SPRITE *spr, int x) {
+void SNSetX(Sprite *spr, int x) {
if (spr)
spr->Goto(x, spr->Y);
}
-void SNSetY(SPRITE *spr, int y) {
+void SNSetY(Sprite *spr, int y) {
if (spr)
spr->Goto(spr->X, y);
}
-void SNSetZ(SPRITE *spr, int z) {
+void SNSetZ(Sprite *spr, int z) {
if (spr) {
spr->Z = z;
//SNPOST_(SNZTRIM, -1, 0, spr);
@@ -713,11 +713,11 @@ void SNSetZ(SPRITE *spr, int z) {
}
-void SNSlave(SPRITE *spr, int ref) {
- SPRITE *slv = Locate(ref);
+void SNSlave(Sprite *spr, int ref) {
+ Sprite *slv = Locate(ref);
if (spr && slv) {
if (spr->Active()) {
- SNSend(slv, spr->Cave);
+ SNSend(slv, spr->_cave);
slv->Flags.Slav = true;
slv->Z = spr->Z;
Vga->ShowQ->Insert(Vga->ShowQ->Remove(slv), spr->Next);
@@ -726,33 +726,33 @@ void SNSlave(SPRITE *spr, int ref) {
}
-void SNTrans(SPRITE *spr, int trans) {
+void SNTrans(Sprite *spr, int trans) {
if (spr)
spr->Flags.Tran = (trans < 0) ? !spr->Flags.Tran : (trans != 0);
}
-void SNPort(SPRITE *spr, int port) {
+void SNPort(Sprite *spr, int port) {
if (spr)
spr->Flags.Port = (port < 0) ? !spr->Flags.Port : (port != 0);
}
-void SNKill(SPRITE *spr) {
+void SNKill(Sprite *spr) {
if (spr) {
if (spr->Flags.Kept) {
int n = FindPocket(spr);
if (n >= 0)
- Pocket[n] = NULL;
+ _pocket[n] = NULL;
}
- SPRITE *nx = spr->Next;
+ Sprite *nx = spr->Next;
Hide1(spr);
Vga->ShowQ->Remove(spr);
MOUSE::ClrEvt(spr);
if (spr->Flags.Kill)
delete spr;
else {
- spr->Cave = -1;
+ spr->_cave = -1;
Vga->SpareQ->Append(spr);
}
if (nx)
@@ -762,7 +762,7 @@ void SNKill(SPRITE *spr) {
}
-static void SNSound(SPRITE *spr, int wav, int cnt) {
+static void SNSound(Sprite *spr, int wav, int cnt) {
if (SNDDrvInfo.DDEV) {
if (wav == -1)
Sound.Stop();
@@ -772,12 +772,12 @@ static void SNSound(SPRITE *spr, int wav, int cnt) {
}
-void SNKeep(SPRITE *spr, int stp) {
+void SNKeep(Sprite *spr, int stp) {
SelectPocket(-1);
- if (spr && ! spr->Flags.Kept && Pocket[PocPtr] == NULL) {
+ if (spr && ! spr->Flags.Kept && _pocket[PocPtr] == NULL) {
SNSound(spr, 3, 1);
- Pocket[PocPtr] = spr;
- spr->Cave = 0;
+ _pocket[PocPtr] = spr;
+ spr->_cave = 0;
spr->Flags.Kept = true;
spr->Goto(POCKET_X + POCKET_DX * PocPtr + POCKET_DX / 2 - spr->W / 2,
POCKET_Y + POCKET_DY / 2 - spr->H / 2);
@@ -788,12 +788,12 @@ void SNKeep(SPRITE *spr, int stp) {
}
-void SNGive(SPRITE *spr, int stp) {
+void SNGive(Sprite *spr, int stp) {
if (spr) {
int p = FindPocket(spr);
if (p >= 0) {
- Pocket[p] = NULL;
- spr->Cave = Now;
+ _pocket[p] = NULL;
+ spr->_cave = Now;
spr->Flags.Kept = false;
if (stp >= 0)
spr->Step(stp);
@@ -803,7 +803,7 @@ void SNGive(SPRITE *spr, int stp) {
}
-static void SNBackPt(SPRITE *spr, int stp) {
+static void SNBackPt(Sprite *spr, int stp) {
if (spr) {
if (stp >= 0)
spr->Step(stp);
@@ -812,19 +812,19 @@ static void SNBackPt(SPRITE *spr, int stp) {
}
-static void SNLevel(SPRITE *spr, int lev) {
+static void SNLevel(Sprite *spr, int lev) {
#ifdef DEMO
static int maxcav[] = { CAVE_MAX };
#else
static int maxcav[] = { 1, 8, 16, 23, 24 };
#endif
while (Lev < lev) {
- SPRITE *spr;
+ Sprite *spr;
++Lev;
spr = Vga->SpareQ->Locate(100 + Lev);
if (spr) {
spr->BackShow(true);
- spr->Cave = 0;
+ spr->_cave = 0;
}
}
MaxCave = maxcav[Lev];
@@ -838,9 +838,9 @@ static void SNFlag(int fn, bool v) {
}
-static void SNSetRef(SPRITE *spr, int nr) {
+static void SNSetRef(Sprite *spr, int nr) {
if (spr)
- spr->Ref = nr;
+ spr->_ref = nr;
}
@@ -880,7 +880,7 @@ static void SNBarrier(int cav, int bar, bool horz) {
}
-static void SNWalk(SPRITE *spr, int x, int y) {
+static void SNWalk(Sprite *spr, int x, int y) {
if (Hero) {
if (spr && y < 0)
Hero->FindWay(spr);
@@ -890,7 +890,7 @@ static void SNWalk(SPRITE *spr, int x, int y) {
}
-static void SNReach(SPRITE *spr, int mode) {
+static void SNReach(Sprite *spr, int mode) {
if (Hero)
Hero->Reach(spr, mode);
}
@@ -925,12 +925,12 @@ void SNAIL::RunCom(void) {
break;
}
- SPRITE *sprel = ((snc->Ref >= 0) ? Locate(snc->Ref) : ((SPRITE *) snc->Ptr));
+ Sprite *sprel = ((snc->Ref >= 0) ? Locate(snc->Ref) : ((Sprite *) snc->Ptr));
switch (snc->Com) {
case SNLABEL :
break;
case SNPAUSE :
- Heart->SetXTimer(&Pause, snc->Val);
+ _heart->setXTimer(&Pause, snc->Val);
if (Talk)
TextDelay = true;
break;
@@ -938,7 +938,7 @@ void SNAIL::RunCom(void) {
if (sprel) {
if (sprel->SeqTest(snc->Val) &&
(snc->Val >= 0 || sprel != Hero || Hero->TracePtr < 0)) {
- Heart->SetXTimer(&Pause, sprel->Time);
+ _heart->setXTimer(&Pause, sprel->Time);
} else
goto xit;
}
@@ -993,7 +993,7 @@ void SNAIL::RunCom(void) {
SNCover(sprel, snc->Val);
break;
case SNUNCOVER :
- SNUncover(sprel, (snc->Val >= 0) ? Locate(snc->Val) : ((SPRITE *) snc->Ptr));
+ SNUncover(sprel, (snc->Val >= 0) ? Locate(snc->Val) : ((Sprite *) snc->Ptr));
break;
case SNKEEP :
SNKeep(sprel, snc->Val);
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index ae94233464..544359897f 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -98,7 +98,7 @@ void FONT::Save(void) {
TALK::TALK(CGEEngine *vm, const char *tx, TBOX_STYLE mode)
- : SPRITE(vm, NULL), Mode(mode), _vm(vm) {
+ : Sprite(vm, NULL), Mode(mode), _vm(vm) {
TS[0] = TS[1] = NULL;
Flags.Syst = true;
Update(tx);
@@ -106,7 +106,7 @@ TALK::TALK(CGEEngine *vm, const char *tx, TBOX_STYLE mode)
TALK::TALK(CGEEngine *vm)
- : SPRITE(vm, NULL), Mode(PURE), _vm(vm) {
+ : Sprite(vm, NULL), Mode(PURE), _vm(vm) {
TS[0] = TS[1] = NULL;
Flags.Syst = true;
}
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index 184b84e553..2a38af91d1 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -68,7 +68,7 @@ public:
enum TBOX_STYLE { PURE, RECT, ROUND };
-class TALK : public SPRITE {
+class TALK : public Sprite {
protected:
TBOX_STYLE Mode;
BITMAP *TS[2];
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 6d7341af0a..74ff6fac2d 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -180,14 +180,14 @@ char *TEXT::getText(int ref) {
}
-void TEXT::Say(const char *txt, SPRITE *spr) {
+void TEXT::Say(const char *txt, Sprite *spr) {
KillText();
Talk = new TALK(_vm, txt, ROUND);
if (Talk) {
bool east = spr->Flags.East;
int x = (east) ? (spr->X + spr->W - 2) : (spr->X + 2);
int y = spr->Y + 2;
- SPRITE *spike = new SPRITE(_vm, SP);
+ Sprite *spike = new Sprite(_vm, SP);
uint16 sw = spike->W;
if (east) {
@@ -198,7 +198,7 @@ void TEXT::Say(const char *txt, SPRITE *spr) {
east = true;
}
x = (east) ? (spr->X + spr->W - 2) : (spr->X + 2 - sw);
- if (spr->Ref == 1)
+ if (spr->_ref == 1)
x += ((east) ? -10 : 10); // Hero
Talk->Flags.Kill = true;
@@ -206,7 +206,7 @@ void TEXT::Say(const char *txt, SPRITE *spr) {
Talk->SetName(Text->getText(SAY_NAME));
Talk->Goto(x - (Talk->W - sw) / 2 - 3 + 6 * east, y - spike->H - Talk->H + 1);
Talk->Z = 125;
- Talk->Ref = SAY_REF;
+ Talk->_ref = SAY_REF;
spike->Goto(x, Talk->Y + Talk->H - 1);
spike->Z = 126;
@@ -214,7 +214,7 @@ void TEXT::Say(const char *txt, SPRITE *spr) {
spike->Flags.Kill = true;
spike->SetName(Text->getText(SAY_NAME));
spike->Step(east);
- spike->Ref = SAY_REF;
+ spike->_ref = SAY_REF;
Vga->ShowQ->Insert(Talk, Vga->ShowQ->Last());
Vga->ShowQ->Insert(spike, Vga->ShowQ->Last());
@@ -231,13 +231,13 @@ void CGEEngine::Inf(const char *txt) {
Talk->Center();
Talk->Goto(Talk->X, Talk->Y - 20);
Talk->Z = 126;
- Talk->Ref = INF_REF;
+ Talk->_ref = INF_REF;
Vga->ShowQ->Insert(Talk, Vga->ShowQ->Last());
}
}
-void SayTime(SPRITE *spr) {
+void SayTime(Sprite *spr) {
/*
static char t[] = "00:00";
struct time ti;
diff --git a/engines/cge/text.h b/engines/cge/text.h
index 161b2e813a..874a640ad0 100644
--- a/engines/cge/text.h
+++ b/engines/cge/text.h
@@ -66,7 +66,7 @@ public:
void Clear(int from = 1, int upto = 0x7FFF);
void Preload(int from = 1, int upto = 0x7FFF);
char *getText(int ref);
- void Say(const char *txt, SPRITE *spr);
+ void Say(const char *txt, Sprite *spr);
private:
CGEEngine *_vm;
};
@@ -76,8 +76,8 @@ extern TALK *Talk;
extern TEXT *Text;
-void Say(const char *txt, SPRITE *spr);
-void SayTime(SPRITE *spr);
+void Say(const char *txt, Sprite *spr);
+void SayTime(Sprite *spr);
void Inf(const char *txt);
void KillText(void);
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index b59f8e8de5..1d55af7e31 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -51,7 +51,6 @@ static char Report[] = "NearHeap=..... FarHeap=......\n";
#define FREP 24
static VgaRegBlk VideoMode[] = {
-
{ 0x04, VGASEQ, 0x08, 0x04 }, // memory mode
{ 0x03, VGAGRA, 0xFF, 0x00 }, // data rotate = 0
{ 0x05, VGAGRA, 0x03, 0x00 }, // R/W mode = 0
@@ -69,9 +68,9 @@ 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 } };
+bool SpeedTest = false;
+Seq _seq1[] = { { 0, 0, 0, 0, 0 } };
+Seq _seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } };
extern "C" void SNDMIDIPlay(void);
@@ -83,8 +82,7 @@ char *NumStr(char *str, int num) {
}
-static void Video(void)
-{
+static void Video() {
/*
static uint16 SP_S;
@@ -206,7 +204,7 @@ DAC MkDAC(uint8 r, uint8 g, uint8 b) {
}
-RGB MkRGB(uint8 r, uint8 g, uint8 b) {
+Rgb MkRGB(uint8 r, uint8 g, uint8 b) {
static TRGB x;
x.dac.R = r;
x.dac.G = g;
@@ -215,54 +213,60 @@ RGB MkRGB(uint8 r, uint8 g, uint8 b) {
}
-SPRITE *Locate(int ref) {
- SPRITE *spr = Vga->ShowQ->Locate(ref);
+Sprite *Locate(int ref) {
+ Sprite *spr = Vga->ShowQ->Locate(ref);
return (spr) ? spr : Vga->SpareQ->Locate(ref);
}
-HEART::HEART(void)
+Heart::Heart(void)
: ENGINE(TMR_DIV) {
- Enable = false;
- XTimer = NULL;
+ _enable = false;
+ _xTimer = NULL;
}
/*
-extern "C" void TimerProc (void)
-{
- static SPRITE * spr;
- static uint8 run = 0;
-
- // decrement external timer uint16
- if (Heart->XTimer)
- if (*Heart->XTimer)
- *Heart->XTimer--;
- else
- Heart->XTimer = NULL;
-
- if (! run && Heart->Enable) // check overrun flag
- {
- static uint16 oldSP, oldSS;
-
- run++; // disable 2nd call until current lasts
- asm mov ax,ds
- asm mov oldSS,ss
- asm mov oldSP,sp
- asm mov ss,ax
- asm mov sp,0xFF80
-
- // system pseudo-sprite
- if (Sys) if (Sys->Time) if (-- Sys->Time == 0) Sys->Tick();
-
- for (spr = VGA::ShowQ.First(); spr; spr = spr->Next)
- {
- if (spr->Time) if (!spr->Flags.Hide) if (-- spr->Time == 0) spr->Tick();
- }
- asm mov ss,oldSS
- asm mov sp,oldSP
- run--;
- }
+extern "C" void TimerProc() {
+ static SPRITE * spr;
+ static uint8 run = 0;
+
+ // decrement external timer uint16
+ if (_heart->_xTimer) {
+ if (*_heart->_xTimer)
+ *_heart->_xTimer--;
+ else
+ _heart->_xTimer = NULL;
+ }
+
+ if (!run && _heart->_enable) { // check overrun flag
+ static uint16 oldSP, oldSS;
+ run++; // disable 2nd call until current lasts
+ asm mov ax,ds
+ asm mov oldSS,ss
+ asm mov oldSP,sp
+ asm mov ss,ax
+ asm mov sp,0xFF80
+
+ // system pseudo-sprite
+ if (Sys) {
+ if (Sys->Time) {
+ if (--Sys->Time == 0)
+ Sys->Tick();
+ }
+ }
+ for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) {
+ if (spr->Time) {
+ if (!spr->Flags.Hide) {
+ if (-- spr->Time == 0)
+ spr->Tick();
+ }
+ }
+ }
+ asm mov ss,oldSS
+ asm mov sp,oldSP
+ run--;
+ }
}
*/
@@ -301,17 +305,17 @@ void ENGINE::NewTimer(...) {
my_int: //------72Hz-------//
// decrement external timer uint16
- if (Heart->XTimer)
- if (*Heart->XTimer)
- *Heart->XTimer--;
+ if (_heart->XTimer) {
+ if (*_heart->XTimer)
+ *_heart->XTimer--;
else
- Heart->XTimer = NULL;
+ _heart->XTimer = NULL;
+ }
- if (! run && Heart->Enable) // check overrun flag
- {
+ if (! run && _heart->Enable) { // check overrun flag
static uint16 oldSP, oldSS;
- run++; // disable 2nd call until current lasts
+ run++; // disable 2nd call until current lasts
asm mov ax,ds
asm mov oldSS,ss
asm mov oldSP,sp
@@ -319,12 +323,21 @@ void ENGINE::NewTimer(...) {
asm mov sp,0xFF80
// system pseudo-sprite
- if (Sys) if (Sys->Time) if (-- Sys->Time == 0) Sys->Tick();
+ if (Sys) {
+ if (Sys->Time) {
+ if (--Sys->Time == 0)
+ Sys->Tick();
+ }
+ }
- for (spr = VGA::ShowQ.First(); spr; spr = spr->Next)
- {
- if (spr->Time) if (!spr->Flags.Hide) if (-- spr->Time == 0) spr->Tick();
- }
+ for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) {
+ if (spr->Time) {
+ if (!spr->Flags.Hide) {
+ if (--spr->Time == 0)
+ spr->Tick();
+ }
+ }
+ }
asm mov ss,oldSS
asm mov sp,oldSP
run--;
@@ -335,39 +348,39 @@ void ENGINE::NewTimer(...) {
}
-void HEART::SetXTimer(uint16 *ptr) {
- if (XTimer && ptr != XTimer)
- *XTimer = 0;
- XTimer = ptr;
+void Heart::setXTimer(uint16 *ptr) {
+ if (_xTimer && ptr != _xTimer)
+ *_xTimer = 0;
+ _xTimer = ptr;
}
-void HEART::SetXTimer(uint16 *ptr, uint16 time) {
- SetXTimer(ptr);
+void Heart::setXTimer(uint16 *ptr, uint16 time) {
+ setXTimer(ptr);
*ptr = time;
}
-SPRITE::SPRITE(CGEEngine *vm, BMP_PTR *shp)
+Sprite::Sprite(CGEEngine *vm, BMP_PTR *shp)
: X(0), Y(0), Z(0), NearPtr(0), TakePtr(0),
Next(NULL), Prev(NULL), SeqPtr(NO_SEQ), Time(0), //Delay(0),
- Ext(NULL), Ref(-1), Cave(0), _vm(vm) {
+ _ext(NULL), _ref(-1), _cave(0), _vm(vm) {
memset(File, 0, sizeof(File));
*((uint16 *)&Flags) = 0;
SetShapeList(shp);
}
-SPRITE::~SPRITE(void) {
+Sprite::~Sprite() {
Contract();
}
-BMP_PTR SPRITE::Shp(void) {
- register SPREXT *e = Ext;
+BMP_PTR Sprite::Shp() {
+ register SprExt *e = _ext;
if (e)
- if (e->Seq) {
- int i = e->Seq[SeqPtr].Now;
+ if (e->_seq) {
+ int i = e->_seq[SeqPtr].Now;
if (i >= ShpCnt) {
//char s[256];
//sprintf(s, "Seq=%p ShpCnt=%d SeqPtr=%d Now=%d Next=%d",
@@ -375,14 +388,14 @@ BMP_PTR SPRITE::Shp(void) {
//VGA::Exit(s, File);
error("Invalid PHASE in SPRITE::Shp() %s", File);
}
- return e->ShpList[i];
+ return e->_shpList[i];
}
return NULL;
}
-BMP_PTR *SPRITE::SetShapeList(BMP_PTR *shp) {
- BMP_PTR *r = (Ext) ? Ext->ShpList : NULL;
+BMP_PTR *Sprite::SetShapeList(BMP_PTR *shp) {
+ BMP_PTR *r = (_ext) ? _ext->_shpList : NULL;
ShpCnt = 0;
W = 0;
@@ -399,29 +412,29 @@ BMP_PTR *SPRITE::SetShapeList(BMP_PTR *shp) {
++ShpCnt;
}
Expand();
- Ext->ShpList = shp;
- if (! Ext->Seq)
- SetSeq((ShpCnt < 2) ? Seq1 : Seq2);
+ _ext->_shpList = shp;
+ if (!_ext->_seq)
+ SetSeq((ShpCnt < 2) ? _seq1 : _seq2);
}
return r;
}
-void SPRITE::MoveShapes(uint8 *buf) {
+void Sprite::MoveShapes(uint8 *buf) {
BMP_PTR *p;
- for (p = Ext->ShpList; *p; p++) {
+ for (p = _ext->_shpList; *p; p++) {
buf += (*p)->MoveVmap(buf);
}
}
-bool SPRITE::Works(SPRITE *spr) {
+bool Sprite::Works(Sprite *spr) {
if (spr)
- if (spr->Ext) {
- SNAIL::COM *c = spr->Ext->Take;
+ if (spr->_ext) {
+ SNAIL::COM *c = spr->_ext->_take;
if (c != NULL) {
c += spr->TakePtr;
- if (c->Ref == Ref)
+ if (c->Ref == _ref)
if (c->Com != SNLABEL || (c->Val == 0 || c->Val == Now))
return true;
}
@@ -430,10 +443,10 @@ bool SPRITE::Works(SPRITE *spr) {
}
-SEQ *SPRITE::SetSeq(SEQ *seq) {
+Seq *Sprite::SetSeq(Seq *seq) {
Expand();
- register SEQ *s = Ext->Seq;
- Ext->Seq = seq;
+ register Seq *s = _ext->_seq;
+ _ext->_seq = seq;
if (SeqPtr == NO_SEQ)
Step(0);
else if (Time == 0)
@@ -442,32 +455,32 @@ SEQ *SPRITE::SetSeq(SEQ *seq) {
}
-bool SPRITE::SeqTest(int n) {
+bool Sprite::SeqTest(int n) {
if (n >= 0)
return (SeqPtr == n);
- if (Ext)
- return (Ext->Seq[SeqPtr].Next == SeqPtr);
+ if (_ext)
+ return (_ext->_seq[SeqPtr].Next == SeqPtr);
return true;
}
-SNAIL::COM *SPRITE::SnList(SNLIST type) {
- register SPREXT *e = Ext;
+SNAIL::COM *Sprite::SnList(SNLIST type) {
+ register SprExt *e = _ext;
if (e)
- return (type == NEAR) ? e->Near : e->Take;
+ return (type == NEAR) ? e->_near : e->_take;
return NULL;
}
-void SPRITE::SetName(char *n) {
- if (Ext) {
- if (Ext->Name) {
- delete[] Ext->Name;
- Ext->Name = NULL;
+void Sprite::SetName(char *n) {
+ if (_ext) {
+ if (_ext->_name) {
+ delete[] _ext->_name;
+ _ext->_name = NULL;
}
if (n) {
- if ((Ext->Name = new char[strlen(n) + 1]) != NULL)
- strcpy(Ext->Name, n);
+ if ((_ext->_name = new char[strlen(n) + 1]) != NULL)
+ strcpy(_ext->_name, n);
else
error("No core [%s]", n);
}
@@ -475,17 +488,17 @@ void SPRITE::SetName(char *n) {
}
-SPRITE *SPRITE::Expand(void) {
- if (! Ext) {
- bool enbl = Heart->Enable;
- Heart->Enable = false;
- if ((Ext = new SPREXT) == NULL)
+Sprite *Sprite::Expand(void) {
+ if (!_ext) {
+ bool enbl = _heart->_enable;
+ _heart->_enable = false;
+ if ((_ext = new SprExt) == NULL)
error("No core");
if (*File) {
static const char *Comd[] = { "Name", "Phase", "Seq", "Near", "Take", NULL };
char line[LINE_MAX], fname[MAXPATH];
BMP_PTR *shplist = new BMP_PTR [ShpCnt + 1];
- SEQ *seq = NULL;
+ Seq *seq = NULL;
int shpcnt = 0,
seqcnt = 0,
neacnt = 0,
@@ -518,10 +531,10 @@ SPRITE *SPRITE::Expand(void) {
break;
}
case 2 : { // Seq
- seq = (SEQ *) realloc(seq, (seqcnt + 1) * sizeof(*seq));
+ seq = (Seq *) realloc(seq, (seqcnt + 1) * sizeof(*seq));
if (seq == NULL)
error("No core [%s]", fname);
- SEQ *s = &seq[seqcnt++];
+ Seq *s = &seq[seqcnt++];
s->Now = atoi(strtok(NULL, " \t,;/"));
if (s->Now > maxnow)
maxnow = s->Now;
@@ -586,52 +599,52 @@ SPRITE *SPRITE::Expand(void) {
error("Bad JUMP in SEQ [%s]", fname);
SetSeq(seq);
} else
- SetSeq((ShpCnt == 1) ? Seq1 : Seq2);
+ SetSeq((ShpCnt == 1) ? _seq1 : _seq2);
//disable(); // disable interupt
SetShapeList(shplist);
//enable(); // enable interupt
if (nea)
- nea[neacnt - 1].Ptr = Ext->Near = nea;
+ nea[neacnt - 1].Ptr = _ext->_near = nea;
else
NearPtr = NO_PTR;
if (tak)
- tak[takcnt - 1].Ptr = Ext->Take = tak;
+ tak[takcnt - 1].Ptr = _ext->_take = tak;
else
TakePtr = NO_PTR;
}
- Heart->Enable = enbl;
+ _heart->_enable = enbl;
}
return this;
}
-SPRITE *SPRITE::Contract(void) {
- register SPREXT *e = Ext;
+Sprite *Sprite::Contract(void) {
+ register SprExt *e = _ext;
if (e) {
- if (e->Name)
- delete[] e->Name;
- if (Flags.BDel && e->ShpList) {
+ if (e->_name)
+ delete[] e->_name;
+ if (Flags.BDel && e->_shpList) {
int i;
- for (i = 0; e->ShpList[i]; i++)
- delete e->ShpList[i];
- if (MemType(e->ShpList) == NEAR_MEM)
- delete[] e->ShpList;
+ for (i = 0; e->_shpList[i]; i++)
+ delete e->_shpList[i];
+ if (MemType(e->_shpList) == NEAR_MEM)
+ delete[] e->_shpList;
}
- if (MemType(e->Seq) == NEAR_MEM)
- free(e->Seq);
- if (e->Near)
- free(e->Near);
- if (e->Take)
- free(e->Take);
+ if (MemType(e->_seq) == NEAR_MEM)
+ free(e->_seq);
+ if (e->_near)
+ free(e->_near);
+ if (e->_take)
+ free(e->_take);
delete e;
- Ext = NULL;
+ _ext = NULL;
}
return this;
}
-SPRITE *SPRITE::BackShow(bool fast) {
+Sprite *Sprite::BackShow(bool fast) {
Expand();
Show(2);
Show(1);
@@ -642,14 +655,14 @@ SPRITE *SPRITE::BackShow(bool fast) {
}
-void SPRITE::Step(int nr) {
+void Sprite::Step(int nr) {
if (nr >= 0)
SeqPtr = nr;
- if (Ext) {
- SEQ *seq;
+ if (_ext) {
+ Seq *seq;
if (nr < 0)
- SeqPtr = Ext->Seq[SeqPtr].Next;
- seq = Ext->Seq + SeqPtr;
+ SeqPtr = _ext->_seq[SeqPtr].Next;
+ seq = _ext->_seq + SeqPtr;
if (seq->Dly >= 0) {
Goto(X + (seq->Dx), Y + (seq->Dy));
Time = seq->Dly;
@@ -658,28 +671,28 @@ void SPRITE::Step(int nr) {
}
-void SPRITE::Tick(void) {
+void Sprite::Tick(void) {
Step();
}
-void SPRITE::MakeXlat(uint8 *x) {
- if (Ext) {
+void Sprite::MakeXlat(uint8 *x) {
+ if (_ext) {
BMP_PTR *b;
if (Flags.Xlat)
KillXlat();
- for (b = Ext->ShpList; *b; b++)
+ for (b = _ext->_shpList; *b; b++)
(*b)->M = x;
Flags.Xlat = true;
}
}
-void SPRITE::KillXlat(void) {
- if (Flags.Xlat && Ext) {
+void Sprite::KillXlat(void) {
+ if (Flags.Xlat && _ext) {
BMP_PTR *b;
- uint8 *m = (*Ext->ShpList)->M;
+ uint8 *m = (*_ext->_shpList)->M;
switch (MemType(m)) {
case NEAR_MEM :
@@ -689,14 +702,14 @@ void SPRITE::KillXlat(void) {
free(m);
break;
}
- for (b = Ext->ShpList; *b; b++)
+ for (b = _ext->_shpList; *b; b++)
(*b)->M = NULL;
Flags.Xlat = false;
}
}
-void SPRITE::Goto(int x, int y) {
+void Sprite::Goto(int x, int y) {
int xo = X, yo = Y;
if (W < SCR_WID) {
if (x < 0)
@@ -720,30 +733,32 @@ void SPRITE::Goto(int x, int y) {
}
-void SPRITE::Center(void) {
+void Sprite::Center(void) {
Goto((SCR_WID - W) / 2, (SCR_HIG - H) / 2);
}
-void SPRITE::Show(void) {
- register SPREXT *e;
+void Sprite::Show(void) {
+ register SprExt *e;
// asm cli // critic section...
- e = Ext;
- e->x0 = e->x1;
- e->y0 = e->y1;
- e->b0 = e->b1;
- e->x1 = X;
- e->y1 = Y;
- e->b1 = Shp();
+ e = _ext;
+ e->_x0 = e->_x1;
+ e->_y0 = e->_y1;
+ e->_b0 = e->_b1;
+ e->_x1 = X;
+ e->_y1 = Y;
+ e->_b1 = Shp();
// asm sti // ...done!
if (! Flags.Hide) {
- if (Flags.Xlat) e->b1->XShow(e->x1, e->y1);
- else e->b1->Show(e->x1, e->y1);
+ if (Flags.Xlat)
+ e->_b1->XShow(e->_x1, e->_y1);
+ else
+ e->_b1->Show(e->_x1, e->_y1);
}
}
-void SPRITE::Show(uint16 pg) {
+void Sprite::Show(uint16 pg) {
Graphics::Surface *a = VGA::Page[1];
VGA::Page[1] = VGA::Page[pg & 3];
Shp()->Show(X, Y);
@@ -751,24 +766,24 @@ void SPRITE::Show(uint16 pg) {
}
-void SPRITE::Hide(void) {
- register SPREXT *e = Ext;
- if (e->b0)
- e->b0->Hide(e->x0, e->y0);
+void Sprite::Hide(void) {
+ register SprExt *e = _ext;
+ if (e->_b0)
+ e->_b0->Hide(e->_x0, e->_y0);
}
-BMP_PTR SPRITE::Ghost(void) {
- register SPREXT *e = Ext;
- if (e->b1) {
+BMP_PTR Sprite::Ghost(void) {
+ register SprExt *e = _ext;
+ if (e->_b1) {
BMP_PTR bmp = new BITMAP(0, 0, (uint8 *)NULL);
if (bmp == NULL)
error("No core");
- bmp->W = e->b1->W;
- bmp->H = e->b1->H;
+ bmp->W = e->_b1->W;
+ bmp->H = e->_b1->H;
if ((bmp->B = farnew(HideDesc, bmp->H)) == NULL)
error("No Core");
- bmp->V = (uint8 *) memcpy(bmp->B, e->b1->B, sizeof(HideDesc) * bmp->H);
+ 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);
warning("FIXME: SPRITE::Ghost");
@@ -778,8 +793,8 @@ BMP_PTR SPRITE::Ghost(void) {
}
-SPRITE *SpriteAt(int x, int y) {
- SPRITE *spr = NULL, * tail = Vga->ShowQ->Last();
+Sprite *SpriteAt(int x, int y) {
+ Sprite *spr = NULL, * tail = Vga->ShowQ->Last();
if (tail) {
for (spr = tail->Prev; spr; spr = spr->Prev)
if (! spr->Flags.Hide && ! spr->Flags.Tran)
@@ -801,24 +816,24 @@ QUEUE::~QUEUE(void) {
void QUEUE::Clear(void) {
while (Head) {
- SPRITE *s = Remove(Head);
+ Sprite *s = Remove(Head);
if (s->Flags.Kill)
delete s;
}
}
-void QUEUE::ForAll(void (*fun)(SPRITE *)) {
- SPRITE *s = Head;
+void QUEUE::ForAll(void (*fun)(Sprite *)) {
+ Sprite *s = Head;
while (s) {
- SPRITE *n = s->Next;
+ Sprite *n = s->Next;
fun(s);
s = n;
}
}
-void QUEUE::Append(SPRITE *spr) {
+void QUEUE::Append(Sprite *spr) {
if (Tail) {
spr->Prev = Tail;
Tail->Next = spr;
@@ -832,7 +847,7 @@ void QUEUE::Append(SPRITE *spr) {
}
-void QUEUE::Insert(SPRITE *spr, SPRITE *nxt) {
+void QUEUE::Insert(Sprite *spr, Sprite *nxt) {
if (nxt == Head) {
spr->Next = Head;
Head = spr;
@@ -853,8 +868,8 @@ void QUEUE::Insert(SPRITE *spr, SPRITE *nxt) {
}
-void QUEUE::Insert(SPRITE *spr) {
- SPRITE *s;
+void QUEUE::Insert(Sprite *spr) {
+ Sprite *s;
for (s = Head; s; s = s->Next)
if (s->Z > spr->Z)
break;
@@ -869,7 +884,7 @@ void QUEUE::Insert(SPRITE *spr) {
}
-SPRITE *QUEUE::Remove(SPRITE *spr) {
+Sprite *QUEUE::Remove(Sprite *spr) {
if (spr == Head)
Head = spr->Next;
if (spr == Tail)
@@ -884,11 +899,12 @@ SPRITE *QUEUE::Remove(SPRITE *spr) {
}
-SPRITE *QUEUE::Locate(int ref) {
- SPRITE *spr;
- for (spr = Head; spr; spr = spr->Next)
- if (spr->Ref == ref)
+Sprite *QUEUE::Locate(int ref) {
+ Sprite *spr;
+ for (spr = Head; spr; spr = spr->Next) {
+ if (spr->_ref == ref)
return spr;
+ }
return NULL;
}
@@ -907,9 +923,9 @@ void VGA::init() {
}
void VGA::deinit() {
- for (int idx = 0; idx < 4; ++idx) {
+ for (int idx = 0; idx < 4; ++idx)
delete Page[idx];
- }
+
delete[] SysPal;
}
@@ -1120,7 +1136,7 @@ void VGA::Sunset(void) {
void VGA::Show(void) {
- SPRITE *spr = ShowQ->First();
+ Sprite *spr = ShowQ->First();
for (spr = ShowQ->First(); spr; spr = spr->Next)
spr->Show();
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index c984e121e8..af1c981aa8 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -81,37 +81,40 @@ namespace CGE {
-typedef struct {
+struct Rgb {
uint16 r : 2;
uint16 R : 6;
uint16 g : 2;
uint16 G : 6;
uint16 b : 2;
uint16 B : 6;
-} RGB;
+};
typedef union {
DAC dac;
- RGB rgb;
+ Rgb rgb;
} TRGB;
-typedef struct {
- uint8 idx, adr;
- uint8 clr, set;
-} VgaRegBlk;
+struct VgaRegBlk {
+ uint8 idx;
+ uint8 adr;
+ uint8 clr;
+ uint8 set;
+};
-typedef struct {
- uint8 Now, Next;
- signed char Dx, Dy;
+struct Seq {
+ uint8 Now;
+ uint8 Next;
+ int8 Dx;
+ int8 Dy;
int Dly;
-} SEQ;
+};
-extern SEQ Seq1[];
-extern SEQ Seq2[];
+extern Seq _seq1[];
+extern Seq _seq2[];
//extern SEQ * Compass[];
//extern SEQ TurnToS[];
-
#define PAL_CNT 256
#define PAL_SIZ (PAL_CNT * 3)
#define VGAATR_ 0x3C0
@@ -130,43 +133,44 @@ extern SEQ Seq2[];
#define VGAST1 (VGAST1_ & 0xFF)
-class HEART : public ENGINE {
+class Heart : public ENGINE {
friend class ENGINE;
public:
- HEART();
+ Heart();
+
+ bool _enable;
+ uint16 *_xTimer;
- bool Enable;
- uint16 *XTimer;
- void SetXTimer(uint16 *ptr);
- void SetXTimer(uint16 *ptr, uint16 time);
+ void setXTimer(uint16 *ptr);
+ void setXTimer(uint16 *ptr, uint16 time);
};
-class SPREXT {
+class SprExt {
public:
- int x0, y0;
- int x1, y1;
- BMP_PTR b0, b1;
- BMP_PTR *ShpList;
- SEQ *Seq;
- char *Name;
- SNAIL::COM *Near, * Take;
- SPREXT(void) :
- x0(0), y0(0),
- x1(0), y1(0),
- b0(NULL), b1(NULL),
- ShpList(NULL), Seq(NULL),
- Name(NULL), Near(NULL), Take(NULL)
+ int _x0, _y0;
+ int _x1, _y1;
+ BMP_PTR _b0, _b1;
+ BMP_PTR *_shpList;
+ Seq *_seq;
+ char *_name;
+ SNAIL::COM *_near, *_take;
+ SprExt() :
+ _x0(0), _y0(0),
+ _x1(0), _y1(0),
+ _b0(NULL), _b1(NULL),
+ _shpList(NULL), _seq(NULL),
+ _name(NULL), _near(NULL), _take(NULL)
{}
};
-class SPRITE {
+class Sprite {
protected:
- SPREXT *Ext;
+ SprExt *_ext;
public:
- int Ref;
- signed char Cave;
+ int _ref;
+ signed char _cave;
struct FLAGS {
uint16 Hide : 1; // general visibility switch
uint16 Near : 1; // Near action lock
@@ -193,23 +197,23 @@ public:
int SeqPtr;
int ShpCnt;
char File[MAXFILE];
- SPRITE *Prev, * Next;
- bool Works(SPRITE *spr);
+ Sprite *Prev, * Next;
+ bool Works(Sprite *spr);
bool SeqTest(int n);
inline bool Active(void) {
- return Ext != NULL;
+ return _ext != NULL;
}
- SPRITE(CGEEngine *vm, BMP_PTR *shp);
- virtual ~SPRITE(void);
+ Sprite(CGEEngine *vm, BMP_PTR *shp);
+ virtual ~Sprite(void);
BMP_PTR Shp(void);
BMP_PTR *SetShapeList(BMP_PTR *shp);
void MoveShapes(uint8 *buf);
- SPRITE *Expand(void);
- SPRITE *Contract(void);
- SPRITE *BackShow(bool fast = false);
+ Sprite *Expand(void);
+ Sprite *Contract(void);
+ Sprite *BackShow(bool fast = false);
void SetName(char *n);
inline char *Name(void) {
- return (Ext) ? Ext->Name : NULL;
+ return (_ext) ? _ext->_name : NULL;
}
void Goto(int x, int y);
void Center(void);
@@ -220,7 +224,7 @@ public:
void MakeXlat(uint8 *x);
void KillXlat(void);
void Step(int nr = -1);
- SEQ *SetSeq(SEQ *seq);
+ Seq *SetSeq(Seq *seq);
SNAIL::COM *SnList(SNLIST type);
virtual void Touch(uint16 mask, int x, int y);
virtual void Tick(void);
@@ -230,23 +234,23 @@ private:
class QUEUE {
- SPRITE *Head, * Tail;
+ Sprite *Head, * Tail;
public:
bool Show;
QUEUE(bool show);
~QUEUE(void);
- void Append(SPRITE *spr);
- void Insert(SPRITE *spr, SPRITE *nxt);
- void Insert(SPRITE *spr);
- SPRITE *Remove(SPRITE *spr);
- void ForAll(void (*fun)(SPRITE *));
- SPRITE *First(void) {
+ void Append(Sprite *spr);
+ void Insert(Sprite *spr, Sprite *nxt);
+ void Insert(Sprite *spr);
+ Sprite *Remove(Sprite *spr);
+ void ForAll(void (*fun)(Sprite *));
+ Sprite *First(void) {
return Head;
}
- SPRITE *Last(void) {
+ Sprite *Last(void) {
return Tail;
}
- SPRITE *Locate(int ref);
+ Sprite *Locate(int ref);
void Clear(void);
};
@@ -292,8 +296,8 @@ public:
};
-DAC MkDAC(uint8 r, uint8 g, uint8 b);
-RGB MkRGB(uint8 r, uint8 g, uint8 b);
+DAC MkDAC(uint8 r, uint8 g, uint8 b);
+Rgb MkRGB(uint8 r, uint8 g, uint8 b);
template <class CBLK>
@@ -331,12 +335,12 @@ uint8 Closest(CBLK *pal, CBLK x) {
-char *NumStr(char *str, int num);
+char *NumStr(char *str, int num);
//static void Video (void);
-uint16 *SaveScreen(void);
-void RestoreScreen(uint16 * &sav);
-SPRITE *SpriteAt(int x, int y);
-SPRITE *Locate(int ref);
+uint16 *SaveScreen(void);
+void RestoreScreen(uint16 * &sav);
+Sprite *SpriteAt(int x, int y);
+Sprite *Locate(int ref);
extern bool SpeedTest;
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
index 7db5a79f85..ed335191aa 100644
--- a/engines/cge/vmenu.cpp
+++ b/engines/cge/vmenu.cpp
@@ -130,7 +130,7 @@ void VMENU::Touch(uint16 mask, int x, int y) {
bool ok = false;
if (Items) {
- SPRITE::Touch(mask, x, y);
+ Sprite::Touch(mask, x, y);
y -= TEXT_VM - 1;
int n = 0;