1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License as published by
4  *  the Free Software Foundation; either version 2 of the License, or
5  *  (at your option) any later version.
6  *
7  *  This program is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *  GNU General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16 #ifndef UQM_BATTLE_H_
17 #define UQM_BATTLE_H_
18 
19 #include "options.h"
20 #include "libs/compiler.h"
21 
22 #if defined (NETPLAY)
23 typedef DWORD BattleFrameCounter;
24 #endif
25 
26 #include "init.h"
27 		// For NUM_SIDES
28 
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32 
33 // The callback function is called on every battle frame
34 // just before the display queue is drawn
35 typedef void (BattleFrameCallback) (void);
36 
37 typedef struct battlestate_struct {
38 	BOOLEAN (*InputFunc) (struct battlestate_struct *pInputState);
39 	BOOLEAN first_time;
40 	DWORD NextTime;
41 	BattleFrameCallback *frame_cb;
42 } BATTLE_STATE;
43 
44 extern BYTE battle_counter[NUM_SIDES];
45 extern BOOLEAN instantVictory;
46 #if defined (NETPLAY)
47 extern BattleFrameCounter battleFrameCount;
48 #endif
49 #ifdef NETPLAY
50 COUNT GetPlayerOrder (COUNT i);
51 #else
52 #	define GetPlayerOrder(i) (i)
53 #endif
54 
55 BOOLEAN Battle (BattleFrameCallback *);
56 
57 #define BATTLE_FRAME_RATE (ONE_SECOND / 24)
58 
59 extern void BattleSong (BOOLEAN DoPlay);
60 extern void FreeBattleSong (void);
61 
62 #if defined(__cplusplus)
63 }
64 #endif
65 
66 #endif  /* UQM_BATTLE_H_ */
67