ScummVM
timer_mr.cpp
Go to the documentation of this file.
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "kyra/engine/kyra_mr.h"
24 #include "kyra/engine/timer.h"
25 
26 #include "common/system.h"
27 
28 namespace Kyra {
29 
30 #define TimerV3(x) new Common::Functor1Mem<int, void, KyraEngine_MR>(this, &KyraEngine_MR::x)
31 
33  _timer->addTimer(0, TimerV3(timerRestoreCommandLine), -1, 1);
34  for (int i = 1; i <= 3; ++i)
35  _timer->addTimer(i, TimerV3(timerRunSceneScript7), -1, 0);
36  _timer->addTimer(4, TimerV3(timerFleaDeath), -1, 0);
37  for (int i = 5; i <= 11; ++i)
38  _timer->addTimer(i, TimerV3(timerRunSceneScript7), -1, 0);
39  for (int i = 12; i <= 13; ++i)
40  _timer->addTimer(i, TimerV3(timerRunSceneScript7), 0, 0);
41 }
42 
44  if (_shownMessage)
45  _restoreCommandLine = true;
46 }
47 
52  _sceneScriptState.regs[3] = 0;
55 
56  while (_emc->isValid(&_sceneScriptState))
58 }
59 
61  _timer->setCountdown(4, 5400);
62  saveGameStateIntern(999, "Autosave", 0);
63  _screen->hideMouse();
64  _timer->disable(4);
65  runAnimationScript("FLEADTH1.EMC", 0, 0, 1, 1);
66  runAnimationScript("FLEADTH2.EMC", 0, 0, 1, 0);
68  delay(60, true);
69  const char *str1 = (const char *)getTableEntry(_cCodeFile, 130);
70  const char *str2 = (const char *)getTableEntry(_cCodeFile, 131);
71  if (str1 && str2) {
72  badConscienceChat(str1, 204, 130);
73  badConscienceChat(str2, 204, 131);
74  }
75  delay(60, true);
77  runAnimationScript("FLEADTH3.EMC", 0, 0, 0, 1);
78  _deathHandler = 9;
79  _screen->showMouse();
80 }
81 
83  if (speed < 5)
84  speed = 3;
85  else
86  speed = 5;
87 
88  _mainCharacter.walkspeed = speed;
89 }
90 
92  if (secs == -1)
93  secs = 32000;
94  _timer->setCountdown(0, secs*60);
95 }
96 
99 }
100 
101 } // End of namespace Kyra
Kyra
This is the namespace of the Kyra engine.
Definition: chargen.cpp:37
Kyra::KyraEngine_v2::_sceneScriptState
EMCState _sceneScriptState
Definition: kyra_v2.h:192
Kyra::KyraEngine_v1::_deathHandler
int8 _deathHandler
Definition: kyra_v1.h:316
Kyra::EMCInterpreter::start
bool start(EMCState *script, int function)
Definition: script.cpp:155
Kyra::KyraEngine_v1::_mouseY
int _mouseY
Definition: kyra_v1.h:276
Kyra::EMCInterpreter::init
void init(EMCState *scriptState, const EMCData *data)
Definition: script.cpp:147
Kyra::KyraEngine_MR::_nextIdleAnim
uint32 _nextIdleAnim
Definition: kyra_mr.h:177
Kyra::Screen::showMouse
void showMouse()
Definition: screen.cpp:2984
kyra_mr.h
Kyra::EMCInterpreter::run
bool run(EMCState *script)
Definition: script.cpp:181
Kyra::KyraEngine_v2::_sceneScriptData
EMCData _sceneScriptData
Definition: kyra_v2.h:191
Kyra::KyraEngine_v1::_emc
EMCInterpreter * _emc
Definition: kyra_v1.h:268
Engine::_system
OSystem * _system
Definition: engine.h:62
Kyra::KyraEngine_v2::_mainCharacter
Character _mainCharacter
Definition: kyra_v2.h:330
Kyra::KyraEngine_MR::_cCodeFile
uint8 * _cCodeFile
Definition: kyra_mr.h:269
Kyra::KyraEngine_MR::timerFleaDeath
void timerFleaDeath(int arg)
Definition: timer_mr.cpp:60
Kyra::KyraEngine_MR::_screen
Screen_MR * _screen
Definition: kyra_mr.h:82
Kyra::KyraEngine_v2::runAnimationScript
void runAnimationScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload)
Definition: sequences_v2.cpp:30
Kyra::KyraEngine_v2::_itemInHand
int _itemInHand
Definition: kyra_v2.h:299
Kyra::KyraEngine_MR::setCommandLineRestoreTimer
void setCommandLineRestoreTimer(int secs)
Definition: timer_mr.cpp:91
Kyra::TimerManager::disable
void disable(uint8 id)
Definition: timer.cpp:238
uint8
unsigned char uint8
Definition: cdtypes.h:28
Kyra::TimerManager::addTimer
void addTimer(uint8 id, TimerFunc *func, int countdown, bool enabled)
Definition: timer.cpp:90
Kyra::KyraEngine_v2::delay
void delay(uint32 time, bool update=false, bool isMainLoop=false) override
Definition: kyra_v2.cpp:149
Kyra::KyraEngine_MR::setupTimers
void setupTimers() override
Definition: timer_mr.cpp:32
Kyra::KyraEngine_MR::badConscienceChat
void badConscienceChat(const char *str, int vocHigh, int vocLow)
Definition: text_mr.cpp:367
Kyra::TimerManager::setCountdown
void setCountdown(uint8 id, int32 countdown)
Definition: timer.cpp:143
Kyra::KyraEngine_v1::_timer
TimerManager * _timer
Definition: kyra_v1.h:267
OSystem::getMillis
virtual uint32 getMillis(bool skipRecord=false)=0
Get the number of milliseconds since the program was started.
Kyra::EMCInterpreter::isValid
bool isValid(EMCState *script)
Definition: script.cpp:175
Kyra::KyraEngine_MR::_shownMessage
const char * _shownMessage
Definition: kyra_mr.h:242
Kyra::KyraEngine_MR::hideBadConscience
void hideBadConscience()
Definition: sequences_mr.cpp:91
Kyra::KyraEngine_MR::timerRestoreCommandLine
void timerRestoreCommandLine(int arg)
Definition: timer_mr.cpp:43
Kyra::KyraEngine_MR::showBadConscience
void showBadConscience()
Definition: sequences_mr.cpp:28
Kyra::KyraEngine_MR::setNextIdleAnimTimer
void setNextIdleAnimTimer()
Definition: timer_mr.cpp:97
Kyra::KyraEngine_MR::saveGameStateIntern
Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) override
Definition: saveload_mr.cpp:33
Kyra::KyraEngine_MR::timerRunSceneScript7
void timerRunSceneScript7(int arg)
Definition: timer_mr.cpp:48
system.h
Kyra::KyraEngine_v2::Character::walkspeed
byte walkspeed
Definition: kyra_v2.h:323
Kyra::KyraEngine_v1::_rnd
Common::RandomSource _rnd
Definition: kyra_v1.h:205
Kyra::EMCState::regs
int16 regs[30]
Definition: script.h:58
Kyra::KyraEngine_v1::_mouseX
int _mouseX
Definition: kyra_v1.h:276
Kyra::Screen::hideMouse
void hideMouse()
Definition: screen.cpp:2979
Kyra::KyraEngine_MR::_restoreCommandLine
bool _restoreCommandLine
Definition: kyra_mr.h:243
timer.h
Kyra::KyraEngine_MR::setWalkspeed
void setWalkspeed(uint8) override
Definition: timer_mr.cpp:82
Kyra::KyraEngine_MR::getTableEntry
uint8 * getTableEntry(uint8 *buffer, int id)
Definition: kyra_mr.cpp:1246
Common::RandomSource::getRandomNumberRng
uint getRandomNumberRng(uint min, uint max)
Generates a random unsigned integer in the interval [min, max].
Definition: random.cpp:58