Add time code for FF and minor cleanup

svn-id: r21714
This commit is contained in:
Travis Howell 2006-04-09 06:06:10 +00:00
parent 202406e31b
commit 55cc897cff
4 changed files with 29 additions and 10 deletions

View File

@ -1217,7 +1217,7 @@ static const char *const feeblefiles_opcode_name_table[256] = {
"W|CLEAR_VGAPOINTER_ENTRY",
NULL,
"|VGA_POINTER_OP_3",
NULL,
"|CENTRE_SCROLL",
/* 188 */
"BSJ|STRING2_IS",
"|CLEAR_MARKS",

View File

@ -1445,14 +1445,22 @@ void SimonEngine::o3_oracleTextUp() {
void SimonEngine::o3_ifTime() {
// 124: if time
uint time = getVarOrWord();
setScriptCondition(true);
warning("STUB: script opcode 124 (%d)", time);
time_t t;
uint a = getVarOrWord();
time(&t);
t -= _gameStoppedClock;
t -= a;
if (t >= _timeStore)
setScriptCondition(true);
else
setScriptCondition(false);
}
void SimonEngine::o3_setTime() {
// 131
warning("STUB: script opcode 131");
time(&_timeStore);
_timeStore -= _gameStoppedClock;
}
void SimonEngine::o3_loadUserGame() {
@ -1547,12 +1555,14 @@ void SimonEngine::o3_setPathValues() {
void SimonEngine::o3_stopClock() {
// 193: pause clock
warning("STUB: script opcode 193");
_clockStopped = time(NULL);
}
void SimonEngine::o3_restartClock() {
// 194: resume clock
warning("STUB: script opcode 194");
if (_clockStopped != 0)
_gameStoppedClock += time(NULL) - _clockStopped;
_clockStopped = 0;
}
void SimonEngine::o3_setColour() {

View File

@ -304,6 +304,8 @@ SimonEngine::SimonEngine(OSystem *syst)
_printCharPixelCount = 0;
_numLettersToPrint = 0;
_clockStopped = 0;
_gameStoppedClock = 0;
_lastTime = 0;
_firstTimeStruct = 0;
@ -2663,6 +2665,11 @@ void SimonEngine::timer_vga_sprites() {
scrollEvent();
}
if (getGameType() == GType_FF && getBitFlag(84)) {
// TODO
warning("Animation by Y value not supported");
}
vsp = _vgaSprites;
while (vsp->id != 0) {
@ -2904,7 +2911,7 @@ void SimonEngine::closeWindow(uint a) {
if (_windowArray[a] == NULL)
return;
removeIconArray(a);
video_copy_if_flag_0x8_c(_windowArray[a]);
resetWindow(_windowArray[a]);
_windowArray[a] = NULL;
if (_curWindow == a) {
_textWindow = NULL;
@ -3265,7 +3272,7 @@ void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte
_lockWord &= ~0x8000;
}
void SimonEngine::video_copy_if_flag_0x8_c(WindowBlock *window) {
void SimonEngine::resetWindow(WindowBlock *window) {
if (window->flags & 8)
restoreWindow(window);
window->mode = 0;

View File

@ -307,6 +307,8 @@ protected:
uint _numLettersToPrint;
uint _lastTime;
uint _clockStopped, _gameStoppedClock;
time_t _timeStore;
TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
@ -1032,7 +1034,7 @@ protected:
bool isSpriteLoaded(uint16 id, uint16 fileId);
void video_copy_if_flag_0x8_c(WindowBlock *window);
void resetWindow(WindowBlock *window);
void delete_hitarea_by_index(uint index);
void windowPutChar(uint a);