diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 9 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 20 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 16 | ||||
-rw-r--r-- | scumm/scumm.h | 7 | ||||
-rw-r--r-- | scumm/vars.cpp | 6 |
5 files changed, 34 insertions, 24 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index df71a11d7b..23f47d887e 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -371,6 +371,7 @@ protected: void o6_deleteFile(); void o6_findAllObjects(); void o6_pickVarRandom(); + void o6_getDateTime(); }; class Scumm_v7 : public Scumm_v6 @@ -434,7 +435,6 @@ protected: void o8_startVideo(); void o8_kernelSetFunctions(); void o8_kernelGetFunctions(); - void o8_getDateTime(); void o8_getActorChore(); @@ -446,13 +446,6 @@ protected: void o8_getStringWidth(); - /* V8 Scumm Vars */ - byte VAR_TIMEDATE_YEAR; - byte VAR_TIMEDATE_MONTH; - byte VAR_TIMEDATE_DAY; - byte VAR_TIMEDATE_HOUR; - byte VAR_TIMEDATE_MINUTE; - byte VAR_TIMEDATE_SECOND; }; diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index ffd2a1ba3e..8039c1515b 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -29,6 +29,7 @@ #include "intern.h" #include "sound.h" #include "verbs.h" +#include <time.h> #include "smush/player.h" #include "smush/scumm_renderer.h" @@ -303,7 +304,7 @@ void Scumm_v6::setupOpcodes() OPCODE(o6_invalid), OPCODE(o6_invalid), /* D0 */ - OPCODE(o6_invalid), + OPCODE(o6_getDateTime), OPCODE(o6_stopTalking), OPCODE(o6_getAnimateVariable), OPCODE(o6_invalid), @@ -2964,6 +2965,23 @@ void Scumm_v6::o6_pickVarRandom() { push(2); } +void Scumm_v6::o6_getDateTime() +{ + struct tm *t; + time_t now = time(NULL); + + t = localtime(&now); + + _vars[VAR_TIMEDATE_YEAR] = t->tm_year; + _vars[VAR_TIMEDATE_MONTH] = t->tm_mon; + _vars[VAR_TIMEDATE_DAY] = t->tm_mday; + _vars[VAR_TIMEDATE_HOUR] = t->tm_hour; + _vars[VAR_TIMEDATE_MINUTE] = t->tm_min; + + if (_features & GF_AFTER_V8) + _vars[VAR_TIMEDATE_SECOND] = t->tm_sec; +} + void Scumm_v6::decodeParseString(int m, int n) { byte b; diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index a34a33ee41..e116ddcbce 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -266,7 +266,7 @@ void Scumm_v8::setupOpcodes() /* B4 */ OPCODE(o6_saveRestoreVerbs), OPCODE(o6_setObjectName), - OPCODE(o8_getDateTime), + OPCODE(o6_getDateTime), OPCODE(o6_drawBox), /* B8 */ OPCODE(o6_invalid), @@ -1358,20 +1358,6 @@ void Scumm_v8::o8_system() } } -void Scumm_v8::o8_getDateTime() -{ - struct tm *t; - time_t now = time(NULL); - - t = localtime(&now); - - _vars[VAR_TIMEDATE_YEAR] = t->tm_year; - _vars[VAR_TIMEDATE_MONTH] = t->tm_mon; - _vars[VAR_TIMEDATE_DAY] = t->tm_mday; - _vars[VAR_TIMEDATE_HOUR] = t->tm_hour; - _vars[VAR_TIMEDATE_MINUTE] = t->tm_min; - _vars[VAR_TIMEDATE_SECOND] = t->tm_sec; -} void Scumm_v8::o8_startVideo() { diff --git a/scumm/scumm.h b/scumm/scumm.h index 97d956afd2..27e20cb11d 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1108,6 +1108,13 @@ public: byte VAR_CUSTOMSCALETABLE; byte VAR_VIDEONAME; byte VAR_V6_SOUNDMODE; + + byte VAR_TIMEDATE_YEAR; + byte VAR_TIMEDATE_MONTH; + byte VAR_TIMEDATE_DAY; + byte VAR_TIMEDATE_HOUR; + byte VAR_TIMEDATE_MINUTE; + byte VAR_TIMEDATE_SECOND; }; // This is a constant lookup table of reverse bit masks diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 86d18ce6bb..839f134bd0 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -109,6 +109,12 @@ void Scumm::setupScummVars() VAR_V6_EMSSPACE = 76; VAR_V6_RANDOM_NR = 118; + VAR_TIMEDATE_YEAR = 119; + VAR_TIMEDATE_MONTH = 129; + VAR_TIMEDATE_DAY = 128; + VAR_TIMEDATE_HOUR = 125; + VAR_TIMEDATE_MINUTE = 126; + VAR_V6_SOUNDMODE = 9; } |