Added a CON command:

getdate <sec> <min> <hour> <mday> <mon> <year> <wday> <yday>

sec		seconds after the minute
min		minutes after the hour
hour	hours since midnight
mday	day of the month
mon		months since January
year	years since 1900
wday	days since Sunday
yday	days since January


git-svn-id: https://svn.eduke32.com/eduke32@955 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hnt_ts 2008-08-09 19:59:41 +00:00
parent 01182163a9
commit 5062ab8773
4 changed files with 48 additions and 19 deletions

View file

@ -465,6 +465,7 @@ static const char *keyw[] =
"scriptsize", // 329
"definegamename", // 330
"cmenu", // 331
"getdate", // 332
"<null>"
};
@ -3862,6 +3863,10 @@ static int parsecommand(void)
}
break;
case CON_GETDATE:
transmultvarstype(GAMEVAR_FLAG_READONLY,8);
break;
case CON_MOVESPRITE:
case CON_SETSPRITE:
if (!CheckEventSync(current_event))

View file

@ -842,4 +842,5 @@ enum keywords
CON_SCRIPTSIZE, // 329
CON_DEFINEGAMENAME, // 330
CON_CMENU, // 331
CON_GETDATE, // 332
};

View file

@ -6090,6 +6090,28 @@ static int parse(void)
break;
}
case CON_GETDATE:
insptr++;
{
int v1=*insptr++,v2=*insptr++,v3=*insptr++,v4=*insptr++,v5=*insptr++,v6=*insptr++,v7=*insptr++,v8=*insptr++;
time_t rawtime;
struct tm * ti;
time(&rawtime);
ti=localtime(&rawtime);
// initprintf("Time&date: %s\n",asctime (ti));
SetGameVarID(v1, ti->tm_sec, g_i, g_p);
SetGameVarID(v2, ti->tm_min, g_i, g_p);
SetGameVarID(v3, ti->tm_hour, g_i, g_p);
SetGameVarID(v4, ti->tm_mday, g_i, g_p);
SetGameVarID(v5, ti->tm_mon, g_i, g_p);
SetGameVarID(v6, ti->tm_year+1900, g_i, g_p);
SetGameVarID(v7, ti->tm_wday, g_i, g_p);
SetGameVarID(v8, ti->tm_yday, g_i, g_p);
break;
}
case CON_MOVESPRITE:
case CON_SETSPRITE:
insptr++;

View file

@ -1888,3 +1888,4 @@ void FreeMapState(int mapnum)
Bfree(map[mapnum].savedstate);
map[mapnum].savedstate = NULL;
}