From 06434f6eef88850f3a67e12b044af52225d5c72f Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 11 Mar 2007 13:01:11 +0000 Subject: some simplification for changeLocation svn-id: r26083 --- engines/parallaction/location.cpp | 57 ++++++++++++++++++++--------------- engines/parallaction/parallaction.cpp | 2 +- engines/parallaction/parallaction.h | 3 +- 3 files changed, 35 insertions(+), 27 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index a483635970..086670a331 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -279,6 +279,29 @@ extern Zone *_hoverZone; extern Job *_jDrawLabel; extern Job *_jEraseLabel; +void Parallaction::showSlide(const char *name) { + + _disk->loadSlide(name); + _graphics->palUnk0(_palette); + _graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront); + + debugC(1, kDebugLocation, "changeLocation: new background set"); + + _graphics->_proportionalFont = false; + _graphics->setFont("slide"); + + uint16 _ax = strlen(_slideText[0]); + _ax <<= 3; // text width + uint16 _dx = (SCREEN_WIDTH - _ax) >> 1; // center text + _graphics->displayString(_dx, 14, _slideText[0]); // displays text on screen + + waitUntilLeftClick(); + + debugC(2, kDebugLocation, "changeLocation: intro text shown"); + + return; +} + /* changeLocation handles transitions between locations, and is able to display slides between one and the other. The input parameter 'location' exists in some flavours: @@ -319,41 +342,25 @@ void Parallaction::changeLocation(char *location) { debugC(2, kDebugLocation, "changeLocation: changed cursor"); } - strcpy(_newLocation, location); - removeNode(&_yourself._zone._node); debugC(2, kDebugLocation, "changeLocation: removed character from the animation list"); freeLocation(); debugC(1, kDebugLocation, "changeLocation: old location free'd"); + char buf[100]; + strcpy(buf, location); - char *tmp = strchr(_newLocation, '.'); + char *tmp = strchr(buf, '.'); // tmp = ".slide.[L].[C]" or tmp = ".[C]" or tmp = NULL if (tmp) { *tmp = '\0'; if (!scumm_strnicmp(tmp+1, "slide", 5)) { - _disk->loadSlide(_newLocation); - _graphics->palUnk0(_palette); - _graphics->copyScreen(Graphics::kBitBack, Graphics::kBitFront); - - debugC(1, kDebugLocation, "changeLocation: new background set"); - - _graphics->_proportionalFont = false; - _graphics->setFont("slide"); - - uint16 _ax = strlen(_slideText[0]); - _ax <<= 3; // text width - uint16 _dx = (SCREEN_WIDTH - _ax) >> 1; // center text - _graphics->displayString(_dx, 14, _slideText[0]); // displays text on screen - - waitUntilLeftClick(); - - debugC(2, kDebugLocation, "changeLocation: intro text shown"); + showSlide(buf); tmp = strchr(tmp+1, '.'); - strcpy(_newLocation, tmp+1); - tmp = strchr(_newLocation, '.'); + strcpy(buf, tmp+1); + tmp = strchr(buf, '.'); if (tmp) { *tmp = '\0'; @@ -372,11 +379,11 @@ void Parallaction::changeLocation(char *location) { addNode(&_animations, &_yourself._zone._node); debugC(2, kDebugLocation, "changeLocation: new character added to the animation list"); - strcpy(_saveData1, _newLocation); + strcpy(_saveData1, buf); - parseLocation(_newLocation); + parseLocation(buf); _graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2); - debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _newLocation); + debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", buf); _yourself._zone.pos._oldposition._x = -1000; _yourself._zone.pos._oldposition._y = -1000; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 888f776514..956eb119b2 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -135,7 +135,7 @@ uint16 _numForwards = 0; char _soundFile[20]; char _slideText[2][40]; Point _firstPosition = { -1000, -1000 }; -char _newLocation[100]; + char *_globalTable[32]; uint16 _firstFrame = 0; byte _mouseHidden = 0; diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 2196942b0a..a07de9389b 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -114,7 +114,7 @@ extern char _soundFile[]; extern char _slideText[][40]; extern uint16 _introSarcData3; // sarcophagus stuff to be saved extern uint16 _introSarcData2; // sarcophagus stuff to be saved -extern char _newLocation[]; + extern char *_globalTable[]; extern char _saveData1[]; extern Point _firstPosition; // starting position after load game?? @@ -353,6 +353,7 @@ protected: // members void parseZoneTypeBlock(Script &script, Zone *z); void loadProgram(Animation *a, char *filename); void changeLocation(char *location); + void showSlide(const char *name); void pickMusic(const char *location); void selectCharacterMusic(const char *name); -- cgit v1.2.3