diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cge/cge.cpp | 20 | ||||
-rw-r--r-- | engines/cge/cge_main.cpp | 278 | ||||
-rw-r--r-- | engines/cge/cge_main.h | 6 | ||||
-rw-r--r-- | engines/cge/config.cpp | 74 | ||||
-rw-r--r-- | engines/cge/events.cpp | 6 | ||||
-rw-r--r-- | engines/cge/game.cpp | 8 | ||||
-rw-r--r-- | engines/cge/jbw.h | 4 | ||||
-rw-r--r-- | engines/cge/mixer.cpp | 6 | ||||
-rw-r--r-- | engines/cge/snail.cpp | 112 | ||||
-rw-r--r-- | engines/cge/text.cpp | 6 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 198 | ||||
-rw-r--r-- | engines/cge/vga13h.h | 87 | ||||
-rw-r--r-- | engines/cge/vmenu.cpp | 58 | ||||
-rw-r--r-- | engines/cge/vmenu.h | 26 | ||||
-rw-r--r-- | engines/cge/vol.cpp | 34 | ||||
-rw-r--r-- | engines/cge/vol.h | 24 |
16 files changed, 474 insertions, 473 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 6eae8f3c0e..0487441517 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -58,17 +58,17 @@ void CGEEngine::setup() { _console = new CGEConsole(this); // Initialise classes that have static members - VGA::init(); - VFILE::init(); + Vga::init(); + VFile::init(); Bitmap::init(); Talk::init(); // Initialise engine objects _text = new Text(this, progName(), 128); - Vga = new VGA(M13H); + _vga = new Vga(M13H); _heart = new Heart; - Hero = new WALK(this, NULL); - Sys = new SYSTEM(this); + _hero = new WALK(this, NULL); + _sys = new SYSTEM(this); _pocLight = new Sprite(this, LI); for (int i = 0; i < POCKET_NX; i++) _pocket[i] = new Sprite(this, NULL); @@ -111,8 +111,8 @@ CGEEngine::~CGEEngine() { // Call classes with static members to clear them up Talk::deinit(); Bitmap::deinit(); - VFILE::deinit(); - VGA::deinit(); + VFile::deinit(); + Vga::deinit(); // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); @@ -147,9 +147,9 @@ CGEEngine::~CGEEngine() { delete _pocket[i]; delete _snail; delete _snail_; - delete Hero; - delete Vga; - delete Sys; + delete _hero; + delete _vga; + delete _sys; } Common::Error CGEEngine::run() { diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index a2209e72e9..2caa9e0a98 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -55,10 +55,10 @@ namespace CGE { uint16 _stklen = (STACK_SIZ * 2); -VGA *Vga; +Vga *_vga; Heart *_heart; -WALK *Hero; -SYSTEM *Sys; +WALK *_hero; +SYSTEM *_sys; Sprite *_pocLight; EventManager *_eventManager; Keyboard *_keyboard; @@ -252,12 +252,12 @@ void CGEEngine::loadGame(XFile &file, bool tiny = false) { if (spr == NULL) error("No core"); *spr = S; - Vga->_spareQ->append(spr); + _vga->_spareQ->append(spr); } for (i = 0; i < POCKET_NX; i++) { register int r = _pocref[i]; - _pocket[i] = (r < 0) ? NULL : Vga->_spareQ->locate(r); + _pocket[i] = (r < 0) ? NULL : _vga->_spareQ->locate(r); } } } @@ -291,7 +291,7 @@ static void SaveGame(XFile &file) { file.write((uint8 *) & (i = SVGCHKSUM), sizeof(i)); - for (spr = Vga->_spareQ->first(); spr; spr = spr->_next) + for (spr = _vga->_spareQ->first(); spr; spr = spr->_next) if (spr->_ref >= 1000) if (!file._error) file.write((uint8 *)spr, sizeof(*spr)); @@ -304,12 +304,12 @@ static void HeroCover(int cvr) { static void trouble(int seq, int txt) { - Hero->park(); - SNPOST(SNWAIT, -1, -1, Hero); - SNPOST(SNSEQ, -1, seq, Hero); - SNPOST(SNSOUND, -1, 2, Hero); - SNPOST(SNWAIT, -1, -1, Hero); - SNPOST(SNSAY, 1, txt, Hero); + _hero->park(); + SNPOST(SNWAIT, -1, -1, _hero); + SNPOST(SNSEQ, -1, seq, _hero); + SNPOST(SNSOUND, -1, 2, _hero); + SNPOST(SNWAIT, -1, -1, _hero); + SNPOST(SNSAY, 1, txt, _hero); } @@ -366,8 +366,8 @@ void WALK::tick() { if (Dir != NO_DIR) { Sprite *spr; - Sys->FunTouch(); - for (spr = Vga->_showQ->first(); spr; spr = spr->_next) { + _sys->FunTouch(); + for (spr = _vga->_showQ->first(); spr; spr = spr->_next) { if (distance(spr) < 2) { if (!spr->_flags._near) { feedSnail(spr, NEAR); @@ -495,7 +495,7 @@ bool WALK::lower(Sprite *spr) { void WALK::reach(Sprite *spr, int mode) { if (spr) { - Hero->findWay(spr); + _hero->findWay(spr); if (mode < 0) { mode = spr->_flags._east; if (lower(spr)) @@ -506,7 +506,7 @@ void WALK::reach(Sprite *spr, int mode) { SNINSERT(SNPAUSE, -1, 64, NULL); SNINSERT(SNSEQ, -1, TSEQ + mode, this); if (spr) { - SNINSERT(SNWAIT, -1, -1, Hero); /////--------$$$$$$$ + SNINSERT(SNWAIT, -1, -1, _hero); /////--------$$$$$$$ //SNINSERT(SNWALK, -1, -1, spr); } // sequence is not finished, @@ -548,12 +548,12 @@ void CGEEngine::setMapBrick(int x, int z) { wtom(z, n + 3, 10, 2); Cluster::_map[z][x] = 1; s->setName(n); - Vga->_showQ->insert(s, Vga->_showQ->first()); + _vga->_showQ->insert(s, _vga->_showQ->first()); } } static void SwitchColorMode(void); -static void SwitchDebug(void); +static void switchDebug(); static void SwitchMusic(void); static void KillSprite(void); static void PushSprite(void); @@ -573,20 +573,20 @@ void CGEEngine::resetQSwitch() { void CGEEngine::quit() { - static CHOICE QuitMenu[] = { + static Choice QuitMenu[] = { { NULL, &CGEEngine::startCountDown }, { NULL, &CGEEngine::resetQSwitch }, { NULL, &CGEEngine::dummy } }; - if (_snail->idle() && ! Hero->_flags._hide) { - if (VMENU::Addr) { - SNPOST_(SNKILL, -1, 0, VMENU::Addr); + if (_snail->idle() && !_hero->_flags._hide) { + if (Vmenu::_addr) { + SNPOST_(SNKILL, -1, 0, Vmenu::_addr); resetQSwitch(); } else { - QuitMenu[0].Text = _text->getText(QUIT_TEXT); - QuitMenu[1].Text = _text->getText(NOQUIT_TEXT); - (new VMENU(this, QuitMenu, -1, -1))->setName(_text->getText(QUIT_TITLE)); + QuitMenu[0]._text = _text->getText(QUIT_TEXT); + QuitMenu[1]._text = _text->getText(NOQUIT_TEXT); + (new Vmenu(this, QuitMenu, -1, -1))->setName(_text->getText(QUIT_TITLE)); SNPOST_(SNSEQ, 123, 1, NULL); KeyClick(); } @@ -595,7 +595,7 @@ void CGEEngine::quit() { static void AltCtrlDel() { - SNPOST_(SNSAY, -1, A_C_D_TEXT, Hero); + SNPOST_(SNSAY, -1, A_C_D_TEXT, _hero); } // Used in stubbed function, do not remove! @@ -622,7 +622,7 @@ static void PostMiniStep(int stp) { void SYSTEM::SetPal(void) { uint i; - Dac *p = VGA::SysPal + 256 - ArrayCount(_stdPal); + Dac *p = Vga::_sysPal + 256 - ArrayCount(_stdPal); for (i = 0; i < ArrayCount(_stdPal); i++) { p[i]._r = _stdPal[i]._r >> 2; p[i]._g = _stdPal[i]._g >> 2; @@ -639,14 +639,14 @@ 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; + Bitmap::_pal = Vga::_sysPal; spr->expand(); Bitmap::_pal = NULL; spr->show(2); - Vga->CopyPage(1, 2); - Sys->SetPal(); + _vga->copyPage(1, 2); + _sys->SetPal(); spr->contract(); } } @@ -660,7 +660,7 @@ static void caveUp() { 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) @@ -679,33 +679,33 @@ static void caveUp() { _fx.Preload(BakRef); } - if (Hero) { - Hero->gotoxy(_heroXY[_now - 1]._x, _heroXY[_now - 1]._y); + if (_hero) { + _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; + _hero->tick(); + _hero->_time = 1; + _hero->_flags._hide = false; } if (!_dark) - Vga->Sunset(); + _vga->sunset(); - Vga->CopyPage(0, 1); + _vga->copyPage(0, 1); selectPocket(-1); - if (Hero) - Vga->_showQ->insert(Vga->_showQ->remove(Hero)); + 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; + _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(); - Vga->CopyPage(1, 0); - Vga->Show(); - Vga->Sunrise(VGA::SysPal); + feedSnail(_vga->_showQ->locate(BakRef + 999), TAKE); + _vga->show(); + _vga->copyPage(1, 0); + _vga->show(); + _vga->sunrise(Vga::_sysPal); _dark = false; if (!_startup) _mouse->On(); @@ -719,12 +719,12 @@ void CGEEngine::caveDown() { if (!_horzLine->_flags._hide) switchMapping(); - for (spr = Vga->_showQ->first(); spr;) { + for (spr = _vga->_showQ->first(); spr;) { Sprite *n = spr->_next; if (spr->_ref >= 1000 /*&& spr->_cave*/) { if (spr->_ref % 1000 == 999) feedSnail(spr, TAKE); - Vga->_spareQ->append(Vga->_showQ->remove(spr)); + _vga->_spareQ->append(_vga->_showQ->remove(spr)); } spr = n; } @@ -744,7 +744,7 @@ void CGEEngine::qGame() { SaveSound(); CFile file = CFile(usrPath(_usrFnam), WRI, RCrypt); SaveGame(file); - Vga->Sunset(); + _vga->sunset(); _finis = true; } @@ -760,12 +760,12 @@ void CGEEngine::switchCave(int cav) { } else { _now = cav; _mouse->Off(); - if (Hero) { - Hero->park(); - Hero->step(0); + if (_hero) { + _hero->park(); + _hero->step(0); if (!_isDemo) ///// protection: auto-destruction on! ---------------------- - Vga->_spareQ->_show = Startup::_summa * (cav <= CAVE_MAX); + _vga->_spareQ->_show = Startup::_summa * (cav <= CAVE_MAX); /////-------------------------------------------------------- } _cavLight->gotoxy(CAVE_X + ((_now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, @@ -810,7 +810,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 @@ -833,28 +833,28 @@ void SYSTEM::touch(uint16 mask, int x, int y) { _vm->switchMapping(); break; case F1: - SwitchDebug(); + switchDebug(); break; case F3: - Hero->step(TSEQ + 4); + _hero->step(TSEQ + 4); break; case F4: - Hero->step(TSEQ + 5); + _hero->step(TSEQ + 5); break; case F5: - Hero->step(TSEQ + 0); + _hero->step(TSEQ + 0); break; case F6: - Hero->step(TSEQ + 1); + _hero->step(TSEQ + 1); break; case F7: - Hero->step(TSEQ + 2); + _hero->step(TSEQ + 2); break; case F8: - Hero->step(TSEQ + 3); + _hero->step(TSEQ + 3); break; case F9: - Sys->FunDel = 1; + _sys->FunDel = 1; break; case 'X': if (_keyboard->_key[ALT]) @@ -878,16 +878,16 @@ 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': if (pp == 0) - ++pp; + pp++; break; case 'B': if (pp == 1) - ++pp; + pp++; break; case 'W': if (pp == 2) @@ -923,7 +923,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) { @@ -935,9 +935,9 @@ void SYSTEM::touch(uint16 mask, int x, int y) { } } else { - if (!_talk && _snail->idle() && Hero + if (!_talk && _snail->idle() && _hero && y >= MAP_TOP && y < MAP_TOP + MAP_HIG && !_game) { - Hero->findWay(XZ(x, y)); + _hero->findWay(XZ(x, y)); } } } @@ -955,7 +955,7 @@ void SYSTEM::Tick(void) { else if (Startup::_core >= CORE_MID) { int n = new_random(100); if (n > 96) - HeroCover(6 + (Hero->_x + Hero->_w / 2 < SCR_WID / 2)); + HeroCover(6 + (_hero->_x + _hero->_w / 2 < SCR_WID / 2)); else { if (n > 90) HeroCover(5); @@ -994,17 +994,17 @@ static void SpkClose(void) { static void SwitchColorMode(void) { - SNPOST_(SNSEQ, 121, Vga->Mono = !Vga->Mono, NULL); + SNPOST_(SNSEQ, 121, _vga->_mono = !_vga->_mono, NULL); KeyClick(); - Vga->SetColors(VGA::SysPal, 64); + _vga->setColors(Vga::_sysPal, 64); } static void SwitchMusic(void) { if (_keyboard->_key[ALT]) { - if (VMENU::Addr) - SNPOST_(SNKILL, -1, 0, VMENU::Addr); + if (Vmenu::_addr) + SNPOST_(SNKILL, -1, 0, Vmenu::_addr); else { SNPOST_(SNSEQ, 122, (_music = false), NULL); //TODO Change the SNPOST message send to a special way to send function pointer @@ -1042,7 +1042,7 @@ void CGEEngine::takeName() { tn->center(); tn->gotoxy(tn->_x, tn->_y - 10); tn->_z = 126; - Vga->_showQ->insert(tn); + _vga->_showQ->insert(tn); } } } @@ -1060,7 +1060,7 @@ void CGEEngine::switchMapping() { } } else { Sprite *s; - for (s = Vga->_showQ->first(); s; s = s->_next) + for (s = _vga->_showQ->first(); s; s = s->_next) if (s->_w == MAP_XGRID && s->_h == MAP_ZGRID) SNPOST_(SNKILL, -1, 0, s); } @@ -1079,7 +1079,7 @@ static void KillSprite(void) { static void PushSprite(void) { Sprite *spr = _sprite->_prev; if (spr) { - Vga->_showQ->insert(Vga->_showQ->remove(_sprite), spr); + _vga->_showQ->insert(_vga->_showQ->remove(_sprite), spr); while (_sprite->_z > _sprite->_next->_z) _sprite->_z--; } else @@ -1096,7 +1096,7 @@ static void PullSprite(void) { ok = (!spr->_flags._slav); } if (ok) { - Vga->_showQ->insert(Vga->_showQ->remove(_sprite), spr); + _vga->_showQ->insert(_vga->_showQ->remove(_sprite), spr); if (_sprite->_prev) while (_sprite->_z < _sprite->_prev->_z) _sprite->_z++; @@ -1121,8 +1121,8 @@ static void SaveMapping() { { IoHand cf(progName(".HXY"), WRI); if (!cf._error) { - _heroXY[_now - 1]._x = Hero->_x; - _heroXY[_now - 1]._y = Hero->_y; + _heroXY[_now - 1]._x = _hero->_x; + _heroXY[_now - 1]._y = _hero->_y; cf.write((uint8 *) _heroXY, sizeof(_heroXY)); } } @@ -1156,7 +1156,7 @@ static void sayDebug() { if (t1 - t >= 18) { static uint32 old = 0L; - uint32 now = Vga->FrmCnt; + uint32 now = _vga->_frmCnt; dwtom(now - old, FRPS, 10, 4); old = now; t = t1; @@ -1170,7 +1170,7 @@ static void sayDebug() { // sprite queue size uint16 n = 0; Sprite *spr; - for (spr = Vga->_showQ->first(); spr; spr = spr->_next) { + for (spr = _vga->_showQ->first(); spr; spr = spr->_next) { ++ n; if (spr == _sprite) { *XSPR = ' '; @@ -1190,7 +1190,7 @@ static void sayDebug() { } -static void SwitchDebug(void) { +static void switchDebug() { _debugLine->_flags._hide = !_debugLine->_flags._hide; } @@ -1220,7 +1220,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) { #pragma argsused void Sprite::touch(uint16 mask, int x, int y) { - Sys->FunTouch(); + _sys->FunTouch(); if ((mask & ATTN) == 0) { _infoLine->update(name()); if (mask & (R_DN | L_DN)) @@ -1238,7 +1238,7 @@ void Sprite::touch(uint16 mask, int x, int y) { if ((mask & R_UP) && _snail->idle()) { Sprite *ps = (_pocLight->_seqPtr) ? _pocket[_pocPtr] : NULL; if (ps) { - if (_flags._kept || Hero->distance(this) < MAX_DISTANCE) { + if (_flags._kept || _hero->distance(this) < MAX_DISTANCE) { if (works(ps)) { feedSnail(ps, TAKE); } else @@ -1250,7 +1250,7 @@ void Sprite::touch(uint16 mask, int x, int y) { if (_flags._kept) mask |= L_UP; else { - if (Hero->distance(this) < MAX_DISTANCE) { + if (_hero->distance(this) < MAX_DISTANCE) { /// if (_flags._port) { if (findPocket(NULL) < 0) @@ -1369,9 +1369,9 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int WALK *w = new WALK(this, NULL); if (w && ref == 1) { w->gotoxy(col, row); - if (Hero) + if (_hero) error("2nd HERO [%s]", fname); - Hero = w; + _hero = w; } _sprite = w; break; @@ -1440,7 +1440,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int *p = '\0'; _sprite->_shpCnt = shpcnt; - Vga->_spareQ->append(_sprite); + _vga->_spareQ->append(_sprite); } } @@ -1522,7 +1522,7 @@ void CGEEngine::mainLoop() { //FIXME: tc = TimerCount; } } - Vga->Show(); + _vga->show(); _snail_->runCom(); _snail->runCom(); @@ -1543,7 +1543,7 @@ void CGEEngine::mainLoop() { } void CGEEngine::tick() { - for (Sprite *spr = Vga->_showQ->first(); spr; spr = spr->_next) { + for (Sprite *spr = _vga->_showQ->first(); spr; spr = spr->_next) { if (spr->_time) { if (!spr->_flags._hide) { if (--spr->_time == 0) @@ -1583,7 +1583,7 @@ void CGEEngine::runGame() { loadHeroXY(); _cavLight->_flags._tran = true; - Vga->_showQ->append(_cavLight); + _vga->_showQ->append(_cavLight); _cavLight->_flags._hide = true; static Seq pocSeq[] = { { 0, 0, 0, 0, 20 }, @@ -1598,7 +1598,7 @@ void CGEEngine::runGame() { _pocLight->_flags._tran = true; _pocLight->_time = 1; _pocLight->_z = 120; - Vga->_showQ->append(_pocLight); + _vga->_showQ->append(_pocLight); selectPocket(-1); // FIXME: Allow ScummVM to handle mouse display @@ -1608,9 +1608,9 @@ void CGEEngine::runGame() { loadUser(); // ~~~~~~~~~~~ - if ((_sprite = Vga->_spareQ->locate(121)) != NULL) - SNPOST_(SNSEQ, -1, Vga->Mono, _sprite); - if ((_sprite = Vga->_spareQ->locate(122)) != NULL) + if ((_sprite = _vga->_spareQ->locate(121)) != NULL) + SNPOST_(SNSEQ, -1, _vga->_mono, _sprite); + if ((_sprite = _vga->_spareQ->locate(122)) != NULL) _sprite->step(_music); SNPOST_(SNSEQ, -1, _music, _sprite); if (!_music) @@ -1631,16 +1631,16 @@ void CGEEngine::runGame() { } } - if (Hero) { - ExpandSprite(Hero); - Hero->gotoxy(_heroXY[_now - 1]._x, _heroXY[_now - 1]._y); + if (_hero) { + ExpandSprite(_hero); + _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); + loadSprite("00SHADOW", -1, 0, _hero->_x + 14, _hero->_y + 51); if ((_shadow = _sprite) != NULL) { _shadow->_ref = 2; _shadow->_flags._tran = true; - Hero->_flags._shad = true; - Vga->_showQ->insert(Vga->_spareQ->remove(_shadow), Hero); + _hero->_flags._shad = true; + _vga->_showQ->insert(_vga->_spareQ->remove(_shadow), _hero); } } } @@ -1648,16 +1648,16 @@ void CGEEngine::runGame() { _infoLine->gotoxy(INFO_X, INFO_Y); _infoLine->_flags._tran = true; _infoLine->update(NULL); - Vga->_showQ->insert(_infoLine); + _vga->_showQ->insert(_infoLine); _debugLine->_z = 126; - Vga->_showQ->insert(_debugLine); + _vga->_showQ->insert(_debugLine); _horzLine->_y = MAP_TOP - (MAP_TOP > 0); _horzLine->_z = 126; - Vga->_showQ->insert(_horzLine); + _vga->_showQ->insert(_horzLine); - _mouse->Busy = Vga->_spareQ->locate(BUSY_REF); + _mouse->Busy = _vga->_spareQ->locate(BUSY_REF); if (_mouse->Busy) ExpandSprite(_mouse->Busy); @@ -1668,7 +1668,7 @@ void CGEEngine::runGame() { CAVE_Y + ((_now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY); caveUp(); - _keyboard->setClient(Sys); + _keyboard->setClient(_sys); // main loop while (!_finis && !_eventManager->_quitFlag) { //TODO Change the SNPOST message send to a special way to send function pointer @@ -1682,9 +1682,9 @@ void CGEEngine::runGame() { SNPOST(SNCLEAR, -1, 0, NULL); SNPOST_(SNCLEAR, -1, 0, NULL); _mouse->Off(); - Vga->_showQ->clear(); - Vga->_spareQ->clear(); - Hero = NULL; + _vga->_showQ->clear(); + _vga->_spareQ->clear(); + _hero = NULL; _shadow = NULL; } @@ -1696,14 +1696,14 @@ void CGEEngine::movie(const char *ext) { const char *fn = progName(ext); if (INI_FILE::exist(fn)) { loadScript(fn); - ExpandSprite(Vga->_spareQ->locate(999)); - feedSnail(Vga->_showQ->locate(999), TAKE); + ExpandSprite(_vga->_spareQ->locate(999)); + feedSnail(_vga->_showQ->locate(999), TAKE); // FIXME: Allow ScummVM to handle mouse display //Vga->ShowQ->Append(Mouse); _heart->_enable = true; - _keyboard->setClient(Sys); + _keyboard->setClient(_sys); while (!_snail->idle() && !_eventManager->_quitFlag) mainLoop(); @@ -1711,8 +1711,8 @@ void CGEEngine::movie(const char *ext) { _heart->_enable = false; SNPOST(SNCLEAR, -1, 0, NULL); SNPOST_(SNCLEAR, -1, 0, NULL); - Vga->_showQ->clear(); - Vga->_spareQ->clear(); + _vga->_showQ->clear(); + _vga->_spareQ->clear(); } } @@ -1721,7 +1721,7 @@ bool CGEEngine::showTitle(const char *name) { if (_eventManager->_quitFlag) return false; - Bitmap::_pal = VGA::SysPal; + Bitmap::_pal = Vga::_sysPal; BMP_PTR LB[] = { new Bitmap(name, true), NULL }; Bitmap::_pal = NULL; bool usr_ok = false; @@ -1737,19 +1737,19 @@ bool CGEEngine::showTitle(const char *name) { _talk->show(2); } - Vga->Sunset(); - Vga->CopyPage(1, 2); - Vga->CopyPage(0, 1); + _vga->sunset(); + _vga->copyPage(1, 2); + _vga->copyPage(0, 1); selectPocket(-1); - Vga->Sunrise(VGA::SysPal); + _vga->sunrise(Vga::_sysPal); if (Startup::_mode < 2 && !Startup::_soundOk) { - Vga->CopyPage(1, 2); - Vga->CopyPage(0, 1); - Vga->_showQ->append(_mouse); + _vga->copyPage(1, 2); + _vga->copyPage(0, 1); + _vga->_showQ->append(_mouse); _heart->_enable = true; _mouse->On(); - for (selectSound(); !_snail->idle() || VMENU::Addr;) { + for (selectSound(); !_snail->idle() || Vmenu::_addr;) { mainLoop(); if (_eventManager->_quitFlag) return false; @@ -1757,8 +1757,8 @@ bool CGEEngine::showTitle(const char *name) { _mouse->Off(); _heart->_enable = false; - Vga->_showQ->clear(); - Vga->CopyPage(0, 2); + _vga->_showQ->clear(); + _vga->copyPage(0, 2); Startup::_soundOk = 2; if (_music) LoadMIDI(0); @@ -1779,9 +1779,9 @@ bool CGEEngine::showTitle(const char *name) { #endif //----------------------------------------- movie("X00"); // paylist - Vga->CopyPage(1, 2); - Vga->CopyPage(0, 1); - Vga->_showQ->append(_mouse); + _vga->copyPage(1, 2); + _vga->copyPage(0, 1); + _vga->_showQ->append(_mouse); //Mouse.On(); _heart->_enable = true; for (takeName(); GetText::_ptr;) { @@ -1795,8 +1795,8 @@ bool CGEEngine::showTitle(const char *name) { if (usr_ok) strcat(_usrFnam, SVG_EXT); //Mouse.Off(); - Vga->_showQ->clear(); - Vga->CopyPage(0, 2); + _vga->_showQ->clear(); + _vga->copyPage(0, 2); #endif } @@ -1805,8 +1805,8 @@ bool CGEEngine::showTitle(const char *name) { if (CFile::exist(n)) { CFile file = CFile(n, REA, RCrypt); loadGame(file, true); // only system vars - Vga->SetColors(VGA::SysPal, 64); - Vga->Update(); + _vga->setColors(Vga::_sysPal, 64); + _vga->update(); if (FINIS) { Startup::_mode++; FINIS = false; @@ -1819,7 +1819,7 @@ bool CGEEngine::showTitle(const char *name) { if (Startup::_mode < 2) movie("X01"); // wink - Vga->CopyPage(0, 2); + _vga->copyPage(0, 2); if (_isDemo) return true; @@ -1854,7 +1854,7 @@ void CGEEngine::cge_main(void) { _horzLine->_flags._hide = true; //srand((uint16) Timer()); - Sys = new SYSTEM(this); + _sys = new SYSTEM(this); if (_music && Startup::_soundOk) LoadMIDI(0); @@ -1869,7 +1869,7 @@ void CGEEngine::cge_main(void) { if (FINIS) movie("X03"); } else - Vga->Sunset(); + _vga->sunset(); } } // End of namespace CGE diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index 0684a886e5..c5be2adc26 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -166,10 +166,10 @@ Cluster XZ(Couple xy); void ExpandSprite(Sprite *spr); void ContractSprite(Sprite *spr); -extern WALK *Hero; -extern VGA *Vga; +extern WALK *_hero; +extern Vga *_vga; extern Heart *_heart; -extern SYSTEM *Sys; +extern SYSTEM *_sys; extern int _offUseCount; extern Sprite *_pocLight; extern Keyboard *_keyboard; diff --git a/engines/cge/config.cpp b/engines/cge/config.cpp index f32c3b7195..8812207371 100644 --- a/engines/cge/config.cpp +++ b/engines/cge/config.cpp @@ -64,7 +64,7 @@ static int DevName[] = { MIDI_TEXT, AUTO_TEXT }; -static CHOICE DevMenu[] = { +static Choice DevMenu[] = { { NULL, &CGEEngine::NONE }, { NULL, &CGEEngine::SB }, { NULL, &CGEEngine::SBM }, @@ -76,7 +76,7 @@ static CHOICE DevMenu[] = { }; -static CHOICE DigiPorts[] = { +static Choice DigiPorts[] = { { " 210h", &CGEEngine::setPortD }, { " 220h", &CGEEngine::setPortD }, { " 230h", &CGEEngine::setPortD }, @@ -87,7 +87,7 @@ static CHOICE DigiPorts[] = { { NULL, NULL } }; -static CHOICE MIDIPorts[] = { +static Choice MIDIPorts[] = { { " 220h", &CGEEngine::setPortM }, { " 230h", &CGEEngine::setPortM }, { " 240h", &CGEEngine::setPortM }, @@ -102,7 +102,7 @@ static CHOICE MIDIPorts[] = { { NULL, NULL } }; -static CHOICE BlsterIRQ[] = { +static Choice BlsterIRQ[] = { { "IRQ 2", &CGEEngine::setIRQ }, { "IRQ 5", &CGEEngine::setIRQ }, { "IRQ 7", &CGEEngine::setIRQ }, @@ -111,7 +111,7 @@ static CHOICE BlsterIRQ[] = { { NULL, NULL } }; -static CHOICE GravisIRQ[] = { +static Choice GravisIRQ[] = { { "IRQ 2", &CGEEngine::setIRQ }, { "IRQ 5", &CGEEngine::setIRQ }, { "IRQ 7", &CGEEngine::setIRQ }, @@ -122,7 +122,7 @@ static CHOICE GravisIRQ[] = { { NULL, NULL } }; -static CHOICE GravisDMA[] = { +static Choice GravisDMA[] = { { "DMA 1", &CGEEngine::setDMA }, { "DMA 3", &CGEEngine::setDMA }, { "DMA 5", &CGEEngine::setDMA }, @@ -132,7 +132,7 @@ static CHOICE GravisDMA[] = { { NULL, NULL } }; -static CHOICE BlsterDMA[] = { +static Choice BlsterDMA[] = { { "DMA 0", &CGEEngine::setDMA }, { "DMA 1", &CGEEngine::setDMA }, { "DMA 3", &CGEEngine::setDMA }, @@ -144,17 +144,17 @@ static CHOICE BlsterDMA[] = { void CGEEngine::selectSound() { int i; _sound.Close(); - if (VMENU::Addr) - SNPOST_(SNKILL, -1, 0, VMENU::Addr); + if (Vmenu::_addr) + SNPOST_(SNKILL, -1, 0, Vmenu::_addr); inf(_text->getText(STYPE_TEXT)); _talk->gotoxy(_talk->_x, FONT_HIG / 2); for (i = 0; i < (int)ArrayCount(DevName); i++) - DevMenu[i].Text = _text->getText(DevName[i]); - (new VMENU(this, DevMenu, SCR_WID / 2, _talk->_y + _talk->_h + TEXT_VM + FONT_HIG))->setName(_text->getText(MENU_TEXT)); + DevMenu[i]._text = _text->getText(DevName[i]); + (new Vmenu(this, DevMenu, SCR_WID / 2, _talk->_y + _talk->_h + TEXT_VM + FONT_HIG))->setName(_text->getText(MENU_TEXT)); } -static void Reset(void) { +static void reset(void) { _sndDrvInfo._dBase = _sndDrvInfo._dIrq = _sndDrvInfo._dDma = _sndDrvInfo._mBase = DETECT; } @@ -179,22 +179,22 @@ static uint16 xdeco(const char *str) { } -static CHOICE *Cho; -static int Hlp; +static Choice *_cho; +static int _hlp; void CGEEngine::SNSelect() { - inf(_text->getText(Hlp)); + inf(_text->getText(_hlp)); _talk->gotoxy(_talk->_x, FONT_HIG / 2); - (new VMENU(this, Cho, SCR_WID / 2, _talk->_y + _talk->_h + TEXT_VM + FONT_HIG))->setName(_text->getText(MENU_TEXT)); + (new Vmenu(this, _cho, SCR_WID / 2, _talk->_y + _talk->_h + TEXT_VM + FONT_HIG))->setName(_text->getText(MENU_TEXT)); } -static void Select(CHOICE *cho, int hlp) { - Cho = cho; - Hlp = hlp; +static void select(Choice *cho, int hlp) { + _cho = cho; + _hlp = hlp; //TODO Change the SNPOST message send to a special way to send function pointer //SNPOST(SNEXEC, -1, 0, (void *)&SNSelect); - warning("STUB: Select"); + warning("STUB: select"); } @@ -208,32 +208,32 @@ void CGEEngine::NONE() { void CGEEngine::SB() { _sndDrvInfo._dDev = DEV_SB; _sndDrvInfo._mDev = DEV_SB; - Reset(); - Select(DigiPorts, SPORT_TEXT); + reset(); + select(DigiPorts, SPORT_TEXT); } void CGEEngine::SBM() { _sndDrvInfo._dDev = DEV_SB; _sndDrvInfo._mDev = DEV_GM; - Reset(); - Select(DigiPorts, SPORT_TEXT); + reset(); + select(DigiPorts, SPORT_TEXT); } void CGEEngine::GUS() { _sndDrvInfo._dDev = DEV_GUS; _sndDrvInfo._mDev = DEV_GUS; - Reset(); - Select(DigiPorts, SPORT_TEXT); + reset(); + select(DigiPorts, SPORT_TEXT); } void CGEEngine::GUSM() { _sndDrvInfo._dDev = DEV_GUS; _sndDrvInfo._mDev = DEV_GM; - Reset(); - Select(DigiPorts, SPORT_TEXT); + reset(); + select(DigiPorts, SPORT_TEXT); } @@ -241,40 +241,40 @@ void CGEEngine::MIDI() { _sndDrvInfo._dDev = DEV_QUIET; _sndDrvInfo._mDev = DEV_GM; _sndDrvInfo._mBase = DETECT; - Select(MIDIPorts, MPORT_TEXT); + select(MIDIPorts, MPORT_TEXT); } void CGEEngine::AUTO() { _sndDrvInfo._dDev = DEV_AUTO; _sndDrvInfo._mDev = DEV_AUTO; - Reset(); + reset(); _sound.Open(); } void CGEEngine::setPortD() { - _sndDrvInfo._dBase = xdeco(DigiPorts[VMENU::Recent].Text); - Select((_sndDrvInfo._dDev == DEV_SB) ? BlsterIRQ : GravisIRQ, SIRQ_TEXT); + _sndDrvInfo._dBase = xdeco(DigiPorts[Vmenu::_recent]._text); + select((_sndDrvInfo._dDev == DEV_SB) ? BlsterIRQ : GravisIRQ, SIRQ_TEXT); } void CGEEngine::setPortM() { - _sndDrvInfo._mBase = xdeco(MIDIPorts[VMENU::Recent].Text); + _sndDrvInfo._mBase = xdeco(MIDIPorts[Vmenu::_recent]._text); _sound.Open(); } void CGEEngine::setIRQ() { - _sndDrvInfo._dIrq = ddeco(((_sndDrvInfo._dDev == DEV_SB) ? BlsterIRQ : GravisIRQ)[VMENU::Recent].Text); - Select((_sndDrvInfo._dDev == DEV_SB) ? BlsterDMA : GravisDMA, SDMA_TEXT); + _sndDrvInfo._dIrq = ddeco(((_sndDrvInfo._dDev == DEV_SB) ? BlsterIRQ : GravisIRQ)[Vmenu::_recent]._text); + select((_sndDrvInfo._dDev == DEV_SB) ? BlsterDMA : GravisDMA, SDMA_TEXT); } void CGEEngine::setDMA() { - _sndDrvInfo._dDma = ddeco(((_sndDrvInfo._dDev == DEV_SB) ? BlsterDMA : GravisDMA)[VMENU::Recent].Text); + _sndDrvInfo._dDma = ddeco(((_sndDrvInfo._dDev == DEV_SB) ? BlsterDMA : GravisDMA)[Vmenu::_recent]._text); if (_sndDrvInfo._mDev != _sndDrvInfo._dDev) - Select(MIDIPorts, MPORT_TEXT); + select(MIDIPorts, MPORT_TEXT); else _sound.Open(); } diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 5f98cf34fb..5bafd46884 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -200,7 +200,7 @@ void MOUSE::NewMouse(Common::Event &event) { EvtHead = (EvtHead + 1) % EVT_MAX; evt._x = event.mouse.x; evt._y = event.mouse.y; - evt._ptr = SpriteAt(evt._x, evt._y); + evt._ptr = spriteAt(evt._x, evt._y); switch (event.type) { case Common::EVENT_MOUSEMOVE: @@ -278,8 +278,8 @@ void EventManager::handleEvents(void) { e._ptr->touch(e._msk, e._x, e._y); else e._ptr->touch(e._msk, e._x - e._ptr->_x, e._y - e._ptr->_y); - } else if (Sys) - Sys->touch(e._msk, e._x, e._y); + } else if (_sys) + _sys->touch(e._msk, e._x, e._y); if (e._msk & L_DN) { _mouse->Hold = e._ptr; diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp index 3acafd80e7..f2ebc0b4f8 100644 --- a/engines/cge/game.cpp +++ b/engines/cge/game.cpp @@ -35,7 +35,7 @@ uint8 *glass(Dac *pal, uint8 r, uint8 g, uint8 b) { if (x) { uint16 i; for (i = 0; i < 256; i++) { - x[i] = Closest(pal, MkDAC(((uint16)(pal[i]._r) * r) / 255, + x[i] = closest(pal, mkDac(((uint16)(pal[i]._r) * r) / 255, ((uint16)(pal[i]._g) * g) / 255, ((uint16)(pal[i]._b) * b) / 255)); } @@ -50,9 +50,9 @@ uint8 *Mark(DAC *pal) { if (x) { uint16 i; for (i = 0; i < 256; i++) { - x[i] = Closest(pal, MkDAC(f(pal[i].R), - f(pal[i].G), - f(pal[i].B))); + x[i] = closest(pal, mkDax(f(pal[i]._R), + f(pal[i]._G), + f(pal[i]._B))); } } return x; diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 93cdb75a4b..74084fb905 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -34,8 +34,8 @@ namespace CGE { // Defines found in cge.mak #define VOL -#define INI_FILE VFILE // Or is it CFILE? -#define PIC_FILE VFILE +#define INI_FILE VFile // Or is it CFile? +#define PIC_FILE VFile #define BMP_MODE 0 // diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index a49f7c5c7f..b7c4b8ca83 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -75,9 +75,9 @@ Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(MIX_FALL), _ } _led[ArrayCount(_led) - 1]->_flags._bDel = true; - Vga->_showQ->insert(this); + _vga->_showQ->insert(this); for (i = 0; i < ArrayCount(_led); i++) - Vga->_showQ->insert(_led[i]); + _vga->_showQ->insert(_led[i]); //--- reset balance i = (_sndDrvInfo.Vol4._ml + _sndDrvInfo.Vol4._mr) / 2; @@ -115,7 +115,7 @@ void Mixer::touch(uint16 mask, int x, int y) { void Mixer::tick() { int x = _mouse->_x; int y = _mouse->_y; - if (SpriteAt(x, y) == this) { + if (spriteAt(x, y) == this) { _fall = MIX_FALL; if (_flags._hold) touch(L_UP, x - _x, y - _y); diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 01be69386f..edafd59111 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -71,7 +71,7 @@ static void SNGame(Sprite *spr, int num) { int buref = 0; int Stage = 0; - for (dup[0] = Vga->_showQ->first(); dup[0]; dup[0] = dup[0]->_next) { + for (dup[0] = _vga->_showQ->first(); dup[0]; dup[0] = dup[0]->_next) { buref = dup[0]->_ref; if (buref / 1000 == 16 && buref % 100 == 6) { Stage = (buref / 100) % 10; @@ -79,8 +79,8 @@ static void SNGame(Sprite *spr, int num) { } } if (dup[1] == NULL) { - dup[1] = Vga->_showQ->locate(16003); // pan - dup[2] = Vga->_showQ->locate(16004); // pani + dup[1] = _vga->_showQ->locate(16003); // pan + dup[2] = _vga->_showQ->locate(16004); // pani } if (_game) { // continue game @@ -163,10 +163,10 @@ static void SNGame(Sprite *spr, int num) { static int count = 0; if (k == NULL) { - k = Vga->_showQ->locate(20700); - k1 = Vga->_showQ->locate(20701); - k2 = Vga->_showQ->locate(20702); - k3 = Vga->_showQ->locate(20703); + k = _vga->_showQ->locate(20700); + k1 = _vga->_showQ->locate(20701); + k2 = _vga->_showQ->locate(20702); + k3 = _vga->_showQ->locate(20703); } if (!_game) { // init @@ -217,7 +217,7 @@ static void SNGame(Sprite *spr, int num) { SNPOST(SNSAY, 20003, 20022, NULL); break; } - ++ count; + count++; } switch (spr->_ref) { case 1 : @@ -273,13 +273,13 @@ static void SNGame(Sprite *spr, int num) { void ExpandSprite(Sprite *spr) { if (spr) - Vga->_showQ->insert(Vga->_spareQ->remove(spr)); + _vga->_showQ->insert(_vga->_spareQ->remove(spr)); } void ContractSprite(Sprite *spr) { if (spr) - Vga->_spareQ->append(Vga->_showQ->remove(spr)); + _vga->_spareQ->append(_vga->_showQ->remove(spr)); } int findPocket(Sprite *spr) { @@ -307,12 +307,12 @@ void selectPocket(int n) { void pocFul() { - Hero->park(); - SNPOST(SNWAIT, -1, -1, Hero); - SNPOST(SNSEQ, -1, POC_FUL, Hero); - SNPOST(SNSOUND, -1, 2, Hero); - SNPOST(SNWAIT, -1, -1, Hero); - SNPOST(SNSAY, 1, POC_FUL_TEXT, Hero); + _hero->park(); + SNPOST(SNWAIT, -1, -1, _hero); + SNPOST(SNSEQ, -1, POC_FUL, _hero); + SNPOST(SNSOUND, -1, 2, _hero); + SNPOST(SNWAIT, -1, -1, _hero); + SNPOST(SNSAY, 1, POC_FUL_TEXT, _hero); } @@ -356,7 +356,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) { @@ -383,7 +383,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 @@ -506,10 +506,10 @@ static void SNZTrim(Sprite *spr) { Sprite *s; _heart->_enable = false; s = (spr->_flags._shad) ? spr->_prev : NULL; - Vga->_showQ->insert(Vga->_showQ->remove(spr)); + _vga->_showQ->insert(_vga->_showQ->remove(spr)); if (s) { s->_z = spr->_z; - Vga->_showQ->insert(Vga->_showQ->remove(s), spr); + _vga->_showQ->insert(_vga->_showQ->remove(s), spr); } _heart->_enable = en; } @@ -539,8 +539,8 @@ static void SNRmTake(Sprite *spr) { void SNSeq(Sprite *spr, int val) { if (spr) { - if (spr == Hero && val == 0) - Hero->park(); + if (spr == _hero && val == 0) + _hero->park(); else spr->step(val); } @@ -571,7 +571,7 @@ void SNSend(Sprite *spr, int val) { spr->_flags._slav = false; } else { if (spr->_ref % 1000 == 0) - Bitmap::_pal = VGA::SysPal; + Bitmap::_pal = Vga::_sysPal; if (spr->_flags._back) spr->backShow(true); else @@ -584,7 +584,7 @@ void SNSend(Sprite *spr, int val) { void SNSwap(Sprite *spr, int xref) { - Sprite *xspr = Locate(xref); + Sprite *xspr = locate(xref); if (spr && xspr) { int was = spr->_cave; int xwas = xspr->_cave; @@ -619,7 +619,7 @@ void SNSwap(Sprite *spr, int xref) { void SNCover(Sprite *spr, int xref) { - Sprite *xspr = Locate(xref); + Sprite *xspr = locate(xref); if (spr && xspr) { spr->_flags._hide = true; xspr->_z = spr->_z; @@ -627,7 +627,7 @@ void SNCover(Sprite *spr, int xref) { xspr->gotoxy(spr->_x, spr->_y); ExpandSprite(xspr); if ((xspr->_flags._shad = spr->_flags._shad) == 1) { - Vga->_showQ->insert(Vga->_showQ->remove(spr->_prev), xspr); + _vga->_showQ->insert(_vga->_showQ->remove(spr->_prev), xspr); spr->_flags._shad = false; } feedSnail(xspr, NEAR); @@ -641,13 +641,13 @@ void SNUncover(Sprite *spr, Sprite *xspr) { spr->_cave = xspr->_cave; spr->gotoxy(xspr->_x, xspr->_y); if ((spr->_flags._shad = xspr->_flags._shad) == 1) { - Vga->_showQ->insert(Vga->_showQ->remove(xspr->_prev), spr); + _vga->_showQ->insert(_vga->_showQ->remove(xspr->_prev), spr); xspr->_flags._shad = false; } spr->_z = xspr->_z; SNSend(xspr, -1); if (spr->_time == 0) - ++spr->_time; + spr->_time++; } } @@ -669,20 +669,20 @@ void SNSetXY(Sprite *spr, uint16 xy) { void SNRelX(Sprite *spr, int x) { - if (spr && Hero) - spr->gotoxy(Hero->_x + x, spr->_y); + if (spr && _hero) + spr->gotoxy(_hero->_x + x, spr->_y); } void SNRelY(Sprite *spr, int y) { - if (spr && Hero) - spr->gotoxy(spr->_x, Hero->_y + y); + if (spr && _hero) + spr->gotoxy(spr->_x, _hero->_y + y); } void SNRelZ(Sprite *spr, int z) { - if (spr && Hero) { - spr->_z = Hero->_z + z; + if (spr && _hero) { + spr->_z = _hero->_z + z; SNZTrim(spr); } } @@ -710,13 +710,13 @@ void SNSetZ(Sprite *spr, int z) { void SNSlave(Sprite *spr, int ref) { - Sprite *slv = Locate(ref); + Sprite *slv = locate(ref); if (spr && slv) { if (spr->active()) { SNSend(slv, spr->_cave); slv->_flags._slav = true; slv->_z = spr->_z; - Vga->_showQ->insert(Vga->_showQ->remove(slv), spr->_next); + _vga->_showQ->insert(_vga->_showQ->remove(slv), spr->_next); } } } @@ -743,13 +743,13 @@ void SNKill(Sprite *spr) { } Sprite *nx = spr->_next; Hide1(spr); - Vga->_showQ->remove(spr); + _vga->_showQ->remove(spr); EventManager::ClrEvt(spr); if (spr->_flags._kill) delete spr; else { spr->_cave = -1; - Vga->_spareQ->append(spr); + _vga->_spareQ->append(spr); } if (nx) { if (nx->_flags._slav) @@ -817,7 +817,7 @@ static void SNLevel(Sprite *spr, int lev) { #endif while (_lev < lev) { _lev++; - spr = Vga->_spareQ->locate(100 + _lev); + spr = _vga->_spareQ->locate(100 + _lev); if (spr) { spr->backShow(true); spr->_cave = 0; @@ -844,7 +844,7 @@ void SNFlash(bool on) { if (on) { Dac *pal = farnew(Dac, PAL_CNT); if (pal) { - memcpy(pal, VGA::SysPal, PAL_SIZ); + memcpy(pal, Vga::_sysPal, PAL_SIZ); for (int i = 0; i < PAL_CNT; i++) { register int c; c = pal[i]._r << 1; @@ -854,19 +854,19 @@ void SNFlash(bool on) { c = pal[i]._b << 1; pal[i]._b = (c < 64) ? c : 63; } - Vga->SetColors(pal, 64); + _vga->setColors(pal, 64); } } else - Vga->SetColors(VGA::SysPal, 64); + _vga->setColors(Vga::_sysPal, 64); _dark = false; } static void SNLight(bool in) { if (in) - Vga->Sunrise(VGA::SysPal); + _vga->sunrise(Vga::_sysPal); else - Vga->Sunset(); + _vga->sunset(); _dark = ! in; } @@ -877,18 +877,18 @@ static void SNBarrier(int cav, int bar, bool horz) { static void SNWalk(Sprite *spr, int x, int y) { - if (Hero) { + if (_hero) { if (spr && y < 0) - Hero->findWay(spr); + _hero->findWay(spr); else - Hero->findWay(XZ(x, y)); + _hero->findWay(XZ(x, y)); } } static void SNReach(Sprite *spr, int mode) { - if (Hero) - Hero->reach(spr, mode); + if (_hero) + _hero->reach(spr, mode); } @@ -927,7 +927,7 @@ void Snail::runCom() { 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; @@ -939,7 +939,7 @@ void Snail::runCom() { case SNWAIT : if (sprel) { if (sprel->seqTest(snc->_val) && - (snc->_val >= 0 || sprel != Hero || Hero->_tracePtr < 0)) { + (snc->_val >= 0 || sprel != _hero || _hero->_tracePtr < 0)) { _timerExpiry = g_system->getMillis() + sprel->_time * SNAIL_FRAME_DELAY; } else goto xit; @@ -953,21 +953,21 @@ void Snail::runCom() { break; case SNSAY : if (sprel && _talkEnable) { - if (sprel == Hero && sprel->seqTest(-1)) + if (sprel == _hero && sprel->seqTest(-1)) sprel->step(HTALK); _text->say(_text->getText(snc->_val), sprel); - Sys->FunDel = HEROFUN0; + _sys->FunDel = HEROFUN0; } break; case SNINF : if (_talkEnable) { _vm->inf(_text->getText(snc->_val)); - Sys->FunDel = HEROFUN0; + _sys->FunDel = HEROFUN0; } break; case SNTIME : if (sprel && _talkEnable) { - if (sprel == Hero && sprel->seqTest(-1)) + if (sprel == _hero && sprel->seqTest(-1)) sprel->step(HTALK); sayTime(sprel); } @@ -995,7 +995,7 @@ void Snail::runCom() { 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/text.cpp b/engines/cge/text.cpp index f112493278..5f370150ca 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -213,8 +213,8 @@ void Text::say(const char *txt, Sprite *spr) { spike->step(east); spike->_ref = SAY_REF; - Vga->_showQ->insert(_talk, Vga->_showQ->last()); - Vga->_showQ->insert(spike, Vga->_showQ->last()); + _vga->_showQ->insert(_talk, _vga->_showQ->last()); + _vga->_showQ->insert(spike, _vga->_showQ->last()); } } @@ -229,7 +229,7 @@ void CGEEngine::inf(const char *txt) { _talk->gotoxy(_talk->_x, _talk->_y - 20); _talk->_z = 126; _talk->_ref = INF_REF; - Vga->_showQ->insert(_talk, Vga->_showQ->last()); + _vga->_showQ->insert(_talk, _vga->_showQ->last()); } } diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 36661e756e..aa7cd8ad06 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -177,7 +177,7 @@ void RestoreScreen(uint16 * &sav) { } -Dac MkDAC(uint8 r, uint8 g, uint8 b) { +Dac mkDac(uint8 r, uint8 g, uint8 b) { static Dac x; x._r = r; x._g = g; @@ -186,7 +186,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; @@ -195,9 +195,9 @@ Rgb MkRGB(uint8 r, uint8 g, uint8 b) { } -Sprite *Locate(int ref) { - Sprite *spr = Vga->_showQ->locate(ref); - return (spr) ? spr : Vga->_spareQ->locate(ref); +Sprite *locate(int ref) { + Sprite *spr = _vga->_showQ->locate(ref); + return (spr) ? spr : _vga->_spareQ->locate(ref); } @@ -746,10 +746,10 @@ void Sprite::show() { void Sprite::show(uint16 pg) { - Graphics::Surface *a = VGA::Page[1]; - VGA::Page[1] = VGA::Page[pg & 3]; + Graphics::Surface *a = Vga::_page[1]; + Vga::_page[1] = Vga::_page[pg & 3]; shp()->show(_x, _y); - VGA::Page[1] = a; + Vga::_page[1] = a; } @@ -780,8 +780,8 @@ BMP_PTR Sprite::ghost() { } -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) { @@ -899,32 +899,32 @@ Sprite *Queue::locate(int ref) { //extern const char Copr[]; -Graphics::Surface *VGA::Page[4]; -Dac *VGA::SysPal; +Graphics::Surface *Vga::_page[4]; +Dac *Vga::_sysPal; -void VGA::init() { +void Vga::init() { for (int idx = 0; idx < 4; ++idx) { - Page[idx] = new Graphics::Surface(); - Page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); + _page[idx] = new Graphics::Surface(); + _page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); } - SysPal = new Dac[PAL_CNT]; + _sysPal = new Dac[PAL_CNT]; } -void VGA::deinit() { +void Vga::deinit() { for (int idx = 0; idx < 4; ++idx) { - Page[idx]->free(); - delete Page[idx]; + _page[idx]->free(); + delete _page[idx]; } - delete[] SysPal; + delete[] _sysPal; } -VGA::VGA(int mode) - : FrmCnt(0), OldMode(0), OldScreen(NULL), StatAdr(VGAST1_), - Msg(NULL), Nam(NULL), SetPal(false), Mono(0) { - OldColors = NULL; - NewColors = NULL; +Vga::Vga(int mode) + : _frmCnt(0), _oldMode(0), _oldScreen(NULL), _statAdr(VGAST1_), + _msg(NULL), _nam(NULL), _setPal(false), _mono(0) { + _oldColors = NULL; + _newColors = NULL; _showQ = new Queue(true); _spareQ = new Queue(false); @@ -941,42 +941,42 @@ VGA::VGA(int mode) // warning(Copr); warning("TODO: Fix Copr"); - SetStatAdr(); - if (StatAdr != VGAST1_) - ++Mono; + setStatAdr(); + if (_statAdr != VGAST1_) + _mono++; if (isVga()) { - OldColors = farnew(Dac, 256); - NewColors = farnew(Dac, 256); - OldScreen = SaveScreen(); - GetColors(OldColors); - Sunset(); - OldMode = SetMode(mode); - SetColors(); - Setup(VideoMode); - Clear(0); + _oldColors = farnew(Dac, 256); + _newColors = farnew(Dac, 256); + _oldScreen = SaveScreen(); + getColors(_oldColors); + sunset(); + _oldMode = setMode(mode); + setColors(); + setup(VideoMode); + clear(0); } } -VGA::~VGA(void) { - Mono = 0; +Vga::~Vga() { + _mono = 0; if (isVga()) { Common::String buffer = ""; /* - Clear(0); - SetMode(OldMode); - SetColors(); - RestoreScreen(OldScreen); - Sunrise(OldColors); + clear(0); + setMode(_oldMode); + setColors(); + restoreScreen(_oldScreen); + sunrise(_oldColors); */ - if (OldColors) - free(OldColors); - if (NewColors) - free(NewColors); - if (Msg) - buffer = Common::String(Msg); - if (Nam) - buffer = buffer + " [" + Nam + "]"; + if (_oldColors) + free(_oldColors); + if (_newColors) + free(_newColors); + if (_msg) + buffer = Common::String(_msg); + if (_nam) + buffer = buffer + " [" + _nam + "]"; debugN("%s", buffer.c_str()); } @@ -986,7 +986,7 @@ VGA::~VGA(void) { } -void VGA::SetStatAdr(void) { +void Vga::setStatAdr() { /* asm mov dx,VGAMIr_ asm in al,dx @@ -997,21 +997,21 @@ void VGA::SetStatAdr(void) { set_mode_adr: StatAdr = _AX; */ - warning("STUB: VGA::SetStatADR"); + warning("STUB: VGA::setStatADR"); } #pragma argsused -void VGA::WaitVR(bool on) { +void Vga::waitVR(bool on) { // Since some of the game parts rely on using vertical sync as a delay mechanism, // we're introducing a short delay to simulate it g_system->delayMillis(10); } -void VGA::Setup(VgaRegBlk *vrb) { +void Vga::setup(VgaRegBlk *vrb) { /* - WaitVR(); // *--LOOK!--* resets VGAATR logic + waitVR(); // *--LOOK!--* resets VGAATR logic asm cld asm mov si, vrb // take address of parameter table asm mov dh,0x03 // higher byte of I/O address is always 3 @@ -1048,23 +1048,23 @@ void VGA::Setup(VgaRegBlk *vrb) { xit: */ - warning("STUB: VGA::Setup"); + warning("STUB: VGA::setup"); } -int VGA::SetMode(int mode) { +int Vga::setMode(int mode) { // ScummVM provides it's own vieo services return 0; } -void VGA::GetColors(Dac *tab) { +void Vga::getColors(Dac *tab) { byte palData[PAL_SIZ]; g_system->getPaletteManager()->grabPalette(palData, 0, PAL_CNT); - pal2DAC(palData, tab); + palToDac(palData, tab); } -void VGA::pal2DAC(const byte *palData, Dac *tab) { +void Vga::palToDac(const byte *palData, Dac *tab) { const byte *colP = palData; for (int idx = 0; idx < PAL_CNT; ++idx, colP += 3) { tab[idx]._r = *colP >> 2; @@ -1073,7 +1073,7 @@ void VGA::pal2DAC(const byte *palData, Dac *tab) { } } -void VGA::DAC2pal(const Dac *tab, byte *palData) { +void Vga::dacToPal(const Dac *tab, byte *palData) { for (int idx = 0; idx < PAL_CNT; ++idx, palData += 3) { *palData = tab[idx]._r << 2; *(palData + 1) = tab[idx]._g << 2; @@ -1081,16 +1081,16 @@ void VGA::DAC2pal(const Dac *tab, byte *palData) { } } -void VGA::SetColors(Dac *tab, int lum) { - Dac *palP = tab, *destP = NewColors; +void Vga::setColors(Dac *tab, int lum) { + Dac *palP = tab, *destP = _newColors; for (int idx = 0; idx < PAL_CNT; ++idx, ++palP, ++destP) { destP->_r = (palP->_r * lum) >> 6; destP->_g = (palP->_g * lum) >> 6; destP->_b = (palP->_b * lum) >> 6; } - if (Mono) { - destP = NewColors; + if (_mono) { + destP = _newColors; for (int idx = 0; idx < PAL_CNT; ++idx, ++palP) { // Form a greyscalce colour from 30% R, 59% G, 11% B uint8 intensity = (destP->_r * 77) + (destP->_g * 151) + (destP->_b * 28); @@ -1100,77 +1100,77 @@ void VGA::SetColors(Dac *tab, int lum) { } } - SetPal = true; + _setPal = true; } -void VGA::SetColors(void) { - memset(NewColors, 0, PAL_SIZ); - UpdateColors(); +void Vga::setColors(void) { + memset(_newColors, 0, PAL_SIZ); + updateColors(); } -void VGA::Sunrise(Dac *tab) { +void Vga::sunrise(Dac *tab) { for (int i = 0; i <= 64; i += FADE_STEP) { - SetColors(tab, i); - WaitVR(true); - UpdateColors(); + setColors(tab, i); + waitVR(true); + updateColors(); } } -void VGA::Sunset(void) { +void Vga::sunset() { Dac tab[256]; - GetColors(tab); + getColors(tab); for (int i = 64; i >= 0; i -= FADE_STEP) { - SetColors(tab, i); - WaitVR(true); - UpdateColors(); + setColors(tab, i); + waitVR(true); + updateColors(); } } -void VGA::Show(void) { +void Vga::show() { Sprite *spr = _showQ->first(); for (spr = _showQ->first(); spr; spr = spr->_next) spr->show(); - Update(); + update(); for (spr = _showQ->first(); spr; spr = spr->_next) spr->hide(); - ++ FrmCnt; + _frmCnt++; } -void VGA::UpdateColors(void) { +void Vga::updateColors() { byte palData[PAL_SIZ]; - DAC2pal(NewColors, palData); + dacToPal(_newColors, palData); g_system->getPaletteManager()->setPalette(palData, 0, 256); } -void VGA::Update(void) { - SWAP(VGA::Page[0], VGA::Page[1]); +void Vga::update() { + SWAP(Vga::_page[0], Vga::_page[1]); - if (SetPal) { - UpdateColors(); - SetPal = false; + if (_setPal) { + updateColors(); + _setPal = false; } - g_system->copyRectToScreen((const byte *)VGA::Page[0]->getBasePtr(0, 0), SCR_WID, 0, 0, SCR_WID, SCR_HIG); + g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), SCR_WID, 0, 0, SCR_WID, SCR_HIG); g_system->updateScreen(); } -void VGA::Clear(uint8 color) { +void Vga::clear(uint8 color) { for (int paneNum = 0; paneNum < 4; ++paneNum) - Page[paneNum]->fillRect(Common::Rect(0, 0, SCR_WID, SCR_HIG), color); + _page[paneNum]->fillRect(Common::Rect(0, 0, SCR_WID, SCR_HIG), color); } -void VGA::CopyPage(uint16 d, uint16 s) { - Page[d]->copyFrom(*Page[s]); +void Vga::copyPage(uint16 d, uint16 s) { + _page[d]->copyFrom(*_page[s]); } //-------------------------------------------------------------------------- @@ -1259,13 +1259,13 @@ void Bitmap::xShow(int x, int y) { void Bitmap::show(int x, int y) { const byte *srcP = (const byte *)_v; - byte *destEndP = (byte *)VGA::Page[1]->pixels + (SCR_WID * SCR_HIG); + byte *destEndP = (byte *)Vga::_page[1]->pixels + (SCR_WID * SCR_HIG); // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a // given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data // must be decompressed and inserted into the surface for (int planeCtr = 0; planeCtr < 4; ++planeCtr) { - byte *destP = (byte *)VGA::Page[1]->getBasePtr(x + planeCtr, y); + byte *destP = (byte *)Vga::_page[1]->getBasePtr(x + planeCtr, y); for (;;) { uint16 v = READ_LE_UINT16(srcP); @@ -1321,8 +1321,8 @@ void Bitmap::show(int x, int y) { void Bitmap::hide(int x, int y) { for (int yp = y; yp < y + _h; ++yp) { - const byte *srcP = (const byte *)VGA::Page[2]->getBasePtr(x, yp); - byte *destP = (byte *)VGA::Page[1]->getBasePtr(x, yp); + const byte *srcP = (const byte *)Vga::_page[2]->getBasePtr(x, yp); + byte *destP = (byte *)Vga::_page[1]->getBasePtr(x, yp); Common::copy(srcP, srcP + _w, destP); } diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 9e49b3d918..5ef7f99c69 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -170,7 +170,7 @@ protected: public: int _ref; signed char _cave; - struct FLAGS { + struct Flags { uint16 _hide : 1; // general visibility switch uint16 _near : 1; // Near action lock uint16 _drag : 1; // sprite is moveable @@ -237,7 +237,8 @@ private: class Queue { - Sprite *_head, *_tail; + Sprite *_head; + Sprite *_tail; public: Queue(bool show); ~Queue(); @@ -260,55 +261,55 @@ public: }; -class VGA { - uint16 OldMode; - uint16 *OldScreen; - uint16 StatAdr; - bool SetPal; - Dac *OldColors; - Dac *NewColors; - const char *Msg; - const char *Nam; - - int SetMode(int mode); - void UpdateColors(void); - void SetColors(void); - void SetStatAdr(void); - void WaitVR(bool on); +class Vga { + uint16 _oldMode; + uint16 *_oldScreen; + uint16 _statAdr; + bool _setPal; + Dac *_oldColors; + Dac *_newColors; + const char *_msg; + const char *_nam; + + int setMode(int mode); + void updateColors(); + void setColors(); + void setStatAdr(); + void waitVR(bool on); public: - uint32 FrmCnt; + uint32 _frmCnt; Queue *_showQ; Queue *_spareQ; - int Mono; - static Graphics::Surface *Page[4]; - static Dac *SysPal; + int _mono; + static Graphics::Surface *_page[4]; + static Dac *_sysPal; - VGA(int mode); - ~VGA(void); + Vga(int mode); + ~Vga(void); static void init(); static void deinit(); - void Setup(VgaRegBlk *vrb); - void GetColors(Dac *tab); - void SetColors(Dac *tab, int lum); - void Clear(uint8 color); - void CopyPage(uint16 d, uint16 s); - void Sunrise(Dac *tab); - void Sunset(); - void Show(); - void Update(); - - static void pal2DAC(const byte *palData, Dac *tab); - static void DAC2pal(const Dac *tab, byte *palData); + void setup(VgaRegBlk *vrb); + void getColors(Dac *tab); + void setColors(Dac *tab, int lum); + void clear(uint8 color); + void copyPage(uint16 d, uint16 s); + void sunrise(Dac *tab); + void sunset(); + void show(); + void update(); + + static void palToDac(const byte *palData, Dac *tab); + static void dacToPal(const Dac *tab, byte *palData); }; -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> -uint8 Closest(CBLK *pal, CBLK x) { +uint8 closest(CBLK *pal, CBLK x) { #define f(col, lum) ((((uint16)(col)) << 8) / lum) uint16 i, dif = 0xFFFF, found = 0; uint16 L = x._r + x._g + x._b; @@ -337,12 +338,12 @@ uint8 Closest(CBLK *pal, CBLK x) { } //static void Video (void); -uint16 *SaveScreen(void); -void RestoreScreen(uint16 * &sav); -Sprite *SpriteAt(int x, int y); -Sprite *Locate(int ref); +uint16 *saveScreen(); +void restoreScreen(uint16 * &sav); +Sprite *spriteAt(int x, int y); +Sprite *locate(int ref); -extern bool SpeedTest; +extern bool _speedTest; } // End of namespace CGE diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index 7ea32ff023..49dbbbdab6 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -44,7 +44,7 @@ namespace CGE { -MENU_BAR::MENU_BAR(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { +MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { int h = FONT_HIG + 2 * MB_VM, i = (w += 2 * MB_HM) * h; uint8 *p = farnew(uint8, i), * p1, * p2; @@ -71,21 +71,21 @@ MENU_BAR::MENU_BAR(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { static char *vmgt; -char *VMGather(CHOICE *list) { - CHOICE *cp; +char *VMGather(Choice *list) { + Choice *cp; int len = 0, h = 0; - for (cp = list; cp->Text; cp++) { - len += strlen(cp->Text); + for (cp = list; cp->_text; cp++) { + len += strlen(cp->_text); h++; } vmgt = new char[len + h]; if (vmgt) { *vmgt = '\0'; - for (cp = list; cp->Text; cp++) { + for (cp = list; cp->_text; cp++) { if (*vmgt) strcat(vmgt, "|"); - strcat(vmgt, cp->Text); + strcat(vmgt, cp->_text); h++; } } @@ -93,60 +93,60 @@ char *VMGather(CHOICE *list) { } -VMENU *VMENU::Addr = NULL; -int VMENU::Recent = -1; +Vmenu *Vmenu::_addr = NULL; +int Vmenu::_recent = -1; -VMENU::VMENU(CGEEngine *vm, CHOICE *list, int x, int y) - : Talk(vm, VMGather(list), RECT), Menu(list), Bar(NULL), _vm(vm) { - CHOICE *cp; +Vmenu::Vmenu(CGEEngine *vm, Choice *list, int x, int y) + : Talk(vm, VMGather(list), RECT), _menu(list), _bar(NULL), _vm(vm) { + Choice *cp; - Addr = this; + _addr = this; delete[] vmgt; - Items = 0; - for (cp = list; cp->Text; cp++) - Items++; + _items = 0; + for (cp = list; cp->_text; cp++) + _items++; _flags._bDel = true; _flags._kill = true; if (x < 0 || y < 0) center(); else gotoxy(x - _w / 2, y - (TEXT_VM + FONT_HIG / 2)); - Vga->_showQ->insert(this, Vga->_showQ->last()); - Bar = new MENU_BAR(_vm, _w - 2 * TEXT_HM); - Bar->gotoxy(_x + TEXT_HM - MB_HM, _y + TEXT_VM - MB_VM); - Vga->_showQ->insert(Bar, Vga->_showQ->last()); + _vga->_showQ->insert(this, _vga->_showQ->last()); + _bar = new MenuBar(_vm, _w - 2 * TEXT_HM); + _bar->gotoxy(_x + TEXT_HM - MB_HM, _y + TEXT_VM - MB_VM); + _vga->_showQ->insert(_bar, _vga->_showQ->last()); } -VMENU::~VMENU(void) { - Addr = NULL; +Vmenu::~Vmenu(void) { + _addr = NULL; } -void VMENU::touch(uint16 mask, int x, int y) { +void Vmenu::touch(uint16 mask, int x, int y) { uint16 h = FONT_HIG + TEXT_LS; bool ok = false; - if (Items) { + if (_items) { Sprite::touch(mask, x, y); y -= TEXT_VM - 1; int n = 0; if (y >= 0) { n = y / h; - if (n < Items) + if (n < _items) ok = (x >= TEXT_HM && x < _w - TEXT_HM/* && y % h < FONT_HIG*/); else - n = Items - 1; + n = _items - 1; } - Bar->gotoxy(_x + TEXT_HM - MB_HM, _y + TEXT_VM + n * h - MB_VM); + _bar->gotoxy(_x + TEXT_HM - MB_HM, _y + TEXT_VM + n * h - MB_VM); if (ok && (mask & L_UP)) { - Items = 0; + _items = 0; SNPOST_(SNKILL, -1, 0, this); - //Menu[Recent = n].Proc(); + //_menu[_recent = n].Proc(); warning("Missing call to proc()"); } } diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index 88a2766040..6b4eb85a53 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -36,29 +36,29 @@ namespace CGE { #define MB_HM 3 -typedef struct { - const char *Text; +struct Choice { + const char *_text; void (CGEEngine::*Proc)(); -} CHOICE; +}; -class MENU_BAR : public Talk { +class MenuBar : public Talk { public: - MENU_BAR(CGEEngine *vm, uint16 w); + MenuBar(CGEEngine *vm, uint16 w); private: CGEEngine *_vm; }; -class VMENU : public Talk { - uint16 Items; - CHOICE *Menu; +class Vmenu : public Talk { + uint16 _items; + Choice *_menu; public: - static VMENU *Addr; - static int Recent; - MENU_BAR *Bar; - VMENU(CGEEngine *vm, CHOICE *list, int x, int y); - ~VMENU(); + static Vmenu *_addr; + static int _recent; + MenuBar *_bar; + Vmenu(CGEEngine *vm, Choice *list, int x, int y); + ~Vmenu(); virtual void touch(uint16 mask, int x, int y); private: CGEEngine *_vm; diff --git a/engines/cge/vol.cpp b/engines/cge/vol.cpp index 332ae869c8..2988f9ab11 100644 --- a/engines/cge/vol.cpp +++ b/engines/cge/vol.cpp @@ -31,25 +31,25 @@ namespace CGE { -DAT *VFILE::_dat = NULL; -BtFile *VFILE::_cat = NULL; -VFILE *VFILE::_recent = NULL; +Dat *VFile::_dat = NULL; +BtFile *VFile::_cat = NULL; +VFile *VFile::_recent = NULL; /*-----------------------------------------------------------------------*/ -DAT::DAT(): +Dat::Dat(): #ifdef VOL_UPD - _File(DAT_NAME, UPD, CRP) + _file(DAT_NAME, UPD, CRP) #else - _File(DAT_NAME, REA, CRP) + _file(DAT_NAME, REA, CRP) #endif { } /*-----------------------------------------------------------------------*/ -void VFILE::init() { - _dat = new DAT(); +void VFile::init() { + _dat = new Dat(); #ifdef VOL_UPD _cat = new BtFile(CAT_NAME, UPD, CRP); #else @@ -59,15 +59,15 @@ void VFILE::init() { _recent = NULL; } -void VFILE::deinit() { +void VFile::deinit() { delete _dat; delete _cat; } -VFILE::VFILE(const char *name, IOMODE mode) +VFile::VFile(const char *name, IOMODE mode) : IoBuf(mode) { if (mode == REA) { - if (_dat->_File._error || _cat->_error) + if (_dat->_file._error || _cat->_error) error("Bad volume data"); BtKeypack *kp = _cat->find(name); if (scumm_stricmp(kp->_key, name) != 0) @@ -81,27 +81,27 @@ VFILE::VFILE(const char *name, IOMODE mode) } -VFILE::~VFILE(void) { +VFile::~VFile() { if (_recent == this) _recent = NULL; } -bool VFILE::exist(const char *name) { +bool VFile::exist(const char *name) { return scumm_stricmp(_cat->find(name)->_key, name) == 0; } -void VFILE::readBuff(void) { +void VFile::readBuff() { if (_recent != this) { - _dat->_File.seek(_bufMark + _lim); + _dat->_file.seek(_bufMark + _lim); _recent = this; } - _bufMark = _dat->_File.mark(); + _bufMark = _dat->_file.mark(); long n = _endMark - _bufMark; if (n > IOBUF_SIZE) n = IOBUF_SIZE; - _lim = _dat->_File.read(_buff, (uint16) n); + _lim = _dat->_file.read(_buff, (uint16) n); _ptr = 0; } diff --git a/engines/cge/vol.h b/engines/cge/vol.h index 1e0b363ca5..d8ba0979cb 100644 --- a/engines/cge/vol.h +++ b/engines/cge/vol.h @@ -49,11 +49,11 @@ namespace CGE { #endif -class DAT { - friend class VFILE; - VOLBASE _File; +class Dat { + friend class VFile; + VOLBASE _file; public: - DAT(); + Dat(); bool append(uint8 *buf, uint16 len); bool write(CFile &f); @@ -61,11 +61,11 @@ public: }; -class VFILE : public IoBuf { +class VFile : public IoBuf { private: - static DAT *_dat; + static Dat *_dat; static BtFile *_cat; - static VFILE *_recent; + static VFile *_recent; long _begMark; long _endMark; @@ -74,17 +74,17 @@ private: void writeBuff(void) { } void make(const char *fspec); public: - VFILE(const char *name, IOMODE mode = REA); - ~VFILE(void); + VFile(const char *name, IOMODE mode = REA); + ~VFile(); static void init(); static void deinit(); static bool exist(const char *name); - static const char *next(void); - long mark(void) { + static const char *next(); + long mark() { return (_bufMark + _ptr) - _begMark; } - long size(void) { + long size() { return _endMark - _begMark; } long seek(long pos) { |