mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
CGE: Move some more globals to CGEEngine
This commit is contained in:
parent
f5eca79658
commit
4778ff720c
@ -49,8 +49,8 @@ Bitmap::Bitmap(CGEEngine *vm, const char *fname) : _m(NULL), _v(NULL), _map(0),
|
||||
char pat[kMaxPath];
|
||||
forceExt(pat, fname, ".VBM");
|
||||
|
||||
if (_resman->exist(pat)) {
|
||||
EncryptedStream file(pat);
|
||||
if (_vm->_resman->exist(pat)) {
|
||||
EncryptedStream file(_vm, pat);
|
||||
if (file.err())
|
||||
error("Unable to find VBM [%s]", fname);
|
||||
if (!loadVBM(&file))
|
||||
|
@ -102,11 +102,11 @@ void CGEEngine::init() {
|
||||
_debugLine = new InfoLine(this, kScrWidth);
|
||||
_snail = new Snail(this, false);
|
||||
_snail_ = new Snail(this, true);
|
||||
|
||||
_midiPlayer = new MusicPlayer(this);
|
||||
_mouse = new Mouse(this);
|
||||
_keyboard = new Keyboard(this);
|
||||
_eventManager = new EventManager(this);
|
||||
_fx = new Fx(16); // must precede SOUND!!
|
||||
_fx = new Fx(this, 16); // must precede SOUND!!
|
||||
_sound = new Sound(this);
|
||||
|
||||
_offUseCount = atoi(_text->getText(kOffUseCount));
|
||||
@ -148,7 +148,7 @@ void CGEEngine::deinit() {
|
||||
DebugMan.clearAllDebugChannels();
|
||||
|
||||
delete _console;
|
||||
_midiPlayer.killMidi();
|
||||
_midiPlayer->killMidi();
|
||||
|
||||
// Delete engine objects
|
||||
delete _vga;
|
||||
|
@ -45,6 +45,13 @@ class Vga;
|
||||
class System;
|
||||
class Keyboard;
|
||||
class Mouse;
|
||||
class HorizLine;
|
||||
class InfoLine;
|
||||
class SceneLight;
|
||||
class Snail;
|
||||
class Snail;
|
||||
class EventManager;
|
||||
class ResourceManager;
|
||||
|
||||
#define kSavegameVersion 2
|
||||
#define kSavegameStrSize 11
|
||||
@ -164,9 +171,22 @@ public:
|
||||
Sprite *_pocLight;
|
||||
Keyboard *_keyboard;
|
||||
Mouse *_mouse;
|
||||
Sprite *_sprite;
|
||||
Sprite *_miniScene;
|
||||
Sprite *_shadow;
|
||||
HorizLine *_horzLine;
|
||||
InfoLine *_infoLine;
|
||||
InfoLine *_debugLine;
|
||||
SceneLight *_sceneLight;
|
||||
Snail *_snail;
|
||||
Snail *_snail_;
|
||||
EventManager *_eventManager;
|
||||
Fx *_fx;
|
||||
Sound *_sound;
|
||||
ResourceManager *_resman;
|
||||
|
||||
Common::RandomSource _randomSource;
|
||||
MusicPlayer _midiPlayer;
|
||||
MusicPlayer *_midiPlayer;
|
||||
BitmapPtr *_miniShp;
|
||||
BitmapPtr *_miniShpList;
|
||||
int _startGameSlot;
|
||||
|
@ -52,22 +52,7 @@ namespace CGE {
|
||||
|
||||
uint16 _stklen = (kStackSize * 2);
|
||||
|
||||
EventManager *_eventManager;
|
||||
Sprite *_pocket[kPocketNX];
|
||||
Sprite *_sprite;
|
||||
Sprite *_miniScene;
|
||||
Sprite *_shadow;
|
||||
HorizLine *_horzLine;
|
||||
InfoLine *_infoLine;
|
||||
SceneLight *_sceneLight;
|
||||
InfoLine *_debugLine;
|
||||
|
||||
Snail *_snail;
|
||||
Snail *_snail_;
|
||||
|
||||
Fx *_fx;
|
||||
Sound *_sound;
|
||||
ResourceManager *_resman;
|
||||
|
||||
const char *savegameStr = "SCUMMVM_CGE";
|
||||
|
||||
@ -219,7 +204,7 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
|
||||
|
||||
if (slotNumber == -1) {
|
||||
// Loading the data for the initial game state
|
||||
kSavegame0File file = kSavegame0File(kSavegame0Name);
|
||||
kSavegame0File file = kSavegame0File(this, kSavegame0Name);
|
||||
int size = file.size();
|
||||
byte *dataBuffer = (byte *)malloc(size);
|
||||
file.read(dataBuffer, size);
|
||||
@ -490,7 +475,7 @@ void CGEEngine::tooFar() {
|
||||
void CGEEngine::loadHeroXY() {
|
||||
debugC(1, kCGEDebugEngine, "CGEEngine::loadHeroXY()");
|
||||
|
||||
EncryptedStream cf("CGE.HXY");
|
||||
EncryptedStream cf(this, "CGE.HXY");
|
||||
uint16 x, y;
|
||||
|
||||
memset(_heroXY, 0, sizeof(_heroXY));
|
||||
@ -509,7 +494,7 @@ void CGEEngine::loadMapping() {
|
||||
debugC(1, kCGEDebugEngine, "CGEEngine::loadMapping()");
|
||||
|
||||
if (_now <= kSceneMax) {
|
||||
EncryptedStream cf("CGE.TAB");
|
||||
EncryptedStream cf(this, "CGE.TAB");
|
||||
if (!cf.err()) {
|
||||
// Move to the data for the given room
|
||||
cf.seek((_now - 1) * kMapArrSize);
|
||||
@ -536,7 +521,7 @@ void Square::touch(uint16 mask, int x, int y) {
|
||||
Sprite::touch(mask, x, y);
|
||||
if (mask & kMouseLeftUp) {
|
||||
_vm->XZ(_x + x, _y + y).cell() = 0;
|
||||
_snail_->addCom(kSnKill, -1, 0, this);
|
||||
_vm->_snail_->addCom(kSnKill, -1, 0, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -629,7 +614,7 @@ void CGEEngine::sceneUp() {
|
||||
|
||||
const int BakRef = 1000 * _now;
|
||||
if (_music)
|
||||
_midiPlayer.loadMidi(_now);
|
||||
_midiPlayer->loadMidi(_now);
|
||||
|
||||
showBak(BakRef);
|
||||
loadMapping();
|
||||
@ -775,7 +760,7 @@ void System::touch(uint16 mask, int x, int y) {
|
||||
_vm->keyClick();
|
||||
_vm->killText();
|
||||
if (_vm->_startupMode == 1) {
|
||||
_snail->addCom(kSnClear, -1, 0, NULL);
|
||||
_vm->_snail->addCom(kSnClear, -1, 0, NULL);
|
||||
return;
|
||||
}
|
||||
switch (x) {
|
||||
@ -789,7 +774,7 @@ void System::touch(uint16 mask, int x, int y) {
|
||||
case '3':
|
||||
case '4':
|
||||
if (_vm->_keyboard->_key[kKeyAlt]) {
|
||||
_snail->addCom(kSnLevel, -1, x - '0', NULL);
|
||||
_vm->_snail->addCom(kSnLevel, -1, x - '0', NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -798,7 +783,7 @@ void System::touch(uint16 mask, int x, int y) {
|
||||
if (_vm->_startupMode)
|
||||
return;
|
||||
int selectedScene = 0;
|
||||
_infoLine->update(NULL);
|
||||
_vm->_infoLine->update(NULL);
|
||||
if (y >= kWorldHeight ) {
|
||||
if (x < kButtonX) { // select scene?
|
||||
if (y >= kSceneY && y < kSceneY + kSceneNy * kSceneDy &&
|
||||
@ -821,10 +806,10 @@ void System::touch(uint16 mask, int x, int y) {
|
||||
_vm->postMiniStep(selectedScene - 1);
|
||||
|
||||
if (mask & kMouseLeftUp) {
|
||||
if (selectedScene && _snail->idle() && _hero->_tracePtr < 0)
|
||||
if (selectedScene && _vm->_snail->idle() && _hero->_tracePtr < 0)
|
||||
_vm->switchScene(selectedScene);
|
||||
|
||||
if (_horzLine && !_horzLine->_flags._hide) {
|
||||
if (_vm->_horzLine && !_vm->_horzLine->_flags._hide) {
|
||||
if (y >= kMapTop && y < kMapTop + kMapHig) {
|
||||
Cluster tmpCluster = _vm->XZ(x, y);
|
||||
int16 x1 = tmpCluster._pt.x;
|
||||
@ -833,7 +818,7 @@ void System::touch(uint16 mask, int x, int y) {
|
||||
_vm->setMapBrick(x1, z1);
|
||||
}
|
||||
} else {
|
||||
if (!_talk && _snail->idle() && _hero
|
||||
if (!_talk && _vm->_snail->idle() && _hero
|
||||
&& y >= kMapTop && y < kMapTop + kMapHig && !_vm->_game) {
|
||||
_hero->findWay(_vm->XZ(x, y));
|
||||
}
|
||||
@ -846,7 +831,7 @@ void System::tick() {
|
||||
if (!_vm->_startupMode)
|
||||
if (--_funDel == 0) {
|
||||
_vm->killText();
|
||||
if (_snail->idle()) {
|
||||
if (_vm->_snail->idle()) {
|
||||
if (_vm->_flag[0]) // Pain flag
|
||||
_vm->heroCover(9);
|
||||
else { // CHECKME: Before, was: if (Startup::_core >= CORE_MID) {
|
||||
@ -881,9 +866,9 @@ void CGEEngine::switchMusic() {
|
||||
keyClick();
|
||||
|
||||
if (_music)
|
||||
_midiPlayer.loadMidi(_now);
|
||||
_midiPlayer->loadMidi(_now);
|
||||
else
|
||||
_midiPlayer.killMidi();
|
||||
_midiPlayer->killMidi();
|
||||
}
|
||||
|
||||
void CGEEngine::startCountDown() {
|
||||
@ -946,10 +931,10 @@ void Sprite::touch(uint16 mask, int x, int y) {
|
||||
if ((mask & kEventAttn) != 0)
|
||||
return;
|
||||
|
||||
_infoLine->update(name());
|
||||
_vm->_infoLine->update(name());
|
||||
|
||||
if (mask & (kMouseRightDown | kMouseLeftDown))
|
||||
_sprite = this;
|
||||
_vm->_sprite = this;
|
||||
|
||||
if (_ref / 10 == 12) {
|
||||
_vm->optionTouch(_ref % 10, mask);
|
||||
@ -965,7 +950,7 @@ void Sprite::touch(uint16 mask, int x, int y) {
|
||||
mask |= kMouseRightUp;
|
||||
}
|
||||
|
||||
if ((mask & kMouseRightUp) && _snail->idle()) {
|
||||
if ((mask & kMouseRightUp) && _vm->_snail->idle()) {
|
||||
Sprite *ps = (_vm->_pocLight->_seqPtr) ? _pocket[_vm->_pocPtr] : NULL;
|
||||
if (ps) {
|
||||
if (_flags._kept || _hero->distance(this) < kDistMax) {
|
||||
@ -985,8 +970,8 @@ void Sprite::touch(uint16 mask, int x, int y) {
|
||||
if (_vm->findPocket(NULL) < 0) {
|
||||
_vm->pocFul();
|
||||
} else {
|
||||
_snail->addCom(kSnReach, -1, -1, this);
|
||||
_snail->addCom(kSnKeep, -1, -1, this);
|
||||
_vm->_snail->addCom(kSnReach, -1, -1, this);
|
||||
_vm->_snail->addCom(kSnKeep, -1, -1, this);
|
||||
_flags._port = false;
|
||||
}
|
||||
} else {
|
||||
@ -1006,7 +991,7 @@ void Sprite::touch(uint16 mask, int x, int y) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & kMouseLeftUp) && _snail->idle()) {
|
||||
if ((mask & kMouseLeftUp) && _vm->_snail->idle()) {
|
||||
if (_flags._kept) {
|
||||
for (int n = 0; n < kPocketNX; n++) {
|
||||
if (_pocket[n] == this) {
|
||||
@ -1015,7 +1000,7 @@ void Sprite::touch(uint16 mask, int x, int y) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_snail->addCom(kSnWalk, -1, -1, this); // Hero->FindWay(this);
|
||||
_vm->_snail->addCom(kSnWalk, -1, -1, this); // Hero->FindWay(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1043,7 +1028,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
|
||||
mergeExt(tmpStr, fname, kSprExt);
|
||||
|
||||
if (_resman->exist(tmpStr)) { // sprite description file exist
|
||||
EncryptedStream sprf(tmpStr);
|
||||
EncryptedStream sprf(this, tmpStr);
|
||||
if (sprf.err())
|
||||
error("Bad SPR [%s]", tmpStr);
|
||||
|
||||
@ -1148,7 +1133,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
|
||||
}
|
||||
|
||||
void CGEEngine::loadScript(const char *fname) {
|
||||
EncryptedStream scrf(fname);
|
||||
EncryptedStream scrf(this, fname);
|
||||
|
||||
if (scrf.err())
|
||||
return;
|
||||
@ -1356,7 +1341,7 @@ void CGEEngine::runGame() {
|
||||
_sprite->step(_music);
|
||||
_snail_->addCom(kSnSeq, -1, _music, _sprite);
|
||||
if (!_music)
|
||||
_midiPlayer.killMidi();
|
||||
_midiPlayer->killMidi();
|
||||
|
||||
if (_resman->exist("MINI.SPR")) {
|
||||
_miniShp = new BitmapPtr[2];
|
||||
@ -1505,7 +1490,7 @@ bool CGEEngine::showTitle(const char *name) {
|
||||
_vga->copyPage(0, 2);
|
||||
_soundOk = 2;
|
||||
if (_music)
|
||||
_midiPlayer.loadMidi(0);
|
||||
_midiPlayer->loadMidi(0);
|
||||
}
|
||||
|
||||
if (_mode < 2) {
|
||||
@ -1560,7 +1545,7 @@ void CGEEngine::cge_main() {
|
||||
_horzLine->_flags._hide = true;
|
||||
|
||||
if (_music && _soundOk)
|
||||
_midiPlayer.loadMidi(0);
|
||||
_midiPlayer->loadMidi(0);
|
||||
|
||||
if (_startGameSlot != -1) {
|
||||
// Starting up a savegame from the launcher
|
||||
|
@ -109,19 +109,7 @@ private:
|
||||
CGEEngine *_vm;
|
||||
};
|
||||
|
||||
extern EventManager *_eventManager;
|
||||
extern Sprite *_pocket[];
|
||||
extern Sprite *_sprite;
|
||||
extern Sprite *_miniScene;
|
||||
extern Sprite *_shadow;
|
||||
extern HorizLine *_horzLine;
|
||||
extern InfoLine *_infoLine;
|
||||
extern SceneLight *_sceneLight;
|
||||
extern InfoLine *_debugLine;
|
||||
extern Snail *_snail;
|
||||
extern Snail *_snail_;
|
||||
extern Fx *_fx;
|
||||
extern Sound *_sound;
|
||||
|
||||
} // End of namespace CGE
|
||||
|
||||
|
@ -165,7 +165,7 @@ void Keyboard::newKeyboard(Common::Event &event) {
|
||||
_current = Keyboard::_code[keycode];
|
||||
|
||||
if (_client) {
|
||||
CGEEvent &evt = _eventManager->getNextEvent();
|
||||
CGEEvent &evt = _vm->_eventManager->getNextEvent();
|
||||
evt._x = _current; // Keycode
|
||||
evt._mask = kEventKeyb; // Event mask
|
||||
evt._spritePtr = _client; // Sprite pointer
|
||||
@ -239,7 +239,7 @@ void Mouse::newMouse(Common::Event &event) {
|
||||
if (!_active)
|
||||
return;
|
||||
|
||||
CGEEvent &evt = _eventManager->getNextEvent();
|
||||
CGEEvent &evt = _vm->_eventManager->getNextEvent();
|
||||
evt._x = event.mouse.x;
|
||||
evt._y = event.mouse.y;
|
||||
evt._spritePtr = _vm->spriteAt(evt._x, evt._y);
|
||||
|
@ -192,17 +192,17 @@ uint16 ResourceManager::catRead(void *buf, uint16 length) {
|
||||
/*-----------------------------------------------------------------------
|
||||
* EncryptedStream
|
||||
*-----------------------------------------------------------------------*/
|
||||
EncryptedStream::EncryptedStream(const char *name) {
|
||||
EncryptedStream::EncryptedStream(CGEEngine *vm, const char *name) : _vm(vm) {
|
||||
debugC(3, kCGEDebugFile, "EncryptedStream::EncryptedStream(%s)", name);
|
||||
|
||||
_error = false;
|
||||
BtKeypack *kp = _resman->find(name);
|
||||
BtKeypack *kp = _vm->_resman->find(name);
|
||||
if (scumm_stricmp(kp->_key, name) != 0)
|
||||
_error = true;
|
||||
|
||||
_resman->seek(kp->_pos);
|
||||
_vm->_resman->seek(kp->_pos);
|
||||
byte *dataBuffer = (byte *)malloc(kp->_size);
|
||||
_resman->read(dataBuffer, kp->_size);
|
||||
_vm->_resman->read(dataBuffer, kp->_size);
|
||||
_readStream = new Common::MemoryReadStream(dataBuffer, kp->_size, DisposeAfterUse::YES);
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
namespace CGE {
|
||||
|
||||
class CGEEngine;
|
||||
|
||||
#define kBtSize 1024
|
||||
#define kBtKeySize 13
|
||||
#define kBtLevel 2
|
||||
@ -98,10 +100,11 @@ public:
|
||||
|
||||
class EncryptedStream {
|
||||
private:
|
||||
CGEEngine *_vm;
|
||||
Common::SeekableReadStream *_readStream;
|
||||
bool _error;
|
||||
public:
|
||||
EncryptedStream(const char *name);
|
||||
EncryptedStream(CGEEngine *vm, const char *name);
|
||||
~EncryptedStream();
|
||||
bool err();
|
||||
bool eos();
|
||||
@ -112,8 +115,6 @@ public:
|
||||
Common::String readLine();
|
||||
};
|
||||
|
||||
extern ResourceManager *_resman;
|
||||
|
||||
} // End of namespace CGE
|
||||
|
||||
#endif
|
||||
|
@ -1136,7 +1136,7 @@ void Snail::runCom() {
|
||||
_vm->snSound(spr, snc->_val);
|
||||
break;
|
||||
case kSnCount:
|
||||
_sound->setRepeat(snc->_val);
|
||||
_vm->_sound->setRepeat(snc->_val);
|
||||
break;
|
||||
case kSnExec:
|
||||
switch (snc->_cbType) {
|
||||
|
@ -55,12 +55,12 @@ Sound::~Sound() {
|
||||
}
|
||||
|
||||
void Sound::close() {
|
||||
_vm->_midiPlayer.killMidi();
|
||||
_vm->_midiPlayer->killMidi();
|
||||
}
|
||||
|
||||
void Sound::open() {
|
||||
setRepeat(1);
|
||||
play((*_fx)[30000], 8);
|
||||
play((*_vm->_fx)[30000], 8);
|
||||
}
|
||||
|
||||
void Sound::setRepeat(int16 count) {
|
||||
@ -103,7 +103,7 @@ void Sound::sndDigiStop(SmpInfo *PSmpInfo) {
|
||||
_audioStream = NULL;
|
||||
}
|
||||
|
||||
Fx::Fx(int size) : _current(NULL) {
|
||||
Fx::Fx(CGEEngine *vm, int size) : _current(NULL), _vm(vm) {
|
||||
_cache = new Handler[size];
|
||||
for (_size = 0; _size < size; _size++) {
|
||||
_cache[_size]._ref = 0;
|
||||
@ -144,7 +144,7 @@ void Fx::preload(int ref0) {
|
||||
|
||||
for (int ref = ref0; ref < ref0 + 10; ref++) {
|
||||
sprintf(filename, "FX%05d.WAV", ref);
|
||||
EncryptedStream file = filename;
|
||||
EncryptedStream file(_vm, filename);
|
||||
DataCk *wav = loadWave(&file);
|
||||
if (wav) {
|
||||
Handler *p = &_cache[find(0)];
|
||||
@ -162,7 +162,7 @@ DataCk *Fx::load(int idx, int ref) {
|
||||
char filename[12];
|
||||
sprintf(filename, "FX%05d.WAV", ref);
|
||||
|
||||
EncryptedStream file = filename;
|
||||
EncryptedStream file(_vm, filename);
|
||||
DataCk *wav = loadWave(&file);
|
||||
if (wav) {
|
||||
Handler *p = &_cache[idx];
|
||||
@ -195,7 +195,7 @@ DataCk *Fx::operator[](int ref) {
|
||||
return _current;
|
||||
}
|
||||
|
||||
MusicPlayer::MusicPlayer() {
|
||||
MusicPlayer::MusicPlayer(CGEEngine *vm) : _vm(vm) {
|
||||
_data = NULL;
|
||||
_isGM = false;
|
||||
|
||||
@ -230,14 +230,14 @@ void MusicPlayer::killMidi() {
|
||||
void MusicPlayer::loadMidi(int ref) {
|
||||
// Work out the filename and check the given MIDI file exists
|
||||
Common::String filename = Common::String::format("%.2d.MID", ref);
|
||||
if (!_resman->exist(filename.c_str()))
|
||||
if (!_vm->_resman->exist(filename.c_str()))
|
||||
return;
|
||||
|
||||
// Stop any currently playing MIDI file
|
||||
killMidi();
|
||||
|
||||
// Read in the data for the file
|
||||
EncryptedStream mid(filename.c_str());
|
||||
EncryptedStream mid(_vm, filename.c_str());
|
||||
_dataSize = mid.size();
|
||||
_data = (byte *)malloc(_dataSize);
|
||||
mid.read(_data, _dataSize);
|
||||
|
@ -87,6 +87,7 @@ private:
|
||||
};
|
||||
|
||||
class Fx {
|
||||
CGEEngine *_vm;
|
||||
struct Handler {
|
||||
int _ref;
|
||||
DataCk *_wav;
|
||||
@ -99,7 +100,7 @@ class Fx {
|
||||
public:
|
||||
DataCk *_current;
|
||||
|
||||
Fx(int size);
|
||||
Fx(CGEEngine *vm, int size);
|
||||
~Fx();
|
||||
void clear();
|
||||
void preload(int ref0);
|
||||
@ -108,6 +109,7 @@ public:
|
||||
|
||||
class MusicPlayer: public Audio::MidiPlayer {
|
||||
private:
|
||||
CGEEngine *_vm;
|
||||
byte *_data;
|
||||
int _dataSize;
|
||||
bool _isGM;
|
||||
@ -118,7 +120,7 @@ private:
|
||||
// Stop MIDI File
|
||||
void sndMidiStop();
|
||||
public:
|
||||
MusicPlayer();
|
||||
MusicPlayer(CGEEngine *vm);
|
||||
~MusicPlayer();
|
||||
|
||||
void loadMidi(int ref);
|
||||
|
@ -50,7 +50,7 @@ Font::~Font() {
|
||||
}
|
||||
|
||||
void Font::load() {
|
||||
EncryptedStream f = _path;
|
||||
EncryptedStream f(_vm, _path);
|
||||
assert(!f.err());
|
||||
|
||||
f.read(_widthArr, kWidSize);
|
||||
|
@ -40,7 +40,7 @@ Talk *_talk = NULL;
|
||||
|
||||
Text::Text(CGEEngine *vm, const char *fname) : _vm(vm) {
|
||||
_vm->mergeExt(_fileName, fname, kSayExt);
|
||||
if (!_resman->exist(_fileName))
|
||||
if (!_vm->_resman->exist(_fileName))
|
||||
error("No talk (%s)\n", _fileName);
|
||||
int16 txtCount = count() + 1;
|
||||
if (!txtCount)
|
||||
@ -60,7 +60,7 @@ Text::~Text() {
|
||||
}
|
||||
|
||||
int16 Text::count() {
|
||||
EncryptedStream tf = _fileName;
|
||||
EncryptedStream tf(_vm, _fileName);
|
||||
if (tf.err())
|
||||
return -1;
|
||||
|
||||
@ -94,7 +94,7 @@ void Text::clear() {
|
||||
}
|
||||
|
||||
void Text::load() {
|
||||
EncryptedStream tf = _fileName;
|
||||
EncryptedStream tf(_vm, _fileName);
|
||||
assert(!tf.err());
|
||||
|
||||
Common::String line;
|
||||
|
@ -72,8 +72,8 @@ Sprite::Sprite(CGEEngine *vm, BitmapPtr *shpP)
|
||||
}
|
||||
|
||||
Sprite::~Sprite() {
|
||||
if (_sprite == this)
|
||||
_sprite = NULL;
|
||||
if (_vm->_sprite == this)
|
||||
_vm->_sprite = NULL;
|
||||
|
||||
contract();
|
||||
}
|
||||
@ -211,8 +211,8 @@ Sprite *Sprite::expand() {
|
||||
Snail::Com *nearList = NULL;
|
||||
Snail::Com *takeList = NULL;
|
||||
_vm->mergeExt(fname, _file, kSprExt);
|
||||
if (_resman->exist(fname)) { // sprite description file exist
|
||||
EncryptedStream sprf(fname);
|
||||
if (_vm->_resman->exist(fname)) { // sprite description file exist
|
||||
EncryptedStream sprf(_vm, fname);
|
||||
if (sprf.err())
|
||||
error("Bad SPR [%s]", fname);
|
||||
Common::String line;
|
||||
|
@ -112,7 +112,7 @@ void Vmenu::touch(uint16 mask, int x, int y) {
|
||||
|
||||
if (ok && (mask & kMouseLeftUp)) {
|
||||
_items = 0;
|
||||
_snail_->addCom(kSnKill, -1, 0, this);
|
||||
_vm->_snail_->addCom(kSnKill, -1, 0, this);
|
||||
_recent = n;
|
||||
assert(_menu[n].Proc);
|
||||
CALL_MEMBER_FN(*_vm, _menu[n].Proc)();
|
||||
|
@ -95,7 +95,7 @@ void Walk::tick() {
|
||||
} else {
|
||||
// take current Z position
|
||||
_z = _here._pt.y;
|
||||
_snail_->addCom(kSnZTrim, -1, 0, this); // update Hero's pos in show queue
|
||||
_vm->_snail_->addCom(kSnZTrim, -1, 0, this); // update Hero's pos in show queue
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,10 +187,10 @@ void Walk::reach(Sprite *spr, int mode) {
|
||||
}
|
||||
}
|
||||
// note: insert SNAIL commands in reverse order
|
||||
_snail->insCom(kSnPause, -1, 64, NULL);
|
||||
_snail->insCom(kSnSeq, -1, kTSeq + mode, this);
|
||||
_vm->_snail->insCom(kSnPause, -1, 64, NULL);
|
||||
_vm->_snail->insCom(kSnSeq, -1, kTSeq + mode, this);
|
||||
if (spr) {
|
||||
_snail->insCom(kSnWait, -1, -1, _hero);
|
||||
_vm->_snail->insCom(kSnWait, -1, -1, _hero);
|
||||
//SNINSERT(SNWALK, -1, -1, spr);
|
||||
}
|
||||
// sequence is not finished,
|
||||
|
Loading…
x
Reference in New Issue
Block a user