aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v6.cpp
diff options
context:
space:
mode:
authorJonathan Gray2003-02-18 00:13:24 +0000
committerJonathan Gray2003-02-18 00:13:24 +0000
commitd5e8f369a21e02d2390c05c9f4eba2854392fdae (patch)
treeb4d7101d7c7f206b713a3a7771900e11d0244ef1 /scumm/script_v6.cpp
parentc86cc94deb0e072f007c475f259c58ca42bb2c23 (diff)
downloadscummvm-rg350-d5e8f369a21e02d2390c05c9f4eba2854392fdae.tar.gz
scummvm-rg350-d5e8f369a21e02d2390c05c9f4eba2854392fdae.tar.bz2
scummvm-rg350-d5e8f369a21e02d2390c05c9f4eba2854392fdae.zip
change getDateTime to be a v6 opcode, and hopefully not break anything
svn-id: r6619
Diffstat (limited to 'scumm/script_v6.cpp')
-rw-r--r--scumm/script_v6.cpp20
1 files changed, 19 insertions, 1 deletions
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;