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 
17 #ifndef UQM_SUPERMELEE_PICKMELE_H_
18 #define UQM_SUPERMELEE_PICKMELE_H_
19 
20 typedef struct getmelee_struct GETMELEE_STATE;
21 
22 #include "../races.h"
23 #include "../battlecontrols.h"
24 #include "meleesetup.h"
25 #include "libs/compiler.h"
26 
27 #if defined(__cplusplus)
28 extern "C" {
29 #endif
30 
31 void MeleeShipDeath (STARSHIP *);
32 void BuildPickMeleeFrame (void);
33 void DestroyPickMeleeFrame (void);
34 void FillPickMeleeFrame (MeleeSetup *setup);
35 void MeleeGameOver (void);
36 BOOLEAN GetInitialMeleeStarShips (HSTARSHIP *result);
37 BOOLEAN GetNextMeleeStarShip (COUNT which_player, HSTARSHIP *result);
38 
39 bool updateMeleeSelection (GETMELEE_STATE *gms, COUNT player, COUNT ship);
40 
41 BOOLEAN selectShipHuman (HumanInputContext *context, GETMELEE_STATE *gms);
42 BOOLEAN selectShipComputer (ComputerInputContext *context,
43 		GETMELEE_STATE *gms);
44 #ifdef NETPLAY
45 BOOLEAN selectShipNetwork (NetworkInputContext *context, GETMELEE_STATE *gms);
46 #endif  /* NETPLAY */
47 
48 #if defined(__cplusplus)
49 }
50 #endif
51 
52 #ifdef PICKMELE_INTERNAL
53 
54 #include "../flash.h"
55 #include "libs/timelib.h"
56 #include "../init.h"
57 
58 #if defined(__cplusplus)
59 extern "C" {
60 #endif
61 
62 struct getmelee_struct {
63 	BOOLEAN (*InputFunc) (struct getmelee_struct *pInputState);
64 
65 	BOOLEAN Initialized;
66 
67 	struct {
68 		TimeCount timeIn;
69 		HSTARSHIP hBattleShip;
70 				// Chosen ship.
71 		COUNT choice;
72 				// Index of chosen ship, or (COUNT) ~0 for random choice.
73 
74 		COUNT row;
75 		COUNT col;
76 		COUNT ships_left;
77 				// Number of ships still available.
78 		COUNT randomIndex;
79 				// Pre-generated random number.
80 		BOOLEAN selecting;
81 				// Is this player selecting a ship?
82 		BOOLEAN done;
83 				// Has a selection been made for this player?
84 		FlashContext *flashContext;
85 				// Context for controlling the flash rectangle.
86 #ifdef NETPLAY
87 		BOOLEAN remoteSelected;
88 #endif
89 	} player[NUM_PLAYERS];
90 };
91 
92 bool setShipSelected(GETMELEE_STATE *gms, COUNT playerI, COUNT choice,
93 		bool reportNetwork);
94 
95 #if defined(__cplusplus)
96 }
97 #endif
98 
99 #endif  /* PICKMELE_INTERNAL */
100 
101 #endif  /* UQM_SUPERMELEE_PICKMELE_H_ */
102 
103