ADL: Separate game-specific state init
This commit is contained in:
parent
8cc5100afd
commit
5fe95d51ea
10 changed files with 25 additions and 14 deletions
|
@ -379,6 +379,12 @@ void AdlEngine::setupOpcodeTables() {
|
|||
Opcode(o1_setRoomPic);
|
||||
}
|
||||
|
||||
void AdlEngine::initState() {
|
||||
_state = State();
|
||||
|
||||
initGameState();
|
||||
}
|
||||
|
||||
byte AdlEngine::roomArg(byte room) const {
|
||||
return room;
|
||||
}
|
||||
|
|
|
@ -240,6 +240,7 @@ protected:
|
|||
virtual bool isInputValid(const Commands &commands, byte verb, byte noun, bool &is_any);
|
||||
|
||||
virtual void setupOpcodeTables();
|
||||
virtual void initState();
|
||||
virtual byte roomArg(byte room) const;
|
||||
virtual void advanceClock() { }
|
||||
|
||||
|
@ -358,7 +359,7 @@ protected:
|
|||
private:
|
||||
virtual void runIntro() const { }
|
||||
virtual void init() = 0;
|
||||
virtual void initState() = 0;
|
||||
virtual void initGameState() = 0;
|
||||
virtual void drawItems() = 0;
|
||||
virtual void drawItem(Item &item, const Common::Point &pos) = 0;
|
||||
virtual void loadRoom(byte roomNr) = 0;
|
||||
|
|
|
@ -114,6 +114,16 @@ void AdlEngine_v2::setupOpcodeTables() {
|
|||
Opcode(o2_initDisk);
|
||||
}
|
||||
|
||||
void AdlEngine_v2::initState() {
|
||||
AdlEngine::initState();
|
||||
|
||||
_linesPrinted = 0;
|
||||
_picOnScreen = 0;
|
||||
_roomOnScreen = 0;
|
||||
_itemRemoved = false;
|
||||
_itemsOnScreen = 0;
|
||||
}
|
||||
|
||||
byte AdlEngine_v2::roomArg(byte room) const {
|
||||
if (room == IDI_CUR_ROOM)
|
||||
return _state.room;
|
||||
|
|
|
@ -43,6 +43,7 @@ protected:
|
|||
|
||||
// AdlEngine
|
||||
virtual void setupOpcodeTables();
|
||||
virtual void initState();
|
||||
byte roomArg(byte room) const;
|
||||
void advanceClock();
|
||||
virtual void printString(const Common::String &str);
|
||||
|
|
|
@ -206,8 +206,7 @@ void HiRes1Engine::init() {
|
|||
loadWords(*stream, _nouns, _priNouns);
|
||||
}
|
||||
|
||||
void HiRes1Engine::initState() {
|
||||
_state = State();
|
||||
void HiRes1Engine::initGameState() {
|
||||
_state.vars.resize(IDI_HR1_NUM_VARS);
|
||||
|
||||
StreamPtr stream(_files->createReadStream(IDS_HR1_EXE_1));
|
||||
|
|
|
@ -103,7 +103,7 @@ private:
|
|||
// AdlEngine
|
||||
void runIntro() const;
|
||||
void init();
|
||||
void initState();
|
||||
void initGameState();
|
||||
void restartGame();
|
||||
void printString(const Common::String &str);
|
||||
Common::String loadMessage(uint idx) const;
|
||||
|
|
|
@ -130,10 +130,7 @@ void HiRes2Engine::init() {
|
|||
loadWords(*stream, _nouns, _priNouns);
|
||||
}
|
||||
|
||||
void HiRes2Engine::initState() {
|
||||
_linesPrinted = 0;
|
||||
|
||||
_state = State();
|
||||
void HiRes2Engine::initGameState() {
|
||||
_state.vars.resize(IDI_HR2_NUM_VARS);
|
||||
|
||||
StreamPtr stream(_disk->createReadStream(0x21, 0x5, 0x0e, 7));
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
// AdlEngine
|
||||
void runIntro() const;
|
||||
void init();
|
||||
void initState();
|
||||
void initGameState();
|
||||
};
|
||||
|
||||
} // End of namespace Adl
|
||||
|
|
|
@ -192,10 +192,7 @@ void HiRes6Engine::init() {
|
|||
delete boot;
|
||||
}
|
||||
|
||||
void HiRes6Engine::initState() {
|
||||
_linesPrinted = 0;
|
||||
|
||||
_state = State();
|
||||
void HiRes6Engine::initGameState() {
|
||||
_state.vars.resize(IDI_HR6_NUM_VARS);
|
||||
|
||||
StreamPtr stream(_disk->createReadStream(0x20, 0xd, 0x94, 2));
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
// AdlEngine
|
||||
void runIntro() const;
|
||||
void init();
|
||||
void initState();
|
||||
void initGameState();
|
||||
|
||||
// AdlEngine_v2
|
||||
void printString(const Common::String &str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue