diff options
-rw-r--r-- | engines/cge/cge_main.cpp | 96 | ||||
-rw-r--r-- | engines/cge/events.cpp | 10 | ||||
-rw-r--r-- | engines/cge/game.cpp | 2 | ||||
-rw-r--r-- | engines/cge/gettext.cpp | 4 | ||||
-rw-r--r-- | engines/cge/mixer.cpp | 16 | ||||
-rw-r--r-- | engines/cge/snail.cpp | 52 | ||||
-rw-r--r-- | engines/cge/talk.cpp | 4 | ||||
-rw-r--r-- | engines/cge/text.cpp | 14 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 28 | ||||
-rw-r--r-- | engines/cge/vga13h.h | 21 | ||||
-rw-r--r-- | engines/cge/vmenu.cpp | 12 | ||||
-rw-r--r-- | engines/cge/walk.cpp | 14 | ||||
-rw-r--r-- | engines/cge/walk.h | 2 |
13 files changed, 137 insertions, 138 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 213ad7abec..5b98b0a4e8 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -462,16 +462,20 @@ void CGEEngine::loadMapping() { if (_now <= _caveMax) { INI_FILE cf(progName(".TAB")); if (!cf._error) { - memset(Cluster::_map, 0, sizeof(Cluster::_map)); - cf.seek((_now - 1) * sizeof(Cluster::_map)); - cf.read((uint8 *) Cluster::_map, sizeof(Cluster::_map)); + // Move to the data for the given room + cf.seek((_now - 1) * kMapArrSize); + + // Read in the data + for (int z = 0; z < kMapZCnt; ++z) { + cf.read(&Cluster::_map[z][0], kMapXCnt); + } } } } Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) { - _flags.flags._kill = true; - _flags.flags._bDel = false; + _flags._kill = true; + _flags._bDel = false; BitmapPtr *MB = new BitmapPtr[2]; MB[0] = new Bitmap("BRICK", true); @@ -528,7 +532,7 @@ void CGEEngine::quit() { { NULL, &CGEEngine::dummy } }; - if (_snail->idle() && !_hero->_flags.flags._hide) { + if (_snail->idle() && !_hero->_flags._hide) { if (Vmenu::_addr) { _snail_->addCom(kSnKill, -1, 0, Vmenu::_addr); resetQSwitch(); @@ -553,13 +557,13 @@ void CGEEngine::miniStep(int stp) { debugC(1, kCGEDebugEngine, "CGEEngine::miniStep(%d)", stp); if (stp < 0) - _miniCave->_flags.flags._hide = true; + _miniCave->_flags._hide = true; else { *_miniShp[0] = *_miniShpList[stp]; if (_fx->_current) &*(_fx->_current->addr()); - _miniCave->_flags.flags._hide = false; + _miniCave->_flags._hide = false; } } @@ -600,7 +604,7 @@ void CGEEngine::caveUp() { Sprite *n = spr->_next; if (spr->_cave == _now || spr->_cave == 0) if (spr->_ref != BakRef) { - if (spr->_flags.flags._back) + if (spr->_flags._back) spr->backShow(); else expandSprite(spr); @@ -618,7 +622,7 @@ void CGEEngine::caveUp() { // following 2 lines trims Hero's Z position! _hero->tick(); _hero->_time = 1; - _hero->_flags.flags._hide = false; + _hero->_flags._hide = false; } if (!_dark) @@ -650,7 +654,7 @@ void CGEEngine::caveDown() { debugC(1, kCGEDebugEngine, "CGEEngine::caveDown()"); Sprite *spr; - if (_horzLine && !_horzLine->_flags.flags._hide) + if (_horzLine && !_horzLine->_flags._hide) switchMapping(); for (spr = _vga->_showQ->first(); spr;) { @@ -823,7 +827,7 @@ void System::touch(uint16 mask, int x, int y) { _sprite->step(x - '0'); break; case F10 : - if (_snail->idle() && !_hero->_flags.flags._hide) + if (_snail->idle() && !_hero->_flags._hide) _vm->startCountDown(); break; } @@ -857,7 +861,7 @@ void System::touch(uint16 mask, int x, int y) { if (cav && _snail->idle() && _hero->_tracePtr < 0) _vm->switchCave(cav); - if (_horzLine && !_horzLine->_flags.flags._hide) { + if (_horzLine && !_horzLine->_flags._hide) { if (y >= kMapTop && y < kMapTop + kMapHig) { int8 x1, z1; XZ(x, y).split(x1, z1); @@ -960,7 +964,7 @@ void CGEEngine::switchMapping() { assert(_horzLine); debugC(1, kCGEDebugEngine, "CGEEngine::switchMapping()"); - if (_horzLine && _horzLine->_flags.flags._hide) { + if (_horzLine && _horzLine->_flags._hide) { int i; for (i = 0; i < kMapZCnt; i++) { int j; @@ -975,14 +979,14 @@ void CGEEngine::switchMapping() { if (s->_w == kMapGridX && s->_h == kMapGridZ) _snail_->addCom(kSnKill, -1, 0, s); } - _horzLine->_flags.flags._hide = !_horzLine->_flags.flags._hide; + _horzLine->_flags._hide = !_horzLine->_flags._hide; } void CGEEngine::killSprite() { debugC(1, kCGEDebugEngine, "CGEEngine::killSprite()"); - _sprite->_flags.flags._kill = true; - _sprite->_flags.flags._bDel = true; + _sprite->_flags._kill = true; + _sprite->_flags._bDel = true; _snail_->addCom(kSnKill, -1, 0, _sprite); _sprite = NULL; } @@ -1007,7 +1011,7 @@ void CGEEngine::pullSprite() { if (spr) { spr = spr->_next; if (spr) - ok = (!spr->_flags.flags._slav); + ok = (!spr->_flags._slav); } if (ok) { _vga->_showQ->insert(_vga->_showQ->remove(_sprite), spr); @@ -1058,7 +1062,7 @@ void CGEEngine::sayDebug() { char *spH = DebugText + 37; char *spF = DebugText + 41; - if (!_debugLine->_flags.flags._hide) { + if (!_debugLine->_flags._hide) { dwtom(_mouse->_x, absX, 10, 3); dwtom(_mouse->_y, absY, 10, 3); @@ -1083,7 +1087,7 @@ void CGEEngine::sayDebug() { void CGEEngine::switchDebug() { - _debugLine->_flags.flags._hide = !_debugLine->_flags.flags._hide; + _debugLine->_flags._hide = !_debugLine->_flags._hide; } @@ -1121,7 +1125,7 @@ void Sprite::touch(uint16 mask, int x, int y) { _vm->optionTouch(_ref % 10, mask); return; } - if (_flags.flags._syst) + if (_flags._syst) return; // cannot access system sprites if (_vm->_game) if (mask & kMouseLeftUp) { mask &= ~kMouseLeftUp; @@ -1130,7 +1134,7 @@ void Sprite::touch(uint16 mask, int x, int y) { if ((mask & kMouseRightUp) && _snail->idle()) { Sprite *ps = (_pocLight->_seqPtr) ? _pocket[_vm->_pocPtr] : NULL; if (ps) { - if (_flags.flags._kept || _hero->distance(this) < kDistMax) { + if (_flags._kept || _hero->distance(this) < kDistMax) { if (works(ps)) { _vm->feedSnail(ps, kTake); } else @@ -1139,18 +1143,18 @@ void Sprite::touch(uint16 mask, int x, int y) { } else _vm->tooFar(); } else { - if (_flags.flags._kept) + if (_flags._kept) mask |= kMouseLeftUp; else { if (_hero->distance(this) < kDistMax) { /// - if (_flags.flags._port) { + if (_flags._port) { if (_vm->findPocket(NULL) < 0) _vm->pocFul(); else { _snail->addCom(kSnReach, -1, -1, this); _snail->addCom(kSnKeep, -1, -1, this); - _flags.flags._port = false; + _flags._port = false; } } else { if (_takePtr != NO_PTR) { @@ -1168,7 +1172,7 @@ void Sprite::touch(uint16 mask, int x, int y) { } } if ((mask & kMouseLeftUp) && _snail->idle()) { - if (_flags.flags._kept) { + if (_flags._kept) { int n; for (n = 0; n < kPocketNX; n++) { if (_pocket[n] == this) { @@ -1319,11 +1323,11 @@ void CGEEngine::loadSprite(const char *fname, int ref, int cav, int col = 0, int _sprite->_ref = ref; _sprite->_cave = cav; _sprite->_z = pos; - _sprite->_flags.flags._east = east; - _sprite->_flags.flags._port = port; - _sprite->_flags.flags._tran = tran; - _sprite->_flags.flags._kill = true; - _sprite->_flags.flags._bDel = true; + _sprite->_flags._east = east; + _sprite->_flags._port = port; + _sprite->_flags._tran = tran; + _sprite->_flags._kill = true; + _sprite->_flags._bDel = true; // Extract the filename, without the extension strcpy(_sprite->_file, fname); @@ -1390,7 +1394,7 @@ void CGEEngine::loadScript(const char *fname) { _sprite = NULL; loadSprite(SpN, SpI, SpA, SpX, SpY, SpZ); if (_sprite && BkG) - _sprite->_flags.flags._back = true; + _sprite->_flags._back = true; } if (! ok) error("Bad INI line %d [%s]", lcnt, fname); @@ -1452,7 +1456,7 @@ void CGEEngine::handleFrame() { void CGEEngine::tick() { for (Sprite *spr = _vga->_showQ->first(); spr; spr = spr->_next) { if (spr->_time) { - if (!spr->_flags.flags._hide) { + if (!spr->_flags._hide) { if (--spr->_time == 0) spr->tick(); } @@ -1483,9 +1487,9 @@ void CGEEngine::runGame() { _text->preload(100, 1000); loadHeroXY(); - _cavLight->_flags.flags._tran = true; + _cavLight->_flags._tran = true; _vga->_showQ->append(_cavLight); - _cavLight->_flags.flags._hide = true; + _cavLight->_flags._hide = true; const Seq pocSeq[] = { { 0, 0, 0, 0, 20 }, @@ -1500,7 +1504,7 @@ void CGEEngine::runGame() { Common::copy(pocSeq, pocSeq + 7, seq); _pocLight->setSeq(seq); - _pocLight->_flags.flags._tran = true; + _pocLight->_flags._tran = true; _pocLight->_time = 1; _pocLight->_z = 120; _vga->_showQ->append(_pocLight); @@ -1527,8 +1531,8 @@ void CGEEngine::runGame() { loadSprite("MINI", -1, 0, kMiniX, kMiniY); expandSprite(_miniCave = _sprite); // NULL is ok if (_miniCave) { - _miniCave->_flags.flags._kill = false; - _miniCave->_flags.flags._hide = true; + _miniCave->_flags._kill = false; + _miniCave->_flags._hide = true; _miniShp[0] = new Bitmap(*_miniCave->shp()); _miniShpList = _miniCave->setShapeList(_miniShp); postMiniStep(-1); @@ -1543,16 +1547,16 @@ void CGEEngine::runGame() { delete _shadow; if ((_shadow = _sprite) != NULL) { _shadow->_ref = 2; - _shadow->_flags.flags._tran = true; - _shadow->_flags.flags._kill = false; - _hero->_flags.flags._shad = true; + _shadow->_flags._tran = true; + _shadow->_flags._kill = false; + _hero->_flags._shad = true; _vga->_showQ->insert(_vga->_spareQ->remove(_shadow), _hero); } } } _infoLine->gotoxy(kInfoX, kInfoY); - _infoLine->_flags.flags._tran = true; + _infoLine->_flags._tran = true; _infoLine->update(NULL); _vga->_showQ->insert(_infoLine); @@ -1634,8 +1638,8 @@ bool CGEEngine::showTitle(const char *name) { bool userOk = false; Sprite D(this, LB); - D._flags.flags._kill = true; - D._flags.flags._bDel = true; + D._flags._kill = true; + D._flags._bDel = true; D.center(); D.show(2); @@ -1737,9 +1741,9 @@ void CGEEngine::cge_main() { if (!kSavegame0File::exist(kSavegame0Name)) _mode = 2; - _debugLine->_flags.flags._hide = true; + _debugLine->_flags._hide = true; if (_horzLine) - _horzLine->_flags.flags._hide = true; + _horzLine->_flags._hide = true; if (_music && _soundOk) _midiPlayer.loadMidi(0); diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 7235bf19c1..916de839eb 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -158,7 +158,7 @@ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0) _buttons = 0; _busy = NULL; _active = false; - _flags.flags._kill = false; + _flags._kill = false; const Seq ms[] = { { 0, 0, 0, 0, 1 }, @@ -301,9 +301,9 @@ void EventManager::handleEvents() { if (e._mask & kMouseLeftDown) { _mouse->_hold = e._spritePtr; if (_mouse->_hold) { - _mouse->_hold->_flags.flags._hold = true; + _mouse->_hold->_flags._hold = true; - if (_mouse->_hold->_flags.flags._drag) { + if (_mouse->_hold->_flags._drag) { _mouse->_hx = e._x - _mouse->_hold->_x; _mouse->_hy = e._y - _mouse->_hold->_y; } @@ -312,7 +312,7 @@ void EventManager::handleEvents() { if (e._mask & kMouseLeftUp) { if (_mouse->_hold) { - _mouse->_hold->_flags.flags._hold = false; + _mouse->_hold->_flags._hold = false; _mouse->_hold = NULL; } } @@ -325,7 +325,7 @@ void EventManager::handleEvents() { _eventQueueTail = (_eventQueueTail + 1) % kEventMax; } if (_mouse->_hold) { - if (_mouse->_hold->_flags.flags._drag) + if (_mouse->_hold->_flags._drag) _mouse->_hold->gotoxy(_mouse->_x - _mouse->_hx, _mouse->_y - _mouse->_hy); } } diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp index 0b9c6e2a40..e64e4af38a 100644 --- a/engines/cge/game.cpp +++ b/engines/cge/game.cpp @@ -56,7 +56,7 @@ Fly::Fly(CGEEngine *vm, Bitmap **shpl) void Fly::tick() { step(); - if (!_flags.flags._kept) { + if (!_flags._kept) { if (newRandom(10) < 1) { _tx = newRandom(3) - 1; _ty = newRandom(3) - 1; diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp index 34e8643668..d96e494402 100644 --- a/engines/cge/gettext.cpp +++ b/engines/cge/gettext.cpp @@ -46,8 +46,8 @@ GetText::GetText(CGEEngine *vm, const char *info, char *text, int size) _ts[1] = NULL; setShapeList(_ts); - _flags.flags._bDel = true; - _flags.flags._kill = true; + _flags._bDel = true; + _flags._kill = true; memcpy(_buff, text, _len); _buff[_len] = ' '; _buff[_len + 1] = '\0'; diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index 513c6f683f..ba24f832c3 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -45,9 +45,9 @@ Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(kMixFall), _ _mb[1] = NULL; setShapeList(_mb); setName(_text->getText(kMixName)); - _flags.flags._syst = true; - _flags.flags._kill = true; - _flags.flags._bDel = true; + _flags._syst = true; + _flags._kill = true; + _flags._bDel = true; gotoxy(x, y); _z = kMixZ; @@ -73,13 +73,13 @@ Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(kMixFall), _ spr->setSeq(seq); spr->gotoxy(x + 2 + 12 * i, y + 8); - spr->_flags.flags._tran = true; - spr->_flags.flags._kill = true; - spr->_flags.flags._bDel = false; + spr->_flags._tran = true; + spr->_flags._kill = true; + spr->_flags._bDel = false; spr->_z = kMixZ; _led[i] = spr; } - _led[ArrayCount(_led) - 1]->_flags.flags._bDel = true; + _led[ArrayCount(_led) - 1]->_flags._bDel = true; _vga->_showQ->insert(this); for (i = 0; i < ArrayCount(_led); i++) @@ -128,7 +128,7 @@ void Mixer::tick() { int y = _mouse->_y; if (spriteAt(x, y) == this) { _fall = kMixFall; - if (_flags.flags._hold) + if (_flags._hold) touch(kMouseLeftUp, x - _x, y - _y); } else { if (_fall) diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 750d44f45c..6a5556ca58 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -493,7 +493,7 @@ void CGEEngine::snZTrim(Sprite *spr) { if (spr) if (spr->active()) { Sprite *s; - s = (spr->_flags.flags._shad) ? spr->_prev : NULL; + s = (spr->_flags._shad) ? spr->_prev : NULL; _vga->_showQ->insert(_vga->_showQ->remove(spr)); if (s) { s->_z = spr->_z; @@ -506,9 +506,9 @@ void CGEEngine::snHide(Sprite *spr, int val) { debugC(1, kCGEDebugEngine, "CGEEngine::snHide(spr, %d)", val); if (spr) { - spr->_flags.flags._hide = (val >= 0) ? (val != 0) : (!spr->_flags.flags._hide); - if (spr->_flags.flags._shad) - spr->_prev->_flags.flags._hide = spr->_flags.flags._hide; + spr->_flags._hide = (val >= 0) ? (val != 0) : (!spr->_flags._hide); + if (spr->_flags._shad) + spr->_prev->_flags._hide = spr->_flags._hide; } } @@ -554,18 +554,18 @@ void CGEEngine::snSend(Sprite *spr, int val) { spr->_cave = val; if (val1 != was1) { if (was1) { - if (spr->_flags.flags._kept) { + if (spr->_flags._kept) { int n = findPocket(spr); if (n >= 0) _pocket[n] = NULL; } hide1(spr); contractSprite(spr); - spr->_flags.flags._slav = false; + spr->_flags._slav = false; } else { if (spr->_ref % 1000 == 0) Bitmap::_pal = Vga::_sysPal; - if (spr->_flags.flags._back) + if (spr->_flags._back) spr->backShow(true); else expandSprite(spr); @@ -589,12 +589,12 @@ void CGEEngine::snSwap(Sprite *spr, int xref) { swap(spr->_x, xspr->_x); swap(spr->_y, xspr->_y); swap(spr->_z, xspr->_z); - if (spr->_flags.flags._kept) { + if (spr->_flags._kept) { int n = findPocket(spr); if (n >= 0) _pocket[n] = xspr; - xspr->_flags.flags._kept = true; - xspr->_flags.flags._port = false; + xspr->_flags._kept = true; + xspr->_flags._port = false; } if (xwas1 != was1) { if (was1) { @@ -617,14 +617,14 @@ void CGEEngine::snCover(Sprite *spr, int xref) { Sprite *xspr = locate(xref); if (spr && xspr) { - spr->_flags.flags._hide = true; + spr->_flags._hide = true; xspr->_z = spr->_z; xspr->_cave = spr->_cave; xspr->gotoxy(spr->_x, spr->_y); expandSprite(xspr); - if ((xspr->_flags.flags._shad = spr->_flags.flags._shad) == 1) { + if ((xspr->_flags._shad = spr->_flags._shad) == 1) { _vga->_showQ->insert(_vga->_showQ->remove(spr->_prev), xspr); - spr->_flags.flags._shad = false; + spr->_flags._shad = false; } feedSnail(xspr, kNear); } @@ -635,12 +635,12 @@ void CGEEngine::snUncover(Sprite *spr, Sprite *xspr) { debugC(1, kCGEDebugEngine, "CGEEngine::snUncover(spr, xspr)"); if (spr && xspr) { - spr->_flags.flags._hide = false; + spr->_flags._hide = false; spr->_cave = xspr->_cave; spr->gotoxy(xspr->_x, xspr->_y); - if ((spr->_flags.flags._shad = xspr->_flags.flags._shad) == 1) { + if ((spr->_flags._shad = xspr->_flags._shad) == 1) { _vga->_showQ->insert(_vga->_showQ->remove(xspr->_prev), spr); - xspr->_flags.flags._shad = false; + xspr->_flags._shad = false; } spr->_z = xspr->_z; snSend(xspr, -1); @@ -728,7 +728,7 @@ void CGEEngine::snSlave(Sprite *spr, int ref) { if (spr && slv) { if (spr->active()) { snSend(slv, spr->_cave); - slv->_flags.flags._slav = true; + slv->_flags._slav = true; slv->_z = spr->_z; _vga->_showQ->insert(_vga->_showQ->remove(slv), spr->_next); } @@ -740,21 +740,21 @@ void CGEEngine::snTrans(Sprite *spr, int trans) { debugC(1, kCGEDebugEngine, "CGEEngine::snTrans(spr, %d)", trans); if (spr) - spr->_flags.flags._tran = (trans < 0) ? !spr->_flags.flags._tran : (trans != 0); + spr->_flags._tran = (trans < 0) ? !spr->_flags._tran : (trans != 0); } void CGEEngine::snPort(Sprite *spr, int port) { debugC(1, kCGEDebugEngine, "CGEEngine::snPort(spr, %d)", port); if (spr) - spr->_flags.flags._port = (port < 0) ? !spr->_flags.flags._port : (port != 0); + spr->_flags._port = (port < 0) ? !spr->_flags._port : (port != 0); } void CGEEngine::snKill(Sprite *spr) { debugC(1, kCGEDebugEngine, "CGEEngine::snKill(spr)"); if (spr) { - if (spr->_flags.flags._kept) { + if (spr->_flags._kept) { int n = findPocket(spr); if (n >= 0) _pocket[n] = NULL; @@ -763,14 +763,14 @@ void CGEEngine::snKill(Sprite *spr) { hide1(spr); _vga->_showQ->remove(spr); _eventManager->clearEvent(spr); - if (spr->_flags.flags._kill) + if (spr->_flags._kill) delete spr; else { spr->_cave = -1; _vga->_spareQ->append(spr); } if (nx) { - if (nx->_flags.flags._slav) + if (nx->_flags._slav) snKill(nx); } } @@ -791,11 +791,11 @@ void CGEEngine::snKeep(Sprite *spr, int stp) { debugC(1, kCGEDebugEngine, "CGEEngine::snKeep(spr, %d)", stp); selectPocket(-1); - if (spr && ! spr->_flags.flags._kept && _pocket[_pocPtr] == NULL) { + if (spr && ! spr->_flags._kept && _pocket[_pocPtr] == NULL) { snSound(spr, 3, 1); _pocket[_pocPtr] = spr; spr->_cave = 0; - spr->_flags.flags._kept = true; + spr->_flags._kept = true; spr->gotoxy(kPocketX + kPocketDX * _pocPtr + kPocketDX / 2 - spr->_w / 2, kPocketY + kPocketDY / 2 - spr->_h / 2); if (stp >= 0) @@ -812,7 +812,7 @@ void CGEEngine::snGive(Sprite *spr, int stp) { if (p >= 0) { _pocket[p] = NULL; spr->_cave = _now; - spr->_flags.flags._kept = false; + spr->_flags._kept = false; if (stp >= 0) spr->step(stp); } @@ -843,7 +843,7 @@ void CGEEngine::snLevel(Sprite *spr, int lev) { } _maxCave = _maxCaveArr[_lev]; if (spr) - spr->_flags.flags._hide = false; + spr->_flags._hide = false; } diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index 0f38bb0892..db44536267 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -77,7 +77,7 @@ Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode) : Sprite(vm, NULL), _mode(mode), _vm(vm) { _ts = NULL; - _flags.flags._syst = true; + _flags._syst = true; update(text); } @@ -85,7 +85,7 @@ Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode) Talk::Talk(CGEEngine *vm) : Sprite(vm, NULL), _mode(kTBPure), _vm(vm) { _ts = NULL; - _flags.flags._syst = true; + _flags._syst = true; } Font *Talk::_font; diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index c3bdbea706..0e77bb8955 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -180,7 +180,7 @@ void Text::say(const char *text, Sprite *spr) { killText(); _talk = new Talk(_vm, text, kTBRound); if (_talk) { - bool east = spr->_flags.flags._east; + bool east = spr->_flags._east; int x = (east) ? (spr->_x + spr->_w - 2) : (spr->_x + 2); int y = spr->_y + 2; Sprite *spike = new Spike(_vm); @@ -197,8 +197,8 @@ void Text::say(const char *text, Sprite *spr) { if (spr->_ref == 1) x += ((east) ? -10 : 10); // Hero - _talk->_flags.flags._kill = true; - _talk->_flags.flags._bDel = true; + _talk->_flags._kill = true; + _talk->_flags._bDel = true; _talk->setName(_text->getText(kSayName)); _talk->gotoxy(x - (_talk->_w - sw) / 2 - 3 + 6 * east, y - spike->_h - _talk->_h + 1); _talk->_z = 125; @@ -206,8 +206,8 @@ void Text::say(const char *text, Sprite *spr) { spike->gotoxy(x, _talk->_y + _talk->_h - 1); spike->_z = 126; - spike->_flags.flags._slav = true; - spike->_flags.flags._kill = true; + spike->_flags._slav = true; + spike->_flags._kill = true; spike->setName(_text->getText(kSayName)); spike->step(east); spike->_ref = kSayRef; @@ -223,8 +223,8 @@ void CGEEngine::inf(const char *text) { killText(); _talk = new Talk(this, text, kTBRect); if (_talk) { - _talk->_flags.flags._kill = true; - _talk->_flags.flags._bDel = true; + _talk->_flags._kill = true; + _talk->_flags._bDel = true; _talk->setName(_text->getText(kInfName)); _talk->center(); _talk->gotoxy(_talk->_x, _talk->_y - 20); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 6c41292712..ad2415caaf 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -164,7 +164,7 @@ BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) { } expand(); _ext->_shpList = shpP; - _flags.flags._bDel = true; + _flags._bDel = true; if (!_ext->_seq) setSeq(getConstantSeq(_shpCnt < 2)); } @@ -382,7 +382,7 @@ Sprite *Sprite::contract() { if (e) { if (e->_name) delete[] e->_name; - if (_flags.flags._bDel && e->_shpList) { + if (_flags._bDel && e->_shpList) { int i; for (i = 0; e->_shpList[i]; i++) delete e->_shpList[i]; @@ -436,24 +436,24 @@ void Sprite::makeXlat(uint8 *x) { if (_ext) { BitmapPtr *b; - if (_flags.flags._xlat) + if (_flags._xlat) killXlat(); for (b = _ext->_shpList; *b; b++) (*b)->_m = x; - _flags.flags._xlat = true; + _flags._xlat = true; } } void Sprite::killXlat() { - if (_flags.flags._xlat && _ext) { + if (_flags._xlat && _ext) { BitmapPtr *b; uint8 *m = (*_ext->_shpList)->_m; free(m); for (b = _ext->_shpList; *b; b++) (*b)->_m = NULL; - _flags.flags._xlat = false; + _flags._xlat = false; } } @@ -475,9 +475,9 @@ void Sprite::gotoxy(int x, int y) { _y = y; } if (_next) - if (_next->_flags.flags._slav) + if (_next->_flags._slav) _next->gotoxy(_next->_x - xo + _x, _next->_y - yo + _y); - if (_flags.flags._shad) + if (_flags._shad) _prev->gotoxy(_prev->_x - xo + _x, _prev->_y - yo + _y); } @@ -498,8 +498,8 @@ void Sprite::show() { e->_y1 = _y; e->_b1 = shp(); // asm sti // ...done! - if (!_flags.flags._hide) { - if (_flags.flags._xlat) + if (!_flags._hide) { + if (_flags._xlat) e->_b1->xShow(e->_x1, e->_y1); else e->_b1->show(e->_x1, e->_y1); @@ -545,7 +545,7 @@ void Sprite::sync(Common::Serializer &s) { s.syncAsUint16LE(unused); // _ext s.syncAsUint16LE(_ref); s.syncAsByte(_cave); - s.syncAsUint16LE(_flags.flagsWord); + s.syncBytes((byte *)&_flags, 2); s.syncAsUint16LE(_x); s.syncAsUint16LE(_y); s.syncAsByte(_z); @@ -567,7 +567,7 @@ 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.flags._hide && ! spr->_flags.flags._tran) { + if (! spr->_flags._hide && ! spr->_flags._tran) { if (spr->shp()->solidAt(x - spr->_x, y - spr->_y)) break; } @@ -589,7 +589,7 @@ Queue::~Queue() { void Queue::clear() { while (_head) { Sprite *s = remove(_head); - if (s->_flags.flags._kill) + if (s->_flags._kill) delete s; } } @@ -1077,7 +1077,7 @@ PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) { setShapeList(LI); - _flags.flags._kill = false; + _flags._kill = false; } } // End of namespace CGE diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 9ac1bb3c63..1d41a068ff 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -120,8 +120,13 @@ public: {} }; -union Flags { - struct FlagsBits { +class Sprite { +protected: + SprExt *_ext; +public: + int _ref; + signed char _cave; + struct Flags { uint16 _hide : 1; // general visibility switch uint16 _near : 1; // Near action lock uint16 _drag : 1; // sprite is moveable @@ -138,17 +143,7 @@ union Flags { uint16 _back : 1; // 'send to background' request uint16 _bDel : 1; // delete bitmaps in ~SPRITE uint16 _tran : 1; // transparent (untouchable) - } flags; - uint16 flagsWord; -}; - -class Sprite { -protected: - SprExt *_ext; -public: - int _ref; - signed char _cave; - Flags _flags; + } _flags; int _x; int _y; signed char _z; diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index fc7ef2fe00..48b27d9727 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -53,10 +53,10 @@ MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { _ts[1] = NULL; setShapeList(_ts); - _flags.flags._slav = true; - _flags.flags._tran = true; - _flags.flags._kill = true; - _flags.flags._bDel = true; + _flags._slav = true; + _flags._tran = true; + _flags._kill = true; + _flags._bDel = true; } @@ -98,8 +98,8 @@ Vmenu::Vmenu(CGEEngine *vm, Choice *list, int x, int y) _items = 0; for (cp = list; cp->_text; cp++) _items++; - _flags.flags._bDel = true; - _flags.flags._kill = true; + _flags._bDel = true; + _flags._kill = true; if (x < 0 || y < 0) center(); else diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp index 36fecdd22b..a418bfb178 100644 --- a/engines/cge/walk.cpp +++ b/engines/cge/walk.cpp @@ -75,7 +75,7 @@ Walk::Walk(CGEEngine *vm, BitmapPtr *shpl) void Walk::tick() { - if (_flags.flags._hide) + if (_flags._hide) return; _here = XZ(_x + _w / 2, _y + _h); @@ -85,17 +85,17 @@ void Walk::tick() { _sys->funTouch(); for (spr = _vga->_showQ->first(); spr; spr = spr->_next) { if (distance(spr) < 2) { - if (!spr->_flags.flags._near) { + if (!spr->_flags._near) { _vm->feedSnail(spr, kNear); - spr->_flags.flags._near = true; + spr->_flags._near = true; } } else { - spr->_flags.flags._near = false; + spr->_flags._near = false; } } } - if (_flags.flags._hold || _tracePtr < 0) + if (_flags._hold || _tracePtr < 0) park(); else { if (_here == _trace[_tracePtr]) { @@ -187,7 +187,7 @@ void Walk::findWay(Sprite *spr) { if (spr && spr != this) { int x = spr->_x; int z = spr->_z; - if (spr->_flags.flags._east) + if (spr->_flags._east) x += spr->_w + _w / 2 - kWalkSide; else x -= _w / 2 - kWalkSide; @@ -207,7 +207,7 @@ void Walk::reach(Sprite *spr, int mode) { if (spr) { _hero->findWay(spr); if (mode < 0) { - mode = spr->_flags.flags._east; + mode = spr->_flags._east; if (lower(spr)) mode += 2; } diff --git a/engines/cge/walk.h b/engines/cge/walk.h index c1d387f0b5..271663e51d 100644 --- a/engines/cge/walk.h +++ b/engines/cge/walk.h @@ -35,6 +35,7 @@ namespace CGE { #define kMapXCnt 40 #define kMapZCnt 20 +#define kMapArrSize (kMapZCnt * kMapXCnt) #define kMapTop 80 #define kMapHig 80 #define kMapGridX (kScrWidth / kMapXCnt) @@ -93,7 +94,6 @@ public: Cluster() : Couple (-1, -1) { } bool chkBar() const; bool isValid() const; - }; |