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,
160static 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");
286 for (
int i = 0;
i < teamMembers;
i++)
293 if (list !=
nullptr) {
302 if (list !=
nullptr) {
304 return isMultiplayer;
317 Com_Printf(
"Used inventory slots after battle: %i\n",
cls.i.GetUsedSlots());
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);
455 cls.i.destroyInventory(inv);
460 cls.i.EquipActor(chr, ed, weapon, maxWeight);
465 return cls.i.removeFromInventory(
i, container, fItem);
490 cls.nextUniqueCharacterNumber = ucn;
495 return cls.nextUniqueCharacterNumber;
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);
581static const char*
Com_EParse_ (
const char** text,
const char* errhead,
const char* errinfo)
591 if (
cgi ==
nullptr) {
902#ifndef HARD_LINKED_CGAME
903 if (
cls.cgameLibrary) {
906 SDL_UnloadObject(
cls.cgameLibrary);
907 cls.cgameLibrary =
nullptr;
914 cls.currentSelectedMap += step;
916 if (
cls.currentSelectedMap < 0)
917 cls.currentSelectedMap =
csi.numMDs - 1;
918 cls.currentSelectedMap %=
csi.numMDs;
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);
956 if (
cls.gametype == gametype)
975 cls.gametype = gametype;
983 cls.i.destroyInventoryInterface();
1009 Com_Printf(
"GAME_ParseModes: cgame def \"%s\" with same name found, second ignored\n",
name);
1014 Sys_Error(
"GAME_ParseModes: MAX_CGAMETYPES exceeded");
1027 const char*
name = t->
id;
1028#ifndef HARD_LINKED_CGAME
1029 if (
cls.cgameLibrary)
1032 Com_Printf(
"------- Loading cgame-%s.%s -------\n",
name, SO_EXT);
1039 const char* path =
nullptr;
1040 while (!
cls.cgameLibrary) {
1060 Sys_Error(
"Could not find the equipDef '%s' in the cgame mode: '%s'", equipID,
name);
1069#ifdef HARD_LINKED_CGAME
1080 const char* modeName;
1086 if (modeName[0] ==
'\0')
1101 Com_Printf(
"GAME_SetMode_f: Mode '%s' not found\n", modeName);
1117 if (list && list->IsItemUseable)
1118 return list->IsItemUseable(od);
1139 list->Results(msg, winner, numSpawned, numAlive, numKilled, numStunned, nextmap);
1154 assert(item->
def());
1170 if (
INVDEF(container)->temp)
1259 if (teamDefID[0] ==
'\0')
1260 teamDefID =
"phalanx";
1275 cls.i.destroyInventoryInterface();
1302 Cvar_Set(
"cl_maxworldlevel",
"%i",
cl.mapMaxLevel - 1);
1303 if (list !=
nullptr && list->StartBattlescape) {
1304 list->StartBattlescape(isTeamPlay);
1325 if (list !=
nullptr && list->InitMissionBriefing)
1326 list->InitMissionBriefing(&title, &victoryConditionsMsgIDs, &missionBriefingMsgIDs);
1330 LIST_AddString(&victoryConditionsMsgIDs,
"*msgid:victory_condition_default");
1334 LIST_AddString(&missionBriefingMsgIDs,
"*msgid:mission_briefing_default");
1349 for (
int i = 0;
i <
size;
i++) {
1355 if (list && list->InitializeBattlescape) {
1356 list->InitializeBattlescape(&msg, team);
1384 if (list && list->Spawn)
1385 spawnStatus = list->Spawn(&
cl.chrList);
1389 Com_Printf(
"Used inventory slots: %i\n",
cls.i.GetUsedSlots());
1435 if (list && list->NotifyEvent)
1436 list->NotifyEvent(eventType);
1446 if (list && list->IsTeamKnown !=
nullptr)
1447 return list->IsTeamKnown(teamDef);
1454 if (list && list->UpdateCharacterValues !=
nullptr)
1455 list->UpdateCharacterValues(chr);
1471 if (list && list->Drop) {
1503 if (list && list->RunFrame !=
nullptr)
1504 list->RunFrame(
cls.frametime);
1511 if (list && list->DrawBaseLayout !=
nullptr)
1512 list->DrawBaseLayout(baseIdx, x, y, totalMarge, w, h, padding, bgcolor, color);
1524 if (list && list->DrawBaseLayoutTooltip !=
nullptr)
1525 list->DrawBaseLayoutTooltip(baseIdx, x, y);
1539 if (model !=
nullptr) {
1540 if (uiModel !=
nullptr)
1546 if (uiModel !=
nullptr)
1564 if (ucn == chrTmp->ucn) {
1584 if (list && list->GetChrMaxLoad !=
nullptr)
1585 return std::min(strength, list->GetChrMaxLoad(chr));
1599 Com_Error(
ERR_DROP,
"Could not find the equipment definition for '%s'", equipID);
1602 switch (changeType) {
1619 if (entry ==
nullptr) {
1620 equipID = (
const char*)equipmentList->
data;
1621 }
else if (changeType ==
FORWARD) {
1622 equipID = (
const char*)(entry->
next !=
nullptr ? entry->
next->
data : equipmentList->
data);
1623 }
else if (changeType ==
BACKWARD) {
1624 const char* newEntry =
nullptr;
1625 const char* prevEntry =
nullptr;
1628 if (prevEntry !=
nullptr) {
1629 newEntry = prevEntry;
1640 Com_Error(
ERR_DROP,
"Could not find the equipment definition for '%s'", equipID);
1651 Com_Printf(
"----------- game modes -------------\n");
bool BEP_Evaluate(const char *expr, BEPEvaluteCallback_t varFuncParam, const void *userdata)
const cgame_export_t *(* cgame_api_t)(const cgame_import_t *)
bool CHRSH_IsArmourUseableForTeam(const objDef_t *od, const teamDef_t *teamDef)
char * CL_GetConfigString(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...
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.
void GAME_InitStartup(void)
static const cgame_export_t * GAME_GetCurrentType(void)
void GAME_EndRoundAnnounce(int playerNum, int team)
Send end round announcements.
void GAME_StartMatch(void)
character_t * GAME_GetSelectedChr(void)
Returns the currently selected character.
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)
void GAME_AddChatMessage(const char *format,...)
static void GAME_Free(void *ptr)
static equipDef_t equipDefStandard
character_t * GAME_GetCharacterByUCN(int ucn)
Returns a character that can be used to store the game type specific character values.
equipDef_t * GAME_GetEquipmentDefinition(void)
bool GAME_ItemIsUseable(const objDef_t *od)
static const cgame_export_t * GAME_GetCGameAPI_(const cgameType_t *t)
bool GAME_IsTeamEmpty(void)
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)
static void GAME_NET_OOB_Printf2(const char *format,...)
static void UI_PushWindow_(const char *name)
void GAME_Frame(void)
Called every frame and allows us to hook into the current running game mode.
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_DrawMap(geoscapeData_t *data)
static void GAME_NetSendInventory(dbuffer *buf, const Inventory *inv)
static void GAME_FreeAllInventory(void)
static void R_DrawImageCentered(int x, int y, const char *name)
void GAME_NotifyEvent(event_t eventType)
void GAME_SwitchCurrentSelectedMap(int step)
static void GAME_WebListForUser(int category, int userId)
static const cgame_import_t * GAME_GetImportData(const cgameType_t *t)
void GAME_AppendTeamMember(int memberIndex, const char *teamDefID, const equipDef_t *ed)
static void GAME_SetNextUniqueCharacterNumber(int ucn)
void GAME_UnloadGame(void)
static void GAME_CollectAliens(void *data, void(*collect)(void *, const teamDef_t *, int, bool))
Collecting stunned and dead alien bodies after the mission.
static char * GAME_PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
static const int TAG_INVENTORY
const char * GAME_GetAbsoluteSavePath(char *buf, size_t bufSize)
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.
void GAME_InitMissionBriefing(const char *title)
static void GAME_DestroyInventory(Inventory *const inv)
size_t GAME_GetCharacterArraySize(void)
void GAME_GenerateTeam(const char *teamDefID, const equipDef_t *ed, int teamMembers)
static void GAME_FreeInventory(void *data)
void GAME_DrawMapMarkers(uiNode_t *node)
static void GAME_SetMode_f(void)
Decides which game mode should be set - takes the menu as reference.
void GAME_SpawnSoldiers(void)
Called during startup of mission to send team info.
static character_t characters[MAX_ACTIVETEAM]
static character array that can be used by a game mode to store the needed character values.
geoscapeData_t geoscapeData
bool GAME_IsMultiplayer(void)
static void GAME_FreePool(memPool_t *pool)
void GAME_MapClick(uiNode_t *node, int x, int y, const vec2_t pos)
character_t * GAME_GetCharacter(int index)
Returns a character that can be used to store the game type specific character values.
void GAME_ParseModes(const char *name, const char **text)
static void GAME_NET_OOB_Printf(struct net_stream *s, const char *format,...)
void GAME_DrawBaseLayoutTooltip(int baseIdx, int x, int y)
Cgame callback to draw tooltip for baselayout UI node.
static memPool_t * GAME_CreatePool(const char *name)
static void * GAME_AllocInventoryMemory(size_t size)
static void GAME_NetSendItem(dbuffer *buf, const Item *item, containerIndex_t container, int x, int y)
int GAME_GetChrMaxLoad(const character_t *chr)
Returns the max weight the given character can carry.
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.
static int UI_DrawString_(const char *fontID, align_t align, int x, int y, const char *c)
static void GAME_Abort_f(void)
Let the aliens win the match.
static void R_UploadAlpha_(const char *name, const byte *alphaData)
const char * GAME_GetTeamDef(void)
void GAME_ResetCharacters(void)
Reset all characters in the static character array.
static void GAME_WebDownloadFromUser(int category, const char *filename, int userId)
static void GAME_UI_Popup(const char *title, const char *format,...)
bool GAME_TeamIsKnown(const teamDef_t *teamDef)
void GAME_InitUIData(void)
Fills the game mode list entries with the parsed values from the script.
static void GAME_WebDelete(int category, const char *filename)
const mapDef_t * GAME_GetCurrentSelectedMap(void)
const char * GAME_GetCurrentName(void)
const char * GAME_GetRelativeSavePath(char *buf, size_t bufSize)
static SharedPtr< GAMECvarListener > cvarListener(new GAMECvarListener())
static bool GAME_Spawn(linkedList_t **chrList)
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).
static bool GAME_RemoveFromInventory(Inventory *const i, const invDef_t *container, Item *fItem)
static void GAME_EquipActor(character_t *const chr, const equipDef_t *ed, const objDef_t *weapon, int maxWeight)
void GAME_EndBattlescape(void)
This is called when a client quits the battlescape.
static cgameType_t cgameTypes[MAX_CGAMETYPES]
static int GAME_GetNextUniqueCharacterNumber(void)
static SharedPtr< GAMECmdListener > cmdListener(new GAMECmdListener())
static void GAME_WebUpload(int category, const char *filename)
bool GAME_HandleServerCommand(const char *command, dbuffer *msg)
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_SetMode(const cgame_export_t *gametype)
static const cgame_export_t * GAME_GetCGameAPI(const cgameType_t *t)
static void GAME_Exit_f(void)
Quits the current running game by calling the shutdown callback.
static char * GAME_StrDup(const char *string)
static const value_t cgame_vals[]
Valid equipment definition values from script files.
static void CL_QueryMasterServer(const char *action, http_callback_t callback)
void GAME_SetServerInfo(const char *server, const char *serverport)
int GAME_GetCurrentTeam(void)
const char * GAME_GetModelForItem(const objDef_t *od, uiModel_t **uiModel)
Get a model for an item.
void GAME_StartBattlescape(bool isTeamPlay)
Called when the server sends the EV_START event.
void GAME_ReloadMode(void)
static const char * Com_EParse_(const char **text, const char *errhead, const char *errinfo)
static const inventoryImport_t inventoryImport
void GAME_CharacterCvars(const character_t *chr)
static void GAME_CollectItems(void *data, int won, void(*collectItem)(void *, const objDef_t *, int), void(*collectAmmo)(void *, const Item *), void(*ownitems)(const Inventory *))
Shared game type headers.
mapDef_t * Com_GetMapDefByIDX(int index)
linkedList_t * LIST_CopyStructure(linkedList_t *src)
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
void LIST_Sort(linkedList_t **list, linkedListSort_t sorter, const void *userData)
void FS_CloseFile(qFILE *f)
void * _Mem_Alloc(size_t size, bool zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine)
const cgame_export_t * GetCGameAPI(const cgame_import_t *import)
Singleplayer campaign game type headers.
Multiplayer game type headers.
Skirmish game type headers.
bool GAME_SaveCharacter(xmlNode_t *p, const character_t *chr)
saves a character to a given xml node
void GAME_SaveTeam_f(void)
Stores a team in a specified teamslot.
void GAME_UpdateTeamMenuParameters_f(void)
Displays actor info and equipment and unused items in proper (filter) category.
void GAME_AutoTeam_f(void)
void GAME_SaveTeamState_f(void)
Will remove those actors that should not be used in the team.
void GAME_TeamDelete_f(void)
Removes a user created team.
void GAME_TeamSlotComments_f(void)
Reads the comments from team files.
bool GAME_LoadDefaultTeam(bool force)
void GAME_ActorSelect_f(void)
void GAME_AutoTeam(const char *equipmentDefinitionID, int teamMembers)
void GAME_ToggleActorForTeam_f(void)
This will activate/deactivate the actor for the team.
void GAME_LoadTeam_f(void)
Loads the selected teamslot.
bool GAME_LoadCharacter(xmlNode_t *p, character_t *chr)
Loads a character from a given xml node.
cgame team management headers.
void HUD_InitUI(const char *optionWindowName)
Display the user interface.
void HUD_DisplayMessage(const char *text)
Displays a message on the hud.
itemFilterTypes_t INV_GetFilterTypeID(const char *filterTypeID)
Searches for a filter type name (as used in console functions) and returns the matching itemFilterTyp...
const equipDef_t * INV_GetEquipmentDefinitionByID(const char *name)
Gets equipment definition by id.
const char * INV_GetFilterType(itemFilterTypes_t id)
bool INV_ItemMatchesFilter(const objDef_t *obj, const itemFilterTypes_t filterType)
Checks if the given object/item matched the given filter type.
Header file for inventory handling and Equipment menu.
void INV_ItemDescription(const objDef_t *od)
Prints the description for items (weapons, armour, ...).
const char * CL_Translate(const char *t)
le_t * LE_GetNextInUse(le_t *lastLE)
Iterate through the entities that are in use.
bool LE_IsActor(const le_t *le)
Checks whether the given le is a living actor.
int CL_GetClientState(void)
void CL_Drop(void)
Ensures the right menu cvars are set after error drop or map change.
void CL_SetClientState(connstate_t state)
Sets the client state.
void CL_Disconnect(void)
Sets the cls.state to ca_disconnected and informs the server.
memPool_t * cl_genericPool
int CL_Milliseconds(void)
void MAP_ShutdownCallbacks(void)
Unregisters UI Callbacks of battlescape map selection.
void MAP_InitCallbacks(void)
Registers UI Callbacks for battlescape map selection.
const char * CL_PlayerGetName(unsigned int player)
Get the player name.
int CL_GetPlayerNum(void)
void R_LoadImage(const char *name, byte **pic, int *width, int *height)
Generic image-data loading fucntion.
void R_Color(const vec4_t rgba)
Change the color to given value.
mapDef_t * Com_GetMapDefinitionByID(const char *mapDefID)
#define INVDEF(containerID)
void CL_UpdateCharacterValues(const character_t *chr)
linkedList_t * chrDisplayList
List of currently displayed or equipable characters.
const char * CL_ActorGetSkillString(const int skill)
Return the skill string for the given skill level.
void CL_GenerateCharacter(character_t *chr, const char *teamDefName)
Generates the skills and inventory for a character and for a 2x2 unit.
short numBodyParts(void) const
Listener for command changes.
Listener for cvar changes.
std::set< const char * > GameCmds
void onRemove(const char *cmdName)
void onAdd(const char *cmdName)
void onDelete(const struct cvar_s *cvar)
void onCreate(const struct cvar_s *cvar)
std::set< const struct cvar_s * > GameCvars
inventory definition with all its containers
int countItems() const
Count the number of items in the inventory (without temp containers).
void resetTempContainers()
Item * getContainer2(const containerIndex_t idx) const
item instance data, with linked list capability
const objDef_t * ammoDef(void) const
const objDef_t * def(void) const
Primary header for client.
void Cmd_ExecuteString(const char *text,...)
A complete command line has been parsed, so try to execute it.
const char * Cmd_Argv(int arg)
Returns a given argument.
void Cmd_AddParamCompleteFunction(const char *cmdName, int(*function)(const char *partial, const char **match))
void Cmd_TableAddList(const cmdList_t *cmdList)
void Cmd_RemoveCommand(const char *cmdName)
Removes a command from script interface.
void Cbuf_Execute(void)
Pulls off terminated lines of text from the command buffer and sends them through Cmd_ExecuteString...
void Cmd_RegisterCmdListener(CmdListenerPtr listener)
Registers a command listener.
void Cmd_UnRegisterCmdListener(CmdListenerPtr listener)
Unregisters a command listener.
const char * Cmd_Args(void)
Returns a single string containing argv(1) to argv(argc()-1).
bool Cmd_GenericCompleteFunction(char const *candidate, char const *partial, char const **match)
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 Cmd_TableRemoveList(const cmdList_t *cmdList)
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_LoadLibrary(const char *path, const char *prefix)
Attempts to load a library using a filename suffix list.
void Com_Error(int code, const char *fmt,...)
void Com_SetGameType(void)
void Com_Printf(const char *const fmt,...)
cvar_t * masterserver_url
void SV_ShutdownWhenEmpty(void)
Will eventually shutdown the server once all clients have disconnected.
void SV_Shutdown(const char *finalmsg, bool reconnect)
Called when each game quits, before Sys_Quit or Sys_Error.
const cgame_import_t * cgi
cvar_t * Cvar_ForceSet(const char *varName, const char *value)
Will set the variable even if NOSET or LATCH.
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
const char * Cvar_VariableStringOld(const char *varName)
Returns the old value of cvar as string before we changed it.
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
bool Cvar_Delete(const char *varName)
Function to remove the cvar and free the space.
int Cvar_GetInteger(const char *varName)
Returns the int value of a cvar.
void Cvar_RegisterCvarListener(CvarListenerPtr listener)
Registers a cvar listener.
void Cvar_UnRegisterCvarListener(CvarListenerPtr listener)
Unregisters a cvar listener.
cvar_t * Cvar_FullSet(const char *varName, const char *value, int flags)
Sets a cvar from console with the given flags.
float Cvar_GetValue(const char *varName)
Returns the float value of a cvar.
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.
#define ACTOR_SIZE_NORMAL
const eventRegister_t * CL_GetEvent(const event_t eType)
const char * FS_NextPath(const char *prevpath)
Allows enumerating all of the directories in the search path.
void FS_RemoveFile(const char *osPath)
int FS_CheckFile(const char *fmt,...)
Just returns the filelength and -1 if the file wasn't found.
int FS_LoadFile(const char *path, byte **buffer)
Filenames are relative to the quake search path.
char * FS_NextScriptHeader(const char *files, const char **name, const char **text)
void FS_FreeFile(void *buffer)
const char * FS_NextFileFromFileList(const char *files)
Returns the next file that is found in the virtual filesystem identified by the given file pattern.
int FS_WriteFile(const void *buffer, size_t len, const char *filename)
int FS_Read(void *buffer, int len, qFILE *f)
int FS_OpenFile(const char *filename, qFILE *file, filemode_t mode)
Finds and opens the file in the search path.
const char * FS_Gamedir(void)
Called to find where to write a file (savegames, etc).
int FS_BuildFileList(const char *fileList)
Build a filelist.
void Sys_Error(const char *error,...)
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(* http_callback_t)(const char *response, void *userdata)
const objDef_t * INVSH_GetItemByID(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
linkedList_t * LIST_GetPointer(linkedList_t *list, const void *data)
Searches for the first occurrence of a given pointer.
void LIST_AddStringSorted(linkedList_t **listDest, const char *data)
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 * LIST_GetRandom(linkedList_t *list)
void LIST_Delete(linkedList_t **list)
bool LIST_RemoveEntry(linkedList_t **list, linkedList_t *entry)
Removes one entry from the linked list.
void * LIST_GetByIdx(linkedList_t *list, int index)
Get an entry of a linked list by its index in the list.
int LIST_Count(const linkedList_t *list)
void LIST_AddPointer(linkedList_t **listDest, void *data)
Adds just a pointer to a new or to an already existing linked list.
bool LIST_Remove(linkedList_t **list, const void *data)
bool LIST_IsEmpty(const linkedList_t *list)
Checks whether the given list is empty.
const linkedList_t * LIST_ContainsString(const linkedList_t *list, const char *string)
Searches for the first occurrence of a given string.
void LIST_PrependString(linkedList_t **listDest, const char *data)
Adds a string as first entry to a linked list.
#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 ...
#define Mem_FreePool(pool)
#define Mem_PoolStrDup(in, pool, tagNum)
#define Mem_CreatePool(name)
#define Mem_FreeTag(pool, tagNum)
#define Mem_PoolAlloc(size, pool, tagNum)
struct datagram_socket * NET_DatagramSocketNew(const char *node, const char *service, datagram_callback_func *func)
Opens a datagram socket (UDP).
void NET_StreamSetCallback(struct net_stream *s, stream_callback_func *func)
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* ...
void NET_SockaddrToStrings(struct datagram_socket *s, struct sockaddr *addr, char *node, size_t nodelen, char *service, size_t servicelen)
Convert sockaddr to string.
void NET_StreamSetData(struct net_stream *s, void *data)
void * NET_StreamGetData(struct net_stream *s)
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_DatagramBroadcast(struct datagram_socket *s, const char *buf, int len, int port)
void NET_StreamFree(struct net_stream *s)
Call NET_StreamFree to dump the whole thing right now.
void NET_DatagramSocketClose(struct datagram_socket *s)
const char * NET_StreamPeerToName(struct net_stream *s, char *dst, int len, bool appendPort)
int NET_ReadString(dbuffer *buf, char *string, size_t length)
void NET_WriteShort(dbuffer *buf, int c)
int NET_ReadStringLine(dbuffer *buf, char *string, size_t length)
int NET_ReadLong(dbuffer *buf)
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.
int NET_ReadShort(dbuffer *buf)
void NET_WriteByte(dbuffer *buf, byte c)
void NET_WriteLong(dbuffer *buf, int c)
void NET_OOB_Printf(struct net_stream *s, const char *format,...)
Out of band print.
void NET_WriteString(dbuffer *buf, const char *str)
void NET_WriteFormat(dbuffer *buf, const char *format,...)
The user-friendly version of NET_WriteFormat that writes variable arguments to buffer according to fo...
Shared parsing functions.
event_t
Possible event values.
void format(__printf__, 1, 2)))
#define CS_VICTORY_CONDITIONS
#define NET_STATE_STARTMATCH
void R_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
void R_DrawLine(int *verts, float thickness)
Draws one line with only one start and one end point.
void R_DrawLineStrip(int points, int *verts)
2 dimensional line strip
void R_DrawImage(float x, float y, const image_t *image)
Draws an image or parts of it.
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.
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.
void R_DrawBloom(void)
handle post-processing bloom
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN GLsizei const GLvoid * data
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
QGL_EXTERN GLuint GLsizei bufSize
void R_SoftenTexture(byte *in, int width, int height, int bpp)
Applies blurring to a texture.
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
void R_UploadAlpha(const image_t *image, const byte *alphaData)
bool R_ImageExists(const char *pname,...)
image_t * R_GetImage(const char *name)
void S_SetSampleRepeatRate(int sampleRepeatRate)
Controls the repeat rate for the same sample.
void S_StartLocalSample(const char *s, float volume)
Plays a sample without spatialization.
#define SND_VOLUME_DEFAULT
bool Com_ParseBoolean(const char *token)
Parses a boolean from a string.
bool Com_ParseBlock(const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool)
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.
const char * Com_GetRandomMapAssemblyNameForCrashedCraft(const char *craftID)
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.
void Com_RegisterConstInt(const char *name, int value)
Register mappings between script strings and enum values for values of the type V_INT.
const char * Com_UFOCrashedTypeToShortName(ufoType_t type)
Translate UFO type to short name when UFO is crashed.
bool Com_ParseBlockToken(const char *name, const char **text, void *base, const value_t *values, memPool_t *mempool, const char *token)
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.
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 Com_UnregisterConstList(const constListEntry_t constList[])
Unregisters a list of string aliases.
bool Com_UnregisterConstVariable(const char *name)
Removes a registered constant from the script mapping hash table.
short Com_GetHumanAircraftIdsNum(void)
short Com_GetDropShipIdsNum(void)
ufoType_t Com_UFOShortNameToID(const char *token)
Translate short name to UFO type.
bool Com_GetConstIntFromNamespace(const char *space, const char *variable, int *value)
Searches whether a given value was registered as a string to int mapping.
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.
short Com_GetUfoIdsNum(void)
bool Com_GetConstInt(const char *name, int *value)
Searches whether a given value was registered as a string to int mapping.
humanAircraftType_t Com_DropShipShortNameToID(const char *token)
Translate DropShip type to short name.
bool Com_ParseList(const char **text, linkedList_t **list)
const char * Com_GetConstVariable(const char *space, int value)
Searches the mapping variable for a given integer value and a namespace.
const char * Com_ValueToStr(const void *base, const valueTypes_t type, const int ofs)
const char * Com_UFOTypeToShortName(ufoType_t type)
Translate UFO type to short name.
const char * Com_DropShipTypeToShortName(humanAircraftType_t type)
Translate DropShip type to short name.
void Com_RegisterConstList(const constListEntry_t constList[])
Registers a list of string aliases.
int Com_EParseValue(void *base, const char *token, valueTypes_t type, int ofs, size_t size)
align_t
We need this here for checking the boundaries from script values.
#define Q_strvalid(string)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap)
Safe (null terminating) vsnprintf implementation.
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...
character_t *EXPORT * GetSelectedChr(void)
equipDef_t *EXPORT * GetEquipmentDefinition(void)
const char *EXPORT * GetTeamDef(void)
const char *EXPORT * GetModelForItem(const char *string)
linkedList_t * equipmentList
Describes a character with all its attributes.
const teamDef_t * teamDef
actorSizeEnum_t fieldSize
int stuns[KILLED_NUM_TYPES]
int kills[KILLED_NUM_TYPES]
int skills[SKILL_NUM_TYPES]
int experience[SKILL_NUM_TYPES+1]
Struct that defines one particular event with all its callbacks and data.
const char * formatString
The format string that is used to write and parse this event.
inventory definition for our menus
Item * getFloorContainer() const
Defines all attributes of objects used in the inventory.
const objDef_t * onlyWeapon
const BodyData * bodyTemplate
Defines a type of UGV/Robot.
Model that have more than one part (top and down part of an aircraft).
Atomic structure used to define most of the UI.
int treatmentLevel[BODYPART_MAXTYPE]
uiNode_t * UI_InitOptionIteratorAtIndex(int index, uiNode_t *option, uiOptionIterator_t *iterator)
Init an option iterator at an index.
void UI_RegisterOption(int dataId, uiNode_t *option)
void UI_UpdateInvisOptions(uiNode_t *option, const linkedList_t *stringList)
Unhide those options that are stored in the linked list and hide the others.
void UI_ResetData(int dataId)
Reset a shared data. Type became NONE and value became nullptr.
uiNode_t * UI_GetOption(int dataId)
void UI_SortOptions(uiNode_t **first)
Sort options by alphabet.
void UI_RegisterText(int dataId, const char *text)
share a text with a data id
void UI_RegisterLinkedListText(int dataId, linkedList_t *text)
share a linked list of text with a data id
uiNode_t * UI_OptionIteratorNextOption(uiOptionIterator_t *iterator)
Find the next element from the iterator Iterator skipCollapsed and skipInvisible attribute can contro...
uiNode_t * UI_AddOption(uiNode_t **tree, const char *name, const char *label, const char *value)
Append an option to an option list.
@ TEXT_MISSIONBRIEFING_VICTORY_CONDITIONS
@ TEXT_MISSIONBRIEFING_TITLE
void UI_DisplayNotice(const char *text, int time, const char *windowName)
Displays a message over all windows.
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
void UI_ExecuteConfunc(const char *fmt,...)
Executes confunc - just to identify those confuncs in the code - in this frame.
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
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.
void UI_MessageResetStack(void)
void UI_MessageAddStack(struct uiMessageListNodeMessage_s *message)
struct uiMessageListNodeMessage_s * UI_MessageGetStack(void)
uiModel_t * UI_GetUIModel(const char *modelName)
Returns pointer to UI model.
void UI_DrawModelNode(uiNode_t *node, const char *source)
void UI_TextScrollEnd(const char *nodePath)
Scroll to the bottom.
void UI_TextNodeSelectLine(uiNode_t *node, int num)
Change the selected line.
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...
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)
void UI_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
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_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
bool UI_IsWindowOnStack(const char *name)
Check if a named window is on the stack if active windows.
uiNode_t * UI_PushWindow(const char *name, const char *parentName, linkedList_t *params)
Push a window onto the window stack.
void UI_PopWindow(bool all)
Pops a window from the window stack.
void UI_InitStack(const char *activeWindow, const char *mainWindow)
Init the stack to start with a window, and have an alternative window with ESC.
const char * UI_GetActiveWindowName(void)
Returns the name of the current window.
bool WEB_CGameUpload(const char *cgameId, int category, const char *filename)
Uploads a file to the server.
bool WEB_CGameDelete(const char *cgameId, int category, const char *filename)
Deletes a user owned file on the server.
int WEB_CGameListForUser(const char *cgameId, int category, int userId)
Shows the uploaded files for the particular cgame category and the given userid.
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.
UFOAI web interface management. c(lient)game related stuff.
void XML_AddPos2(xmlNode_t *parent, const char *name, const vec2_t pos)
add a Pos2 data to the XML Tree
xmlNode_t * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
Get next Node of the XML tree by name.
void XML_AddFloatValue(xmlNode_t *parent, const char *name, float value)
add a non-zero Float attribute to the XML Node
double XML_GetDouble(xmlNode_t *parent, const char *name, const double defaultval)
retrieve a Double attribute from an XML Node
float XML_GetFloat(xmlNode_t *parent, const char *name, const float defaultval)
retrieve a Float attribute from an XML Node
xmlNode_t * XML_GetPos2(xmlNode_t *parent, const char *name, vec2_t pos)
retrieve the first Pos2 data from an XML Node
void XML_AddByte(xmlNode_t *parent, const char *name, byte value)
add a Byte attribute to the XML Node
bool XML_GetBool(xmlNode_t *parent, const char *name, const bool defaultval)
retrieve a Boolean attribute from an XML Node
void XML_AddString(xmlNode_t *parent, const char *name, const char *value)
add a String attribute to the XML Node
void XML_AddIntValue(xmlNode_t *parent, const char *name, int value)
add a non-zero Int attribute to the XML Node
long XML_GetLong(xmlNode_t *parent, const char *name, const long defaultval)
retrieve a Long attribute from an XML Node
void XML_AddStringValue(xmlNode_t *parent, const char *name, const char *value)
add a non-empty String attribute to the XML Node
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 XML_AddShortValue(xmlNode_t *parent, const char *name, short value)
add a non-zero Short attribute to the XML Node
int XML_GetInt(xmlNode_t *parent, const char *name, const int defaultval)
retrieve an Int attribute from an XML Node
void XML_AddFloat(xmlNode_t *parent, const char *name, float value)
add a Float attribute to the XML Node
short XML_GetShort(xmlNode_t *parent, const char *name, const short defaultval)
retrieve a Short attribute from an XML Node
void XML_AddDouble(xmlNode_t *parent, const char *name, double value)
add a Double attribute to the XML Node
void XML_AddByteValue(xmlNode_t *parent, const char *name, byte value)
add a non-zero Byte attribute to the XML Node
void XML_AddLongValue(xmlNode_t *parent, const char *name, long value)
add a non-zero Long attribute to the XML Node
void XML_AddDoubleValue(xmlNode_t *parent, const char *name, double value)
add a non-zero Double attribute to the XML Node
const char * XML_GetString(xmlNode_t *parent, const char *name)
retrieve a String attribute from an XML Node
void XML_AddLong(xmlNode_t *parent, const char *name, long value)
add a Long attribute to the XML Node
xmlNode_t * XML_GetPos3(xmlNode_t *parent, const char *name, vec3_t pos)
retrieve the first Pos3 data from an XML Node
void XML_AddBool(xmlNode_t *parent, const char *name, bool value)
add a Boolean attribute to the XML Node
xmlNode_t * XML_Parse(const char *buffer)
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
xmlNode_t * XML_AddNode(xmlNode_t *parent, const char *name)
add a new node to the XML tree
void XML_AddInt(xmlNode_t *parent, const char *name, int value)
add an Int attribute to the XML Node
xmlNode_t * XML_GetDate(xmlNode_t *parent, const char *name, int *day, int *sec)
retrieve the date data from an XML Node
void XML_AddShort(xmlNode_t *parent, const char *name, short value)
add a Short attribute to the XML Node
void XML_AddPos3(xmlNode_t *parent, const char *name, const vec3_t pos)
add a Pos3 data to the XML Tree
xmlNode_t * XML_GetNode(xmlNode_t *parent, const char *name)
Get first Node of the XML tree by name.
void XML_AddDate(xmlNode_t *parent, const char *name, const int day, const int sec)
add a date data to the XML Tree
void XML_AddBoolValue(xmlNode_t *parent, const char *name, bool value)
add a non-false Boolean attribute to the XML Node