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

@ -421,18 +421,18 @@ static const char *keyw[] =
"dynamicremap", // 285
"setinput", // 286
"getinput", // 287
"save", // 288
"save", // 288
"cansee", // 289
"canseespr", // 290
"findnearactorz", // 291
"findnearactorzvar", // 292
"findnearspritez", // 293
"findnearspritezvar", // 294
"zshootvar", // 295
"ezshootvar", // 296
"getcurraddress", // 297
"jump", // 298
"qstrlen", // 299
"zshootvar", // 295
"ezshootvar", // 296
"getcurraddress", // 297
"jump", // 298
"qstrlen", // 299
"getincangle", // 300
"quake", // 301
"showview", // 302
@ -454,9 +454,9 @@ static const char *keyw[] =
"resizearray", // 318
"writearraytofile", // 319
"readarrayfromfile", // 320
"starttrackvar", // 321
"qgetsysstr", // 322
"getticks", // 323
"starttrackvar", // 321
"qgetsysstr", // 322
"getticks", // 323
"gettspr", // 324
"settspr", // 325
"savemapstate", // 326
@ -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

@ -798,18 +798,18 @@ enum keywords
CON_DYNAMICREMAP, // 285
CON_SETINPUT, // 286
CON_GETINPUT, // 287
CON_SAVE, // 288
CON_SAVE, // 288
CON_CANSEE, // 289
CON_CANSEESPR, // 290
CON_FINDNEARACTORZ, // 291
CON_FINDNEARACTORZVAR, // 292
CON_FINDNEARSPRITEZ, // 293
CON_FINDNEARSPRITEZVAR, // 294
CON_ZSHOOTVAR, // 295
CON_EZSHOOTVAR, // 296
CON_GETCURRADDRESS, // 297
CON_JUMP, // 298
CON_QSTRLEN, // 299
CON_ZSHOOTVAR, // 295
CON_EZSHOOTVAR, // 296
CON_GETCURRADDRESS, // 297
CON_JUMP, // 298
CON_QSTRLEN, // 299
CON_GETINCANGLE, // 300
CON_QUAKE, // 301
CON_SHOWVIEW, // 302
@ -831,9 +831,9 @@ enum keywords
CON_RESIZEARRAY, // 318
CON_WRITEARRAYTOFILE, // 319
CON_READARRAYFROMFILE, // 320
CON_STARTTRACKVAR, // 321
CON_QGETSYSSTR, // 322
CON_GETTICKS, // 323
CON_STARTTRACKVAR, // 321
CON_QGETSYSSTR, // 322
CON_GETTICKS, // 323
CON_GETTSPR, // 324
CON_SETTSPR, // 325
CON_SAVEMAPSTATE, // 326
@ -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

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