1 /*
2  * file player.c - ingame player mangment
3  *
4  * $Id: player.h,v 1.20 2006/02/10 15:07:42 fzago Exp $
5  *
6  * Program XBLAST
7  * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net)
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published
11  * by the Free Software Foundation; either version 2; or (at your option)
12  * any later version
13  *
14  * This program is distributed in the hope that it will be entertaining,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.
21  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 #ifndef XBLAST_PLAYER_H
24 #define XBLAST_PLAYER_H
25 
26 /*
27  * global macros
28  */
29 #define TELEPORT_TIME     20	/* Define > 1 */
30 #define EXTRA_GHOST_TIME 256
31 #define EXTRA_THROUGH_TIME 64
32 #define MAX_JUNKIE_TIME (384 + GameRandomNumber(31))
33 #define NEW_INVINCIBLE    64
34 #define EXTRA_INVINCIBLE 160
35 #define EXTRA_INVISIBLE  256
36 #define STUN_TIME         16
37 #define SMELLY_TIME 30
38 #define  DALEIF_TIME 5			/* (galatius) Sky */
39 #define BONUSEVIL (2*EXTRA_INVISIBLE)
40 #define ILLDEATHTIME (GAME_TIME/8)
41 #define EXTRA_ELECTRIFY_COUNT 4
42 /*
43  * player health
44  */
45 typedef enum
46 {
47 	Healthy = 0, IllBomb, IllSlow, IllRun, IllMini, IllEmpty, IllInvisible,
48 	IllMalfunction, IllReverse, IllReverse2, IllTeleport,
49 	MAX_ILL
50 } BMHealth;
51 
52 typedef enum
53 {
54 	PM_Same = 0, PM_Polar, PM_Right, PM_Inner, PM_LeftRight, PM_Below,
55 	PM_Horizontal, PM_Vertical, PM_Circle,
56 	MAX_PM
57 } BMPosMod;
58 extern int Original;
59 /*
60  * type definitions
61  */
62 typedef struct _bmplayer
63 {
64 	int y, x;
65 	int id, team;
66 	int local;
67 	int localDisplay;
68 	/* Added by VVL (Chat) 12/11/99 : Begin */
69 	char chatstring[CHAT_LEN];
70 	int chatlen;
71 	int chatmode;
72 	/* Added by VVL (Chat) 12/11/99 : End */
73 	Sprite *sprite;
74 	int disp;
75 	BMDirection d_soll, d_ist, d_look;
76 	int invincible;
77 	int dying;
78 	int stunned;
79 	BMHealth health;
80 	BMHealth illness;
81 	int speed;
82 	int illtime;
83 	int junkie;
84 	int lives;
85 	int stop;
86 	int evilill;
87 	int score;
88 	int range;
89 	int choice_bomb_type;
90 	int bombs;
91 	int PID;					// XBCC
92 	int suck_button;
93 	unsigned int iniextra_flags;
94 	unsigned int revextra_flags;
95 	int special_bombs;
96 	XBBool remote_control;
97 	XBBool kick;
98 	int air_button;
99 	int victories;
100 	XBBool teleport;
101 	int cloaking;
102 	int num_extras;
103 	PlayerAbort abort;
104 	XBBool morphed;
105 	int num_morph;
106 	XBBool in_active;
107 	int jump_button;			/* EPFL */
108 	/* Skywalker */
109 	int revive;
110 	int frogger;
111 	int laola;
112 	int looser;
113 	int ghost;
114 	XBBool bot;
115 	XBBool away;
116 	int num_snipe;
117 	int sniping;
118 	int daleif;					/* Player will daleif (galatius,sky) */
119 	int daleifing;				/* Player has daleifed (galatius,sky) */
120 
121 	/* farter (galatius) */
122 	int farted;					/* player has been farted on */
123 	int farter;					/* player has the farter */
124 	int bfarter;				/* player can fart bombs and others */
125 	int smelly;					/* Just farted others */
126 	int electrify;
127 	int throughCount;
128 	int through;
129 	int phantom;
130 	/* */
131 } BMPlayer;
132 
133 typedef struct
134 {
135 	char *name;
136 	char *tag;
137 	char *pause;
138 	char *winlevel;
139 	char *wingame;
140 	char *loselife;
141 	char *loselevel;
142 	char *gloat;
143 	char *loser;
144 	char *laola;
145 	char *welcome;
146 	char *abort;
147 	char *abortcancel;
148 } PlayerStrings;
149 
150 /*
151  * global variables
152  */
153 extern BMPlayer player_stat[2 * MAX_PLAYER];
154 extern PlayerStrings p_string[2 * MAX_PLAYER];
155 
156 /*
157  * prototypes
158  */
159 extern XBBool ParseLevelPlayers (const DBSection * section, unsigned gameMode, DBSection * warn);
160 extern void ConfigLevelPlayers (const DBSection * section, XBBool allowRandomPos,
161 								unsigned gameMode);
162 extern void WelcomePlayers (void);
163 extern int NumSpecialBombs (void);
164 extern void InitPlayers (XBPlayerHost, const CFGGame *, const CFGPlayer *);
165 extern void FinishPlayers (void);
166 extern void DeletePlayerSprites (void);
167 extern void DropBomb (BMPlayer * ps, int type);
168 extern void DoJunkie (void);
169 extern void InfectOtherPlayers (int *active_player);
170 extern void KillPlayerAtGhost (int block, int x, int y);
171 extern void KillPlayerAt (int x, int y);
172 extern int KillOtherPlayers (int team);
173 extern void SetMsgLaola (int player);
174 extern void SetMsgLaola (int player);
175 extern int StunOtherPlayers (int team, int time);
176 extern XBBool CheckPlayerNear (int x, int y);
177 extern void DoAllPlayers (int game_time, int *active_player);
178 extern void CheckPlayerHit (void);
179 extern void DoEvilIll (void);
180 extern int ElectrifyOtherPlayers (int nplayer);
181 extern int StealBombsOtherPlayers (int team);
182 extern int StealRangeOtherPlayers (int team);
183 extern void SetMsgLoser (int player);
184 extern void SetMsgLaola (int player);
185 extern int FartOnOtherPlayers (BMPlayer * ps);
186 extern void SwapColorOtherPlayers (int team);
187 extern void SwapPositionOtherPlayers (int team);
188 
189 /* bot related stuff */
190 extern void Player_CheckLocalAway (void);
191 extern XBBool Player_CheckLocalBot (void);
192 extern void Player_BotAction (PlayerAction * pa);
193 extern void Player_ActivateBot (BMPlayer * ps, XBBool activate);
194 extern XBBool Player_isLocalBot (BMPlayer * ps);
195 
196 #endif
197 /*
198  * end of file player.h
199  */
200