1 /**
2  * @file
3  * @brief Client game mode interface
4  */
5 
6 /*
7 Copyright (C) 2002-2011 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23 
24 */
25 
26 #pragma once
27 
28 #include "../../common/xml.h"
29 #include "../../common/http.h"
30 
31 struct cgame_import_s;
32 
33 typedef struct cgame_export_s {
34 	/** the name of this cgame mode - only for console output */
35 	const char* name;
36 	const char* menu;
37 	int isMultiplayer;
38 	void (EXPORT* Init) (void);
39 	void (EXPORT* Shutdown) (void);
40 	/** soldier spawn functions may differ between the different gametypes */
41 	bool (EXPORT* Spawn) (linkedList_t** chrList);
42 	/** some gametypes only support special maps */
43 	const mapDef_t* (EXPORT* MapInfo) (int step);
44 	/** some gametypes require extra data in the results parsing (like e.g. campaign mode) */
45 	void (EXPORT* Results) (dbuffer* msg, int, int*, int*, int[][MAX_TEAMS], int[][MAX_TEAMS], bool nextmap);
46 	/** check whether the given item is usable in the current game mode */
47 	bool (EXPORT* IsItemUseable) (const objDef_t* od);
48 	/** if you want to display a different model for the given object in your game mode, implement this function */
49 	const char* (EXPORT* GetModelForItem) (const char* string);
50 	/** returns the equipment definition the game mode is using */
51 	equipDef_t* (EXPORT* GetEquipmentDefinition) (void);
52 	/** update character display values for game type dependent stuff */
53 	void (EXPORT* UpdateCharacterValues) (const character_t* chr);
54 	/** checks whether the given team is known in the particular gamemode */
55 	bool (EXPORT* IsTeamKnown) (const teamDef_t* teamDef);
56 	/** returns the selected character */
57 	character_t* (EXPORT* GetSelectedChr) (void);
58 	/** if you want to have a different control on how much a soldier can carry implement this (but max is still limited to actor strength) */
59 	int (EXPORT* GetChrMaxLoad) (const character_t* chr);
60 	/** called on errors */
61 	void (EXPORT* Drop) (void);
62 	/** called after the team spawn messages where send, can e.g. be used to set initial actor states */
63 	dbuffer* (EXPORT* InitializeBattlescape) (const linkedList_t* team);
64 	/** callback that is executed every frame */
65 	void (EXPORT* RunFrame) (float secondsSinceLastFrame);
66 	void (EXPORT* HandleBaseClick) (int baseIdx, int key, int col, int row);
67 	void (EXPORT* DrawBase) (int baseIdx, int x, int y, int w, int h, int col, int row, bool hover, int overlap);
68 	void (EXPORT* DrawBaseLayout) (int baseIdx, int x, int y, int totalMarge, int w, int h, int padding, const vec4_t bgcolor, const vec4_t color);
69 	void (EXPORT* DrawBaseTooltip) (int baseIdx, int x, int y, int col, int row);
70 	void (EXPORT* EndRoundAnnounce) (int playerNum, int team);
71 	void (EXPORT* StartBattlescape) (bool isTeamPlay);
72 	void (EXPORT* InitMissionBriefing) (const char** title, linkedList_t** victoryConditionsMsgIDs, linkedList_t** missionBriefingMsgIDs);
73 	const char* (EXPORT* GetTeamDef) (void);
74 	void (EXPORT* NotifyEvent) (event_t eventType);
75 	void (EXPORT* AddChatMessage) (const char* message);
76 	bool (EXPORT* HandleServerCommand) (const char* command, dbuffer* msg);
77 
78 	void (EXPORT* MapDraw) (geoscapeData_t* data);
79 	void (EXPORT* MapDrawMarkers) (const uiNode_t* node);
80 	void (EXPORT* MapClick) (const uiNode_t* node, int x, int y, const vec2_t pos);
81 } cgame_export_t;
82 
83 typedef struct cgameType_s {
84 	char id[MAX_VAR];		/**< the id is also the file basename */
85 	char window[MAX_VAR];	/**< the ui window id where this game type should become active for */
86 	char name[MAX_VAR];		/**< translatable ui name */
87 	linkedList_t* equipmentList; /**< the list of valid equipment definitions for this gametype - if this
88 								 * is @c nullptr, every equipment may be used */
89 } cgameType_t;
90 
91 typedef enum {
92 	FORWARD,
93 	BACKWARD,
94 	INIT
95 } changeEquipType_t;
96 
97 /** @todo define the import interface */
98 typedef struct cgame_import_s {
99 	csi_t* csi;
100 	Inventory** ui_inventory;
101 	const cgameType_t* cgameType;
102 
103 	/* UI functions */
104 	void (IMPORT* UI_ExecuteConfunc) (const char* fmt, ...) __attribute__((format(__printf__, 1, 2)));
105 	void (IMPORT* UI_PopWindow) (bool all);
106 	void (IMPORT* UI_PushWindow) (const char* name);
107 	void (IMPORT* UI_InitStack) (const char* activeMenu, const char* mainMenu);
108 	void (IMPORT* UI_Popup) (const char* title, const char* format, ...);
109 	uiNode_t* (IMPORT* UI_AddOption) (uiNode_t** tree, const char* name, const char* label, const char* value);
110 	void (IMPORT* UI_RegisterOption) (int dataId, uiNode_t* option);
111 	void (IMPORT* UI_RegisterText) (int textId, const char* text);
112 	void (IMPORT* UI_ResetData) (int dataId);
113 	void (IMPORT* UI_RegisterLinkedListText) (int textId, linkedList_t* text);
114 	struct uiMessageListNodeMessage_s* (IMPORT* UI_MessageGetStack) (void);
115 	void (IMPORT* UI_MessageAddStack) (struct uiMessageListNodeMessage_s*);
116 	void (IMPORT* UI_MessageResetStack) (void);
117 	void (IMPORT* UI_TextScrollEnd) (const char* nodePath);
118 	void (IMPORT* UI_TextNodeSelectLine) (uiNode_t* node, int num);
119 	uiNode_t* (IMPORT* UI_PopupList) (const char* title, const char* headline, linkedList_t* entries, const char* clickAction);
120 	void (IMPORT* UI_UpdateInvisOptions) (uiNode_t* option, const linkedList_t* stringList);
121 	void (IMPORT* HUD_InitUI) (const char* optionWindowName);
122 	void (IMPORT* HUD_DisplayMessage) (const char* text);
123 	uiNode_t* (IMPORT* UI_GetOption) (int dataId);
124 	void (IMPORT* UI_SortOptions) (uiNode_t** first);
125 	int (IMPORT* UI_DrawString) (const char* fontID, align_t align, int x, int y, const char* c);
126 	const char*  (IMPORT* UI_GetFontFromNode) (const uiNode_t*  const node);
127 	void (IMPORT* UI_DrawNormImageByName) (bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char* name);
128 	void (IMPORT* UI_DrawRect) (int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern);
129 	void (IMPORT* UI_DrawFill) (int x, int y, int w, int h, const vec4_t color);
130 	int (IMPORT* UI_DrawTooltip) (const char* string, int x, int y, int maxWidth);
131 	void (IMPORT* UI_GetNodeAbsPos) (const uiNode_t* node, vec2_t pos);
132 	void (IMPORT* UI_PopupButton) (const char* title, const char* text, const char* clickAction1, const char* clickText1, const char* tooltip1,
133 		const char* clickAction2, const char* clickText2, const char* tooltip2, const char* clickAction3, const char* clickText3, const char* tooltip3);
134 	uiSprite_t* (IMPORT* UI_GetSpriteByName) (const char* name);
135 	void (IMPORT* UI_ContainerNodeUpdateEquipment) (Inventory* inv, const equipDef_t* ed);
136 	void (IMPORT* UI_RegisterLineStrip) (int dataId, struct lineStrip_s* lineStrip);
137 	uiNode_t* (IMPORT* UI_GetNodeByPath) (const char* path);
138 	void (IMPORT* UI_DisplayNotice) (const char* text, int time, const char* windowName);
139 	const char* (IMPORT* UI_GetActiveWindowName) (void);
140 
141 	const char* (IMPORT* CL_Translate) (const char* t);
142 
143 	void (IMPORT* LIST_PrependString) (linkedList_t** listDest, const char* data);
144 	void (IMPORT* LIST_AddString) (linkedList_t** list, const char* data);
145 	void (IMPORT* LIST_AddStringSorted) (linkedList_t** listDest, const char* data);
146 	void (IMPORT* LIST_AddPointer) (linkedList_t** listDest, void* data);
147 	linkedList_t* (IMPORT* LIST_Add) (linkedList_t** list, void const* data, size_t length);
148 	const linkedList_t* (IMPORT* LIST_ContainsString) (const linkedList_t* list, const char* string);
149 	linkedList_t* (IMPORT* LIST_GetPointer) (linkedList_t* list, const void* data);
150 	void (IMPORT* LIST_Delete) (linkedList_t** list);
151 	bool (IMPORT* LIST_RemoveEntry) (linkedList_t** list, linkedList_t* entry);
152 	bool (IMPORT* LIST_IsEmpty) (const linkedList_t* list);
153 	int (IMPORT* LIST_Count) (const linkedList_t* list);
154 	linkedList_t* (IMPORT* LIST_CopyStructure) (linkedList_t* src);
155 	void *(IMPORT* LIST_GetByIdx) (linkedList_t* list, int index);
156 	bool (IMPORT* LIST_Remove) (linkedList_t** list, const void *data);
157 	void (IMPORT* LIST_Sort) (linkedList_t** list, linkedListSort_t sorter, const void* userData);
158 	void* (IMPORT* LIST_GetRandom) (linkedList_t* list);
159 
160 	void (IMPORT* SV_ShutdownWhenEmpty) (void);
161 	void (IMPORT* SV_Shutdown) (const char* finalmsg, bool reconnect);
162 
163 	int (IMPORT* CL_GetPlayerNum) (void);
164 	const char* (IMPORT* CL_PlayerGetName) (unsigned int player);
165 	int (IMPORT* CL_Milliseconds) (void);
166 	void (IMPORT* CL_Drop) (void);
167 	void (IMPORT* CL_QueryMasterServer) (const char* action, http_callback_t callback);
168 	void (IMPORT* CL_SetClientState) (connstate_t state);
169 	int (IMPORT* CL_GetClientState) (void);
170 	void (IMPORT* CL_Disconnect) (void);
171 
172 	void (IMPORT* GAME_SwitchCurrentSelectedMap) (int step);
173 	const mapDef_t* (IMPORT* GAME_GetCurrentSelectedMap) (void);
174 	int (IMPORT* GAME_GetCurrentTeam) (void);
175 	char* (IMPORT* GAME_StrDup) (const char* string);
176 	void (IMPORT* GAME_AutoTeam) (const char* equipmentDefinitionID, int teamMembers);
177 	const equipDef_t* (IMPORT* GAME_ChangeEquip) (const linkedList_t* equipmentList, changeEquipType_t changeType, const char* equipID);
178 	size_t (IMPORT* GAME_GetCharacterArraySize) (void);
179 	bool (IMPORT* GAME_IsTeamEmpty) (void);
180 	bool (IMPORT* GAME_LoadDefaultTeam) (bool force);
181 	void (IMPORT* GAME_SetServerInfo) (const char* server, const char* serverport);
182 	void (IMPORT* GAME_AppendTeamMember) (int memberIndex, const char* teamDefID, const equipDef_t* ed);
183 	void (IMPORT* GAME_ReloadMode) (void);
184 	int (IMPORT* GAME_GetChrMaxLoad) (const character_t* chr);
185 	void (IMPORT* Free) (void *ptr);
186 
187 	/* sound functions */
188 	void (IMPORT* S_StartLocalSample) (const char* s, float volume);
189 	void (IMPORT* S_SetSampleRepeatRate) (int sampleRepeatRate);
190 
191 	/* renderer functions */
192 	void (IMPORT* R_SoftenTexture) (byte *in, int width, int height, int bpp);
193 	void (IMPORT* R_LoadImage) (const char* name, byte** pic, int *width, int *height);
194 	bool (IMPORT* R_ImageExists) (const char* pname, ...) __attribute__((format(__printf__, 1, 2)));
195 	void (IMPORT* R_Color) (const vec4_t rgba);
196 	void (IMPORT* R_DrawLineStrip) (int points, int *verts);
197 	void (IMPORT* R_DrawLine) (int *verts, float thickness);
198 	void (IMPORT* R_DrawRect) (int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern);
199 	void (IMPORT* R_DrawFill) (int x, int y, int w, int h, const vec4_t color);
200 	void (IMPORT* R_Draw2DMapMarkers) (const vec2_t screenPos, float direction, const char* model, int skin);
201 	void (IMPORT* 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);
202 	void (IMPORT* R_DrawBloom) (void);
203 	void (IMPORT* R_UploadAlpha) (const char* name, const byte *alphaData);
204 	void (IMPORT* R_DrawImageCentered) (int x, int y, const char* name);
205 
206 	dbuffer* (IMPORT* NET_ReadMsg)  (struct net_stream *s);
207 	int (IMPORT* NET_ReadByte)  (dbuffer* buf);
208 	int (IMPORT* NET_ReadStringLine)  (dbuffer* buf, char* string, size_t length);
209 	int (IMPORT* NET_ReadString)  (dbuffer* buf, char* string, size_t length);
210 	struct net_stream *(IMPORT* NET_Connect)  (const char* node, const char* service, stream_onclose_func* onclose);
211 	void (IMPORT* NET_StreamSetCallback)  (struct net_stream *s, stream_callback_func* func);
212 	void (IMPORT* NET_OOB_Printf) (struct net_stream *s, const char* format, ...) __attribute__((format(__printf__,2,3)));
213 	void (IMPORT* NET_OOB_Printf2) (const char* format, ...) __attribute__((format(__printf__,1,2)));
214 	void *(IMPORT* NET_StreamGetData) (struct net_stream *s);
215 	void (IMPORT* NET_StreamSetData) (struct net_stream *s, void *data);
216 	void (IMPORT* NET_StreamFree) (struct net_stream *s);
217 	const char* (IMPORT* NET_StreamPeerToName) (struct net_stream *s, char* dst, int len, bool appendPort);
218 	void (IMPORT* NET_SockaddrToStrings) (struct datagram_socket* s, struct sockaddr* addr, char* node, size_t nodelen, char* service, size_t servicelen);
219 	struct datagram_socket* (IMPORT* NET_DatagramSocketNew) (const char* node, const char* service, datagram_callback_func* func);
220 	void (IMPORT* NET_DatagramBroadcast) (struct datagram_socket* s, const char* buf, int len, int port);
221 	void (IMPORT* NET_DatagramSocketClose) (struct datagram_socket* s);
222 
223 	/* xml functions */
224 	xmlNode_t*  (IMPORT* XML_AddNode) (xmlNode_t* parent, const char* name);
225 	void (IMPORT* XML_AddString) (xmlNode_t* parent, const char* name, const char* value);
226 	void (IMPORT* XML_AddBool) (xmlNode_t* parent, const char* name, bool value);
227 	void (IMPORT* XML_AddFloat) (xmlNode_t* parent, const char* name, float value);
228 	void (IMPORT* XML_AddDouble) (xmlNode_t* parent, const char* name, double value);
229 	void (IMPORT* XML_AddByte) (xmlNode_t* parent, const char* name, byte value);
230 	void (IMPORT* XML_AddShort) (xmlNode_t* parent, const char* name, short value);
231 	void (IMPORT* XML_AddInt) (xmlNode_t* parent, const char* name, int value);
232 	void (IMPORT* XML_AddLong) (xmlNode_t* parent, const char* name, long value);
233 	void (IMPORT* XML_AddPos3) (xmlNode_t* parent, const char* name, const vec3_t pos);
234 	void (IMPORT* XML_AddPos2) (xmlNode_t* parent, const char* name, const vec2_t pos);
235 	void (IMPORT* XML_AddDate) (xmlNode_t* parent, const char* name, const int day, const int sec);
236 	void (IMPORT* XML_AddStringValue) (xmlNode_t* parent, const char* name, const char* value);
237 	void (IMPORT* XML_AddBoolValue) (xmlNode_t* parent, const char* name, bool value);
238 	void (IMPORT* XML_AddFloatValue) (xmlNode_t* parent, const char* name, float value);
239 	void (IMPORT* XML_AddDoubleValue) (xmlNode_t* parent, const char* name, double value);
240 	void (IMPORT* XML_AddByteValue) (xmlNode_t* parent, const char* name, byte value);
241 	void (IMPORT* XML_AddShortValue) (xmlNode_t* parent, const char* name, short value);
242 	void (IMPORT* XML_AddIntValue) (xmlNode_t* parent, const char* name, int value);
243 	void (IMPORT* XML_AddLongValue) (xmlNode_t* parent, const char* name, long value);
244 
245 	bool (IMPORT* XML_GetBool) (xmlNode_t* parent, const char* name, const bool defaultval);
246 	int (IMPORT* XML_GetInt) (xmlNode_t* parent, const char* name, const int defaultval);
247 	short (IMPORT* XML_GetShort) (xmlNode_t* parent, const char* name, const short defaultval);
248 	long (IMPORT* XML_GetLong) (xmlNode_t* parent, const char* name, const long defaultval);
249 	const char*  (IMPORT* XML_GetString) (xmlNode_t* parent, const char* name);
250 	float (IMPORT* XML_GetFloat) (xmlNode_t* parent, const char* name, const float defaultval);
251 	double (IMPORT* XML_GetDouble) (xmlNode_t* parent, const char* name, const double defaultval);
252 	xmlNode_t* (IMPORT* XML_Parse) (const char* buffer);
253 	xmlNode_t*  (IMPORT* XML_GetPos2) (xmlNode_t* parent, const char* name, vec2_t pos);
254 	xmlNode_t*  (IMPORT* XML_GetNextPos2) (xmlNode_t* actual, xmlNode_t* parent, const char* name, vec2_t pos);
255 	xmlNode_t*  (IMPORT* XML_GetPos3) (xmlNode_t* parent, const char* name, vec3_t pos);
256 	xmlNode_t*  (IMPORT* XML_GetNextPos3) (xmlNode_t* actual, xmlNode_t* parent, const char* name, vec3_t pos);
257 	xmlNode_t*  (IMPORT* XML_GetDate) (xmlNode_t* parent, const char* name, int *day, int *sec);
258 	xmlNode_t*  (IMPORT* XML_GetNode) (xmlNode_t* parent, const char* name);
259 	xmlNode_t*  (IMPORT* XML_GetNextNode) (xmlNode_t* current, xmlNode_t* parent, const char* name);
260 
261 	/* filesystem functions */
262 	int (IMPORT* FS_LoadFile) (const char* path, byte** buffer);
263 	void (IMPORT* FS_FreeFile) (void *buffer);
264 	int (IMPORT* FS_CheckFile) (const char* fmt, ...) __attribute__((format(__printf__, 1, 2)));
265 	int (IMPORT* FS_BuildFileList) (const char* files);
266 	const char* (IMPORT* FS_NextFileFromFileList) (const char* files);
267 	char* (IMPORT* FS_NextScriptHeader) (const char* files, const char** name, const char** text);
268 
269 	/* console variable interaction */
270 	cvar_t* (IMPORT* Cvar_Get) (const char* varName, const char* value, int flags, const char* desc);
271 	cvar_t* (IMPORT* Cvar_Set) (const char* varName, const char* value, ...) __attribute__((format(__printf__, 2, 3)));
272 	void (IMPORT* Cvar_SetValue) (const char* varName, float value);
273 	const char* (IMPORT* Cvar_GetString) (const char* varName);
274 	int (IMPORT* Cvar_GetInteger) (const char* varName);
275 	const char* (IMPORT* Cvar_VariableStringOld) (const char* varName);
276 	float (IMPORT* Cvar_GetValue) (const char* varName);
277 	bool (IMPORT* Cvar_Delete) (const char* varName);
278 	cvar_t*  (IMPORT* Cvar_ForceSet) (const char* varName, const char* value);
279 
280 	/* ClientCommand and ServerCommand parameter access */
281 	int (IMPORT* Cmd_Argc) (void);
282 	const char* (IMPORT* Cmd_Argv) (int n);
283 	const char* (IMPORT* Cmd_Args) (void);		/**< concatenation of all argv >= 1 */
284 	void (IMPORT* Cmd_AddCommand) (const char* cmdName, xcommand_t function, const char* desc);
285 	void (IMPORT* Cmd_RemoveCommand) (const char* cmdName);
286 	void (IMPORT* Cmd_ExecuteString) (const char* text, ...) __attribute__((format(__printf__, 1, 2)));
287 	void (IMPORT* Cmd_AddParamCompleteFunction) (const char* cmd_name, int (*function)(const char* partial, const char** match));
288 	bool (IMPORT* Cmd_GenericCompleteFunction) (char const* candidate, char const* partial, char const** match);
289 	mapDef_t* (IMPORT* Com_GetMapDefinitionByID) (const char* mapDefID);
290 
291 	void (IMPORT* Cbuf_AddText) (const char* format, ...) __attribute__((format(__printf__, 1, 2)));
292 	void (IMPORT* Cbuf_Execute) (void);
293 
294 	void (IMPORT* Sys_Error) (const char* error, ...) __attribute__((noreturn, format(__printf__, 1, 2)));
295 	int (IMPORT* Com_ServerState) (void);
296 	void (IMPORT* Com_SetGameType) (void);
297 	void (IMPORT* Com_Error) (int code, const char* fmt, ...) __attribute__((noreturn, format(__printf__, 2, 3)));
298 	void (IMPORT* Com_Printf) (const char* msg, ...) __attribute__((format(__printf__, 1, 2)));
299 	void (IMPORT* Com_DPrintf) (int level, const char* msg, ...) __attribute__((format(__printf__, 2, 3)));
300 	const char* (IMPORT* Com_DropShipTypeToShortName) (humanAircraftType_t type);
301 	const char* (IMPORT* Com_UFOCrashedTypeToShortName) (ufoType_t type);
302 	const char* (IMPORT* Com_UFOTypeToShortName) (ufoType_t type);
303 	const char* (IMPORT* Com_GetRandomMapAssemblyNameForCraft) (const char* craftID);
304 	void (IMPORT* Com_RegisterConstInt) (const char* name, int value);
305 	bool (IMPORT* Com_UnregisterConstVariable) (const char* name);
306 	void (IMPORT* Com_RegisterConstList) (const constListEntry_t constList[]);
307 	bool (IMPORT* Com_UnregisterConstList) (const constListEntry_t constList[]);
308 	const char* (IMPORT* Com_GetConstVariable) (const char* space, int value);
309 	bool (IMPORT* Com_GetConstIntFromNamespace) (const char* space, const char* variable, int *value);
310 	bool (IMPORT* Com_GetConstInt) (const char* name, int *value);
311 	const char* (IMPORT* Com_EParse) (const char** text, const char* errhead, const char* errinfo);
312 	int (IMPORT* Com_EParseValue) (void *base, const char* token, valueTypes_t type, int ofs, size_t size);
313 	const char* (IMPORT* Com_ValueToStr) (const void *base, const valueTypes_t type, const int ofs);
314 	const teamDef_t* (IMPORT* Com_GetTeamDefinitionByID) (const char* team);
315 	ufoType_t (IMPORT* Com_UFOShortNameToID) (const char* token);
316 	const char* (IMPORT* Com_GetRandomMapAssemblyNameForCrashedCraft) (const char* craftID);
317 	void (IMPORT* Com_Drop) (void);
318 	const ugv_t* (IMPORT* Com_GetUGVByID) (const char* ugvID);
319 	const ugv_t* (IMPORT* Com_GetUGVByIDSilent) (const char* ugvID);
320 	humanAircraftType_t (IMPORT* Com_DropShipShortNameToID) (const char* token);
321 
322 	void (IMPORT* CL_GenerateCharacter) (character_t* chr, const char* teamDefName);
323 	bool (IMPORT* CL_OnBattlescape) (void);
324 
325 	void (IMPORT* SetNextUniqueCharacterNumber) (int ucn);
326 	int (IMPORT* GetNextUniqueCharacterNumber) (void);
327 
328 	void (IMPORT* CollectItems) (void *target, int won, void (*item)(void*, const objDef_t*, int), void (*ammo) (void *, const Item *), void (*ownitems) (const Inventory*));
329 	void (IMPORT* CollectAliens) (void *data, void (*collect)(void*, const teamDef_t*, int, bool));
330 
331 	const equipDef_t* (IMPORT* INV_GetEquipmentDefinitionByID) (const char* name);
332 	void (IMPORT* INV_DestroyInventory) (Inventory* const i) __attribute__((nonnull(1)));
333 	void (IMPORT* INV_EquipActor) (character_t* const chr, const equipDef_t* ed, int maxWeight);
334 	void (IMPORT* INV_EquipActorMelee) (Inventory* const inv, const teamDef_t* td);
335 	void (IMPORT* INV_EquipActorRobot) (Inventory* const inv, const objDef_t* weapon);
336 	bool (IMPORT* INV_RemoveFromInventory) (Inventory* const i, const invDef_t*  container, Item *fItem);
337 
338 	void (IMPORT* INV_ItemDescription) (const objDef_t* od);
339 
340 	void (IMPORT* WEB_Upload) (int category, const char* filename);
341 	void (IMPORT* WEB_Delete) (int category, const char* filename);
342 	void (IMPORT* WEB_DownloadFromUser) (int category, const char* filename, int userId);
343 	void (IMPORT* WEB_ListForUser) (int category, int userId);
344 
345 	const char* (IMPORT* GetRelativeSavePath) (char* buf, size_t bufSize);
346 	const char* (IMPORT* GetAbsoluteSavePath) (char* buf, size_t bufSize);
347 
348 	/** @todo: remove me */
349 	byte *r_xviAlpha;
350 	byte *r_radarPic;
351 	byte *r_radarSourcePic;
352 } cgame_import_t;
353 
354 extern "C" const cgame_export_t* GetCGameAPI(const cgame_import_t* import);
355 
356 typedef const cgame_export_t* (*cgame_api_t) (const cgame_import_t*);
357