Odamex
Setting the Standard in Multiplayer Doom
common/p_ctf.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*- 
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: p_ctf.h 1992 2010-11-18 17:35:33Z hypereye $
00005 //
00006 // Copyright (C) 2006-2010 by The Odamex Team.
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // DESCRIPTION:
00019 //       CTF Implementation
00020 //
00021 //-----------------------------------------------------------------------------
00022 
00023 #ifndef __P_CTF_H__
00024 #define __P_CTF_H__
00025 
00026 #include "d_netinf.h"
00027 #include "p_local.h"
00028 
00029 //      Map ID for flags
00030 #define ID_BLUE_FLAG    5130
00031 #define ID_RED_FLAG             5131
00032 // Reserve for maintaining the DOOM CTF standard.
00033 //#define ID_NEUTRAL_FLAG       5132
00034 //#define ID_TEAM3_FLAG 5133
00035 //#define ID_TEAM4_FLAG 5134
00036 
00037 // flags can only be in one of these states
00038 enum flag_state_t
00039 {
00040         flag_home,
00041         flag_dropped,
00042         flag_carried,
00043         
00044         NUMFLAGSTATES
00045 };
00046 
00047 // data associated with a flag
00048 struct flagdata
00049 {
00050         // Does this flag have a spawn yet?
00051         bool flaglocated;
00052         
00053         // Actor when being carried by a player, follows player
00054         AActor::AActorPtr actor;
00055 
00056         // Integer representation of WHO has each flag (player id)
00057         size_t flagger;
00058         int     pickup_time;
00059         
00060         // Flag locations
00061         int x, y, z;
00062         
00063         // Flag Timout Counters
00064         size_t timeout;
00065         
00066         // True when a flag has been dropped
00067         flag_state_t state;
00068 
00069         // Used for the blinking flag indicator on the statusbar
00070         int sb_tick;
00071 };
00072 
00073 // events
00074 enum flag_score_t
00075 {
00076         SCORE_NONE,
00077         SCORE_REFRESH,
00078         SCORE_KILL,
00079         SCORE_BETRAYAL,
00080         SCORE_GRAB,
00081         SCORE_FIRSTGRAB,
00082         SCORE_CARRIERKILL,
00083         SCORE_RETURN,
00084         SCORE_CAPTURE,
00085         SCORE_DROP,
00086         SCORE_MANUALRETURN,
00087         NUM_CTF_SCORE
00088 };
00089 
00090 //      Network Events
00091 // [CG] I'm aware having CL_* and SV_* functions in common/ is not great, I'll
00092 //      do more work on CTF and team-related things later.
00093 void CL_CTFEvent(void);
00094 void SV_CTFEvent(flag_t f, flag_score_t event, player_t &who);
00095 bool SV_FlagTouch(player_t &player, flag_t f, bool firstgrab);
00096 void SV_SocketTouch(player_t &player, flag_t f);
00097 void CTF_Connect(player_t &player);
00098 
00099 //      Internal Events
00100 void CTF_DrawHud(void);
00101 void CTF_CarryFlag(player_t &who, flag_t flag);
00102 void CTF_MoveFlags(void);
00103 void CTF_RunTics(void);
00104 void CTF_SpawnFlag(flag_t f);
00105 void CTF_SpawnDroppedFlag(flag_t f, int x, int y, int z);
00106 void CTF_RememberFlagPos(mapthing2_t *mthing);
00107 void CTF_CheckFlags(player_t &player);
00108 void CTF_Sound(flag_t f, flag_score_t event);
00109 // void CTF_TossFlag(player_t &player);  [ML] 04/4/06: Removed buggy flagtoss
00110 // void CTF_SpawnPlayer(player_t &player);      // denis - todo - where's the implementation!?
00111 mapthing2_t *CTF_SelectTeamPlaySpot(player_t &player, int selections);
00112 
00113 //      Externals
00114 // EXTERN_CVAR (sv_scorelimit)
00115 
00116 // CTF Game Data
00117 extern flagdata CTFdata[NUMFLAGS];
00118 extern int TEAMpoints[NUMFLAGS];
00119 extern char *team_names[NUMTEAMS+2];
00120 
00121 //      Colors
00122 #define BLUECOLOR               200
00123 #define REDCOLOR                176
00124 
00125 #endif
00126 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends