diff options
-rw-r--r-- | engines/parallaction/balloons.cpp | 38 | ||||
-rw-r--r-- | engines/parallaction/callables_ns.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 1 | ||||
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/exec.h | 4 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 7 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 1 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 12 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 2 |
13 files changed, 50 insertions, 51 deletions
diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp index 60dd371b6f..f46370849a 100644 --- a/engines/parallaction/balloons.cpp +++ b/engines/parallaction/balloons.cpp @@ -261,9 +261,10 @@ class BalloonManager_ns : public BalloonManager { Balloon *getBalloon(uint id); Gfx *_gfx; + Font *_font; public: - BalloonManager_ns(Gfx *gfx); + BalloonManager_ns(Gfx *gfx, Font *font); ~BalloonManager_ns(); void freeBalloons(); @@ -276,7 +277,7 @@ public: int16 BalloonManager_ns::_dialogueBalloonX[5] = { 80, 120, 150, 150, 150 }; -BalloonManager_ns::BalloonManager_ns(Gfx *gfx) : _numBalloons(0), _gfx(gfx) { +BalloonManager_ns::BalloonManager_ns(Gfx *gfx, Font *font) : _numBalloons(0), _gfx(gfx), _font(font) { _textColors[kSelectedColor] = 0; _textColors[kUnselectedColor] = 3; _textColors[kNormalColor] = 0; @@ -331,7 +332,7 @@ int BalloonManager_ns::setSingleBalloon(const char *text, uint16 x, uint16 y, ui int16 w, h; - StringExtent_NS se(_vm->_dialogueFont); + StringExtent_NS se(_font); se.calc(text, MAX_BALLOON_WIDTH); w = se.width() + 14; h = se.height() + 20; @@ -339,7 +340,7 @@ int BalloonManager_ns::setSingleBalloon(const char *text, uint16 x, uint16 y, ui int id = createBalloon(w+5, h, winding, 1); Balloon *balloon = &_intBalloons[id]; - StringWriter_NS sw(_vm->_dialogueFont); + StringWriter_NS sw(_font); sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); // TODO: extract some text to make a name for obj @@ -355,7 +356,7 @@ int BalloonManager_ns::setDialogueBalloon(const char *text, uint16 winding, Text int16 w, h; - StringExtent_NS se(_vm->_dialogueFont); + StringExtent_NS se(_font); se.calc(text, MAX_BALLOON_WIDTH); w = se.width() + 14; h = se.height() + 20; @@ -364,7 +365,7 @@ int BalloonManager_ns::setDialogueBalloon(const char *text, uint16 winding, Text int id = createBalloon(w+5, h, winding, 1); Balloon *balloon = &_intBalloons[id]; - StringWriter_NS sw(_vm->_dialogueFont); + StringWriter_NS sw(_font); sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); // TODO: extract some text to make a name for obj @@ -385,7 +386,7 @@ void BalloonManager_ns::setBalloonText(uint id, const char *text, TextColor text Balloon *balloon = getBalloon(id); balloon->surface->fillRect(balloon->innerBox, 1); - StringWriter_NS sw(_vm->_dialogueFont); + StringWriter_NS sw(_font); sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); } @@ -394,14 +395,14 @@ int BalloonManager_ns::setLocationBalloon(const char *text, bool endGame) { int16 w, h; - StringExtent_NS se(_vm->_dialogueFont); + StringExtent_NS se(_font); se.calc(text, MAX_BALLOON_WIDTH); w = se.width() + 14; h = se.height() + 20; int id = createBalloon(w+(endGame ? 5 : 10), h+5, -1, BALLOON_TRANSPARENT_COLOR_NS); Balloon *balloon = &_intBalloons[id]; - StringWriter_NS sw(_vm->_dialogueFont); + StringWriter_NS sw(_font); sw.write(text, MAX_BALLOON_WIDTH, _textColors[kNormalColor], balloon->surface); // TODO: extract some text to make a name for obj @@ -548,6 +549,7 @@ class BalloonManager_br : public BalloonManager { Disk *_disk; Gfx *_gfx; + Font *_font; Frames *_leftBalloon; Frames *_rightBalloon; @@ -561,7 +563,7 @@ class BalloonManager_br : public BalloonManager { StringWriter_BR _writer; public: - BalloonManager_br(Disk *disk, Gfx *gfx); + BalloonManager_br(Disk *disk, Gfx *gfx, Font *font); ~BalloonManager_br(); void freeBalloons(); @@ -669,7 +671,7 @@ int BalloonManager_br::setDialogueBalloon(const char *text, uint16 winding, Text void BalloonManager_br::setBalloonText(uint id, const char *text, TextColor textColor) { Balloon *balloon = getBalloon(id); - StringWriter_BR sw(_vm->_dialogueFont); + StringWriter_BR sw(_font); sw.write(text, 216, _textColors[textColor], balloon->surface); } @@ -693,7 +695,7 @@ int BalloonManager_br::createBalloon(int16 w, int16 h, uint16 borderThickness) { } int BalloonManager_br::setLocationBalloon(const char *text, bool endGame) { - StringExtent_BR se(_vm->_dialogueFont); + StringExtent_BR se(_font); se.calc(text, 240); @@ -742,8 +744,8 @@ void BalloonManager_br::cacheAnims() { -BalloonManager_br::BalloonManager_br(Disk *disk, Gfx *gfx) : _numBalloons(0), _disk(disk), _gfx(gfx), - _leftBalloon(0), _rightBalloon(0), _writer(_vm->_dialogueFont) { +BalloonManager_br::BalloonManager_br(Disk *disk, Gfx *gfx, Font *font) : _numBalloons(0), _disk(disk), _gfx(gfx), _font(font), + _leftBalloon(0), _rightBalloon(0), _writer(_font) { _textColors[kSelectedColor] = 12; _textColors[kUnselectedColor] = 0; @@ -756,11 +758,11 @@ BalloonManager_br::~BalloonManager_br() { } void Parallaction::setupBalloonManager() { - if (_vm->getGameType() == GType_Nippon) { - _balloonMan = new BalloonManager_ns(_vm->_gfx); + if (getGameType() == GType_Nippon) { + _balloonMan = new BalloonManager_ns(_gfx, _dialogueFont); } else - if (_vm->getGameType() == GType_BRA) { - _balloonMan = new BalloonManager_br(_vm->_disk, _vm->_gfx); + if (getGameType() == GType_BRA) { + _balloonMan = new BalloonManager_br(_disk, _gfx, _dialogueFont); } else { error("Unknown game type"); } diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index 444f0e580c..70ea732b9a 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -171,7 +171,7 @@ void Parallaction_ns::_c_fade(void *parm) { _gfx->setPalette(pal); _gfx->updateScreen(); - _vm->_system->delayMillis(20); + _system->delayMillis(20); } return; @@ -306,7 +306,7 @@ void Parallaction_ns::_c_endComment(void *param) { _gfx->setPalette(_gfx->_palette); _gfx->updateScreen(); - _vm->_system->delayMillis(20); + _system->delayMillis(20); } _input->waitForButtonEvent(kMouseLeftUp); @@ -325,10 +325,10 @@ void Parallaction_ns::_c_frankenstein(void *parm) { } for (uint16 _di = 0; _di < 30; _di++) { - _vm->_system->delayMillis(20); + _system->delayMillis(20); _gfx->setPalette(pal0); _gfx->updateScreen(); - _vm->_system->delayMillis(20); + _system->delayMillis(20); _gfx->setPalette(pal1); _gfx->updateScreen(); } diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 41c87c55db..d8564459a8 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -409,7 +409,7 @@ void Parallaction::exitDialogueMode() { _input->_inputMode = Input::kInputModeGame; if (_dialogueMan->_cmdList) { - _vm->_cmdExec->run(*_dialogueMan->_cmdList); + _cmdExec->run(*_dialogueMan->_cmdList); } // The current instance of _dialogueMan must be destroyed before the zone commands diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 108c5fe886..d3329966bc 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -152,6 +152,7 @@ protected: void loadMask(BackgroundInfo& info, const char *name); void loadPath(BackgroundInfo& info, const char *name); void loadBackground(BackgroundInfo& info, const char *name); + void buildMask(byte* buf); public: AmigaDisk_ns(Parallaction *vm); diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 2533d32d7c..eedfaf92b7 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -914,7 +914,7 @@ Common::SeekableReadStream *AmigaDisk_ns::tryOpenFile(const char* name) { NOTE: this routine is only able to build masks for Nippon Safes, since mask widths are hardcoded into the main loop. */ -void buildMask(byte* buf) { +void AmigaDisk_ns::buildMask(byte* buf) { byte mask1[16] = { 0, 0x80, 0x20, 0xA0, 8, 0x88, 0x28, 0xA8, 2, 0x82, 0x22, 0xA2, 0xA, 0x8A, 0x2A, 0xAA }; byte mask0[16] = { 0, 0x40, 0x10, 0x50, 4, 0x44, 0x14, 0x54, 1, 0x41, 0x11, 0x51, 0x5, 0x45, 0x15, 0x55 }; diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h index 4239857ec0..9e8a803d52 100644 --- a/engines/parallaction/exec.h +++ b/engines/parallaction/exec.h @@ -44,6 +44,8 @@ class Parallaction_br; class CommandExec { protected: + Parallaction *_vm; + struct ParallactionStruct1 { CommandPtr cmd; ZonePtr z; @@ -69,7 +71,7 @@ public: virtual void run(CommandList &list, ZonePtr z = nullZonePtr); void runSuspended(); - CommandExec() { + CommandExec(Parallaction *vm) : _vm(vm) { _suspendedCtxt.valid = false; } virtual ~CommandExec() { diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 4a398d582a..b60f5d3779 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -438,7 +438,7 @@ void CommandExec::runSuspended() { } } -CommandExec_ns::CommandExec_ns(Parallaction_ns* vm) : _vm(vm) { +CommandExec_ns::CommandExec_ns(Parallaction_ns* vm) : CommandExec(vm), _vm(vm) { } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 0985b5b129..8ad52b9848 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -73,8 +73,9 @@ int32 Gfx::getVar(const Common::String &name) { #define LABEL_TRANSPARENT_COLOR 0xFF void halfbritePixel(int x, int y, int color, void *data) { - byte *buffer = (byte*)data; - buffer[x + y * _vm->_screenWidth] &= ~0x20; + Graphics::Surface *surf = (Graphics::Surface *)data; + byte *pixel = (byte*)surf->getBasePtr(x, y); + *pixel &= ~0x20; } void drawCircleLine(int xCenter, int yCenter, int x, int y, int color, void (*plotProc)(int, int, int, void *), void *data){ @@ -524,7 +525,7 @@ void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) { } } if (_hbCircleRadius > 0) { - drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, surf.pixels); + drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, &surf); } } diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index ad02171052..e2d5fc61df 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -42,9 +42,7 @@ namespace Parallaction { -// FIXME: remove this Parallaction *_vm = NULL; - // public stuff char _saveData1[30] = { '\0' }; @@ -61,11 +59,7 @@ uint32 _globalFlags = 0; Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _char(this) { - // FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what - // needs fixing, or remove it! - // FIXME _vm = this; - Common::addSpecialDebugLevel(kDebugDialogue, "dialogue", "Dialogues debug level"); Common::addSpecialDebugLevel(kDebugParser, "parser", "Parser debug level"); Common::addSpecialDebugLevel(kDebugDisk, "disk", "Disk debug level"); @@ -161,7 +155,7 @@ void Parallaction::updateView() { //foot.y -= ... int min = SCROLL_BAND_WIDTH; - int max = _vm->_screenWidth - SCROLL_BAND_WIDTH; + int max = _screenWidth - SCROLL_BAND_WIDTH; if (foot.x < min) { scrollX -= (min - foot.x); @@ -175,7 +169,7 @@ void Parallaction::updateView() { _gfx->animatePalette(); _gfx->updateScreen(); - _vm->_system->delayMillis(30); + _system->delayMillis(30); } @@ -296,8 +290,8 @@ void Parallaction::showSlide(const char *name, int x, int y) { BackgroundInfo *info = new BackgroundInfo; _disk->loadSlide(*info, name); - info->x = (x == CENTER_LABEL_HORIZONTAL) ? ((_vm->_screenWidth - info->width) >> 1) : x; - info->y = (y == CENTER_LABEL_VERTICAL) ? ((_vm->_screenHeight - info->height) >> 1) : y; + info->x = (x == CENTER_LABEL_HORIZONTAL) ? ((_screenWidth - info->width) >> 1) : x; + info->y = (y == CENTER_LABEL_VERTICAL) ? ((_screenHeight - info->height) >> 1) : y; _gfx->setBackground(kBackgroundSlide, info); } @@ -411,7 +405,7 @@ void Parallaction::doLocationEnterTransition() { pal.fadeTo(_gfx->_palette, 4); _gfx->setPalette(pal); _gfx->updateScreen(); - _vm->_system->delayMillis(20); + _system->delayMillis(20); } _gfx->setPalette(_gfx->_palette); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 3fe0ef49a2..dd4598ed96 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -519,7 +519,6 @@ private: void _c_password(void*); }; -// FIXME: remove global extern Parallaction *_vm; diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index b44bd450a6..59b5c247ab 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -267,8 +267,8 @@ void Parallaction_br::parseLocation(const char *filename) { delete script; // this loads animation scripts - AnimationList::iterator it = _vm->_location._animations.begin(); - for ( ; it != _vm->_location._animations.end(); it++) { + AnimationList::iterator it = _location._animations.begin(); + for ( ; it != _location._animations.end(); it++) { if ((*it)->_scriptName) { loadProgram(*it, (*it)->_scriptName); } @@ -289,7 +289,7 @@ void Parallaction_br::loadProgram(AnimationPtr a, const char *filename) { delete script; - _vm->_location._programs.push_back(program); + _location._programs.push_back(program); debugC(1, kDebugParser, "loadProgram() done"); diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 17f0343259..594fcb61c0 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -141,8 +141,8 @@ void LocationName::bind(const char *s) { strcpy(_buf, s); // kept as reference } -Parallaction_ns::Parallaction_ns(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction(syst, gameDesc), - _locationParser(0), _programParser(0) { +Parallaction_ns::Parallaction_ns(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction(syst, gameDesc), + _locationParser(0), _programParser(0) { } Common::Error Parallaction_ns::init() { @@ -260,7 +260,7 @@ void Parallaction_ns::switchBackground(const char* background, const char* mask) v2 += 4; } - _vm->_system->delayMillis(20); + _system->delayMillis(20); _gfx->setPalette(pal); _gfx->updateScreen(); } @@ -375,15 +375,15 @@ void Parallaction_ns::parseLocation(const char *filename) { // TODO: the following two lines are specific to Nippon Safes // and should be moved into something like 'initializeParsing()' - _vm->_location._hasSound = false; + _location._hasSound = false; _locationParser->parse(script); delete script; // this loads animation scripts - AnimationList::iterator it = _vm->_location._animations.begin(); - for ( ; it != _vm->_location._animations.end(); it++) { + AnimationList::iterator it = _location._animations.begin(); + for ( ; it != _location._animations.end(); it++) { if ((*it)->_scriptName) { loadProgram(*it, (*it)->_scriptName); } diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 86f77e02e7..2a1b40f010 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -356,7 +356,7 @@ void Parallaction_ns::loadProgram(AnimationPtr a, const char *filename) { delete script; - _vm->_location._programs.push_back(program); + _location._programs.push_back(program); debugC(1, kDebugParser, "loadProgram() done"); |