Debian Codegraph @

src/shots.c

raw symbols SCIP
1 /*
2 * OpenTyrian: A modern cross-platform port of Tyrian
3 * Copyright (C) 2007-2013 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 #include "shots.h"cxx . . $ `<file>/src/shots.h`/
20
21 #include "player.h"cxx . . $ `<file>/src/player.h`/
22 #include "sprite.h"cxx . . $ `<file>/src/sprite.h`/
23 #include "video.h"cxx . . $ `<file>/src/video.h`/
24 #include "varz.h"cxx . . $ `<file>/src/varz.h`/
25
26 // I'm pretty sure the last extra entry is never used.
27 PlayerShotDataTypecxx . . $ PlayerShotDataType# playerShotDatacxx . . $ playerShotData.[MAX_PWEAPONcxx . . $ `src/shots.h:33:9`! + 1]; /* [1..MaxPWeapon+1] */
28 JE_bytecxx . . $ JE_byte# shotAvailcxx . . $ shotAvail.[MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!]; /* [1..MaxPWeapon] */ /*0:Avail 1-255:Duration left*/
29
30 void simulate_player_shotscxx . . $ simulate_player_shots(49f6e7a06ebc5aa8).(void)
31 {
32 /* Player Shot Images */
33 for (int z = 0; z < MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!; z++)
34 {
35 if (shotAvailcxx . . $ shotAvail.[z] != 0)
36 {
37 shotAvailcxx . . $ shotAvail.[z]--;
38 if (z != MAX_PWEAPONcxx . . $ `src/shots.h:33:9`! - 1)
39 {
40 PlayerShotDataTypecxx . . $ PlayerShotDataType#* shot = &playerShotDatacxx . . $ playerShotData.[z];
41
42 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. += shot->shotXCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXC.;
43
44 if (shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. <= 100)
45 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. += shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.;
46
47 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. += shot->shotYCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYC.;
48 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM.;
49
50 if (shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. > 100)
51 {
52 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. -= 120;
53 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += playercxx . . $ player.[0].delta_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_y_shot_move.;
54 }
55
56 if (shot->shotComplicatedcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotComplicated. != 0)
57 {
58 shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX. += shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX.;
59 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. += shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX.;
60
61 if (abscxx . . $ abs(7864480464b09eea).(shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX.) == shot->shotCirSizeXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeX.)
62 shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX. = -shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX.;
63
64 shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY. += shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY.;
65 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY.;
66
67 if (abscxx . . $ abs(7864480464b09eea).(shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY.) == shot->shotCirSizeYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeY.)
68 shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY. = -shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY.;
69 /*Double Speed Circle Shots - add a second copy of above loop*/
70 }
71
72 int tempShotX = shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX.;
73 int tempShotY = shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY.;
74
75 if (shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. < 0 || shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. > 140 ||
76 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. < 0 || shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. > 170)
77 {
78 shotAvailcxx . . $ shotAvail.[z] = 0;
79 goto draw_player_shot_loop_end;
80 }
81
82 /* if (shot->shotTrail != 255)
83 {
84 if (shot->shotTrail == 98)
85 {
86 JE_setupExplosion(shot->shotX - shot->shotXM, shot->shotY - shot->shotYM, shot->shotTrail);
87 }
88 else
89 {
90 JE_setupExplosion(shot->shotX, shot->shotY, shot->shotTrail);
91 }
92 }*/
93
94 JE_wordcxx . . $ JE_word# anim_frame = shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. + shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni.;
95 if (++shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni. == shot->shotAniMaxcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAniMax.)
96 shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni. = 0;
97
98 if (anim_frame < 60000)
99 {
100 if (anim_frame > 1000)
101 anim_frame = anim_frame % 1000;
102 if (anim_frame > 500)
103 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., tempShotX+1, tempShotY, spriteSheet12cxx . . $ spriteSheet12., anim_frame - 500);
104 else
105 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., tempShotX+1, tempShotY, spriteSheet8cxx . . $ spriteSheet8., anim_frame);
106 }
107 }
108
109 draw_player_shot_loop_end:
110 ;
111 }
112 }
113 }
114
115 static const JE_wordcxx . . $ JE_word# linkMultiGrcxx . . $ linkMultiGr.[17] /* [0..16] */ =
116 {77,221,183,301,1,282,164,202,58,201,163,281,39,300,182,220,77};
117 static const JE_wordcxx . . $ JE_word# linkSonicGrcxx . . $ linkSonicGr.[17] /* [0..16] */ =
118 {85,242,131,303,47,284,150,223,66,224,149,283,9,302,130,243,85};
119 static const JE_wordcxx . . $ JE_word# linkMult2Grcxx . . $ linkMult2Gr.[17] /* [0..16] */ =
120 {78,299,295,297,2,278,276,280,59,279,275,277,40,296,294,298,78};
121
122 void player_shot_set_directioncxx . . $ player_shot_set_direction(29fe2bd0c19b8f3e).(JE_integercxx . . $ JE_integer# shot_id, uintcxx . . $ uint# weapon_id, JE_realcxx . . $ JE_real# direction)
123 {
124 PlayerShotDataTypecxx . . $ PlayerShotDataType#* shot = &playerShotDatacxx . . $ playerShotData.[shot_id];
125
126 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. = -roundf(sinf(direction) * shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM.);
127 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. = -roundf(cosf(direction) * shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM.);
128
129 // Some weapons have sprites for each direction, use those.
130 int rounded_dir;
131
132 switch (weapon_id)
133 {
134 case 27:
135 case 32:
136 case 10:
137 rounded_dir = roundf(direction * (16 / (2 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!))); /*16 directions*/
138 shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. = linkMultiGrcxx . . $ linkMultiGr.[rounded_dir];
139 break;
140 case 28:
141 case 33:
142 case 11:
143 rounded_dir = roundf(direction * (16 / (2 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!))); /*16 directions*/
144 shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. = linkSonicGrcxx . . $ linkSonicGr.[rounded_dir];
145 break;
146 case 30:
147 case 35:
148 case 14:
149 if (direction > M_PI_2cxx . . $ `<external>/11263917310783833665/math.h:1122:10`! && direction < M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`! + M_PI_2cxx . . $ `<external>/11263917310783833665/math.h:1122:10`!)
150 {
151 shot->shotYCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYC. = 1;
152 }
153 break;
154 case 38:
155 case 22:
156 rounded_dir = roundf(direction * (16 / (2 * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!))); /*16 directions*/
157 shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. = linkMult2Grcxx . . $ linkMult2Gr.[rounded_dir];
158 break;
159 }
160 }
161
162 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! player_shot_move_and_drawcxx . . $ player_shot_move_and_draw(785db07d160ac3c9).(
163 int shot_id, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!* out_is_special,
164 int* out_shotx, int* out_shoty,
165 JE_integercxx . . $ JE_integer#* out_shot_damage, JE_bytecxx . . $ JE_byte#* out_blast_filter,
166 JE_bytecxx . . $ JE_byte#* out_chain, JE_bytecxx . . $ JE_byte#* out_playerNum,
167 JE_wordcxx . . $ JE_word#* out_special_radiusw, JE_wordcxx . . $ JE_word#* out_special_radiush)
168 {
169 PlayerShotDataTypecxx . . $ PlayerShotDataType#* shot = &playerShotDatacxx . . $ playerShotData.[shot_id];
170
171 shotAvailcxx . . $ shotAvail.[shot_id]--;
172 if (shot_id != MAX_PWEAPONcxx . . $ `src/shots.h:33:9`! - 1)
173 {
174 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. += shot->shotXCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXC.;
175 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. += shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.;
176 JE_integercxx . . $ JE_integer# tmp_shotXM = shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.;
177
178 if (shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. > 100)
179 {
180 if (shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. == 101)
181 {
182 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. -= 101;
183 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. += playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_x_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_x_shot_move.;
184 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_y_shot_move.;
185 }
186 else
187 {
188 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. -= 120;
189 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. += playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_x_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_x_shot_move.;
190 }
191 }
192
193 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. += shot->shotYCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYC.;
194 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM.;
195
196 if (shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. > 100)
197 {
198 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. -= 120;
199 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_y_shot_move.;
200 }
201
202 if (shot->shotComplicatedcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotComplicated. != 0)
203 {
204 shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX. += shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX.;
205 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. += shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX.;
206
207 if (abscxx . . $ abs(7864480464b09eea).(shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX.) == shot->shotCirSizeXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeX.)
208 shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX. = -shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX.;
209
210 shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY. += shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY.;
211 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. += shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY.;
212
213 if (abscxx . . $ abs(7864480464b09eea).(shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY.) == shot->shotCirSizeYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeY.)
214 shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY. = -shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY.;
215
216 /*Double Speed Circle Shots - add a second copy of above loop*/
217 }
218
219 *out_shotx = shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX.;
220 *out_shoty = shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY.;
221
222 if (shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. < -34 || shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. > 290 ||
223 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. < -15 || shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. > 190)
224 {
225 shotAvailcxx . . $ shotAvail.[shot_id] = 0;
226 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
227 }
228
229 if (shot->shotTrailcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotTrail. != 255)
230 {
231 if (shot->shotTrailcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotTrail. == 98)
232 JE_setupExplosioncxx . . $ JE_setupExplosion(9c65cb39d99632c2).(shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. - shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM., shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. - shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM., 0, shot->shotTrailcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotTrail., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
233 else
234 JE_setupExplosioncxx . . $ JE_setupExplosion(9c65cb39d99632c2).(shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX., shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY., 0, shot->shotTrailcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotTrail., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
235 }
236
237 if (shot->aimAtEnemycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimAtEnemy. != 0)
238 {
239 if (--shot->aimDelaycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimDelay. == 0)
240 {
241 shot->aimDelaycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimDelay. = shot->aimDelayMaxcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimDelayMax.;
242
243 if (enemyAvailcxx . . $ enemyAvail.[shot->aimAtEnemycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimAtEnemy. - 1] != 1)
244 {
245 if (shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. < enemycxx . . $ enemy.[shot->aimAtEnemycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimAtEnemy. - 1].excxx . . $ JE_SingleEnemyType#ex.)
246 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.++;
247 else
248 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.--;
249
250 if (shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. < enemycxx . . $ enemy.[shot->aimAtEnemycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimAtEnemy. - 1].eycxx . . $ JE_SingleEnemyType#ey.)
251 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM.++;
252 else
253 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM.--;
254 }
255 else
256 {
257 if (shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. > 0)
258 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.++;
259 else
260 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM.--;
261 }
262 }
263 }
264
265 JE_wordcxx . . $ JE_word# sprite_frame = shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. + shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni.;
266 if (++shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni. == shot->shotAniMaxcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAniMax.)
267 shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni. = 0;
268
269 *out_shot_damage = shot->shotDmgcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDmg.;
270 *out_blast_filter = shot->shotBlastFiltercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotBlastFilter.;
271 *out_chain = shot->chainReactioncxx . . $ $anonymous_type_fd5daa34a534a1d9_0#chainReaction.;
272 *out_playerNum = shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.;
273
274 *out_is_special = sprite_frame > 60000;
275
276 if (*out_is_special)
277 {
278 blit_sprite_blendcxx . . $ blit_sprite_blend(ee201c8e1efc2766).(VGAScreencxx . . $ VGAScreen., *out_shotx+1, *out_shoty, OPTION_SHAPEScxx . . $ `src/sprite.h:34:9`!, sprite_frame - 60001);
279
280 *out_special_radiusw = spritecxx . . $ sprite(d067a90ab23634af).(OPTION_SHAPEScxx . . $ `src/sprite.h:34:9`!, sprite_frame - 60001)->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width. / 2;
281 *out_special_radiush = spritecxx . . $ sprite(d067a90ab23634af).(OPTION_SHAPEScxx . . $ `src/sprite.h:34:9`!, sprite_frame - 60001)->heightcxx . . $ $anonymous_type_297934740aeafb7d_0#height. / 2;
282 }
283 else
284 {
285 if (sprite_frame > 1000)
286 {
287 JE_doSPcxx . . $ JE_doSP(92c8302fc7928c72).(*out_shotx+1 + 6, *out_shoty + 6, 5, 3, (sprite_frame / 1000) << 4);
288 sprite_frame = sprite_frame % 1000;
289 }
290 if (sprite_frame > 500)
291 {
292 if (background2cxx . . $ background2. && *out_shoty + shadowYDistcxx . . $ shadowYDist. < 190 && tmp_shotXM < 100)
293 blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., *out_shotx+1, *out_shoty + shadowYDistcxx . . $ shadowYDist., spriteSheet12cxx . . $ spriteSheet12., sprite_frame - 500);
294 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., *out_shotx+1, *out_shoty, spriteSheet12cxx . . $ spriteSheet12., sprite_frame - 500);
295 }
296 else
297 {
298 if (background2cxx . . $ background2. && *out_shoty + shadowYDistcxx . . $ shadowYDist. < 190 && tmp_shotXM < 100)
299 blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., *out_shotx+1, *out_shoty + shadowYDistcxx . . $ shadowYDist., spriteSheet8cxx . . $ spriteSheet8., sprite_frame);
300 blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(VGAScreencxx . . $ VGAScreen., *out_shotx+1, *out_shoty, spriteSheet8cxx . . $ spriteSheet8., sprite_frame);
301 }
302 }
303 }
304
305 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
306 }
307
308 JE_integercxx . . $ JE_integer# player_shot_createcxx . . $ player_shot_create(47a6dcf6307ecf82).(JE_wordcxx . . $ JE_word# portNum, uintcxx . . $ uint# bay_i, JE_wordcxx . . $ JE_word# PX, JE_wordcxx . . $ JE_word# PY, JE_wordcxx . . $ JE_word# mouseX, JE_wordcxx . . $ JE_word# mouseY, JE_wordcxx . . $ JE_word# wpNum, JE_bytecxx . . $ JE_byte# playerNum)
309 {
310 static const JE_bytecxx . . $ JE_byte# soundChannel[11] /* [1..11] */ = {0, 2, 4, 4, 2, 2, 5, 5, 1, 4, 1};
311
312 // Bounds check
313 if (portNum > PORT_NUMcxx . . $ `src/lvlmast.h:27:9`! || wpNum <= 0 || wpNum > WEAP_NUMcxx . . $ `src/lvlmast.h:26:9`!)
314 return MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!;
315
316 const JE_WeaponTypecxx . . $ JE_WeaponType#* weapon = &weaponscxx . . $ weapons.[wpNum];
317
318 if (powercxx . . $ power. < weaponPortcxx . . $ weaponPort.[portNum].powerusecxx . . $ $anonymous_type_66fcae0887b82ce8_1#poweruse.)
319 return MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!;
320 powercxx . . $ power. -= weaponPortcxx . . $ weaponPort.[portNum].powerusecxx . . $ $anonymous_type_66fcae0887b82ce8_1#poweruse.;
321
322 if (weapon->soundcxx . . $ $anonymous_type_66fcae0887b82ce8_0#sound. > 0)
323 soundQueuecxx . . $ soundQueue.[soundChannel[bay_i]] = weapon->soundcxx . . $ $anonymous_type_66fcae0887b82ce8_0#sound.;
324
325 int shot_id = MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!;
326 /*Rot*/
327 for (int multi_i = 1; multi_i <= weapon->multicxx . . $ $anonymous_type_66fcae0887b82ce8_0#multi.; multi_i++)
328 {
329 for (shot_id = 0; shot_id < MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!; shot_id++)
330 if (shotAvailcxx . . $ shotAvail.[shot_id] == 0)
331 break;
332 if (shot_id == MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!)
333 return MAX_PWEAPONcxx . . $ `src/shots.h:33:9`!;
334
335 if (shotMultiPoscxx . . $ shotMultiPos.[bay_i] == weapon->maxcxx . . $ $anonymous_type_66fcae0887b82ce8_0#max. || shotMultiPoscxx . . $ shotMultiPos.[bay_i] > 8)
336 shotMultiPoscxx . . $ shotMultiPos.[bay_i] = 1;
337 else
338 shotMultiPoscxx . . $ shotMultiPos.[bay_i]++;
339
340 PlayerShotDataTypecxx . . $ PlayerShotDataType#* shot = &playerShotDatacxx . . $ playerShotData.[shot_id];
341 shot->chainReactioncxx . . $ $anonymous_type_fd5daa34a534a1d9_0#chainReaction. = 0;
342
343 shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber. = playerNum;
344
345 shot->shotAnicxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAni. = 0;
346
347 shot->shotComplicatedcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotComplicated. = weapon->circlesizecxx . . $ $anonymous_type_66fcae0887b82ce8_0#circlesize. != 0;
348
349 if (weapon->circlesizecxx . . $ $anonymous_type_66fcae0887b82ce8_0#circlesize. == 0)
350 {
351 shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX. = 0;
352 shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX. = 0;
353 shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY. = 0;
354 shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY. = 0;
355 shot->shotCirSizeXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeX. = 0;
356 shot->shotCirSizeYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeY. = 0;
357 }
358 else
359 {
360 JE_bytecxx . . $ JE_byte# circsize = weapon->circlesizecxx . . $ $anonymous_type_66fcae0887b82ce8_0#circlesize.;
361
362 if (circsize > 19)
363 {
364 JE_bytecxx . . $ JE_byte# circsize_mod20 = circsize % 20;
365 shot->shotCirSizeXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeX. = circsize_mod20;
366 shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX. = circsize_mod20 >> 1;
367
368 circsize = circsize / 20;
369 shot->shotCirSizeYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeY. = circsize;
370 shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY. = circsize >> 1;
371 }
372 else
373 {
374 shot->shotCirSizeXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeX. = circsize;
375 shot->shotCirSizeYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotCirSizeY. = circsize;
376 shot->shotDevXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevX. = circsize >> 1;
377 shot->shotDevYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDevY. = circsize >> 1;
378 }
379 shot->shotDirXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirX. = 1;
380 shot->shotDirYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDirY. = -1;
381 }
382
383 shot->shotTrailcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotTrail. = weapon->trailcxx . . $ $anonymous_type_66fcae0887b82ce8_0#trail.;
384
385 if (weapon->attackcxx . . $ $anonymous_type_66fcae0887b82ce8_0#attack.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1] > 99 && weapon->attackcxx . . $ $anonymous_type_66fcae0887b82ce8_0#attack.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1] < 250)
386 {
387 shot->chainReactioncxx . . $ $anonymous_type_fd5daa34a534a1d9_0#chainReaction. = weapon->attackcxx . . $ $anonymous_type_66fcae0887b82ce8_0#attack.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1] - 100;
388 shot->shotDmgcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDmg. = 1;
389 }
390 else
391 {
392 shot->shotDmgcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotDmg. = weapon->attackcxx . . $ $anonymous_type_66fcae0887b82ce8_0#attack.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
393 }
394
395 shot->shotBlastFiltercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotBlastFilter. = weapon->shipblastfiltercxx . . $ $anonymous_type_66fcae0887b82ce8_0#shipblastfilter.;
396
397 JE_integercxx . . $ JE_integer# tmp_by = weapon->bycxx . . $ $anonymous_type_66fcae0887b82ce8_0#by.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
398
399 /*Note: Only front selection used for player shots...*/
400
401 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. = PX + weapon->bxcxx . . $ $anonymous_type_66fcae0887b82ce8_0#bx.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
402
403 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. = PY + tmp_by;
404 shot->shotYCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYC. = -weapon->accelerationcxx . . $ $anonymous_type_66fcae0887b82ce8_0#acceleration.;
405 shot->shotXCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXC. = weapon->accelerationxcxx . . $ $anonymous_type_66fcae0887b82ce8_0#accelerationx.;
406
407 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. = weapon->sxcxx . . $ $anonymous_type_66fcae0887b82ce8_0#sx.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
408
409 // Not sure what this field does exactly.
410 JE_bytecxx . . $ JE_byte# del = weapon->delcxx . . $ $anonymous_type_66fcae0887b82ce8_0#del.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
411
412 if (del == 121)
413 {
414 shot->shotTrailcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotTrail. = 0;
415 del = 255;
416 }
417
418 shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. = weapon->sgcxx . . $ $anonymous_type_66fcae0887b82ce8_0#sg.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
419 if (shot->shotGrcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotGr. == 0)
420 shotAvailcxx . . $ shotAvail.[shot_id] = 0;
421 else
422 shotAvailcxx . . $ shotAvail.[shot_id] = del;
423
424 if (del > 100 && del < 120)
425 shot->shotAniMaxcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAniMax. = (del - 100 + 1);
426 else
427 shot->shotAniMaxcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotAniMax. = weapon->weapanicxx . . $ $anonymous_type_66fcae0887b82ce8_0#weapani. + 1;
428
429 if (del == 99 || del == 98)
430 {
431 tmp_by = PX - mouseX;
432 if (tmp_by < -5)
433 tmp_by = -5;
434 else if (tmp_by > 5)
435 tmp_by = 5;
436 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. += tmp_by;
437 }
438
439 if (del == 99 || del == 100)
440 {
441 tmp_by = PY - mouseY - weapon->sycxx . . $ $anonymous_type_66fcae0887b82ce8_0#sy.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
442 if (tmp_by < -4)
443 tmp_by = -4;
444 else if (tmp_by > 4)
445 tmp_by = 4;
446 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. = tmp_by;
447 }
448 else if (weapon->sycxx . . $ $anonymous_type_66fcae0887b82ce8_0#sy.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1] == 98)
449 {
450 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. = 0;
451 shot->shotYCcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYC. = -1;
452 }
453 else if (weapon->sycxx . . $ $anonymous_type_66fcae0887b82ce8_0#sy.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1] > 100)
454 {
455 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. = weapon->sycxx . . $ $anonymous_type_66fcae0887b82ce8_0#sy.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
456 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. -= playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_y_shot_move.;
457 }
458 else
459 {
460 shot->shotYMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotYM. = -weapon->sycxx . . $ $anonymous_type_66fcae0887b82ce8_0#sy.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
461 }
462
463 if (weapon->sxcxx . . $ $anonymous_type_66fcae0887b82ce8_0#sx.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1] > 100)
464 {
465 shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. = weapon->sxcxx . . $ $anonymous_type_66fcae0887b82ce8_0#sx.[shotMultiPoscxx . . $ shotMultiPos.[bay_i]-1];
466 shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX. -= playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_x_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_x_shot_move.;
467 if (shot->shotXMcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotXM. == 101)
468 shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY. -= playercxx . . $ player.[shot->playerNumbercxx . . $ $anonymous_type_fd5daa34a534a1d9_0#playerNumber.-1].delta_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_y_shot_move.;
469 }
470
471 if (weapon->aimcxx . . $ $anonymous_type_66fcae0887b82ce8_0#aim. > 5) /*Guided Shot*/
472 {
473 uintcxx . . $ uint# best_dist = 65000;
474 JE_bytecxx . . $ JE_byte# closest_enemy = 0;
475 /*Find Closest Enemy*/
476 for (xcxx . . $ x. = 0; xcxx . . $ x. < 100; xcxx . . $ x.++)
477 {
478 if (enemyAvailcxx . . $ enemyAvail.[xcxx . . $ x.] != 1 && !enemycxx . . $ enemy.[xcxx . . $ x.].scoreitemcxx . . $ JE_SingleEnemyType#scoreitem.)
479 {
480 ycxx . . $ y. = abscxx . . $ abs(7864480464b09eea).(enemycxx . . $ enemy.[xcxx . . $ x.].excxx . . $ JE_SingleEnemyType#ex. - shot->shotXcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotX.) + abscxx . . $ abs(7864480464b09eea).(enemycxx . . $ enemy.[xcxx . . $ x.].eycxx . . $ JE_SingleEnemyType#ey. - shot->shotYcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#shotY.);
481 if (ycxx . . $ y. < best_dist)
482 {
483 best_dist = ycxx . . $ y.;
484 closest_enemy = xcxx . . $ x. + 1;
485 }
486 }
487 }
488 shot->aimAtEnemycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimAtEnemy. = closest_enemy;
489 shot->aimDelaycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimDelay. = 5;
490 shot->aimDelayMaxcxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimDelayMax. = weapon->aimcxx . . $ $anonymous_type_66fcae0887b82ce8_0#aim. - 5;
491 }
492 else
493 {
494 shot->aimAtEnemycxx . . $ $anonymous_type_fd5daa34a534a1d9_0#aimAtEnemy. = 0;
495 }
496
497 shotRepeatcxx . . $ shotRepeat.[bay_i] = weapon->shotrepeatcxx . . $ $anonymous_type_66fcae0887b82ce8_0#shotrepeat.;
498 }
499
500 return shot_id;
501 }