1 /*
2 ===========================================================================
3 Copyright (C) 2000 - 2013, Raven Software, Inc.
4 Copyright (C) 2001 - 2013, Activision, Inc.
5 Copyright (C) 2013 - 2015, OpenJK contributors
6 
7 This file is part of the OpenJK source code.
8 
9 OpenJK is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 as
11 published by the Free Software Foundation.
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 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 ===========================================================================
21 */
22 
23 #pragma once
24 
25 #define		MAX_SIEGE_INFO_SIZE					16384
26 
27 #define		SIEGETEAM_TEAM1						1 //e.g. TEAM_RED
28 #define		SIEGETEAM_TEAM2						2 //e.g. TEAM_BLUE
29 
30 #define		SIEGE_POINTS_OBJECTIVECOMPLETED		20
31 #define		SIEGE_POINTS_FINALOBJECTIVECOMPLETED	30
32 #define		SIEGE_POINTS_TEAMWONROUND			10
33 
34 #define		SIEGE_ROUND_BEGIN_TIME				5000 //delay 5 secs after players are in game.
35 
36 #define		MAX_SIEGE_CLASSES					128 //up to 128 classes
37 #define		MAX_SIEGE_CLASSES_PER_TEAM			16
38 
39 #define		MAX_SIEGE_TEAMS						16 //up to 16 diffent teams
40 
41 #define		MAX_EXDATA_ENTS_TO_SEND				MAX_CLIENTS //max number of extended data for ents to send
42 
43 // The basic siege player classes
44 typedef enum
45 {
46 	SPC_INFANTRY = 0,
47 	SPC_VANGUARD,
48 	SPC_SUPPORT,
49 	SPC_JEDI,
50 	SPC_DEMOLITIONIST,
51 	SPC_HEAVY_WEAPONS,
52 	SPC_MAX
53 } siegePlayerClassFlags_t;
54 
55 typedef enum
56 {
57 	CFL_MORESABERDMG = 0,
58 	CFL_STRONGAGAINSTPHYSICAL,
59 	CFL_FASTFORCEREGEN,
60 	CFL_STATVIEWER,
61 	CFL_HEAVYMELEE,
62 	CFL_SINGLE_ROCKET,//has only 1 rocket to use with rocketlauncher
63 	CFL_CUSTOMSKEL, //class uses a custom skeleton, be sure to load on server etc
64 	CFL_EXTRA_AMMO
65 } siegeClassFlags_t;
66 
67 
68 #define SIEGE_CLASS_DESC_LEN  4096
69 typedef struct siegeClassDesc_s {
70 	char		desc[SIEGE_CLASS_DESC_LEN];
71 } siegeClassDesc_t;
72 
73 typedef struct siegeClass_s {
74 	char		name[512];
75 	char		forcedModel[256];
76 	char		forcedSkin[256];
77 	char		saber1[SABER_NAME_LENGTH], saber2[SABER_NAME_LENGTH];
78 	int			saberStance;
79 	int			weapons;
80 	int			forcePowerLevels[NUM_FORCE_POWERS];
81 	int			classflags;
82 	int			maxhealth;
83 	int			starthealth;
84 	int			maxarmor;
85 	int			startarmor;
86 	float		speed;
87 	qboolean	hasForcedSaberColor;
88 	int			forcedSaberColor;
89 	qboolean	hasForcedSaber2Color;
90 	int			forcedSaber2Color;
91 	int			invenItems;
92 	int			powerups;
93 	int			uiPortraitShader;
94 	char		uiPortrait[256];
95 	int			classShader;
96 	short		playerClass;		// SPC_INFANTRY . ..
97 } siegeClass_t;
98 
99 typedef struct siegeTeam_s {
100 	char		name[512];
101 	siegeClass_t	*classes[MAX_SIEGE_CLASSES_PER_TEAM];
102 	int			numClasses;
103 	int			friendlyShader;
104 } siegeTeam_t;
105 
106 
107 extern siegeClass_t bgSiegeClasses[MAX_SIEGE_CLASSES];
108 extern int bgNumSiegeClasses;
109 
110 extern siegeTeam_t bgSiegeTeams[MAX_SIEGE_TEAMS];
111 extern int bgNumSiegeTeams;
112 
113 int BG_SiegeGetValueGroup(char *buf, char *group, char *outbuf);
114 int BG_SiegeGetPairedValue(char *buf, char *key, char *outbuf);
115 void BG_SiegeStripTabs(char *buf);
116 
117 void BG_SiegeLoadClasses(siegeClassDesc_t *descBuffer);
118 void BG_SiegeLoadTeams(void);
119 
120 siegeTeam_t *BG_SiegeFindThemeForTeam(int team);
121 void BG_PrecacheSabersForSiegeTeam(int team);
122 siegeClass_t *BG_SiegeFindClassByName(const char *classname);
123 qboolean BG_SiegeCheckClassLegality(int team, char *classname);
124 void BG_SiegeSetTeamTheme(int team, char *themeName);
125 int BG_SiegeFindClassIndexByName(const char *classname);
126 
127 // for ui
128 int BG_GetUIPortrait( const int team, const short classIndex, const short cntIndex );
129 char *BG_GetUIPortraitFile( const int team, const short classIndex, const short cntIndex );
130 siegeClass_t *BG_GetClassOnBaseClass( const int team, const short classIndex, const short cntIndex );
131 int BG_SiegeCountBaseClass( const int team, const short classIndex );
132 
133 extern char	siege_info[MAX_SIEGE_INFO_SIZE];
134 extern int	siege_valid;
135