1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: p_ctf.h 4469 2014-01-03 23:38:29Z dr_sean $
5 //
6 // Copyright (C) 2006-2014 by The Odamex Team.
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // DESCRIPTION:
19 //	 CTF Implementation
20 //
21 //-----------------------------------------------------------------------------
22 
23 #ifndef __P_CTF_H__
24 #define __P_CTF_H__
25 
26 #include "d_netinf.h"
27 #include "p_local.h"
28 
29 //	Map ID for flags
30 #define	ID_BLUE_FLAG	5130
31 #define	ID_RED_FLAG		5131
32 // Reserve for maintaining the DOOM CTF standard.
33 //#define ID_NEUTRAL_FLAG	5132
34 //#define ID_TEAM3_FLAG	5133
35 //#define ID_TEAM4_FLAG	5134
36 
37 // flags can only be in one of these states
38 enum flag_state_t
39 {
40 	flag_home,
41 	flag_dropped,
42 	flag_carried,
43 
44 	NUMFLAGSTATES
45 };
46 
47 // data associated with a flag
48 struct flagdata
49 {
50 	// Does this flag have a spawn yet?
51 	bool flaglocated;
52 
53 	// Actor when being carried by a player, follows player
54 	AActor::AActorPtr actor;
55 
56 	// Integer representation of WHO has each flag (player id)
57 	byte flagger;
58 	int	pickup_time;
59 
60 	// Flag locations
61 	int x, y, z;
62 
63 	// Flag Timout Counters
64 	int timeout;
65 
66 	// True when a flag has been dropped
67 	flag_state_t state;
68 
69 	// Used for the blinking flag indicator on the statusbar
70 	int sb_tick;
71 };
72 
73 // events
74 enum flag_score_t
75 {
76 	SCORE_NONE,
77 	SCORE_REFRESH,
78 	SCORE_KILL,
79 	SCORE_BETRAYAL,
80 	SCORE_GRAB,
81 	SCORE_FIRSTGRAB,
82 	SCORE_CARRIERKILL,
83 	SCORE_RETURN,
84 	SCORE_CAPTURE,
85 	SCORE_DROP,
86 	SCORE_MANUALRETURN,
87 	NUM_CTF_SCORE
88 };
89 
90 //	Network Events
91 // [CG] I'm aware having CL_* and SV_* functions in common/ is not great, I'll
92 //      do more work on CTF and team-related things later.
93 void CL_CTFEvent(void);
94 void SV_CTFEvent(flag_t f, flag_score_t event, player_t &who);
95 bool SV_FlagTouch(player_t &player, flag_t f, bool firstgrab);
96 void SV_SocketTouch(player_t &player, flag_t f);
97 void CTF_Connect(player_t &player);
98 
99 //	Internal Events
100 void CTF_DrawHud(void);
101 void CTF_CarryFlag(player_t &who, flag_t flag);
102 void CTF_MoveFlags(void);
103 void CTF_RunTics(void);
104 void CTF_SpawnFlag(flag_t f);
105 void CTF_SpawnDroppedFlag(flag_t f, int x, int y, int z);
106 void CTF_RememberFlagPos(mapthing2_t *mthing);
107 void CTF_CheckFlags(player_t &player);
108 void CTF_Sound(flag_t f, flag_score_t event);
109 void CTF_Message(flag_t f, flag_score_t event);
110 // void CTF_TossFlag(player_t &player);  [ML] 04/4/06: Removed buggy flagtoss
111 // void CTF_SpawnPlayer(player_t &player);	// denis - todo - where's the implementation!?
112 
113 //	Externals
114 // EXTERN_CVAR (sv_scorelimit)
115 
116 // CTF Game Data
117 extern flagdata CTFdata[NUMFLAGS];
118 extern int TEAMpoints[NUMFLAGS];
119 extern const char *team_names[NUMTEAMS+2];
120 
121 FArchive &operator<< (FArchive &arc, flagdata &flag);
122 FArchive &operator>> (FArchive &arc, flagdata &flag);
123 
124 //	Colors
125 #define	BLUECOLOR		200
126 #define	REDCOLOR		176
127 
128 #endif
129 
130