From bdc213846e1c35c7b6b7f5a397f97d8fe334c1b1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 2 Jul 2011 18:20:41 +0200 Subject: CGE: Some more renaming (WIP) --- engines/cge/cge.cpp | 8 +- engines/cge/cge_main.cpp | 224 ++++++++++++++++---------------- engines/cge/cge_main.h | 8 +- engines/cge/config.cpp | 10 +- engines/cge/general.cpp | 6 +- engines/cge/snail.cpp | 324 +++++++++++++++++++++++------------------------ engines/cge/snail.h | 82 ++++++------ engines/cge/snddrv.h | 10 +- engines/cge/sound.cpp | 8 +- engines/cge/sound.h | 10 +- engines/cge/vga13h.cpp | 46 +++---- engines/cge/vga13h.h | 4 +- 12 files changed, 365 insertions(+), 375 deletions(-) (limited to 'engines') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index da6365ca83..4af10b2b8d 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -96,8 +96,8 @@ void CGEEngine::setup() { LI[2] = new Bitmap("LITE2", true); LI[3] = new Bitmap("LITE3", true); LI[4] = NULL; - Snail = new SNAIL(this, false); - Snail_ = new SNAIL(this, true); + _snail = new Snail(this, false); + _snail_ = new Snail(this, true); _mouse = new MOUSE(this); _keyboard = new Keyboard(); @@ -145,8 +145,8 @@ CGEEngine::~CGEEngine() { delete _mouse; for (int i = 0; i < POCKET_NX; i++) delete _pocket[i]; - delete Snail; - delete Snail_; + delete _snail; + delete _snail_; delete Hero; delete Vga; delete Sys; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 6562dac041..22316d79b1 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -54,7 +54,7 @@ namespace CGE { #define STACK_SIZ (K(2)) -#define SVGCHKSUM (1956 + Now + OldLev + Game + Music + DemoText) +#define SVGCHKSUM (1956 + _now + _oldLev + _game + _music + _demoText) #define SVG0NAME ("{{INIT}}" SVG_EXT) #define SVG0FILE INI_FILE @@ -85,8 +85,8 @@ BMP_PTR PR[2]; BMP_PTR SP[3]; BMP_PTR LI[5]; -SNAIL *Snail; -SNAIL *Snail_; +Snail *_snail; +Snail *_snail_; // 0.75 - 17II95 - full sound support // 0.76 - 18II95 - small MiniEMS in DEMO, @@ -124,8 +124,8 @@ SNAIL *Snail_; char Copr[] = "To be fixed - Copr[]"; static char UsrFnam[15] = "\0ɱ%^þúȼ´ ÇÉ"; -static int OldLev = 0; -static int DemoText = DEMO_TEXT; +static int _oldLev = 0; +static int _demoText = DEMO_TEXT; //-------------------------------------------------------------------------- @@ -142,16 +142,14 @@ static int Startup = 1; int OffUseCount; uint16 *intStackPtr = false; -HXY HeroXY[CAVE_MAX] = {{0, 0}}; -BAR Barriers[1 + CAVE_MAX] = { { 0xFF, 0xFF } }; +Hxy _heroXY[CAVE_MAX] = {{0, 0}}; +Bar _barriers[1 + CAVE_MAX] = { { 0xFF, 0xFF } }; +extern int findPocket(Sprite *); +extern Dac _stdPal[58]; -extern int FindPocket(Sprite *); - -extern Dac _stdPal[58]; - -void FeedSnail(Sprite *spr, SNLIST snq); // defined in SNAIL -uint8 Cluster::_map[MAP_ZCNT][MAP_XCNT]; +void feedSnail(Sprite *spr, SNLIST snq); // defined in SNAIL +uint8 Cluster::_map[MAP_ZCNT][MAP_XCNT]; uint8 &Cluster::cell(void) { @@ -161,7 +159,7 @@ uint8 &Cluster::cell(void) { bool Cluster::Protected(void) { /* - if (A == Barriers[Now].Vert || B == Barriers[Now].Horz) + if (A == Barriers[Now]._vert || B == Barriers[Now]._horz) return true; _DX = (MAP_ZCNT << 8) + MAP_XCNT; @@ -220,8 +218,8 @@ Cluster XZ(Couple xy) { } -int pocref[POCKET_NX]; -uint8 volume[2]; +int _pocref[POCKET_NX]; +uint8 _volume[2]; struct SavTab { void *Ptr; @@ -230,21 +228,21 @@ struct SavTab { }; SavTab _savTab[] = { - { &Now, sizeof(Now), 1 }, - { &OldLev, sizeof(OldLev), 1 }, - { &DemoText, sizeof(DemoText), 1 }, - { &Game, sizeof(Game), 1 }, - { &Game, sizeof(Game), 1 }, // spare 1 - { &Game, sizeof(Game), 1 }, // spare 2 - { &Game, sizeof(Game), 1 }, // spare 3 - { &Game, sizeof(Game), 1 }, // spare 4 + { &_now, sizeof(_now), 1 }, + { &_oldLev, sizeof(_oldLev), 1 }, + { &_demoText, sizeof(_demoText), 1 }, + { &_game, sizeof(_game), 1 }, + { &_game, sizeof(_game), 1 }, // spare 1 + { &_game, sizeof(_game), 1 }, // spare 2 + { &_game, sizeof(_game), 1 }, // spare 3 + { &_game, sizeof(_game), 1 }, // spare 4 // { &VGA::Mono, sizeof(VGA::Mono), 0 }, - { &Music, sizeof(Music), 1 }, - { volume, sizeof(volume), 1 }, - { Flag, sizeof(Flag), 1 }, - { HeroXY, sizeof(HeroXY), 1 }, - { Barriers, sizeof(Barriers), 1 }, - { pocref, sizeof(pocref), 1 }, + { &_music, sizeof(_music), 1 }, + { _volume, sizeof(_volume), 1 }, + { _flag, sizeof(_flag), 1 }, + { _heroXY, sizeof(_heroXY), 1 }, + { _barriers, sizeof(_barriers), 1 }, + { _pocref, sizeof(_pocref), 1 }, { NULL, 0, 0 } }; @@ -265,11 +263,11 @@ void CGEEngine::loadGame(XFile &file, bool tiny = false) { error("%s", Text->getText(BADSVG_TEXT)); if (STARTUP::Core < CORE_HIG) - Music = false; + _music = false; if (STARTUP::SoundOk == 1 && STARTUP::Mode == 0) { - SNDDrvInfo.VOL2.D = volume[0]; - SNDDrvInfo.VOL2.M = volume[1]; + SNDDrvInfo.VOL2.D = _volume[0]; + SNDDrvInfo.VOL2.M = _volume[1]; SNDSetVolume(); } @@ -291,7 +289,7 @@ void CGEEngine::loadGame(XFile &file, bool tiny = false) { } for (i = 0; i < POCKET_NX; i++) { - register int r = pocref[i]; + register int r = _pocref[i]; _pocket[i] = (r < 0) ? NULL : Vga->SpareQ->Locate(r); } } @@ -312,11 +310,11 @@ static void SaveGame(XFile &file) { for (i = 0; i < POCKET_NX; i++) { register Sprite *s = _pocket[i]; - pocref[i] = (s) ? s->_ref : -1; + _pocref[i] = (s) ? s->_ref : -1; } - volume[0] = SNDDrvInfo.VOL2.D; - volume[1] = SNDDrvInfo.VOL2.M; + _volume[0] = SNDDrvInfo.VOL2.D; + _volume[1] = SNDDrvInfo.VOL2.M; for (st = _savTab; st->Ptr; st++) { if (file._error) @@ -366,18 +364,18 @@ static void noWay() { static void LoadHeroXY(void) { INI_FILE cf(progName(".HXY")); - memset(HeroXY, 0, sizeof(HeroXY)); + memset(_heroXY, 0, sizeof(_heroXY)); if (!cf._error) - cf.CFREAD(&HeroXY); + cf.CFREAD(&_heroXY); } static void LoadMapping(void) { - if (Now <= CAVE_MAX) { + if (_now <= CAVE_MAX) { INI_FILE cf(progName(".TAB")); if (!cf._error) { memset(Cluster::_map, 0, sizeof(Cluster::_map)); - cf.seek((Now - 1) * sizeof(Cluster::_map)); + cf.seek((_now - 1) * sizeof(Cluster::_map)); cf.read((uint8 *) Cluster::_map, sizeof(Cluster::_map)); } } @@ -405,7 +403,7 @@ void WALK::tick() { for (spr = Vga->ShowQ->First(); spr; spr = spr->_next) { if (distance(spr) < 2) { if (!spr->_flags._near) { - FeedSnail(spr, NEAR); + feedSnail(spr, NEAR); spr->_flags._near = true; } } else { @@ -614,7 +612,7 @@ void CGEEngine::quit() { { NULL, &CGEEngine::dummy } }; - if (Snail->Idle() && ! Hero->_flags._hide) { + if (_snail->idle() && ! Hero->_flags._hide) { if (VMENU::Addr) { SNPOST_(SNKILL, -1, 0, VMENU::Addr); resetQSwitch(); @@ -640,8 +638,8 @@ static void miniStep(int stp) { else { &*Mini; *MiniShp[0] = *MiniShpList[stp]; - if (Fx.Current) - &*(Fx.Current->EAddr()); + if (_fx.Current) + &*(_fx.Current->EAddr()); _miniCave->_flags._hide = false; } @@ -688,9 +686,9 @@ static void ShowBak(int ref) { static void caveUp() { - int BakRef = 1000 * Now; - if (Music) - LoadMIDI(Now); + int BakRef = 1000 * _now; + if (_music) + LoadMIDI(_now); ShowBak(BakRef); LoadMapping(); @@ -698,7 +696,7 @@ static void caveUp() { Sprite *spr = Vga->SpareQ->First(); while (spr) { Sprite *n = spr->_next; - if (spr->_cave == Now || spr->_cave == 0) + if (spr->_cave == _now || spr->_cave == 0) if (spr->_ref != BakRef) { if (spr->_flags._back) spr->backShow(); @@ -708,25 +706,25 @@ static void caveUp() { spr = n; } if (SNDDrvInfo.DDEV) { - Sound.Stop(); - Fx.Clear(); - Fx.Preload(0); - Fx.Preload(BakRef); + _sound.Stop(); + _fx.Clear(); + _fx.Preload(0); + _fx.Preload(BakRef); } if (Hero) { - Hero->gotoxy(HeroXY[Now - 1]._x, HeroXY[Now - 1]._y); + Hero->gotoxy(_heroXY[_now - 1]._x, _heroXY[_now - 1]._y); // following 2 lines trims Hero's Z position! Hero->tick(); Hero->_time = 1; Hero->_flags._hide = false; } - if (! Dark) + if (!_dark) Vga->Sunset(); Vga->CopyPage(0, 1); - SelectPocket(-1); + selectPocket(-1); if (Hero) Vga->ShowQ->Insert(Vga->ShowQ->Remove(Hero)); @@ -736,12 +734,12 @@ static void caveUp() { 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(); Vga->Sunrise(VGA::SysPal); - Dark = false; + _dark = false; if (! Startup) _mouse->On(); @@ -758,7 +756,7 @@ void CGEEngine::caveDown() { Sprite *n = spr->_next; if (spr->_ref >= 1000 /*&& spr->_cave*/) { if (spr->_ref % 1000 == 999) - FeedSnail(spr, TAKE); + feedSnail(spr, TAKE); Vga->SpareQ->Append(Vga->ShowQ->Remove(spr)); } spr = n; @@ -775,7 +773,7 @@ void CGEEngine::xCave() { void CGEEngine::qGame() { caveDown(); - OldLev = Lev; + _oldLev = _lev; SaveSound(); CFile file = CFile(UsrPath(UsrFnam), WRI, RCrypt); SaveGame(file); @@ -785,7 +783,7 @@ void CGEEngine::qGame() { void CGEEngine::switchCave(int cav) { - if (cav != Now) { + if (cav != _now) { _heart->_enable = false; if (cav < 0) { SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint @@ -793,7 +791,7 @@ void CGEEngine::switchCave(int cav) { //SNPOST(SNEXEC, -1, 0, (void *)&QGame); // switch cave warning("SwitchCave() - SNPOST"); } else { - Now = cav; + _now = cav; _mouse->Off(); if (Hero) { Hero->park(); @@ -803,8 +801,8 @@ void CGEEngine::switchCave(int cav) { Vga->SpareQ->Show = STARTUP::Summa * (cav <= CAVE_MAX); /////-------------------------------------------------------- } - _cavLight->gotoxy(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, - CAVE_Y + ((Now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY); + _cavLight->gotoxy(CAVE_X + ((_now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, + CAVE_Y + ((_now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY); KillText(); if (! Startup) KeyClick(); @@ -913,7 +911,7 @@ void SYSTEM::touch(uint16 mask, int x, int y) { _sprite->step(x - '0'); break; case F10 : - if (Snail->Idle() && ! Hero->_flags._hide) + if (_snail->idle() && ! Hero->_flags._hide) _vm->startCountDown(); break; case 'J': @@ -939,9 +937,9 @@ void SYSTEM::touch(uint16 mask, int x, int y) { if (y >= WORLD_HIG) { if (x < BUTTON_X) { // select cave? if (y >= CAVE_Y && y < CAVE_Y + CAVE_NY * CAVE_DY && - x >= CAVE_X && x < CAVE_X + CAVE_NX * CAVE_DX && ! Game) { + x >= CAVE_X && x < CAVE_X + CAVE_NX * CAVE_DX && !_game) { cav = ((y - CAVE_Y) / CAVE_DY) * CAVE_NX + (x - CAVE_X) / CAVE_DX + 1; - if (cav > MaxCave) + if (cav > _maxCave) cav = 0; } else { cav = 0; @@ -950,7 +948,7 @@ void SYSTEM::touch(uint16 mask, int x, int y) { if (y >= POCKET_Y && y < POCKET_Y + POCKET_NY * POCKET_DY && x >= POCKET_X && x < POCKET_X + POCKET_NX * POCKET_DX) { int n = ((y - POCKET_Y) / POCKET_DY) * POCKET_NX + (x - POCKET_X) / POCKET_DX; - SelectPocket(n); + selectPocket(n); } } } @@ -958,7 +956,7 @@ void SYSTEM::touch(uint16 mask, int x, int y) { PostMiniStep(cav - 1); if (mask & L_UP) { - if (cav && Snail->Idle() && Hero->_tracePtr < 0) + if (cav && _snail->idle() && Hero->_tracePtr < 0) _vm->switchCave(cav); if (!_horzLine->_flags._hide) { @@ -970,8 +968,8 @@ void SYSTEM::touch(uint16 mask, int x, int y) { } } else { - if (! Talk && Snail->Idle() && Hero - && y >= MAP_TOP && y < MAP_TOP + MAP_HIG && ! Game) { + if (! Talk && _snail->idle() && Hero + && y >= MAP_TOP && y < MAP_TOP + MAP_HIG && !_game) { Hero->findWay(XZ(x, y)); } } @@ -983,7 +981,7 @@ void SYSTEM::touch(uint16 mask, int x, int y) { void SYSTEM::Tick(void) { if (! Startup) if (-- FunDel == 0) { KillText(); - if (Snail->Idle()) { + if (_snail->idle()) { if (PAIN) HeroCover(9); else if (STARTUP::Core >= CORE_MID) { @@ -1040,7 +1038,7 @@ static void SwitchMusic(void) { if (VMENU::Addr) SNPOST_(SNKILL, -1, 0, VMENU::Addr); else { - SNPOST_(SNSEQ, 122, (Music = false), NULL); + SNPOST_(SNSEQ, 122, (_music = false), NULL); //TODO Change the SNPOST message send to a special way to send function pointer // SNPOST(SNEXEC, -1, 0, (void *)&selectSound); warning("SwitchMusic() - SNPOST"); @@ -1049,12 +1047,12 @@ static void SwitchMusic(void) { if (STARTUP::Core < CORE_HIG) SNPOST(SNINF, -1, NOMUSIC_TEXT, NULL); else { - SNPOST_(SNSEQ, 122, (Music = ! Music), NULL); + SNPOST_(SNSEQ, 122, (_music = !_music), NULL); KeyClick(); } } - if (Music) - LoadMIDI(Now); + if (_music) + LoadMIDI(_now); else KillMIDI(); } @@ -1148,16 +1146,16 @@ static void SaveMapping() { { IoHand cf(progName(".TAB"), UPD); if (!cf._error) { - cf.seek((Now - 1) * sizeof(Cluster::_map)); + cf.seek((_now - 1) * sizeof(Cluster::_map)); cf.write((uint8 *) Cluster::_map, sizeof(Cluster::_map)); } } { IoHand cf(progName(".HXY"), WRI); if (!cf._error) { - HeroXY[Now - 1]._x = Hero->_x; - HeroXY[Now - 1]._y = Hero->_y; - cf.write((uint8 *) HeroXY, sizeof(HeroXY)); + _heroXY[_now - 1]._x = Hero->_x; + _heroXY[_now - 1]._y = Hero->_y; + cf.write((uint8 *) _heroXY, sizeof(_heroXY)); } } } @@ -1265,19 +1263,19 @@ void Sprite::touch(uint16 mask, int x, int y) { } if (_flags._syst) return; // cannot access system sprites - if (Game) if (mask & L_UP) { + if (_game) if (mask & L_UP) { mask &= ~L_UP; mask |= R_UP; } - if ((mask & R_UP) && Snail->Idle()) { + if ((mask & R_UP) && _snail->idle()) { Sprite *ps = (_pocLight->_seqPtr) ? _pocket[PocPtr] : NULL; if (ps) { if (_flags._kept || Hero->distance(this) < MAX_DISTANCE) { if (works(ps)) { - FeedSnail(ps, TAKE); + feedSnail(ps, TAKE); } else OffUse(); - SelectPocket(-1); + selectPocket(-1); } else TooFar(); } else { @@ -1287,8 +1285,8 @@ void Sprite::touch(uint16 mask, int x, int y) { if (Hero->distance(this) < MAX_DISTANCE) { /// if (_flags._port) { - if (FindPocket(NULL) < 0) - PocFul(); + if (findPocket(NULL) < 0) + pocFul(); else { SNPOST(SNREACH, -1, -1, this); SNPOST(SNKEEP, -1, -1, this); @@ -1296,10 +1294,10 @@ void Sprite::touch(uint16 mask, int x, int y) { } } else { if (_takePtr != NO_PTR) { - if (snList(TAKE)[_takePtr].Com == SNNEXT) + if (snList(TAKE)[_takePtr]._com == SNNEXT) OffUse(); else - FeedSnail(this, TAKE); + feedSnail(this, TAKE); } else OffUse(); } @@ -1309,12 +1307,12 @@ void Sprite::touch(uint16 mask, int x, int y) { } } } - if ((mask & L_UP) && Snail->Idle()) { + if ((mask & L_UP) && _snail->idle()) { if (_flags._kept) { int n; for (n = 0; n < POCKET_NX; n++) { if (_pocket[n] == this) { - SelectPocket(n); + selectPocket(n); break; } } @@ -1545,20 +1543,20 @@ void CGEEngine::mainLoop() { if (_isDemo) { // static uint32 tc = 0; - if (/* FIXME: TimerCount - tc >= ((182L * 6L) * 5L) && */ Talk == NULL && Snail->Idle()) { - if (Text->getText(DemoText)) { + if (/* FIXME: TimerCount - tc >= ((182L * 6L) * 5L) && */ Talk == NULL && _snail->idle()) { + if (Text->getText(_demoText)) { SNPOST(SNSOUND, -1, 4, NULL); // drumla - SNPOST(SNINF, -1, DemoText, NULL); + SNPOST(SNINF, -1, _demoText, NULL); SNPOST(SNLABEL, -1, -1, NULL); - if (Text->getText(++ DemoText) == NULL) - DemoText = DEMO_TEXT + 1; + if (Text->getText(++_demoText) == NULL) + _demoText = DEMO_TEXT + 1; } //FIXME: tc = TimerCount; } } Vga->Show(); - Snail_->RunCom(); - Snail->RunCom(); + _snail_->runCom(); + _snail->runCom(); // Game frame delay uint32 millis = g_system->getMillis(); @@ -1585,7 +1583,7 @@ void CGEEngine::loadUser() { loadGame(file); } else { loadScript(progName(INI_EXT)); - Music = true; + _music = true; CFile file = CFile(SVG0NAME, WRI); SaveGame(file); error("Ok [%s]", SVG0NAME); @@ -1620,7 +1618,7 @@ void CGEEngine::runGame() { _pocLight->_time = 1; _pocLight->_z = 120; Vga->ShowQ->Append(_pocLight); - SelectPocket(-1); + selectPocket(-1); // FIXME: Allow ScummVM to handle mouse display // Vga->ShowQ->Append(Mouse); @@ -1632,9 +1630,9 @@ void CGEEngine::runGame() { 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) + _sprite->step(_music); + SNPOST_(SNSEQ, -1, _music, _sprite); + if (!_music) KillMIDI(); if (Mini && INI_FILE::exist("MINI.SPR")) { @@ -1654,7 +1652,7 @@ void CGEEngine::runGame() { if (Hero) { ExpandSprite(Hero); - Hero->gotoxy(HeroXY[Now - 1]._x, HeroXY[Now - 1]._y); + Hero->gotoxy(_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) { @@ -1684,9 +1682,9 @@ void CGEEngine::runGame() { Startup = 0; - SNPOST(SNLEVEL, -1, OldLev, &_cavLight); - _cavLight->gotoxy(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, - CAVE_Y + ((Now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY); + SNPOST(SNLEVEL, -1, _oldLev, &_cavLight); + _cavLight->gotoxy(CAVE_X + ((_now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, + CAVE_Y + ((_now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY); caveUp(); _keyboard->setClient(Sys); @@ -1718,14 +1716,14 @@ 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), TAKE); // FIXME: Allow ScummVM to handle mouse display //Vga->ShowQ->Append(Mouse); _heart->_enable = true; _keyboard->setClient(Sys); - while (!Snail->Idle() && !_eventManager->_quitFlag) + while (!_snail->idle() && !_eventManager->_quitFlag) mainLoop(); _keyboard->setClient(NULL); @@ -1761,7 +1759,7 @@ bool CGEEngine::showTitle(const char *name) { Vga->Sunset(); Vga->CopyPage(1, 2); Vga->CopyPage(0, 1); - SelectPocket(-1); + selectPocket(-1); Vga->Sunrise(VGA::SysPal); if (STARTUP::Mode < 2 && !STARTUP::SoundOk) { @@ -1770,7 +1768,7 @@ bool CGEEngine::showTitle(const char *name) { Vga->ShowQ->Append(_mouse); _heart->_enable = true; _mouse->On(); - for (selectSound(); !Snail->Idle() || VMENU::Addr;) { + for (selectSound(); !_snail->idle() || VMENU::Addr;) { mainLoop(); if (_eventManager->_quitFlag) return false; @@ -1781,7 +1779,7 @@ bool CGEEngine::showTitle(const char *name) { Vga->ShowQ->Clear(); Vga->CopyPage(0, 2); STARTUP::SoundOk = 2; - if (Music) + if (_music) LoadMIDI(0); } @@ -1868,7 +1866,7 @@ void CGEEngine::cge_main(void) { //Debug( memset((void *) (-K(2)), 0, K(1)); ) //Debug( memset((void *) (-K(4)), 0, K(1)); ) - memset(Barriers, 0xFF, sizeof(Barriers)); + memset(_barriers, 0xFF, sizeof(_barriers)); if (!_mouse->Exist) error("%s", Text->getText(NO_MOUSE_TEXT)); @@ -1882,7 +1880,7 @@ void CGEEngine::cge_main(void) { //srand((uint16) Timer()); Sys = new SYSTEM(this); - if (Music && STARTUP::SoundOk) + if (_music && STARTUP::SoundOk) LoadMIDI(0); if (STARTUP::Mode < 2) movie(LGO_EXT); diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index 6920f7b2d3..5e3eb6bf1c 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -109,8 +109,8 @@ namespace CGE { #define SYSTIMERATE 6 // 12 Hz #define HEROFUN0 (40 * 12) #define HEROFUN1 ( 2 * 12) -#define PAIN (Flag[0]) -#define FINIS (Flag[3]) +#define PAIN (_flag[0]) +#define FINIS (_flag[3]) class SYSTEM : public Sprite { @@ -190,8 +190,8 @@ extern BMP_PTR MC[3]; extern BMP_PTR PR[2]; extern BMP_PTR SP[3]; extern BMP_PTR LI[5]; -extern SNAIL *Snail; -extern SNAIL *Snail_; +extern Snail *_snail; +extern Snail *_snail_; } // End of namespace CGE diff --git a/engines/cge/config.cpp b/engines/cge/config.cpp index 8110e1702f..4f5284b69b 100644 --- a/engines/cge/config.cpp +++ b/engines/cge/config.cpp @@ -143,7 +143,7 @@ static CHOICE BlsterDMA[] = { void CGEEngine::selectSound() { int i; - Sound.Close(); + _sound.Close(); if (VMENU::Addr) SNPOST_(SNKILL, -1, 0, VMENU::Addr); inf(Text->getText(STYPE_TEXT)); @@ -201,7 +201,7 @@ static void Select(CHOICE *cho, int hlp) { void CGEEngine::NONE() { SNDDrvInfo.DDEV = DEV_QUIET; SNDDrvInfo.MDEV = DEV_QUIET; - Sound.Open(); + _sound.Open(); } @@ -249,7 +249,7 @@ void CGEEngine::AUTO() { SNDDrvInfo.DDEV = DEV_AUTO; SNDDrvInfo.MDEV = DEV_AUTO; Reset(); - Sound.Open(); + _sound.Open(); } @@ -261,7 +261,7 @@ void CGEEngine::setPortD() { void CGEEngine::setPortM() { SNDDrvInfo.MBASE = xdeco(MIDIPorts[VMENU::Recent].Text); - Sound.Open(); + _sound.Open(); } @@ -276,7 +276,7 @@ void CGEEngine::setDMA() { if (SNDDrvInfo.MDEV != SNDDrvInfo.DDEV) Select(MIDIPorts, MPORT_TEXT); else - Sound.Open(); + _sound.Open(); } } // End of namespace CGE diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index b285278842..faff3ada57 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -93,7 +93,7 @@ Dac _stdPal[] = {// R G B { 255, 255, 255}, // 255 }; -DRVINFO SNDDrvInfo; +DrvInfo SNDDrvInfo; void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *)) { warning("STUB: _fqsort"); @@ -311,11 +311,11 @@ void SNDSetVolume() { warning("STUB: SNDSetVolume"); } -void SNDDigiStart(SMPINFO *PSmpInfo) { +void SNDDigiStart(SmpInfo *PSmpInfo) { warning("STUB: SNDDigitStart"); } -void SNDDigiStop(SMPINFO *PSmpInfo) { +void SNDDigiStop(SmpInfo *PSmpInfo) { warning("STUB: SNDDigiStop"); } diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 4bf6f72489..fbde5bd846 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -46,14 +46,13 @@ static void _disable() { warning("STUB: _disable"); } -int MaxCave = 0; +int _maxCave = 0; -SCB Scb = { NULL, 0, NULL }; -bool Flag[4]; -bool Dark = false; -bool Game = false; -int Now = 1; -int Lev = -1; +bool _flag[4]; +bool _dark = false; +bool _game = false; +int _now = 1; +int _lev = -1; extern Sprite *_pocLight; @@ -86,7 +85,7 @@ static void SNGame(Sprite *spr, int num) { dup[2] = Vga->ShowQ->Locate(16004); // pani } - if (Game) { // continue game + if (_game) { // continue game int i = new_random(3), hand = (dup[0]->_shpCnt == 6); Stage++; if (hand && Stage > DRESSED) @@ -131,7 +130,7 @@ static void SNGame(Sprite *spr, int num) { SNPOST(SNSEQ, -1, 0, dup[2]); // odstaw J† SNPOST(SNSETXY, -1, 182 + SCR_WID * 62, dup[2]); SNPOST(SNSETZ, -1, 9, dup[2]); - Game = 0; + _game = 0; return; } else { SNPOST(SNSEQ, -1, 2, dup[0]); // no @@ -152,9 +151,9 @@ static void SNGame(Sprite *spr, int num) { SNPOST(SNSEQ, 16040, 0, NULL); // schowaj plask SNPOST(SNWAIT, 16101, -1, NULL); // stoi SNPOST(SNUNCOVER, 1, 16101, NULL); // SDS - if (! Game) { + if (!_game) { SNPOST(SNSAY, buref, 16008, NULL); // zgadnij! - Game = true; + _game = true; } #undef STEPS #undef DRESSED @@ -172,9 +171,9 @@ static void SNGame(Sprite *spr, int num) { k3 = Vga->ShowQ->Locate(20703); } - if (! Game) { // init + if (!_game) { // init SNPOST(SNGAME, 20002, 2, NULL); - Game = true; + _game = true; } else { // cont k1->step(new_random(6)); k2->step(new_random(6)); @@ -203,7 +202,7 @@ static void SNGame(Sprite *spr, int num) { SNPOST(SNSEND, 20010, 20, NULL); // papier SNPOST(SNSOUND, 20010, 20003, NULL); // papier! SNPOST(SNSAY, 20001, 20005, NULL); - Game = false; + _game = false; return; } else k3->step(new_random(5)); @@ -285,7 +284,7 @@ void ContractSprite(Sprite *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) return i; @@ -293,10 +292,10 @@ int FindPocket(Sprite *spr) { } -void SelectPocket(int n) { +void selectPocket(int n) { if (n < 0 || (_pocLight->_seqPtr && PocPtr == n)) { _pocLight->step(0); - n = FindPocket(NULL); + n = findPocket(NULL); if (n >= 0) PocPtr = n; } else { @@ -309,7 +308,7 @@ void SelectPocket(int n) { } -void PocFul(void) { +void pocFul() { Hero->park(); SNPOST(SNWAIT, -1, -1, Hero); SNPOST(SNSEQ, -1, POC_FUL, Hero); @@ -333,38 +332,38 @@ 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; if (ptr != NO_PTR) { - SNAIL::COM *comtab = spr->snList(snq); - SNAIL::COM *c = comtab + ptr; - - if (FindPocket(NULL) < 0) { // no empty pockets? - SNAIL::COM *p; - for (p = c; p->Com != SNNEXT; p++) { // find KEEP command - if (p->Com == SNKEEP) { - PocFul(); + Snail::Com *comtab = spr->snList(snq); + Snail::Com *c = comtab + ptr; + + if (findPocket(NULL) < 0) { // no empty pockets? + Snail::Com *p; + for (p = c; p->_com != SNNEXT; p++) { // find KEEP command + if (p->_com == SNKEEP) { + pocFul(); return; } - if (p->Ptr) + if (p->_ptr) break; } } while (true) { - if (c->Com == SNTALK) { - if ((Snail->TalkEnable = (c->Val != 0)) == false) + if (c->_com == SNTALK) { + if ((_snail->_talkEnable = (c->_val != 0)) == false) KillText(); } - if (c->Com == SNNEXT) { - Sprite *s = (c->Ref < 0) ? spr : Locate(c->Ref); + if (c->_com == SNNEXT) { + Sprite *s = (c->_ref < 0) ? spr : Locate(c->_ref); if (s) { uint8 *idx = (snq == TAKE) ? &s->_takePtr : &s->_nearPtr; if (*idx != NO_PTR) { int v; - switch (c->Val) { + switch (c->_val) { case -1 : v = c - comtab + 1; break; @@ -375,7 +374,7 @@ void FeedSnail(Sprite *spr, SNLIST snq) { v = -1; break; default : - v = c->Val; + v = c->_val; break; } if (v >= 0) @@ -385,18 +384,18 @@ void FeedSnail(Sprite *spr, SNLIST snq) { if (s == spr) break; } - if (c->Com == SNIF) { - Sprite *s = (c->Ref < 0) ? spr : Locate(c->Ref); + if (c->_com == SNIF) { + Sprite *s = (c->_ref < 0) ? spr : Locate(c->_ref); if (s) { // sprite extsts if (! s->seqTest(-1)) - c = comtab + c->Val; // not parked + c = comtab + c->_val; // not parked else ++c; } else ++c; } else { - SNPOST(c->Com, c->Ref, c->Val, spr); - if (c->Ptr) + SNPOST(c->_com, c->_ref, c->_val, spr); + if (c->_ptr) break; else ++c; @@ -407,7 +406,7 @@ void FeedSnail(Sprite *spr, SNLIST snq) { } -const char *SNAIL::ComTxt[] = { +const char *Snail::_comTxt[] = { "LABEL", "PAUSE", "WAIT", "LEVEL", "HIDE", "SAY", "INF", "TIME", "CAVE", "KILL", "RSEQ", "SEQ", "SEND", "SWAP", "KEEP", @@ -422,28 +421,28 @@ const char *SNAIL::ComTxt[] = { }; -SNAIL::SNAIL(CGEEngine *vm, bool turbo) - : Turbo(turbo), Busy(false), TextDelay(false), - _timerExpiry(0), TalkEnable(true), - Head(0), Tail(0), SNList(farnew(COM, 256)), _vm(vm) { +Snail::Snail(CGEEngine *vm, bool turbo) + : _turbo(turbo), _busy(false), _textDelay(false), + _timerExpiry(0), _talkEnable(true), + _head(0), _tail(0), _snList(farnew(Com, 256)), _vm(vm) { } -SNAIL::~SNAIL(void) { - if (SNList) - free(SNList); +Snail::~Snail() { + if (_snList) + free(_snList); } -void SNAIL::AddCom(SNCOM com, int ref, int val, void *ptr) { +void Snail::addCom(SNCOM com, int ref, int val, void *ptr) { _disable(); - COM *snc = &SNList[Head++]; - snc->Com = com; - snc->Ref = ref; - snc->Val = val; - snc->Ptr = ptr; + Com *snc = &_snList[_head++]; + snc->_com = com; + snc->_ref = ref; + snc->_val = val; + snc->_ptr = ptr; if (com == SNCLEAR) { - Tail = Head; + _tail = _head; KillText(); _timerExpiry = 0; } @@ -451,22 +450,22 @@ void SNAIL::AddCom(SNCOM com, int ref, int val, void *ptr) { } -void SNAIL::InsCom(SNCOM com, int ref, int val, void *ptr) { - COM *snc; +void Snail::insCom(SNCOM com, int ref, int val, void *ptr) { + Com *snc; _disable(); - if (Busy) { - SNList[(Tail - 1) & 0xFF] = SNList[Tail]; - snc = &SNList[Tail]; + if (_busy) { + _snList[(_tail - 1) & 0xFF] = _snList[_tail]; + snc = &_snList[_tail]; } else - snc = &SNList[(Tail - 1) & 0xFF]; - --Tail; - snc->Com = com; - snc->Ref = ref; - snc->Val = val; - snc->Ptr = ptr; + snc = &_snList[(_tail - 1) & 0xFF]; + _tail--; + snc->_com = com; + snc->_ref = ref; + snc->_val = val; + snc->_ptr = ptr; if (com == SNCLEAR) { - Tail = Head; + _tail = _head; KillText(); _timerExpiry = 0; } @@ -559,13 +558,13 @@ void SNRSeq(Sprite *spr, int val) { void SNSend(Sprite *spr, int val) { if (spr) { int was = spr->_cave; - bool was1 = (was == 0 || was == Now); - bool val1 = (val == 0 || val == Now); + bool was1 = (was == 0 || was == _now); + bool val1 = (val == 0 || val == _now); spr->_cave = val; if (val1 != was1) { if (was1) { if (spr->_flags._kept) { - int n = FindPocket(spr); + int n = findPocket(spr); if (n >= 0) _pocket[n] = NULL; } @@ -591,15 +590,15 @@ void SNSwap(Sprite *spr, int xref) { if (spr && xspr) { int was = spr->_cave; int xwas = xspr->_cave; - bool was1 = (was == 0 || was == Now); - bool xwas1 = (xwas == 0 || xwas == Now); + bool was1 = (was == 0 || was == _now); + bool xwas1 = (xwas == 0 || xwas == _now); 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); + int n = findPocket(spr); if (n >= 0) _pocket[n] = xspr; xspr->_flags._kept = true; @@ -633,7 +632,7 @@ void SNCover(Sprite *spr, int xref) { Vga->ShowQ->Insert(Vga->ShowQ->Remove(spr->_prev), xspr); spr->_flags._shad = false; } - FeedSnail(xspr, NEAR); + feedSnail(xspr, NEAR); } } @@ -656,12 +655,12 @@ void SNUncover(Sprite *spr, Sprite *xspr) { void SNSetX0(int cav, int x0) { - HeroXY[cav - 1]._x = x0; + _heroXY[cav - 1]._x = x0; } void SNSetY0(int cav, int y0) { - HeroXY[cav - 1]._y = y0; + _heroXY[cav - 1]._y = y0; } @@ -740,7 +739,7 @@ void SNPort(Sprite *spr, int port) { void SNKill(Sprite *spr) { if (spr) { if (spr->_flags._kept) { - int n = FindPocket(spr); + int n = findPocket(spr); if (n >= 0) _pocket[n] = NULL; } @@ -765,15 +764,15 @@ void SNKill(Sprite *spr) { static void SNSound(Sprite *spr, int wav, int cnt) { if (SNDDrvInfo.DDEV) { if (wav == -1) - Sound.Stop(); + _sound.Stop(); else - Sound.Play(Fx[wav], (spr) ? ((spr->_x + spr->_w / 2) / (SCR_WID / 16)) : 8, cnt); + _sound.Play(_fx[wav], (spr) ? ((spr->_x + spr->_w / 2) / (SCR_WID / 16)) : 8, cnt); } } void SNKeep(Sprite *spr, int stp) { - SelectPocket(-1); + selectPocket(-1); if (spr && ! spr->_flags._kept && _pocket[PocPtr] == NULL) { SNSound(spr, 3, 1); _pocket[PocPtr] = spr; @@ -784,22 +783,22 @@ void SNKeep(Sprite *spr, int stp) { if (stp >= 0) spr->step(stp); } - SelectPocket(-1); + selectPocket(-1); } void SNGive(Sprite *spr, int stp) { if (spr) { - int p = FindPocket(spr); + int p = findPocket(spr); if (p >= 0) { _pocket[p] = NULL; - spr->_cave = Now; + spr->_cave = _now; spr->_flags._kept = false; if (stp >= 0) spr->step(stp); } } - SelectPocket(-1); + selectPocket(-1); } @@ -818,22 +817,22 @@ static void SNLevel(Sprite *spr, int lev) { #else static int maxcav[] = { 1, 8, 16, 23, 24 }; #endif - while (Lev < lev) { - ++Lev; - spr = Vga->SpareQ->Locate(100 + Lev); + while (_lev < lev) { + _lev++; + spr = Vga->SpareQ->Locate(100 + _lev); if (spr) { spr->backShow(true); spr->_cave = 0; } } - MaxCave = maxcav[Lev]; + _maxCave = maxcav[_lev]; if (spr) spr->_flags._hide = false; } static void SNFlag(int fn, bool v) { - Flag[fn] = v; + _flag[fn] = v; } @@ -861,7 +860,7 @@ void SNFlash(bool on) { } } else Vga->SetColors(VGA::SysPal, 64); - Dark = false; + _dark = false; } @@ -870,12 +869,12 @@ static void SNLight(bool in) { Vga->Sunrise(VGA::SysPal); else Vga->Sunset(); - Dark = ! in; + _dark = ! in; } static void SNBarrier(int cav, int bar, bool horz) { - ((uint8 *)(Barriers + ((cav > 0) ? cav : Now)))[horz] = bar; + ((uint8 *)(_barriers + ((cav > 0) ? cav : _now)))[horz] = bar; } @@ -903,15 +902,15 @@ static void SNMouse(bool on) { } -void SNAIL::RunCom(void) { +void Snail::runCom() { static int count = 1; - if (! Busy) { - Busy = true; - uint8 tmphea = Head; - while (Tail != tmphea) { - COM *snc = &SNList[Tail]; + if (!_busy) { + _busy = true; + uint8 tmphea = _head; + while (_tail != tmphea) { + Com *snc = &_snList[_tail]; - if (! Turbo) { // only for the slower one + if (!_turbo) { // only for the slower one if (_timerExpiry) { // Delay in progress if (_timerExpiry > g_system->getMillis()) @@ -921,150 +920,148 @@ void SNAIL::RunCom(void) { // Delay is finished _timerExpiry = 0; } else { - if (TextDelay) { + if (_textDelay) { KillText(); - TextDelay = false; + _textDelay = false; } } - if (Talk && snc->Com != SNPAUSE) + if (Talk && snc->_com != SNPAUSE) break; } - Sprite *sprel = ((snc->Ref >= 0) ? Locate(snc->Ref) : ((Sprite *) snc->Ptr)); - switch (snc->Com) { + Sprite *sprel = ((snc->_ref >= 0) ? Locate(snc->_ref) : ((Sprite *) snc->_ptr)); + switch (snc->_com) { case SNLABEL : break; case SNPAUSE : - _timerExpiry = g_system->getMillis() + snc->Val * SNAIL_FRAME_DELAY; + _timerExpiry = g_system->getMillis() + snc->_val * SNAIL_FRAME_DELAY; if (Talk) - TextDelay = true; + _textDelay = true; break; case SNWAIT : if (sprel) { - if (sprel->seqTest(snc->Val) && - (snc->Val >= 0 || sprel != Hero || Hero->_tracePtr < 0)) { + if (sprel->seqTest(snc->_val) && + (snc->_val >= 0 || sprel != Hero || Hero->_tracePtr < 0)) { _timerExpiry = g_system->getMillis() + sprel->_time * SNAIL_FRAME_DELAY; } else goto xit; } break; case SNLEVEL : - SNLevel(sprel, snc->Val); + SNLevel(sprel, snc->_val); break; case SNHIDE : - SNHide(sprel, snc->Val); + SNHide(sprel, snc->_val); break; case SNSAY : - if (sprel && TalkEnable) { + if (sprel && _talkEnable) { if (sprel == Hero && sprel->seqTest(-1)) sprel->step(HTALK); - Text->Say(Text->getText(snc->Val), sprel); + Text->Say(Text->getText(snc->_val), sprel); Sys->FunDel = HEROFUN0; } break; case SNINF : - if (TalkEnable) { - _vm->inf(Text->getText(snc->Val)); + if (_talkEnable) { + _vm->inf(Text->getText(snc->_val)); Sys->FunDel = HEROFUN0; } break; case SNTIME : - if (sprel && TalkEnable) { + if (sprel && _talkEnable) { if (sprel == Hero && sprel->seqTest(-1)) sprel->step(HTALK); SayTime(sprel); } break; case SNCAVE : - // SwitchCave(snc->Val); - warning("Problematic call of SwitchCave in SNAIL::RunCom"); + // SwitchCave(snc->_val); + warning("Problematic call of SwitchCave in SNAIL::runCom"); break; case SNKILL : SNKill(sprel); break; case SNSEQ : - SNSeq(sprel, snc->Val); + SNSeq(sprel, snc->_val); break; case SNRSEQ : - SNRSeq(sprel, snc->Val); + SNRSeq(sprel, snc->_val); break; case SNSEND : - SNSend(sprel, snc->Val); + SNSend(sprel, snc->_val); break; case SNSWAP : - SNSwap(sprel, snc->Val); + SNSwap(sprel, snc->_val); break; case SNCOVER : - SNCover(sprel, snc->Val); + 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); + SNKeep(sprel, snc->_val); break; case SNGIVE : - SNGive(sprel, snc->Val); + SNGive(sprel, snc->_val); break; case SNGAME : - SNGame(sprel, snc->Val); + SNGame(sprel, snc->_val); break; case SNSETX0 : - SNSetX0(snc->Ref, snc->Val); + SNSetX0(snc->_ref, snc->_val); break; case SNSETY0 : - SNSetY0(snc->Ref, snc->Val); + SNSetY0(snc->_ref, snc->_val); break; case SNSETXY : - SNSetXY(sprel, snc->Val); + SNSetXY(sprel, snc->_val); break; case SNRELX : - SNRelX(sprel, snc->Val); + SNRelX(sprel, snc->_val); break; case SNRELY : - SNRelY(sprel, snc->Val); + SNRelY(sprel, snc->_val); break; case SNRELZ : - SNRelZ(sprel, snc->Val); + SNRelZ(sprel, snc->_val); break; case SNSETX : - SNSetX(sprel, snc->Val); + SNSetX(sprel, snc->_val); break; case SNSETY : - SNSetY(sprel, snc->Val); + SNSetY(sprel, snc->_val); break; case SNSETZ : - SNSetZ(sprel, snc->Val); + SNSetZ(sprel, snc->_val); break; case SNSLAVE : - SNSlave(sprel, snc->Val); + SNSlave(sprel, snc->_val); break; case SNTRANS : - SNTrans(sprel, snc->Val); + SNTrans(sprel, snc->_val); break; case SNPORT : - SNPort(sprel, snc->Val); + SNPort(sprel, snc->_val); break; case SNNEXT : - break; case SNIF : - break; case SNTALK : break; case SNMOUSE : - SNMouse(snc->Val != 0); + SNMouse(snc->_val != 0); break; case SNNNEXT : - SNNNext(sprel, snc->Val); + SNNNext(sprel, snc->_val); break; case SNTNEXT : - SNTNext(sprel, snc->Val); + SNTNext(sprel, snc->_val); break; case SNRNNEXT : - SNRNNext(sprel, snc->Val); + SNRNNext(sprel, snc->_val); break; case SNRTNEXT : - SNRTNext(sprel, snc->Val); + SNRTNext(sprel, snc->_val); break; case SNRMNEAR : SNRmNear(sprel); @@ -1073,43 +1070,44 @@ void SNAIL::RunCom(void) { SNRmTake(sprel); break; case SNFLAG : - SNFlag(snc->Ref & 3, snc->Val != 0); + SNFlag(snc->_ref & 3, snc->_val != 0); break; case SNSETREF : - SNSetRef(sprel, snc->Val); + SNSetRef(sprel, snc->_val); break; case SNBACKPT : - SNBackPt(sprel, snc->Val); + SNBackPt(sprel, snc->_val); break; case SNFLASH : - SNFlash(snc->Val != 0); + SNFlash(snc->_val != 0); break; case SNLIGHT : - SNLight(snc->Val != 0); + SNLight(snc->_val != 0); break; case SNSETHB : - SNBarrier(snc->Ref, snc->Val, true); + SNBarrier(snc->_ref, snc->_val, true); break; case SNSETVB : - SNBarrier(snc->Ref, snc->Val, false); + SNBarrier(snc->_ref, snc->_val, false); break; case SNWALK : - SNWalk(sprel, snc->Ref, snc->Val); + SNWalk(sprel, snc->_ref, snc->_val); break; case SNREACH : - SNReach(sprel, snc->Val); + SNReach(sprel, snc->_val); break; case SNSOUND : - SNSound(sprel, snc->Val, count); + SNSound(sprel, snc->_val, count); count = 1; break; case SNCOUNT : - count = snc->Val; + count = snc->_val; break; case SNEXEC : // TODO: Handle correctly the execution of function pointer coming from Message send SNPOST - // ((void(*)(int)) (snc->Ptr))(snc->Val); break; + // ((void(*)(int)) (snc->_ptr))(snc->_val); warning("STUB: SNEXEC code"); + break; case SNSTEP : sprel->step(); break; @@ -1117,24 +1115,24 @@ void SNAIL::RunCom(void) { SNZTrim(sprel); break; case SNGHOST : - SNGhost((Bitmap *) snc->Ptr); + SNGhost((Bitmap *) snc->_ptr); break; default : - warning("Unhandled snc->Com in SNMouse(bool)"); + warning("Unhandled snc->_com in SNMouse(bool)"); break; } - Tail++; - if (!Turbo) + _tail++; + if (!_turbo) break; } xit: - Busy = false; + _busy = false; } } -bool SNAIL::Idle(void) { - return (Head == Tail); +bool Snail::idle() { + return (_head == _tail); } } // End of namespace CGE diff --git a/engines/cge/snail.h b/engines/cge/snail.h index 54a24ac1a9..2e06149526 100644 --- a/engines/cge/snail.h +++ b/engines/cge/snail.h @@ -43,22 +43,16 @@ namespace CGE { #define POCKET_SX 8 #define POCKET_SY 3 -#define SNINSERT(c,r,v,p) Snail->InsCom(c,r,v,p) -#define SNPOST(c,r,v,p) Snail->AddCom(c,r,v,p) -#define SNPOST_(c,r,v,p) Snail_->AddCom(c,r,v,p) +#define SNINSERT(c, r, v, p) _snail->insCom(c, r, v, p) +#define SNPOST(c, r, v, p) _snail->addCom(c, r, v, p) +#define SNPOST_(c, r, v, p) _snail_->addCom(c, r, v, p) #define SNAIL_FRAME_RATE 62 #define SNAIL_FRAME_DELAY (1000 / SNAIL_FRAME_RATE) -typedef struct { - uint8 Horz, Vert; -} BAR; - - -struct SCB { - uint8 *Ptr; - uint16 Siz; - SCB *Nxt; +struct Bar { + uint8 _horz; + uint8 _vert; }; @@ -79,49 +73,49 @@ enum SNCOM { enum SNLIST { NEAR, TAKE }; -class SNAIL { +class Snail { public: - struct COM { - SNCOM Com; - int Ref; - int Val; - void *Ptr; - } *SNList; - uint8 Head, Tail; - bool Turbo, Busy, TextDelay; + struct Com { + SNCOM _com; + int _ref; + int _val; + void *_ptr; + } *_snList; + uint8 _head; + uint8 _tail; + bool _turbo; + bool _busy; + bool _textDelay; uint32 _timerExpiry; - static const char *ComTxt[]; - bool TalkEnable; - SNAIL(CGEEngine *vm, bool turbo = false); - ~SNAIL(); - void RunCom(void); - void AddCom(SNCOM com, int ref = 0, int val = 0, void *ptr = NULL); - void InsCom(SNCOM com, int ref = 0, int val = 0, void *ptr = NULL); - bool Idle(void); + static const char *_comTxt[]; + bool _talkEnable; + Snail(CGEEngine *vm, bool turbo); + ~Snail(); + void runCom(); + void addCom(SNCOM com, int ref, int val, void *ptr); + void insCom(SNCOM com, int ref, int val, void *ptr); + bool idle(); private: CGEEngine *_vm; }; -void SelectPocket(int n); -void PocFul(void); +void selectPocket(int n); +void pocFul(); -extern SCB Scb; -extern bool Flag[4]; -extern bool Game; -extern bool Dark; -//extern SNAIL *Snail; -//extern SNAIL *Snail_; -extern int Now; -extern int Lev; -extern int MaxCave; -extern int PocPtr; -extern BAR Barriers[]; -extern struct HXY { +extern bool _flag[4]; +extern bool _game; +extern bool _dark; +extern int _now; +extern int _lev; +extern int _maxCave; +extern int _pocPtr; +extern Bar _barriers[]; +extern struct Hxy { int _x; int _y; -} HeroXY[]; +} _heroXY[]; } // End of namespace CGE diff --git a/engines/cge/snddrv.h b/engines/cge/snddrv.h index 4cdac383be..78d1434b40 100644 --- a/engines/cge/snddrv.h +++ b/engines/cge/snddrv.h @@ -56,7 +56,7 @@ enum DEV_TYPE { DEV_AUTO = -1, // auto-detect mode #define SERR_BADDDEV 128 // bad device // driver info -struct DRVINFO { +struct DrvInfo { DEV_TYPE DDEV; // digi device DEV_TYPE MDEV; // midi device uint16 DBASE; // digi base port @@ -78,7 +78,7 @@ struct DRVINFO { }; // sample info -struct SMPINFO { +struct SmpInfo { uint8 *saddr; // address uint16 slen; // length uint16 span; // left/right pan (0-15) @@ -89,7 +89,7 @@ struct SMPINFO { // * Data * // ****************************************************** // driver info -extern DRVINFO SNDDrvInfo; +extern DrvInfo SNDDrvInfo; // midi player flag (1 means we are playing) extern uint16 MIDIPlayFlag; @@ -110,10 +110,10 @@ void SNDDone(); void SNDSetVolume(); // Start Digi -void SNDDigiStart(SMPINFO *PSmpInfo); +void SNDDigiStart(SmpInfo *PSmpInfo); // Stop Digi -void SNDDigiStop(SMPINFO *PSmpInfo); +void SNDDigiStop(SmpInfo *PSmpInfo); // Start MIDI File void SNDMIDIStart(uint8 *MIDFile); diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index 75adf3868a..60af9f7016 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -35,9 +35,9 @@ namespace CGE { -bool Music = true; -FX Fx = 16; // must precede SOUND!! -SOUND Sound; +bool _music = true; +FX _fx = 16; // must precede SOUND!! +SOUND _sound; SOUND::SOUND(void) { @@ -59,7 +59,7 @@ void SOUND::Close(void) { void SOUND::Open(void) { SNDInit(); - Play(Fx[30000], 8); + Play(_fx[30000], 8); } diff --git a/engines/cge/sound.h b/engines/cge/sound.h index 743fba0bb6..55dd1615cc 100644 --- a/engines/cge/sound.h +++ b/engines/cge/sound.h @@ -39,7 +39,7 @@ namespace CGE { class SOUND { public: - SMPINFO smpinf; + SmpInfo smpinf; SOUND(void); ~SOUND(void); void Open(void); @@ -68,13 +68,13 @@ public: }; -extern bool Music; -extern SOUND Sound; -extern FX Fx; +extern bool _music; +extern SOUND _sound; +extern FX _fx; void LoadMIDI(int ref); -void KillMIDI(void); +void KillMIDI(); } // End of namespace CGE diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 83c89892ca..484d7118ef 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -251,7 +251,7 @@ extern "C" void TimerProc() { } for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) { if (spr->Time) { - if (!spr->Flags.Hide) { + if (!spr->_flags.Hide) { if (-- spr->Time == 0) spr->Tick(); } @@ -326,7 +326,7 @@ void Engine_::newTimer(...) { for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) { if (spr->Time) { - if (!spr->Flags.Hide) { + if (!spr->_flags.Hide) { if (--spr->Time == 0) spr->Tick(); } @@ -427,11 +427,11 @@ void Sprite::moveShapes(uint8 *buf) { bool Sprite::works(Sprite *spr) { if (spr) if (spr->_ext) { - SNAIL::COM *c = spr->_ext->_take; + Snail::Com *c = spr->_ext->_take; if (c != NULL) { c += spr->_takePtr; - if (c->Ref == _ref) - if (c->Com != SNLABEL || (c->Val == 0 || c->Val == Now)) + if (c->_ref == _ref) + if (c->_com != SNLABEL || (c->_val == 0 || c->_val == _now)) return true; } } @@ -460,7 +460,7 @@ 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; @@ -493,7 +493,7 @@ Sprite *Sprite::expand() { 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]; + BMP_PTR *shplist = new BMP_PTR[_shpCnt + 1]; Seq *seq = NULL; int shpcnt = 0, seqcnt = 0, @@ -502,8 +502,8 @@ Sprite *Sprite::expand() { maxnow = 0, maxnxt = 0; - SNAIL::COM *nea = NULL; - SNAIL::COM *tak = NULL; + Snail::Com *nea = NULL; + Snail::Com *tak = NULL; mergeExt(fname, _file, SPR_EXT); if (INI_FILE::exist(fname)) { // sprite description file exist INI_FILE sprf(fname); @@ -552,32 +552,32 @@ Sprite *Sprite::expand() { } case 3 : { // Near if (_nearPtr != NO_PTR) { - nea = (SNAIL::COM *) realloc(nea, (neacnt + 1) * sizeof(*nea)); + nea = (Snail::Com *) realloc(nea, (neacnt + 1) * sizeof(*nea)); if (nea == NULL) error("No core [%s]", fname); else { - SNAIL::COM *c = &nea[neacnt++]; - if ((c->Com = (SNCOM) takeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0) + Snail::Com *c = &nea[neacnt++]; + if ((c->_com = (SNCOM)takeEnum(Snail::_comTxt, strtok(NULL, " \t,;/"))) < 0) error("%s [%s]", (const char*)NumStr("Bad NEAR in ######", lcnt), (const char*)fname); - c->Ref = atoi(strtok(NULL, " \t,;/")); - c->Val = atoi(strtok(NULL, " \t,;/")); - c->Ptr = NULL; + c->_ref = atoi(strtok(NULL, " \t,;/")); + c->_val = atoi(strtok(NULL, " \t,;/")); + c->_ptr = NULL; } } } break; case 4 : { // Take if (_takePtr != NO_PTR) { - tak = (SNAIL::COM *) realloc(tak, (takcnt + 1) * sizeof(*tak)); + tak = (Snail::Com *) realloc(tak, (takcnt + 1) * sizeof(*tak)); if (tak == NULL) error("No core [%s]", fname); else { - SNAIL::COM *c = &tak[takcnt++]; - if ((c->Com = (SNCOM) takeEnum(SNAIL::ComTxt, strtok(NULL, " \t,;/"))) < 0) + Snail::Com *c = &tak[takcnt++]; + if ((c->_com = (SNCOM)takeEnum(Snail::_comTxt, strtok(NULL, " \t,;/"))) < 0) error("%s [%s]", NumStr("Bad NEAR in ######", lcnt), (const char *)fname); - c->Ref = atoi(strtok(NULL, " \t,;/")); - c->Val = atoi(strtok(NULL, " \t,;/")); - c->Ptr = NULL; + c->_ref = atoi(strtok(NULL, " \t,;/")); + c->_val = atoi(strtok(NULL, " \t,;/")); + c->_ptr = NULL; } } break; @@ -601,11 +601,11 @@ Sprite *Sprite::expand() { 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; } diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 152f608c56..8bc24bc9fb 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -154,7 +154,7 @@ public: BMP_PTR *_shpList; Seq *_seq; char *_name; - SNAIL::COM *_near, *_take; + Snail::Com *_near, *_take; SprExt() : _x0(0), _y0(0), _x1(0), _y1(0), @@ -229,7 +229,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(); private: -- cgit v1.2.3