1 /*
2  *
3  *   Copyright (c) 1994, 2002, 2003 Johannes Prix
4  *   Copyright (c) 1994, 2002 Reinhard Prix
5  *   Copyright (c) 2004-2007 Arthur Huillet
6  *
7  *
8  *  This file is part of Freedroid
9  *
10  *  Freedroid is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  Freedroid is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with Freedroid; see the file COPYING. If not, write to the
22  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23  *  MA  02111-1307  USA
24  *
25  */
26 #ifndef _takeover_h
27 #define _takeover_h
28 
29 #ifndef _defs_h
30 #include "defs.h"		// we need this here for path defines
31 #endif
32 
33 void to_show_banner(const char *left, const char *right);
34 
35 /* Background-color of takeover-game */
36 #define TO_BG_COLOR			63
37 
38 /* File containing the Takeover-blocks */
39 #define TO_BLOCK_FILE		"to_elem.png"
40 /* --------------- individual block dimensions --------------- */
41 #define NUM_PHASES		5	/* number of color-phases for current "flow" */
42 					/* inclusive "inactive" phase */
43 
44 /* Dimensions of the game-blocks */
45 #define TO_BLOCKS		11	/* quantity of different game- blocks */
46 
47 #define NUM_TO_BLOCKS		2*NUM_PHASES*TO_BLOCKS	// total number of takeover blocks
48 #define TO_ELEMENTS		6
49 #define TO_BLOCKLEN		2*32	/* dimension of a game- block */
50 #define TO_BLOCKHEIGHT	 	2*8
51 
52 /* Dimensions of the fill-blocks (in led-column */
53 #define NUM_FILL_BLOCKS		3	// yellow, purple and black
54 #define FILL_BLOCK_LEN		2*16
55 #define FILL_BLOCK_HEIGHT  	2*7
56 
57 /* Dimensions of a capsule */
58 #define NUM_CAPS_BLOCKS		3	// yellow, purple and red (?what for)
59 #define CAPSULE_LEN		2*7
60 #define CAPSULE_HEIGHT		2*7
61 
62 /* Dimensions of ground-, column- und leader blocks */
63 #define NUM_GROUND_BLOCKS	6
64 #define GROUNDBLOCKLEN		2*23
65 #define GROUNDBLOCKHEIGHT	2*8
66 
67 #define COLUMNBLOCKLEN		2*30
68 #define COLUMNBLOCKHEIGHT	2*8
69 
70 #define LEADERBLOCKLEN		2*30
71 #define LEADERBLOCKHEIGHT	2*19
72 
73 /* --------------- Timing parameters --------------- */
74 #define COLOR_COUNTDOWN		100	/* time to choose color */
75 #define GAME_COUNTDOWN		100	/* time to end the game */
76 #define CAPSULE_COUNTDOWN	 40	/* 1/10 sec. lifetime of a capsule */
77 
78 #define WAIT_MOVEMENT		0	/* 1/18 sec. movementspeed. */
79 #define WAIT_COLOR_ROTATION	2	/* 1/18 sec active-capsule */
80 #define WAIT_AFTER_GAME		2*18	/* Wait after a deadlock */
81 
82 #define TO_TICK_LENGTH		40	/* Time in ms between ticks */
83 
84 /* --------------- Playground layout --------------- */
85 
86 /* Position of Leader-Led */
87 #define LEADERLED_X		2*136
88 #define LEADERLED_Y		2*11
89 
90 /* Start-pos of Led-column */
91 #define LEDCOLUMN_X		2*136
92 #define LEDCOLUMN_Y		2*27
93 
94 /* Positions of Droid-pictures */
95 #define YELLOW_DROID_X		2*40
96 #define YELLOW_DROID_Y		0
97 #define PURPLE_DROID_X		2*225
98 #define PURPLE_DROID_Y		YELLOW_DROID_Y
99 
100 /* Left-Capsules positions */
101 #define YELLOW_LEFT_CAPSULES_X	4
102 #define YELLOW_LEFT_CAPSULES_Y	2*27
103 #define PURPLE_LEFT_CAPSULES_X	RIGHT_OFFS_X + COLUMNBLOCKLEN -10
104 #define PURPLE_LEFT_CAPSULES_Y	2*27
105 
106 /* start-pos of Current Capsule */
107 #define YELLOW_CUR_CAPSULE_X	2*26
108 #define YELLOW_CUR_CAPSULE_Y	2*19
109 #define PURPLE_CUR_CAPSULE_X	2*255
110 #define PURPLE_CUR_CAPSULE_Y	2*19
111 
112 #define MAX_CAPSULES		13	/* a 999 has 13 !!! */
113 
114 /* Start-Pos of playground */
115 #define YELLOW_PLAYGROUND_X	2*33
116 #define YELLOW_PLAYGROUND_Y	2*26
117 #define PURPLE_PLAYGROUND_X	2*159
118 #define PURPLE_PLAYGROUND_Y	2*26
119 
120 #define LEFT_OFFS_X		2*10	/* Offset of the left column */
121 #define LEFT_OFFS_Y		2*15
122 
123 #define MID_OFFS_X		2*129	/* -- of the middle one -- */
124 #define MID_OFFS_Y		2*8
125 
126 #define RIGHT_OFFS_X		2*255	/* -- and the right one --- */
127 #define RIGHT_OFFS_Y		2*15
128 
129 enum _groundblocks {
130 	YELLOW_HIGH,
131 	YELLOW_MIDDLE,
132 	YELLOW_LOW,
133 	PURPLE_HIGH,
134 	PURPLE_MIDDLE,
135 	PURPLE_LOW
136 };
137 
138 /* Conditions in Connection-layer */
139 enum condition {
140 	INACTIVE = 0,
141 	ACTIVE1,
142 	ACTIVE2,
143 	ACTIVE3,
144 	ACTIVE4
145 };
146 
147 /* Names for you and "him" */
148 enum to_opponents {
149 	YOU,
150 	ENEMY
151 };
152 
153 /* Color-names */
154 #define TO_COLORS		2
155 enum to_colors {
156 	YELLOW = 0,
157 	PURPLE,
158 	DRAW
159 };
160 
161 /* Element - Names */
162 enum to_elements {
163 	EL_CABLE,
164 	EL_CABLE_END,
165 	EL_AMPLIFIER,
166 	EL_COLOR_EXCHANGER,
167 	EL_SEPARATOR,
168 	EL_GATE
169 };
170 
171 /* Block-Names */
172 enum to_block_tyes {
173 	CABLE,
174 	CABLE_END,
175 	AMPLIFIER,
176 	COLOR_EXCHANGER,
177 	SEPARATOR_H,
178 	SEPARATOR_M,
179 	SEPARATOR_L,
180 	GATE_H,
181 	GATE_M,
182 	GATE_L,
183 	EMPTY
184 };
185 
186 /* there are two classes of blocks: connectors and non-connectors */
187 #define CONNECTOR		0
188 #define NON_CONNECTOR  		1
189 
190 #define NUM_LAYERS		4	/* dimension of the playground */
191 #define NUM_LINES		12
192 
193 /* the playground type */
194 typedef int playground_t[TO_COLORS][NUM_LAYERS][NUM_LINES];
195 
196 #endif
197