27 #include "../client.h" 28 #include "../cl_language.h" 30 #include "../battlescape/cl_localentity.h" 31 #include "../battlescape/cl_hud.h" 32 #include "../battlescape/cl_parse.h" 33 #include "../ui/ui_main.h" 34 #include "../ui/ui_draw.h" 35 #include "../ui/ui_nodes.h" 36 #include "../ui/ui_popup.h" 37 #include "../ui/ui_render.h" 38 #include "../ui/ui_windows.h" 39 #include "../ui/ui_sprite.h" 40 #include "../ui/ui_font.h" 41 #include "../ui/ui_tooltip.h" 42 #include "../ui/node/ui_node_container.h" 43 #include "../ui/node/ui_node_messagelist.h" 44 #include "../ui/node/ui_node_model.h" 45 #include "../cl_team.h" 46 #include "../web/web_cgame.h" 47 #include "../battlescape/events/e_main.h" 48 #include "../cl_inventory.h" 49 #include "../../shared/parse.h" 50 #include "../../common/filesys.h" 51 #include "../renderer/r_draw.h" 52 #include "../renderer/r_framebuffer.h" 53 #include "../renderer/r_geoscape.h" 59 #define MAX_CGAMETYPES 16 94 for (GameCvars::const_iterator
i = copy.begin();
i != copy.end(); ++
i) {
95 const struct cvar_s* cvar = *
i;
96 if (cvar->flags == 0) {
99 cvar->name, list ? list->
name :
"none");
121 _cmds.insert(cmdName);
127 _cmds.erase(cmdName);
133 for (GameCmds::const_iterator
i = copy.begin();
i != copy.end(); ++
i) {
134 const char* cmdName = *
i;
137 cmdName, list ? list->
name :
"none");
149 #ifdef HARD_LINKED_CGAME 155 GetCGameMultiplayerAPI,
160 static const char* cgameMenu;
166 if (cgameMenu ==
nullptr)
169 for (
int i = 0;
i <
len;
i++) {
214 for (
int i = 0;
i <
size;
i++) {
235 if (cgame ==
nullptr)
264 const char* ugvId = strstr(chr->
teamDef->
id,
"ugv");
273 UI_ExecuteConfunc(
"team_memberadd %i \"%s\" \"%s\" \"%s\" %i", memberIndex, chr->name, chr->path, chr->head, chr->headSkin);
286 for (
int i = 0;
i < teamMembers;
i++)
293 if (list !=
nullptr) {
302 if (list !=
nullptr) {
304 return isMultiplayer;
329 if (list !=
nullptr && list->EndRoundAnnounce)
330 list->EndRoundAnnounce(playerNum, team);
364 if (!list || list->HandleServerCommand ==
nullptr)
367 return list->HandleServerCommand(command, msg);
376 if (!list || list->AddChatMessage ==
nullptr)
385 list->AddChatMessage(
string);
508 for ( ;
i;
i =
i->getNext()) {
509 collectItem(
data,
i->def(), 1);
510 if (
i->isReloadable() &&
i->getAmmoLeft() > 0)
511 collectAmmo(
data,
i);
521 collectItem(
data, item->
def(), 1);
581 static const char*
Com_EParse_ (
const char** text,
const char* errhead,
const char* errinfo)
591 if (
cgi ==
nullptr) {
902 #ifndef HARD_LINKED_CGAME 934 if (list && list->MapDraw)
941 if (list && list->MapDrawMarkers)
942 list->MapDrawMarkers(node);
948 if (list && list->MapClick)
949 list->MapClick(node, x, y, pos);
1009 Com_Printf(
"GAME_ParseModes: cgame def \"%s\" with same name found, second ignored\n",
name);
1014 Sys_Error(
"GAME_ParseModes: MAX_CGAMETYPES exceeded");
1025 #ifndef HARD_LINKED_CGAME 1033 Com_sprintf(fullPath,
sizeof(fullPath),
"%s/cgame-%s.%s", path,
name, SO_EXT);
1050 const char*
name = t->
id;
1051 #ifndef HARD_LINKED_CGAME 1055 Com_Printf(
"------- Loading cgame-%s.%s -------\n",
name, SO_EXT);
1062 const char* path =
nullptr;
1083 Sys_Error(
"Could not find the equipDef '%s' in the cgame mode: '%s'", equipID,
name);
1092 #ifdef HARD_LINKED_CGAME 1103 const char* modeName;
1109 if (modeName[0] ==
'\0')
1124 Com_Printf(
"GAME_SetMode_f: Mode '%s' not found\n", modeName);
1140 if (list && list->IsItemUseable)
1141 return list->IsItemUseable(od);
1162 list->Results(msg, winner, numSpawned, numAlive, numKilled, numStunned, nextmap);
1177 assert(item->
def());
1193 if (
INVDEF(container)->temp)
1282 if (teamDefID[0] ==
'\0')
1283 teamDefID =
"phalanx";
1326 if (list !=
nullptr && list->StartBattlescape) {
1327 list->StartBattlescape(isTeamPlay);
1348 if (list !=
nullptr && list->InitMissionBriefing)
1349 list->InitMissionBriefing(&title, &victoryConditionsMsgIDs, &missionBriefingMsgIDs);
1353 LIST_AddString(&victoryConditionsMsgIDs,
"*msgid:victory_condition_default");
1357 LIST_AddString(&missionBriefingMsgIDs,
"*msgid:mission_briefing_default");
1372 for (
int i = 0;
i <
size;
i++) {
1378 if (list && list->InitializeBattlescape) {
1379 list->InitializeBattlescape(&msg, team);
1407 if (list && list->Spawn)
1458 if (list && list->NotifyEvent)
1459 list->NotifyEvent(eventType);
1469 if (list && list->IsTeamKnown !=
nullptr)
1470 return list->IsTeamKnown(teamDef);
1477 if (list && list->UpdateCharacterValues !=
nullptr)
1478 list->UpdateCharacterValues(chr);
1494 if (list && list->Drop) {
1526 if (list && list->RunFrame !=
nullptr)
1534 if (list && list->DrawBaseLayout !=
nullptr)
1535 list->DrawBaseLayout(baseIdx, x, y, totalMarge, w, h, padding, bgcolor, color);
1547 if (list && list->DrawBaseLayoutTooltip !=
nullptr)
1548 list->DrawBaseLayoutTooltip(baseIdx, x, y);
1562 if (model !=
nullptr) {
1563 if (uiModel !=
nullptr)
1569 if (uiModel !=
nullptr)
1587 if (ucn == chrTmp->ucn) {
1607 if (list && list->GetChrMaxLoad !=
nullptr)
1608 return std::min(strength, list->GetChrMaxLoad(chr));
1622 Com_Error(
ERR_DROP,
"Could not find the equipment definition for '%s'", equipID);
1625 switch (changeType) {
1642 if (entry ==
nullptr) {
1643 equipID = (
const char*)equipmentList->
data;
1644 }
else if (changeType ==
FORWARD) {
1645 equipID = (
const char*)(entry->
next !=
nullptr ? entry->
next->
data : equipmentList->
data);
1646 }
else if (changeType ==
BACKWARD) {
1647 const char* newEntry =
nullptr;
1648 const char* prevEntry =
nullptr;
1651 if (prevEntry !=
nullptr) {
1652 newEntry = prevEntry;
1663 Com_Error(
ERR_DROP,
"Could not find the equipment definition for '%s'", equipID);
1674 Com_Printf(
"----------- game modes -------------\n");
static void UI_PushWindow_(const char *name)
void Cmd_UnRegisterCmdListener(CmdListenerPtr listener)
Unregisters a command listener.
equipDef_t * GAME_GetEquipmentDefinition(void)
bool Com_ParseBlock(const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool)
uiSprite_t *IMPORT * UI_GetSpriteByName(const char *name)
const objDef_t * def(void) const
const char * Cmd_Argv(int arg)
Returns a given argument.
void GAME_GenerateTeam(const char *teamDefID, const equipDef_t *ed, int teamMembers)
static void * GAME_AllocInventoryMemory(size_t size)
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void GAME_AddChatMessage(const char *format,...)
xmlNode_t * XML_GetPos2(xmlNode_t *parent, const char *name, vec2_t pos)
retrieve the first Pos2 data from an XML Node
void CL_UpdateCharacterValues(const character_t *chr)
const char * formatString
The format string that is used to write and parse this event.
static SharedPtr< GAMECvarListener > cvarListener(new GAMECvarListener())
short XML_GetShort(xmlNode_t *parent, const char *name, const short defaultval)
retrieve a Short attribute from an XML Node
const char * FS_NextFileFromFileList(const char *files)
Returns the next file that is found in the virtual filesystem identified by the given file pattern...
uiNode_t *IMPORT * UI_OptionIteratorNextOption(uiOptionIterator_t *iterator)
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap)
Safe (null terminating) vsnprintf implementation.
void R_SoftenTexture(byte *in, int width, int height, int bpp)
Applies blurring to a texture.
bool Com_UnregisterConstVariable(const char *name)
Removes a registered constant from the script mapping hash table.
void Sys_Error(const char *error,...)
short Com_GetDropShipIdsNum(void)
void NET_SockaddrToStrings(struct datagram_socket *s, struct sockaddr *addr, char *node, size_t nodelen, char *service, size_t servicelen)
Convert sockaddr to string.
bool Com_GetConstIntFromNamespace(const char *space, const char *variable, int *value)
Searches whether a given value was registered as a string to int mapping.
bool GAME_SaveCharacter(xmlNode_t *p, const character_t *chr)
saves a character to a given xml node
int FS_CheckFile(const char *fmt,...)
Just returns the filelength and -1 if the file wasn't found.
itemFilterTypes_t INV_GetFilterTypeID(const char *filterTypeID)
Searches for a filter type name (as used in console functions) and returns the matching itemFilterTyp...
void Cmd_RemoveCommand(const char *cmdName)
Removes a command from script interface.
const char * Com_GetRandomMapAssemblyNameForCrashedCraft(const char *craftID)
uiNode_t *IMPORT * UI_PopupList(const char *title, const char *headline, linkedList_t *entries, const char *clickAction)
const objDef_t * INVSH_GetItemByID(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
void R_DrawImage(float x, float y, const image_t *image)
Draws an image or parts of it.
bool INV_ItemMatchesFilter(const objDef_t *obj, const itemFilterTypes_t filterType)
Checks if the given object/item matched the given filter type.
void LIST_PrependString(linkedList_t **listDest, const char *data)
Adds a string as first entry to a linked list.
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.
xmlNode_t *IMPORT * XML_Parse(const char *buffer)
void UI_RegisterLinkedListText(int dataId, linkedList_t *text)
share a linked list of text with a data id
void XML_AddStringValue(xmlNode_t *parent, const char *name, const char *value)
add a non-empty String attribute to the XML Node
static void GAME_WebDelete(int category, const char *filename)
void UI_MessageAddStack(struct uiMessageListNodeMessage_s *message)
int GetUsedSlots()
Calculate the number of used inventory slots.
int FS_OpenFile(const char *filename, qFILE *file, filemode_t mode)
Finds and opens the file in the search path.
void UI_RegisterText(int dataId, const char *text)
share a text with a data id
void R_DrawLineStrip(int points, int *verts)
2 dimensional line strip
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 UI_SortOptions(uiNode_t **first)
Sort options by alphabet.
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
void MAP_InitCallbacks(void)
Registers UI Callbacks for battlescape map selection.
void GAME_SpawnSoldiers(void)
Called during startup of mission to send team info.
float XML_GetFloat(xmlNode_t *parent, const char *name, const float defaultval)
retrieve a Float attribute from an XML Node
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...
struct datagram_socket * NET_DatagramSocketNew(const char *node, const char *service, datagram_callback_func *func)
Opens a datagram socket (UDP)
void LIST_AddStringSorted(linkedList_t **listDest, const char *data)
void * LIST_GetByIdx(linkedList_t *list, int index)
Get an entry of a linked list by its index in the list.
static void GAME_DestroyInventory(Inventory *const inv)
uiNode_t * UI_GetNodeByPath(const char *path)
Return a node by a path name (names with dot separation) It is a simplification facade over UI_ReadNo...
struct net_stream *IMPORT * NET_Connect(const char *node, const char *service, stream_onclose_func *onclose)
void XML_AddDoubleValue(xmlNode_t *parent, const char *name, double value)
add a non-zero Double attribute to the XML Node
void GAME_TeamDelete_f(void)
Removes a user created team.
int treatmentLevel[BODYPART_MAXTYPE]
static int GAME_GetNextUniqueCharacterNumber(void)
const char * GAME_GetAbsoluteSavePath(char *buf, size_t bufSize)
char * CL_GetConfigString(int index)
int XML_GetInt(xmlNode_t *parent, const char *name, const int defaultval)
retrieve an Int attribute from an XML Node
double XML_GetDouble(xmlNode_t *parent, const char *name, const double defaultval)
retrieve a Double attribute from an XML Node
const char *IMPORT * UI_GetFontFromNode(const uiNode_t *const node)
static void GAME_FreeAllInventory(void)
void * _Mem_Alloc(size_t size, bool zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine)
static void R_DrawImageCentered(int x, int y, const char *name)
void SV_ShutdownWhenEmpty(void)
Will eventually shutdown the server once all clients have disconnected.
const ugv_t *IMPORT * Com_GetUGVByID(const char *ugvID)
const char *IMPORT * GetAbsoluteSavePath(char *buf, size_t bufSize)
void GAME_ReloadMode(void)
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const char * UI_GetActiveWindowName(void)
Returns the name of the current window.
void onAdd(const char *cmdName)
const char *IMPORT * Com_GetRandomMapAssemblyNameForCraft(const char *craftID)
cvar_t *IMPORT * Cvar_Get(const char *varName, const char *value, int flags, const char *desc)
void UI_DrawModelNode(uiNode_t *node, const char *source)
#define Mem_PoolAlloc(size, pool, tagNum)
bool GAME_HandleServerCommand(const char *command, dbuffer *msg)
void XML_AddDate(xmlNode_t *parent, const char *name, const int day, const int sec)
add a date data to the XML Tree
const struct cgame_export_s * gametype
linkedList_t * equipmentList
const char *IMPORT * Com_UFOCrashedTypeToShortName(ufoType_t type)
const mapDef_t *IMPORT * GAME_GetCurrentSelectedMap(void)
void Cbuf_AddText(const char *format,...)
Adds command text at the end of the buffer.
void UI_UpdateInvisOptions(uiNode_t *option, const linkedList_t *stringList)
Unhide those options that are stored in the linked list and hide the others.
Describes a character with all its attributes.
void NET_WriteString(dbuffer *buf, const char *str)
void GAME_ParseModes(const char *name, const char **text)
void XML_AddPos3(xmlNode_t *parent, const char *name, const vec3_t pos)
add a Pos3 data to the XML Tree
Shared game type headers.
void GAME_SetServerInfo(const char *server, const char *serverport)
const char *IMPORT * CL_ActorGetSkillString(const int skill)
void GAME_StartBattlescape(bool isTeamPlay)
Called when the server sends the EV_START event.
static char * GAME_PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
cvar_t *IMPORT * Cvar_ForceSet(const char *varName, const char *value)
void FS_RemoveFile(const char *osPath)
void XML_AddFloatValue(xmlNode_t *parent, const char *name, float value)
add a non-zero Float attribute to the XML Node
void Cvar_UnRegisterCvarListener(CvarListenerPtr listener)
Unregisters a cvar listener.
const char *IMPORT * Com_GetRandomMapAssemblyNameForCrashedCraft(const char *craftID)
const char * CL_ActorGetSkillString(const int skill)
Return the skill string for the given skill level.
const BodyData * bodyTemplate
QGL_EXTERN GLsizei const GLvoid * data
int FS_LoadFile(const char *path, byte **buffer)
Filenames are relative to the quake search path.
void NET_StreamFree(struct net_stream *s)
Call NET_StreamFree to dump the whole thing right now.
struct net_stream * netStream
le_t * teamList[MAX_ACTIVETEAM]
void UI_ContainerNodeUpdateEquipment(Inventory *inv, const equipDef_t *ed)
Fills the ground container of the ui_inventory with unused items from a given equipment definition...
static const char * Com_EParse_(const char **text, const char *errhead, const char *errinfo)
int NET_ReadLong(dbuffer *buf)
static void GAME_SendCurrentTeamSpawningInfo(dbuffer *buf, linkedList_t *team)
Stores a team-list (chr-list) info to buffer (which might be a network buffer, too).
void Com_Printf(const char *const fmt,...)
uiNode_t * UI_GetOption(int dataId)
void GAME_AppendTeamMember(int memberIndex, const char *teamDefID, const equipDef_t *ed)
bool Cmd_GenericCompleteFunction(char const *candidate, char const *partial, char const **match)
const char *IMPORT * Cvar_GetString(const char *varName)
const char *IMPORT * Cmd_Argv(int n)
const teamDef_t * teamDef
const char * Com_DropShipTypeToShortName(humanAircraftType_t type)
Translate DropShip type to short name.
const objDef_t * ammoDef(void) const
linkedList_t *IMPORT * LIST_Add(linkedList_t **list, void const *data, size_t length)
int FS_BuildFileList(const char *fileList)
Build a filelist.
int GAME_GetCurrentTeam(void)
inventory definition for our menus
equipDef_t *EXPORT * GetEquipmentDefinition(void)
int stuns[KILLED_NUM_TYPES]
void LIST_Delete(linkedList_t **list)
void Com_RegisterConstList(const constListEntry_t constList[])
Registers a list of string aliases.
static bool GAME_LoadGame(const char *path, const char *name)
void GAME_TeamSlotComments_f(void)
Reads the comments from team files.
const equipDef_t * INV_GetEquipmentDefinitionByID(const char *name)
Gets equipment definition by id.
void(* http_callback_t)(const char *response, void *userdata)
cvar_t * masterserver_url
void UI_InitStack(const char *activeWindow, const char *mainWindow)
Init the stack to start with a window, and have an alternative window with ESC.
bool LE_IsActor(const le_t *le)
Checks whether the given le is a living actor.
const char * Com_GetRandomMapAssemblyNameForCraft(const char *craftID)
Returns the name of an aircraft or an ufo that is used in the ump files for the random map assembly...
Model that have more than one part (top and down part of an aircraft)
void GAME_UnloadGame(void)
const teamDef_t * Com_GetTeamDefinitionByID(const char *team)
Returns the teamDef pointer for the searched team id - or nullptr if not found in the teamDef array...
int GAME_GetChrMaxLoad(const character_t *chr)
Returns the max weight the given character can carry.
void GAME_AutoTeam_f(void)
void GAME_NotifyEvent(event_t eventType)
xmlNode_t * XML_GetPos3(xmlNode_t *parent, const char *name, vec3_t pos)
retrieve the first Pos3 data from an XML Node
void Cmd_TableRemoveList(const cmdList_t *cmdList)
void CL_Drop(void)
Ensures the right menu cvars are set after error drop or map change.
static void UI_DrawNormImageByName_(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char *name)
xmlNode_t * XML_GetNextPos3(xmlNode_t *actual, xmlNode_t *parent, const char *name, vec3_t pos)
retrieve the next Pos3 data from an XML Node
const ugv_t * Com_GetUGVByIDSilent(const char *ugvID)
Searches an UGV definition by a given script id and returns the pointer to the global data...
bool GAME_LoadCharacter(xmlNode_t *p, character_t *chr)
Loads a character from a given xml node.
int LIST_Count(const linkedList_t *list)
int Cvar_GetInteger(const char *varName)
Returns the int value of a cvar.
static void GAME_EquipActor(character_t *const chr, const equipDef_t *ed, const objDef_t *weapon, int maxWeight)
void XML_AddPos2(xmlNode_t *parent, const char *name, const vec2_t pos)
add a Pos2 data to the XML Tree
memPool_t * cl_genericPool
void onDelete(const struct cvar_s *cvar)
#define Q_strvalid(string)
const char * XML_GetString(xmlNode_t *parent, const char *name)
retrieve a String attribute from an XML Node
void R_Color(const vec4_t rgba)
Change the color to given value.
void * NET_StreamGetData(struct net_stream *s)
bool BEP_Evaluate(const char *expr, BEPEvaluteCallback_t varFuncParam, const void *userdata)
static bool GAME_Spawn(linkedList_t **chrList)
char *IMPORT * PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
void Com_Error(int code, const char *fmt,...)
byte r_xviAlpha[XVI_WIDTH *XVI_HEIGHT]
Atomic structure used to define most of the UI.
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
void *IMPORT * Alloc(size_t size, bool zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine)
void Cmd_ExecuteString(const char *text,...)
A complete command line has been parsed, so try to execute it.
static void GAME_CollectAliens(void *data, void(*collect)(void *, const teamDef_t *, int, bool))
Collecting stunned and dead alien bodies after the mission.
xmlNode_t * XML_AddNode(xmlNode_t *parent, const char *name)
add a new node to the XML tree
static void GAME_Exit_f(void)
Quits the current running game by calling the shutdown callback.
void R_Draw3DMapMarkers(const vec2_t nodePos, const vec2_t nodeSize, const vec3_t rotate, const vec2_t pos, float direction, float earthRadius, const char *model, int skin)
Draw 3D Marker on the 3D geoscape.
void R_Draw2DMapMarkers(const vec2_t screenPos, float direction, const char *model, int skin)
Draw 3D Marker on the 2D geoscape.
uiNode_t * UI_OptionIteratorNextOption(uiOptionIterator_t *iterator)
Find the next element from the iterator Iterator skipCollapsed and skipInvisible attribute can contro...
const char * FS_Gamedir(void)
Called to find where to write a file (savegames, etc)
static int UI_DrawString_(const char *fontID, align_t align, int x, int y, const char *c)
void GAME_EndBattlescape(void)
This is called when a client quits the battlescape.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
struct uiMessageListNodeMessage_s *IMPORT * UI_MessageGetStack(void)
struct uiMessageListNodeMessage_s * UI_MessageGetStack(void)
void NET_OOB_Printf(struct net_stream *s, const char *format,...)
Out of band print.
Inventory ** ui_inventory
character_t *EXPORT * GetSelectedChr(void)
bool LIST_Remove(linkedList_t **list, const void *data)
void GAME_DrawMapMarkers(uiNode_t *node)
void XML_AddInt(xmlNode_t *parent, const char *name, int value)
add an Int attribute to the XML Node
int experience[SKILL_NUM_TYPES+1]
const char * GAME_GetModelForItem(const objDef_t *od, uiModel_t **uiModel)
Get a model for an item.
const objDef_t * onlyWeapon
void XML_AddString(xmlNode_t *parent, const char *name, const char *value)
add a String attribute to the XML Node
align_t
We need this here for checking the boundaries from script values.
uiNode_t * UI_PushWindow(const char *name, const char *parentName, linkedList_t *params)
Push a window onto the window stack.
static bool GAME_RemoveFromInventory(Inventory *const i, const invDef_t *container, Item *fItem)
byte r_radarPic[RADAR_WIDTH *RADAR_HEIGHT]
void GAME_ActorSelect_f(void)
xmlNode_t *IMPORT * XML_GetPos3(xmlNode_t *parent, const char *name, vec3_t pos)
void XML_AddFloat(xmlNode_t *parent, const char *name, float value)
add a Float attribute to the XML Node
static void GAME_Free(void *ptr)
const image_t * UI_DrawNormImageByName(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char *name)
Draws an image or parts of it.
void UI_ResetData(int dataId)
Reset a shared data. Type became NONE and value became nullptr.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
int NET_ReadString(dbuffer *buf, char *string, size_t length)
static void GAME_WebListForUser(int category, int userId)
void *IMPORT * LIST_GetByIdx(linkedList_t *list, int index)
void LIST_AddString(linkedList_t **listDest, const char *data)
Adds an string to a new or to an already existing linked list. The string is copied here...
void GAME_SwitchCurrentSelectedMap(int step)
geoscapeData_t geoscapeData
xmlNode_t *IMPORT * XML_GetPos2(xmlNode_t *parent, const char *name, vec2_t pos)
float Cvar_GetValue(const char *varName)
Returns the float value of a cvar.
mapDef_t * Com_GetMapDefByIDX(int index)
static void GAME_CollectItems(void *data, int won, void(*collectItem)(void *, const objDef_t *, int), void(*collectAmmo)(void *, const Item *), void(*ownitems)(const Inventory *))
bool removeFromInventory(Inventory *const inv, const invDef_t *container, Item *fItem) __attribute__((warn_unused_result))
void GAME_SetMode(const cgame_export_t *gametype)
xmlNode_t *IMPORT * XML_GetDate(xmlNode_t *parent, const char *name, int *day, int *sec)
void XML_AddBool(xmlNode_t *parent, const char *name, bool value)
add a Boolean attribute to the XML Node
void GAME_InitMissionBriefing(const char *title)
void XML_AddLong(xmlNode_t *parent, const char *name, long value)
add a Long attribute to the XML Node
equipDef_t eds[MAX_EQUIPDEFS]
static void GAME_WebDownloadFromUser(int category, const char *filename, int userId)
static character_t characters[MAX_ACTIVETEAM]
static character array that can be used by a game mode to store the needed character values...
void LIST_Sort(linkedList_t **list, linkedListSort_t sorter, const void *userData)
void Cvar_RegisterCvarListener(CvarListenerPtr listener)
Registers a cvar listener.
character_t * GAME_GetCharacterByUCN(int ucn)
Returns a character that can be used to store the game type specific character values.
void GAME_ResetCharacters(void)
Reset all characters in the static character array.
void GAME_Frame(void)
Called every frame and allows us to hook into the current running game mode.
void UI_MessageResetStack(void)
short Com_GetUfoIdsNum(void)
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
const char *IMPORT * XML_GetString(xmlNode_t *parent, const char *name)
const cgame_import_t * cgi
const eventRegister_t * CL_GetEvent(const event_t eType)
Singleplayer campaign game type headers.
const char * Cvar_VariableStringOld(const char *varName)
Returns the old value of cvar as string before we changed it.
event_t
Possible event values.
Multiplayer game type headers.
int countItems() const
Count the number of items in the inventory (without temp containers)
void R_UploadAlpha(const image_t *image, const byte *alphaData)
bool UI_IsWindowOnStack(const char *name)
Check if a named window is on the stack if active windows.
void NET_WriteLong(dbuffer *buf, int c)
static SharedPtr< GAMECmdListener > cmdListener(new GAMECmdListener())
const char * Com_ValueToStr(const void *base, const valueTypes_t type, const int ofs)
const char uiNode_t *IMPORT * UI_AddOption(uiNode_t **tree, const char *name, const char *label, const char *value)
uiNode_t *IMPORT * UI_InitOptionIteratorAtIndex(int index, uiNode_t *option, uiOptionIterator_t *iterator)
int NET_ReadShort(dbuffer *buf)
cgame team management headers.
const char * Com_EParse(const char **text, const char *errhead, const char *errinfo, char *target, size_t size)
Parsing function that prints an error message when there is no text in the buffer.
#define Mem_CreatePool(name)
static void GAME_InitializeBattlescape(linkedList_t *team)
This is called if actors are spawned (or at least the spawning commands were send to the server)...
void GAME_DrawBaseLayout(int baseIdx, int x, int y, int totalMarge, int w, int h, int padding, const vec4_t bgcolor, const vec4_t color)
void UI_TextScrollEnd(const char *nodePath)
Scroll to the bottom.
void XML_AddShortValue(xmlNode_t *parent, const char *name, short value)
add a non-zero Short attribute to the XML Node
static void R_UploadAlpha_(const char *name, const byte *alphaData)
int FS_WriteFile(const void *buffer, size_t len, const char *filename)
item instance data, with linked list capability
Item * getContainer2(const containerIndex_t idx) const
const equipDef_t *IMPORT * INV_GetEquipmentDefinitionByID(const char *name)
bool GAME_IsMultiplayer(void)
void initInventory(const char *name, const csi_t *csi, const inventoryImport_t *import)
Initializes the inventory definition by linking the ->next pointers properly.
void FS_CloseFile(qFILE *f)
const mapDef_t * GAME_GetCurrentSelectedMap(void)
const char * Com_UFOTypeToShortName(ufoType_t type)
Translate UFO type to short name.
void GAME_InitUIData(void)
Fills the game mode list entries with the parsed values from the script.
void CL_GenerateCharacter(character_t *chr, const char *teamDefName)
Generates the skills and inventory for a character and for a 2x2 unit.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
#define INVDEF(containerID)
#define NET_STATE_STARTMATCH
const teamDef_t *IMPORT * Com_GetTeamDefinitionByID(const char *team)
const linkedList_t * LIST_ContainsString(const linkedList_t *list, const char *string)
Searches for the first occurrence of a given string.
linkedList_t * LIST_CopyStructure(linkedList_t *src)
ufoType_t Com_UFOShortNameToID(const char *token)
Translate short name to UFO type.
void onRemove(const char *cmdName)
bool GAME_TeamIsKnown(const teamDef_t *teamDef)
const char * CL_PlayerGetName(unsigned int player)
Get the player name.
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
void S_SetSampleRepeatRate(int sampleRepeatRate)
Controls the repeat rate for the same sample.
void GAME_LoadTeam_f(void)
Loads the selected teamslot.
void NET_WriteFormat(dbuffer *buf, const char *format,...)
The user-friendly version of NET_WriteFormat that writes variable arguments to buffer according to fo...
mapDef_t * Com_GetMapDefinitionByID(const char *mapDefID)
const char *IMPORT * CL_Translate(const char *t)
static void GAME_NetSendItem(dbuffer *buf, const Item *item, containerIndex_t container, int x, int y)
bool LIST_RemoveEntry(linkedList_t **list, linkedList_t *entry)
Removes one entry from the linked list.
#define Mem_FreePool(pool)
character_t * GAME_GetSelectedChr(void)
Returns the currently selected character.
int WEB_CGameListForUser(const char *cgameId, int category, int userId)
Shows the uploaded files for the particular cgame category and the given userid.
void Com_RegisterConstInt(const char *name, int value)
Register mappings between script strings and enum values for values of the type V_INT.
void XML_AddShort(xmlNode_t *parent, const char *name, short value)
add a Short attribute to the XML Node
uiNode_t * UI_InitOptionIteratorAtIndex(int index, uiNode_t *option, uiOptionIterator_t *iterator)
Init an option iterator at an index.
linkedList_t * chrDisplayList
List of currently displayed or equipable characters.
long XML_GetLong(xmlNode_t *parent, const char *name, const long defaultval)
retrieve a Long attribute from an XML Node
static void GAME_NET_OOB_Printf(struct net_stream *s, const char *format,...)
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
bool Cvar_Delete(const char *varName)
Function to remove the cvar and free the space.
bool GAME_LoadDefaultTeam(bool force)
uiModel_t * UI_GetUIModel(const char *modelName)
Returns pointer to UI model.
character_t * GAME_GetCharacter(int index)
Returns a character that can be used to store the game type specific character values.
void S_StartLocalSample(const char *s, float volume)
Plays a sample without spatialization.
actorSizeEnum_t fieldSize
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
static const cgame_import_t * GAME_GetImportData(const cgameType_t *t)
uiNode_t *IMPORT * UI_GetOption(int dataId)
const char *IMPORT * Com_ValueToStr(const void *base, const valueTypes_t type, const int ofs)
void R_DrawLine(int *verts, float thickness)
Draws one line with only one start and one end point.
le_t * LE_GetNextInUse(le_t *lastLE)
Iterate through the entities that are in use.
static void GAME_NetSendCharacter(dbuffer *buf, const character_t *chr)
Send the character information to the server that is needed to spawn the soldiers of the player...
const char *IMPORT * INV_GetFilterType(itemFilterTypes_t id)
void R_LoadImage(const char *name, byte **pic, int *width, int *height)
Generic image-data loading fucntion.
Listener for cvar changes.
linkedList_t *IMPORT * LIST_GetPointer(linkedList_t *list, const void *data)
static const value_t cgame_vals[]
Valid equipment definition values from script files.
const char * GAME_GetCurrentName(void)
cvar_t * Cvar_FullSet(const char *varName, const char *value, int flags)
Sets a cvar from console with the given flags.
const char * Com_GetConstVariable(const char *space, int value)
Searches the mapping variable for a given integer value and a namespace.
void INV_ItemDescription(const objDef_t *od)
Prints the description for items (weapons, armour, ...)
int Com_EParseValue(void *base, const char *token, valueTypes_t type, int ofs, size_t size)
void GAME_SaveTeam_f(void)
Stores a team in a specified teamslot.
bool XML_GetBool(xmlNode_t *parent, const char *name, const bool defaultval)
retrieve a Boolean attribute from an XML Node
void XML_AddBoolValue(xmlNode_t *parent, const char *name, bool value)
add a non-false Boolean attribute to the XML Node
void GAME_ToggleActorForTeam_f(void)
This will activate/deactivate the actor for the team.
void NET_StreamSetData(struct net_stream *s, void *data)
void XML_AddByte(xmlNode_t *parent, const char *name, byte value)
add a Byte attribute to the XML Node
Skirmish game type headers.
int FS_Read(void *buffer, int len, qFILE *f)
const equipDef_t *IMPORT * GAME_ChangeEquip(const linkedList_t *equipmentList, changeEquipType_t changeType, const char *equipID)
linkedList_t *IMPORT * LIST_CopyStructure(linkedList_t *src)
bool Com_ParseList(const char **text, linkedList_t **list)
const cgame_export_t * GetCGameAPI(const cgame_import_t *import)
#define Mem_FreeTag(pool, tagNum)
static void GAME_WebUpload(int category, const char *filename)
const linkedList_t *IMPORT * LIST_ContainsString(const linkedList_t *list, const char *string)
static void GAME_SetNextUniqueCharacterNumber(int ucn)
size_t GAME_GetCharacterArraySize(void)
xmlNode_t *IMPORT * XML_GetNextPos2(xmlNode_t *actual, xmlNode_t *parent, const char *name, vec2_t pos)
QGL_EXTERN GLuint GLchar GLuint * len
const char * CL_Translate(const char *t)
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
void GAME_UpdateTeamMenuParameters_f(void)
Displays actor info and equipment and unused items in proper (filter) category.
xmlNode_t * XML_GetDate(xmlNode_t *parent, const char *name, int *day, int *sec)
retrieve the date data from an XML Node
void NET_DatagramBroadcast(struct datagram_socket *s, const char *buf, int len, int port)
void CL_SetClientState(connstate_t state)
Sets the client state.
void NET_DatagramSocketClose(struct datagram_socket *s)
bool WEB_CGameUpload(const char *cgameId, int category, const char *filename)
Uploads a file to the server.
const char *IMPORT * UI_GetActiveWindowName(void)
int nextUniqueCharacterNumber
void destroyInventoryInterface(void)
xmlNode_t * XML_GetNextPos2(xmlNode_t *actual, xmlNode_t *parent, const char *name, vec2_t pos)
retrieve the next Pos2 data from an XML Node
void GAME_AutoTeam(const char *equipmentDefinitionID, int teamMembers)
bool GAME_IsTeamEmpty(void)
static void CL_QueryMasterServer(const char *action, http_callback_t callback)
char * FS_NextScriptHeader(const char *files, const char **name, const char **text)
const char *EXPORT * GetModelForItem(const char *string)
std::set< const struct cvar_s *> GameCvars
void GAME_HandleResults(dbuffer *msg, int winner, int *numSpawned, int *numAlive, int numKilled[][MAX_TEAMS], int numStunned[][MAX_TEAMS], bool nextmap)
After a mission was finished this function is called.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void NET_WriteByte(dbuffer *buf, byte c)
void EquipActor(character_t *const chr, const equipDef_t *ed, const objDef_t *weapon, int maxWeight)
#define CS_VICTORY_CONDITIONS
const char *EXPORT * GetTeamDef(void)
void XML_AddDouble(xmlNode_t *parent, const char *name, double value)
add a Double attribute to the XML Node
dbuffer *IMPORT * NET_ReadMsg(struct net_stream *s)
void GAME_DisplayItemInfo(uiNode_t *node, const char *string)
Shows game type specific item information (if it's not resolvable via objDef_t).
void GAME_EndRoundAnnounce(int playerNum, int team)
Send end round announcements.
char *IMPORT * FS_NextScriptHeader(const char *files, const char **name, const char **text)
void UI_RegisterOption(int dataId, uiNode_t *option)
inventory definition with all its containers
void HUD_InitUI(const char *optionWindowName)
Display the user interface.
std::set< const char *> GameCmds
Defines all attributes of objects used in the inventory.
linkedList_t * LIST_GetPointer(linkedList_t *list, const void *data)
Searches for the first occurrence of a given pointer.
const char *IMPORT * CL_PlayerGetName(unsigned int player)
void UI_PopWindow(bool all)
Pops a window from the window stack.
void Cmd_RegisterCmdListener(CmdListenerPtr listener)
Registers a command listener.
void GAME_CharacterCvars(const character_t *chr)
int CL_GetPlayerNum(void)
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
char *IMPORT * GAME_StrDup(const char *string)
void Com_SetGameType(void)
memPool_t *IMPORT * CreatePool(const char *name)
xmlNode_t * XML_GetNode(xmlNode_t *parent, const char *name)
Get first Node of the XML tree by name.
void Cmd_AddParamCompleteFunction(const char *cmdName, int(*function)(const char *partial, const char **match))
void destroyInventory(Inventory *const inv)
Destroys inventory.
void R_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
Draws a rect to the screen. Also has support for stippled rendering of the rect.
const char *IMPORT * NET_StreamPeerToName(struct net_stream *s, char *dst, int len, bool appendPort)
const ugv_t *IMPORT * Com_GetUGVByIDSilent(const char *ugvID)
uiNode_t * UI_AddOption(uiNode_t **tree, const char *name, const char *label, const char *value)
Append an option to an option list.
int UI_DrawString(const char *fontID, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, bool increaseLine, longlines_t method)
bool WEB_CGameDelete(const char *cgameId, int category, const char *filename)
Deletes a user owned file on the server.
void UI_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
void CL_Disconnect(void)
Sets the cls.state to ca_disconnected and informs the server.
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* ...
cvar_t * Cvar_ForceSet(const char *varName, const char *value)
Will set the variable even if NOSET or LATCH.
bool HTTP_GetURL(const char *url, http_callback_t callback, void *userdata, const char *postfields)
Downloads the given url and return the data to the callback (optional)
void *IMPORT * NET_StreamGetData(struct net_stream *s)
struct datagram_socket *IMPORT * NET_DatagramSocketNew(const char *node, const char *service, datagram_callback_func *func)
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
static void GAME_NET_OOB_Printf2(const char *format,...)
void R_DrawBloom(void)
handle post-processing bloom
void GAME_InitStartup(void)
int skills[SKILL_NUM_TYPES]
const char * NET_StreamPeerToName(struct net_stream *s, char *dst, int len, bool appendPort)
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
const char * Cvar_GetString(const char *varName)
Returns the value of cvar as string.
static void GAME_UI_Popup(const char *title, const char *format,...)
#define Mem_PoolStrDup(in, pool, tagNum)
void MAP_ShutdownCallbacks(void)
Unregisters UI Callbacks of battlescape map selection.
xmlNode_t *IMPORT * XML_GetNextPos3(xmlNode_t *actual, xmlNode_t *parent, const char *name, vec3_t pos)
mapDef_t *IMPORT * Com_GetMapDefinitionByID(const char *mapDefID)
void R_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
bool GAME_ItemIsUseable(const objDef_t *od)
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
bool LIST_IsEmpty(const linkedList_t *list)
Checks whether the given list is empty.
const char *IMPORT * Com_DropShipTypeToShortName(humanAircraftType_t type)
void GAME_StartMatch(void)
void XML_AddIntValue(xmlNode_t *parent, const char *name, int value)
add a non-zero Int attribute to the XML Node
const char *IMPORT * GetRelativeSavePath(char *buf, size_t bufSize)
int kills[KILLED_NUM_TYPES]
void NET_StreamSetCallback(struct net_stream *s, stream_callback_func *func)
void Cbuf_Execute(void)
Pulls off terminated lines of text from the command buffer and sends them through Cmd_ExecuteString...
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
static char * GAME_StrDup(const char *string)
void GAME_DrawBaseLayoutTooltip(int baseIdx, int x, int y)
Cgame callback to draw tooltip for baselayout UI node.
image_t * R_GetImage(const char *name)
void *IMPORT * LIST_GetRandom(linkedList_t *list)
const char *IMPORT * Cvar_VariableStringOld(const char *varName)
const char * INV_GetFilterType(itemFilterTypes_t id)
#define ACTOR_SIZE_NORMAL
const char *IMPORT * Com_GetConstVariable(const char *space, int value)
const char * GAME_GetRelativeSavePath(char *buf, size_t bufSize)
const cgameType_t * cgameType
Item * getFloorContainer() const
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
humanAircraftType_t Com_DropShipShortNameToID(const char *token)
Translate DropShip type to short name.
const char *IMPORT * Cmd_Args(void)
void GAME_DrawMap(geoscapeData_t *data)
const char *IMPORT * Com_EParse(const char **text, const char *errhead, const char *errinfo)
static void GAME_SetMode_f(void)
Decides which game mode should be set - takes the menu as reference.
static void GAME_FreePool(memPool_t *pool)
static void GAME_Abort_f(void)
Let the aliens win the match.
void GAME_SaveTeamState_f(void)
Will remove those actors that should not be used in the team.
QGL_EXTERN GLuint GLsizei bufSize
static const cgame_export_t * GAME_GetCGameAPI(const cgameType_t *t)
void resetTempContainers()
const char * GAME_GetTeamDef(void)
const equipDef_t * GAME_ChangeEquip(const linkedList_t *equipmentList, changeEquipType_t changeType, const char *equipID)
Changed the given cvar to the next/prev equipment definition.
static equipDef_t equipDefStandard
int Com_ServerState(void)
Check whether we are the server or have a singleplayer tactical mission.
const char *IMPORT * Com_UFOTypeToShortName(ufoType_t type)
static const cgame_export_t * GAME_GetCGameAPI_(const cgameType_t *t)
void XML_AddByteValue(xmlNode_t *parent, const char *name, byte value)
add a non-zero Byte attribute to the XML Node
short numBodyParts(void) const
static void GAME_NetSendInventory(dbuffer *buf, const Inventory *inv)
const char *IMPORT * FS_NextFileFromFileList(const char *files)
xmlNode_t * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
Get next Node of the XML tree by name.
void * LIST_GetRandom(linkedList_t *list)
void onCreate(const struct cvar_s *cvar)
const char * Com_UFOCrashedTypeToShortName(ufoType_t type)
Translate UFO type to short name when UFO is crashed.
void UI_TextNodeSelectLine(uiNode_t *node, int num)
Change the selected line.
static cgameType_t cgameTypes[MAX_CGAMETYPES]
bool CHRSH_IsArmourUseableForTeam(const objDef_t *od, const teamDef_t *teamDef)
Struct that defines one particular event with all its callbacks and data.
void NET_WriteShort(dbuffer *buf, int c)
int NET_ReadByte(dbuffer *buf)
Reads a byte from the netchannel.
byte r_radarSourcePic[RADAR_WIDTH *RADAR_HEIGHT]
const char * Cmd_Args(void)
Returns a single string containing argv(1) to argv(argc()-1)
static const cgame_export_t * GAME_GetCurrentType(void)
static void GAME_FreeInventory(void *data)
static const inventoryImport_t inventoryImport
void XML_AddLongValue(xmlNode_t *parent, const char *name, long value)
add a non-zero Long attribute to the XML Node
bool Com_ParseBlockToken(const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool, const char *token)
uiNode_t *IMPORT * UI_GetNodeByPath(const char *path)
Defines a type of UGV/Robot.
static memPool_t * GAME_CreatePool(const char *name)
bool Com_GetConstInt(const char *name, int *value)
Searches whether a given value was registered as a string to int mapping.
int CL_GetClientState(void)
bool Com_UnregisterConstList(const constListEntry_t constList[])
Unregisters a list of string aliases.
void format(__printf__, 1, 2)))
int NET_ReadStringLine(dbuffer *buf, char *string, size_t length)
void LIST_AddPointer(linkedList_t **listDest, void *data)
Adds just a pointer to a new or to an already existing linked list.
bool R_ImageExists(const char *pname,...)
xmlNode_t * XML_Parse(const char *buffer)
void SV_Shutdown(const char *finalmsg, bool reconnect)
Called when each game quits, before Sys_Quit or Sys_Error.
const ugv_t * Com_GetUGVByID(const char *ugvID)
Searches an UGV definition by a given script id and returns the pointer to the global data...
void HUD_DisplayMessage(const char *text)
Displays a message on the hud.
short Com_GetHumanAircraftIdsNum(void)
int CL_Milliseconds(void)
Listener for command changes.
void Cmd_TableAddList(const cmdList_t *cmdList)
void FS_FreeFile(void *buffer)
void UI_DisplayNotice(const char *text, int time, const char *windowName)
Displays a message over all windows.
void GAME_MapClick(uiNode_t *node, int x, int y, const vec2_t pos)
bool WEB_CGameDownloadFromUser(const char *cgameId, int category, const char *filename, int userId)
Downloads a file from the server and store it in the user directory.
#define SND_VOLUME_DEFAULT
void UI_ExecuteConfunc(const char *fmt,...)
Executes confunc - just to identify those confuncs in the code - in this frame.
const char * FS_NextPath(const char *prevpath)
Allows enumerating all of the directories in the search path.
bool Com_ParseBoolean(const char *token)
Parses a boolean from a string.
static const int TAG_INVENTORY
void NET_WriteMsg(struct net_stream *s, dbuffer &buf)
Enqueue the buffer in the net stream for ONE client.
const cgame_export_t *(* cgame_api_t)(const cgame_import_t *)