Campaign geoscape time code. More...
#include "../cl_shared.h"
#include "cp_campaign.h"
#include "cp_time.h"
Go to the source code of this file.
Data Structures | |
struct | gameLapse_s |
Defines | |
#define | NUM_TIMELAPSE 8 |
Typedefs | |
typedef struct gameLapse_s | gameLapse_t |
Functions | |
CASSERT (lengthof(lapse)==NUM_TIMELAPSE) | |
void | CL_UpdateTime (void) |
Updates date/time and timescale (=timelapse) on the geoscape menu. | |
void | CL_GameTimeStop (void) |
Stop game time speed. | |
qboolean | CL_IsTimeStopped (void) |
Check if time is stopped. | |
static qboolean | CL_AllowTimeScale (void) |
void | CL_GameTimeSlow (void) |
Decrease game time speed. | |
void | CL_GameTimeFast (void) |
Increase game time speed. | |
static void | CL_SetGameTime (int gameLapseValue) |
Set game time speed. | |
void | CL_SetGameTime_f (void) |
Set a new time game from id. | |
qboolean | Date_LaterThan (date_t now, date_t compare) |
Check wheter given date and time is later than current date. | |
date_t | Date_Add (date_t a, date_t b) |
Add two dates and return the result. | |
date_t | Date_Random (date_t minFrame, date_t maxFrame) |
Return a random relative date which lies between a lower and upper limit. | |
const char * | Date_GetMonthName (int month) |
Returns the monatname to the given month index. | |
Variables | |
static const gameLapse_t | lapse [NUM_TIMELAPSE] |
The possible geoscape time intervalls. |
Campaign geoscape time code.
Definition in file cp_time.c.
#define NUM_TIMELAPSE 8 |
Definition at line 36 of file cp_time.c.
Referenced by CL_GameTimeFast(), CL_SetGameTime(), and CL_UpdateTime().
typedef struct gameLapse_s gameLapse_t |
CASSERT | ( | lengthof(lapse) | = =NUM_TIMELAPSE |
) |
static qboolean CL_AllowTimeScale | ( | void | ) | [static] |
Time scaling is only allowed when you are on the geoscape and when you had at least one base built.
Definition at line 101 of file cp_time.c.
References stats_s::basesBuilt, ccs_s::campaignStats, ccs, CP_OnGeoscape(), and qfalse.
Referenced by CL_GameTimeFast(), and CL_GameTimeSlow().
void CL_GameTimeFast | ( | void | ) |
Increase game time speed.
Definition at line 128 of file cp_time.c.
References ccs, CL_AllowTimeScale(), CL_UpdateTime(), ccs_s::gameLapse, and NUM_TIMELAPSE.
void CL_GameTimeSlow | ( | void | ) |
Decrease game time speed.
Definition at line 114 of file cp_time.c.
References ccs, CL_AllowTimeScale(), CL_UpdateTime(), and ccs_s::gameLapse.
void CL_GameTimeStop | ( | void | ) |
Stop game time speed.
Definition at line 80 of file cp_time.c.
References ccs, CL_UpdateTime(), cp_missiontest, CP_OnGeoscape(), ccs_s::gameLapse, and cvar_s::integer.
Referenced by AIR_Move(), B_UpdateAllBaseBuildingStatus(), CL_DisplayHomebasePopup(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CP_BaseAttackMissionDestroyBase(), CP_BaseAttackStartMission(), CP_CampaignInit(), CP_MissionAddToGeoscape(), CP_NationHandleBudget(), CP_PopupList(), MAP_MapClick(), and MSO_CheckAddNewMessage().
qboolean CL_IsTimeStopped | ( | void | ) |
Check if time is stopped.
Definition at line 93 of file cp_time.c.
References ccs, and ccs_s::gameLapse.
Referenced by CL_CampaignRun().
static void CL_SetGameTime | ( | int | gameLapseValue | ) | [static] |
Set game time speed.
[in] | gameLapseValue | The value to set the game time to. |
Definition at line 143 of file cp_time.c.
References stats_s::basesBuilt, ccs_s::campaignStats, ccs, CL_UpdateTime(), ccs_s::gameLapse, and NUM_TIMELAPSE.
Referenced by CL_SetGameTime_f().
void CL_SetGameTime_f | ( | void | ) |
Set a new time game from id.
Definition at line 168 of file cp_time.c.
References CL_SetGameTime(), Cmd_Argc(), Cmd_Argv(), and Com_Printf().
void CL_UpdateTime | ( | void | ) |
Updates date/time and timescale (=timelapse) on the geoscape menu.
Definition at line 56 of file cp_time.c.
References _, ccs, CL_DateConvertLong(), Com_sprintf(), cp_messageBuffer, Cvar_Set(), Cvar_SetValue(), ccs_s::date, Date_GetMonthName(), dateLong_s::day, ccs_s::gameLapse, ccs_s::gameTimeScale, dateLong_s::hour, dateLong_s::min, dateLong_s::month, gameLapse_s::name, NUM_TIMELAPSE, gameLapse_s::scale, and dateLong_s::year.
Referenced by CL_CampaignRun(), CL_GameTimeFast(), CL_GameTimeSlow(), CL_GameTimeStop(), CL_SetGameTime(), CP_CampaignInit(), and SAV_GameActionsAfterLoad().
Add two dates and return the result.
[in] | a | First date. |
[in] | b | Second date. |
Definition at line 200 of file cp_time.c.
References date_s::day, date_s::sec, and SECONDS_PER_DAY.
Referenced by CP_BuildBaseSetUpBase(), CP_BuildBaseSubvertGovernment(), CP_CreateNewMission(), CP_HarvestMissionStart(), CP_InterceptAircraftMissionSet(), CP_InterceptAttackInstallation(), CP_InterceptNextStage(), CP_ReconMissionAerial(), CP_ReconMissionGround(), CP_SpawnCrashSiteMission(), CP_SpawnRescueMission(), CP_SupplySetStayAtBase(), CP_TerrorMissionStart(), and CP_XVIMissionStart().
const char* Date_GetMonthName | ( | int | month | ) |
Returns the monatname to the given month index.
[in] | month | The month index - [0-11] |
Definition at line 229 of file cp_time.c.
References _.
Referenced by CL_EventAddMail_f(), CL_UpdateTime(), MS_TimestampedText(), SAV_GameSave(), UP_OpenMail_f(), and UP_SetMailHeader().
Check wheter given date and time is later than current date.
[in] | now | Current date. |
[in] | compare | Date to compare. |
Definition at line 183 of file cp_time.c.
References date_s::day, qfalse, qtrue, and date_s::sec.
Referenced by CP_CheckMissionEnd().
Return a random relative date which lies between a lower and upper limit.
[in] | minFrame | Minimal date. |
[in] | maxFrame | Maximal date. |
Definition at line 214 of file cp_time.c.
References date_s::day, frand(), date_s::sec, and SECONDS_PER_DAY.
Referenced by CP_BuildBaseSetUpBase(), CP_BuildBaseSubvertGovernment(), CP_CreateNewMission(), CP_HarvestMissionStart(), CP_InterceptAircraftMissionSet(), CP_InterceptAttackInstallation(), CP_ReconMissionAerial(), CP_ReconMissionGround(), CP_SpawnCrashSiteMission(), CP_SpawnRescueMission(), CP_SupplySetStayAtBase(), CP_TerrorMissionStart(), and CP_XVIMissionStart().
const gameLapse_t lapse[NUM_TIMELAPSE] [static] |
{ {N_("stopped"), 0}, {N_("5 sec"), 5}, {N_("5 mins"), 5 * 60}, {N_("20 mins"), SECONDS_PER_HOUR / 3}, {N_("1 hour"), SECONDS_PER_HOUR}, {N_("12 hours"), 12 * SECONDS_PER_HOUR}, {N_("1 day"), 24 * SECONDS_PER_HOUR}, {N_("5 days"), 5 * SECONDS_PER_DAY} }
The possible geoscape time intervalls.