30typedef struct gameLapse_s {
35#define NUM_TIMELAPSE 8
37const int DAYS_PER_MONTH[
DateTime::MONTHS_PER_YEAR] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
59 static char buffer[6];
62 Com_sprintf(buffer,
sizeof(buffer),
"%2i:%02i", hour, min);
89 dateLong->
day = d + 1;
111 cgi->Cvar_Set(
"mn_timelapse",
"%s",
_(
lapse[
ccs.gameLapse].name));
113 cgi->Cvar_SetValue(
"mn_timelapse_id",
ccs.gameLapse);
120 cgi->Cvar_Set(
"mn_maptime",
_(
"%02i:%02i"), date.
hour, date.
min);
141 return !
ccs.gameLapse;
151 if (!
ccs.campaignStats.basesBuilt)
164 if (
ccs.gameLapse > 0)
191 if (gameLapseValue ==
ccs.gameLapse)
196 if (!
ccs.campaignStats.basesBuilt)
202 ccs.gameLapse = gameLapseValue;
216 if (
cgi->Cmd_Argc() < 2) {
217 cgi->Com_Printf(
"Usage: %s <timeid>\n",
cgi->Cmd_Argv(0));
DateTime class definition.
Share stuff between the different cgame implementations.
Class describing a point of time.
static const int SECONDS_PER_DAY
int getTimeAsSeconds() const
Return the time part of the DateTime as seconds.
static const short SECONDS_PER_MINUTE
static const short MONTHS_PER_YEAR
static const short SECONDS_PER_HOUR
static const int DAYS_PER_YEAR
int getDateAsDays() const
Return the date part of the DateTime as days.
bool CP_OnGeoscape(void)
Returns if we are currently on the Geoscape.
Header file for single player campaign control.
const cgame_import_t * cgi
void CP_GameTimeFast(void)
Increase game time speed.
const char * CP_SecondConvert(int second)
Converts a number of second into a char to display.
void CP_GameTimeStop(void)
Stop game time speed.
void CP_UpdateTime(void)
Updates date/time and timescale (=timelapse) on the geoscape menu.
void CP_DateConvertLong(const DateTime &date, dateLong_t *dateLong)
Converts a date from the engine in a (longer) human-readable format.
bool CP_IsTimeStopped(void)
Check if time is stopped.
void CP_GameTimeSlow(void)
Decrease game time speed.
void CP_SetGameTime_f(void)
Set a new time game from id.
int Date_DateToSeconds(const DateTime &date)
Convert a date to seconds.
static const gameLapse_t lapse[NUM_TIMELAPSE]
The possible geoscape time intervalls.
const char * Date_GetMonthName(int month)
Returns the short monthame to the given month index.
static bool CP_AllowTimeScale(void)
static void CP_SetGameTime(int gameLapseValue)
Set game time speed.
const int DAYS_PER_MONTH[DateTime::MONTHS_PER_YEAR]
DateTime Date_Random(const DateTime &minFrame, const DateTime &maxFrame)
Return a random relative date which lies between a lower and upper limit.
Campaign geoscape time header.
float frand(void)
Return random values between 0 and 1.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
Human readable time information in the game.