00001
00024 #include "message.h"
00025
00026
00027 #include <SDL.h>
00028
00036 struct GameOptions_t {
00041 Uint32 duration;
00045 Sint16 teamScore[TEAM_MAX];
00049 Sint16 winScore;
00054 Uint16 width;
00059 Uint16 height;
00063 Uint16 obstacles;
00067 Uint16 totalMsgs;
00073 Uint16 rcvdMsgs;
00077 Uint8 spawnAreas[TEAM_MAX];
00081 Uint8 goalAreas[TEAM_MAX];
00089 Uint8 flags;
00090 };
00091
00092 typedef struct GameOptions_t GameOptions;
00093
00094 enum GAME_OPT_FLAGS {
00100 OPT_ISSET = 1,
00106 OPT_ERROR = 2,
00110 OPT_USEGUIDEDSHELL = 4,
00114 OPT_USEPONGSHELL = 8,
00119 OPT_ISCTF = 16,
00125 OPT_ISWINSCOREABS = 32,
00130 OPT_ALLOWDRAW = 64,
00135 OPT_UPDATESCORE = 128
00136 };
00137
00141 extern GameOptions gameOpts;
00142
00147 extern SDL_Rect *spawnAreas[TEAM_MAX];
00148
00153 extern SDL_Rect *goalAreas[TEAM_MAX];
00154
00155 #define BFLDERRLEN 120
00156
00161 struct BattleFieldError_t {
00167 int line;
00171 char file[80];
00175 rtsa_char msg[BFLDERRLEN];
00176 };
00177
00178 typedef struct BattleFieldError_t BattleFieldError;
00179
00184 extern BattleFieldError bfErr;
00185
00249 #define MAX_OBSTACLES_PER_MSG 62
00250
00262 Bool InitGameConfig(const char *fname);
00263
00269 void UninitGameConfig();
00270
00277 void AddToConfigList(ClientData *client);
00278
00286 void RemoveFromConfigList(ClientData *client);
00287
00292 ClientData *configListStart;
00293
00298 ClientData *configListEnd;
00299
00307 Bool ServiceGameConfig();
00308
00319 Bool HandleGameOption(SocketAddr *origin, NetBuffer *buffer, Uint8 *unused,
00320 Uint16 noid);
00321
00333 Bool HandleObstacle(SocketAddr *origin, NetBuffer *buffer, Uint8 *unused,
00334 Uint16 noid);
00335
00347 Bool HandleArea(SocketAddr *origin, NetBuffer *buffer, Uint8 *unused,
00348 Uint16 noid);
00349
00360 Bool HandleScoreUpdate(SocketAddr *origin, NetBuffer *buffer, Uint8 *unused,
00361 Uint16 noid);
00362
00367 struct ScoreUpdate_t {
00371 Uint8 killerId;
00375 Uint8 killedId;
00376 };
00377
00378 typedef struct ScoreUpdate_t ScoreUpdate;
00379
00387 Bool SendScoreUpdate(ScoreUpdate *scores, int len);
00388