cgame.h

Go to the documentation of this file.
00001 
00006 /*
00007 Copyright (C) 2002-2010 UFO: Alien Invasion.
00008 
00009 This program is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2
00012 of the License, or (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018 See the GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 
00024 */
00025 
00026 #ifndef CL_CGAME_H
00027 #define CL_CGAME_H
00028 
00029 #include "mxml/mxml.h"
00030 
00031 typedef struct {
00032     const char *name;
00033     const char *menu;
00034     int gametype;
00035     void (EXPORT *Init) (void);
00036     void (EXPORT *Shutdown) (void);
00038     qboolean (EXPORT *Spawn) (void);
00040     int (EXPORT *GetTeam) (void);
00042     const mapDef_t* (EXPORT *MapInfo) (int step);
00044     void (EXPORT *Results) (struct dbuffer *msg, int, int*, int*, int[][MAX_TEAMS], int[][MAX_TEAMS]);
00046     qboolean (EXPORT *IsItemUseable) (const objDef_t *od);
00048     void (EXPORT *DisplayItemInfo) (uiNode_t *node, const char *string);
00050     equipDef_t* (EXPORT *GetEquipmentDefinition) (void);
00052     void (EXPORT *UpdateCharacterValues) (const character_t *chr);
00054     qboolean (EXPORT *IsTeamKnown) (const teamDef_t *teamDef);
00056     void (EXPORT *Drop) (void);
00058     void (EXPORT *InitializeBattlescape) (const chrList_t *team);
00060     void (EXPORT *RunFrame) (void);
00062     const char* (EXPORT *GetModelForItem) (const objDef_t*od);
00063     void (EXPORT *EndRoundAnnounce) (int playerNum, int team);
00064     void (EXPORT *StartBattlescape) (qboolean isTeamPlay);
00065 } cgame_export_t;
00066 
00068 typedef struct {
00069     csi_t *csi;
00070     client_static_t *cls;
00071     client_state_t *cl;
00072 
00073     /* menu functions */
00074     void (IMPORT *UI_ExecuteConfunc) (const char *fmt, ...) __attribute__((format(printf, 1, 2)));
00075     void (IMPORT *UI_PopWindow) (qboolean all);
00076     uiNode_t* (IMPORT *UI_PushWindow) (const char *name, const char *parentName);
00077     void (IMPORT *UI_InitStack) (const char* activeMenu, const char* mainMenu, qboolean popAll, qboolean pushActive);
00078     void (IMPORT *UI_Popup) (const char *title, const char *text);
00079     uiNode_t* (IMPORT *UI_AddOption) (uiNode_t** tree, const char* name, const char* label, const char* value);
00080     void (IMPORT *UI_RegisterOption) (int dataId, uiNode_t *option);
00081     void (IMPORT *UI_RegisterText) (int textId, const char *text);
00082     void (IMPORT *UI_ResetData) (int dataId);
00083     void (IMPORT *UI_RegisterLinkedListText) (int textId, linkedList_t *text);
00084     void (IMPORT *UI_TextNodeSelectLine) (uiNode_t *node, int num);
00085     uiNode_t *(IMPORT *UI_PopupList) (const char *title, const char *headline, linkedList_t* entries, const char *clickAction);
00086 
00087     /* xml functions */
00088     mxml_node_t * (IMPORT *mxml_AddNode) (mxml_node_t *parent, const char *name);
00089     void (IMPORT *mxml_AddString) (mxml_node_t *parent, const char *name, const char *value);
00090     void (IMPORT *mxml_AddBool) (mxml_node_t *parent, const char *name, qboolean value);
00091     void (IMPORT *mxml_AddFloat) (mxml_node_t *parent, const char *name, float value);
00092     void (IMPORT *mxml_AddDouble) (mxml_node_t *parent, const char *name, double value);
00093     void (IMPORT *mxml_AddByte) (mxml_node_t *parent, const char *name, byte value);
00094     void (IMPORT *mxml_AddShort) (mxml_node_t *parent, const char *name, short value);
00095     void (IMPORT *mxml_AddInt) (mxml_node_t *parent, const char *name, int value);
00096     void (IMPORT *mxml_AddLong) (mxml_node_t *parent, const char *name, long value);
00097     void (IMPORT *mxml_AddPos3) (mxml_node_t *parent, const char *name, const vec3_t pos);
00098     void (IMPORT *mxml_AddPos2) (mxml_node_t *parent, const char *name, const vec2_t pos);
00099     void (IMPORT *mxml_AddDate) (mxml_node_t *parent, const char *name, const int day, const int sec);
00100     void (IMPORT *mxml_AddStringValue) (mxml_node_t *parent, const char *name, const char *value);
00101     void (IMPORT *mxml_AddBoolValue) (mxml_node_t *parent, const char *name, qboolean value);
00102     void (IMPORT *mxml_AddFloatValue) (mxml_node_t *parent, const char *name, float value);
00103     void (IMPORT *mxml_AddDoubleValue) (mxml_node_t *parent, const char *name, double value);
00104     void (IMPORT *mxml_AddByteValue) (mxml_node_t *parent, const char *name, byte value);
00105     void (IMPORT *mxml_AddShortValue) (mxml_node_t *parent, const char *name, short value);
00106     void (IMPORT *mxml_AddIntValue) (mxml_node_t *parent, const char *name, int value);
00107     void (IMPORT *mxml_AddLongValue) (mxml_node_t *parent, const char *name, long value);
00108 
00109     /* filesystem functions */
00110     int (IMPORT *FS_LoadFile) (const char *path, byte **buffer);
00111     void (IMPORT *FS_FreeFile) (void *buffer);
00112 
00113     /* console variable interaction */
00114     cvar_t *(IMPORT *Cvar_Get) (const char *varName, const char *value, int flags, const char* desc);
00115     cvar_t *(IMPORT *Cvar_Set) (const char *varName, const char *value);
00116     void (IMPORT *Cvar_SetValue) (const char *varName, float value);
00117     const char *(IMPORT *Cvar_String) (const char *varName);
00118     int (IMPORT *Cvar_Integer) (const char *varName);
00119     qboolean (IMPORT *Cvar_Delete) (const char *varName);
00120 
00121     /* sound functions */
00122     void (IMPORT *S_StartLocalSample) (const char *s, float volume);
00123     void (IMPORT *S_SetSampleRepeatRate) (int sampleRepeatRate);
00124 
00125     /* renderer functions */
00126     void (IMPORT *R_SoftenTexture) (byte *in, int width, int height, int bpp);
00127     void (IMPORT *R_UploadAlpha) (const image_t *image, const byte *alphaData);
00128     void (IMPORT *R_LoadImage) (const char *name, byte **pic, int *width, int *height);
00129     image_t *(IMPORT *R_LoadImageData) (const char *name, byte * pic, int width, int height, imagetype_t type);
00130 
00131     /* ClientCommand and ServerCommand parameter access */
00132     int (IMPORT *Cmd_Argc) (void);
00133     const char *(IMPORT *Cmd_Argv) (int n);
00134     const char *(IMPORT *Cmd_Args) (void);      
00135     void (IMPORT *Cmd_AddCommand) (const char *cmdName, xcommand_t function, const char *desc);
00136     void (IMPORT *Cmd_RemoveCommand) (const char *cmdName);
00137     void (IMPORT *Cmd_ExecuteString) (const char *text);
00138 } cgame_import_t;
00139 
00140 cgame_export_t *GetCGameAPI(cgame_import_t *import);
00141 
00142 #endif

Generated by  doxygen 1.6.2