28 #include "../shared/ufotypes.h" 29 #include "../shared/byte.h" 30 #include "../shared/shared.h" 31 #include "../shared/mathlib.h" 32 #include "../shared/defines.h" 36 #define UFO_VERSION "2.6-dev" 37 #define GAME_TITLE "UFO:AI" 38 #define GAME_TITLE_LONG "UFO:Alien Invasion" 41 # define BUILDSTRING_OS "Win32" 46 #elif defined __linux__ 47 # define BUILDSTRING_OS "Linux" 52 #elif defined(__FreeBSD__) 53 # define BUILDSTRING_OS "FreeBSD" 58 #elif defined(__OpenBSD__) 59 # define BUILDSTRING_OS "OpenBSD" 64 #elif defined(__NetBSD__) 65 # define BUILDSTRING_OS "NetBSD" 71 # define BUILDSTRING_OS "Solaris" 76 #elif defined (__APPLE__) || defined (MACOSX) 77 # define BUILDSTRING_OS "MacOSX" 79 # define SO_EXT "dylib" 83 # define BUILDSTRING_OS "Android" 89 # define BUILDSTRING_OS "Unknown" 92 #if defined __alpha__ || defined __alpha || defined _M_ALPHA 93 # define CPUSTRING "Alpha" 94 #elif defined __amd64__ || defined __amd64 || defined __x86_64__ || defined __x86_64 || defined _M_X64 95 # define CPUSTRING "AMD64" 96 #elif defined __arm__ || defined __thumb__ || defined _ARM 97 # define CPUSTRING "ARM" 98 #elif defined i386 || defined __i386__ || defined __i386 || defined _M_IX86 || defined __X86__ || defined _X86_ || defined __THW_INTEL__ || defined __I86__ || defined __INTEL__ 99 # define CPUSTRING "IA-32" 100 #elif defined __ia64__ || defined _IA64 || defined __IA64__ || defined __ia64 || defined _M_IA64 101 # define CPUSTRING "IA-64" 102 #elif defined __mips__ || defined mips || defined __mips || defined __MIPS__ 103 # define CPUSTRING "MIPS" 104 #elif defined __powerpc || defined __powerpc__ || defined __POWERPC__ || defined __ppc__ || defined _M_PPC || defined _ARCH_PPC 105 # define CPUSTRING "PowerPC" 106 #elif defined __sparc__ || defined __sparc 107 # define CPUSTRING "SPARC" 109 # define CPUSTRING "Unknown" 113 # define BUILDSTRING_VARIANT "DEBUG" 115 # define BUILDSTRING_VARIANT "RELEASE" 119 # define BUILDSTRING BUILDSTRING_OS " " BUILDSTRING_VARIANT " build " UFO_REVISION 121 # define BUILDSTRING BUILDSTRING_OS " " BUILDSTRING_VARIANT 124 #define MASTER_SERVER "http://ufoai.org/" 134 #define PROTOCOL_VERSION 18 136 #define PORT_CLIENT 27901 137 #define PORT_SERVER 27910 159 #define MAX_SVC_STUFFTEXT 1024 160 #define MAX_SVC_PRINT 1024 161 #define MAX_SVC_RECONNECT 256 162 #define MAX_SVC_DISCONNECT 256 163 #define MAX_CLC_STRINGCMD 512 185 #define SOUND_ATTN_NONE 0.0f 186 #define SOUND_ATTN_NORM 1.0f 187 #define SOUND_ATTN_IDLE 1.2f 188 #define SOUND_ATTN_STATIC 3.0f 189 #define SOUND_ATTN_MAX SOUND_ATTN_STATIC 191 #include "../ports/system.h" 207 #define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535) 208 #define SHORT2ANGLE(x) ((x)*(360.0/65536)) 214 #define Q_COLOR_ESCAPE '^' 215 #define Q_IsColorString(p) ((p) && *(p) == Q_COLOR_ESCAPE && *((p) + 1) && isalnum(*((p) + 1))) 217 #define S_COLOR_BLACK "^0" 218 #define S_COLOR_RED "^1" 219 #define S_COLOR_GREEN "^2" 220 #define S_COLOR_YELLOW "^3" 221 #define S_COLOR_BLUE "^4" 222 #define S_COLOR_CYAN "^5" 223 #define S_COLOR_MAGENTA "^6" 224 #define S_COLOR_WHITE "^7" 226 #define CON_COLOR_BLACK 0 227 #define CON_COLOR_RED 1 228 #define CON_COLOR_GREEN 2 229 #define CON_COLOR_YELLOW 3 230 #define CON_COLOR_BLUE 4 231 #define CON_COLOR_CYAN 5 232 #define CON_COLOR_MAGENTA 6 233 #define CON_COLOR_WHITE 7 283 #define MAXCMDLINE 256 353 void SV_Shutdown(
const char* finalmsg,
bool reconnect);
384 #define REMOVE_ELEM(array, index, n) \ 386 size_t idx__ = (index); \ 387 size_t n__ = --(n); \ 388 assert(idx__ <= n__); \ 389 memmove((array) + idx__, (array) + idx__ + 1, (n__ - idx__) * sizeof(*(array))); \ 390 OBJZERO((array)[n__]); \ 395 #define REMOVE_ELEM_ADJUST_IDX(array, index, n) \ 397 size_t idx__ = (index); \ 400 REMOVE_ELEM(array, index, n); \ 402 for (i__ = idx__; i__ < n__; ++i__) \ 403 --(array)[i__].idx; \ 406 #define HASH_Add(hash, elem, index) \ 408 const int hashIndex = (index); \ 409 assert(hashIndex >= 0); \ 410 assert(hashIndex < lengthof(hash)); \ 411 (elem)->hash_next = (hash)[hashIndex]; \ 412 (hash)[hashIndex] = (elem); \ 415 #define HASH_Delete(anchor) (*(anchor) = (*(anchor))->hash_next) int CL_Milliseconds(void)
memPool_t * com_fileSysPool
void event_clean_func(void *data)
mapTiles_t * SV_GetMapTiles(void)
Memory handling with sentinel checking and pools with tags for grouped free'ing.
QGL_EXTERN GLint GLenum type
Common model code header (for bsp and others)
void Con_Print(const char *txt)
Handles cursor positioning, line wrapping, etc All console printing must go through this in order to ...
ScheduleEventPtr Schedule_Event(int when, event_func *func, event_check_func *check, event_clean_func *clean, void *data)
Schedules an event to run on or after the given time, and when its check function returns true...
memPool_t * com_cmodelSysPool
void SV_ShutdownWhenEmpty(void)
Will eventually shutdown the server once all clients have disconnected.
bool CL_ParseClientData(const char *type, const char *name, const char **text)
Called at client startup.
void event_notify_delay_func(int now, void *data, int delay)
void event_func(int now, void *data)
int Com_ServerState(void)
Check whether we are the server or have a singleplayer tactical mission.
QGL_EXTERN GLsizei const GLvoid * data
Command text buffering and command execution header.
void Cvar_WriteVariables(qFILE *f)
appends lines containing "set variable value" for all variables with the archive flag set to true...
const char * Com_ByteToBinary(byte x)
memPool_t * com_cvarSysPool
void CL_Drop(void)
Ensures the right menu cvars are set after error drop or map change.
vPrintfPtr_t Qcommon_GetPrintFunction(void)
svc_ops_e
server to client the svc_strings[] array in cl_parse.c should mirror this
memPool_t * com_networkPool
void Qcommon_Frame(void)
This is the function that is called directly from main()
void(* vPrintfPtr_t)(const char *fmt, va_list ap)
void(* exceptionCallback_t)(void)
bool Com_ConsoleCompleteCommand(const char *s, char *target, size_t bufSize, uint32_t *pos, uint32_t offset)
Console completion for command and variables.
const char * Com_MD5File(const char *fn, int length=0)
Compute the md5sum of a given file.
Header for script parsing functions.
mapData_t * SV_GetMapData(void)
int CL_FilterEventQueue(event_filter *filter)
Filters every event in the queue using the given function. Keeps all events for which the function re...
const char * Com_MD5Buffer(const byte *buf, size_t len)
Compute the md5sum of the given buffer.
void Com_ClearArgv(int arg)
Reset com_argv entry to empty string.
void Com_UploadCrashDump(const char *crashDumpFile)
const char * Com_UnsignedIntToBinary(uint32_t x)
void Qcommon_Init(int argc, char **argv)
Init function.
const char * Com_Argv(int arg)
Returns an argument of script commandline.
memPool_t * com_cmdSysPool
memPool_t * com_genericPool
QGL_EXTERN GLuint GLsizei GLsizei * length
void Com_EndRedirect(void)
End the redirection of packets/output.
void SV_Clear(void)
Cleanup when the whole game process is shutting down.
void SCR_BeginLoadingPlaque(void)
void Com_SetRandomSeed(unsigned int seed)
bool Com_CheckConfigStringIndex(int index)
void CL_Shutdown(void)
Saves configuration file and shuts the client systems down.
Cvar (console variable) header file.
int Com_Argc(void)
Returns the script commandline argument count.
comRestart_t(const char *_gamedir)
void SV_Init(void)
Only called once at startup, not for each game.
void Qcommon_Shutdown(void)
event_notify_delay_func * notifyDelay
memPool_t * com_aliasSysPool
void Com_SetGameType(void)
const char * Com_MacroExpandString(const char *text)
Expands strings with cvar values that are dereferenced by a '*cvar'.
QGL_EXTERN void(APIENTRY *qglActiveTexture)(GLenum texture)
void Com_BreakIntoDebugger(void)
void Com_vPrintf(const char *fmt, va_list)
float Com_GrenadeTarget(const vec3_t from, const vec3_t at, float speed, bool launched, bool rolled, vec3_t v0)
Calculates parabola-type shot.
void CL_Frame(int now, void *data)
void Com_WriteConfigToFile(const char *filename)
void SCR_EndLoadingPlaque(void)
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void Com_Drop(void) __attribute__((noreturn))
void Qcommon_SetPrintFunction(vPrintfPtr_t func)
clc_ops_e
client to server
void * notifyDelayUserData
bool event_filter(int when, event_func *func, event_check_func *check, void *data)
void CL_InitAfter(void)
Init function for clients - called after menu was initialized and ufo-scripts were parsed...
cvar_t * masterserver_url
void CL_SlowFrame(int now, void *data)
void Com_BeginRedirect(struct net_stream *stream, char *buffer, int buffersize)
Redirect packets/output from server to client.
SharedPtr< scheduleEvent_t > ScheduleEventPtr
event_delay_func * delay
Called when the check failed and we have to delay events in the queue.
QGL_EXTERN GLuint GLsizei bufSize
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
bool event_check_func(int now, void *data)
void Com_ReadFromPipe(void)
Read whatever is in com_pipefile, if anything, and execute it.
void Com_SetServerState(int state)
void SV_Frame(int now, void *)
void SV_Shutdown(const char *finalmsg, bool reconnect)
Called when each game quits, before Sys_Quit or Sys_Error.
bool event_delay_func(int now, void *data)