[Scummvm-cvs-logs] SF.net SVN: scummvm:[34219] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Aug 31 07:18:26 CEST 2008
Revision: 34219
http://scummvm.svn.sourceforge.net/scummvm/?rev=34219&view=rev
Author: peres001
Date: 2008-08-31 05:18:25 +0000 (Sun, 31 Aug 2008)
Log Message:
-----------
Uniformed the interface of Parallaction class (and its hierarchy) with regards of gui code, which is now independent of engine version.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/exec_ns.cpp
scummvm/trunk/engines/parallaction/gui_br.cpp
scummvm/trunk/engines/parallaction/gui_ns.cpp
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/parallaction_br.cpp
scummvm/trunk/engines/parallaction/parallaction_ns.cpp
scummvm/trunk/engines/parallaction/parser.h
scummvm/trunk/engines/parallaction/saveload.cpp
Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -318,7 +318,7 @@
}
-void Parallaction_ns::drawAnimations() {
+void Parallaction::drawAnimations() {
debugC(9, kDebugExec, "Parallaction_ns::drawAnimations()\n");
uint16 layer = 0, scale = 100;
Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -40,11 +40,11 @@
Palette blackPal;
Palette pal;
- Parallaction_br *_vm;
+ Parallaction *_vm;
int _fadeSteps;
public:
- SplashInputState_BR(Parallaction_br *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm) {
+ SplashInputState_BR(Parallaction *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm) {
}
virtual MenuInputState* run() {
@@ -150,6 +150,8 @@
static const char *_menuStrings[NUM_MENULINES];
static const MenuOptions _options[NUM_MENULINES];
+ static const char *_firstLocation[];
+
int _availItems;
int _selection;
@@ -173,7 +175,7 @@
break;
default:
- _vm->startPart(selectedItem);
+ _vm->scheduleLocationSwitch(_firstLocation[selectedItem]);
}
}
@@ -218,10 +220,12 @@
}
_vm->showSlide("tbra", x, y);
- // TODO: load progress from savefile
- int progress = 3;
- _availItems = 4 + progress;
+ _availItems = 4;
+ bool complete[3];
+ _vm->getGamePartProgress(complete, 3);
+ for (int i = 0; i < 3 && complete[i]; i++, _availItems++) ;
+
// TODO: keep track of and destroy menu item frames/surfaces
int i;
for (i = 0; i < _availItems; i++) {
@@ -236,6 +240,14 @@
};
+const char *MainMenuInputState_BR::_firstLocation[] = {
+ "intro.0",
+ "museo.1",
+ "start.2",
+ "bolscoi.3",
+ "treno.4"
+};
+
const char *MainMenuInputState_BR::_menuStrings[NUM_MENULINES] = {
"SEE INTRO",
"NEW GAME",
Modified: scummvm/trunk/engines/parallaction/gui_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_ns.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/gui_ns.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -41,10 +41,10 @@
Common::String _nextState;
uint32 _startTime;
- Parallaction_ns *_vm;
+ Parallaction *_vm;
public:
- SplashInputState_NS(Parallaction_ns *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm) {
+ SplashInputState_NS(Parallaction *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm) {
}
virtual MenuInputState* run() {
@@ -66,7 +66,7 @@
class SplashInputState0_NS : public SplashInputState_NS {
public:
- SplashInputState0_NS(Parallaction_ns *vm, MenuInputHelper *helper) : SplashInputState_NS(vm, "intro0", helper) {
+ SplashInputState0_NS(Parallaction *vm, MenuInputHelper *helper) : SplashInputState_NS(vm, "intro0", helper) {
_slideName = "intro";
_timeOut = 2000;
_nextState = "intro1";
@@ -76,7 +76,7 @@
class SplashInputState1_NS : public SplashInputState_NS {
public:
- SplashInputState1_NS(Parallaction_ns *vm, MenuInputHelper *helper) : SplashInputState_NS(vm, "intro1", helper) {
+ SplashInputState1_NS(Parallaction *vm, MenuInputHelper *helper) : SplashInputState_NS(vm, "intro1", helper) {
_slideName = "minintro";
_timeOut = 2000;
_nextState = "chooselanguage";
@@ -111,10 +111,10 @@
static const Common::Rect _amigaLanguageSelectBlocks[4];
const Common::Rect *_blocks;
- Parallaction_ns *_vm;
+ Parallaction *_vm;
public:
- ChooseLanguageInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("chooselanguage", helper), _vm(vm) {
+ ChooseLanguageInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("chooselanguage", helper), _vm(vm) {
_allowChoice = false;
_nextState = "selectgame";
@@ -203,13 +203,13 @@
uint _labels[2];
- Parallaction_ns *_vm;
+ Parallaction *_vm;
static const char *newGameMsg[4];
static const char *loadGameMsg[4];
public:
- SelectGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectgame", helper), _vm(vm) {
+ SelectGameInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("selectgame", helper), _vm(vm) {
_choice = 0;
_oldChoice = -1;
@@ -271,10 +271,10 @@
class LoadGameInputState_NS : public MenuInputState {
bool _result;
- Parallaction_ns *_vm;
+ Parallaction *_vm;
public:
- LoadGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("loadgame", helper), _vm(vm) { }
+ LoadGameInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("loadgame", helper), _vm(vm) { }
virtual MenuInputState* run() {
if (!_result) {
@@ -291,12 +291,12 @@
class NewGameInputState_NS : public MenuInputState {
- Parallaction_ns *_vm;
+ Parallaction *_vm;
static const char *introMsg3[4];
public:
- NewGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("newgame", helper), _vm(vm) {
+ NewGameInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("newgame", helper), _vm(vm) {
}
virtual MenuInputState* run() {
@@ -344,10 +344,10 @@
class StartDemoInputState_NS : public MenuInputState {
- Parallaction_ns *_vm;
+ Parallaction *_vm;
public:
- StartDemoInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("startdemo", helper), _vm(vm) {
+ StartDemoInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("startdemo", helper), _vm(vm) {
}
virtual MenuInputState* run() {
@@ -372,7 +372,7 @@
static const Common::Rect codeSelectBlocks[9];
static const Common::Rect codeTrueBlocks[9];
- Parallaction_ns *_vm;
+ Parallaction *_vm;
int guiGetSelectedBlock(const Common::Point &p) {
@@ -425,7 +425,7 @@
public:
- SelectCharacterInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectcharacter", helper), _vm(vm) {
+ SelectCharacterInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("selectcharacter", helper), _vm(vm) {
_keys = (_vm->getPlatform() == Common::kPlatformAmiga && (_vm->getFeatures() & GF_LANG_MULT)) ? _amigaKeys : _pcKeys;
_block.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
}
@@ -509,7 +509,6 @@
error("If you read this, either your CPU or transivity is broken (we believe the former).");
}
- _vm->_inTestResult = false;
_vm->cleanupGame();
_vm->scheduleLocationSwitch(_charStartLocation[character]);
}
@@ -621,7 +620,7 @@
class ShowCreditsInputState_NS : public MenuInputState {
- Parallaction_ns *_vm;
+ Parallaction *_vm;
int _current;
uint32 _startTime;
@@ -633,7 +632,7 @@
static const Credit _credits[6];
public:
- ShowCreditsInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("showcredits", helper), _vm(vm) {
+ ShowCreditsInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("showcredits", helper), _vm(vm) {
}
void drawCurrentLabel() {
@@ -686,11 +685,11 @@
};
class EndIntroInputState_NS : public MenuInputState {
- Parallaction_ns *_vm;
+ Parallaction *_vm;
bool _isDemo;
public:
- EndIntroInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endintro", helper), _vm(vm) {
+ EndIntroInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("endintro", helper), _vm(vm) {
_isDemo = (_vm->getFeatures() & GF_DEMO) != 0;
}
@@ -723,7 +722,7 @@
class EndPartInputState_NS : public MenuInputState {
- Parallaction_ns *_vm;
+ Parallaction *_vm;
bool _allPartsComplete;
// part completion messages
@@ -739,7 +738,7 @@
public:
- EndPartInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endpart", helper), _vm(vm) {
+ EndPartInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("endpart", helper), _vm(vm) {
}
virtual MenuInputState* run() {
@@ -759,7 +758,9 @@
}
virtual void enter() {
- _allPartsComplete = _vm->allPartsComplete();
+ bool completed[3];
+ _vm->getGamePartProgress(completed, 3);
+ _allPartsComplete = (completed[0] && completed[1] && completed[2]);
_vm->_input->setMouseState(MOUSE_DISABLED);
uint id[4];
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -269,9 +269,17 @@
return;
}
+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;
+ _gfx->setBackground(kBackgroundSlide, info);
+}
+
void Parallaction::freeBackground() {
_pathBuffer = 0;
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2008-08-31 05:18:25 UTC (rev 34219)
@@ -333,12 +333,16 @@
void updateDoor(ZonePtr z, bool close);
- virtual void drawAnimations() = 0;
+ void drawAnimations();
void beep();
+ void showSlide(const char *name, int x = 0, int y = 0);
ZonePtr _zoneTrap;
+ virtual void cleanupGame() = 0;
+ virtual void getGamePartProgress(bool *complete, int size) = 0;
+
public:
void highlightInventoryItem(ItemPosition pos);
int16 getHoverInventoryItem(int16 x, int16 y);
@@ -443,14 +447,13 @@
bool saveGame();
void switchBackground(const char* background, const char* mask);
- void showSlide(const char *name, int x = 0, int y = 0);
- // TODO: this should be private!!!!!!!
- bool _inTestResult;
void cleanupGame();
- bool allPartsComplete();
+ void getGamePartProgress(bool *complete, int size);
private:
+ bool _inTestResult;
+
LocationParser_ns *_locationParser;
ProgramParser_ns *_programParser;
@@ -528,7 +531,6 @@
const Callable *_callables;
protected:
- void drawAnimations();
void parseLocation(const char *filename);
void loadProgram(AnimationPtr a, const char *filename);
@@ -558,6 +560,7 @@
void setupSubtitles(char *s, char *s2, int y);
void clearSubtitles();
+ void getGamePartProgress(bool *complete, int size);
public:
Table *_countersNames;
@@ -565,7 +568,6 @@
const char **_audioCommandsNamesRes;
int _part;
- int _progress;
#if 0 // disabled since I couldn't find any references to lip sync in the scripts
int16 _lipSyncVal;
@@ -579,7 +581,6 @@
int32 _counters[32];
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
- void startPart(uint part);
private:
LocationParser_br *_locationParser;
ProgramParser_br *_programParser;
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -41,14 +41,6 @@
"PART4"
};
-const char *partFirstLocation[] = {
- "intro",
- "museo",
- "start",
- "bolscoi",
- "treno"
-};
-
int Parallaction_br::init() {
_screenWidth = 640;
@@ -112,7 +104,7 @@
while ((_engineFlags & kEngineQuit) == 0) {
if (getFeatures() & GF_DEMO) {
- startPart(1);
+ scheduleLocationSwitch("camalb.1");
_input->_inputMode = Input::kInputModeGame;
} else {
startGui(splash);
@@ -174,23 +166,6 @@
_countersNames = 0;
}
-void Parallaction_br::startPart(uint part) {
- _part = part;
- _disk->selectArchive(_partNames[_part]);
-
- initPart();
-
- if (getFeatures() & GF_DEMO) {
- strcpy(_location._name, "camalb");
- } else {
- strcpy(_location._name, partFirstLocation[_part]);
- }
-
- parseLocation("common");
- changeLocation(_location._name);
-
-}
-
void Parallaction_br::runPendingZones() {
ZonePtr z;
@@ -245,6 +220,24 @@
void Parallaction_br::changeLocation(char *location) {
+ char *partStr = strrchr(location, '.');
+ if (partStr) {
+ int n = partStr - location;
+ strncpy(_location._name, location, n);
+ _location._name[n] = '\0';
+
+ _part = atoi(++partStr);
+ if (getFeatures() & GF_DEMO) {
+ assert(_part == 1);
+ } else {
+ assert(_part >= 0 && _part <= 4);
+ }
+
+ _disk->selectArchive(_partNames[_part]);
+ initPart();
+ parseLocation("common");
+ }
+
freeLocation();
// load new location
parseLocation(location);
Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -220,16 +220,6 @@
}
-void Parallaction_ns::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;
-
- _gfx->setBackground(kBackgroundSlide, info);
-}
-
void Parallaction_ns::runPendingZones() {
if (_activeZone) {
ZonePtr z = _activeZone; // speak Zone or sound
@@ -395,6 +385,7 @@
}
void Parallaction_ns::cleanupGame() {
+ _inTestResult = false;
_engineFlags &= ~kEngineTransformedDonna;
Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/parser.h 2008-08-31 05:18:25 UTC (rev 34219)
@@ -27,6 +27,7 @@
#define PARALLACTION_PARSER_H
#include "common/stream.h"
+#include "common/stack.h"
#include "parallaction/objects.h"
#include "parallaction/walk.h"
Modified: scummvm/trunk/engines/parallaction/saveload.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/saveload.cpp 2008-08-31 00:05:09 UTC (rev 34218)
+++ scummvm/trunk/engines/parallaction/saveload.cpp 2008-08-31 05:18:25 UTC (rev 34219)
@@ -445,16 +445,29 @@
return;
}
-bool Parallaction_ns::allPartsComplete() {
+void Parallaction_ns::getGamePartProgress(bool *complete, int size) {
+ assert(complete && size >= 3);
+
char buf[30];
-
Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT);
inFile->readLine(buf, 29);
delete inFile;
- return strstr(buf, "dino") && strstr(buf, "donna") && strstr(buf, "dough");
+ complete[0] = strstr(buf, "dino");
+ complete[1] = strstr(buf, "donna");
+ complete[2] = strstr(buf, "dough");
}
+void Parallaction_br::getGamePartProgress(bool *complete, int size) {
+ assert(complete && size >= 3);
+
+ // TODO: implement progress loading
+
+ complete[0] = true;
+ complete[1] = true;
+ complete[2] = true;
+}
+
void Parallaction_ns::renameOldSavefiles() {
bool exists[NUM_SAVESLOTS];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list