aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorStrangerke2011-07-13 08:44:58 +0200
committerStrangerke2011-07-13 08:44:58 +0200
commit4d0f83babb923527c67157204ba0b8b678b6732a (patch)
tree44589f9abae8a063307404b0ba8640054eb536d5 /engines/cge
parent5148f80fa5077e2bdffba44dabac793c9cbe4666 (diff)
downloadscummvm-rg350-4d0f83babb923527c67157204ba0b8b678b6732a.tar.gz
scummvm-rg350-4d0f83babb923527c67157204ba0b8b678b6732a.tar.bz2
scummvm-rg350-4d0f83babb923527c67157204ba0b8b678b6732a.zip
CGE: Rename some constants
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge.h12
-rw-r--r--engines/cge/cge_main.cpp24
-rw-r--r--engines/cge/config.cpp2
-rw-r--r--engines/cge/mixer.cpp2
-rw-r--r--engines/cge/snail.cpp26
-rw-r--r--engines/cge/snail.h4
-rw-r--r--engines/cge/vga13h.cpp4
-rw-r--r--engines/cge/vga13h.h2
8 files changed, 42 insertions, 34 deletions
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 644e06e7e7..7dd218e258 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -45,8 +45,14 @@ enum {
kCGEDebug = 1 << 0
};
-enum SNLIST { NEAR, TAKE };
-enum CALLBACK { NULLCB = 0, QGAME, MINISTEP, XCAVE, SELECTSOUND, SNSELECT, SNDSETVOLUME };
+enum SnList {
+ kNear, kTake
+};
+
+enum CallbackType {
+ kNullCB = 0, kQGame, kMiniStep, kXCave, kSelectSound,
+ kSnSelect, kSndSetVolume
+};
#define POCKET_NX 8
@@ -126,7 +132,7 @@ public:
void expandSprite(Sprite *spr);
void contractSprite(Sprite *spr);
int findPocket(Sprite *spr);
- void feedSnail(Sprite *spr, SNLIST snq);
+ void feedSnail(Sprite *spr, SnList snq);
void pocFul();
void hide1(Sprite *spr);
void loadMapping();
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index f2aca3ed8b..16e21e1f73 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -355,7 +355,7 @@ void WALK::tick() {
for (spr = _vga->_showQ->first(); spr; spr = spr->_next) {
if (distance(spr) < 2) {
if (!spr->_flags._near) {
- _vm->feedSnail(spr, NEAR);
+ _vm->feedSnail(spr, kNear);
spr->_flags._near = true;
}
} else {
@@ -601,7 +601,7 @@ void CGEEngine::miniStep(int stp) {
static void postMiniStep(int stp) {
static int recent = -2;
if (_miniCave && stp != recent)
- SNPOST2_(SNEXEC, -1, recent = stp, MINISTEP);
+ SNPOST2_(SNEXEC, -1, recent = stp, kMiniStep);
}
void System::setPal() {
@@ -685,7 +685,7 @@ void CGEEngine::caveUp() {
_vga->_showQ->insert(_shadow, _hero);
_shadow->_z = _hero->_z;
}
- feedSnail(_vga->_showQ->locate(BakRef + 999), TAKE);
+ feedSnail(_vga->_showQ->locate(BakRef + 999), kTake);
_vga->show();
_vga->copyPage(1, 0);
_vga->show();
@@ -707,7 +707,7 @@ void CGEEngine::caveDown() {
Sprite *n = spr->_next;
if (spr->_ref >= 1000 /*&& spr->_cave*/) {
if (spr->_ref % 1000 == 999)
- feedSnail(spr, TAKE);
+ feedSnail(spr, kTake);
_vga->_spareQ->append(_vga->_showQ->remove(spr));
}
spr = n;
@@ -742,7 +742,7 @@ void CGEEngine::switchCave(int cav) {
_heart->_enable = false;
if (cav < 0) {
SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint
- SNPOST2(SNEXEC, -1, 0, QGAME); // switch cave
+ SNPOST2(SNEXEC, -1, 0, kQGame); // switch cave
} else {
_now = cav;
_mouse->off();
@@ -760,7 +760,7 @@ void CGEEngine::switchCave(int cav) {
if (!_startupMode)
keyClick();
SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint
- SNPOST2(SNEXEC, 0, 0, XCAVE); // switch cave
+ SNPOST2(SNEXEC, 0, 0, kXCave); // switch cave
}
}
}
@@ -991,7 +991,7 @@ void CGEEngine::switchMusic() {
SNPOST_(SNKILL, -1, 0, Vmenu::_addr);
else {
SNPOST_(SNSEQ, 122, (_music = false), NULL);
- SNPOST2(SNEXEC, -1, 0, SELECTSOUND);
+ SNPOST2(SNEXEC, -1, 0, kSelectSound);
}
} else {
if (Startup::_core < CORE_HIG)
@@ -1217,7 +1217,7 @@ void Sprite::touch(uint16 mask, int x, int y) {
if (ps) {
if (_flags._kept || _hero->distance(this) < MAX_DISTANCE) {
if (works(ps)) {
- _vm->feedSnail(ps, TAKE);
+ _vm->feedSnail(ps, kTake);
} else
_vm->offUse();
_vm->selectPocket(-1);
@@ -1239,10 +1239,10 @@ void Sprite::touch(uint16 mask, int x, int y) {
}
} else {
if (_takePtr != NO_PTR) {
- if (snList(TAKE)[_takePtr]._com == SNNEXT)
+ if (snList(kTake)[_takePtr]._com == SNNEXT)
_vm->offUse();
else
- _vm->feedSnail(this, TAKE);
+ _vm->feedSnail(this, kTake);
} else
_vm->offUse();
}
@@ -1662,7 +1662,7 @@ void CGEEngine::runGame() {
// main loop
while (!_finis && !_eventManager->_quitFlag) {
if (_finis)
- SNPOST2(SNEXEC, -1, 0, QGAME);
+ SNPOST2(SNEXEC, -1, 0, kQGame);
mainLoop();
}
@@ -1686,7 +1686,7 @@ void CGEEngine::movie(const char *ext) {
if (INI_FILE::exist(fn)) {
loadScript(fn);
expandSprite(_vga->_spareQ->locate(999));
- feedSnail(_vga->_showQ->locate(999), TAKE);
+ feedSnail(_vga->_showQ->locate(999), kTake);
_vga->_showQ->append(_mouse);
diff --git a/engines/cge/config.cpp b/engines/cge/config.cpp
index 0152961982..2941d36d2c 100644
--- a/engines/cge/config.cpp
+++ b/engines/cge/config.cpp
@@ -192,7 +192,7 @@ void CGEEngine::snSelect() {
static void select(Choice *cho, int hlp) {
_cho = cho;
_hlp = hlp;
- SNPOST2(SNEXEC, -1, 0, SNSELECT);
+ SNPOST2(SNEXEC, -1, 0, kSnSelect);
}
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp
index 8b11dbcc4c..eddc4a6570 100644
--- a/engines/cge/mixer.cpp
+++ b/engines/cge/mixer.cpp
@@ -142,7 +142,7 @@ void Mixer::update() {
_led[0]->step(_sndDrvInfo.Vol4._ml);
_led[1]->step(_sndDrvInfo.Vol4._dl);
- SNPOST2_(SNEXEC, -1, 0, SNDSETVOLUME);
+ SNPOST2_(SNEXEC, -1, 0, kSndSetVolume);
}
} // End of namespace CGE
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 23a182cbd5..10d85bfc0f 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -307,10 +307,10 @@ void CGEEngine::snGhost(Bitmap *bmp) {
delete bmp;
}
-void CGEEngine::feedSnail(Sprite *spr, SNLIST snq) {
+void CGEEngine::feedSnail(Sprite *spr, SnList snq) {
if (spr)
if (spr->active()) {
- uint8 ptr = (snq == TAKE) ? spr->_takePtr : spr->_nearPtr;
+ uint8 ptr = (snq == kTake) ? spr->_takePtr : spr->_nearPtr;
if (ptr != NO_PTR) {
Snail::Com *comtab = spr->snList(snq);
@@ -335,7 +335,7 @@ void CGEEngine::feedSnail(Sprite *spr, SNLIST snq) {
if (c->_com == SNNEXT) {
Sprite *s = (c->_ref < 0) ? spr : locate(c->_ref);
if (s) {
- uint8 *idx = (snq == TAKE) ? &s->_takePtr : &s->_nearPtr;
+ uint8 *idx = (snq == kTake) ? &s->_takePtr : &s->_nearPtr;
if (*idx != NO_PTR) {
int v;
switch (c->_val) {
@@ -411,7 +411,7 @@ void Snail::addCom(SNCOM com, int ref, int val, void *ptr) {
snc->_ref = ref;
snc->_val = val;
snc->_ptr = ptr;
- snc->_cbType = NULLCB;
+ snc->_cbType = kNullCB;
if (com == SNCLEAR) {
_tail = _head;
killText();
@@ -419,7 +419,7 @@ void Snail::addCom(SNCOM com, int ref, int val, void *ptr) {
}
}
-void Snail::addCom2(SNCOM com, int ref, int val, CALLBACK cbType) {
+void Snail::addCom2(SNCOM com, int ref, int val, CallbackType cbType) {
Com *snc = &_snList[_head++];
snc->_com = com;
snc->_ref = ref;
@@ -603,7 +603,7 @@ void CGEEngine::snCover(Sprite *spr, int xref) {
_vga->_showQ->insert(_vga->_showQ->remove(spr->_prev), xspr);
spr->_flags._shad = false;
}
- feedSnail(xspr, NEAR);
+ feedSnail(xspr, kNear);
}
}
@@ -1057,24 +1057,26 @@ void Snail::runCom() {
break;
case SNEXEC :
switch (snc->_cbType) {
- case QGAME:
+ case kQGame:
_vm->qGame();
break;
- case MINISTEP:
+ case kMiniStep:
_vm->miniStep(snc->_val);
break;
- case XCAVE:
+ case kXCave:
_vm->xCave();
break;
- case SELECTSOUND:
+ case kSelectSound:
_vm->selectSound();
break;
- case SNSELECT:
+ case kSnSelect:
_vm->snSelect();
break;
- case SNDSETVOLUME:
+ case kSndSetVolume:
sndSetVolume();
break;
+ default:
+ error("Unknown Callback Type in SNEXEC");
}
break;
case SNSTEP :
diff --git a/engines/cge/snail.h b/engines/cge/snail.h
index 48e5900248..08f20b9d07 100644
--- a/engines/cge/snail.h
+++ b/engines/cge/snail.h
@@ -79,7 +79,7 @@ public:
int _ref;
int _val;
void *_ptr;
- CALLBACK _cbType;
+ CallbackType _cbType;
} *_snList;
uint8 _head;
uint8 _tail;
@@ -93,7 +93,7 @@ public:
~Snail();
void runCom();
void addCom(SNCOM com, int ref, int val, void *ptr);
- void addCom2(SNCOM com, int ref, int val, CALLBACK cbType);
+ void addCom2(SNCOM com, int ref, int val, CallbackType cbType);
void insCom(SNCOM com, int ref, int val, void *ptr);
bool idle();
private:
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 5bdb50fa9e..d0e267ef38 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -476,10 +476,10 @@ bool Sprite::seqTest(int n) {
}
-Snail::Com *Sprite::snList(SNLIST type) {
+Snail::Com *Sprite::snList(SnList type) {
register SprExt *e = _ext;
if (e)
- return (type == NEAR) ? e->_near : e->_take;
+ return (type == kNear) ? e->_near : e->_take;
return NULL;
}
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index e29fa2eea4..6b56217a1e 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -222,7 +222,7 @@ public:
void killXlat();
void step(int nr = -1);
Seq *setSeq(Seq *seq);
- Snail::Com *snList(SNLIST type);
+ Snail::Com *snList(SnList type);
virtual void touch(uint16 mask, int x, int y);
virtual void tick();
void sync(Common::Serializer &s);