103 Com_Printf(
"Unknown command \"%s\" - wasn't sent to server\n", cmd);
109 msg.
add(cmd, strlen(cmd));
128 }
else if (argc == 2) {
129 const char* env = SDL_getenv(
Cmd_Argv(1));
191 cls.netStream =
nullptr;
204 assert(!
cls.netStream);
206 if (
cls.servername[0] !=
'\0') {
207 assert(
cls.serverport[0] !=
'\0');
220 if (
cls.servername[0] !=
'\0') {
221 assert(
cls.serverport[0]);
224 Com_Printf(
"Could not connect to localhost\n");
274 cls.netStream =
nullptr;
290#ifdef ACTIVATE_PACKET_COMMAND
298static void CL_Packet_f (
void)
313 const int l = strlen(in);
317 for (
int i = 0;
i < l;
i++) {
318 if (in[
i] ==
'\\' && in[
i + 1] ==
'n') {
356 if (
cls.downloadServer[0])
357 Com_Printf(
"HTTP downloading enabled, URL: %s\n",
cls.downloadServer);
361 Com_Printf(
"Dup connect received. Ignored.\n");
375 Com_Printf(
"Command packet from remote host. Ignored.\n");
406 UI_Popup(
_(
"Connection failure"),
_(
"The password you specified was wrong."));
409 UI_Popup(
_(
"Connection failure"),
_(
"This server requires a password."));
413 UI_Popup(
_(
"Connection failure"),
_(
"This server is full."));
416 UI_Popup(
_(
"Connection failure"),
_(
"You are banned on this server."));
419 UI_Popup(
_(
"Connection failure"),
_(
"The game has already started."));
422 UI_Popup(
_(
"Connection failure"),
_(
"The server is running a different version of the game."));
424 Cvar_Set(
"rcon_password",
"%s",
"");
425 UI_Popup(
_(
"Bad rcon password"),
_(
"The rcon password you specified was wrong."));
428 UI_Popup(
_(
"Connection failure"),
_(
"The server refused the connection."));
436 Com_Printf(
"Unknown command received \"%s\"\n", c);
502 bool startedDownload =
false;
509 return startedDownload;
512 if (token[0] ==
'-') {
526 return startedDownload;
531 bool startedDownload;
536 if (!startedDownload) {
542 return startedDownload;
562 UI_Popup(
_(
"Error"),
_(
"Script files are not the same"));
570 if (
cls.downloadMaps) {
573 cls.downloadMaps =
false;
581 Com_Printf(
"You are using modified ufo script files - might produce problems\n");
587 UI_Popup(
_(
"Error"),
_(
"Local map version differs from server"));
605 Com_Printf(
"CL_RequestNextDownload: Not connected (%i)\n",
cls.state);
641 cls.downloadMaps =
true;
650 float requestedRation = atof(
Cmd_Argv(1));
653 const float delta = 0.01;
665 requestedRation = atof(
Cmd_Argv(1));
670 bool visible =
false;
671 const int result = sscanf(
OPTIONEXTRADATA(option).label,
"%i x %i", &width, &height);
673 Com_Error(
ERR_FATAL,
"CL_SetRatioFilter_f: Impossible to decode resolution label.\n");
674 const float ratio = (float)width / (
float)height;
680 visible = ratio > 2 || (ratio > 1.7 && ratio < 1.76);
682 visible = ratio - delta < requestedRation && ratio + delta > requestedRation;
684 option->
invis = !visible;
685 option = option->
next;
707 Com_Error(
ERR_DROP,
"CL_ParseActorSkin: First actorskin read from script must be \"default\" skin.");
721 const char* map1 = ((
const mapDef_t*)mapDef1)->mapTheme;
722 const char* map2 = ((
const mapDef_t*)mapDef2)->mapTheme;
725 if (map1[0] ==
'+' || map1[0] ==
'.')
727 if (map2[0] ==
'+' || map2[0] ==
'.')
772#ifndef COMPILE_UNITTESTS
773 static int progressCurrent = 0;
776 if (progressCurrent % 10 == 0)
819 const char* configString;
828 if (configString[0] ==
'\0')
830 Com_Printf(
"configstring[%3i]: %s\n",
i, configString);
873 cl_map_debug =
Cvar_Get(
"debug_map",
"0", 0,
"Activate realtime map debugging options - bitmask. Valid values are 0, 1, 3 and 7");
885#ifdef ACTIVATE_PACKET_COMMAND
887 Cmd_AddCommand(
"packet", CL_Packet_f,
"Dangerous debug function for network testing");
904 Cmd_AddCommand(
"players",
nullptr,
"List of team and player name");
906 Cmd_AddCommand(
"debug_cgrid", Grid_DumpWholeClientMap_f,
"Shows the whole client side pathfinding grid of the current loaded map");
907 Cmd_AddCommand(
"debug_croute", Grid_DumpClientRoutes_f,
"Shows the whole client side pathfinding grid of the current loaded map");
908 Cmd_AddCommand(
"debug_listle", LE_List_f,
"Shows a list of current know local entities with type and status");
909 Cmd_AddCommand(
"debug_listlm", LM_List_f,
"Shows a list of current know local models");
911 Cmd_AddCommand(
"debug_edictdestroy",
nullptr,
"Call the 'destroy' function of a given edict");
912 Cmd_AddCommand(
"debug_edictuse",
nullptr,
"Call the 'use' function of a given edict");
913 Cmd_AddCommand(
"debug_edicttouch",
nullptr,
"Call the 'touch' function of a given edict");
916 Cmd_AddCommand(
"debug_listscore",
nullptr,
"Shows mission-score entries of all team members");
917 Cmd_AddCommand(
"debug_statechange",
nullptr,
"Change the state of an edict");
952 dbuffer msg(strlen(userInfo) + 2);
980 cls.servername[0] =
'\0';
981 cls.serverport[0] =
'\0';
993 if (
cls.waitingForStart) {
995 Com_Error(
ERR_DROP,
"Server aborted connection - the server didn't response in %is. You can try to increase the cvar cl_connecttimeout",
1020 switch (
cls.state) {
1025 cls.waitingForStart = 0;
1028 cls.reconnectTime = 0;
1032 cls.waitingForStart = 0;
1049 static int lastFrame = 0;
1056 delta = now - lastFrame;
1058 cls.frametime = delta / 1000.0;
1067 cls.framerate = 1000.0 / delta;
1156 setlocale(LC_ALL,
"C");
1160 setlocale(LC_MESSAGES,
"");
1168 Com_sprintf(languagePath,
sizeof(languagePath), LOCALEDIR);
1209 return cls.realtime;
1222 printf(
"recursive shutdown\n");
const char * Sys_GetCurrentUser(void)
void ACTOR_InitStartup(void)
void CL_ActorTargetAlign_f(void)
Targets to the ground when holding the assigned button.
char * CL_GetConfigString(int index)
int CL_GetConfigStringInteger(int index)
bool CL_OnBattlescape(void)
Check whether we are in a tactical mission as server or as client. But this only means that we are ab...
void CL_CameraMove(void)
Update the camera position. This can be done in two different reasons. The first is the user input,...
Header file for cinematics.
void Con_SaveConsoleHistory(void)
Stores the console history.
void GAME_InitStartup(void)
void GAME_StartMatch(void)
void GAME_Frame(void)
Called every frame and allows us to hook into the current running game mode.
void GAME_UnloadGame(void)
void GAME_InitMissionBriefing(const char *title)
void GAME_SpawnSoldiers(void)
Called during startup of mission to send team info.
bool GAME_IsMultiplayer(void)
void GAME_ParseModes(const char *name, const char **text)
void GAME_EndBattlescape(void)
This is called when a client quits the battlescape.
bool GAME_HandleServerCommand(const char *command, dbuffer *msg)
void GAME_SetMode(const cgame_export_t *gametype)
Shared game type headers.
cgame team management headers.
bool CL_CheckOrDownloadFile(const char *filename)
bool CL_PendingHTTPDownloads(void)
See if we're still busy with some downloads. Called by precacher just before it loads the map since w...
void CL_RunHTTPDownloads(void)
This calls curl_multi_perform do actually do stuff. Called every frame while connecting to minimise l...
void CL_HTTP_Cleanup(void)
UFO is exiting or we're changing servers. Clean up.
void CL_SetHTTPServer(const char *URL)
A new server is specified, so we nuke all our state.
void HTTP_InitStartup(void)
void HUD_InitStartup(void)
void HUD_Update(void)
Updates console vars for an actor.
void INV_InitStartup(void)
Header file for inventory handling and Equipment menu.
void Irc_Logic_Frame(void)
IRC client header for UFO:AI.
void Key_WriteBindings(const char *filename)
Writes lines containing "bind key value".
bool CL_LanguageTryToSet(const char *localeID)
Cycle through all parsed locale mappings and try to set one after another.
void CL_LanguageShutdown(void)
void CL_LanguageInit(void)
Fills the options language menu node with the parsed language mappings.
void CL_ParseLanguages(const char *name, const char **text)
Parse all language definitions from the script files.
static cvar_t * fs_i18ndir
void LE_Cleanup(void)
Cleanup unused LE inventories that the server sent to the client also free some unused LE memory.
void LE_Think(void)
Calls the le think function and updates the animation. The animation updated even if the particular l...
void CL_InitLua(void)
Initializes the ui-lua interfacing environment.
void CL_ShutdownLua(void)
Shutdown the ui-lua interfacing environment.
static void CL_ConnectionlessPacket(dbuffer *msg)
Responses to broadcasts, etc.
static void CL_SpawnSoldiers_f(void)
Send the clc_teaminfo command to server.
memPool_t * vid_genericPool
int CL_GetClientState(void)
void CL_RequestNextDownload(void)
static int Com_MapDefSort(const void *mapDef1, const void *mapDef2)
static void CL_SendChangedUserinfos(void)
Send the userinfo to the server (and to all other clients) when they changed (CVAR_USERINFO).
static void CL_ReadPackets(void)
bool CL_ParseClientData(const char *type, const char *name, const char **text)
Called at client startup.
static void CL_StartMatch_f(void)
static void CL_UserInfo_f(void)
Prints the current userinfo string to the game console.
static void CL_RContextCvarChange(const char *cvarName, const char *oldValue, const char *newValue, void *data)
static void CL_ShowConfigstrings_f(void)
Print the configstrings to game console.
memPool_t * vid_imagePool
static void CL_SetRatioFilter_f(void)
static void CL_FreeClientStream(void)
static void CL_OpenURL_f(void)
Opens the specified URL and minimizes the game window. You have to specify the whole url including th...
static bool CL_DownloadMap(const char *map)
void CL_Drop(void)
Ensures the right menu cvars are set after error drop or map change.
static void CL_Connect(void)
static cvar_t * cl_connecttimeout
static void CL_Precache_f(void)
The server will send this command right before allowing the client into the server.
void CL_SetClientState(connstate_t state)
Sets the client state.
static void CL_InitMemPools(void)
static void CL_SendCommand(void)
static void CL_RImagesCvarChange(const char *cvarName, const char *oldValue, const char *newValue, void *data)
static void CL_Reconnect(void)
static void CL_InitLocal(void)
Calls all reset functions for all subsystems like production and research also initializes the cvars ...
static void CL_ForwardToServer_f(void)
static void CL_ClearState(void)
Called after tactical missions to wipe away the tactical-mission-only data.
static const value_t actorskin_vals[]
valid actorskin descriptors
memPool_t * vid_modelPool
static void CL_Quit_f(void)
void CL_SlowFrame(int now, void *data)
void CL_Disconnect(void)
Sets the cls.state to ca_disconnected and informs the server.
void Cmd_ForwardToServer(void)
adds the current command line as a clc_stringcmd to the client message. things like action,...
memPool_t * cl_genericPool
void CL_Frame(int now, void *data)
static bool CL_DownloadUMPMap(const char *tiles)
static bool CL_CanMultiplayerStart(void)
static void CL_ParseActorSkin(const char *name, const char **text)
void CL_Shutdown(void)
Saves configuration file and shuts the client systems down.
static void CL_Env_f(void)
Set or print some environment variables via console command.
memPool_t * vid_lightPool
void CL_InitAfter(void)
Init function for clients - called after menu was initialized and ufo-scripts were parsed.
int CL_Milliseconds(void)
void CL_ParseServerMessage(svc_ops_t cmd, dbuffer *msg)
Parses the server sent data from the given buffer.
void PTL_InitStartup(void)
Clears particle data.
void CL_ParseParticle(const char *name, const char **text)
Parses particle definitions from UFO-script files.
void CL_ParticleRun(void)
General system for particle running during the game.
void CL_BattlescapeRadarInit(void)
Battlescape radar header.
void SCR_DrawLoading(int percent)
Draws the current loading pic of the map from base/pics/maps/loading.
void SCR_DrawLoadingScreen(bool string, int percent)
Precache and loading screen at startup.
void SCR_EndLoadingPlaque(void)
void SCR_UpdateScreen(void)
This is called every frame, and can also be called explicitly to flush text to the screen.
void SCR_RunConsole(void)
Scroll it up or down.
void SCR_BeginLoadingPlaque(void)
Header for certain screen operations.
void CL_ParseSequence(const char *name, const char **text)
Reads the sequence values from given text-pointer.
void TEAM_InitStartup(void)
unsigned int CL_GetActorSkinCount(void)
Get number of registered actorskins.
actorSkin_t * CL_AllocateActorSkin(const char *name)
Allocate a skin from the cls structure.
void TOTD_InitStartup(void)
Init function for cvars and console command bindings.
void CL_ParseTipOfTheDay(const char *name, const char **text)
Parse all tip definitions from the script files.
void TUT_InitStartup(void)
void TUT_ParseTutorials(const char *name, const char **text)
void CL_ViewLoadMedia(void)
Call before entering a new level, or after vid_restart.
void CL_ViewCalcFieldOfViewX(void)
Calculates refdef's FOV_X. Should generally be called after any changes are made to the zoom level (v...
void CL_ViewPrecacheModels(void)
Precaches all models at game startup - for faster access.
void add(const char *, size_t)
Primary header for client.
const char * Cmd_Argv(int arg)
Returns a given argument.
void Cbuf_Execute(void)
Pulls off terminated lines of text from the command buffer and sends them through Cmd_ExecuteString...
void Cmd_TokenizeString(const char *text, bool macroExpand, bool replaceWhitespaces)
Parses the given string into command line tokens.
const char * Cmd_Args(void)
Returns a single string containing argv(1) to argv(argc()-1).
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void Cbuf_AddText(const char *format,...)
Adds command text at the end of the buffer.
void CM_LoadMap(const char *tiles, bool day, const char *pos, const char *entityString, mapData_t *mapData, mapTiles_t *mapTiles)
Loads in the map and all submodels.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
int Com_ServerState(void)
Check whether we are the server or have a singleplayer tactical mission.
void Com_Error(int code, const char *fmt,...)
void Com_Printf(const char *const fmt,...)
cvar_t * masterserver_url
mapData_t * SV_GetMapData(void)
mapTiles_t * SV_GetMapTiles(void)
cvarChangeListener_t * Cvar_RegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Registers a listener that is executed each time a cvar changed its value.
const char * Cvar_Userinfo(char *info, size_t infoSize)
Returns an info string containing all the CVAR_USERINFO cvars.
void Cvar_UnRegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Unregisters a cvar change listener.
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
bool Com_IsUserinfoModified(void)
cvar_t * Cvar_GetFirst(void)
Return the first cvar of the cvar list.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
const char * Cvar_GetString(const char *varName)
Returns the value of cvar as string.
void Cvar_FixCheatVars(void)
Reset cheat cvar values to default.
void Com_SetUserinfoModified(bool modified)
#define MAX_STRING_TOKENS
cvar_t * cl_log_battlescape_events
int CL_ClearBattlescapeEvents(void)
void CL_ServerEventsInit(void)
Events that are send from the client to the server.
const char * FS_GetCwd(void)
Return current working dir.
void Info_Print(const char *s)
Prints info strings (like userinfo or serverinfo - CVAR_USERINFO, CVAR_SERVERINFO).
#define Mem_CreatePool(name)
bool NET_StreamIsLoopback(struct net_stream *s)
dbuffer * NET_ReadMsg(struct net_stream *s)
Reads messages from the network channel and adds them to the dbuffer where you can use the NET_Read* ...
struct net_stream * NET_ConnectToLoopBack(stream_onclose_func *onclose)
struct net_stream * NET_Connect(const char *node, const char *service, stream_onclose_func *onclose)
Try to connect to a given host on a given port.
void NET_StreamFinished(struct net_stream *s)
Call NET_StreamFinished to mark the stream as uninteresting, but to finish sending any data in the bu...
void NET_Wait(int timeout)
int NET_ReadString(dbuffer *buf, char *string, size_t length)
int NET_ReadStringLine(dbuffer *buf, char *string, size_t length)
void NET_WriteMsg(struct net_stream *s, dbuffer &buf)
Enqueue the buffer in the net stream for ONE client.
int NET_ReadByte(dbuffer *buf)
Reads a byte from the netchannel.
void NET_WriteByte(dbuffer *buf, byte c)
void NET_OOB_Printf(struct net_stream *s, const char *format,...)
Out of band print.
void NET_WriteString(dbuffer *buf, const char *str)
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
Shared parsing functions.
#define CL_CMD_CLIENT_CONNECT
#define REJ_CONNECTION_REFUSED
#define BAD_RCON_PASSWORD
#define NET_STATE_DISCONNECT
#define MAX_CONFIGSTRINGS
#define REJ_SERVER_VERSION_MISMATCH
#define REJ_GAME_ALREADY_STARTED
#define REJ_PASSWORD_REQUIRED_OR_INCORRECT
Reject messages that are send to the client from the game module.
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN GLsizei const GLvoid * data
QGL_EXTERN GLint GLenum type
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void R_FreeWorldImages(void)
Any image that is a mesh or world texture will be removed here.
void R_ShutdownModels(bool complete)
Frees the model pool.
Particle system header file.
void S_LoadSamples(void)
Wrapper for S_PrecacheSamples to avoid exposing it via s_sample.h.
void S_Stop(void)
Stop all channels.
void M_ParseMusic(const char *name, const char **text)
Parses music definitions for different situations.
bool Com_ParseBlock(const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool)
int Com_GetScriptChecksum(void)
#define MEMBER_SIZEOF(TYPE, MEMBER)
#define Q_strvalid(string)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
int Q_StringSort(const void *string1, const void *string2)
Compare two strings.
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
Not cleared on a map change (static data).
This is the structure that should be used for data that is needed for tactical missions only.
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
Atomic structure used to define most of the UI.
void Sys_OpenURL(const char *url)
void Sys_SetAffinityAndPriority(void)
int Sys_Milliseconds(void)
int Sys_Setenv(const char *name, const char *value)
set/unset environment variables (empty value removes it)
void UI_RegisterOption(int dataId, uiNode_t *option)
uiNode_t * UI_GetOption(int dataId)
@ OPTION_VIDEO_RESOLUTIONS
void UI_DisplayNotice(const char *text, int time, const char *windowName)
Displays a message over all windows.
bool UI_ParseFont(const char *name, const char **text)
bool UI_ParseAndLoadLuaScript(const char *name, const char **text)
Parses and loads a .ufo file holding a lua script.
Basic lua initialization for the ui.
void UI_Shutdown(void)
Reset and free the UI data hunk.
#define OPTIONEXTRADATA(node)
bool UI_ParseWindow(const char *type, const char *name, const char **text)
Parse a window.
bool UI_ParseSprite(const char *name, const char **text)
bool UI_ParseUIModel(const char *name, const char **text)
parses the models.ufo and all files where UI models (menu_model) are defined
bool UI_ParseComponent(const char *type, const char *name, const char **text)
Parse a component.
uiNode_t * UI_PushWindow(const char *name, const char *parentName, linkedList_t *params)
Push a window onto the window stack.
void WEB_InitStartup(void)
UFOAI web interface management. Authentication as well as uploading/downloading stuff to and from you...