Debian Codegraph @

src/destruct.c

raw symbols SCIP
1 /*
2 * OpenTyrian: A modern cross-platform port of Tyrian
3 * Copyright (C) 2007-2009 The OpenTyrian Development Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 /* File notes:
21 * Two players duke it out in a Scorched Earth style game.
22 * Most of the variables referring to the players are global as
23 * they are often edited and that's how the original was written.
24 *
25 * Currently this file is at its final stage for vanilla destruct.
26 * Almost all of the left/right code duplications is gone. Most of the
27 * functions have been examined and tightened up, none of the enums
28 * start with '1', and the various large functions have been divided into
29 * smaller chunks.
30 *
31 * Destruct also supports some 'hidden' configuration that's just too awesome
32 * to not have available. Destruct has no configuration options in game, but
33 * that doesn't stop us from changing various limiting vars and letting
34 * people remap the keyboard. AIs may also be introduced here; fighting a
35 * stateless AI isn't really challenging after all.
36 *
37 * This hidden config also allows for a hidden game mode! Though as a custom
38 * game mode wouldn't show up in the data files it forces us to distinguish
39 * between the constant DESTRUCT_MODES (5) and MAX_MODES (6). DESTRUCT_MODES
40 * is only used with loaded data.
41 *
42 * Things I wanted to do but can't: Remove references to VGAScreen. For
43 * a multitude of reasons this just isn't feasible. It would have been nice
44 * to increase the playing field though...
45 */
46
47 /*** Headers ***/
48 #include "destruct.h"cxx . . $ `<file>/src/destruct.h`/
49
50 #include "config.h"cxx . . $ `<file>/src/config.h`/
51 #include "config_file.h"cxx . . $ `<file>/src/config_file.h`/
52 #include "fonthand.h"cxx . . $ `<file>/src/fonthand.h`/
53 #include "helptext.h"cxx . . $ `<file>/src/helptext.h`/
54 #include "keyboard.h"cxx . . $ `<file>/src/keyboard.h`/
55 #include "loudness.h"cxx . . $ `<file>/src/loudness.h`/
56 #include "mtrand.h"cxx . . $ `<file>/src/mtrand.h`/
57 #include "nortsong.h"cxx . . $ `<file>/src/nortsong.h`/
58 #include "opentyr.h"cxx . . $ `<file>/src/opentyr.h`/
59 #include "palette.h"cxx . . $ `<file>/src/palette.h`/
60 #include "picload.h"cxx . . $ `<file>/src/picload.h`/
61 #include "sprite.h"cxx . . $ `<file>/src/sprite.h`/
62 #include "varz.h"cxx . . $ `<file>/src/varz.h`/
63 #include "vga256d.h"cxx . . $ `<file>/src/vga256d.h`/
64 #include "video.h"cxx . . $ `<file>/src/video.h`/
65
66 #include <assert.h>
67
68 /*** Defines ***/
69 #define UNIT_HEIGHTcxx . . $ `src/destruct.c:69:9`! 12
70 #define MAX_KEY_OPTIONScxx . . $ `src/destruct.c:70:9`! 4
71
72 /*** Enums ***/
73 enum de_state_tcxx . . $ de_state_t#
74 {
75 STATE_INITcxx . . $ STATE_INIT.,
76 STATE_RELOADcxx . . $ STATE_RELOAD.,
77 STATE_CONTINUEcxx . . $ STATE_CONTINUE.
78 };
79
80 enum de_player_tcxx . . $ de_player_t#
81 {
82 PLAYER_LEFTcxx . . $ PLAYER_LEFT. = 0,
83 PLAYER_RIGHTcxx . . $ PLAYER_RIGHT. = 1,
84 MAX_PLAYERScxx . . $ MAX_PLAYERS. = 2
85 };
86
87 enum de_team_tcxx . . $ de_team_t#
88 {
89 TEAM_LEFTcxx . . $ TEAM_LEFT. = 0,
90 TEAM_RIGHTcxx . . $ TEAM_RIGHT. = 1,
91 MAX_TEAMScxx . . $ MAX_TEAMS. = 2
92 };
93
94 enum de_mode_tcxx . . $ de_mode_t#
95 {
96 MODE_5CARDWARcxx . . $ MODE_5CARDWAR. = 0,
97 MODE_TRADITIONALcxx . . $ MODE_TRADITIONAL.,
98 MODE_HELIASSAULTcxx . . $ MODE_HELIASSAULT.,
99 MODE_HELIDEFENSEcxx . . $ MODE_HELIDEFENSE.,
100 MODE_OUTGUNNEDcxx . . $ MODE_OUTGUNNED.,
101 MODE_CUSTOMcxx . . $ MODE_CUSTOM.,
102 MODE_FIRSTcxx . . $ MODE_FIRST. = MODE_5CARDWARcxx . . $ MODE_5CARDWAR.,
103 MODE_LASTcxx . . $ MODE_LAST. = MODE_CUSTOMcxx . . $ MODE_CUSTOM.,
104 MAX_MODEScxx . . $ MAX_MODES. = 6,
105 MODE_NONEcxx . . $ MODE_NONE. = -1
106 };
107
108 enum de_unit_tcxx . . $ de_unit_t#
109 {
110 UNIT_TANKcxx . . $ UNIT_TANK. = 0,
111 UNIT_NUKEcxx . . $ UNIT_NUKE.,
112 UNIT_DIRTcxx . . $ UNIT_DIRT.,
113 UNIT_SATELLITEcxx . . $ UNIT_SATELLITE.,
114 UNIT_MAGNETcxx . . $ UNIT_MAGNET.,
115 UNIT_LASERcxx . . $ UNIT_LASER.,
116 UNIT_JUMPERcxx . . $ UNIT_JUMPER.,
117 UNIT_HELIcxx . . $ UNIT_HELI.,
118 UNIT_FIRSTcxx . . $ UNIT_FIRST. = UNIT_TANKcxx . . $ UNIT_TANK.,
119 UNIT_LASTcxx . . $ UNIT_LAST. = UNIT_HELIcxx . . $ UNIT_HELI.,
120 MAX_UNITScxx . . $ MAX_UNITS. = 8,
121 UNIT_NONEcxx . . $ UNIT_NONE. = -1
122 };
123
124 enum de_shot_tcxx . . $ de_shot_t#
125 {
126 SHOT_TRACERcxx . . $ SHOT_TRACER. = 0,
127 SHOT_SMALLcxx . . $ SHOT_SMALL.,
128 SHOT_LARGEcxx . . $ SHOT_LARGE.,
129 SHOT_MICROcxx . . $ SHOT_MICRO.,
130 SHOT_SUPERcxx . . $ SHOT_SUPER.,
131 SHOT_DEMOcxx . . $ SHOT_DEMO.,
132 SHOT_SMALLNUKEcxx . . $ SHOT_SMALLNUKE.,
133 SHOT_LARGENUKEcxx . . $ SHOT_LARGENUKE.,
134 SHOT_SMALLDIRTcxx . . $ SHOT_SMALLDIRT.,
135 SHOT_LARGEDIRTcxx . . $ SHOT_LARGEDIRT.,
136 SHOT_MAGNETcxx . . $ SHOT_MAGNET.,
137 SHOT_MINILASERcxx . . $ SHOT_MINILASER.,
138 SHOT_MEGALASERcxx . . $ SHOT_MEGALASER.,
139 SHOT_LASERTRACERcxx . . $ SHOT_LASERTRACER.,
140 SHOT_MEGABLASTcxx . . $ SHOT_MEGABLAST.,
141 SHOT_MINIcxx . . $ SHOT_MINI.,
142 SHOT_BOMBcxx . . $ SHOT_BOMB.,
143 SHOT_FIRSTcxx . . $ SHOT_FIRST. = SHOT_TRACERcxx . . $ SHOT_TRACER.,
144 SHOT_LASTcxx . . $ SHOT_LAST. = SHOT_BOMBcxx . . $ SHOT_BOMB.,
145 MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES. = 17,
146 SHOT_INVALIDcxx . . $ SHOT_INVALID. = -1
147 };
148
149 enum de_expl_tcxx . . $ de_expl_t#
150 {
151 EXPL_NONEcxx . . $ EXPL_NONE.,
152 EXPL_MAGNETcxx . . $ EXPL_MAGNET.,
153 EXPL_DIRTcxx . . $ EXPL_DIRT.,
154 EXPL_NORMALcxx . . $ EXPL_NORMAL.
155 }; /* this needs a better name */
156
157 enum de_trails_tcxx . . $ de_trails_t#
158 {
159 TRAILS_NONEcxx . . $ TRAILS_NONE.,
160 TRAILS_NORMALcxx . . $ TRAILS_NORMAL.,
161 TRAILS_FULLcxx . . $ TRAILS_FULL.
162 };
163
164 enum de_pixel_tcxx . . $ de_pixel_t#
165 {
166 PIXEL_BLACKcxx . . $ PIXEL_BLACK. = 0,
167 PIXEL_DIRTcxx . . $ PIXEL_DIRT. = 25
168 };
169
170 enum de_mapflags_tcxx . . $ de_mapflags_t#
171 {
172 MAP_NORMALcxx . . $ MAP_NORMAL. = 0x00,
173 MAP_WALLScxx . . $ MAP_WALLS. = 0x01,
174 MAP_RINGScxx . . $ MAP_RINGS. = 0x02,
175 MAP_HOLEScxx . . $ MAP_HOLES. = 0x04,
176 MAP_FUZZYcxx . . $ MAP_FUZZY. = 0x08,
177 MAP_TALLcxx . . $ MAP_TALL. = 0x10
178 };
179
180 /* keys and moves should line up. */
181 enum de_keys_tcxx . . $ de_keys_t#
182 {
183 KEY_LEFTcxx . . $ KEY_LEFT. = 0,
184 KEY_RIGHTcxx . . $ KEY_RIGHT.,
185 KEY_UPcxx . . $ KEY_UP.,
186 KEY_DOWNcxx . . $ KEY_DOWN.,
187 KEY_CHANGEcxx . . $ KEY_CHANGE.,
188 KEY_FIREcxx . . $ KEY_FIRE.,
189 KEY_CYUPcxx . . $ KEY_CYUP.,
190 KEY_CYDNcxx . . $ KEY_CYDN.,
191 MAX_KEYcxx . . $ MAX_KEY. = 8
192 };
193
194 enum de_move_tcxx . . $ de_move_t#
195 {
196 MOVE_LEFTcxx . . $ MOVE_LEFT. = 0,
197 MOVE_RIGHTcxx . . $ MOVE_RIGHT.,
198 MOVE_UPcxx . . $ MOVE_UP.,
199 MOVE_DOWNcxx . . $ MOVE_DOWN.,
200 MOVE_CHANGEcxx . . $ MOVE_CHANGE.,
201 MOVE_FIREcxx . . $ MOVE_FIRE.,
202 MOVE_CYUPcxx . . $ MOVE_CYUP.,
203 MOVE_CYDNcxx . . $ MOVE_CYDN.,
204 MAX_MOVEcxx . . $ MAX_MOVE. = 8
205 };
206
207 /* The tracerlaser is dummied out. It works but (probably due to the low
208 * MAX_SHOTS) is not assigned to anything. The bomb does not work.
209 */
210
211 /*** Structs ***/
212 struct destruct_config_scxx . . $ destruct_config_s#
213 {
214 unsigned int max_shotscxx . . $ destruct_config_s#max_shots.;
215 unsigned int min_wallscxx . . $ destruct_config_s#min_walls.;
216 unsigned int max_wallscxx . . $ destruct_config_s#max_walls.;
217 unsigned int max_explosionscxx . . $ destruct_config_s#max_explosions.;
218 unsigned int max_installationscxx . . $ destruct_config_s#max_installations.;
219 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allow_customcxx . . $ destruct_config_s#allow_custom.;
220 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! alwaysaliascxx . . $ destruct_config_s#alwaysalias.;
221 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! jumper_straightcxx . . $ destruct_config_s#jumper_straight.[2];
222 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! aicxx . . $ destruct_config_s#ai.[2];
223 };
224
225 struct destruct_unit_scxx . . $ destruct_unit_s#
226 {
227 /* Positioning/movement */
228 unsigned int unitXcxx . . $ destruct_unit_s#unitX.; /* yep, one's an int and the other is a real */
229 float unitYcxx . . $ destruct_unit_s#unitY.;
230 float unitYMovcxx . . $ destruct_unit_s#unitYMov.;
231 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! isYInAircxx . . $ destruct_unit_s#isYInAir.;
232
233 /* What it is and what it fires */
234 enum de_unit_tcxx . . $ de_unit_t# unitTypecxx . . $ destruct_unit_s#unitType.;
235 enum de_shot_tcxx . . $ de_shot_t# shotTypecxx . . $ destruct_unit_s#shotType.;
236
237 /* What it's pointed */
238 float anglecxx . . $ destruct_unit_s#angle.;
239 float powercxx . . $ destruct_unit_s#power.;
240
241 /* Misc */
242 int lastMovecxx . . $ destruct_unit_s#lastMove.;
243 unsigned int ani_framecxx . . $ destruct_unit_s#ani_frame.;
244 int healthcxx . . $ destruct_unit_s#health.;
245 };
246
247 struct destruct_shot_scxx . . $ destruct_shot_s#
248 {
249 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! isAvailablecxx . . $ destruct_shot_s#isAvailable.;
250
251 float xcxx . . $ destruct_shot_s#x.;
252 float ycxx . . $ destruct_shot_s#y.;
253 float xmovcxx . . $ destruct_shot_s#xmov.;
254 float ymovcxx . . $ destruct_shot_s#ymov.;
255 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! gravitycxx . . $ destruct_shot_s#gravity.;
256 unsigned int shottypecxx . . $ destruct_shot_s#shottype.;
257 //int shotdur; /* This looks to be unused */
258 unsigned int trailxcxx . . $ destruct_shot_s#trailx.[4], trailycxx . . $ destruct_shot_s#traily.[4], trailccxx . . $ destruct_shot_s#trailc.[4];
259 };
260
261 struct destruct_explo_scxx . . $ destruct_explo_s#
262 {
263 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! isAvailablecxx . . $ destruct_explo_s#isAvailable.;
264
265 unsigned int xcxx . . $ destruct_explo_s#x., ycxx . . $ destruct_explo_s#y.;
266 unsigned int explowidthcxx . . $ destruct_explo_s#explowidth.;
267 unsigned int explomaxcxx . . $ destruct_explo_s#explomax.;
268 unsigned int explofillcxx . . $ destruct_explo_s#explofill.;
269 enum de_expl_tcxx . . $ de_expl_t# exploTypecxx . . $ destruct_explo_s#exploType.;
270 };
271
272 struct destruct_moves_scxx . . $ destruct_moves_s#
273 {
274 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! actionscxx . . $ destruct_moves_s#actions.[MAX_MOVEcxx . . $ MAX_MOVE.];
275 };
276
277 struct destruct_keys_scxx . . $ destruct_keys_s#
278 {
279 SDL_Scancodecxx . . $ SDL_Scancode# Configcxx . . $ destruct_keys_s#Config.[MAX_KEYcxx . . $ MAX_KEY.][MAX_KEY_OPTIONScxx . . $ `src/destruct.c:70:9`!];
280 };
281
282 struct destruct_ai_scxx . . $ destruct_ai_s#
283 {
284 int c_Anglecxx . . $ destruct_ai_s#c_Angle., c_Powercxx . . $ destruct_ai_s#c_Power., c_Firecxx . . $ destruct_ai_s#c_Fire.;
285 unsigned int c_noDowncxx . . $ destruct_ai_s#c_noDown.;
286 };
287
288 struct destruct_player_scxx . . $ destruct_player_s#
289 {
290 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_cpucxx . . $ destruct_player_s#is_cpu.;
291 struct destruct_ai_scxx . . $ destruct_ai_s# aiMemorycxx . . $ destruct_player_s#aiMemory.;
292
293 struct destruct_unit_scxx . . $ destruct_unit_s# * unitcxx . . $ destruct_player_s#unit.;
294 struct destruct_moves_scxx . . $ destruct_moves_s# movescxx . . $ destruct_player_s#moves.;
295 struct destruct_keys_scxx . . $ destruct_keys_s# keyscxx . . $ destruct_player_s#keys.;
296
297 enum de_team_tcxx . . $ de_team_t# teamcxx . . $ destruct_player_s#team.;
298 unsigned int unitsRemainingcxx . . $ destruct_player_s#unitsRemaining.;
299 unsigned int unitSelectedcxx . . $ destruct_player_s#unitSelected.;
300 unsigned int shotDelaycxx . . $ destruct_player_s#shotDelay.;
301 unsigned int scorecxx . . $ destruct_player_s#score.;
302 };
303
304 struct destruct_wall_scxx . . $ destruct_wall_s#
305 {
306 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! wallExistcxx . . $ destruct_wall_s#wallExist.;
307 unsigned int wallXcxx . . $ destruct_wall_s#wallX., wallYcxx . . $ destruct_wall_s#wallY.;
308 };
309
310 struct destruct_world_scxx . . $ destruct_world_s#
311 {
312 /* Map data & screen pointer */
313 unsigned int baseMapcxx . . $ destruct_world_s#baseMap.[320];
314 SDL_Surfacecxx . . $ SDL_Surface# * VGAScreencxx . . $ destruct_world_s#VGAScreen.;
315 struct destruct_wall_scxx . . $ destruct_wall_s# * mapWallscxx . . $ destruct_world_s#mapWalls.;
316
317 /* Map configuration */
318 enum de_mode_tcxx . . $ de_mode_t# destructModecxx . . $ destruct_world_s#destructMode.;
319 unsigned int mapFlagscxx . . $ destruct_world_s#mapFlags.;
320 };
321
322 /*** Function decs ***/
323 //Prep functions
324 static void JE_destructMaincxx . . $ JE_destructMain(49f6e7a06ebc5aa8).(void);
325 static void JE_introScreencxx . . $ JE_introScreen(49f6e7a06ebc5aa8).(void);
326 static enum de_mode_tcxx . . $ de_mode_t# JE_modeSelectcxx . . $ JE_modeSelect(edf75d82bf086192).(void);
327 static void JE_helpScreencxx . . $ JE_helpScreen(49f6e7a06ebc5aa8).(void);
328 static void JE_pauseScreencxx . . $ JE_pauseScreen(49f6e7a06ebc5aa8).(void);
329
330 //level generating functions
331 static void JE_generateTerraincxx . . $ JE_generateTerrain(49f6e7a06ebc5aa8).(void);
332 static void DE_generateBaseTerraincxx . . $ DE_generateBaseTerrain(ec424488036d5d70).(unsigned int, unsigned int *);
333 static void DE_drawBaseTerraincxx . . $ DE_drawBaseTerrain(218b13e5e7cbf689).(unsigned int *);
334 static void DE_generateUnitscxx . . $ DE_generateUnits(218b13e5e7cbf689).(unsigned int *);
335 static void DE_generateWallscxx . . $ DE_generateWalls(20fa528b014a5b4e).(struct destruct_world_scxx . . $ destruct_world_s# *);
336 static void DE_generateRingscxx . . $ DE_generateRings(91b72255c859517f).(SDL_Surfacecxx . . $ SDL_Surface# *, Uint8cxx . . $ Uint8#);
337 static void DE_ResetLevelcxx . . $ DE_ResetLevel(49f6e7a06ebc5aa8).(void);
338 static unsigned int JE_placementPositioncxx . . $ JE_placementPosition(df145c89fad21506).(unsigned int, unsigned int, unsigned int *);
339
340 //drawing functions
341 static void JE_aliasDirtcxx . . $ JE_aliasDirt(60a0b30a00b4fc6d).(SDL_Surfacecxx . . $ SDL_Surface# *);
342 static void DE_RunTickDrawCrosshairscxx . . $ DE_RunTickDrawCrosshairs(49f6e7a06ebc5aa8).(void);
343 static void DE_RunTickDrawHUDcxx . . $ DE_RunTickDrawHUD(49f6e7a06ebc5aa8).(void);
344 static void DE_GravityDrawUnitcxx . . $ DE_GravityDrawUnit(d7e50c04c26b4b3).(enum de_player_tcxx . . $ de_player_t#, struct destruct_unit_scxx . . $ destruct_unit_s# *);
345 static void DE_RunTickAnimatecxx . . $ DE_RunTickAnimate(49f6e7a06ebc5aa8).(void);
346 static void DE_RunTickDrawWallscxx . . $ DE_RunTickDrawWalls(49f6e7a06ebc5aa8).(void);
347 static void DE_DrawTrailscxx . . $ DE_DrawTrails(fe9620acf5ef4f0d).(struct destruct_shot_scxx . . $ destruct_shot_s# *, unsigned int, unsigned int, unsigned int);
348 static void JE_tempScreenCheckingcxx . . $ JE_tempScreenChecking(49f6e7a06ebc5aa8).(void);
349 static void JE_superPixelcxx . . $ JE_superPixel(b4d55b1286ff73e8).(unsigned int, unsigned int);
350 static void JE_pixCoolcxx . . $ JE_pixCool(10e3fdc6547212ea).(unsigned int, unsigned int, Uint8cxx . . $ Uint8#);
351
352 //player functions
353 static void DE_RunTickGetInputcxx . . $ DE_RunTickGetInput(49f6e7a06ebc5aa8).(void);
354 static void DE_ProcessInputcxx . . $ DE_ProcessInput(49f6e7a06ebc5aa8).(void);
355 static void DE_ResetPlayerscxx . . $ DE_ResetPlayers(49f6e7a06ebc5aa8).(void);
356 static void DE_ResetAIcxx . . $ DE_ResetAI(49f6e7a06ebc5aa8).(void);
357 static void DE_ResetActionscxx . . $ DE_ResetActions(49f6e7a06ebc5aa8).(void);
358 static void DE_RunTickAIcxx . . $ DE_RunTickAI(49f6e7a06ebc5aa8).(void);
359
360 //unit functions
361 static void DE_RaiseAnglecxx . . $ DE_RaiseAngle(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
362 static void DE_LowerAnglecxx . . $ DE_LowerAngle(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
363 static void DE_RaisePowercxx . . $ DE_RaisePower(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
364 static void DE_LowerPowercxx . . $ DE_LowerPower(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
365 static void DE_CycleWeaponUpcxx . . $ DE_CycleWeaponUp(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
366 static void DE_CycleWeaponDowncxx . . $ DE_CycleWeaponDown(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
367 static void DE_RunMagnetcxx . . $ DE_RunMagnet(d7e50c04c26b4b3).(enum de_player_tcxx . . $ de_player_t#, struct destruct_unit_scxx . . $ destruct_unit_s# *);
368 static void DE_GravityFlyUnitcxx . . $ DE_GravityFlyUnit(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
369 static void DE_GravityLowerUnitcxx . . $ DE_GravityLowerUnit(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
370 static void DE_DestroyUnitcxx . . $ DE_DestroyUnit(d7e50c04c26b4b3).(enum de_player_tcxx . . $ de_player_t#, struct destruct_unit_scxx . . $ destruct_unit_s# *);
371 static void DE_ResetUnitscxx . . $ DE_ResetUnits(49f6e7a06ebc5aa8).(void);
372 static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(struct destruct_unit_scxx . . $ destruct_unit_s# *);
373
374 //weapon functions
375 static void DE_ResetWeaponscxx . . $ DE_ResetWeapons(49f6e7a06ebc5aa8).(void);
376 static void DE_RunTickShotscxx . . $ DE_RunTickShots(49f6e7a06ebc5aa8).(void);
377 static void DE_RunTickExplosionscxx . . $ DE_RunTickExplosions(49f6e7a06ebc5aa8).(void);
378 static void DE_TestExplosionCollisioncxx . . $ DE_TestExplosionCollision(b4d55b1286ff73e8).(unsigned int, unsigned int);
379 static void JE_makeExplosioncxx . . $ JE_makeExplosion(b1f3cc9e908f625d).(unsigned int, unsigned int, enum de_shot_tcxx . . $ de_shot_t#);
380 static void DE_MakeShotcxx . . $ DE_MakeShot(5776d1f53a924cb0).(enum de_player_tcxx . . $ de_player_t#, const struct destruct_unit_scxx . . $ destruct_unit_s# *, int);
381
382 //gameplay functions
383 static enum de_state_tcxx . . $ de_state_t# DE_RunTickcxx . . $ DE_RunTick(824bd1aac937bb2e).(void);
384 static void DE_RunTickCycleDeadUnitscxx . . $ DE_RunTickCycleDeadUnits(49f6e7a06ebc5aa8).(void);
385 static void DE_RunTickGravitycxx . . $ DE_RunTickGravity(49f6e7a06ebc5aa8).(void);
386 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! DE_RunTickCheckEndgamecxx . . $ DE_RunTickCheckEndgame(c9857a73d68e59ba).(void);
387 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(unsigned int, unsigned int);
388
389 //sound
390 static void DE_RunTickPlaySoundscxx . . $ DE_RunTickPlaySounds(49f6e7a06ebc5aa8).(void);
391 static void JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(unsigned int);
392
393 /*** Weapon configurations ***/
394
395 /* Part of me wants to leave these as bytes to save space. */
396 static const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! demolishcxx . . $ demolish.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!};
397 //static const int shotGr[MAX_SHOT_TYPES] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101};
398 static const int shotTrailcxx . . $ shotTrail.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {TRAILS_NONEcxx . . $ TRAILS_NONE., TRAILS_NONEcxx . . $ TRAILS_NONE., TRAILS_NONEcxx . . $ TRAILS_NONE., TRAILS_NORMALcxx . . $ TRAILS_NORMAL., TRAILS_NORMALcxx . . $ TRAILS_NORMAL., TRAILS_NORMALcxx . . $ TRAILS_NORMAL., TRAILS_FULLcxx . . $ TRAILS_FULL., TRAILS_FULLcxx . . $ TRAILS_FULL., TRAILS_NONEcxx . . $ TRAILS_NONE., TRAILS_NONEcxx . . $ TRAILS_NONE., TRAILS_NONEcxx . . $ TRAILS_NONE., TRAILS_NORMALcxx . . $ TRAILS_NORMAL., TRAILS_FULLcxx . . $ TRAILS_FULL., TRAILS_NORMALcxx . . $ TRAILS_NORMAL., TRAILS_FULLcxx . . $ TRAILS_FULL., TRAILS_NORMALcxx . . $ TRAILS_NORMAL., TRAILS_NONEcxx . . $ TRAILS_NONE.};
399 //static const int shotFuse[MAX_SHOT_TYPES] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0};
400 static const int shotDelaycxx . . $ shotDelay.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {10, 30, 80, 20, 60, 100, 140, 200, 20, 60, 5, 15, 50, 5, 80, 16, 0};
401 static const int shotSoundcxx . . $ shotSound.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {S_SELECTcxx . . $ S_SELECT., S_WEAPON_2cxx . . $ S_WEAPON_2., S_WEAPON_1cxx . . $ S_WEAPON_1., S_WEAPON_7cxx . . $ S_WEAPON_7., S_WEAPON_7cxx . . $ S_WEAPON_7., S_EXPLOSION_9cxx . . $ S_EXPLOSION_9., S_EXPLOSION_22cxx . . $ S_EXPLOSION_22., S_EXPLOSION_22cxx . . $ S_EXPLOSION_22., S_WEAPON_5cxx . . $ S_WEAPON_5., S_WEAPON_13cxx . . $ S_WEAPON_13., S_WEAPON_10cxx . . $ S_WEAPON_10., S_WEAPON_15cxx . . $ S_WEAPON_15., S_WEAPON_15cxx . . $ S_WEAPON_15., S_WEAPON_26cxx . . $ S_WEAPON_26., S_WEAPON_14cxx . . $ S_WEAPON_14., S_WEAPON_7cxx . . $ S_WEAPON_7., S_WEAPON_7cxx . . $ S_WEAPON_7.};
402 static const int exploSizecxx . . $ exploSize.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {4, 20, 30, 14, 22, 16, 40, 60, 10, 30, 0, 5, 10, 3, 15, 7, 0};
403 static const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! shotBouncecxx . . $ shotBounce.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!};
404 static const int exploDensitycxx . . $ exploDensity.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = { 2, 5, 10, 15, 20, 15, 25, 30, 40, 80, 0, 30, 30, 4, 30, 5, 0};
405 static const int shotDirtcxx . . $ shotDirt.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_DIRTcxx . . $ EXPL_DIRT., EXPL_DIRTcxx . . $ EXPL_DIRT., EXPL_MAGNETcxx . . $ EXPL_MAGNET., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NORMALcxx . . $ EXPL_NORMAL., EXPL_NONEcxx . . $ EXPL_NONE.};
406 static const int shotColorcxx . . $ shotColor.[MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] = {16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 16, 0};
407
408 static const int defaultWeaponcxx . . $ defaultWeapon.[MAX_UNITScxx . . $ MAX_UNITS.] = {SHOT_SMALLcxx . . $ SHOT_SMALL., SHOT_MICROcxx . . $ SHOT_MICRO., SHOT_SMALLDIRTcxx . . $ SHOT_SMALLDIRT., SHOT_INVALIDcxx . . $ SHOT_INVALID., SHOT_MAGNETcxx . . $ SHOT_MAGNET., SHOT_MINILASERcxx . . $ SHOT_MINILASER., SHOT_MICROcxx . . $ SHOT_MICRO., SHOT_MINIcxx . . $ SHOT_MINI.};
409 static const int defaultCpuWeaponcxx . . $ defaultCpuWeapon.[MAX_UNITScxx . . $ MAX_UNITS.] = {SHOT_SMALLcxx . . $ SHOT_SMALL., SHOT_MICROcxx . . $ SHOT_MICRO., SHOT_DEMOcxx . . $ SHOT_DEMO., SHOT_INVALIDcxx . . $ SHOT_INVALID., SHOT_MAGNETcxx . . $ SHOT_MAGNET., SHOT_MINILASERcxx . . $ SHOT_MINILASER., SHOT_MICROcxx . . $ SHOT_MICRO., SHOT_MINIcxx . . $ SHOT_MINI.};
410 static const int defaultCpuWeaponBcxx . . $ defaultCpuWeaponB.[MAX_UNITScxx . . $ MAX_UNITS.] = {SHOT_DEMOcxx . . $ SHOT_DEMO., SHOT_SMALLNUKEcxx . . $ SHOT_SMALLNUKE., SHOT_DEMOcxx . . $ SHOT_DEMO., SHOT_INVALIDcxx . . $ SHOT_INVALID., SHOT_MAGNETcxx . . $ SHOT_MAGNET., SHOT_MEGALASERcxx . . $ SHOT_MEGALASER., SHOT_MICROcxx . . $ SHOT_MICRO., SHOT_MINIcxx . . $ SHOT_MINI.};
411 static const int systemAnglecxx . . $ systemAngle.[MAX_UNITScxx . . $ MAX_UNITS.] = {truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!};
412 static const int baseDamagecxx . . $ baseDamage.[MAX_UNITScxx . . $ MAX_UNITS.] = {200, 120, 400, 300, 80, 150, 600, 40};
413 static const int systemAnicxx . . $ systemAni.[MAX_UNITScxx . . $ MAX_UNITS.] = {falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!};
414
415 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! weaponSystemscxx . . $ weaponSystems.[MAX_UNITScxx . . $ MAX_UNITS.][MAX_SHOT_TYPEScxx . . $ MAX_SHOT_TYPES.] =
416 {
417 {1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // normal
418 {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // nuke
419 {0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // dirt
420 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // worthless
421 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, // magnet
422 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0}, // laser
423 {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, // jumper
424 {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0} // helicopter
425 };
426
427 /* More constant configuration settings. */
428 /* Music that destruct will play. You can check out musmast.c to see what is what. */
429 static const JE_bytecxx . . $ JE_byte# goodselcxx . . $ goodsel.[14] /*[1..14]*/ = {1, 2, 6, 12, 13, 14, 17, 23, 24, 26, 28, 29, 32, 33};
430
431 /* Unit creation. Need to move this later: Doesn't belong here */
432 static JE_bytecxx . . $ JE_byte# basetypescxx . . $ basetypes.[10][11] /*[1..8, 1..11]*/ = /* [0] is amount of units*/
433 {
434 {5, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_SATELLITEcxx . . $ UNIT_SATELLITE., UNIT_MAGNETcxx . . $ UNIT_MAGNET., UNIT_LASERcxx . . $ UNIT_LASER., UNIT_JUMPERcxx . . $ UNIT_JUMPER., UNIT_HELIcxx . . $ UNIT_HELI.}, /*Normal*/
435 {1, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK.}, /*Traditional*/
436 {4, UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI.}, /*Weak Heli attack fleet*/
437 {8, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_MAGNETcxx . . $ UNIT_MAGNET., UNIT_LASERcxx . . $ UNIT_LASER., UNIT_JUMPERcxx . . $ UNIT_JUMPER.}, /*Strong Heli defense fleet*/
438 {8, UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_HELIcxx . . $ UNIT_HELI.}, /*Strong Heli attack fleet*/
439 {4, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_MAGNETcxx . . $ UNIT_MAGNET., UNIT_JUMPERcxx . . $ UNIT_JUMPER., UNIT_JUMPERcxx . . $ UNIT_JUMPER.}, /*Weak Heli defense fleet*/
440 {8, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_SATELLITEcxx . . $ UNIT_SATELLITE., UNIT_MAGNETcxx . . $ UNIT_MAGNET., UNIT_LASERcxx . . $ UNIT_LASER., UNIT_JUMPERcxx . . $ UNIT_JUMPER., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE.}, /*Overpowering fleet*/
441 {4, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_LASERcxx . . $ UNIT_LASER., UNIT_JUMPERcxx . . $ UNIT_JUMPER., UNIT_HELIcxx . . $ UNIT_HELI., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_JUMPERcxx . . $ UNIT_JUMPER.}, /*Weak fleet*/
442 {5, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_SATELLITEcxx . . $ UNIT_SATELLITE., UNIT_MAGNETcxx . . $ UNIT_MAGNET., UNIT_LASERcxx . . $ UNIT_LASER., UNIT_JUMPERcxx . . $ UNIT_JUMPER., UNIT_HELIcxx . . $ UNIT_HELI.}, /*Left custom*/
443 {5, UNIT_TANKcxx . . $ UNIT_TANK., UNIT_TANKcxx . . $ UNIT_TANK., UNIT_NUKEcxx . . $ UNIT_NUKE., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_DIRTcxx . . $ UNIT_DIRT., UNIT_SATELLITEcxx . . $ UNIT_SATELLITE., UNIT_MAGNETcxx . . $ UNIT_MAGNET., UNIT_LASERcxx . . $ UNIT_LASER., UNIT_JUMPERcxx . . $ UNIT_JUMPER., UNIT_HELIcxx . . $ UNIT_HELI.}, /*Right custom*/
444 };
445 static const unsigned int baseLookupcxx . . $ baseLookup.[MAX_PLAYERScxx . . $ MAX_PLAYERS.][MAX_MODEScxx . . $ MAX_MODES.] =
446 {
447 {0, 1, 3, 4, 6, 8},
448 {0, 1, 2, 5, 7, 9}
449 };
450
451 static const JE_bytecxx . . $ JE_byte# GraphicBasecxx . . $ GraphicBase.[MAX_PLAYERScxx . . $ MAX_PLAYERS.][MAX_UNITScxx . . $ MAX_UNITS.] =
452 {
453 { 1, 6, 11, 58, 63, 68, 96, 153},
454 { 20, 25, 30, 77, 82, 87, 115, 172}
455 };
456
457 static const JE_bytecxx . . $ JE_byte# ModeScorecxx . . $ ModeScore.[MAX_PLAYERScxx . . $ MAX_PLAYERS.][MAX_MODEScxx . . $ MAX_MODES.] =
458 {
459 {1, 0, 0, 5, 0, 1},
460 {1, 0, 5, 0, 1, 1}
461 };
462
463 static SDL_Scancodecxx . . $ SDL_Scancode# defaultKeyConfigcxx . . $ defaultKeyConfig.[MAX_PLAYERScxx . . $ MAX_PLAYERS.][MAX_KEYcxx . . $ MAX_KEY.][MAX_KEY_OPTIONScxx . . $ `src/destruct.c:70:9`!] =
464 {
465 {
466 {SDL_SCANCODE_Ccxx . . $ SDL_SCANCODE_C.},
467 {SDL_SCANCODE_Vcxx . . $ SDL_SCANCODE_V.},
468 {SDL_SCANCODE_Acxx . . $ SDL_SCANCODE_A.},
469 {SDL_SCANCODE_Zcxx . . $ SDL_SCANCODE_Z.},
470 {SDL_SCANCODE_LALTcxx . . $ SDL_SCANCODE_LALT.},
471 {SDL_SCANCODE_Xcxx . . $ SDL_SCANCODE_X., SDL_SCANCODE_LSHIFTcxx . . $ SDL_SCANCODE_LSHIFT.},
472 {SDL_SCANCODE_LCTRLcxx . . $ SDL_SCANCODE_LCTRL.},
473 {SDL_SCANCODE_SPACEcxx . . $ SDL_SCANCODE_SPACE.}
474 },
475 {
476 {SDL_SCANCODE_LEFTcxx . . $ SDL_SCANCODE_LEFT., SDL_SCANCODE_KP_4cxx . . $ SDL_SCANCODE_KP_4.},
477 {SDL_SCANCODE_RIGHTcxx . . $ SDL_SCANCODE_RIGHT., SDL_SCANCODE_KP_6cxx . . $ SDL_SCANCODE_KP_6.},
478 {SDL_SCANCODE_UPcxx . . $ SDL_SCANCODE_UP., SDL_SCANCODE_KP_8cxx . . $ SDL_SCANCODE_KP_8.},
479 {SDL_SCANCODE_DOWNcxx . . $ SDL_SCANCODE_DOWN., SDL_SCANCODE_KP_2cxx . . $ SDL_SCANCODE_KP_2.},
480 {SDL_SCANCODE_BACKSLASHcxx . . $ SDL_SCANCODE_BACKSLASH., SDL_SCANCODE_KP_5cxx . . $ SDL_SCANCODE_KP_5.},
481 {SDL_SCANCODE_INSERTcxx . . $ SDL_SCANCODE_INSERT., SDL_SCANCODE_RETURNcxx . . $ SDL_SCANCODE_RETURN., SDL_SCANCODE_KP_0cxx . . $ SDL_SCANCODE_KP_0., SDL_SCANCODE_KP_ENTERcxx . . $ SDL_SCANCODE_KP_ENTER.},
482 {SDL_SCANCODE_PAGEUPcxx . . $ SDL_SCANCODE_PAGEUP., SDL_SCANCODE_KP_9cxx . . $ SDL_SCANCODE_KP_9.},
483 {SDL_SCANCODE_PAGEDOWNcxx . . $ SDL_SCANCODE_PAGEDOWN., SDL_SCANCODE_KP_3cxx . . $ SDL_SCANCODE_KP_3.}
484 }
485 };
486
487 /*** Globals ***/
488 static SDL_Surfacecxx . . $ SDL_Surface# *destructTempScreencxx . . $ destructTempScreen.;
489 static JE_booleancxx . . $ JE_boolean# destructFirstTimecxx . . $ destructFirstTime.;
490
491 static struct destruct_config_scxx . . $ destruct_config_s# configcxx . . $ config. = { 40, 20, 20, 40, 10, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, {truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!}, {truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!} };
492 static struct destruct_player_scxx . . $ destruct_player_s# destruct_playercxx . . $ destruct_player.[MAX_PLAYERScxx . . $ MAX_PLAYERS.];
493 static struct destruct_world_scxx . . $ destruct_world_s# worldcxx . . $ world.;
494 static struct destruct_shot_scxx . . $ destruct_shot_s# * shotReccxx . . $ shotRec.;
495 static struct destruct_explo_scxx . . $ destruct_explo_s# * exploReccxx . . $ exploRec.;
496
497 static const char *const player_namescxx . . $ player_names.[] =
498 {
499 "left",
500 "right",
501 };
502
503 static const char *const key_namescxx . . $ key_names.[] =
504 {
505 "left",
506 "right",
507 "up",
508 "down",
509 "change",
510 "fire",
511 "previous weapon",
512 "next weapon",
513 };
514
515 static const char *const unit_namescxx . . $ unit_names.[] =
516 {
517 "tank",
518 "nuke",
519 "dirt",
520 "satellite",
521 "magnet",
522 "laser",
523 "jumper",
524 "heli",
525 };
526
527 static enum de_unit_tcxx . . $ de_unit_t# get_unit_by_namecxx . . $ get_unit_by_name(43bf32baab236a41).(const char *unit_name)
528 {
529 for (enum de_unit_tcxx . . $ de_unit_t# unit = UNIT_FIRSTcxx . . $ UNIT_FIRST.; unit < MAX_UNITScxx . . $ MAX_UNITS.; ++unit)
530 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(unit_name, unit_namescxx . . $ unit_names.[unit]) == 0)
531 return unit;
532
533 return UNIT_NONEcxx . . $ UNIT_NONE.;
534 }
535
536 static void load_destruct_configcxx . . $ load_destruct_config(b7cb4517c44ac027).(Configcxx . . $ Config# *config_)
537 {
538 ConfigSectioncxx . . $ ConfigSection# *section;
539
540 section = config_find_or_add_sectioncxx . . $ config_find_or_add_section(9d60c5d7489db765).(config_, "destruct", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
541 if (section == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
542 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!); // out of memory
543
544 configcxx . . $ config..alwaysaliascxx . . $ destruct_config_s#alwaysalias. = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "antialias craters", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NO_YEScxx . . $ NO_YES.);
545
546 weaponSystemscxx . . $ weaponSystems.[UNIT_LASERcxx . . $ UNIT_LASER.][SHOT_LASERTRACERcxx . . $ SHOT_LASERTRACER.] = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "tracer laser", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, OFF_ONcxx . . $ OFF_ON.);
547
548 configcxx . . $ config..max_shotscxx . . $ destruct_config_s#max_shots. = config_get_or_set_int_optioncxx . . $ config_get_or_set_int_option(bd9cb9e767e253ec).(section, "max shots", 40);
549 configcxx . . $ config..max_explosionscxx . . $ destruct_config_s#max_explosions. = config_get_or_set_int_optioncxx . . $ config_get_or_set_int_option(bd9cb9e767e253ec).(section, "max explosions", 40);
550 configcxx . . $ config..min_wallscxx . . $ destruct_config_s#min_walls. = config_get_or_set_int_optioncxx . . $ config_get_or_set_int_option(bd9cb9e767e253ec).(section, "min walls", 20);
551 configcxx . . $ config..max_wallscxx . . $ destruct_config_s#max_walls. = config_get_or_set_int_optioncxx . . $ config_get_or_set_int_option(bd9cb9e767e253ec).(section, "max walls", 20);
552
553 configcxx . . $ config..aicxx . . $ destruct_config_s#ai.[0] = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "left ai", truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, NO_YEScxx . . $ NO_YES.);
554 configcxx . . $ config..jumper_straightcxx . . $ destruct_config_s#jumper_straight.[0] = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "left jumper fires straight", truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, NO_YEScxx . . $ NO_YES.);
555 configcxx . . $ config..aicxx . . $ destruct_config_s#ai.[1] = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "right ai", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NO_YEScxx . . $ NO_YES.);
556 configcxx . . $ config..jumper_straightcxx . . $ destruct_config_s#jumper_straight.[1] = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "right jumper fires straight", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NO_YEScxx . . $ NO_YES.);
557
558 // keyboard controls
559
560 for (int p = 0; p < MAX_PLAYERScxx . . $ MAX_PLAYERS.; ++p)
561 {
562 section = config_find_sectioncxx . . $ config_find_section(9d60c5d7489db765).(config_, "destruct keyboard", player_namescxx . . $ player_names.[p]);
563 if (section == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
564 if ((section = config_add_sectioncxx . . $ config_add_section(9d60c5d7489db765).(config_, "destruct keyboard", player_namescxx . . $ player_names.[p])) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
565 exitcxx . . $ exit(3ca292c338df9bb3).(-1);
566
567 ConfigOptioncxx . . $ ConfigOption# *option;
568
569 for (int k = 0; k < MAX_KEYcxx . . $ MAX_KEY.; ++k)
570 {
571 if ((option = config_get_or_set_optioncxx . . $ config_get_or_set_option(a828e1840e46298e).(section, key_namescxx . . $ key_names.[k], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
572 exitcxx . . $ exit(3ca292c338df9bb3).(-1);
573
574 foreach_option_i_valuecxx . . $ `src/config_file.h:574:9`!(i, value, option)
575 {
576 SDL_Scancodecxx . . $ SDL_Scancode# key = SDL_GetScancodeFromNamecxx . . $ SDL_GetScancodeFromName(fb4900f4c3435660).(value);
577 if (key != SDL_SCANCODE_UNKNOWNcxx . . $ SDL_SCANCODE_UNKNOWN. && i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(defaultKeyConfig[p][k]))
578 {
579 defaultKeyConfigcxx . . $ defaultKeyConfig.[p][k][i] = key;
580 }
581 else // invalid or excess
582 {
583 foreach_remove_option_valuecxx . . $ `src/config_file.h:585:9`!();
584 continue;
585 }
586 }
587
588 if (config_get_value_countcxx . . $ config_get_value_count(6881ebc08440b4a5).(option) > 0)
589 {
590 // unset remaining defaults
591 for (unsigned int i = config_get_value_countcxx . . $ config_get_value_count(6881ebc08440b4a5).(option); i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(defaultKeyConfig[p][k]); ++i)
592 defaultKeyConfigcxx . . $ defaultKeyConfig.[p][k][i] = SDL_SCANCODE_UNKNOWNcxx . . $ SDL_SCANCODE_UNKNOWN.;
593 }
594 else
595 {
596 // set defaults
597 for (unsigned int i = 0; i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(defaultKeyConfig[p][k]); ++i)
598 if (defaultKeyConfigcxx . . $ defaultKeyConfig.[p][k][i] != SDL_SCANCODE_UNKNOWNcxx . . $ SDL_SCANCODE_UNKNOWN.)
599 config_add_valuecxx . . $ config_add_value(933b7be54a5eb800).(option, SDL_GetScancodeNamecxx . . $ SDL_GetScancodeName(784ff5cdfe45052d).(defaultKeyConfigcxx . . $ defaultKeyConfig.[p][k][i]));
600 }
601 }
602 }
603
604 // custom destruct mode
605
606 section = config_find_sectioncxx . . $ config_find_section(9d60c5d7489db765).(config_, "destruct custom", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
607 if (section == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
608 if ((section = config_add_sectioncxx . . $ config_add_section(9d60c5d7489db765).(config_, "destruct custom", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
609 exitcxx . . $ exit(3ca292c338df9bb3).(-1);
610
611 configcxx . . $ config..allow_customcxx . . $ destruct_config_s#allow_custom. = config_get_or_set_bool_optioncxx . . $ config_get_or_set_bool_option(d7712a9617cb47df).(section, "enable", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NO_YEScxx . . $ NO_YES.);
612
613 char buffer[15 + 1];
614
615 for (int p = 0; p < MAX_PLAYERScxx . . $ MAX_PLAYERS.; ++p)
616 {
617 snprintfcxx . . $ snprintf(ea502d73e74c754c).(buffer, sizeof(buffer), "%s num units", player_namescxx . . $ player_names.[p]);
618 basetypescxx . . $ basetypes.[8 + p][0] = config_get_or_set_int_optioncxx . . $ config_get_or_set_int_option(bd9cb9e767e253ec).(section, buffer, basetypescxx . . $ basetypes.[8 + p][0]);
619
620 ConfigOptioncxx . . $ ConfigOption# *option;
621
622 snprintfcxx . . $ snprintf(ea502d73e74c754c).(buffer, sizeof(buffer), "%s unit", player_namescxx . . $ player_names.[p]);
623 if ((option = config_get_or_set_optioncxx . . $ config_get_or_set_option(a828e1840e46298e).(section, buffer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
624 exitcxx . . $ exit(3ca292c338df9bb3).(-1);
625
626 foreach_option_i_valuecxx . . $ `src/config_file.h:574:9`!(i, value, option)
627 {
628 enum de_unit_tcxx . . $ de_unit_t# unit = get_unit_by_namecxx . . $ get_unit_by_name(43bf32baab236a41).(value);
629 if (unit != UNIT_NONEcxx . . $ UNIT_NONE. && 1 + i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(basetypes[8 + p]))
630 {
631 basetypescxx . . $ basetypes.[8 + p][1 + i] = unit;
632 }
633 else // invalid or excess
634 {
635 foreach_remove_option_valuecxx . . $ `src/config_file.h:585:9`!();
636 continue;
637 }
638 }
639
640 if (config_get_value_countcxx . . $ config_get_value_count(6881ebc08440b4a5).(option) > 0)
641 {
642 // set remaining units to tank
643 for (unsigned int i = config_get_value_countcxx . . $ config_get_value_count(6881ebc08440b4a5).(option); 1 + i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(basetypes[8 + p]); ++i)
644 {
645 basetypescxx . . $ basetypes.[8 + p][1 + i] = UNIT_TANKcxx . . $ UNIT_TANK.;
646 config_add_valuecxx . . $ config_add_value(933b7be54a5eb800).(option, unit_namescxx . . $ unit_names.[UNIT_TANKcxx . . $ UNIT_TANK.]);
647 }
648 }
649 else
650 {
651 // set defaults
652 for (unsigned int i = 0; 1 + i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(basetypes[8 + p]); ++i)
653 config_add_valuecxx . . $ config_add_value(933b7be54a5eb800).(option, unit_namescxx . . $ unit_names.[basetypescxx . . $ basetypes.[8 + p][1 + i]]);
654 }
655 }
656 }
657
658 /*** Startup ***/
659
660 void JE_destructGamecxx . . $ JE_destructGame(49f6e7a06ebc5aa8).(void)
661 {
662 unsigned int i;
663
664 /* This is the entry function. Any one-time actions we need to
665 * perform can go in here. */
666 JE_clr256cxx . . $ JE_clr256(60a0b30a00b4fc6d).(VGAScreencxx . . $ VGAScreen.);
667 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
668
669 load_destruct_configcxx . . $ load_destruct_config(b7cb4517c44ac027).(&opentyrian_configcxx . . $ opentyrian_config.);
670
671 //malloc things that have customizable sizes
672 shotReccxx . . $ shotRec. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct destruct_shot_scxx . . $ destruct_shot_s#) * configcxx . . $ config..max_shotscxx . . $ destruct_config_s#max_shots.);
673 exploReccxx . . $ exploRec. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct destruct_explo_scxx . . $ destruct_explo_s#) * configcxx . . $ config..max_explosionscxx . . $ destruct_config_s#max_explosions.);
674 worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct destruct_wall_scxx . . $ destruct_wall_s#) * configcxx . . $ config..max_wallscxx . . $ destruct_config_s#max_walls.);
675
676 //Malloc enough structures to cover all of this session's possible needs.
677 for (i = 0; i < 10; i++)
678 configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations. = MAXcxx . . $ `src/opentyr.h:29:9`!(config.max_installations, basetypes[i][0]);
679 destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT. ].unitcxx . . $ destruct_player_s#unit. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct destruct_unit_scxx . . $ destruct_unit_s#) * configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.);
680 destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].unitcxx . . $ destruct_player_s#unit. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct destruct_unit_scxx . . $ destruct_unit_s#) * configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.);
681
682 destructTempScreencxx . . $ destructTempScreen. = game_screencxx . . $ game_screen.;
683 worldcxx . . $ world..VGAScreencxx . . $ destruct_world_s#VGAScreen. = VGAScreencxx . . $ VGAScreen.;
684
685 JE_loadCompShapescxx . . $ JE_loadCompShapes(676db0deaa5c5c40).(&destructSpriteSheetcxx . . $ destructSpriteSheet., '~');
686
687 fade_blackcxx . . $ fade_black(d4f767463ce0a6b3).(1);
688
689 JE_destructMaincxx . . $ JE_destructMain(49f6e7a06ebc5aa8).();
690
691 free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(&destructSpriteSheetcxx . . $ destructSpriteSheet.);
692
693 //and of course exit actions go here.
694 freecxx . . $ free(5d22bdacc48458e8).(shotReccxx . . $ shotRec.);
695 freecxx . . $ free(5d22bdacc48458e8).(exploReccxx . . $ exploRec.);
696 freecxx . . $ free(5d22bdacc48458e8).(worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.);
697 freecxx . . $ free(5d22bdacc48458e8).(destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT. ].unitcxx . . $ destruct_player_s#unit.);
698 freecxx . . $ free(5d22bdacc48458e8).(destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].unitcxx . . $ destruct_player_s#unit.);
699 }
700
701 static void JE_destructMaincxx . . $ JE_destructMain(49f6e7a06ebc5aa8).(void)
702 {
703 enum de_state_tcxx . . $ de_state_t# curState;
704
705 JE_loadPiccxx . . $ JE_loadPic(4846ed2ea5b0a844).(VGAScreencxx . . $ VGAScreen., 11, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
706 JE_introScreencxx . . $ JE_introScreen(49f6e7a06ebc5aa8).();
707
708 DE_ResetPlayerscxx . . $ DE_ResetPlayers(49f6e7a06ebc5aa8).();
709
710 destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT. ].is_cpucxx . . $ destruct_player_s#is_cpu. = configcxx . . $ config..aicxx . . $ destruct_config_s#ai.[PLAYER_LEFTcxx . . $ PLAYER_LEFT.];
711 destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].is_cpucxx . . $ destruct_player_s#is_cpu. = configcxx . . $ config..aicxx . . $ destruct_config_s#ai.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.];
712
713 while (truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
714 {
715 worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode. = JE_modeSelectcxx . . $ JE_modeSelect(edf75d82bf086192).();
716
717 if (worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode. == MODE_NONEcxx . . $ MODE_NONE.)
718 break; /* User is quitting */
719
720 do
721 {
722
723 destructFirstTimecxx . . $ destructFirstTime. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
724 JE_loadPiccxx . . $ JE_loadPic(4846ed2ea5b0a844).(VGAScreencxx . . $ VGAScreen., 11, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
725
726 DE_ResetUnitscxx . . $ DE_ResetUnits(49f6e7a06ebc5aa8).();
727 DE_ResetLevelcxx . . $ DE_ResetLevel(49f6e7a06ebc5aa8).();
728 do
729 {
730 curState = DE_RunTickcxx . . $ DE_RunTick(824bd1aac937bb2e).();
731 } while (curState == STATE_CONTINUEcxx . . $ STATE_CONTINUE.);
732
733 fade_blackcxx . . $ fade_black(d4f767463ce0a6b3).(25);
734 } while (curState == STATE_RELOADcxx . . $ STATE_RELOAD.);
735 }
736 }
737
738 static void JE_introScreencxx . . $ JE_introScreen(49f6e7a06ebc5aa8).(void)
739 {
740 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->hcxx . . $ SDL_Surface#h. * VGAScreen2cxx . . $ VGAScreen2.->pitchcxx . . $ SDL_Surface#pitch.);
741 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., JE_fontCentercxx . . $ JE_fontCenter(1df18506ef0a631b).(specialNamecxx . . $ specialName.[7], TINY_FONTcxx . . $ `src/sprite.h:31:9`!), 90, specialNamecxx . . $ specialName.[7], 12, 5);
742 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., JE_fontCentercxx . . $ JE_fontCenter(1df18506ef0a631b).(miscTextcxx . . $ miscText.[64], TINY_FONTcxx . . $ `src/sprite.h:31:9`!), 180, miscTextcxx . . $ miscText.[64], 15, 2);
743 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., JE_fontCentercxx . . $ JE_fontCenter(1df18506ef0a631b).(miscTextcxx . . $ miscText.[65], TINY_FONTcxx . . $ `src/sprite.h:31:9`!), 190, miscTextcxx . . $ miscText.[65], 15, 2);
744 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
745 fade_palettecxx . . $ fade_palette(59ab901998e00635).(colorscxx . . $ colors., 15, 0, 255);
746
747 newkeycxx . . $ newkey. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
748 while (!newkeycxx . . $ newkey.)
749 {
750 service_SDL_eventscxx . . $ service_SDL_events(b45ddcbc8423892c).(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
751 SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(16);
752 }
753
754 fade_blackcxx . . $ fade_black(d4f767463ce0a6b3).(15);
755 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->hcxx . . $ SDL_Surface#h. * VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.);
756 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
757 }
758
759 /* JE_modeSelect
760 *
761 * This function prints the DESTRUCT mode selection menu.
762 * The return value is the selected mode, or -1 (MODE_NONE)
763 * if the user quits.
764 */
765 static void DrawModeSelectMenucxx . . $ DrawModeSelectMenu(1b96a3b1e7d5097c).(enum de_mode_tcxx . . $ de_mode_t# mode)
766 {
767 int i;
768
769 /* Helper function of JE_modeSelect. Do not use elsewhere. */
770 for (i = 0; i < DESTRUCT_MODEScxx . . $ `src/helptext.h:30:9`!; i++)
771 JE_textShadecxx . . $ JE_textShade(bb6cf87f29d3df77).(VGAScreencxx . . $ VGAScreen., JE_fontCentercxx . . $ JE_fontCenter(1df18506ef0a631b).(destructModeNamecxx . . $ destructModeName.[i], TINY_FONTcxx . . $ `src/sprite.h:31:9`!), 82 + i * 12, destructModeNamecxx . . $ destructModeName.[i], 12, (i == mode) * 4, FULL_SHADEcxx . . $ `src/fonthand.h:27:9`!);
772 if (configcxx . . $ config..allow_customcxx . . $ destruct_config_s#allow_custom. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
773 JE_textShadecxx . . $ JE_textShade(bb6cf87f29d3df77).(VGAScreencxx . . $ VGAScreen., JE_fontCentercxx . . $ JE_fontCenter(1df18506ef0a631b).("Custom", TINY_FONTcxx . . $ `src/sprite.h:31:9`!), 82 + i * 12, "Custom", 12, (i == mode) * 4, FULL_SHADEcxx . . $ `src/fonthand.h:27:9`!);
774 }
775
776 static enum de_mode_tcxx . . $ de_mode_t# JE_modeSelectcxx . . $ JE_modeSelect(edf75d82bf086192).(void)
777 {
778 enum de_mode_tcxx . . $ de_mode_t# mode;
779
780 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->hcxx . . $ SDL_Surface#h. * VGAScreen2cxx . . $ VGAScreen2.->pitchcxx . . $ SDL_Surface#pitch.);
781 mode = MODE_5CARDWARcxx . . $ MODE_5CARDWAR.;
782
783 // Draw the menu and fade us in
784 DrawModeSelectMenucxx . . $ DrawModeSelectMenu(1b96a3b1e7d5097c).(mode);
785
786 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
787 fade_palettecxx . . $ fade_palette(59ab901998e00635).(colorscxx . . $ colors., 15, 0, 255);
788
789 /* Get input in a loop. */
790 while (truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
791 {
792 /* Re-draw the menu every iteration */
793 DrawModeSelectMenucxx . . $ DrawModeSelectMenu(1b96a3b1e7d5097c).(mode);
794 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
795
796 /* Grab keys */
797 newkeycxx . . $ newkey. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
798 do
799 {
800 service_SDL_eventscxx . . $ service_SDL_events(b45ddcbc8423892c).(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
801 SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(16);
802 } while (!newkeycxx . . $ newkey.);
803
804 /* See what was pressed */
805 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_ESCAPEcxx . . $ SDL_SCANCODE_ESCAPE.])
806 {
807 mode = MODE_NONEcxx . . $ MODE_NONE.; /* User is quitting, return failure */
808 break;
809 }
810 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_RETURNcxx . . $ SDL_SCANCODE_RETURN.])
811 {
812 break; /* User has selected, return choice */
813 }
814 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_UPcxx . . $ SDL_SCANCODE_UP.])
815 {
816 if (mode == MODE_FIRSTcxx . . $ MODE_FIRST.)
817 {
818 if (configcxx . . $ config..allow_customcxx . . $ destruct_config_s#allow_custom. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
819 mode = MODE_LASTcxx . . $ MODE_LAST.;
820 else
821 mode = MODE_LASTcxx . . $ MODE_LAST.-1;
822 }
823 else
824 {
825 mode--;
826 }
827 }
828 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_DOWNcxx . . $ SDL_SCANCODE_DOWN.])
829 {
830 if (mode >= MODE_LASTcxx . . $ MODE_LAST.-1)
831 {
832 if (configcxx . . $ config..allow_customcxx . . $ destruct_config_s#allow_custom. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! && mode == MODE_LASTcxx . . $ MODE_LAST.-1)
833 mode++;
834 else
835 mode = MODE_FIRSTcxx . . $ MODE_FIRST.;
836 }
837 else
838 {
839 mode++;
840 }
841 }
842 }
843
844 fade_blackcxx . . $ fade_black(d4f767463ce0a6b3).(15);
845 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->hcxx . . $ SDL_Surface#h. * VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.);
846 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
847 return mode;
848 }
849
850 static void JE_generateTerraincxx . . $ JE_generateTerrain(49f6e7a06ebc5aa8).(void)
851 {
852 /* The unique modifiers:
853 Altered generation (really tall)
854 Fuzzy hills
855 Rings of dirt
856
857 The non-unique ones;:
858 Rings of not dirt (holes)
859 Walls
860 */
861
862 worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. = MAP_NORMALcxx . . $ MAP_NORMAL.;
863
864 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 2 == 0)
865 worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. |= MAP_WALLScxx . . $ MAP_WALLS.;
866 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 4 == 0)
867 worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. |= MAP_HOLEScxx . . $ MAP_HOLES.;
868 switch (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 4)
869 {
870 case 0:
871 worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. |= MAP_FUZZYcxx . . $ MAP_FUZZY.;
872 break;
873
874 case 1:
875 worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. |= MAP_TALLcxx . . $ MAP_TALL.;
876 break;
877
878 case 2:
879 worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. |= MAP_RINGScxx . . $ MAP_RINGS.;
880 break;
881 }
882
883 play_songcxx . . $ play_song(cb2f890c2fdad230).(goodselcxx . . $ goodsel.[mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 14] - 1);
884
885 DE_generateBaseTerraincxx . . $ DE_generateBaseTerrain(ec424488036d5d70).(worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags., worldcxx . . $ world..baseMapcxx . . $ destruct_world_s#baseMap.);
886 DE_generateUnitscxx . . $ DE_generateUnits(218b13e5e7cbf689).(worldcxx . . $ world..baseMapcxx . . $ destruct_world_s#baseMap.);
887 DE_generateWallscxx . . $ DE_generateWalls(20fa528b014a5b4e).(&worldcxx . . $ world.);
888 DE_drawBaseTerraincxx . . $ DE_drawBaseTerrain(218b13e5e7cbf689).(worldcxx . . $ world..baseMapcxx . . $ destruct_world_s#baseMap.);
889
890 if (worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. & MAP_RINGScxx . . $ MAP_RINGS.)
891 DE_generateRingscxx . . $ DE_generateRings(91b72255c859517f).(worldcxx . . $ world..VGAScreencxx . . $ destruct_world_s#VGAScreen., PIXEL_DIRTcxx . . $ PIXEL_DIRT.);
892 if (worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. & MAP_HOLEScxx . . $ MAP_HOLES.)
893 DE_generateRingscxx . . $ DE_generateRings(91b72255c859517f).(worldcxx . . $ world..VGAScreencxx . . $ destruct_world_s#VGAScreen., PIXEL_BLACKcxx . . $ PIXEL_BLACK.);
894
895 JE_aliasDirtcxx . . $ JE_aliasDirt(60a0b30a00b4fc6d).(worldcxx . . $ world..VGAScreencxx . . $ destruct_world_s#VGAScreen.);
896 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
897
898 memcpycxx . . $ memcpy(cc817cb175f282d).(destructTempScreencxx . . $ destructTempScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch. * destructTempScreencxx . . $ destructTempScreen.->hcxx . . $ SDL_Surface#h.);
899 }
900
901 static void DE_generateBaseTerraincxx . . $ DE_generateBaseTerrain(ec424488036d5d70).(unsigned int mapFlags, unsigned int * baseWorld)
902 {
903 unsigned int i;
904 unsigned int newheight, HeightMul;
905 float sinewave, sinewave2, cosinewave, cosinewave2;
906
907 /* The 'terrain' is actually the video buffer :). If it's brown, flu... er,
908 * brown pixels are what we check for collisions with. */
909
910 /* The ranges here are between .01 and roughly 0.07283...*/
911 sinewave = mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / 50 + 0.01f;
912 sinewave2 = mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / 50 + 0.01f;
913 cosinewave = mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / 50 + 0.01f;
914 cosinewave2 = mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / 50 + 0.01f;
915 HeightMul = 20;
916
917 /* This block just exists to mix things up. */
918 if (mapFlags & MAP_FUZZYcxx . . $ MAP_FUZZY.)
919 {
920 sinewave = M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! - mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * 0.3f;
921 sinewave2 = M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! - mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * 0.3f;
922 }
923 if (mapFlags & MAP_TALLcxx . . $ MAP_TALL.)
924 {
925 HeightMul = 100;
926 }
927
928 /* Now compute a height for each of our lines. */
929 for (i = 1; i <= 318; i++)
930 {
931 newheight = roundf(sinf(sinewave * i) * HeightMul + sinf(sinewave2 * i) * 15 +
932 cosf(cosinewave * i) * 10 + sinf(cosinewave2 * i) * 15) + 130;
933
934 /* Bind it; we have mins and maxs */
935 if (newheight < 40)
936 newheight = 40;
937 else if (newheight > 195)
938 newheight = 195;
939 baseWorld[i] = newheight;
940 }
941 /* The base world has been created. */
942 }
943
944 static void DE_drawBaseTerraincxx . . $ DE_drawBaseTerrain(218b13e5e7cbf689).(unsigned int * baseWorld)
945 {
946 unsigned int i;
947
948 for (i = 1; i <= 318; i++)
949 {
950 JE_rectanglecxx . . $ JE_rectangle(fa5faf37b232239e).(VGAScreencxx . . $ VGAScreen., i, baseWorld[i], i, 199, PIXEL_DIRTcxx . . $ PIXEL_DIRT.);
951 }
952 }
953
954 static void DE_generateUnitscxx . . $ DE_generateUnits(218b13e5e7cbf689).(unsigned int * baseWorld)
955 {
956 unsigned int i, j, numSatellites;
957
958 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
959 {
960 numSatellites = 0;
961 destruct_playercxx . . $ destruct_player.[i].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining. = 0;
962
963 for (j = 0; j < basetypescxx . . $ basetypes.[baseLookupcxx . . $ baseLookup.[i][worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode.]][0]; j++)
964 {
965 /* Not everything is the same between players */
966 if (i == PLAYER_LEFTcxx . . $ PLAYER_LEFT.)
967 {
968 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitXcxx . . $ destruct_unit_s#unitX. = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 120) + 10;
969 }
970 else
971 {
972 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitXcxx . . $ destruct_unit_s#unitX. = 320 - ((mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 120) + 22);
973 }
974
975 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitYcxx . . $ destruct_unit_s#unitY. = JE_placementPositioncxx . . $ JE_placementPosition(df145c89fad21506).(destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitXcxx . . $ destruct_unit_s#unitX. - 1, 14, baseWorld);
976 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitTypecxx . . $ destruct_unit_s#unitType. = basetypescxx . . $ basetypes.[baseLookupcxx . . $ baseLookup.[i][worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode.]][(mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 10) + 1];
977
978 /* Sats are special cases since they are useless. They don't count
979 * as active units and we can't have a team of all sats */
980 if (destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_SATELLITEcxx . . $ UNIT_SATELLITE.)
981 {
982 if (numSatellites == basetypescxx . . $ basetypes.[baseLookupcxx . . $ baseLookup.[i][worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode.]][0])
983 {
984 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitTypecxx . . $ destruct_unit_s#unitType. = UNIT_TANKcxx . . $ UNIT_TANK.;
985 destruct_playercxx . . $ destruct_player.[i].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining.++;
986 }
987 else
988 {
989 /* Place the satellite. Note: Earlier we cleared
990 * space with JE_placementPosition. Now we are randomly
991 * placing the sat's Y. It can be generated in hills
992 * and there is a clearing underneath it. This CAN
993 * be fixed but won't be for classic.
994 */
995 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitYcxx . . $ destruct_unit_s#unitY. = 30 + (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 40);
996 numSatellites++;
997 }
998 }
999 else
1000 {
1001 destruct_playercxx . . $ destruct_player.[i].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining.++;
1002 }
1003
1004 /* Now just fill in the rest of the unit's values. */
1005 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].lastMovecxx . . $ destruct_unit_s#lastMove. = 0;
1006 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitYMovcxx . . $ destruct_unit_s#unitYMov. = 0;
1007 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].isYInAircxx . . $ destruct_unit_s#isYInAir. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1008 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].anglecxx . . $ destruct_unit_s#angle. = 0;
1009 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].powercxx . . $ destruct_unit_s#power. = (destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_LASERcxx . . $ UNIT_LASER.) ? 6 : 3;
1010 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].shotTypecxx . . $ destruct_unit_s#shotType. = defaultWeaponcxx . . $ defaultWeapon.[destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitTypecxx . . $ destruct_unit_s#unitType.];
1011 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].healthcxx . . $ destruct_unit_s#health. = baseDamagecxx . . $ baseDamage.[destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitTypecxx . . $ destruct_unit_s#unitType.];
1012 destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].ani_framecxx . . $ destruct_unit_s#ani_frame. = 0;
1013 }
1014 }
1015 }
1016
1017 static void DE_generateWallscxx . . $ DE_generateWalls(20fa528b014a5b4e).(struct destruct_world_scxx . . $ destruct_world_s# * gameWorld)
1018 {
1019 unsigned int i, j, wallX;
1020 unsigned int wallHeight, remainWalls;
1021 unsigned int tries;
1022 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! isGood;
1023
1024 if ((worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. & MAP_WALLScxx . . $ MAP_WALLS.) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
1025 {
1026 /* Just clear them out */
1027 for (i = 0; i < configcxx . . $ config..max_wallscxx . . $ destruct_config_s#max_walls.; i++)
1028 {
1029 gameWorld->mapWallscxx . . $ destruct_world_s#mapWalls.[i].wallExistcxx . . $ destruct_wall_s#wallExist. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1030 }
1031 return;
1032 }
1033
1034 remainWalls = (randcxx . . $ rand(b126dc7c1de90089).() % (configcxx . . $ config..max_wallscxx . . $ destruct_config_s#max_walls. - configcxx . . $ config..min_wallscxx . . $ destruct_config_s#min_walls. + 1)) + configcxx . . $ config..min_wallscxx . . $ destruct_config_s#min_walls.;
1035
1036 do
1037 {
1038 /* Create a wall. Decide how tall the wall will be */
1039 wallHeight = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 5) + 1;
1040 if (wallHeight > remainWalls)
1041 {
1042 wallHeight = remainWalls;
1043 }
1044
1045 /* Now find a good place to put the wall. */
1046 tries = 0;
1047 do
1048 {
1049 isGood = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1050 wallX = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 300) + 10;
1051
1052 /* Is this X already occupied? In the original Tyrian we only
1053 * checked to make sure four units on each side were unobscured.
1054 * That's not very scalable; instead I will check every unit,
1055 * but I'll only try plotting an unobstructed X four times.
1056 * After that we'll cover up what may; having a few units
1057 * stuck behind walls makes things mildly interesting.
1058 */
1059 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
1060 {
1061 for (j = 0; j < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; j++)
1062 {
1063 if ((wallX > destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitXcxx . . $ destruct_unit_s#unitX. - 12) &&
1064 (wallX < destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[j].unitXcxx . . $ destruct_unit_s#unitX. + 13))
1065 {
1066 isGood = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1067 goto label_outer_break; /* I do feel that outer breaking is a legitimate goto use. */
1068 }
1069 }
1070 }
1071
1072 label_outer_break:
1073 tries++;
1074
1075 } while (isGood == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! && tries < 5);
1076
1077 /* We now have a valid X. Create the wall. */
1078 for (i = 1; i <= wallHeight; i++)
1079 {
1080 gameWorld->mapWallscxx . . $ destruct_world_s#mapWalls.[remainWalls - i].wallExistcxx . . $ destruct_wall_s#wallExist. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1081 gameWorld->mapWallscxx . . $ destruct_world_s#mapWalls.[remainWalls - i].wallXcxx . . $ destruct_wall_s#wallX. = wallX;
1082 gameWorld->mapWallscxx . . $ destruct_world_s#mapWalls.[remainWalls - i].wallYcxx . . $ destruct_wall_s#wallY. = JE_placementPositioncxx . . $ JE_placementPosition(df145c89fad21506).(wallX, 12, gameWorld->baseMapcxx . . $ destruct_world_s#baseMap.) - 14 * i;
1083 }
1084
1085 remainWalls -= wallHeight;
1086
1087 } while (remainWalls != 0);
1088 }
1089
1090 static void DE_generateRingscxx . . $ DE_generateRings(91b72255c859517f).(SDL_Surfacecxx . . $ SDL_Surface# * screen, Uint8cxx . . $ Uint8# pixel)
1091 {
1092 unsigned int i, j, tempSize, rings;
1093 int tempPosX1, tempPosY1, tempPosX2, tempPosY2;
1094 float tempRadian;
1095
1096 rings = mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 6 + 1;
1097 for (i = 1; i <= rings; i++)
1098 {
1099 tempPosX1 = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 320);
1100 tempPosY1 = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 160) + 20;
1101 tempSize = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 40) + 10; /*Size*/
1102
1103 for (j = 1; j <= tempSize * tempSize * 2; j++)
1104 {
1105 tempRadian = mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * (2 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!);
1106 tempPosY2 = tempPosY1 + roundf(cosf(tempRadian) * (mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * 0.1f + 0.9f) * tempSize);
1107 tempPosX2 = tempPosX1 + roundf(sinf(tempRadian) * (mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * 0.1f + 0.9f) * tempSize);
1108 if ((tempPosY2 > 12) && (tempPosY2 < 200) &&
1109 (tempPosX2 > 0) && (tempPosX2 < 319))
1110 {
1111 ((Uint8cxx . . $ Uint8# *)screen->pixelscxx . . $ SDL_Surface#pixels.)[tempPosX2 + tempPosY2 * screen->pitchcxx . . $ SDL_Surface#pitch.] = pixel;
1112 }
1113 }
1114 }
1115 }
1116
1117 static unsigned int aliasDirtPixelcxx . . $ aliasDirtPixel(51c56bf3b37373e3).(const SDL_Surfacecxx . . $ SDL_Surface# * screen, unsigned int x, unsigned int y, const Uint8cxx . . $ Uint8# * s)
1118 {
1119 //A helper function used when aliasing dirt. That's a messy process;
1120 //let's contain the mess here.
1121 unsigned int newColor = PIXEL_BLACKcxx . . $ PIXEL_BLACK.;
1122
1123 if ((y > 0) && (*(s - screen->pitchcxx . . $ SDL_Surface#pitch.) == PIXEL_DIRTcxx . . $ PIXEL_DIRT.)) // look up
1124 newColor += 1;
1125 if ((y < screen->hcxx . . $ SDL_Surface#h. - 1u) && (*(s + screen->pitchcxx . . $ SDL_Surface#pitch.) == PIXEL_DIRTcxx . . $ PIXEL_DIRT.)) // look down
1126 newColor += 3;
1127 if ((x > 0) && (*(s - 1) == PIXEL_DIRTcxx . . $ PIXEL_DIRT.)) // look left
1128 newColor += 2;
1129 if ((x < screen->pitchcxx . . $ SDL_Surface#pitch. - 1u) && (*(s + 1) == PIXEL_DIRTcxx . . $ PIXEL_DIRT.)) // look right
1130 newColor += 2;
1131 if (newColor != PIXEL_BLACKcxx . . $ PIXEL_BLACK.)
1132 return newColor + 16; // 16 must be the start of the brown pixels.
1133
1134 return PIXEL_BLACKcxx . . $ PIXEL_BLACK.;
1135 }
1136
1137 static void JE_aliasDirtcxx . . $ JE_aliasDirt(60a0b30a00b4fc6d).(SDL_Surfacecxx . . $ SDL_Surface# * screen)
1138 {
1139 /* This complicated looking function goes through the whole screen
1140 * looking for brown pixels which just happen to be next to non-brown
1141 * pixels. It's an aliaser, just like it says. */
1142 unsigned int x, y;
1143
1144 /* This is a pointer to a screen. If you don't like pointer arithmetic,
1145 * you won't like this function. */
1146 Uint8cxx . . $ Uint8# *s = screen->pixelscxx . . $ SDL_Surface#pixels.;
1147 s += 12 * screen->pitchcxx . . $ SDL_Surface#pitch.;
1148
1149 for (y = 12; y < (unsigned int)screen->hcxx . . $ SDL_Surface#h.; y++)
1150 {
1151 for (x = 0; x < (unsigned int)screen->pitchcxx . . $ SDL_Surface#pitch.; x++)
1152 {
1153 if (*s == PIXEL_BLACKcxx . . $ PIXEL_BLACK.)
1154 *s = aliasDirtPixelcxx . . $ aliasDirtPixel(51c56bf3b37373e3).(screen, x, y, s);
1155
1156 s++;
1157 }
1158 }
1159 }
1160
1161 static unsigned int JE_placementPositioncxx . . $ JE_placementPosition(df145c89fad21506).(unsigned int passed_x, unsigned int width, unsigned int * world)
1162 {
1163 unsigned int i, new_y;
1164
1165 /* This is the function responsible for carving out chunks of land.
1166 * There's a bug here, but it's a pretty major gameplay altering one:
1167 * areas can be carved out for units that are aerial or in mountains.
1168 * This can result in huge caverns. Ergo, it's a feature :)
1169 *
1170 * I wondered if it might be better to not carve out land at all.
1171 * On testing I determined that was distracting and added nothing. */
1172 new_y = 0;
1173 for (i = passed_x; i <= passed_x + width - 1; i++)
1174 {
1175 if (new_y < world[i])
1176 new_y = world[i];
1177 }
1178
1179 for (i = passed_x; i <= passed_x + width - 1; i++)
1180 {
1181 world[i] = new_y;
1182 }
1183
1184 return new_y;
1185 }
1186
1187 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(unsigned int x, unsigned int y)
1188 {
1189 unsigned int i, numDirtPixels;
1190 Uint8cxx . . $ Uint8# * s;
1191
1192 numDirtPixels = 0;
1193 s = destructTempScreencxx . . $ destructTempScreen.->pixelscxx . . $ SDL_Surface#pixels.;
1194 s += x + (y * destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch.) - 1;
1195
1196 /* Check the 12 pixels on the bottom border of our object */
1197 for (i = 0; i < 12; i++)
1198 {
1199 if (*s == PIXEL_DIRTcxx . . $ PIXEL_DIRT.)
1200 numDirtPixels++;
1201
1202 s++;
1203 }
1204
1205 /* If there are fewer than 10 brown pixels we don't consider it a solid base */
1206 return (numDirtPixels < 10);
1207 }
1208
1209 static void JE_tempScreenCheckingcxx . . $ JE_tempScreenChecking(49f6e7a06ebc5aa8).(void) /*and copy to vgascreen*/
1210 {
1211 Uint8cxx . . $ Uint8# *s = VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels.;
1212 s += 12 * VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.;
1213
1214 Uint8cxx . . $ Uint8# *temps = destructTempScreencxx . . $ destructTempScreen.->pixelscxx . . $ SDL_Surface#pixels.;
1215 temps += 12 * destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch.;
1216
1217 for (int y = 12; y < VGAScreencxx . . $ VGAScreen.->hcxx . . $ SDL_Surface#h.; y++)
1218 {
1219 for (int x = 0; x < VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.; x++)
1220 {
1221 // This block is what fades out explosions. The palette from 241
1222 // to 255 fades from a very dark red to a very bright yellow.
1223 if (*temps >= 241)
1224 {
1225 if (*temps == 241)
1226 *temps = PIXEL_BLACKcxx . . $ PIXEL_BLACK.;
1227 else
1228 (*temps)--;
1229 }
1230
1231 // This block is for aliasing dirt. Computers are fast these days,
1232 // and it's fun.
1233 if (configcxx . . $ config..alwaysaliascxx . . $ destruct_config_s#alwaysalias. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! && *temps == PIXEL_BLACKcxx . . $ PIXEL_BLACK.)
1234 *temps = aliasDirtPixelcxx . . $ aliasDirtPixel(51c56bf3b37373e3).(VGAScreencxx . . $ VGAScreen., x, y, temps);
1235
1236 /* This is copying from our temp screen to VGAScreen */
1237 *s = *temps;
1238
1239 s++;
1240 temps++;
1241 }
1242 }
1243 }
1244
1245 static void JE_makeExplosioncxx . . $ JE_makeExplosion(b1f3cc9e908f625d).(unsigned int tempPosX, unsigned int tempPosY, enum de_shot_tcxx . . $ de_shot_t# shottype)
1246 {
1247 unsigned int i, tempExploSize;
1248
1249 /* First find an open explosion. If we can't find one, return.*/
1250 for (i = 0; i < configcxx . . $ config..max_explosionscxx . . $ destruct_config_s#max_explosions.; i++)
1251 if (exploReccxx . . $ exploRec.[i].isAvailablecxx . . $ destruct_explo_s#isAvailable. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
1252 break;
1253 if (i == configcxx . . $ config..max_explosionscxx . . $ destruct_config_s#max_explosions.) /* No empty slots */
1254 return;
1255
1256 exploReccxx . . $ exploRec.[i].isAvailablecxx . . $ destruct_explo_s#isAvailable. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1257 exploReccxx . . $ exploRec.[i].xcxx . . $ destruct_explo_s#x. = tempPosX;
1258 exploReccxx . . $ exploRec.[i].ycxx . . $ destruct_explo_s#y. = tempPosY;
1259 exploReccxx . . $ exploRec.[i].explowidthcxx . . $ destruct_explo_s#explowidth. = 2;
1260
1261 if (shottype != SHOT_INVALIDcxx . . $ SHOT_INVALID.)
1262 {
1263 tempExploSize = exploSizecxx . . $ exploSize.[shottype];
1264 if (tempExploSize < 5)
1265 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(3);
1266 else if (tempExploSize < 15)
1267 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(4);
1268 else if (tempExploSize < 20)
1269 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(12);
1270 else if (tempExploSize < 40)
1271 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(11);
1272 else
1273 {
1274 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(12);
1275 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(11);
1276 }
1277
1278 exploReccxx . . $ exploRec.[i].explomaxcxx . . $ destruct_explo_s#explomax. = tempExploSize;
1279 exploReccxx . . $ exploRec.[i].explofillcxx . . $ destruct_explo_s#explofill. = exploDensitycxx . . $ exploDensity.[shottype];
1280 exploReccxx . . $ exploRec.[i].exploTypecxx . . $ destruct_explo_s#exploType. = shotDirtcxx . . $ shotDirt.[shottype];
1281 }
1282 else
1283 {
1284 JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(4);
1285 exploReccxx . . $ exploRec.[i].explomaxcxx . . $ destruct_explo_s#explomax. = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 40) + 10;
1286 exploReccxx . . $ exploRec.[i].explofillcxx . . $ destruct_explo_s#explofill. = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 60) + 20;
1287 exploReccxx . . $ exploRec.[i].exploTypecxx . . $ destruct_explo_s#exploType. = EXPL_NORMALcxx . . $ EXPL_NORMAL.;
1288 }
1289 }
1290
1291 static void JE_eSoundcxx . . $ JE_eSound(cb2f890c2fdad230).(unsigned int sound)
1292 {
1293 static int exploSoundChannel = 0;
1294
1295 if (++exploSoundChannel > 5)
1296 exploSoundChannel = 1;
1297
1298 soundQueuecxx . . $ soundQueue.[exploSoundChannel] = sound;
1299 }
1300
1301 static void JE_superPixelcxx . . $ JE_superPixel(b4d55b1286ff73e8).(unsigned int tempPosX, unsigned int tempPosY)
1302 {
1303 const unsigned int starPattern[5][5] =
1304 {
1305 { 0, 0, 246, 0, 0 },
1306 { 0, 247, 249, 247, 0 },
1307 { 246, 249, 252, 249, 246 },
1308 { 0, 247, 249, 247, 0 },
1309 { 0, 0, 246, 0, 0 }
1310 };
1311 const unsigned int starIntensity[5][5] =
1312 {
1313 { 0, 0, 1, 0, 0 },
1314 { 0, 1, 2, 1, 0 },
1315 { 1, 2, 4, 2, 1 },
1316 { 0, 1, 2, 1, 0 },
1317 { 0, 0, 1, 0, 0 }
1318 };
1319
1320 int x, y, maxX, maxY;
1321 unsigned int rowLen;
1322 Uint8cxx . . $ Uint8# *s;
1323
1324 maxX = destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch.;
1325 maxY = destructTempScreencxx . . $ destructTempScreen.->hcxx . . $ SDL_Surface#h.;
1326
1327 rowLen = destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch.;
1328 s = destructTempScreencxx . . $ destructTempScreen.->pixelscxx . . $ SDL_Surface#pixels.;
1329 s += (rowLen * (tempPosY - 2)) + (tempPosX - 2);
1330
1331 for (y = 0; y < 5; y++, s += rowLen - 5)
1332 {
1333 if ((signed)tempPosY + y - 2 < 0 || /* would be out of bounds */
1334 (signed)tempPosY + y - 2 >= maxY)
1335 {
1336 continue;
1337 }
1338
1339 for (x = 0; x < 5; x++, s++)
1340 {
1341 if ((signed)tempPosX + x - 2 < 0 ||
1342 (signed)tempPosX + x - 2 >= maxX)
1343 {
1344 continue;
1345 }
1346
1347 if (starPattern[y][x] == 0)
1348 continue; /* this is just to speed it up */
1349
1350 /* at this point *s is our pixel. Our constant arrays tell us what
1351 * to do with it. */
1352 if (*s < starPattern[y][x])
1353 *s = starPattern[y][x];
1354 else if (*s + starIntensity[y][x] > 255)
1355 *s = 255;
1356 else
1357 *s += starIntensity[y][x];
1358 }
1359 }
1360 }
1361
1362 static void JE_helpScreencxx . . $ JE_helpScreen(49f6e7a06ebc5aa8).(void)
1363 {
1364 unsigned int i, j;
1365
1366 //JE_getVGA(); didn't do anything anyway?
1367 fade_blackcxx . . $ fade_black(d4f767463ce0a6b3).(15);
1368 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->hcxx . . $ SDL_Surface#h. * VGAScreen2cxx . . $ VGAScreen2.->pitchcxx . . $ SDL_Surface#pitch.);
1369 JE_clr256cxx . . $ JE_clr256(60a0b30a00b4fc6d).(VGAScreencxx . . $ VGAScreen.);
1370
1371 for (i = 0; i < 2; i++)
1372 {
1373 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., 100, 5 + i * 90, destructHelpcxx . . $ destructHelp.[i * 12 + 0], 2, 4);
1374 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., 100, 15 + i * 90, destructHelpcxx . . $ destructHelp.[i * 12 + 1], 2, 1);
1375 for (j = 3; j <= 12; j++)
1376 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., ((j - 1) % 2) * 160 + 10, 15 + ((j - 1) / 2) * 12 + i * 90, destructHelpcxx . . $ destructHelp.[i * 12 + j-1], 1, 3);
1377 }
1378 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., 30, 190, destructHelpcxx . . $ destructHelp.[24], 3, 4);
1379 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
1380 fade_palettecxx . . $ fade_palette(59ab901998e00635).(colorscxx . . $ colors., 15, 0, 255);
1381
1382 do /* wait until user hits a key */
1383 {
1384 service_SDL_eventscxx . . $ service_SDL_events(b45ddcbc8423892c).(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!);
1385 SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(16);
1386 } while (!newkeycxx . . $ newkey.);
1387
1388 fade_blackcxx . . $ fade_black(d4f767463ce0a6b3).(15);
1389 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->hcxx . . $ SDL_Surface#h. * VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.);
1390 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
1391 fade_palettecxx . . $ fade_palette(59ab901998e00635).(colorscxx . . $ colors., 15, 0, 255);
1392 }
1393
1394 static void JE_pauseScreencxx . . $ JE_pauseScreen(49f6e7a06ebc5aa8).(void)
1395 {
1396 set_volumecxx . . $ set_volume(8fbe6856f5410d23).(tyrMusicVolumecxx . . $ tyrMusicVolume. / 2, fxVolumecxx . . $ fxVolume.);
1397
1398 /* Save our current screen/game world. We don't want to screw it up while paused. */
1399 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->hcxx . . $ SDL_Surface#h. * VGAScreen2cxx . . $ VGAScreen2.->pitchcxx . . $ SDL_Surface#pitch.);
1400 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e).(VGAScreencxx . . $ VGAScreen., JE_fontCentercxx . . $ JE_fontCenter(1df18506ef0a631b).(miscTextcxx . . $ miscText.[22], TINY_FONTcxx . . $ `src/sprite.h:31:9`!), 90, miscTextcxx . . $ miscText.[22], 12, 5);
1401 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
1402
1403 do /* wait until user hits a key */
1404 {
1405 service_SDL_eventscxx . . $ service_SDL_events(b45ddcbc8423892c).(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!);
1406 SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(16);
1407 } while (!newkeycxx . . $ newkey.);
1408
1409 /* Restore current screen & volume*/
1410 memcpycxx . . $ memcpy(cc817cb175f282d).(VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreen2cxx . . $ VGAScreen2.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->hcxx . . $ SDL_Surface#h. * VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.);
1411 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
1412
1413 set_volumecxx . . $ set_volume(8fbe6856f5410d23).(tyrMusicVolumecxx . . $ tyrMusicVolume., fxVolumecxx . . $ fxVolume.);
1414 }
1415
1416 /* DE_ResetX
1417 *
1418 * The reset functions clear the state of whatever they are assigned to.
1419 */
1420 static void DE_ResetUnitscxx . . $ DE_ResetUnits(49f6e7a06ebc5aa8).(void)
1421 {
1422 unsigned int p, u;
1423
1424 for (p = 0; p < MAX_PLAYERScxx . . $ MAX_PLAYERS.; ++p)
1425 for (u = 0; u < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; ++u)
1426 destruct_playercxx . . $ destruct_player.[p].unitcxx . . $ destruct_player_s#unit.[u].healthcxx . . $ destruct_unit_s#health. = 0;
1427 }
1428
1429 static void DE_ResetPlayerscxx . . $ DE_ResetPlayers(49f6e7a06ebc5aa8).(void)
1430 {
1431 unsigned int i;
1432
1433 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; ++i)
1434 {
1435 destruct_playercxx . . $ destruct_player.[i].is_cpucxx . . $ destruct_player_s#is_cpu. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1436 destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected. = 0;
1437 destruct_playercxx . . $ destruct_player.[i].shotDelaycxx . . $ destruct_player_s#shotDelay. = 0;
1438 destruct_playercxx . . $ destruct_player.[i].scorecxx . . $ destruct_player_s#score. = 0;
1439 destruct_playercxx . . $ destruct_player.[i].aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = 0;
1440 destruct_playercxx . . $ destruct_player.[i].aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 0;
1441 destruct_playercxx . . $ destruct_player.[i].aiMemorycxx . . $ destruct_player_s#aiMemory..c_Firecxx . . $ destruct_ai_s#c_Fire. = 0;
1442 destruct_playercxx . . $ destruct_player.[i].aiMemorycxx . . $ destruct_player_s#aiMemory..c_noDowncxx . . $ destruct_ai_s#c_noDown. = 0;
1443 memcpycxx . . $ memcpy(cc817cb175f282d).(destruct_playercxx . . $ destruct_player.[i].keyscxx . . $ destruct_player_s#keys..Configcxx . . $ destruct_keys_s#Config., defaultKeyConfigcxx . . $ defaultKeyConfig.[i], sizeof(destruct_playercxx . . $ destruct_player.[i].keyscxx . . $ destruct_player_s#keys..Configcxx . . $ destruct_keys_s#Config.));
1444 }
1445 }
1446
1447 static void DE_ResetWeaponscxx . . $ DE_ResetWeapons(49f6e7a06ebc5aa8).(void)
1448 {
1449 unsigned int i;
1450
1451 for (i = 0; i < configcxx . . $ config..max_shotscxx . . $ destruct_config_s#max_shots.; i++)
1452 shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1453
1454 for (i = 0; i < configcxx . . $ config..max_explosionscxx . . $ destruct_config_s#max_explosions.; i++)
1455 exploReccxx . . $ exploRec.[i].isAvailablecxx . . $ destruct_explo_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1456 }
1457
1458 static void DE_ResetLevelcxx . . $ DE_ResetLevel(49f6e7a06ebc5aa8).(void)
1459 {
1460 /* Okay, let's prep the arena */
1461
1462 DE_ResetWeaponscxx . . $ DE_ResetWeapons(49f6e7a06ebc5aa8).();
1463
1464 JE_generateTerraincxx . . $ JE_generateTerrain(49f6e7a06ebc5aa8).();
1465 DE_ResetAIcxx . . $ DE_ResetAI(49f6e7a06ebc5aa8).();
1466 }
1467
1468 static void DE_ResetAIcxx . . $ DE_ResetAI(49f6e7a06ebc5aa8).(void)
1469 {
1470 unsigned int i, j;
1471 struct destruct_unit_scxx . . $ destruct_unit_s# * ptr;
1472
1473 for (i = PLAYER_LEFTcxx . . $ PLAYER_LEFT.; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
1474 {
1475 if (destruct_playercxx . . $ destruct_player.[i].is_cpucxx . . $ destruct_player_s#is_cpu. == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
1476 continue;
1477 ptr = destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.;
1478
1479 for (j = 0; j < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; j++, ptr++)
1480 {
1481 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(ptr) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
1482 continue;
1483
1484 if (systemAnglecxx . . $ systemAngle.[ptr->unitTypecxx . . $ destruct_unit_s#unitType.] || ptr->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
1485 ptr->anglecxx . . $ destruct_unit_s#angle. = M_PI_4cxx . . $ `<external>/11263917310783833665/math.h:1123:10`!;
1486 else
1487 ptr->anglecxx . . $ destruct_unit_s#angle. = 0;
1488
1489 ptr->powercxx . . $ destruct_unit_s#power. = (ptr->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_LASERcxx . . $ UNIT_LASER.) ? 6 : 4;
1490
1491 if (worldcxx . . $ world..mapFlagscxx . . $ destruct_world_s#mapFlags. & MAP_WALLScxx . . $ MAP_WALLS.)
1492 ptr->shotTypecxx . . $ destruct_unit_s#shotType. = defaultCpuWeaponBcxx . . $ defaultCpuWeaponB.[ptr->unitTypecxx . . $ destruct_unit_s#unitType.];
1493 else
1494 ptr->shotTypecxx . . $ destruct_unit_s#shotType. = defaultCpuWeaponcxx . . $ defaultCpuWeapon.[ptr->unitTypecxx . . $ destruct_unit_s#unitType.];
1495 }
1496 }
1497 }
1498
1499 static void DE_ResetActionscxx . . $ DE_ResetActions(49f6e7a06ebc5aa8).(void)
1500 {
1501 unsigned int i;
1502
1503 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
1504 { /* Zero it all. A memset would do the trick */
1505 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&(destruct_playercxx . . $ destruct_player.[i].movescxx . . $ destruct_player_s#moves.), 0, sizeof(destruct_playercxx . . $ destruct_player.[i].movescxx . . $ destruct_player_s#moves.));
1506 }
1507 }
1508
1509 /* DE_RunTick
1510 *
1511 * Runs one tick. One tick involves handling physics, drawing crap,
1512 * moving projectiles and explosions, and getting input.
1513 * Returns true while the game is running or false if the game is
1514 * to be terminated.
1515 */
1516 static enum de_state_tcxx . . $ de_state_t# DE_RunTickcxx . . $ DE_RunTick(824bd1aac937bb2e).(void)
1517 {
1518 static unsigned int endDelay;
1519
1520 setDelaycxx . . $ setDelay(d4f767463ce0a6b3).(1);
1521
1522 memsetcxx . . $ memset(d1de1e4fb215f1c6).(soundQueuecxx . . $ soundQueue., 0, sizeof(soundQueuecxx . . $ soundQueue.));
1523 JE_tempScreenCheckingcxx . . $ JE_tempScreenChecking(49f6e7a06ebc5aa8).();
1524
1525 DE_ResetActionscxx . . $ DE_ResetActions(49f6e7a06ebc5aa8).();
1526 DE_RunTickCycleDeadUnitscxx . . $ DE_RunTickCycleDeadUnits(49f6e7a06ebc5aa8).();
1527
1528 DE_RunTickGravitycxx . . $ DE_RunTickGravity(49f6e7a06ebc5aa8).();
1529 DE_RunTickAnimatecxx . . $ DE_RunTickAnimate(49f6e7a06ebc5aa8).();
1530 DE_RunTickDrawWallscxx . . $ DE_RunTickDrawWalls(49f6e7a06ebc5aa8).();
1531 DE_RunTickExplosionscxx . . $ DE_RunTickExplosions(49f6e7a06ebc5aa8).();
1532 DE_RunTickShotscxx . . $ DE_RunTickShots(49f6e7a06ebc5aa8).();
1533 DE_RunTickAIcxx . . $ DE_RunTickAI(49f6e7a06ebc5aa8).();
1534 DE_RunTickDrawCrosshairscxx . . $ DE_RunTickDrawCrosshairs(49f6e7a06ebc5aa8).();
1535 DE_RunTickDrawHUDcxx . . $ DE_RunTickDrawHUD(49f6e7a06ebc5aa8).();
1536 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
1537
1538 if (destructFirstTimecxx . . $ destructFirstTime.)
1539 {
1540 fade_palettecxx . . $ fade_palette(59ab901998e00635).(colorscxx . . $ colors., 25, 0, 255);
1541 destructFirstTimecxx . . $ destructFirstTime. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1542 endDelay = 0;
1543 }
1544
1545 DE_RunTickGetInputcxx . . $ DE_RunTickGetInput(49f6e7a06ebc5aa8).();
1546 DE_ProcessInputcxx . . $ DE_ProcessInput(49f6e7a06ebc5aa8).();
1547
1548 if (endDelay > 0)
1549 {
1550 if (--endDelay == 0)
1551 return STATE_RELOADcxx . . $ STATE_RELOAD.;
1552 }
1553 else if (DE_RunTickCheckEndgamecxx . . $ DE_RunTickCheckEndgame(c9857a73d68e59ba).() == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
1554 {
1555 endDelay = 80;
1556 }
1557
1558 DE_RunTickPlaySoundscxx . . $ DE_RunTickPlaySounds(49f6e7a06ebc5aa8).();
1559
1560 /* The rest of this cruft needs to be put in appropriate sections */
1561 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_F10cxx . . $ SDL_SCANCODE_F10.])
1562 {
1563 destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT.].is_cpucxx . . $ destruct_player_s#is_cpu. = !destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT.].is_cpucxx . . $ destruct_player_s#is_cpu.;
1564 keysactivecxx . . $ keysactive.[SDL_SCANCODE_F10cxx . . $ SDL_SCANCODE_F10.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1565 }
1566 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_F11cxx . . $ SDL_SCANCODE_F11.])
1567 {
1568 destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].is_cpucxx . . $ destruct_player_s#is_cpu. = !destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].is_cpucxx . . $ destruct_player_s#is_cpu.;
1569 keysactivecxx . . $ keysactive.[SDL_SCANCODE_F11cxx . . $ SDL_SCANCODE_F11.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1570 }
1571 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_Pcxx . . $ SDL_SCANCODE_P.])
1572 {
1573 JE_pauseScreencxx . . $ JE_pauseScreen(49f6e7a06ebc5aa8).();
1574 keysactivecxx . . $ keysactive.[lastkey_scancxx . . $ lastkey_scan.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1575 }
1576
1577 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_F1cxx . . $ SDL_SCANCODE_F1.])
1578 {
1579 JE_helpScreencxx . . $ JE_helpScreen(49f6e7a06ebc5aa8).();
1580 keysactivecxx . . $ keysactive.[lastkey_scancxx . . $ lastkey_scan.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1581 }
1582
1583 wait_delaycxx . . $ wait_delay(49f6e7a06ebc5aa8).();
1584
1585 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_ESCAPEcxx . . $ SDL_SCANCODE_ESCAPE.])
1586 {
1587 keysactivecxx . . $ keysactive.[SDL_SCANCODE_ESCAPEcxx . . $ SDL_SCANCODE_ESCAPE.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1588 return STATE_INITcxx . . $ STATE_INIT.; /* STATE_INIT drops us to the mode select */
1589 }
1590
1591 if (keysactivecxx . . $ keysactive.[SDL_SCANCODE_BACKSPACEcxx . . $ SDL_SCANCODE_BACKSPACE.])
1592 {
1593 keysactivecxx . . $ keysactive.[SDL_SCANCODE_BACKSPACEcxx . . $ SDL_SCANCODE_BACKSPACE.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1594 return STATE_RELOADcxx . . $ STATE_RELOAD.; /* STATE_RELOAD creates a new map */
1595 }
1596
1597 return STATE_CONTINUEcxx . . $ STATE_CONTINUE.;
1598 }
1599
1600 /* DE_RunTickX
1601 *
1602 * Handles something that we do once per tick, such as
1603 * track ammo and move explosions.
1604 */
1605 static void DE_RunTickCycleDeadUnitscxx . . $ DE_RunTickCycleDeadUnits(49f6e7a06ebc5aa8).(void)
1606 {
1607 unsigned int i;
1608 struct destruct_unit_scxx . . $ destruct_unit_s# * unit;
1609
1610 /* This code automatically switches the active unit if it is destroyed
1611 * and skips over the useless satellite */
1612 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
1613 {
1614 if (destruct_playercxx . . $ destruct_player.[i].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining. == 0)
1615 continue;
1616
1617 unit = &(destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected.]);
1618 while (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(unit) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! ||
1619 unit->shotTypecxx . . $ destruct_unit_s#shotType. == SHOT_INVALIDcxx . . $ SHOT_INVALID.)
1620 {
1621 destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected.++;
1622 unit++;
1623 if (destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected. >= configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.)
1624 {
1625 destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected. = 0;
1626 unit = destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.;
1627 }
1628 }
1629 }
1630 }
1631
1632 static void DE_RunTickGravitycxx . . $ DE_RunTickGravity(49f6e7a06ebc5aa8).(void)
1633 {
1634 unsigned int i, j;
1635 struct destruct_unit_scxx . . $ destruct_unit_s# * unit;
1636
1637 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
1638 {
1639 unit = destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.;
1640 for (j = 0; j < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; j++, unit++)
1641 {
1642 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(unit) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!) /* invalid unit */
1643 continue;
1644
1645 switch (unit->unitTypecxx . . $ destruct_unit_s#unitType.)
1646 {
1647 case UNIT_SATELLITEcxx . . $ UNIT_SATELLITE.: /* satellites don't fall down */
1648 break;
1649
1650 case UNIT_HELIcxx . . $ UNIT_HELI.:
1651 case UNIT_JUMPERcxx . . $ UNIT_JUMPER.:
1652 if (unit->isYInAircxx . . $ destruct_unit_s#isYInAir. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!) /* unit is falling down, at least in theory */
1653 {
1654 DE_GravityFlyUnitcxx . . $ DE_GravityFlyUnit(c7ca2fa70b0d21d).(unit);
1655 break;
1656 }
1657 /* else treat as a normal unit */
1658 /* fall through */
1659 default:
1660 DE_GravityLowerUnitcxx . . $ DE_GravityLowerUnit(c7ca2fa70b0d21d).(unit);
1661 }
1662
1663 /* Draw the unit. */
1664 DE_GravityDrawUnitcxx . . $ DE_GravityDrawUnit(d7e50c04c26b4b3).(i, unit);
1665 }
1666 }
1667 }
1668
1669 static void DE_GravityDrawUnitcxx . . $ DE_GravityDrawUnit(d7e50c04c26b4b3).(enum de_player_tcxx . . $ de_player_t# team, struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
1670 {
1671 unsigned int anim_index;
1672
1673 anim_index = GraphicBasecxx . . $ GraphicBase.[team][unit->unitTypecxx . . $ destruct_unit_s#unitType.] + unit->ani_framecxx . . $ destruct_unit_s#ani_frame.;
1674 if (unit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
1675 {
1676 /* Adjust animation index if we are traveling right or left. */
1677 if (unit->lastMovecxx . . $ destruct_unit_s#lastMove. < -2)
1678 anim_index += 5;
1679 else if (unit->lastMovecxx . . $ destruct_unit_s#lastMove. > 2)
1680 anim_index += 10;
1681 }
1682 else /* This handles our cannons and the like */
1683 {
1684 anim_index += floorf(unit->anglecxx . . $ destruct_unit_s#angle. * 9.99f / M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!);
1685 }
1686
1687 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., unit->unitXcxx . . $ destruct_unit_s#unitX., roundf(unit->unitYcxx . . $ destruct_unit_s#unitY.) - 13, destructSpriteSheetcxx . . $ destructSpriteSheet., anim_index);
1688 }
1689
1690 static void DE_GravityLowerUnitcxx . . $ DE_GravityLowerUnit(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
1691 {
1692 /* units fall at a constant speed. The heli is an odd case though;
1693 * we simply give it a downward velocity, but due to a buggy implementation
1694 * the chopper didn't lower until you tried to fly it up. Tyrian 2000 fixes
1695 * this by not making the chopper a special case. I've decided to actually
1696 * mix both; the chopper is given a slight downward acceleration (simulating
1697 * a 'rocky' takeoff), and it is lowered like a regular unit, but not as
1698 * quickly.
1699 */
1700 if (unit->unitYcxx . . $ destruct_unit_s#unitY. < 199) /* checking takes time, don't check if it's at the bottom */
1701 {
1702 if (JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(unit->unitXcxx . . $ destruct_unit_s#unitX., roundf(unit->unitYcxx . . $ destruct_unit_s#unitY.)))
1703 {
1704 switch (unit->unitTypecxx . . $ destruct_unit_s#unitType.)
1705 {
1706 case UNIT_HELIcxx . . $ UNIT_HELI.:
1707 unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. = 1.5f;
1708 unit->unitYcxx . . $ destruct_unit_s#unitY. += 0.2f;
1709 break;
1710
1711 default:
1712 unit->unitYcxx . . $ destruct_unit_s#unitY. += 1;
1713 }
1714
1715 if (unit->unitYcxx . . $ destruct_unit_s#unitY. > 199) /* could be possible */
1716 unit->unitYcxx . . $ destruct_unit_s#unitY. = 199;
1717 }
1718 }
1719 }
1720
1721 static void DE_GravityFlyUnitcxx . . $ DE_GravityFlyUnit(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
1722 {
1723 if (unit->unitYcxx . . $ destruct_unit_s#unitY. + unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. > 199) /* would hit bottom of screen */
1724 {
1725 unit->unitYcxx . . $ destruct_unit_s#unitY. = 199;
1726 unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. = 0;
1727 unit->isYInAircxx . . $ destruct_unit_s#isYInAir. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1728 return;
1729 }
1730
1731 /* move the unit and alter acceleration */
1732 unit->unitYcxx . . $ destruct_unit_s#unitY. += unit->unitYMovcxx . . $ destruct_unit_s#unitYMov.;
1733 if (unit->unitYcxx . . $ destruct_unit_s#unitY. < 24) /* This stops units from going above the screen */
1734 {
1735 unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. = 0;
1736 unit->unitYcxx . . $ destruct_unit_s#unitY. = 24;
1737 }
1738
1739 if (unit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.) /* helicopters fall more slowly */
1740 unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. += 0.0001f;
1741 else
1742 unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. += 0.03f;
1743
1744 if (!JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(unit->unitXcxx . . $ destruct_unit_s#unitX., roundf(unit->unitYcxx . . $ destruct_unit_s#unitY.)))
1745 {
1746 unit->unitYMovcxx . . $ destruct_unit_s#unitYMov. = 0;
1747 unit->isYInAircxx . . $ destruct_unit_s#isYInAir. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1748 }
1749 }
1750
1751 static void DE_RunTickAnimatecxx . . $ DE_RunTickAnimate(49f6e7a06ebc5aa8).(void)
1752 {
1753 unsigned int p, u;
1754 struct destruct_unit_scxx . . $ destruct_unit_s# * ptr;
1755
1756 for (p = 0; p < MAX_PLAYERScxx . . $ MAX_PLAYERS.; ++p)
1757 {
1758 ptr = destruct_playercxx . . $ destruct_player.[p].unitcxx . . $ destruct_player_s#unit.;
1759 for (u = 0; u < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; ++u, ++ptr)
1760 {
1761 /* Don't mess with any unit that is unallocated
1762 * or doesn't animate and is set to frame 0 */
1763 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(ptr) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
1764 continue;
1765 if (systemAnicxx . . $ systemAni.[ptr->unitTypecxx . . $ destruct_unit_s#unitType.] == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! && ptr->ani_framecxx . . $ destruct_unit_s#ani_frame. == 0)
1766 continue;
1767
1768 if (++(ptr->ani_framecxx . . $ destruct_unit_s#ani_frame.) > 3)
1769 ptr->ani_framecxx . . $ destruct_unit_s#ani_frame. = 0;
1770 }
1771 }
1772 }
1773
1774 static void DE_RunTickDrawWallscxx . . $ DE_RunTickDrawWalls(49f6e7a06ebc5aa8).(void)
1775 {
1776 unsigned int i;
1777
1778 for (i = 0; i < configcxx . . $ config..max_wallscxx . . $ destruct_config_s#max_walls.; i++)
1779 if (worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[i].wallExistcxx . . $ destruct_wall_s#wallExist.)
1780 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[i].wallXcxx . . $ destruct_wall_s#wallX., worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[i].wallYcxx . . $ destruct_wall_s#wallY., destructSpriteSheetcxx . . $ destructSpriteSheet., 42);
1781 }
1782
1783 static void DE_RunTickExplosionscxx . . $ DE_RunTickExplosions(49f6e7a06ebc5aa8).(void)
1784 {
1785 unsigned int i, j;
1786 int tempPosX, tempPosY;
1787 float tempRadian;
1788
1789 /* Run through all open explosions. They are not sorted in any way */
1790 for (i = 0; i < configcxx . . $ config..max_explosionscxx . . $ destruct_config_s#max_explosions.; i++)
1791 {
1792 if (exploReccxx . . $ exploRec.[i].isAvailablecxx . . $ destruct_explo_s#isAvailable. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
1793 continue; /* Nothing to do */
1794
1795 for (j = 0; j < exploReccxx . . $ exploRec.[i].explofillcxx . . $ destruct_explo_s#explofill.; j++)
1796 {
1797 /* An explosion is comprised of multiple 'flares' that fan out.
1798 Calculate where this 'flare' will end up */
1799 tempRadian = mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * (2 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!);
1800 tempPosY = exploReccxx . . $ exploRec.[i].ycxx . . $ destruct_explo_s#y. + roundf(cosf(tempRadian) * mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * exploReccxx . . $ exploRec.[i].explowidthcxx . . $ destruct_explo_s#explowidth.);
1801 tempPosX = exploReccxx . . $ exploRec.[i].xcxx . . $ destruct_explo_s#x. + roundf(sinf(tempRadian) * mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() * exploReccxx . . $ exploRec.[i].explowidthcxx . . $ destruct_explo_s#explowidth.);
1802
1803 /* Our game allows explosions to wrap around. This looks to have
1804 * originally been a bug that was left in as being fun, but we are
1805 * going to replicate it w/o risking out of bound arrays. */
1806
1807 while (tempPosX < 0)
1808 tempPosX += 320;
1809 while (tempPosX > 320)
1810 tempPosX -= 320;
1811
1812 /* We don't draw our explosion if it's out of bounds vertically */
1813 if (tempPosY >= 200 || tempPosY <= 15)
1814 continue;
1815
1816 /* And now the drawing. There are only two types of explosions
1817 * right now; dirt and flares. Dirt simply draws a brown pixel;
1818 * flares explode and have a star formation. */
1819 switch (exploReccxx . . $ exploRec.[i].exploTypecxx . . $ destruct_explo_s#exploType.)
1820 {
1821 case EXPL_DIRTcxx . . $ EXPL_DIRT.:
1822 ((Uint8cxx . . $ Uint8# *)destructTempScreencxx . . $ destructTempScreen.->pixelscxx . . $ SDL_Surface#pixels.)[tempPosX + tempPosY * destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch.] = PIXEL_DIRTcxx . . $ PIXEL_DIRT.;
1823 break;
1824
1825 case EXPL_NORMALcxx . . $ EXPL_NORMAL.:
1826 JE_superPixelcxx . . $ JE_superPixel(b4d55b1286ff73e8).(tempPosX, tempPosY);
1827 DE_TestExplosionCollisioncxx . . $ DE_TestExplosionCollision(b4d55b1286ff73e8).(tempPosX, tempPosY);
1828 break;
1829
1830 default:
1831 assertcxx . . $ `/usr/include/assert.h:50:10`!(false);
1832 break;
1833 }
1834 }
1835
1836 /* Widen the explosion and delete it if necessary. */
1837 exploReccxx . . $ exploRec.[i].explowidthcxx . . $ destruct_explo_s#explowidth.++;
1838 if (exploReccxx . . $ exploRec.[i].explowidthcxx . . $ destruct_explo_s#explowidth. == exploReccxx . . $ exploRec.[i].explomaxcxx . . $ destruct_explo_s#explomax.)
1839 {
1840 exploReccxx . . $ exploRec.[i].isAvailablecxx . . $ destruct_explo_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1841 }
1842 }
1843 }
1844
1845 static void DE_TestExplosionCollisioncxx . . $ DE_TestExplosionCollision(b4d55b1286ff73e8).(unsigned int PosX, unsigned int PosY)
1846 {
1847 unsigned int i, j;
1848 struct destruct_unit_scxx . . $ destruct_unit_s# * unit;
1849
1850 for (i = PLAYER_LEFTcxx . . $ PLAYER_LEFT.; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
1851 {
1852 unit = destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.;
1853 for (j = 0; j < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; j++, unit++)
1854 {
1855 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(unit) == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! &&
1856 PosX > unit->unitXcxx . . $ destruct_unit_s#unitX. && PosX < unit->unitXcxx . . $ destruct_unit_s#unitX. + 11 &&
1857 PosY < unit->unitYcxx . . $ destruct_unit_s#unitY. && PosY > unit->unitYcxx . . $ destruct_unit_s#unitY. - 11)
1858 {
1859 unit->healthcxx . . $ destruct_unit_s#health.--;
1860 if (unit->healthcxx . . $ destruct_unit_s#health. <= 0)
1861 DE_DestroyUnitcxx . . $ DE_DestroyUnit(d7e50c04c26b4b3).(i, unit);
1862 }
1863 }
1864 }
1865 }
1866
1867 static void DE_DestroyUnitcxx . . $ DE_DestroyUnit(d7e50c04c26b4b3).(enum de_player_tcxx . . $ de_player_t# playerID, struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
1868 {
1869 /* This function call was an evil evil piece of brilliance before. Go on.
1870 * Look at the older revisions. It passed the result of a comparison.
1871 * MULTIPLIED. This is at least a little clearer... */
1872 JE_makeExplosioncxx . . $ JE_makeExplosion(b1f3cc9e908f625d).(unit->unitXcxx . . $ destruct_unit_s#unitX. + 5, roundf(unit->unitYcxx . . $ destruct_unit_s#unitY.) - 5, (unit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.) ? SHOT_SMALLcxx . . $ SHOT_SMALL. : SHOT_INVALIDcxx . . $ SHOT_INVALID.); /* Helicopters explode like small shots do. Invalids are their own special case. */
1873
1874 if (unit->unitTypecxx . . $ destruct_unit_s#unitType. != UNIT_SATELLITEcxx . . $ UNIT_SATELLITE.) /* increment score */
1875 { /* todo: change when teams are created. Hacky kludge for now.*/
1876 destruct_playercxx . . $ destruct_player.[playerID].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining.--;
1877 destruct_playercxx . . $ destruct_player.[((playerID == PLAYER_LEFTcxx . . $ PLAYER_LEFT.) ? PLAYER_RIGHTcxx . . $ PLAYER_RIGHT. : PLAYER_LEFTcxx . . $ PLAYER_LEFT.)].scorecxx . . $ destruct_player_s#score.++;
1878 }
1879 }
1880
1881 static void DE_RunTickShotscxx . . $ DE_RunTickShots(49f6e7a06ebc5aa8).(void)
1882 {
1883 unsigned int i, j, k;
1884 unsigned int tempTrails;
1885 unsigned int tempPosX, tempPosY;
1886 struct destruct_unit_scxx . . $ destruct_unit_s# * unit;
1887
1888 for (i = 0; i < configcxx . . $ config..max_shotscxx . . $ destruct_config_s#max_shots.; i++)
1889 {
1890 if (shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
1891 continue; /* Nothing to do */
1892
1893 /* Move the shot. Simple displacement */
1894 shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. += shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov.;
1895 shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. += shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov.;
1896
1897 /* If the shot can bounce off the map, bounce it */
1898 if (shotBouncecxx . . $ shotBounce.[shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.])
1899 {
1900 if (shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. > 199 || shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. < 14)
1901 {
1902 shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. -= shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov.;
1903 shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. = -shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov.;
1904 }
1905 if (shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. < 1 || shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. > 318)
1906 {
1907 shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. -= shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov.;
1908 shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. = -shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov.;
1909 }
1910 }
1911 else /* If it cannot, apply normal physics */
1912 {
1913 shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. += 0.05f; /* add gravity */
1914
1915 if (shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. > 199) /* We hit the floor */
1916 {
1917 shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. -= shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov.;
1918 shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. = -shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. * 0.8f; /* bounce at reduced velocity */
1919
1920 /* Don't allow a bouncing shot to bounce straight up and down */
1921 if (shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. == 0)
1922 shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. += mt_rand_lt1cxx . . $ mt_rand_lt1(9b8c9e39889c762c).() - 0.5f;
1923 }
1924 }
1925
1926 /* Shot has gone out of bounds. Eliminate it. */
1927 if (shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. > 318 || shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. < 1)
1928 {
1929 shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1930 continue;
1931 }
1932
1933 /* Now check for collisions. */
1934
1935 /* Don't bother checking for collisions above the map :) */
1936 if (shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. <= 14)
1937 continue;
1938
1939 tempPosX = roundf(shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x.);
1940 tempPosY = roundf(shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y.);
1941
1942 /*Check building hits*/
1943 for (j = 0; j < MAX_PLAYERScxx . . $ MAX_PLAYERS.; j++)
1944 {
1945 unit = destruct_playercxx . . $ destruct_player.[j].unitcxx . . $ destruct_player_s#unit.;
1946 for (k = 0; k < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; k++, unit++)
1947 {
1948 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(unit) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
1949 continue;
1950
1951 if (tempPosX > unit->unitXcxx . . $ destruct_unit_s#unitX. && tempPosX < unit->unitXcxx . . $ destruct_unit_s#unitX. + 11 &&
1952 tempPosY < unit->unitYcxx . . $ destruct_unit_s#unitY. && tempPosY > unit->unitYcxx . . $ destruct_unit_s#unitY. - 13)
1953 {
1954 shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1955 JE_makeExplosioncxx . . $ JE_makeExplosion(b1f3cc9e908f625d).(tempPosX, tempPosY, shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.);
1956 }
1957 }
1958 }
1959
1960 tempTrails = (shotColorcxx . . $ shotColor.[shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.] << 4) - 3;
1961 JE_pixCoolcxx . . $ JE_pixCool(10e3fdc6547212ea).(tempPosX, tempPosY, tempTrails);
1962
1963 /*Draw the shot trail (if applicable) */
1964 switch (shotTrailcxx . . $ shotTrail.[shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.])
1965 {
1966 case TRAILS_NONEcxx . . $ TRAILS_NONE.:
1967 break;
1968 case TRAILS_NORMALcxx . . $ TRAILS_NORMAL.:
1969 DE_DrawTrailscxx . . $ DE_DrawTrails(fe9620acf5ef4f0d).(&(shotReccxx . . $ shotRec.[i]), 2, 4, tempTrails - 3);
1970 break;
1971 case TRAILS_FULLcxx . . $ TRAILS_FULL.:
1972 DE_DrawTrailscxx . . $ DE_DrawTrails(fe9620acf5ef4f0d).(&(shotReccxx . . $ shotRec.[i]), 4, 3, tempTrails - 1);
1973 break;
1974 }
1975
1976 /* Bounce off of or destroy walls */
1977 for (j = 0; j < configcxx . . $ config..max_wallscxx . . $ destruct_config_s#max_walls.; j++)
1978 {
1979 if (worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallExistcxx . . $ destruct_wall_s#wallExist. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! &&
1980 tempPosX >= worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallXcxx . . $ destruct_wall_s#wallX. && tempPosX <= worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallXcxx . . $ destruct_wall_s#wallX. + 11 &&
1981 tempPosY >= worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallYcxx . . $ destruct_wall_s#wallY. && tempPosY <= worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallYcxx . . $ destruct_wall_s#wallY. + 14)
1982 {
1983 if (demolishcxx . . $ demolish.[shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.])
1984 {
1985 /* Blow up the wall and remove the shot. */
1986 worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallExistcxx . . $ destruct_wall_s#wallExist. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1987 shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1988 JE_makeExplosioncxx . . $ JE_makeExplosion(b1f3cc9e908f625d).(tempPosX, tempPosY, shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.);
1989 continue;
1990 }
1991 else
1992 {
1993 /* Otherwise, bounce. */
1994 if (shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. - shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. < worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallXcxx . . $ destruct_wall_s#wallX. ||
1995 shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. - shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. > worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallXcxx . . $ destruct_wall_s#wallX. + 11)
1996 {
1997 shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. = -shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov.;
1998 }
1999 if (shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. - shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. < worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallYcxx . . $ destruct_wall_s#wallY. ||
2000 shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y. - shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. > worldcxx . . $ world..mapWallscxx . . $ destruct_world_s#mapWalls.[j].wallYcxx . . $ destruct_wall_s#wallY. + 14)
2001 {
2002 if (shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. < 0)
2003 shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. = -shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov.;
2004 else
2005 shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. = -shotReccxx . . $ shotRec.[i].ymovcxx . . $ destruct_shot_s#ymov. * 0.8f;
2006 }
2007
2008 tempPosX = roundf(shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x.);
2009 tempPosY = roundf(shotReccxx . . $ shotRec.[i].ycxx . . $ destruct_shot_s#y.);
2010 }
2011 }
2012 }
2013
2014 /* Our last collision check, at least for now. We hit dirt. */
2015 if ((((Uint8cxx . . $ Uint8# *)destructTempScreencxx . . $ destructTempScreen.->pixelscxx . . $ SDL_Surface#pixels.)[tempPosX + tempPosY * destructTempScreencxx . . $ destructTempScreen.->pitchcxx . . $ SDL_Surface#pitch.]) == PIXEL_DIRTcxx . . $ PIXEL_DIRT.)
2016 {
2017 shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2018 JE_makeExplosioncxx . . $ JE_makeExplosion(b1f3cc9e908f625d).(tempPosX, tempPosY, shotReccxx . . $ shotRec.[i].shottypecxx . . $ destruct_shot_s#shottype.);
2019 continue;
2020 }
2021 }
2022 }
2023
2024 static void DE_DrawTrailscxx . . $ DE_DrawTrails(fe9620acf5ef4f0d).(struct destruct_shot_scxx . . $ destruct_shot_s# * shot, unsigned int count, unsigned int decay, unsigned int startColor)
2025 {
2026 int i;
2027
2028 for (i = count-1; i >= 0; i--) /* going in reverse is important as it affects how we draw */
2029 {
2030 if (shot->trailccxx . . $ destruct_shot_s#trailc.[i] > 0 && shot->trailycxx . . $ destruct_shot_s#traily.[i] > 12) /* If it exists and if it's not out of bounds, draw it. */
2031 {
2032 JE_pixCoolcxx . . $ JE_pixCool(10e3fdc6547212ea).(shot->trailxcxx . . $ destruct_shot_s#trailx.[i], shot->trailycxx . . $ destruct_shot_s#traily.[i], shot->trailccxx . . $ destruct_shot_s#trailc.[i]);
2033 }
2034
2035 if (i == 0) /* The first trail we create. */
2036 {
2037 shot->trailxcxx . . $ destruct_shot_s#trailx.[i] = roundf(shot->xcxx . . $ destruct_shot_s#x.);
2038 shot->trailycxx . . $ destruct_shot_s#traily.[i] = roundf(shot->ycxx . . $ destruct_shot_s#y.);
2039 shot->trailccxx . . $ destruct_shot_s#trailc.[i] = startColor;
2040 }
2041 else /* The newer trails decay into the older trails.*/
2042 {
2043 shot->trailxcxx . . $ destruct_shot_s#trailx.[i] = shot->trailxcxx . . $ destruct_shot_s#trailx.[i-1];
2044 shot->trailycxx . . $ destruct_shot_s#traily.[i] = shot->trailycxx . . $ destruct_shot_s#traily.[i-1];
2045 if (shot->trailccxx . . $ destruct_shot_s#trailc.[i-1] > 0)
2046 {
2047 shot->trailccxx . . $ destruct_shot_s#trailc.[i] = shot->trailccxx . . $ destruct_shot_s#trailc.[i-1] - decay;
2048 }
2049 }
2050 }
2051 }
2052
2053 static void DE_RunTickAIcxx . . $ DE_RunTickAI(49f6e7a06ebc5aa8).(void)
2054 {
2055 unsigned int i, j;
2056 struct destruct_player_scxx . . $ destruct_player_s# * ptrPlayer, * ptrTarget;
2057 struct destruct_unit_scxx . . $ destruct_unit_s# * ptrUnit, * ptrCurUnit;
2058
2059 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
2060 {
2061 ptrPlayer = &(destruct_playercxx . . $ destruct_player.[i]);
2062 if (ptrPlayer->is_cpucxx . . $ destruct_player_s#is_cpu. == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
2063 continue;
2064
2065 /* I've been thinking, purely hypothetically, about what it would take
2066 * to have multiple computer opponents. The answer? A lot of crap
2067 * and a 'target' variable in the destruct_player struct. */
2068 j = i + 1;
2069 if (j >= MAX_PLAYERScxx . . $ MAX_PLAYERS.)
2070 j = 0;
2071
2072 ptrTarget = &(destruct_playercxx . . $ destruct_player.[j]);
2073 ptrCurUnit = &(ptrPlayer->unitcxx . . $ destruct_player_s#unit.[ptrPlayer->unitSelectedcxx . . $ destruct_player_s#unitSelected.]);
2074
2075 /* This is the start of the original AI. Heh. AI. */
2076
2077 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_noDowncxx . . $ destruct_ai_s#c_noDown. > 0)
2078 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_noDowncxx . . $ destruct_ai_s#c_noDown.--;
2079
2080 /* Until all structs are properly divvied up this must only apply to player1 */
2081 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 100 > 80)
2082 {
2083 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. += (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 3) - 1;
2084
2085 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. > 1)
2086 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = 1;
2087 else
2088 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. < -1)
2089 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = -1;
2090 }
2091 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 100 > 90)
2092 {
2093 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. > 0 && ptrCurUnit->anglecxx . . $ destruct_unit_s#angle. > (M_PI_2cxx . . $ `<external>/11263917310783833665/math.h:1122:10`!) - (M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / 9))
2094 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = 0;
2095 else
2096 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. < 0 && ptrCurUnit->anglecxx . . $ destruct_unit_s#angle. < M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! / 8)
2097 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = 0;
2098 }
2099
2100 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 100 > 93)
2101 {
2102 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. += (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 3) - 1;
2103
2104 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. > 1)
2105 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 1;
2106 else
2107 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. < -1)
2108 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = -1;
2109 }
2110 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 100 > 90)
2111 {
2112 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. > 0 && ptrCurUnit->powercxx . . $ destruct_unit_s#power. > 4)
2113 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 0;
2114 else
2115 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. < 0 && ptrCurUnit->powercxx . . $ destruct_unit_s#power. < 3)
2116 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 0;
2117 else
2118 if (ptrCurUnit->powercxx . . $ destruct_unit_s#power. < 2)
2119 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 1;
2120 }
2121
2122 // prefer helicopter
2123 ptrUnit = ptrPlayer->unitcxx . . $ destruct_player_s#unit.;
2124 for (j = 0; j < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; j++, ptrUnit++)
2125 {
2126 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(ptrUnit) && ptrUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
2127 {
2128 ptrPlayer->unitSelectedcxx . . $ destruct_player_s#unitSelected. = j;
2129 break;
2130 }
2131 }
2132
2133 if (ptrCurUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
2134 {
2135 if (ptrCurUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
2136 {
2137 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 1;
2138 }
2139 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX. > 100)
2140 {
2141 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 1;
2142 }
2143 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 240 > ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX.)
2144 {
2145 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_RIGHTcxx . . $ MOVE_RIGHT.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2146 }
2147 else if ((mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 20) + 300 < ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX.)
2148 {
2149 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_LEFTcxx . . $ MOVE_LEFT.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2150 }
2151 else if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 30 == 1)
2152 {
2153 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 3) - 1;
2154 }
2155 if (ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX. > 295 && ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove. > 1)
2156 {
2157 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_LEFTcxx . . $ MOVE_LEFT.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2158 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_RIGHTcxx . . $ MOVE_RIGHT.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2159 }
2160 if (ptrCurUnit->unitTypecxx . . $ destruct_unit_s#unitType. != UNIT_HELIcxx . . $ UNIT_HELI. || ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove. > 3 || (ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX. > 160 && ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove. > -3))
2161 {
2162 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % (int)roundf(ptrCurUnit->unitYcxx . . $ destruct_unit_s#unitY.) < 150 && ptrCurUnit->unitYMovcxx . . $ destruct_unit_s#unitYMov. < 0.01f && (ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX. < 160 || ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove. < 2))
2163 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2164 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_noDowncxx . . $ destruct_ai_s#c_noDown. = (5 - abscxx . . $ abs(7864480464b09eea).(ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove.)) * (5 - abscxx . . $ abs(7864480464b09eea).(ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove.)) + 3;
2165 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 1;
2166 }
2167 else
2168 {
2169 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2170 }
2171
2172 ptrUnit = ptrTarget->unitcxx . . $ destruct_player_s#unit.;
2173 for (j = 0; j < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; j++, ptrUnit++)
2174 {
2175 if (abscxx . . $ abs(7864480464b09eea).((int)ptrUnit->unitXcxx . . $ destruct_unit_s#unitX. - (int)ptrCurUnit->unitXcxx . . $ destruct_unit_s#unitX.) < 8)
2176 {
2177 /* I get it. This makes helicopters hover over
2178 * their enemies. */
2179 if (ptrUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_SATELLITEcxx . . $ UNIT_SATELLITE.)
2180 {
2181 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2182 }
2183 else
2184 {
2185 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_LEFTcxx . . $ MOVE_LEFT.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2186 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_RIGHTcxx . . $ MOVE_RIGHT.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2187 if (ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove. < -1)
2188 ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove.++;
2189 else if (ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove. > 1)
2190 ptrCurUnit->lastMovecxx . . $ destruct_unit_s#lastMove.--;
2191 }
2192 }
2193 }
2194 }
2195 else
2196 {
2197 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] = 1;
2198 }
2199
2200 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 200 > 198)
2201 {
2202 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_CHANGEcxx . . $ MOVE_CHANGE.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2203 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. = 0;
2204 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 0;
2205 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Firecxx . . $ destruct_ai_s#c_Fire. = 0;
2206 }
2207
2208 if (mt_randcxx . . $ mt_rand(f708dce9a8856c70).() % 100 > 98 || ptrCurUnit->shotTypecxx . . $ destruct_unit_s#shotType. == SHOT_TRACERcxx . . $ SHOT_TRACER.)
2209 {
2210 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_CYDNcxx . . $ MOVE_CYDN.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2211 }
2212 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. > 0)
2213 {
2214 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_LEFTcxx . . $ MOVE_LEFT.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2215 }
2216 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Anglecxx . . $ destruct_ai_s#c_Angle. < 0)
2217 {
2218 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_RIGHTcxx . . $ MOVE_RIGHT.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2219 }
2220 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. > 0)
2221 {
2222 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_UPcxx . . $ MOVE_UP.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2223 }
2224 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. < 0 && ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_noDowncxx . . $ destruct_ai_s#c_noDown. == 0)
2225 {
2226 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_DOWNcxx . . $ MOVE_DOWN.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2227 }
2228 if (ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Firecxx . . $ destruct_ai_s#c_Fire. > 0)
2229 {
2230 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2231 }
2232
2233 if (ptrCurUnit->unitYMovcxx . . $ destruct_unit_s#unitYMov. < -0.1f && ptrCurUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
2234 {
2235 ptrPlayer->movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2236 }
2237
2238 /* This last hack was down in the processing section.
2239 * What exactly it was doing there I do not know */
2240 if (ptrCurUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_LASERcxx . . $ UNIT_LASER. || ptrCurUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2241 ptrPlayer->aiMemorycxx . . $ destruct_player_s#aiMemory..c_Powercxx . . $ destruct_ai_s#c_Power. = 0;
2242 }
2243 }
2244
2245 static void DE_RunTickDrawCrosshairscxx . . $ DE_RunTickDrawCrosshairs(49f6e7a06ebc5aa8).(void)
2246 {
2247 unsigned int i;
2248 int tempPosX, tempPosY;
2249 int direction;
2250 struct destruct_unit_scxx . . $ destruct_unit_s# * curUnit;
2251
2252 /* Draw the crosshairs. Most vehicles aim left or right. Helis can aim
2253 * either way and this must be accounted for.
2254 */
2255 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
2256 {
2257 direction = (i == PLAYER_LEFTcxx . . $ PLAYER_LEFT.) ? -1 : 1;
2258 curUnit = &(destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected.]);
2259
2260 if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
2261 {
2262 tempPosX = curUnit->unitXcxx . . $ destruct_unit_s#unitX. + roundf(0.1f * curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. * curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. * curUnit->lastMovecxx . . $ destruct_unit_s#lastMove.) + 5;
2263 tempPosY = roundf(curUnit->unitYcxx . . $ destruct_unit_s#unitY.) + 1;
2264 }
2265 else
2266 {
2267 tempPosX = roundf(curUnit->unitXcxx . . $ destruct_unit_s#unitX. + 6 - cosf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * (curUnit->powercxx . . $ destruct_unit_s#power. * 8 + 7) * direction);
2268 tempPosY = roundf(curUnit->unitYcxx . . $ destruct_unit_s#unitY. - 7 - sinf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * (curUnit->powercxx . . $ destruct_unit_s#power. * 8 + 7));
2269 }
2270
2271 /* Draw it. Clip away from the HUD though. */
2272 if (tempPosY > 9)
2273 {
2274 if (tempPosY > 11)
2275 {
2276 if (tempPosY > 13)
2277 {
2278 /* Top pixel */
2279 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., tempPosX, tempPosY - 2, 3);
2280 }
2281 /* Middle three pixels */
2282 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., tempPosX + 3, tempPosY, 3);
2283 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., tempPosX, tempPosY, 14);
2284 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., tempPosX - 3, tempPosY, 3);
2285 }
2286 /* Bottom pixel */
2287 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., tempPosX, tempPosY + 2, 3);
2288 }
2289 }
2290 }
2291
2292 static void DE_RunTickDrawHUDcxx . . $ DE_RunTickDrawHUD(49f6e7a06ebc5aa8).(void)
2293 {
2294 unsigned int i;
2295 unsigned int startX;
2296 char tempstr[16]; /* Max size needed: 16 assuming 10 digit int max. */
2297 struct destruct_unit_scxx . . $ destruct_unit_s# * curUnit;
2298
2299 for (i = 0; i < MAX_PLAYERScxx . . $ MAX_PLAYERS.; i++)
2300 {
2301 curUnit = &(destruct_playercxx . . $ destruct_player.[i].unitcxx . . $ destruct_player_s#unit.[destruct_playercxx . . $ destruct_player.[i].unitSelectedcxx . . $ destruct_player_s#unitSelected.]);
2302 startX = ((i == PLAYER_LEFTcxx . . $ PLAYER_LEFT.) ? 0 : 320 - 150);
2303
2304 fill_rectangle_xycxx . . $ fill_rectangle_xy(da1d960d0d6e485d).(VGAScreencxx . . $ VGAScreen., startX + 5, 3, startX + 14, 8, 241);
2305 JE_rectanglecxx . . $ JE_rectangle(fa5faf37b232239e).(VGAScreencxx . . $ VGAScreen., startX + 4, 2, startX + 15, 9, 242);
2306 JE_rectanglecxx . . $ JE_rectangle(fa5faf37b232239e).(VGAScreencxx . . $ VGAScreen., startX + 3, 1, startX + 16, 10, 240);
2307 fill_rectangle_xycxx . . $ fill_rectangle_xy(da1d960d0d6e485d).(VGAScreencxx . . $ VGAScreen., startX + 18, 3, startX + 140, 8, 241);
2308 JE_rectanglecxx . . $ JE_rectangle(fa5faf37b232239e).(VGAScreencxx . . $ VGAScreen., startX + 17, 2, startX + 143, 9, 242);
2309 JE_rectanglecxx . . $ JE_rectangle(fa5faf37b232239e).(VGAScreencxx . . $ VGAScreen., startX + 16, 1, startX + 144, 10, 240);
2310
2311 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., startX + 4, 0, destructSpriteSheetcxx . . $ destructSpriteSheet., 191 + curUnit->shotTypecxx . . $ destruct_unit_s#shotType.);
2312
2313 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e). (VGAScreencxx . . $ VGAScreen., startX + 20, 3, weaponNamescxx . . $ weaponNames.[curUnit->shotTypecxx . . $ destruct_unit_s#shotType.], 15, 2);
2314 sprintfcxx . . $ sprintf(26c8642d26409d6d). (tempstr, "dmg~%d~", curUnit->healthcxx . . $ destruct_unit_s#health.);
2315 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e). (VGAScreencxx . . $ VGAScreen., startX + 75, 3, tempstr, 15, 0);
2316 sprintfcxx . . $ sprintf(26c8642d26409d6d). (tempstr, "pts~%d~", destruct_playercxx . . $ destruct_player.[i].scorecxx . . $ destruct_player_s#score.);
2317 JE_outTextcxx . . $ JE_outText(894c69c4be246b6e). (VGAScreencxx . . $ VGAScreen., startX + 110, 3, tempstr, 15, 0);
2318 }
2319 }
2320
2321 static void DE_RunTickGetInputcxx . . $ DE_RunTickGetInput(49f6e7a06ebc5aa8).(void)
2322 {
2323 unsigned int player_index, key_index, slot_index;
2324 SDL_Scancodecxx . . $ SDL_Scancode# key;
2325
2326 /* destruct_player.keys holds our key config. Players will eventually be
2327 * allowed to can change their key mappings. destruct_player.moves and
2328 * destruct_player.keys line up; rather than manually checking left and
2329 * right we can just loop through the indexes and set the actions as
2330 * needed. */
2331 service_SDL_eventscxx . . $ service_SDL_events(b45ddcbc8423892c).(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!);
2332
2333 for (player_index = 0; player_index < MAX_PLAYERScxx . . $ MAX_PLAYERS.; player_index++)
2334 {
2335 for (key_index = 0; key_index < MAX_KEYcxx . . $ MAX_KEY.; key_index++)
2336 {
2337 for (slot_index = 0; slot_index < MAX_KEY_OPTIONScxx . . $ `src/destruct.c:70:9`!; slot_index++)
2338 {
2339 key = destruct_playercxx . . $ destruct_player.[player_index].keyscxx . . $ destruct_player_s#keys..Configcxx . . $ destruct_keys_s#Config.[key_index][slot_index];
2340 if (key == SDL_SCANCODE_UNKNOWNcxx . . $ SDL_SCANCODE_UNKNOWN.)
2341 break;
2342 if (keysactivecxx . . $ keysactive.[key] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2343 {
2344 /* The right key was clearly pressed */
2345 destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[key_index] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2346
2347 /* Some keys we want to toggle afterwards */
2348 if (key_index == KEY_CHANGEcxx . . $ KEY_CHANGE. ||
2349 key_index == KEY_CYUPcxx . . $ KEY_CYUP. ||
2350 key_index == KEY_CYDNcxx . . $ KEY_CYDN.)
2351 {
2352 keysactivecxx . . $ keysactive.[key] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2353 }
2354 break;
2355 }
2356 }
2357 }
2358 }
2359 }
2360
2361 static void DE_ProcessInputcxx . . $ DE_ProcessInput(49f6e7a06ebc5aa8).(void)
2362 {
2363 int direction;
2364
2365 unsigned int player_index;
2366 struct destruct_unit_scxx . . $ destruct_unit_s# * curUnit;
2367
2368 for (player_index = 0; player_index < MAX_PLAYERScxx . . $ MAX_PLAYERS.; player_index++)
2369 {
2370 if (destruct_playercxx . . $ destruct_player.[player_index].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining. <= 0)
2371 continue;
2372
2373 direction = (player_index == PLAYER_LEFTcxx . . $ PLAYER_LEFT.) ? -1 : 1;
2374 curUnit = &(destruct_playercxx . . $ destruct_player.[player_index].unitcxx . . $ destruct_player_s#unit.[destruct_playercxx . . $ destruct_player.[player_index].unitSelectedcxx . . $ destruct_player_s#unitSelected.]);
2375
2376 if (systemAnglecxx . . $ systemAngle.[curUnit->unitTypecxx . . $ destruct_unit_s#unitType.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!) /* selected unit may change shot angle */
2377 {
2378 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_LEFTcxx . . $ MOVE_LEFT.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2379 {
2380 if (player_index == PLAYER_LEFTcxx . . $ PLAYER_LEFT.)
2381 DE_RaiseAnglecxx . . $ DE_RaiseAngle(c7ca2fa70b0d21d).(curUnit);
2382 else
2383 DE_LowerAnglecxx . . $ DE_LowerAngle(c7ca2fa70b0d21d).(curUnit);
2384 }
2385 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_RIGHTcxx . . $ MOVE_RIGHT.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2386 {
2387 if (player_index == PLAYER_LEFTcxx . . $ PLAYER_LEFT.)
2388 DE_LowerAnglecxx . . $ DE_LowerAngle(c7ca2fa70b0d21d).(curUnit);
2389 else
2390 DE_RaiseAnglecxx . . $ DE_RaiseAngle(c7ca2fa70b0d21d).(curUnit);
2391 }
2392 }
2393 else if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
2394 {
2395 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_LEFTcxx . . $ MOVE_LEFT.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! && curUnit->unitXcxx . . $ destruct_unit_s#unitX. > 5)
2396 {
2397 if (JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(curUnit->unitXcxx . . $ destruct_unit_s#unitX. - 5, roundf(curUnit->unitYcxx . . $ destruct_unit_s#unitY.)))
2398 {
2399 if (curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. > -5)
2400 curUnit->lastMovecxx . . $ destruct_unit_s#lastMove.--;
2401 curUnit->unitXcxx . . $ destruct_unit_s#unitX.--;
2402 if (JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(curUnit->unitXcxx . . $ destruct_unit_s#unitX., roundf(curUnit->unitYcxx . . $ destruct_unit_s#unitY.)))
2403 curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2404 }
2405 }
2406 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_RIGHTcxx . . $ MOVE_RIGHT.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! && curUnit->unitXcxx . . $ destruct_unit_s#unitX. < 305)
2407 {
2408 if (JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(curUnit->unitXcxx . . $ destruct_unit_s#unitX. + 5, roundf(curUnit->unitYcxx . . $ destruct_unit_s#unitY.)))
2409 {
2410 if (curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. < 5)
2411 curUnit->lastMovecxx . . $ destruct_unit_s#lastMove.++;
2412 curUnit->unitXcxx . . $ destruct_unit_s#unitX.++;
2413 if (JE_stabilityCheckcxx . . $ JE_stabilityCheck(8e1b545ea3aecce3).(curUnit->unitXcxx . . $ destruct_unit_s#unitX., roundf(curUnit->unitYcxx . . $ destruct_unit_s#unitY.)))
2414 curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2415 }
2416 }
2417 }
2418
2419 if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. != UNIT_LASERcxx . . $ UNIT_LASER.)
2420 { /*increasepower*/
2421 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_UPcxx . . $ MOVE_UP.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2422 {
2423 if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI.)
2424 {
2425 curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2426 curUnit->unitYMovcxx . . $ destruct_unit_s#unitYMov. -= 0.1f;
2427 }
2428 else if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_JUMPERcxx . . $ UNIT_JUMPER. &&
2429 curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
2430 {
2431 curUnit->unitYMovcxx . . $ destruct_unit_s#unitYMov. = -3;
2432 curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2433 }
2434 else
2435 {
2436 DE_RaisePowercxx . . $ DE_RaisePower(c7ca2fa70b0d21d).(curUnit);
2437 }
2438 }
2439 /*decreasepower*/
2440 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_DOWNcxx . . $ MOVE_DOWN.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2441 {
2442 if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI. && curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2443 {
2444 curUnit->unitYMovcxx . . $ destruct_unit_s#unitYMov. += 0.1f;
2445 }
2446 else
2447 {
2448 DE_LowerPowercxx . . $ DE_LowerPower(c7ca2fa70b0d21d).(curUnit);
2449 }
2450 }
2451 }
2452
2453 /*up/down weapon. These just cycle until a valid weapon is found */
2454 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_CYUPcxx . . $ MOVE_CYUP.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2455 DE_CycleWeaponUpcxx . . $ DE_CycleWeaponUp(c7ca2fa70b0d21d).(curUnit);
2456 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_CYDNcxx . . $ MOVE_CYDN.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2457 DE_CycleWeaponDowncxx . . $ DE_CycleWeaponDown(c7ca2fa70b0d21d).(curUnit);
2458
2459 /* Change. Since change would change out curUnit pointer, let's just do it last.
2460 * Validity checking is performed at the beginning of the tick. */
2461 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_CHANGEcxx . . $ MOVE_CHANGE.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2462 {
2463 destruct_playercxx . . $ destruct_player.[player_index].unitSelectedcxx . . $ destruct_player_s#unitSelected.++;
2464 if (destruct_playercxx . . $ destruct_player.[player_index].unitSelectedcxx . . $ destruct_player_s#unitSelected. >= configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.)
2465 destruct_playercxx . . $ destruct_player.[player_index].unitSelectedcxx . . $ destruct_player_s#unitSelected. = 0;
2466 }
2467
2468 /*Newshot*/
2469 if (destruct_playercxx . . $ destruct_player.[player_index].shotDelaycxx . . $ destruct_player_s#shotDelay. > 0)
2470 destruct_playercxx . . $ destruct_player.[player_index].shotDelaycxx . . $ destruct_player_s#shotDelay.--;
2471 if (destruct_playercxx . . $ destruct_player.[player_index].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_FIREcxx . . $ MOVE_FIRE.] == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! &&
2472 destruct_playercxx . . $ destruct_player.[player_index].shotDelaycxx . . $ destruct_player_s#shotDelay. == 0)
2473 {
2474 destruct_playercxx . . $ destruct_player.[player_index].shotDelaycxx . . $ destruct_player_s#shotDelay. = shotDelaycxx . . $ shotDelay.[curUnit->shotTypecxx . . $ destruct_unit_s#shotType.];
2475
2476 switch (shotDirtcxx . . $ shotDirt.[curUnit->shotTypecxx . . $ destruct_unit_s#shotType.])
2477 {
2478 case EXPL_NONEcxx . . $ EXPL_NONE.:
2479 break;
2480
2481 case EXPL_MAGNETcxx . . $ EXPL_MAGNET.:
2482 DE_RunMagnetcxx . . $ DE_RunMagnet(d7e50c04c26b4b3).(player_index, curUnit);
2483 break;
2484
2485 case EXPL_DIRTcxx . . $ EXPL_DIRT.:
2486 case EXPL_NORMALcxx . . $ EXPL_NORMAL.:
2487 DE_MakeShotcxx . . $ DE_MakeShot(5776d1f53a924cb0).(player_index, curUnit, direction);
2488 break;
2489
2490 default:
2491 assertcxx . . $ `/usr/include/assert.h:50:10`!(false);
2492 }
2493 }
2494 }
2495 }
2496
2497 static void DE_CycleWeaponUpcxx . . $ DE_CycleWeaponUp(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2498 {
2499 do
2500 {
2501 unit->shotTypecxx . . $ destruct_unit_s#shotType.++;
2502 if (unit->shotTypecxx . . $ destruct_unit_s#shotType. > SHOT_LASTcxx . . $ SHOT_LAST.)
2503 unit->shotTypecxx . . $ destruct_unit_s#shotType. = SHOT_FIRSTcxx . . $ SHOT_FIRST.;
2504 } while (weaponSystemscxx . . $ weaponSystems.[unit->unitTypecxx . . $ destruct_unit_s#unitType.][unit->shotTypecxx . . $ destruct_unit_s#shotType.] == 0);
2505 }
2506
2507 static void DE_CycleWeaponDowncxx . . $ DE_CycleWeaponDown(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2508 {
2509 do
2510 {
2511 unit->shotTypecxx . . $ destruct_unit_s#shotType.--;
2512 if (unit->shotTypecxx . . $ destruct_unit_s#shotType. < SHOT_FIRSTcxx . . $ SHOT_FIRST.)
2513 unit->shotTypecxx . . $ destruct_unit_s#shotType. = SHOT_LASTcxx . . $ SHOT_LAST.;
2514 } while (weaponSystemscxx . . $ weaponSystems.[unit->unitTypecxx . . $ destruct_unit_s#unitType.][unit->shotTypecxx . . $ destruct_unit_s#shotType.] == 0);
2515 }
2516
2517 static void DE_MakeShotcxx . . $ DE_MakeShot(5776d1f53a924cb0).(enum de_player_tcxx . . $ de_player_t# curPlayer, const struct destruct_unit_scxx . . $ destruct_unit_s# * curUnit, int direction)
2518 {
2519 unsigned int i;
2520 unsigned int shotIndex;
2521
2522 /* First, find an empty shot struct we can use */
2523 for (i = 0; ; i++)
2524 {
2525 if (i >= configcxx . . $ config..max_shotscxx . . $ destruct_config_s#max_shots.)
2526 return; /* no empty slots. Do nothing. */
2527
2528 if (shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable.)
2529 {
2530 shotIndex = i;
2531 break;
2532 }
2533 }
2534
2535 /* Helis can't fire when they are on the ground. */
2536 if (curUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI. && curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
2537 return;
2538
2539 /* Play the firing sound */
2540 soundQueuecxx . . $ soundQueue.[curPlayer] = shotSoundcxx . . $ shotSound.[curUnit->shotTypecxx . . $ destruct_unit_s#shotType.];
2541
2542 /* Create our shot. Some units have differing logic here */
2543 switch (curUnit->unitTypecxx . . $ destruct_unit_s#unitType.)
2544 {
2545 case UNIT_HELIcxx . . $ UNIT_HELI.:
2546
2547 shotReccxx . . $ shotRec.[shotIndex].xcxx . . $ destruct_shot_s#x. = curUnit->unitXcxx . . $ destruct_unit_s#unitX. + curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. * 2 + 5;
2548 shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. = 0.02f * curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. * curUnit->lastMovecxx . . $ destruct_unit_s#lastMove. * curUnit->lastMovecxx . . $ destruct_unit_s#lastMove.;
2549
2550 /* If we are trying in vain to move up off the screen, act differently.*/
2551 if (destruct_playercxx . . $ destruct_player.[curPlayer].movescxx . . $ destruct_player_s#moves..actionscxx . . $ destruct_moves_s#actions.[MOVE_UPcxx . . $ MOVE_UP.] && curUnit->unitYcxx . . $ destruct_unit_s#unitY. < 30)
2552 {
2553 shotReccxx . . $ shotRec.[shotIndex].ycxx . . $ destruct_shot_s#y. = curUnit->unitYcxx . . $ destruct_unit_s#unitY.;
2554 shotReccxx . . $ shotRec.[shotIndex].ymovcxx . . $ destruct_shot_s#ymov. = 0.1f;
2555
2556 if (shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. < 0)
2557 shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. += 0.1f;
2558 else if (shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. > 0)
2559 shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. -= 0.1f;
2560 }
2561 else
2562 {
2563 shotReccxx . . $ shotRec.[shotIndex].ycxx . . $ destruct_shot_s#y. = curUnit->unitYcxx . . $ destruct_unit_s#unitY. + 1;
2564 shotReccxx . . $ shotRec.[shotIndex].ymovcxx . . $ destruct_shot_s#ymov. = 0.5f + curUnit->unitYMovcxx . . $ destruct_unit_s#unitYMov. * 0.1f;
2565 }
2566 break;
2567
2568 case UNIT_JUMPERcxx . . $ UNIT_JUMPER.: /* Jumpers are normally only special for the left hand player. Bug? Or feature? */
2569
2570 if (configcxx . . $ config..jumper_straightcxx . . $ destruct_config_s#jumper_straight.[curPlayer])
2571 {
2572 /* This is identical to the default case.
2573 * I considered letting the switch fall through
2574 * but that's more confusing to people who aren't used
2575 * to that quirk of switch. */
2576
2577 shotReccxx . . $ shotRec.[shotIndex].xcxx . . $ destruct_shot_s#x. = curUnit->unitXcxx . . $ destruct_unit_s#unitX. + 6 - cosf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * 10 * direction;
2578 shotReccxx . . $ shotRec.[shotIndex].ycxx . . $ destruct_shot_s#y. = curUnit->unitYcxx . . $ destruct_unit_s#unitY. - 7 - sinf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * 10;
2579 shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. = -cosf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * curUnit->powercxx . . $ destruct_unit_s#power. * direction;
2580 shotReccxx . . $ shotRec.[shotIndex].ymovcxx . . $ destruct_shot_s#ymov. = -sinf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * curUnit->powercxx . . $ destruct_unit_s#power.;
2581 }
2582 else
2583 {
2584 /* This is not identical to the default case. */
2585
2586 shotReccxx . . $ shotRec.[shotIndex].xcxx . . $ destruct_shot_s#x. = curUnit->unitXcxx . . $ destruct_unit_s#unitX. + 2;
2587 shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. = -cosf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * curUnit->powercxx . . $ destruct_unit_s#power. * direction;
2588
2589 if (curUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2590 {
2591 shotReccxx . . $ shotRec.[shotIndex].ymovcxx . . $ destruct_shot_s#ymov. = 1;
2592 shotReccxx . . $ shotRec.[shotIndex].ycxx . . $ destruct_shot_s#y. = curUnit->unitYcxx . . $ destruct_unit_s#unitY. + 2;
2593 }
2594 else
2595 {
2596 shotReccxx . . $ shotRec.[shotIndex].ymovcxx . . $ destruct_shot_s#ymov. = -2;
2597 shotReccxx . . $ shotRec.[shotIndex].ycxx . . $ destruct_shot_s#y. = curUnit->unitYcxx . . $ destruct_unit_s#unitY. - 12;
2598 }
2599 }
2600 break;
2601
2602 default:
2603
2604 shotReccxx . . $ shotRec.[shotIndex].xcxx . . $ destruct_shot_s#x. = curUnit->unitXcxx . . $ destruct_unit_s#unitX. + 6 - cosf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * 10 * direction;
2605 shotReccxx . . $ shotRec.[shotIndex].ycxx . . $ destruct_shot_s#y. = curUnit->unitYcxx . . $ destruct_unit_s#unitY. - 7 - sinf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * 10;
2606 shotReccxx . . $ shotRec.[shotIndex].xmovcxx . . $ destruct_shot_s#xmov. = -cosf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * curUnit->powercxx . . $ destruct_unit_s#power. * direction;
2607 shotReccxx . . $ shotRec.[shotIndex].ymovcxx . . $ destruct_shot_s#ymov. = -sinf(curUnit->anglecxx . . $ destruct_unit_s#angle.) * curUnit->powercxx . . $ destruct_unit_s#power.;
2608 break;
2609 }
2610
2611 /* Now set/clear out a few last details. */
2612 shotReccxx . . $ shotRec.[shotIndex].isAvailablecxx . . $ destruct_shot_s#isAvailable. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2613
2614 shotReccxx . . $ shotRec.[shotIndex].shottypecxx . . $ destruct_shot_s#shottype. = curUnit->shotTypecxx . . $ destruct_unit_s#shotType.;
2615 //shotRec[shotIndex].shotdur = shotFuse[shotRec[shotIndex].shottype];
2616
2617 shotReccxx . . $ shotRec.[shotIndex].trailccxx . . $ destruct_shot_s#trailc.[0] = 0;
2618 shotReccxx . . $ shotRec.[shotIndex].trailccxx . . $ destruct_shot_s#trailc.[1] = 0;
2619 shotReccxx . . $ shotRec.[shotIndex].trailccxx . . $ destruct_shot_s#trailc.[2] = 0;
2620 shotReccxx . . $ shotRec.[shotIndex].trailccxx . . $ destruct_shot_s#trailc.[3] = 0;
2621 }
2622
2623 static void DE_RunMagnetcxx . . $ DE_RunMagnet(d7e50c04c26b4b3).(enum de_player_tcxx . . $ de_player_t# curPlayer, struct destruct_unit_scxx . . $ destruct_unit_s# * magnet)
2624 {
2625 unsigned int i;
2626 enum de_player_tcxx . . $ de_player_t# curEnemy;
2627 int direction;
2628 struct destruct_unit_scxx . . $ destruct_unit_s# * enemyUnit;
2629
2630 curEnemy = (curPlayer == PLAYER_LEFTcxx . . $ PLAYER_LEFT.) ? PLAYER_RIGHTcxx . . $ PLAYER_RIGHT. : PLAYER_LEFTcxx . . $ PLAYER_LEFT.;
2631 direction = (curPlayer == PLAYER_LEFTcxx . . $ PLAYER_LEFT.) ? -1 : 1;
2632
2633 /* Push all shots that are in front of the magnet */
2634 for (i = 0; i < configcxx . . $ config..max_shotscxx . . $ destruct_config_s#max_shots.; i++)
2635 {
2636 if (shotReccxx . . $ shotRec.[i].isAvailablecxx . . $ destruct_shot_s#isAvailable. == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)
2637 {
2638 if ((curPlayer == PLAYER_LEFTcxx . . $ PLAYER_LEFT. && shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. > magnet->unitXcxx . . $ destruct_unit_s#unitX.) ||
2639 (curPlayer == PLAYER_RIGHTcxx . . $ PLAYER_RIGHT. && shotReccxx . . $ shotRec.[i].xcxx . . $ destruct_shot_s#x. < magnet->unitXcxx . . $ destruct_unit_s#unitX.))
2640 {
2641 shotReccxx . . $ shotRec.[i].xmovcxx . . $ destruct_shot_s#xmov. += magnet->powercxx . . $ destruct_unit_s#power. * 0.1f * -direction;
2642 }
2643 }
2644 }
2645
2646 enemyUnit = destruct_playercxx . . $ destruct_player.[curEnemy].unitcxx . . $ destruct_player_s#unit.;
2647 for (i = 0; i < configcxx . . $ config..max_installationscxx . . $ destruct_config_s#max_installations.; i++, enemyUnit++) /* magnets push coptors */
2648 {
2649 if (DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(enemyUnit) &&
2650 enemyUnit->unitTypecxx . . $ destruct_unit_s#unitType. == UNIT_HELIcxx . . $ UNIT_HELI. &&
2651 enemyUnit->isYInAircxx . . $ destruct_unit_s#isYInAir. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
2652 {
2653 if ((curEnemy == PLAYER_RIGHTcxx . . $ PLAYER_RIGHT. && destruct_playercxx . . $ destruct_player.[curEnemy].unitcxx . . $ destruct_player_s#unit.[i].unitXcxx . . $ destruct_unit_s#unitX. + 11 < 318) ||
2654 (curEnemy == PLAYER_LEFTcxx . . $ PLAYER_LEFT. && destruct_playercxx . . $ destruct_player.[curEnemy].unitcxx . . $ destruct_player_s#unit.[i].unitXcxx . . $ destruct_unit_s#unitX. > 1))
2655 {
2656 enemyUnit->unitXcxx . . $ destruct_unit_s#unitX. -= 2 * direction;
2657 }
2658 }
2659 }
2660 magnet->ani_framecxx . . $ destruct_unit_s#ani_frame. = 1;
2661 }
2662
2663 static void DE_RaiseAnglecxx . . $ DE_RaiseAngle(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2664 {
2665 unit->anglecxx . . $ destruct_unit_s#angle. += 0.01f;
2666 if (unit->anglecxx . . $ destruct_unit_s#angle. > M_PI_2cxx . . $ `<external>/11263917310783833665/math.h:1122:10`! - 0.01f)
2667 unit->anglecxx . . $ destruct_unit_s#angle. = M_PI_2cxx . . $ `<external>/11263917310783833665/math.h:1122:10`! - 0.01f;
2668 }
2669
2670 static void DE_LowerAnglecxx . . $ DE_LowerAngle(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2671 {
2672 unit->anglecxx . . $ destruct_unit_s#angle. -= 0.01f;
2673 if (unit->anglecxx . . $ destruct_unit_s#angle. < 0)
2674 unit->anglecxx . . $ destruct_unit_s#angle. = 0;
2675 }
2676
2677 static void DE_RaisePowercxx . . $ DE_RaisePower(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2678 {
2679 unit->powercxx . . $ destruct_unit_s#power. += 0.05f;
2680 if (unit->powercxx . . $ destruct_unit_s#power. > 5)
2681 unit->powercxx . . $ destruct_unit_s#power. = 5;
2682 }
2683
2684 static void DE_LowerPowercxx . . $ DE_LowerPower(c7ca2fa70b0d21d).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2685 {
2686 unit->powercxx . . $ destruct_unit_s#power. -= 0.05f;
2687 if (unit->powercxx . . $ destruct_unit_s#power. < 1)
2688 unit->powercxx . . $ destruct_unit_s#power. = 1;
2689 }
2690
2691 /* DE_isValidUnit
2692 *
2693 * Returns true if the unit's health is above 0 and false
2694 * otherwise. This mainly exists because the 'health' var
2695 * serves two roles and that can get confusing.
2696 */
2697 static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! DE_isValidUnitcxx . . $ DE_isValidUnit(76a96ad34811eb9a).(struct destruct_unit_scxx . . $ destruct_unit_s# * unit)
2698 {
2699 return unit->healthcxx . . $ destruct_unit_s#health. > 0;
2700 }
2701
2702 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! DE_RunTickCheckEndgamecxx . . $ DE_RunTickCheckEndgame(c9857a73d68e59ba).(void)
2703 {
2704 if (destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT.].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining. == 0)
2705 {
2706 destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].scorecxx . . $ destruct_player_s#score. += ModeScorecxx . . $ ModeScore.[PLAYER_LEFTcxx . . $ PLAYER_LEFT.][worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode.];
2707 soundQueuecxx . . $ soundQueue.[7] = V_CLEARED_PLATFORMcxx . . $ V_CLEARED_PLATFORM.;
2708 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2709 }
2710 if (destruct_playercxx . . $ destruct_player.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.].unitsRemainingcxx . . $ destruct_player_s#unitsRemaining. == 0)
2711 {
2712 destruct_playercxx . . $ destruct_player.[PLAYER_LEFTcxx . . $ PLAYER_LEFT.].scorecxx . . $ destruct_player_s#score. += ModeScorecxx . . $ ModeScore.[PLAYER_RIGHTcxx . . $ PLAYER_RIGHT.][worldcxx . . $ world..destructModecxx . . $ destruct_world_s#destructMode.];
2713 soundQueuecxx . . $ soundQueue.[7] = V_CLEARED_PLATFORMcxx . . $ V_CLEARED_PLATFORM.;
2714 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2715 }
2716 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2717 }
2718
2719 static void DE_RunTickPlaySoundscxx . . $ DE_RunTickPlaySounds(49f6e7a06ebc5aa8).(void)
2720 {
2721 unsigned int i, tempSampleIndex, tempVolume;
2722
2723 for (i = 0; i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(soundQueue); i++)
2724 {
2725 if (soundQueuecxx . . $ soundQueue.[i] != S_NONEcxx . . $ S_NONE.)
2726 {
2727 tempSampleIndex = soundQueuecxx . . $ soundQueue.[i];
2728 if (i == 7)
2729 tempVolume = fxPlayVolcxx . . $ fxPlayVol.;
2730 else
2731 tempVolume = fxPlayVolcxx . . $ fxPlayVol. / 2;
2732
2733 multiSamplePlaycxx . . $ multiSamplePlay(c50bd6ef3d54aac8).(soundSamplescxx . . $ soundSamples.[tempSampleIndex-1], soundSampleCountcxx . . $ soundSampleCount.[tempSampleIndex-1], i, tempVolume);
2734 soundQueuecxx . . $ soundQueue.[i] = S_NONEcxx . . $ S_NONE.;
2735 }
2736 }
2737 }
2738
2739 static void JE_pixCoolcxx . . $ JE_pixCool(10e3fdc6547212ea).(unsigned int x, unsigned int y, Uint8cxx . . $ Uint8# c)
2740 {
2741 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., x, y, c);
2742 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., x - 1, y, c - 2);
2743 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., x + 1, y, c - 2);
2744 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., x, y - 1, c - 2);
2745 JE_pixcxx . . $ JE_pix(a8f544383a9967e9).(VGAScreencxx . . $ VGAScreen., x, y + 1, c - 2);
2746 }