change getDateTime to be a v6 opcode, and hopefully not break anything

svn-id: r6619
This commit is contained in:
Jonathan Gray 2003-02-18 00:13:24 +00:00
parent c86cc94deb
commit d5e8f369a2
5 changed files with 34 additions and 24 deletions

View file

@ -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;