diff options
author | Strangerke | 2011-07-02 01:02:14 +0200 |
---|---|---|
committer | Strangerke | 2011-07-02 01:02:14 +0200 |
commit | 8e531d0da391b895a573c36c4b1bd8074571df83 (patch) | |
tree | f4c67a215f3e552540f36fdda0c28f7524e325cb /engines | |
parent | 601bfbd6095a88b2f6b77d2dec16731fe4fbf687 (diff) | |
download | scummvm-rg350-8e531d0da391b895a573c36c4b1bd8074571df83.tar.gz scummvm-rg350-8e531d0da391b895a573c36c4b1bd8074571df83.tar.bz2 scummvm-rg350-8e531d0da391b895a573c36c4b1bd8074571df83.zip |
CGE: Some more renaming (WIP)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cge/bitmap.cpp | 23 | ||||
-rw-r--r-- | engines/cge/bitmap.h | 16 | ||||
-rw-r--r-- | engines/cge/cge.cpp | 2 | ||||
-rw-r--r-- | engines/cge/cge_main.cpp | 165 | ||||
-rw-r--r-- | engines/cge/config.cpp | 8 | ||||
-rw-r--r-- | engines/cge/game.cpp | 8 | ||||
-rw-r--r-- | engines/cge/general.cpp | 61 | ||||
-rw-r--r-- | engines/cge/general.h | 36 | ||||
-rw-r--r-- | engines/cge/gettext.cpp | 72 | ||||
-rw-r--r-- | engines/cge/gettext.h | 25 | ||||
-rw-r--r-- | engines/cge/ident.h | 10 | ||||
-rw-r--r-- | engines/cge/jbw.h | 36 | ||||
-rw-r--r-- | engines/cge/keybd.cpp | 24 | ||||
-rw-r--r-- | engines/cge/keybd.h | 22 | ||||
-rw-r--r-- | engines/cge/mixer.cpp | 74 | ||||
-rw-r--r-- | engines/cge/mixer.h | 24 | ||||
-rw-r--r-- | engines/cge/mouse.cpp | 20 | ||||
-rw-r--r-- | engines/cge/snail.cpp | 100 | ||||
-rw-r--r-- | engines/cge/snddrv.h | 16 | ||||
-rw-r--r-- | engines/cge/sound.cpp | 2 | ||||
-rw-r--r-- | engines/cge/startup.cpp | 51 | ||||
-rw-r--r-- | engines/cge/talk.cpp | 8 | ||||
-rw-r--r-- | engines/cge/text.cpp | 18 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 146 | ||||
-rw-r--r-- | engines/cge/vga13h.h | 59 | ||||
-rw-r--r-- | engines/cge/vmenu.cpp | 12 |
26 files changed, 513 insertions, 525 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 959301bf50..dc06d9944e 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -48,7 +48,7 @@ void Bitmap::deinit() { #pragma argsused Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL) { char pat[MAXPATH]; - ForceExt(pat, fname, ".VBM"); + forceExt(pat, fname, ".VBM"); #if (BMP_MODE < 2) if (rem && PIC_FILE::exist(pat)) { @@ -130,10 +130,10 @@ Bitmap::Bitmap(const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL) { Bitmap::~Bitmap(void) { - if (MemType(_m) == FAR_MEM) + if (memType(_m) == FAR_MEM) free(_m); - switch (MemType(_v)) { + switch (memType(_v)) { case NEAR_MEM : delete[](uint8 *) _v; break; @@ -152,7 +152,7 @@ Bitmap &Bitmap::operator = (const Bitmap &bmp) { _w = bmp._w; _h = bmp._h; _m = NULL; - if (MemType(_v) == FAR_MEM) + if (memType(_v) == FAR_MEM) free(_v); if (v0 == NULL) _v = NULL; @@ -174,7 +174,7 @@ uint16 Bitmap::moveVmap(uint8 *buf) { uint16 vsiz = (uint8 *)_b - (uint8 *)_v; uint16 siz = vsiz + _h * sizeof(HideDesc); memcpy(buf, _v, siz); - if (MemType(_v) == FAR_MEM) + if (memType(_v) == FAR_MEM) free(_v); _b = (HideDesc *)((_v = buf) + vsiz); return siz; @@ -188,7 +188,7 @@ BMP_PTR Bitmap::code(void) { uint16 i, cnt; if (_v) { // old X-map exists, so remove it - switch (MemType(_v)) { + switch (memType(_v)) { case NEAR_MEM : delete[](uint8 *) _v; break; @@ -450,19 +450,20 @@ bool Bitmap::loadBMP(XFile *f) { union { int16 _2E; int32 _2E_; }; union { int16 _32; int32 _32_; }; } hea; - BGR4 bpal[256]; + + Bgr4 bpal[256]; f->read((byte *)&hea, sizeof(hea)); if (f->_error == 0) { if (hea.hdr == 0x436L) { - int16 i = (hea.hdr - sizeof(hea)) / sizeof(BGR4); + int16 i = (hea.hdr - sizeof(hea)) / sizeof(Bgr4); f->read((byte *)&bpal, sizeof(bpal)); if (f->_error == 0) { if (_pal) { for (i = 0; i < 256; i ++) { - _pal[i]._r = bpal[i].R; - _pal[i]._g = bpal[i].G; - _pal[i]._b = bpal[i].B; + _pal[i]._r = bpal[i]._R; + _pal[i]._g = bpal[i]._G; + _pal[i]._b = bpal[i]._B; } _pal = NULL; } diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index 99464bffeb..846f0149be 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -41,14 +41,14 @@ namespace CGE { #include "common/pack-start.h" -struct BGR4 { - uint16 b : 2; - uint16 B : 6; - uint16 g : 2; - uint16 G : 6; - uint16 r : 2; - uint16 R : 6; - uint16 Z : 8; +struct Bgr4 { + uint16 _b : 2; + uint16 _B : 6; + uint16 _g : 2; + uint16 _G : 6; + uint16 _r : 2; + uint16 _R : 6; + uint16 _Z : 8; }; diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index e844322e0e..43d74ab3a5 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -61,7 +61,7 @@ void CGEEngine::setup() { TALK::init(); // Initialise engine objects - Text = new TEXT(this, ProgName(), 128); + Text = new TEXT(this, progName(), 128); Vga = new VGA(M13H); _heart = new Heart; Hero = new WALK(this, NULL); diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 2d4f004632..0d8bef4b85 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -136,7 +136,6 @@ int PocPtr = 0; static EMS *Mini = MiniEmm.alloc((uint16)MINI_EMM_SIZE); static BMP_PTR *MiniShpList = NULL; static BMP_PTR MiniShp[] = { NULL, NULL }; -static KEYBOARD Keyboard; static bool Finis = false; static int Startup = 1; int OffUseCount; @@ -282,7 +281,7 @@ void CGEEngine::loadGame(XFile &file, bool tiny = false) { break; S._prev = S._next = NULL; - spr = (scumm_stricmp(S.File + 2, "MUCHA") == 0) ? new Fly(this, NULL) + spr = (scumm_stricmp(S._file + 2, "MUCHA") == 0) ? new Fly(this, NULL) : new Sprite(this, NULL); if (spr == NULL) error("No core"); @@ -299,7 +298,7 @@ void CGEEngine::loadGame(XFile &file, bool tiny = false) { static void SaveSound(void) { - CFile cfg(UsrPath(ProgName(CFG_EXT)), WRI); + CFile cfg(UsrPath(progName(CFG_EXT)), WRI); if (!cfg._error) cfg.write(&SNDDrvInfo, sizeof(SNDDrvInfo) - sizeof(SNDDrvInfo.VOL2)); } @@ -365,7 +364,7 @@ static void noWay() { static void LoadHeroXY(void) { - INI_FILE cf(ProgName(".HXY")); + INI_FILE cf(progName(".HXY")); memset(HeroXY, 0, sizeof(HeroXY)); if (!cf._error) cf.CFREAD(&HeroXY); @@ -374,7 +373,7 @@ static void LoadHeroXY(void) { static void LoadMapping(void) { if (Now <= CAVE_MAX) { - INI_FILE cf(ProgName(".TAB")); + INI_FILE cf(progName(".TAB")); if (!cf._error) { memset(Cluster::_map, 0, sizeof(Cluster::_map)); cf.seek((Now - 1) * sizeof(Cluster::_map)); @@ -427,7 +426,7 @@ void WALK::tick() { turn(d); } } - Step(); + step(); if ((Dir == WW && _x <= 0) || (Dir == EE && _x + _w >= SCR_WID) || (Dir == SS && _y + _w >= WORLD_HIG - 2)) @@ -465,7 +464,7 @@ int WALK::distance(Sprite *spr) { void WALK::turn(DIR d) { DIR dir = (Dir == NO_DIR) ? SS : Dir; if (d != Dir) { - Step((d == dir) ? (1 + dir + dir) : (9 + 4 * dir + d)); + step((d == dir) ? (1 + dir + dir) : (9 + 4 * dir + d)); Dir = d; } } @@ -476,7 +475,7 @@ void WALK::park(void) { ++_time; if (Dir != NO_DIR) { - Step(9 + 4 * Dir + Dir); + step(9 + 4 * Dir + Dir); Dir = NO_DIR; _tracePtr = -1; } @@ -566,7 +565,7 @@ SQUARE::SQUARE(CGEEngine *vm) void SQUARE::Touch(uint16 mask, int x, int y) { - Sprite::Touch(mask, x, y); + Sprite::touch(mask, x, y); if (mask & L_UP) { XZ(_x + x, _y + y).cell() = 0; SNPOST_(SNKILL, -1, 0, this); @@ -578,11 +577,11 @@ void CGEEngine::setMapBrick(int x, int z) { SQUARE *s = new SQUARE(this); if (s) { static char n[] = "00:00"; - s->Goto(x * MAP_XGRID, MAP_TOP + z * MAP_ZGRID); + s->gotoxy(x * MAP_XGRID, MAP_TOP + z * MAP_ZGRID); wtom(x, n + 0, 10, 2); wtom(z, n + 3, 10, 2); Cluster::_map[z][x] = 1; - s->SetName(n); + s->setName(n); Vga->ShowQ->Insert(s, Vga->ShowQ->First()); } } @@ -621,7 +620,7 @@ void CGEEngine::quit() { } 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)); + (new VMENU(this, QuitMenu, -1, -1))->setName(Text->getText(QUIT_TITLE)); SNPOST_(SNSEQ, 123, 1, NULL); KeyClick(); } @@ -677,12 +676,12 @@ static void ShowBak(int ref) { Sprite *spr = Vga->SpareQ->Locate(ref); if (spr) { Bitmap::_pal = VGA::SysPal; - spr->Expand(); + spr->expand(); Bitmap::_pal = NULL; - spr->Show(2); + spr->show(2); Vga->CopyPage(1, 2); Sys->SetPal(); - spr->Contract(); + spr->contract(); } } @@ -701,7 +700,7 @@ static void caveUp() { if (spr->_cave == Now || spr->_cave == 0) if (spr->_ref != BakRef) { if (spr->_flags._back) - spr->BackShow(); + spr->backShow(); else ExpandSprite(spr); } @@ -715,9 +714,9 @@ static void caveUp() { } if (Hero) { - Hero->Goto(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->tick(); Hero->_time = 1; Hero->_flags._hide = false; } @@ -732,7 +731,7 @@ static void caveUp() { if (_shadow) { Vga->ShowQ->Remove(_shadow); - _shadow->MakeXlat(glass(VGA::SysPal, 204, 204, 204)); + _shadow->makeXlat(glass(VGA::SysPal, 204, 204, 204)); Vga->ShowQ->Insert(_shadow, Hero); _shadow->_z = Hero->_z; } @@ -797,13 +796,13 @@ void CGEEngine::switchCave(int cav) { Mouse->Off(); if (Hero) { Hero->park(); - Hero->Step(0); + Hero->step(0); if (!_isDemo) ///// protection: auto-destruction on! ---------------------- Vga->SpareQ->Show = STARTUP::Summa * (cav <= CAVE_MAX); /////-------------------------------------------------------- } - _cavLight->Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, + _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) @@ -838,16 +837,16 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { pp0 = pp; switch (x) { case Del: - if (KEYBOARD::Key[ALT] && KEYBOARD::Key[CTRL]) + if (Keyboard::_key[ALT] && Keyboard::_key[CTRL]) AltCtrlDel(); else KillSprite(); break; case 'F': - if (KEYBOARD::Key[ALT]) { + if (Keyboard::_key[ALT]) { Sprite *m = Vga->ShowQ->Locate(17001); if (m) { - m->Step(1); + m->step(1); m->_time = 216; // 3s } } @@ -862,7 +861,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { NextStep(); break; case '`': - if (KEYBOARD::Key[ALT]) + if (Keyboard::_key[ALT]) SaveMapping(); else _vm->switchMapping(); @@ -871,28 +870,28 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { 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; break; case 'X': - if (KEYBOARD::Key[ALT]) + if (Keyboard::_key[ALT]) Finis = true; break; case '0': @@ -900,7 +899,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { case '2': case '3': case '4': - if (KEYBOARD::Key[ALT]) { + if (Keyboard::_key[ALT]) { SNPOST(SNLEVEL, -1, x - '0', NULL); break; } @@ -910,7 +909,7 @@ void SYSTEM::Touch(uint16 mask, int x, int y) { case '8': case '9': if (_sprite) - _sprite->Step(x - '0'); + _sprite->step(x - '0'); break; case F10 : if (Snail->Idle() && ! Hero->_flags._hide) @@ -1036,7 +1035,7 @@ static void SwitchColorMode(void) { static void SwitchMusic(void) { - if (KEYBOARD::Key[ALT]) { + if (Keyboard::_key[ALT]) { if (VMENU::Addr) SNPOST_(SNKILL, -1, 0, VMENU::Addr); else { @@ -1067,14 +1066,14 @@ void CGEEngine::startCountDown() { void CGEEngine::takeName() { - if (GET_TEXT::Ptr) - SNPOST_(SNKILL, -1, 0, GET_TEXT::Ptr); + if (GetText::_ptr) + SNPOST_(SNKILL, -1, 0, GetText::_ptr); else { - GET_TEXT *tn = new GET_TEXT(this, Text->getText(GETNAME_PROMPT), UsrFnam, 8, KeyClick); + GetText *tn = new GetText(this, Text->getText(GETNAME_PROMPT), UsrFnam, 8, KeyClick); if (tn) { - tn->SetName(Text->getText(GETNAME_TITLE)); - tn->Center(); - tn->Goto(tn->_x, tn->_y - 10); + tn->setName(Text->getText(GETNAME_TITLE)); + tn->center(); + tn->gotoxy(tn->_x, tn->_y - 10); tn->_z = 126; Vga->ShowQ->Insert(tn); } @@ -1146,14 +1145,14 @@ static void NextStep(void) { static void SaveMapping() { { - IoHand cf(ProgName(".TAB"), UPD); + IoHand cf(progName(".TAB"), UPD); if (!cf._error) { cf.seek((Now - 1) * sizeof(Cluster::_map)); cf.write((uint8 *) Cluster::_map, sizeof(Cluster::_map)); } } { - IoHand cf(ProgName(".HXY"), WRI); + IoHand cf(progName(".HXY"), WRI); if (!cf._error) { HeroXY[Now - 1]._x = Hero->_x; HeroXY[Now - 1]._y = Hero->_y; @@ -1186,7 +1185,7 @@ static char DebugText[] = " N=00000 F=000000 X=000 Y=000 FPS=0000\0S=00:00 0 static void SayDebug(void) { if (!DebugLine->_flags._hide) { static long t = -1L; - long t1 = Timer(); + long t1 = timer(); if (t1 - t >= 18) { static uint32 old = 0L; @@ -1239,9 +1238,9 @@ void CGEEngine::optionTouch(int opt, uint16 mask) { if (mask & L_UP) SwitchMusic(); else if (mask & R_UP) - if (! MIXER::Appear) { - MIXER::Appear = true; - new MIXER(this, BUTTON_X, BUTTON_Y); + if (!Mixer::_appear) { + Mixer::_appear = true; + new Mixer(this, BUTTON_X, BUTTON_Y); } break; case 3 : @@ -1253,10 +1252,10 @@ void CGEEngine::optionTouch(int opt, uint16 mask) { #pragma argsused -void Sprite::Touch(uint16 mask, int x, int y) { +void Sprite::touch(uint16 mask, int x, int y) { Sys->FunTouch(); if ((mask & ATTN) == 0) { - InfoLine->Update(Name()); + InfoLine->Update(name()); if (mask & (R_DN | L_DN)) _sprite = this; if (_ref / 10 == 12) { @@ -1273,7 +1272,7 @@ void Sprite::Touch(uint16 mask, int x, int y) { Sprite *ps = (_pocLight->_seqPtr) ? _pocket[PocPtr] : NULL; if (ps) { if (_flags._kept || Hero->distance(this) < MAX_DISTANCE) { - if (Works(ps)) { + if (works(ps)) { FeedSnail(ps, TAKE); } else OffUse(); @@ -1295,8 +1294,8 @@ void Sprite::Touch(uint16 mask, int x, int y) { _flags._port = false; } } else { - if (TakePtr != NO_PTR) { - if (SnList(TAKE)[TakePtr].Com == SNNEXT) + if (_takePtr != NO_PTR) { + if (snList(TAKE)[_takePtr].Com == SNNEXT) OffUse(); else FeedSnail(this, TAKE); @@ -1345,7 +1344,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int int i, lcnt = 0; uint16 len; - MergeExt(line, fname, SPR_EXT); + mergeExt(line, fname, SPR_EXT); if (INI_FILE::exist(line)) { // sprite description file exist INI_FILE sprf(line); if (sprf._error) @@ -1358,7 +1357,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int if (len == 0 || *line == '.') continue; - if ((i = TakeEnum(Comd, strtok(line, " =\t"))) < 0) + if ((i = takeEnum(Comd, strtok(line, " =\t"))) < 0) error("%s [%s]", NumStr("Bad line ######", lcnt), (const char *)fname); @@ -1366,7 +1365,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int case 0 : // Name - will be taken in Expand routine break; case 1 : // Type - if ((type = TakeEnum(Type, strtok(NULL, " \t,;/"))) < 0) + if ((type = takeEnum(Type, strtok(NULL, " \t,;/"))) < 0) error("%s [%s]", NumStr("Bad line ######", lcnt), (const char *)fname); break; case 2 : // Phase @@ -1394,7 +1393,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int case 1 : { // AUTO _sprite = new Sprite(this, NULL); if (_sprite) { - _sprite->Goto(col, row); + _sprite->gotoxy(col, row); //Sprite->Time = 1;//-----------$$$$$$$$$$$$$$$$ } break; @@ -1402,7 +1401,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int case 2 : { // WALK WALK *w = new WALK(this, NULL); if (w && ref == 1) { - w->Goto(col, row); + w->gotoxy(col, row); if (Hero) error("2nd HERO [%s]", fname); Hero = w; @@ -1453,7 +1452,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int default: { // DEAD _sprite = new Sprite(this, NULL); if (_sprite) - _sprite->Goto(col, row); + _sprite->gotoxy(col, row); break; } } @@ -1468,8 +1467,8 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int _sprite->_flags._bDel = true; // Extract the filename, without the extension - strcpy(_sprite->File, fname); - char *p = strchr(_sprite->File, '.'); + strcpy(_sprite->_file, fname); + char *p = strchr(_sprite->_file, '.'); if (p) *p = '\0'; @@ -1574,14 +1573,14 @@ void CGEEngine::loadUser() { SVG0FILE file = SVG0FILE(SVG0NAME); loadGame(file); } else { - loadScript(ProgName(INI_EXT)); + loadScript(progName(INI_EXT)); Music = true; CFile file = CFile(SVG0NAME, WRI); SaveGame(file); error("Ok [%s]", SVG0NAME); } } - loadScript(ProgName(IN0_EXT)); + loadScript(progName(IN0_EXT)); } @@ -1602,7 +1601,7 @@ void CGEEngine::runGame() { { 1, 6, 0, 0, 4 }, { 0, 1, 0, 0, 16 }, }; - _pocLight->SetSeq(pocSeq); + _pocLight->setSeq(pocSeq); _pocLight->_flags._tran = true; _pocLight->_time = 1; _pocLight->_z = 120; @@ -1619,7 +1618,7 @@ 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); + _sprite->step(Music); SNPOST_(SNSEQ, -1, Music, _sprite); if (! Music) KillMIDI(); @@ -1631,9 +1630,9 @@ void CGEEngine::runGame() { ExpandSprite(_miniCave = _sprite); // NULL is ok if (_miniCave) { _miniCave->_flags._hide = true; - _miniCave->MoveShapes(ptr); - MiniShp[0] = new Bitmap(*_miniCave->Shp()); - MiniShpList = _miniCave->SetShapeList(MiniShp); + _miniCave->moveShapes(ptr); + MiniShp[0] = new Bitmap(*_miniCave->shp()); + MiniShpList = _miniCave->setShapeList(MiniShp); PostMiniStep(-1); } } @@ -1641,7 +1640,7 @@ void CGEEngine::runGame() { if (Hero) { ExpandSprite(Hero); - Hero->Goto(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) { @@ -1653,7 +1652,7 @@ void CGEEngine::runGame() { } } - InfoLine->Goto(INFO_X, INFO_Y); + InfoLine->gotoxy(INFO_X, INFO_Y); InfoLine->_flags._tran = true; InfoLine->Update(NULL); Vga->ShowQ->Insert(InfoLine); @@ -1672,11 +1671,11 @@ void CGEEngine::runGame() { Startup = 0; SNPOST(SNLEVEL, -1, OldLev, &_cavLight); - _cavLight->Goto(CAVE_X + ((Now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX, + _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); + Keyboard::setClient(Sys); // main loop while (! Finis) { //TODO Change the SNPOST message send to a special way to send function pointer @@ -1685,7 +1684,7 @@ void CGEEngine::runGame() { mainLoop(); } - KEYBOARD::SetClient(NULL); + Keyboard::setClient(NULL); _heart->_enable = false; SNPOST(SNCLEAR, -1, 0, NULL); SNPOST_(SNCLEAR, -1, 0, NULL); @@ -1698,7 +1697,7 @@ void CGEEngine::runGame() { void CGEEngine::movie(const char *ext) { - const char *fn = ProgName(ext); + const char *fn = progName(ext); if (INI_FILE::exist(fn)) { loadScript(fn); ExpandSprite(Vga->SpareQ->Locate(999)); @@ -1708,11 +1707,11 @@ void CGEEngine::movie(const char *ext) { //Vga->ShowQ->Append(Mouse); _heart->_enable = true; - KEYBOARD::SetClient(Sys); + Keyboard::setClient(Sys); while (!Snail->Idle()) mainLoop(); - KEYBOARD::SetClient(NULL); + Keyboard::setClient(NULL); _heart->_enable = false; SNPOST(SNCLEAR, -1, 0, NULL); SNPOST_(SNCLEAR, -1, 0, NULL); @@ -1731,12 +1730,12 @@ bool CGEEngine::showTitle(const char *name) { Sprite D(this, LB); D._flags._kill = true; D._flags._bDel = true; - D.Center(); - D.Show(2); + D.center(); + D.show(2); if (STARTUP::Mode == 2) { inf(SVG0NAME); - Talk->Show(2); + Talk->show(2); } Vga->Sunset(); @@ -1764,7 +1763,7 @@ bool CGEEngine::showTitle(const char *name) { if (STARTUP::Mode < 2) { if (_isDemo) { - strcpy(UsrFnam, ProgName(SVG_EXT)); + strcpy(UsrFnam, progName(SVG_EXT)); usr_ok = true; } else { //----------------------------------------- @@ -1774,10 +1773,10 @@ bool CGEEngine::showTitle(const char *name) { #else // Boot * b = ReadBoot(getdisk()); warning("ShowTitle: FIXME ReadBoot"); - Boot *b = ReadBoot(0); + Boot *b = readBoot(0); uint32 sn = (b->_xSign == 0x29) ? b->_serial : b->_lTotSecs; free(b); - sn -= ((IDENT *)Copr)->disk; + sn -= ((Ident *)Copr)->_disk; STARTUP::Summa |= Lo(sn) | Hi(sn); #endif //----------------------------------------- @@ -1787,10 +1786,10 @@ bool CGEEngine::showTitle(const char *name) { Vga->ShowQ->Append(Mouse); //Mouse.On(); _heart->_enable = true; - for (takeName(); GET_TEXT::Ptr;) + for (takeName(); GetText::_ptr;) mainLoop(); _heart->_enable = false; - if (KEYBOARD::Last() == Enter && *UsrFnam) + if (Keyboard::last() == Enter && *UsrFnam) usr_ok = true; if (usr_ok) strcat(UsrFnam, SVG_EXT); diff --git a/engines/cge/config.cpp b/engines/cge/config.cpp index 702c10ed15..8110e1702f 100644 --- a/engines/cge/config.cpp +++ b/engines/cge/config.cpp @@ -147,10 +147,10 @@ void CGEEngine::selectSound() { if (VMENU::Addr) SNPOST_(SNKILL, -1, 0, VMENU::Addr); inf(Text->getText(STYPE_TEXT)); - Talk->Goto(Talk->_x, FONT_HIG / 2); + Talk->gotoxy(Talk->_x, FONT_HIG / 2); for (i = 0; i < 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)); + (new VMENU(this, DevMenu, SCR_WID / 2, Talk->_y + Talk->_h + TEXT_VM + FONT_HIG))->setName(Text->getText(MENU_TEXT)); } @@ -184,8 +184,8 @@ static int Hlp; void CGEEngine::SNSelect() { inf(Text->getText(Hlp)); - Talk->Goto(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)); + 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)); } diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp index 2a6bc85015..be93709f17 100644 --- a/engines/cge/game.cpp +++ b/engines/cge/game.cpp @@ -69,13 +69,13 @@ int Fly::_l = 20, Fly::Fly(CGEEngine *vm, Bitmap **shpl) : Sprite(vm, shpl), _tx(0), _ty(0), _vm(vm) { - Step(new_random(2)); - Goto(_l + new_random(_r - _l - _w), _t + new_random(_b - _t - _h)); + step(new_random(2)); + gotoxy(_l + new_random(_r - _l - _w), _t + new_random(_b - _t - _h)); } void Fly::tick() { - Step(); + step(); if (!_flags._kept) { if (new_random(10) < 1) { _tx = new_random(3) - 1; @@ -85,7 +85,7 @@ void Fly::tick() { _tx = -_tx; if (_y + _ty < _t || _y + _ty + _h > _b) _ty = -_ty; - Goto(_x + _tx, _y + _ty); + gotoxy(_x + _tx, _y + _ty); } } diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index 803100d0d4..b285278842 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -95,12 +95,12 @@ Dac _stdPal[] = {// R G B DRVINFO SNDDrvInfo; -EC void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *)) { +void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *)) { warning("STUB: _fqsort"); } -const char *ProgName(const char *ext) { - warning("ProgName"); +const char *progName(const char *ext) { + warning("progName"); static Common::String buf = "CGE"; if (ext) @@ -108,11 +108,11 @@ const char *ProgName(const char *ext) { return buf.c_str(); } -char *MergeExt(char *buf, const char *nam, const char *ext) { +char *mergeExt(char *buf, const char *nam, const char *ext) { // char dr[MAXDRIVE], di[MAXDIR], na[MAXFILE], ex[MAXEXT]; // fnmerge(buf, dr, di, na, (fnsplit(nam, dr, di, na, ex) & EXTENSION) ? ex : ext); // return buf; - warning("MergeExt"); + warning("mergeExt"); strcpy(buf, nam); char *dot = strrchr(buf, '.'); @@ -122,7 +122,7 @@ char *MergeExt(char *buf, const char *nam, const char *ext) { return buf; } -char *ForceExt(char *buf, const char *nam, const char *ext) { +char *forceExt(char *buf, const char *nam, const char *ext) { // char dr[MAXDRIVE], di[MAXDIR], na[MAXFILE], ex[MAXEXT]; // fnsplit(nam, dr, di, na, ex); // fnmerge(buf, dr, di, na, ext); @@ -279,7 +279,7 @@ bool IoHand::exist(const char *name) { //#define EMS_ADR(a) (FP_SEG(a) > 0xA000) //#define HNODE_OK(p) (heapchecknode(p)==4) -MEM_TYPE MemType(void *mem) { +MEM_TYPE memType(void *mem) { /* if (FP_SEG(mem) == _DS) { if (heapchecknode((void *)mem)==4) return NEAR_MEM; @@ -291,39 +291,39 @@ MEM_TYPE MemType(void *mem) { } return BAD_MEM; */ - warning("STUB: MemType"); + warning("STUB: memType"); return FAR_MEM; } -bool IsVga() { +bool isVga() { return true; } -EC void SNDInit() { +void SNDInit() { warning("STUB: SNDInit"); } -EC void SNDDone() { +void SNDDone() { // FIXME: STUB: SNDDone } -EC void SNDSetVolume() { +void SNDSetVolume() { warning("STUB: SNDSetVolume"); } -EC void SNDDigiStart(SMPINFO *PSmpInfo) { +void SNDDigiStart(SMPINFO *PSmpInfo) { warning("STUB: SNDDigitStart"); } -EC void SNDDigiStop(SMPINFO *PSmpInfo) { +void SNDDigiStop(SMPINFO *PSmpInfo) { warning("STUB: SNDDigiStop"); } -EC void SNDMIDIStart(uint8 *MIDFile) { +void SNDMIDIStart(uint8 *MIDFile) { warning("STUB: SNDMIDIStart"); } -EC void SNDMIDIStop() { +void SNDMIDIStop() { // FIXME: STUB: SNDMIDIStop } @@ -332,7 +332,7 @@ DATACK *LoadWave(XFile *file, EMM *emm) { return NULL; } -int TakeEnum(const char **tab, const char *txt) { +int takeEnum(const char **tab, const char *txt) { const char **e; if (txt) { for (e = tab; *e; e++) { @@ -344,22 +344,25 @@ int TakeEnum(const char **tab, const char *txt) { return -1; } -Boot *ReadBoot(int drive) { +Boot *readBoot(int drive) { /* - struct fatinfo fi; Boot *b; - getfat(drive+1, &fi); - if (fi.fi_sclus & 0x80) return NULL; - if ((b = malloc(fi.fi_bysec)) == NULL) return NULL; - // read boot sector - if (absread(drive, 1, 0L, b) == 0) return b; - free(b); - return NULL; + struct fatinfo fi; Boot *b; + getfat(drive+1, &fi); + if (fi.fi_sclus & 0x80) + return NULL; + if ((b = malloc(fi.fi_bysec)) == NULL) + return NULL; + // read boot sector + if (absread(drive, 1, 0L, b) == 0) + return b; + free(b); + return NULL; */ - warning("STUB: ReadBoot"); + warning("STUB: readBoot"); return NULL; } -long Timer(void) { +long timer(void) { /* asm mov ax,0x40 asm mov es,ax @@ -367,7 +370,7 @@ long Timer(void) { asm mov dx,es:[0x6E] return ((long) _DX << 16) | _CX; */ - warning("STUB: Timer"); + warning("STUB: timer"); return 0; } diff --git a/engines/cge/general.h b/engines/cge/general.h index 3c94e22ae4..cff00fb7f3 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -208,35 +208,35 @@ public: CRYPT XCrypt; CRYPT RCrypt; -MEM_TYPE MemType(void *mem); +MEM_TYPE memType(void *mem); uint16 atow(const char *a); uint16 xtow(const char *x); char *wtom(uint16 val, char *str, int radix, int len); char *dwtom(uint32 val, char *str, int radix, int len); -int TakeEnum(const char **tab, const char *txt); -uint16 ChkSum(void *m, uint16 n); -long Timer(void); -char *MergeExt(char *buf, const char *nam, const char *ext); -char *ForceExt(char *buf, const char *nam, const char *ext); -int DriveCD(unsigned drv); -bool IsVga(void); +int takeEnum(const char **tab, const char *txt); +uint16 chkSum(void *m, uint16 n); +long timer(); +char *mergeExt(char *buf, const char *nam, const char *ext); +char *forceExt(char *buf, const char *nam, const char *ext); +int driveCD(unsigned drv); +bool isVga(); // MISSING FUNCTIONS -EC void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *)); -const char *ProgName(const char *ext = NULL); -char *MergeExt(char *buf, const char *nam, const char *ext); -char *ForceExt(char *buf, const char *nam, const char *ext); -unsigned FastRand(void); -unsigned FastRand(unsigned s); -uint16 RCrypt(void *buf, uint16 siz, uint16 seed); +void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *)); +const char *progName(const char *ext = NULL); +char *mergeExt(char *buf, const char *nam, const char *ext); +char *forceExt(char *buf, const char *nam, const char *ext); +unsigned fastRand(void); +unsigned fastRand(unsigned s); +uint16 rCrypt(void *buf, uint16 siz, uint16 seed); uint16 atow(const char *a); uint16 xtow(const char *x); char *wtom(uint16 val, char *str, int radix, int len); char *dwtom(uint32 val, char * str, int radix, int len); -int TakeEnum(const char **tab, const char *txt); -Boot *ReadBoot(int drive); -long Timer(void); +int takeEnum(const char **tab, const char *txt); +Boot *readBoot(int drive); +long timer(void); int new_random(int range); } // End of namespace CGE diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp index e3c60b6e21..1b609e2d8b 100644 --- a/engines/cge/gettext.cpp +++ b/engines/cge/gettext.cpp @@ -33,56 +33,56 @@ namespace CGE { -GET_TEXT *GET_TEXT::Ptr = NULL; +GetText *GetText::_ptr = NULL; -GET_TEXT::GET_TEXT(CGEEngine *vm, const char *info, char *text, int size, void (*click)(void)) - : TALK(vm), Text(text), Size(min<int>(size, GTMAX)), Len(min<int>(Size, strlen(text))), - Cntr(GTBLINK), Click(click), OldKeybClient(KEYBOARD::SetClient(this)), _vm(vm) { +GetText::GetText(CGEEngine *vm, const char *info, char *text, int size, void (*click)()) + : TALK(vm), _text(text), _size(min<int>(size, GTMAX)), _len(min<int>(_size, strlen(text))), + _cntr(GTBLINK), _click(click), _oldKeybClient(Keyboard::setClient(this)), _vm(vm) { int i = 2 * TEXT_HM + _Font->Width(info); - Ptr = this; + _ptr = this; Mode = RECT; TS[0] = Box((i + 3) & ~3, 2 * TEXT_VM + 2 * FONT_HIG + TEXT_LS); - SetShapeList(TS); + setShapeList(TS); _flags._bDel = true; _flags._kill = true; - memcpy(Buff, text, Len); - Buff[Len] = ' '; - Buff[Len + 1] = '\0'; + memcpy(_buff, text, _len); + _buff[_len] = ' '; + _buff[_len + 1] = '\0'; PutLine(0, info); - Tick(); + tick(); } -GET_TEXT::~GET_TEXT(void) { - KEYBOARD::SetClient(OldKeybClient); - Ptr = NULL; +GetText::~GetText() { + Keyboard::setClient(_oldKeybClient); + _ptr = NULL; } -void GET_TEXT::Tick(void) { - if (++ Cntr >= GTBLINK) { - Buff[Len] ^= (' ' ^ '_'); - Cntr = 0; +void GetText::tick() { + if (++_cntr >= GTBLINK) { + _buff[_len] ^= (' ' ^ '_'); + _cntr = 0; } - PutLine(1, Buff); + PutLine(1, _buff); _time = GTTIME; } -void GET_TEXT::Touch(uint16 mask, int x, int y) { +void GetText::touch(uint16 mask, int x, int y) { static char ogon[] = "•œ¥£˜ ¡"; static char bezo[] = "ACELNOSXZ"; char *p; if (mask & KEYB) { - if (Click) - Click(); + if (_click) + _click(); switch (x) { case Enter : - Buff[Len] = '\0'; - strcpy(Text, Buff); - for (p = Text; *p; p++) { + _buff[_len] = '\0'; + strcpy(_text, _buff); + for (p = _text; *p; p++) { char *q = strchr(ogon, *p); if (q) *p = bezo[q - ogon]; @@ -91,32 +91,32 @@ void GET_TEXT::Touch(uint16 mask, int x, int y) { SNPOST_(SNKILL, -1, 0, this); break; case BSp : - if (Len) { - --Len; - Buff[Len] = Buff[Len + 1]; - Buff[Len + 1] = Buff[Len + 2]; + if (_len) { + _len--; + _buff[_len] = _buff[_len + 1]; + _buff[_len + 1] = _buff[_len + 2]; } break; default : if (x < 'A' || x > 'Z') { - if (OldKeybClient) - OldKeybClient->Touch(mask, x, y); + if (_oldKeybClient) + _oldKeybClient->touch(mask, x, y); } else { - if (KEYBOARD::Key[ALT]) { + if (Keyboard::_key[ALT]) { p = strchr(bezo, x); if (p) x = ogon[p - bezo]; } - if (Len < Size && 2 * TEXT_HM + _Font->Width(Buff) + _Font->Wid[x] <= _w) { - Buff[Len + 2] = Buff[Len + 1]; - Buff[Len + 1] = Buff[Len]; - Buff[Len++] = x; + if (_len < _size && 2 * TEXT_HM + _Font->Width(_buff) + _Font->Wid[x] <= _w) { + _buff[_len + 2] = _buff[_len + 1]; + _buff[_len + 1] = _buff[_len]; + _buff[_len++] = x; } } break; } } else - Sprite::Touch(mask, x, y); + Sprite::touch(mask, x, y); } } // End of namespace CGE diff --git a/engines/cge/gettext.h b/engines/cge/gettext.h index 33210758af..059d84be41 100644 --- a/engines/cge/gettext.h +++ b/engines/cge/gettext.h @@ -37,18 +37,21 @@ namespace CGE { #define GTBLINK 6 #define GTTIME 6 -class GET_TEXT : public TALK { - char Buff[GTMAX + 2], * Text; - uint16 Size, Len; - uint16 Cntr; - Sprite *OldKeybClient; - void (*Click)(); +class GetText : public TALK { + char _buff[GTMAX + 2]; + char *_text; + uint16 _size; + uint16 _len; + uint16 _cntr; + Sprite *_oldKeybClient; + void (*_click)(); + public: - static GET_TEXT *Ptr; - GET_TEXT(CGEEngine *vm, const char *info, char *text, int size, void (*click)(void) = NULL); - ~GET_TEXT(); - void Touch(uint16 mask, int x, int y); - void Tick(); + static GetText *_ptr; + GetText(CGEEngine *vm, const char *info, char *text, int size, void (*click)(void) = NULL); + ~GetText(); + void touch(uint16 mask, int x, int y); + void tick(); private: CGEEngine *_vm; diff --git a/engines/cge/ident.h b/engines/cge/ident.h index da36bfa682..afdb86d785 100644 --- a/engines/cge/ident.h +++ b/engines/cge/ident.h @@ -30,11 +30,11 @@ namespace CGE { -struct IDENT { - char copr[83]; - char fill[8]; - unsigned long disk; - unsigned char cork; +struct Ident { + char _copr[83]; + char _fill[8]; + unsigned long _disk; + unsigned char _cork; }; } // End of namespace CGE diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 12c6609f4e..359df8a216 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -59,7 +59,7 @@ namespace CGE { #define ArrayCount(a) (sizeof(a) / sizeof((a)[0])) #define MAX_TIMER 0x1800B0L -typedef void (MouseFunType)(void); +typedef void (MouseFunType)(); #define Lo(d) (((int *) &d)[0]) #define Hi(d) (((int *) &d)[1]) @@ -68,7 +68,7 @@ typedef void (MouseFunType)(void); #define K(n) (1024 * (n)) #define MASK(n) ((1 << n) - 1) -typedef enum { +enum Keys { NoKey = 0, CtrlA, CtrlB, CtrlC, CtrlD, CtrlE, CtrlF, CtrlG, CtrlH, CtrlI, CtrlJ, CtrlK, CtrlL, CtrlM, CtrlN, CtrlO, CtrlP, CtrlQ, CtrlR, CtrlS, CtrlT, CtrlU, CtrlV, CtrlW, CtrlX, @@ -112,40 +112,16 @@ typedef enum { MouseRight, TwiceLeft = 512 + 256 + 1, TwiceRight -} Keys; - -struct KeyStatStruct { - int RShift : 1; - int LShift : 1; - int Ctrl : 1; - int Alt : 1; - - int ScrollLock : 1; - int NumLock : 1; - int CapsLock : 1; - int Ins : 1; - - int LeftCtrl : 1; - int LeftAlt : 1; - int Unused : 6; }; #define HGC_Cursor 0x0B0C #define CGA_Cursor 0x0607 #define OFF_Cursor 0x2000 -#define TimerCount (*((volatile long *) ((void _seg *) 0x40 + (void *) 0x6C))) -#define KeyStat (*((volatile struct KeyStatStruct *) ((void _seg *) 0x40 + (void *) 0x17))) -#define BreakFlag (*((volatile uint8 *) ((void _seg *) 0x40 + (void *) 0x71))) -#define PostFlag (*((volatile uint16 *) ((void _seg *) 0x40 + (void *) 0x72))) -#define POST ((void (*)(void)) ((void _seg *) 0xF000 + (void *) 0xFFF0)) - - -#ifdef __cplusplus -#define EC extern "C" -#else -#define EC -#endif +//#define TimerCount (*((volatile long *) ((void _seg *) 0x40 + (void *) 0x6C))) +//#define BreakFlag (*((volatile uint8 *) ((void _seg *) 0x40 + (void *) 0x71))) +//#define PostFlag (*((volatile uint16 *) ((void _seg *) 0x40 + (void *) 0x72))) +//#define POST ((void (*)(void)) ((void _seg *) 0xF000 + (void *) 0xFFF0)) extern uint16 _stklen; diff --git a/engines/cge/keybd.cpp b/engines/cge/keybd.cpp index 8530815b16..45237d15d1 100644 --- a/engines/cge/keybd.cpp +++ b/engines/cge/keybd.cpp @@ -30,10 +30,10 @@ namespace CGE { -Sprite *KEYBOARD::Client = NULL; -uint8 KEYBOARD::Key[0x60] = { 0 }; -uint16 KEYBOARD::Current = 0; -uint16 KEYBOARD::Code[0x60] = { +Sprite *Keyboard::_client = NULL; +uint8 Keyboard::_key[0x60] = { 0 }; +uint16 Keyboard::_current = 0; +uint16 Keyboard::_code[0x60] = { 0, Esc, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '+', BSp, @@ -56,20 +56,20 @@ uint16 KEYBOARD::Code[0x60] = { 0 * 0x5F }; -void (* KEYBOARD::OldKeyboard)(...); +void (* Keyboard::OldKeyboard)(...); -KEYBOARD::KEYBOARD(void) { +Keyboard::Keyboard() { // steal keyboard interrupt /* TODO replace totally by scummvm handling OldKeyboard = getvect(KEYBD_INT); setvect(KEYBD_INT, NewKeyboard); */ - warning("STUB: KEYBOARD::KEYBOARD"); + warning("STUB: Keyboard::Keyboard"); } -KEYBOARD::~KEYBOARD(void) { +Keyboard::~Keyboard() { // bring back keyboard interrupt /* TODO replace totally by scummvm handling setvect(KEYBD_INT, OldKeyboard); @@ -78,13 +78,13 @@ KEYBOARD::~KEYBOARD(void) { } -Sprite *KEYBOARD::SetClient(Sprite *spr) { - Swap(Client, spr); +Sprite *Keyboard::setClient(Sprite *spr) { + Swap(_client, spr); return spr; } -void KEYBOARD::NewKeyboard(...) { +void Keyboard::NewKeyboard(...) { // table address /* _SI = (uint16) Key; @@ -145,7 +145,7 @@ void KEYBOARD::NewKeyboard(...) { asm mov al,20h // send End-Of-Interrupt asm out 20h,al // to the 8259 IC */ - warning("STUB: KEYBOARD::NewKeyboard"); + warning("STUB: Keyboard::NewKeyboard"); } } // End of namespace CGE diff --git a/engines/cge/keybd.h b/engines/cge/keybd.h index 2cdbd558d8..bb87ffb0ed 100644 --- a/engines/cge/keybd.h +++ b/engines/cge/keybd.h @@ -40,22 +40,22 @@ namespace CGE { #define ALT 56 -class KEYBOARD { +class Keyboard { public: static void (* OldKeyboard)(...); static void NewKeyboard(...); - static uint16 Code[0x60]; - static uint16 Current; - static Sprite *Client; - static uint8 Key[0x60]; - static uint16 Last(void) { - uint16 cur = Current; - Current = 0; + static uint16 _code[0x60]; + static uint16 _current; + static Sprite *_client; + static uint8 _key[0x60]; + static uint16 last() { + uint16 cur = _current; + _current = 0; return cur; } - static Sprite *SetClient(Sprite *spr); - KEYBOARD(void); - ~KEYBOARD(void); + static Sprite *setClient(Sprite *spr); + Keyboard(); + ~Keyboard(); }; } // End of namespace CGE diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index a5ef5b8b62..b6442f3cd3 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -37,19 +37,19 @@ namespace CGE { extern MOUSE *Mouse; -bool MIXER::Appear = false; +bool Mixer::_appear = false; -MIXER::MIXER(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), Fall(MIX_FALL), _vm(vm) { - Appear = true; - mb[0] = new Bitmap("VOLUME", true); - mb[1] = NULL; - SetShapeList(mb); - SetName(Text->getText(MIX_NAME)); +Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(MIX_FALL), _vm(vm) { + _appear = true; + _mb[0] = new Bitmap("VOLUME", true); + _mb[1] = NULL; + setShapeList(_mb); + setName(Text->getText(MIX_NAME)); _flags._syst = true; _flags._kill = true; _flags._bDel = true; - Goto(x, y); + gotoxy(x, y); _z = MIX_Z; // slaves @@ -58,27 +58,27 @@ MIXER::MIXER(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), Fall(MIX_FALL), _v for (i = 0; i < MIX_MAX; i++) { static char fn[] = "V00"; wtom(i, fn + 1, 10, 2); - lb[i] = new Bitmap(fn, true); - ls[i].Now = ls[i].Next = i; - ls[i].Dx = ls[i].Dy = ls[i].Dly = 0; + _lb[i] = new Bitmap(fn, true); + _ls[i].Now = _ls[i].Next = i; + _ls[i].Dx = _ls[i].Dy = _ls[i].Dly = 0; } - lb[i] = NULL; + _lb[i] = NULL; - for (i = 0; i < ArrayCount(Led); i++) { - register Sprite *spr = new Sprite(_vm, lb); - spr->SetSeq(ls); - spr->Goto(x + 2 + 12 * i, y + 8); + for (i = 0; i < ArrayCount(_led); i++) { + register Sprite *spr = new Sprite(_vm, _lb); + spr->setSeq(_ls); + spr->gotoxy(x + 2 + 12 * i, y + 8); spr->_flags._tran = true; spr->_flags._kill = true; spr->_flags._bDel = false; spr->_z = MIX_Z; - Led[i] = spr; + _led[i] = spr; } - Led[ArrayCount(Led) - 1]->_flags._bDel = true; + _led[ArrayCount(_led) - 1]->_flags._bDel = true; Vga->ShowQ->Insert(this); - for (i = 0; i < ArrayCount(Led); i++) - Vga->ShowQ->Insert(Led[i]); + for (i = 0; i < ArrayCount(_led); i++) + Vga->ShowQ->Insert(_led[i]); //--- reset balance i = (SNDDrvInfo.VOL4.ML + SNDDrvInfo.VOL4.MR) / 2; @@ -87,18 +87,18 @@ MIXER::MIXER(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), Fall(MIX_FALL), _v i = (SNDDrvInfo.VOL4.DL + SNDDrvInfo.VOL4.DR) / 2; SNDDrvInfo.VOL4.DL = i; SNDDrvInfo.VOL4.DR = i; - Update(); + update(); _time = MIX_DELAY; } -MIXER::~MIXER(void) { - Appear = false; +Mixer::~Mixer() { + _appear = false; } #pragma argsused -void MIXER::Touch(uint16 mask, int x, int y) { - Sprite::Touch(mask, x, y); +void Mixer::touch(uint16 mask, int x, int y) { + Sprite::touch(mask, x, y); if (mask & L_UP) { uint8 *vol = (&SNDDrvInfo.VOL2.D) + (x < _w / 2); if (y < MIX_BHIG) { @@ -108,24 +108,24 @@ void MIXER::Touch(uint16 mask, int x, int y) { if (*vol > 0x00) *vol -= 0x11; } - Update(); + update(); } } -void MIXER::Tick(void) { +void Mixer::tick() { int x = Mouse->_x; int y = Mouse->_y; if (SpriteAt(x, y) == this) { - Fall = MIX_FALL; + _fall = MIX_FALL; if (_flags._hold) - Touch(L_UP, x - _x, y - _y); + touch(L_UP, x - _x, y - _y); } else { - if (Fall) - --Fall; + if (_fall) + _fall--; else { - for (uint i = 0; i < ArrayCount(Led); i++) - SNPOST_(SNKILL, -1, 0, Led[i]); + for (uint i = 0; i < ArrayCount(_led); i++) + SNPOST_(SNKILL, -1, 0, _led[i]); SNPOST_(SNKILL, -1, 0, this); } } @@ -133,13 +133,13 @@ void MIXER::Tick(void) { } -void MIXER::Update(void) { - Led[0]->Step(SNDDrvInfo.VOL4.ML); - Led[1]->Step(SNDDrvInfo.VOL4.DL); +void Mixer::update(void) { + _led[0]->step(SNDDrvInfo.VOL4.ML); + _led[1]->step(SNDDrvInfo.VOL4.DL); //TODO Change the SNPOST message send to a special way to send function pointer //SNPOST_(SNEXEC, -1, 0, (void*)&SNDSetVolume); - warning("STUB: MIXER::Update"); + warning("STUB: Mixer::Update"); } } // End of namespace CGE diff --git a/engines/cge/mixer.h b/engines/cge/mixer.h index d42d25ca24..a86e65d3d1 100644 --- a/engines/cge/mixer.h +++ b/engines/cge/mixer.h @@ -39,19 +39,19 @@ namespace CGE { #define MIX_BHIG 6 // mixer button high #define MIX_NAME 105 // sprite name -class MIXER : public Sprite { - BMP_PTR mb[2]; - BMP_PTR lb[MIX_MAX + 1]; - Seq ls[MIX_MAX]; - Sprite *Led[2]; - int Fall; - void Update(void); +class Mixer : public Sprite { + BMP_PTR _mb[2]; + BMP_PTR _lb[MIX_MAX + 1]; + Seq _ls[MIX_MAX]; + Sprite *_led[2]; + int _fall; + void update(); public: - static bool Appear; - MIXER(CGEEngine *vm, int x, int y); - ~MIXER(); - void Touch(uint16 mask, int x, int y); - void Tick(); + static bool _appear; + Mixer(CGEEngine *vm, int x, int y); + ~Mixer(); + void touch(uint16 mask, int x, int y); + void tick(); private: CGEEngine *_vm; }; diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp index b16f4f52b2..a1b6b253ce 100644 --- a/engines/cge/mouse.cpp +++ b/engines/cge/mouse.cpp @@ -45,7 +45,7 @@ MOUSE::MOUSE(CGEEngine *vm, Bitmap **shpl) : Sprite(vm, shpl), Busy(NULL), Hold( { 1, 1, 0, 0, 1 } }; - SetSeq(ms); + setSeq(ms); /* TODO Mouse handling // Mouse reset @@ -54,9 +54,9 @@ MOUSE::MOUSE(CGEEngine *vm, Bitmap **shpl) : Sprite(vm, shpl), Busy(NULL), Hold( Exist = (_AX != 0); Buttons = _BX; */ - Goto(SCR_WID/2, SCR_HIG/2); + gotoxy(SCR_WID/2, SCR_HIG/2); _z = 127; - Step(1); + step(1); Exist = true; warning("STUB: MOUSE::MOUSE"); @@ -144,25 +144,25 @@ void MOUSE::ClrEvt(Sprite *spr) { void MOUSE::Tick(void) { - Step(); + step(); while (EvtTail != EvtHead) { Event e = Evt[EvtTail]; if (e._msk) { if (Hold && e._ptr != Hold) - Hold->Touch(e._msk | ATTN, e._x - Hold->_x, e._y - Hold->_y); + Hold->touch(e._msk | ATTN, e._x - Hold->_x, e._y - Hold->_y); // update mouse cursor position if (e._msk & ROLL) - Goto(e._x, e._y); + gotoxy(e._x, e._y); // activate current touched SPRITE if (e._ptr) { if (e._msk & KEYB) - e._ptr->Touch(e._msk, e._x, e._y); + 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); + 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); + Sys->touch(e._msk, e._x, e._y); if (e._msk & L_DN) { Hold = e._ptr; @@ -188,7 +188,7 @@ void MOUSE::Tick(void) { EvtTail = (EvtTail + 1) % EVT_MAX; } if (Hold) - Hold->Goto(_x - hx, _y - hy); + Hold->gotoxy(_x - hx, _y - hy); } } // End of namespace CGE diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 6600b75245..baaac250dd 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -177,14 +177,14 @@ static void SNGame(Sprite *spr, int num) { SNPOST(SNGAME, 20002, 2, NULL); Game = true; } else { // cont - k1->Step(new_random(6)); - k2->Step(new_random(6)); - k3->Step(new_random(6)); + k1->step(new_random(6)); + k2->step(new_random(6)); + k3->step(new_random(6)); ///-------------------- - if (spr->_ref == 1 && KEYBOARD::Key[ALT]) { - k1->Step(5); - k2->Step(5); - k3->Step(5); + if (spr->_ref == 1 && Keyboard::_key[ALT]) { + k1->step(5); + k2->step(5); + k3->step(5); } ///-------------------- SNPOST(SNSETZ, 20700, 0, NULL); @@ -207,7 +207,7 @@ static void SNGame(Sprite *spr, int num) { Game = false; return; } else - k3->Step(new_random(5)); + k3->step(new_random(5)); } if (count < 100) { switch (count) { @@ -296,17 +296,17 @@ int FindPocket(Sprite *spr) { void SelectPocket(int n) { if (n < 0 || (_pocLight->_seqPtr && PocPtr == n)) { - _pocLight->Step(0); + _pocLight->step(0); n = FindPocket(NULL); if (n >= 0) PocPtr = n; } else { if (_pocket[n] != NULL) { PocPtr = n; - _pocLight->Step(1); + _pocLight->step(1); } } - _pocLight->Goto(POCKET_X + PocPtr * POCKET_DX + POCKET_SX, POCKET_Y + POCKET_SY); + _pocLight->gotoxy(POCKET_X + PocPtr * POCKET_DX + POCKET_SX, POCKET_Y + POCKET_SY); } @@ -321,7 +321,7 @@ void PocFul(void) { void Hide1(Sprite *spr) { - SNPOST_(SNGHOST, -1, 0, spr->Ghost()); + SNPOST_(SNGHOST, -1, 0, spr->ghost()); } @@ -336,11 +336,11 @@ void SNGhost(Bitmap *bmp) { void FeedSnail(Sprite *spr, SNLIST snq) { if (spr) - if (spr->Active()) { - uint8 ptr = (snq == TAKE) ? spr->TakePtr : spr->NearPtr; + if (spr->active()) { + uint8 ptr = (snq == TAKE) ? spr->_takePtr : spr->_nearPtr; if (ptr != NO_PTR) { - SNAIL::COM *comtab = spr->SnList(snq); + SNAIL::COM *comtab = spr->snList(snq); SNAIL::COM *c = comtab + ptr; if (FindPocket(NULL) < 0) { // no empty pockets? @@ -362,7 +362,7 @@ void FeedSnail(Sprite *spr, SNLIST snq) { if (c->Com == SNNEXT) { Sprite *s = (c->Ref < 0) ? spr : Locate(c->Ref); if (s) { - uint8 *idx = (snq == TAKE) ? &s->TakePtr : &s->NearPtr; + uint8 *idx = (snq == TAKE) ? &s->_takePtr : &s->_nearPtr; if (*idx != NO_PTR) { int v; switch (c->Val) { @@ -389,7 +389,7 @@ void FeedSnail(Sprite *spr, SNLIST snq) { if (c->Com == SNIF) { Sprite *s = (c->Ref < 0) ? spr : Locate(c->Ref); if (s) { // sprite extsts - if (! s->SeqTest(-1)) + if (! s->seqTest(-1)) c = comtab + c->Val; // not parked else ++c; @@ -477,35 +477,35 @@ void SNAIL::InsCom(SNCOM com, int ref, int val, void *ptr) { static void SNNNext(Sprite *sprel, int p) { if (sprel) - if (sprel->NearPtr != NO_PTR) - sprel->NearPtr = p; + if (sprel->_nearPtr != NO_PTR) + sprel->_nearPtr = p; } static void SNTNext(Sprite *sprel, int p) { if (sprel) - if (sprel->TakePtr != NO_PTR) - sprel->TakePtr = p; + if (sprel->_takePtr != NO_PTR) + sprel->_takePtr = p; } static void SNRNNext(Sprite *sprel, int p) { if (sprel) - if (sprel->NearPtr != NO_PTR) - sprel->NearPtr += p; + if (sprel->_nearPtr != NO_PTR) + sprel->_nearPtr += p; } static void SNRTNext(Sprite *sprel, int p) { if (sprel) - if (sprel->TakePtr != NO_PTR) - sprel->TakePtr += p; + if (sprel->_takePtr != NO_PTR) + sprel->_takePtr += p; } static void SNZTrim(Sprite *spr) { if (spr) - if (spr->Active()) { + if (spr->active()) { bool en = _heart->_enable; Sprite *s; _heart->_enable = false; @@ -531,13 +531,13 @@ static void SNHide(Sprite *spr, int val) { static void SNRmNear(Sprite *spr) { if (spr) - spr->NearPtr = NO_PTR; + spr->_nearPtr = NO_PTR; } static void SNRmTake(Sprite *spr) { if (spr) - spr->TakePtr = NO_PTR; + spr->_takePtr = NO_PTR; } @@ -546,7 +546,7 @@ void SNSeq(Sprite *spr, int val) { if (spr == Hero && val == 0) Hero->park(); else - spr->Step(val); + spr->step(val); } } @@ -577,7 +577,7 @@ void SNSend(Sprite *spr, int val) { if (spr->_ref % 1000 == 0) Bitmap::_pal = VGA::SysPal; if (spr->_flags._back) - spr->BackShow(true); + spr->backShow(true); else ExpandSprite(spr); Bitmap::_pal = NULL; @@ -628,7 +628,7 @@ void SNCover(Sprite *spr, int xref) { spr->_flags._hide = true; xspr->_z = spr->_z; xspr->_cave = spr->_cave; - xspr->Goto(spr->_x, spr->_y); + 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); @@ -643,7 +643,7 @@ void SNUncover(Sprite *spr, Sprite *xspr) { if (spr && xspr) { spr->_flags._hide = false; spr->_cave = xspr->_cave; - spr->Goto(xspr->_x, xspr->_y); + spr->gotoxy(xspr->_x, xspr->_y); if ((spr->_flags._shad = xspr->_flags._shad) == 1) { Vga->ShowQ->Insert(Vga->ShowQ->Remove(xspr->_prev), spr); xspr->_flags._shad = false; @@ -668,19 +668,19 @@ void SNSetY0(int cav, int y0) { void SNSetXY(Sprite *spr, uint16 xy) { if (spr) - spr->Goto(xy % SCR_WID, xy / SCR_WID); + spr->gotoxy(xy % SCR_WID, xy / SCR_WID); } void SNRelX(Sprite *spr, int x) { if (spr && Hero) - spr->Goto(Hero->_x + x, spr->_y); + spr->gotoxy(Hero->_x + x, spr->_y); } void SNRelY(Sprite *spr, int y) { if (spr && Hero) - spr->Goto(spr->_x, Hero->_y + y); + spr->gotoxy(spr->_x, Hero->_y + y); } @@ -694,13 +694,13 @@ void SNRelZ(Sprite *spr, int z) { void SNSetX(Sprite *spr, int x) { if (spr) - spr->Goto(x, spr->_y); + spr->gotoxy(x, spr->_y); } void SNSetY(Sprite *spr, int y) { if (spr) - spr->Goto(spr->_x, y); + spr->gotoxy(spr->_x, y); } @@ -716,7 +716,7 @@ void SNSetZ(Sprite *spr, int z) { void SNSlave(Sprite *spr, int ref) { Sprite *slv = Locate(ref); if (spr && slv) { - if (spr->Active()) { + if (spr->active()) { SNSend(slv, spr->_cave); slv->_flags._slav = true; slv->_z = spr->_z; @@ -780,10 +780,10 @@ void SNKeep(Sprite *spr, int stp) { _pocket[PocPtr] = spr; spr->_cave = 0; spr->_flags._kept = true; - spr->Goto(POCKET_X + POCKET_DX * PocPtr + POCKET_DX / 2 - spr->_w / 2, + spr->gotoxy(POCKET_X + POCKET_DX * PocPtr + POCKET_DX / 2 - spr->_w / 2, POCKET_Y + POCKET_DY / 2 - spr->_h / 2); if (stp >= 0) - spr->Step(stp); + spr->step(stp); } SelectPocket(-1); } @@ -797,7 +797,7 @@ void SNGive(Sprite *spr, int stp) { spr->_cave = Now; spr->_flags._kept = false; if (stp >= 0) - spr->Step(stp); + spr->step(stp); } } SelectPocket(-1); @@ -807,8 +807,8 @@ void SNGive(Sprite *spr, int stp) { static void SNBackPt(Sprite *spr, int stp) { if (spr) { if (stp >= 0) - spr->Step(stp); - spr->BackShow(true); + spr->step(stp); + spr->backShow(true); } } @@ -823,7 +823,7 @@ static void SNLevel(Sprite *spr, int lev) { ++Lev; spr = Vga->SpareQ->Locate(100 + Lev); if (spr) { - spr->BackShow(true); + spr->backShow(true); spr->_cave = 0; } } @@ -936,7 +936,7 @@ void SNAIL::RunCom(void) { break; case SNWAIT : if (sprel) { - if (sprel->SeqTest(snc->Val) && + if (sprel->seqTest(snc->Val) && (snc->Val >= 0 || sprel != Hero || Hero->_tracePtr < 0)) { _timerExpiry = g_system->getMillis() + sprel->_time * SNAIL_FRAME_DELAY; } else @@ -951,8 +951,8 @@ void SNAIL::RunCom(void) { break; case SNSAY : if (sprel && TalkEnable) { - if (sprel == Hero && sprel->SeqTest(-1)) - sprel->Step(HTALK); + if (sprel == Hero && sprel->seqTest(-1)) + sprel->step(HTALK); Text->Say(Text->getText(snc->Val), sprel); Sys->FunDel = HEROFUN0; } @@ -965,8 +965,8 @@ void SNAIL::RunCom(void) { break; case SNTIME : if (sprel && TalkEnable) { - if (sprel == Hero && sprel->SeqTest(-1)) - sprel->Step(HTALK); + if (sprel == Hero && sprel->seqTest(-1)) + sprel->step(HTALK); SayTime(sprel); } break; @@ -1106,7 +1106,7 @@ void SNAIL::RunCom(void) { // ((void(*)(int)) (snc->Ptr))(snc->Val); break; warning("STUB: SNEXEC code"); case SNSTEP : - sprel->Step(); + sprel->step(); break; case SNZTRIM : SNZTrim(sprel); diff --git a/engines/cge/snddrv.h b/engines/cge/snddrv.h index 3d1658e1e0..2de9014034 100644 --- a/engines/cge/snddrv.h +++ b/engines/cge/snddrv.h @@ -101,29 +101,29 @@ extern uint16 MIDIEndFlag; // * Driver Code * // ****************************************************** // Init Digi Device -EC void SNDInit(void); +void SNDInit(); // Close Digi Device -EC void SNDDone(void); +void SNDDone(); // Set Volume -EC void SNDSetVolume(void); +void SNDSetVolume(); // Start Digi -EC void SNDDigiStart(SMPINFO *PSmpInfo); +void SNDDigiStart(SMPINFO *PSmpInfo); // Stop Digi -EC void SNDDigiStop(SMPINFO *PSmpInfo); +void SNDDigiStop(SMPINFO *PSmpInfo); // Start MIDI File -EC void SNDMIDIStart(uint8 *MIDFile); +void SNDMIDIStart(uint8 *MIDFile); // Stop MIDI File -EC void SNDMIDIStop(void); +void SNDMIDIStop(); // Play MIDI File (to be called while interrupting) // WARNING: Uses ALL registers! -EC void SNDMIDIPlay(void); +void SNDMIDIPlay(); } // End of namespace CGE diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index a59179710b..75adf3868a 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -205,7 +205,7 @@ void LoadMIDI(int ref) { } -EC void *Patch(int pat) { +void *Patch(int pat) { void *p = NULL; static char fn[] = "PATCH000.SND"; diff --git a/engines/cge/startup.cpp b/engines/cge/startup.cpp index 4895ce9861..028e4c61b1 100644 --- a/engines/cge/startup.cpp +++ b/engines/cge/startup.cpp @@ -39,7 +39,7 @@ namespace CGE { extern char Copr[]; -#define id (*(IDENT*)Copr) +#define id (*(Ident*)Copr) EMM MiniEmm = MINI_EMM_SIZE; @@ -65,7 +65,7 @@ bool STARTUP::get_parms(void) { { static char *PrmTab[] = { "NEW", "MK0SVG", "QUIET", "SB", "GUS", "MIDI", "P", "D", "I", "M" }; - int n = TakeEnum(PrmTab, strtok(_argv[--i], " =:(")); + int n = takeEnum(PrmTab, strtok(_argv[--i], " =:(")); uint16 p = xtow(strtok(NULL, " h,)")); switch (n) { @@ -99,7 +99,7 @@ bool STARTUP::get_parms(void) { Summa = 0; #else // disk signature checksum - Summa = ChkSum(Copr, sizeof(IDENT)); + Summa = ChkSum(Copr, sizeof(Ident)); #endif #endif if (SNDDrvInfo.MDEV != DEV_GM) SNDDrvInfo.MDEV = SNDDrvInfo.DDEV; @@ -112,26 +112,31 @@ bool STARTUP::get_parms(void) { STARTUP::STARTUP(void) { /* - uint32 m = farcoreleft() >> 10; - if (m < 0x7FFF) Core = (int) m; else Core = 0x7FFF; - - if (! IsVga()) quit_now(NOT_VGA_TEXT); - if (Cpu() < _80286) quit_now(BAD_CHIP_TEXT); - if (100 * _osmajor + _osminor < 330) quit_now(BAD_DOS_TEXT); - - if (! get_parms()) quit_now(BAD_ARG_TEXT); - //--- load sound configuration - const char * fn = UsrPath(ProgName(CFG_EXT)); - if (! STARTUP::SoundOk && CFILE::Exist(fn)) - { - CFILE cfg(fn, REA); - if (! cfg.Error) - { - cfg.Read(&SNDDrvInfo, sizeof(SNDDrvInfo)-sizeof(SNDDrvInfo.VOL2)); - if (! cfg.Error) STARTUP::SoundOk = 1; - } - } - */ + uint32 m = farcoreleft() >> 10; + if (m < 0x7FFF) + Core = (int) m; + else + Core = 0x7FFF; + + if (! IsVga()) + quit_now(NOT_VGA_TEXT); + if (Cpu() < _80286) + quit_now(BAD_CHIP_TEXT); + if (100 * _osmajor + _osminor < 330) + quit_now(BAD_DOS_TEXT); + if (! get_parms()) + quit_now(BAD_ARG_TEXT); + //--- load sound configuration + const char * fn = UsrPath(ProgName(CFG_EXT)); + if (! STARTUP::SoundOk && CFILE::Exist(fn)) { + CFILE cfg(fn, REA); + if (! cfg.Error) { + cfg.Read(&SNDDrvInfo, sizeof(SNDDrvInfo)-sizeof(SNDDrvInfo.VOL2)); + if (! cfg.Error) + STARTUP::SoundOk = 1; + } + } + */ warning("STUB: STARTUP::STARTUP"); } diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index fab1abc0d8..38625e2971 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -48,7 +48,7 @@ FONT::FONT(const char *name) { Wid = farnew(uint8, WID_SIZ); if ((Map == NULL) || (Pos == NULL) || (Wid == NULL)) error("No core"); - MergeExt(Path, name, FONT_EXT); + mergeExt(Path, name, FONT_EXT); Load(); } @@ -126,7 +126,7 @@ TALK::~TALK (void) { FONT *TALK::_Font; void TALK::init() { - _Font = new FONT(ProgName()); + _Font = new FONT(progName()); } void TALK::deinit() { @@ -182,7 +182,7 @@ void TALK::Update(const char *tx) { tx++; } TS[0]->code(); - SetShapeList(TS); + setShapeList(TS); } @@ -286,7 +286,7 @@ void TALK::PutLine(int line, const char *text) { INFO_LINE::INFO_LINE(CGEEngine *vm, uint16 w) : TALK(vm), OldTxt(NULL), _vm(vm) { TS[0] = new Bitmap(w, FONT_HIG, TEXT_BG); - SetShapeList(TS); + setShapeList(TS); } diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index 515c1091f8..f98b7f5d1c 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -44,7 +44,7 @@ TALK *Talk = NULL; TEXT::TEXT(CGEEngine *vm, const char *fname, int size) : _vm(vm) { Cache = new HAN[size]; - MergeExt(FileName, fname, SAY_EXT); + mergeExt(FileName, fname, SAY_EXT); if (!INI_FILE::exist(FileName)) error("No talk (%s)\n", FileName); @@ -203,17 +203,17 @@ void TEXT::Say(const char *txt, Sprite *spr) { Talk->_flags._kill = true; Talk->_flags._bDel = true; - Talk->SetName(Text->getText(SAY_NAME)); - Talk->Goto(x - (Talk->_w - sw) / 2 - 3 + 6 * east, y - spike->_h - Talk->_h + 1); + Talk->setName(Text->getText(SAY_NAME)); + Talk->gotoxy(x - (Talk->_w - sw) / 2 - 3 + 6 * east, y - spike->_h - Talk->_h + 1); Talk->_z = 125; Talk->_ref = SAY_REF; - spike->Goto(x, Talk->_y + Talk->_h - 1); + spike->gotoxy(x, Talk->_y + Talk->_h - 1); spike->_z = 126; spike->_flags._slav = true; spike->_flags._kill = true; - spike->SetName(Text->getText(SAY_NAME)); - spike->Step(east); + spike->setName(Text->getText(SAY_NAME)); + spike->step(east); spike->_ref = SAY_REF; Vga->ShowQ->Insert(Talk, Vga->ShowQ->Last()); @@ -227,9 +227,9 @@ void CGEEngine::inf(const char *txt) { if (Talk) { Talk->_flags._kill = true; Talk->_flags._bDel = true; - Talk->SetName(Text->getText(INF_NAME)); - Talk->Center(); - Talk->Goto(Talk->_x, Talk->_y - 20); + Talk->setName(Text->getText(INF_NAME)); + Talk->center(); + Talk->gotoxy(Talk->_x, Talk->_y - 20); Talk->_z = 126; Talk->_ref = INF_REF; Vga->ShowQ->Insert(Talk, Vga->ShowQ->Last()); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index e1bea9a15c..0e865ffd90 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -356,21 +356,21 @@ void Heart::setXTimer(uint16 *ptr, uint16 time) { Sprite::Sprite(CGEEngine *vm, BMP_PTR *shp) - : _x(0), _y(0), _z(0), NearPtr(0), TakePtr(0), + : _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0), _next(NULL), _prev(NULL), _seqPtr(NO_SEQ), _time(0), //Delay(0), _ext(NULL), _ref(-1), _cave(0), _vm(vm) { - memset(File, 0, sizeof(File)); + memset(_file, 0, sizeof(_file)); *((uint16 *)&_flags) = 0; - SetShapeList(shp); + setShapeList(shp); } Sprite::~Sprite() { - Contract(); + contract(); } -BMP_PTR Sprite::Shp() { +BMP_PTR Sprite::shp() { register SprExt *e = _ext; if (e) if (e->_seq) { @@ -380,7 +380,7 @@ BMP_PTR Sprite::Shp() { //sprintf(s, "Seq=%p ShpCnt=%d SeqPtr=%d Now=%d Next=%d", // Seq, ShpCnt, SeqPtr, Seq[SeqPtr].Now, Seq[SeqPtr].Next); //VGA::Exit(s, File); - error("Invalid PHASE in SPRITE::Shp() %s", File); + error("Invalid PHASE in SPRITE::Shp() %s", _file); } return e->_shpList[i]; } @@ -388,7 +388,7 @@ BMP_PTR Sprite::Shp() { } -BMP_PTR *Sprite::SetShapeList(BMP_PTR *shp) { +BMP_PTR *Sprite::setShapeList(BMP_PTR *shp) { BMP_PTR *r = (_ext) ? _ext->_shpList : NULL; _shpCnt = 0; @@ -405,16 +405,16 @@ BMP_PTR *Sprite::SetShapeList(BMP_PTR *shp) { _h = b->_h; _shpCnt++; } - Expand(); + expand(); _ext->_shpList = shp; if (!_ext->_seq) - SetSeq((_shpCnt < 2) ? _seq1 : _seq2); + setSeq((_shpCnt < 2) ? _seq1 : _seq2); } return r; } -void Sprite::MoveShapes(uint8 *buf) { +void Sprite::moveShapes(uint8 *buf) { BMP_PTR *p; for (p = _ext->_shpList; *p; p++) { buf += (*p)->moveVmap(buf); @@ -422,12 +422,12 @@ void Sprite::MoveShapes(uint8 *buf) { } -bool Sprite::Works(Sprite *spr) { +bool Sprite::works(Sprite *spr) { if (spr) if (spr->_ext) { SNAIL::COM *c = spr->_ext->_take; if (c != NULL) { - c += spr->TakePtr; + c += spr->_takePtr; if (c->Ref == _ref) if (c->Com != SNLABEL || (c->Val == 0 || c->Val == Now)) return true; @@ -437,19 +437,19 @@ bool Sprite::Works(Sprite *spr) { } -Seq *Sprite::SetSeq(Seq *seq) { - Expand(); +Seq *Sprite::setSeq(Seq *seq) { + expand(); register Seq *s = _ext->_seq; _ext->_seq = seq; if (_seqPtr == NO_SEQ) - Step(0); + step(0); else if (_time == 0) - Step(_seqPtr); + step(_seqPtr); return s; } -bool Sprite::SeqTest(int n) { +bool Sprite::seqTest(int n) { if (n >= 0) return (_seqPtr == n); if (_ext) @@ -458,7 +458,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; @@ -466,7 +466,7 @@ SNAIL::COM *Sprite::SnList(SNLIST type) { } -void Sprite::SetName(char *n) { +void Sprite::setName(char *n) { if (_ext) { if (_ext->_name) { delete[] _ext->_name; @@ -482,13 +482,13 @@ void Sprite::SetName(char *n) { } -Sprite *Sprite::Expand(void) { +Sprite *Sprite::expand() { if (!_ext) { bool enbl = _heart->_enable; _heart->_enable = false; if ((_ext = new SprExt) == NULL) error("No core"); - if (*File) { + 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]; @@ -502,7 +502,7 @@ Sprite *Sprite::Expand(void) { SNAIL::COM *nea = NULL; SNAIL::COM *tak = NULL; - MergeExt(fname, File, SPR_EXT); + mergeExt(fname, _file, SPR_EXT); if (INI_FILE::exist(fname)) { // sprite description file exist INI_FILE sprf(fname); if (!(sprf._error==0)) @@ -515,9 +515,9 @@ Sprite *Sprite::Expand(void) { if (len == 0 || *line == '.') continue; - switch (TakeEnum(Comd, strtok(line, " =\t"))) { + switch (takeEnum(Comd, strtok(line, " =\t"))) { case 0 : { // Name - SetName(strtok(NULL, "")); + setName(strtok(NULL, "")); break; } case 1 : { // Phase @@ -549,13 +549,13 @@ Sprite *Sprite::Expand(void) { break; } case 3 : { // Near - if (NearPtr != NO_PTR) { + if (_nearPtr != NO_PTR) { 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) + 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,;/")); @@ -565,13 +565,13 @@ Sprite *Sprite::Expand(void) { } break; case 4 : { // Take - if (TakePtr != NO_PTR) { + if (_takePtr != NO_PTR) { 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) + 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,;/")); @@ -583,7 +583,7 @@ Sprite *Sprite::Expand(void) { } } } else { // no sprite description: try to read immediately from .BMP - shplist[shpcnt++] = new Bitmap(File, true); + shplist[shpcnt++] = new Bitmap(_file, true); } shplist[shpcnt] = NULL; if (seq) { @@ -591,21 +591,21 @@ Sprite *Sprite::Expand(void) { error("Bad PHASE in SEQ [%s]", fname); if (maxnxt >= seqcnt) error("Bad JUMP in SEQ [%s]", fname); - SetSeq(seq); + setSeq(seq); } else - SetSeq((_shpCnt == 1) ? _seq1 : _seq2); + setSeq((_shpCnt == 1) ? _seq1 : _seq2); //disable(); // disable interupt - SetShapeList(shplist); + setShapeList(shplist); //enable(); // enable interupt if (nea) nea[neacnt - 1].Ptr = _ext->_near = nea; else - NearPtr = NO_PTR; + _nearPtr = NO_PTR; if (tak) tak[takcnt - 1].Ptr = _ext->_take = tak; else - TakePtr = NO_PTR; + _takePtr = NO_PTR; } _heart->_enable = enbl; } @@ -613,7 +613,7 @@ Sprite *Sprite::Expand(void) { } -Sprite *Sprite::Contract(void) { +Sprite *Sprite::contract() { register SprExt *e = _ext; if (e) { if (e->_name) @@ -622,10 +622,10 @@ Sprite *Sprite::Contract(void) { int i; for (i = 0; e->_shpList[i]; i++) delete e->_shpList[i]; - if (MemType(e->_shpList) == NEAR_MEM) + if (memType(e->_shpList) == NEAR_MEM) delete[] e->_shpList; } - if (MemType(e->_seq) == NEAR_MEM) + if (memType(e->_seq) == NEAR_MEM) free(e->_seq); if (e->_near) free(e->_near); @@ -638,18 +638,18 @@ Sprite *Sprite::Contract(void) { } -Sprite *Sprite::BackShow(bool fast) { - Expand(); - Show(2); - Show(1); +Sprite *Sprite::backShow(bool fast) { + expand(); + show(2); + show(1); if (fast) - Show(0); - Contract(); + show(0); + contract(); return this; } -void Sprite::Step(int nr) { +void Sprite::step(int nr) { if (nr >= 0) _seqPtr = nr; if (_ext) { @@ -658,24 +658,24 @@ void Sprite::Step(int nr) { _seqPtr = _ext->_seq[_seqPtr].Next; seq = _ext->_seq + _seqPtr; if (seq->Dly >= 0) { - Goto(_x + (seq->Dx), _y + (seq->Dy)); + gotoxy(_x + (seq->Dx), _y + (seq->Dy)); _time = seq->Dly; } } } -void Sprite::Tick(void) { - Step(); +void Sprite::tick() { + step(); } -void Sprite::MakeXlat(uint8 *x) { +void Sprite::makeXlat(uint8 *x) { if (_ext) { BMP_PTR *b; if (_flags._xlat) - KillXlat(); + killXlat(); for (b = _ext->_shpList; *b; b++) (*b)->_m = x; _flags._xlat = true; @@ -683,12 +683,12 @@ void Sprite::MakeXlat(uint8 *x) { } -void Sprite::KillXlat(void) { +void Sprite::killXlat() { if (_flags._xlat && _ext) { BMP_PTR *b; uint8 *m = (*_ext->_shpList)->_m; - switch (MemType(m)) { + switch (memType(m)) { case NEAR_MEM : delete[](uint8 *) m; break; @@ -706,7 +706,7 @@ void Sprite::KillXlat(void) { } -void Sprite::Goto(int x, int y) { +void Sprite::gotoxy(int x, int y) { int xo = _x, yo = _y; if (_x < SCR_WID) { if (x < 0) @@ -724,18 +724,18 @@ void Sprite::Goto(int x, int y) { } if (_next) if (_next->_flags._slav) - _next->Goto(_next->_x - xo + _x, _next->_y - yo + _y); + _next->gotoxy(_next->_x - xo + _x, _next->_y - yo + _y); if (_flags._shad) - _prev->Goto(_prev->_x - xo + _x, _prev->_y - yo + _y); + _prev->gotoxy(_prev->_x - xo + _x, _prev->_y - yo + _y); } -void Sprite::Center(void) { - Goto((SCR_WID - _w) / 2, (SCR_HIG - _h) / 2); +void Sprite::center() { + gotoxy((SCR_WID - _w) / 2, (SCR_HIG - _h) / 2); } -void Sprite::Show(void) { +void Sprite::show() { register SprExt *e; // asm cli // critic section... e = _ext; @@ -744,7 +744,7 @@ void Sprite::Show(void) { e->_b0 = e->_b1; e->_x1 = _x; e->_y1 = _y; - e->_b1 = Shp(); + e->_b1 = shp(); // asm sti // ...done! if (!_flags._hide) { if (_flags._xlat) @@ -755,22 +755,22 @@ void Sprite::Show(void) { } -void Sprite::Show(uint16 pg) { +void Sprite::show(uint16 pg) { Graphics::Surface *a = VGA::Page[1]; VGA::Page[1] = VGA::Page[pg & 3]; - Shp()->show(_x, _y); + shp()->show(_x, _y); VGA::Page[1] = a; } -void Sprite::Hide(void) { +void Sprite::hide() { register SprExt *e = _ext; if (e->_b0) e->_b0->hide(e->_x0, e->_y0); } -BMP_PTR Sprite::Ghost(void) { +BMP_PTR Sprite::ghost() { register SprExt *e = _ext; if (e->_b1) { BMP_PTR bmp = new Bitmap(0, 0, (uint8 *)NULL); @@ -795,7 +795,7 @@ Sprite *SpriteAt(int x, int y) { if (tail) { for (spr = tail->_prev; spr; spr = spr->_prev) { if (! spr->_flags._hide && ! spr->_flags._tran) { - if (spr->Shp()->solidAt(x - spr->_x, y - spr->_y)) + if (spr->shp()->solidAt(x - spr->_x, y - spr->_y)) break; } } @@ -840,9 +840,9 @@ void QUEUE::Append(Sprite *spr) { Head = spr; Tail = spr; if (Show) - spr->Expand(); + spr->expand(); else - spr->Contract(); + spr->contract(); } @@ -861,9 +861,9 @@ void QUEUE::Insert(Sprite *spr, Sprite *nxt) { if (spr->_next) spr->_next->_prev = spr; if (Show) - spr->Expand(); + spr->expand(); else - spr->Contract(); + spr->contract(); } @@ -877,9 +877,9 @@ void QUEUE::Insert(Sprite *spr) { else Append(spr); if (Show) - spr->Expand(); + spr->expand(); else - spr->Contract(); + spr->contract(); } @@ -952,7 +952,7 @@ VGA::VGA(int mode) SetStatAdr(); if (StatAdr != VGAST1_) ++Mono; - if (IsVga()) { + if (isVga()) { OldColors = farnew(Dac, 256); NewColors = farnew(Dac, 256); OldScreen = SaveScreen(); @@ -968,7 +968,7 @@ VGA::VGA(int mode) VGA::~VGA(void) { Mono = 0; - if (IsVga()) { + if (isVga()) { Common::String buffer = ""; Clear(0); SetMode(OldMode); @@ -1137,10 +1137,10 @@ void VGA::Show(void) { Sprite *spr = ShowQ->First(); for (spr = ShowQ->First(); spr; spr = spr->_next) - spr->Show(); + spr->show(); Update(); for (spr = ShowQ->First(); spr; spr = spr->_next) - spr->Hide(); + spr->hide(); ++ FrmCnt; } diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index a3d5ad949b..a22dd9d57a 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -195,42 +195,43 @@ public: uint16 _w; uint16 _h; uint16 _time; - uint8 NearPtr, TakePtr; + uint8 _nearPtr; + uint8 _takePtr; int _seqPtr; int _shpCnt; - char File[MAXFILE]; + char _file[MAXFILE]; Sprite *_prev; Sprite *_next; - bool Works(Sprite *spr); - bool SeqTest(int n); - inline bool Active(void) { + bool works(Sprite *spr); + bool seqTest(int n); + inline bool active() { return _ext != NULL; } Sprite(CGEEngine *vm, BMP_PTR *shp); virtual ~Sprite(void); - BMP_PTR Shp(void); - BMP_PTR *SetShapeList(BMP_PTR *shp); - void MoveShapes(uint8 *buf); - Sprite *Expand(void); - Sprite *Contract(void); - Sprite *BackShow(bool fast = false); - void SetName(char *n); - inline char *Name(void) { + BMP_PTR shp(); + BMP_PTR *setShapeList(BMP_PTR *shp); + void moveShapes(uint8 *buf); + Sprite *expand(); + Sprite *contract(); + Sprite *backShow(bool fast = false); + void setName(char *n); + inline char *name() { return (_ext) ? _ext->_name : NULL; } - void Goto(int x, int y); - void Center(void); - void Show(void); - void Hide(void); - BMP_PTR Ghost(void); - void Show(uint16 pg); - void MakeXlat(uint8 *x); - void KillXlat(void); - void Step(int nr = -1); - Seq *SetSeq(Seq *seq); - SNAIL::COM *SnList(SNLIST type); - virtual void Touch(uint16 mask, int x, int y); - virtual void Tick(void); + void gotoxy(int x, int y); + void center(); + void show(); + void hide(); + BMP_PTR ghost(); + void show(uint16 pg); + void makeXlat(uint8 *x); + void killXlat(); + void step(int nr = -1); + Seq *setSeq(Seq *seq); + SNAIL::COM *snList(SNLIST type); + virtual void touch(uint16 mask, int x, int y); + virtual void tick(); private: CGEEngine *_vm; }; @@ -291,9 +292,9 @@ public: void Clear(uint8 color); void CopyPage(uint16 d, uint16 s); void Sunrise(Dac *tab); - void Sunset(void); - void Show(void); - void Update(void); + void Sunset(); + void Show(); + void Update(); static void pal2DAC(const byte *palData, Dac *tab); static void DAC2pal(const Dac *tab, byte *palData); diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index ed07a1269f..7e1d327b69 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -61,7 +61,7 @@ MENU_BAR::MENU_BAR(CGEEngine *vm, uint16 w) : TALK(vm), _vm(vm) { p2 -= w; } TS[0] = new Bitmap(w, h, p); - SetShapeList(TS); + setShapeList(TS); _flags._slav = true; _flags._tran = true; _flags._kill = true; @@ -110,12 +110,12 @@ VMENU::VMENU(CGEEngine *vm, CHOICE *list, int x, int y) _flags._bDel = true; _flags._kill = true; if (x < 0 || y < 0) - Center(); + center(); else - Goto(x - _w / 2, y - (TEXT_VM + FONT_HIG / 2)); + 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->Goto(_x + TEXT_HM - MB_HM, _y + TEXT_VM - MB_VM); + Bar->gotoxy(_x + TEXT_HM - MB_HM, _y + TEXT_VM - MB_VM); Vga->ShowQ->Insert(Bar, Vga->ShowQ->Last()); } @@ -130,7 +130,7 @@ void VMENU::Touch(uint16 mask, int x, int y) { bool ok = false; if (Items) { - Sprite::Touch(mask, x, y); + Sprite::touch(mask, x, y); y -= TEXT_VM - 1; int n = 0; @@ -142,7 +142,7 @@ void VMENU::Touch(uint16 mask, int x, int y) { n = Items - 1; } - Bar->Goto(_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; |