DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
charakey.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 836
4#pragma argument_flag 0
5#pragma argument_flag_ones 189, 248, 267, 286, 342, 348, 410, 430, 470, 490
6#pragma argument_flag_ones 540, 545, 617, 622, 693, 699, 746, 747, 749
7
8#include "common.h"
9
10/* The per-character special-attack key handlers: Toan's, Ungaga's and Goro's,
11 * with the two helpers they share. */
12
13#include <cmath>
14
15#include "btactstatus.hpp"
16#include "btmisc.hpp"
17#include "character.hpp"
18#include "clothread.hpp"
19#include "collisiondata.hpp"
20#include "dataread.hpp"
21#include "dun/gameloop.hpp"
22#include "frame.hpp"
23#include "framevu1.hpp"
24#include "gamepad.hpp"
25#include "itemdata.hpp"
26#include "motionmodel.hpp"
27#include "shot_effect.hpp"
28#include "shot_freefuncs.hpp"
29#include "snd.hpp"
30#include "userstatus.hpp"
31#include "weaponeffect.hpp"
32
33void sound_play(float from, float to, float now, int se_no) {
34 if (now >= from && now <= to) {
35 SndSePlay(se_no, -1, 0);
36 }
37}
38
39void basic_damage(int kind, int owner) {
40 NowColData->hit[NowColData->now_hit].vs_monster = NowWeaponHave->vs_monster;
41 NowColData->hit[NowColData->now_hit].weapon_flags = NowWeaponHave->flags;
42
43 s8 elem = NowWeaponHave->best_elem;
44 CCollisionData *attr_col = NowColData;
45
46 attr_col->hit[attr_col->now_hit].flags = GetWeaponElementAttr(elem);
47
48 CCollisionData *owner_col = NowColData;
49
50 owner_col->hit[owner_col->now_hit].owner = owner;
51 owner_col->hit[owner_col->now_hit].attack_no = kind;
52}
53
54void ToanKey_On() {
55 if (BtActStatus.special_cooldown > 0) {
56 return;
57 }
58
59 if (BtActStatus.action_on == 0) {
60 sceVu0FVECTOR rotation;
61
62 BtActStatus.refill_frames = 0;
63 BtActStatus.action_no = 0x24;
64 BtActStatus.action_on = 1;
65 BtActStatus.action_step = 0;
66 BtActStatus.charge_time = 1.0f;
67 BtActStatus.charge_level = 0;
68 driveNoInterpolate = 1;
69 CharaMain.motion_type.state.time = 136.0f;
70 BtActStatus.combo_window = 0;
71 BtActStatus.combo_queued = 0;
72 BtActStatus.frames_since_attack = 0;
73 CharaMain.GetRotation(rotation);
74 BtActStatus.swing_heading = rotation[1];
75 } else {
76 if (BtActStatus.action_no == 0x24 && BtActStatus.combo_window != 0 && BtActStatus.action_gauge >= 20.0f) {
77 BtActStatus.combo_queued = 1;
78 BtActStatus.refill_frames = 0;
79 }
80
81 if (BtActStatus.action_no == 0x25 && BtActStatus.combo_window != 0 && BtActStatus.action_gauge >= 20.0f) {
82 BtActStatus.combo_queued = 1;
83 BtActStatus.refill_frames = 0;
84 }
85
86 if (BtActStatus.action_no == 0x26 && BtActStatus.combo_window != 0 && BtActStatus.action_gauge >= 20.0f) {
87 BtActStatus.combo_queued = 1;
88 BtActStatus.refill_frames = 0;
89 }
90
91 if (BtActStatus.action_no == 0x27 && BtActStatus.combo_window != 0 && BtActStatus.action_gauge >= 20.0f) {
92 BtActStatus.combo_queued = 1;
93 BtActStatus.refill_frames = 0;
94 }
95 }
96}
97
98void ToanKey_Play() {
99 float time = CharaMain.motion_type.state.time;
100 int damage = NowWeaponHave->attack;
101
102 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
103 damage *= 2;
104 }
105
106 int element_se = -1;
107
108 if (NowWeaponHave->best_elem < 5) {
109 element_se = NowWeaponHave->best_elem + 0x65;
110 }
111
112 if (element_se == 0x66) {
113 element_se = 0x66;
114 }
115
116 sceVu0FVECTOR hit_pos;
117 sceVu0FVECTOR chara_pos;
118
119 getFramePos((CFrameVu1 *) NowWeapon->frame, "dcol1", hit_pos);
120 sceVu0CopyVector(chara_pos, CharaMain.pos);
121
122 if (time >= 825 && time <= 828.0f) {
123 NowColData->Set(hit_pos, damage, 1, 2.8f, 0.0f, 2, 2, 0, 0);
124 basic_damage(0, 0);
125 NowColData->SetKickBack(chara_pos, 1.2f, 0.2f, 2);
126 }
127
128 if (time >= 833 && time <= 835) {
129 NowColData->Set(hit_pos, damage, 1, 5.3f, 0.0f, 2, 2, 0, 0);
130 basic_damage(0, 0);
131 NowColData->SetKickBack(chara_pos, 1.2f, 0.2f, 2);
132 }
133
134 if (time >= 842 && time <= 844.0f) {
135 NowColData->Set(hit_pos, damage, 1, 6.2f, 0.0f, 2, 2, 0, 0);
136 basic_damage(0, 0);
137 NowColData->SetKickBack(chara_pos, 1.5f, 0.3f, 2);
138 }
139
140 if (time >= 851 && time <= 854) {
141 NowColData->Set(hit_pos, damage, 1, 6.2f, 0.0f, 2, 2, 0, 0);
142 basic_damage(0, 0);
143 NowColData->SetKickBack(chara_pos, 2.0f, 0.4f, 2);
144 }
145
146 if (time >= 862 && time <= 866) {
147 damage *= 1.8f;
148 NowColData->Set(hit_pos, damage, 1, 6.2f, 0.0f, 2, 2, 0, 0);
149 basic_damage(0, 0);
150 NowColData->SetKickBack(chara_pos, 3.0f, 0.3f, 2);
151 }
152
153 if (time >= 193.0f && time <= 196.0f) {
154 damage *= 1.5;
155 NowColData->Set(hit_pos, damage, 1, 6.0f, 0.0f, 2, 2, 0, 0);
156 basic_damage(2, 0);
157 NowColData->SetKickBack(chara_pos, 3.0f, 0.3f, 2);
158 }
159
160 if (time >= 720.0f && time <= 722) {
161 damage *= 1.5;
162 NowColData->Set(hit_pos, damage, 1, 12.0f, 0.0f, 2, 2, 0, 0);
163 basic_damage(3, 0);
164 NowColData->SetKickBack(chara_pos, 3.0f, 0.3f, 2);
165 }
166
167 int swing_motions[4] = {0x25, 0x26, 0x27, 0x28};
168
169 for (int i = 0; i < 4; i++) {
170 float swing_start = CharaMain.motion_type.motion_info[swing_motions[i]].start;
171 float swing_end = CharaMain.motion_type.motion_info[swing_motions[i]].end;
172
173 if (swing_start < time && swing_end > time) {
174 BtActStatus.swinging = 1;
175 }
176 }
177
178 sound_play(825, 825.3f, time, 0x190);
179 sound_play(833, 833.3f, time, 0x191);
180 sound_play(842, 842.3f, time, 0x190);
181 sound_play(852.0f, 852.3f, time, 0x190);
182 sound_play(864.0f, 864.3f, time, 0x191);
183 sound_play(193.0f, 193.3f, time, 0x191);
184 sound_play(717, 717.3f, time, 0x191);
185 sound_play(825, 825.3f, time, 0x1A4);
186 sound_play(833, 833.3f, time, 0x1A5);
187 sound_play(842, 842.3f, time, 0x1A5);
188 sound_play(852.0f, 852.3f, time, 0x1A4);
189 sound_play(864.0f, 864.3f, time, 0x1A6);
190
191 sceVu0FVECTOR forward = {0.0f, 0.0f, 1.0f, 1.0f};
192 sceVu0FVECTOR rotation;
193 sceVu0FMATRIX matrix;
194
195 CharaMain.frame->GetRotation(rotation);
196 sceVu0UnitMatrix(matrix);
197 sceVu0RotMatrixY(matrix, matrix, rotation[1]);
198 sceVu0ApplyMatrix(BtActStatus.move_vector, matrix, forward);
199
200 if (BtActStatus.action_no == 0x24) {
201 if (time >= 820.0f && time <= 820.5f) {
202 BtActStatus.move_power = 0.17f;
203 BtActStatus.move_power_decay = 0.0f;
204 }
205
206 BtActStatus.motion_no = 0x24;
207
208 if (GamePad.On(PadInput_OK) == 0) {
209 BtActStatus.action_step = 1;
210 }
211
212 float end = CharaMain.motion_type.motion_info[0x24].end;
213
214 if (time >= 824.0f && time <= 825) {
215 float tip = 64.0f;
216
217 CWeaponFx.Set(8, 32.0f, tip);
218 }
219
220 BtActStatus.combo_window = 1;
221
222 if (time >= end - 1.0f && time <= end) {
223 if (BtActStatus.action_step == 0) {
224 BtActStatus.action_no = 14;
225 BtActStatus.motion_no = 14;
226 BtActStatus.action_gauge = 0.0f;
227 BtActStatus.move_power = 0.0f;
228 } else if (BtActStatus.combo_queued == 1) {
229 BtActStatus.action_gauge -= 25.0f;
230
231 if (BtActStatus.action_gauge <= 0.0f) {
232 BtActStatus.action_gauge = 0.0f;
233 }
234
235 BtActStatus.action_no = 0x25;
236 BtActStatus.motion_no = 0x25;
237 driveNoInterpolate = 1;
238 CharaMain.frame->SearchFrame("dcol1");
239 BtActStatus.frames_since_attack = 0;
240 BtActStatus.swing_heading = atan2f(BtActStatus.move_x, BtActStatus.move_z);
241 } else {
242 if (lockOnTargetFlag != 0) {
243 BtActStatus.motion_no = 0x12;
244 }
245
246 BtActStatus.unk_028 = 0;
247 BtActStatus.motion_no = 0;
248 BtActStatus.action_on = 0;
249 BtActStatus.move_power = 0.0f;
250 BtActStatus.move_power_decay = 0.0f;
251 BtActStatus.special_cooldown = 15;
252 }
253
254 BtActStatus.combo_window = 0;
255 BtActStatus.combo_queued = 0;
256 }
257 }
258
259 if (BtActStatus.action_no == 0x25) {
260 if (BtActStatus.stick_strength > 0.0f) {
261 CharaMain.frame->SetRotation(0.0f, unitRotation((CFrameVu1 *) CharaMain.frame, BtActStatus.swing_heading), 0.0f);
262 }
263
264 BtActStatus.motion_no = 0x25;
265
266 float end = CharaMain.motion_type.motion_info[0x25].end;
267
268 if (time >= 832.0f && time <= 833) {
269 CWeaponFx.Set(0xA, 32.0f, 32.0f);
270 }
271
272 BtActStatus.combo_window = 1;
273
274 if (time >= end - 1.0f && time <= end) {
275 if (BtActStatus.combo_queued == 1) {
276 BtActStatus.action_gauge -= 25.0f;
277
278 if (BtActStatus.action_gauge <= 0.0f) {
279 BtActStatus.action_gauge = 0.0f;
280 }
281
282 BtActStatus.action_no = 0x26;
283 BtActStatus.motion_no = 0x26;
284 driveNoInterpolate = 1;
285 CharaMain.frame->SearchFrame("dcol1");
286 BtActStatus.frames_since_attack = 0;
287 BtActStatus.swing_heading = atan2f(BtActStatus.move_x, BtActStatus.move_z);
288 } else {
289 if (lockOnTargetFlag != 0) {
290 BtActStatus.motion_no = 0x12;
291 }
292
293 BtActStatus.unk_028 = 0;
294 BtActStatus.motion_no = 0;
295 BtActStatus.action_on = 0;
296 BtActStatus.move_power = 0.0f;
297 BtActStatus.move_power_decay = 0.0f;
298 }
299
300 BtActStatus.combo_window = 0;
301 BtActStatus.combo_queued = 0;
302 }
303 }
304
305 if (BtActStatus.action_no == 0x26) {
306 if (BtActStatus.stick_strength > 0.0f) {
307 CharaMain.frame->SetRotation(0.0f, unitRotation((CFrameVu1 *) CharaMain.frame, BtActStatus.swing_heading), 0.0f);
308 }
309
310 BtActStatus.motion_no = 0x26;
311
312 float end = CharaMain.motion_type.motion_info[0x26].end;
313
314 if (time >= 841 && time <= 841.5f) {
315 CWeaponFx.Set(8, 32.0f, 64.0f);
316 }
317
318 BtActStatus.combo_window = 1;
319
320 if (time >= end - 1.0f && time <= end) {
321 if (BtActStatus.combo_queued == 1) {
322 BtActStatus.action_gauge -= 25.0f;
323
324 if (BtActStatus.action_gauge <= 0.0f) {
325 BtActStatus.action_gauge = 0.0f;
326 }
327
328 BtActStatus.action_no = 0x27;
329 BtActStatus.motion_no = 0x27;
330 driveNoInterpolate = 1;
331 CharaMain.frame->SearchFrame("dcol1");
332 BtActStatus.frames_since_attack = 0;
333 BtActStatus.swing_heading = atan2f(BtActStatus.move_x, BtActStatus.move_z);
334 } else {
335 if (lockOnTargetFlag != 0) {
336 BtActStatus.motion_no = 0x12;
337 }
338
339 BtActStatus.unk_028 = 0;
340 BtActStatus.motion_no = 0;
341 BtActStatus.action_on = 0;
342 BtActStatus.move_power = 0.0f;
343 BtActStatus.move_power_decay = 0.0f;
344 }
345
346 BtActStatus.combo_window = 0;
347 BtActStatus.combo_queued = 0;
348 }
349 }
350
351 if (BtActStatus.action_no == 0x27) {
352 if (BtActStatus.stick_strength > 0.0f) {
353 CharaMain.frame->SetRotation(0.0f, unitRotation((CFrameVu1 *) CharaMain.frame, BtActStatus.swing_heading), 0.0f);
354 }
355
356 BtActStatus.motion_no = 0x27;
357
358 float end = CharaMain.motion_type.motion_info[0x27].end;
359
360 if (time >= 849 && time <= 849.5f) {
361 CWeaponFx.Set(0xA, 32.0f, 32.0f);
362 }
363
364 BtActStatus.combo_window = 1;
365
366 if (time >= end - 1.0f && time <= end) {
367 if (BtActStatus.combo_queued == 1) {
368 BtActStatus.action_gauge -= 25.0f;
369
370 if (BtActStatus.action_gauge <= 0.0f) {
371 BtActStatus.action_gauge = 0.0f;
372 }
373
374 BtActStatus.action_no = 0x28;
375 BtActStatus.motion_no = 0x28;
376 driveNoInterpolate = 1;
377 CharaMain.frame->SearchFrame("dcol1");
378 BtActStatus.frames_since_attack = 0;
379 } else {
380 if (lockOnTargetFlag != 0) {
381 BtActStatus.motion_no = 0x12;
382 }
383
384 BtActStatus.unk_028 = 0;
385 BtActStatus.motion_no = 0;
386 BtActStatus.action_on = 0;
387 BtActStatus.move_power = 0.0f;
388 BtActStatus.move_power_decay = 0.0f;
389 }
390
391 BtActStatus.combo_window = 0;
392 BtActStatus.combo_queued = 0;
393 }
394 }
395
396 if (BtActStatus.action_no == 0x28) {
397 if (time >= 867.5f && time <= 868.0f) {
398 BtActStatus.move_power = 0.0f;
399 BtActStatus.move_power_decay = 0.0f;
400 }
401
402 BtActStatus.motion_no = 0x28;
403
404 if (time >= 861 && time <= 861.5f) {
405 CWeaponFx.Set(0xE, 24.0f, 32.0f);
406 }
407
408 float end = CharaMain.motion_type.motion_info[0x28].end;
409
410 if (time >= end - 1.0f && time <= end) {
411 if (lockOnTargetFlag != 0) {
412 BtActStatus.motion_no = 0x12;
413 }
414
415 BtActStatus.unk_028 = 0;
416 BtActStatus.motion_no = 0;
417 BtActStatus.action_on = 0;
418 BtActStatus.move_power = 0.0f;
419 BtActStatus.move_power_decay = 0.0f;
420 BtActStatus.combo_window = 0;
421 BtActStatus.combo_queued = 0;
422 }
423 }
424
425 if (BtActStatus.action_no == 14) {
426 if (GamePad.On(PadInput_OK) == 0) {
427 BtActStatus.action_step = 1;
428 }
429
430 BtActStatus.motion_no = 14;
431 BtActStatus.charge_time += 0.016666667f;
432
433 if (BtActStatus.charge_time >= 1.5f && BtActStatus.charge_level == 0) {
434 BtActStatus.charge_level = 1;
435 setUnitAmbientAnime(15.0f, 1.0f, 0.0f, 122.0f, 208.0f);
436 }
437
438 if (UserStatus->skill_owned[0] != 0 && BtActStatus.charge_time >= 2.5f && BtActStatus.charge_level == 1) {
439 BtActStatus.charge_level = 2;
440 setUnitAmbientAnime(15.0f, 1.0f, 0.0f, 122.0f, 208.0f);
441 }
442
443 if (BtActStatus.action_step == 1) {
444 if (BtActStatus.charge_time >= 1.5f) {
445 int charged = 0;
446
447 if (UserStatus->skill_owned[0] != 0 && BtActStatus.charge_time >= 2.5f) {
448 charged = 1;
449 }
450
451 if (BtActStatus.charge_time >= 3.0f) {
452 BtActStatus.charge_time = 3.0f;
453 }
454
455 if (charged == 0) {
456 BtActStatus.action_no = 0xF;
457 BtActStatus.motion_no = 0xF;
458 driveNoInterpolate = 1;
459 SwordDmgCheck1(2.0f, 0);
460 }
461
462 if (charged != 0) {
463 sceVu0FVECTOR shot_pos;
464 sceVu0FVECTOR shot_vector = {0.0001f, 0.9998f, 0.0001f, 1.0f};
465
466 sceVu0CopyVector(shot_pos, CharaMain.pos);
467 NowMainEffect->Set(shot_pos, shot_vector, 0, -1, 0, NULL, -1);
468 NowMainEffect->SetVsMonster(NowWeaponHave->vs_monster);
469 NowMainEffect->SetWepStatus(NowWeaponHave->flags);
470 NowMainEffect->SetDmg((int) (1.5f * (float) damage));
471 NowMainEffect->SetWait(45);
472 NowMainEffect->SetAttribute(GetWeaponElementAttr(NowWeaponHave->best_elem));
473 SwordDmgCheck1(3.0f, 0);
474 BtActStatus.action_no = 0x18;
475 BtActStatus.motion_no = 0x18;
476 driveNoInterpolate = 1;
477 SndSePlay(SE_CHARA_SHOUT_4, -1, 0);
478 }
479 } else {
480 if (lockOnTargetFlag != 0) {
481 BtActStatus.motion_no = 0x12;
482 }
483
484 BtActStatus.unk_028 = 0;
485 BtActStatus.motion_no = 0;
486 BtActStatus.action_on = 0;
487 }
488 }
489 }
490
491 if (BtActStatus.action_no == 0x18) {
492 if (time >= 720.0f && time <= 720.5f) {
493 CWeaponFx.Set(0x1E, 28.0f, 16.0f);
494 }
495
496 BtActStatus.invincible_frames = 0x1770;
497 BtActStatus.action_busy = 1;
498 BtActStatus.can_act = 0;
499 BtActStatus.motion_no = 0x18;
500
501 float end = CharaMain.motion_type.motion_info[0x18].end;
502
503 if (time >= end - 1.0f && time <= end) {
504 if (lockOnTargetFlag != 0) {
505 BtActStatus.motion_no = 0x12;
506 }
507
508 BtActStatus.unk_028 = 0;
509 BtActStatus.motion_no = 0;
510 BtActStatus.action_on = 0;
511 BtActStatus.invincible_frames = 0;
512 BtActStatus.action_busy = 0;
513 BtActStatus.can_act = 1;
514 }
515 }
516
517 if (BtActStatus.action_no == 0xF) {
518 BtActStatus.motion_no = 0xF;
519 BtActStatus.invincible_frames = 0x1770;
520 BtActStatus.action_busy = 1;
521 BtActStatus.can_act = 0;
522
523 if (time >= 187.0f && time < 188.0f) {
524 sceVu0FVECTOR shot_from;
525 sceVu0FVECTOR shot_to;
526
527 sceVu0CopyVector(shot_from, CharaMain.pos);
528 getCharacterVector(shot_to, 0.0f);
529 sceVu0ScaleVectorXYZ(shot_to, shot_to, 16.0f);
530 shot_to[0] += shot_from[0];
531 shot_to[1] = shot_from[1];
532 shot_to[2] += shot_from[2];
533 BtActStatus.jumping = 1;
534 ParabolicInitialVector(&BtActStatus.jump_velocity_x, shot_from, shot_to, 0.1f, 40.0f);
535 BtActStatus.jump_velocity_z = 0.0f;
536 BtActStatus.jump_velocity_x = 0.0f;
537 }
538
539 float end = CharaMain.motion_type.motion_info[15].end;
540
541 if (time >= end - 1.0f && time <= end) {
542 BtActStatus.action_no = 0x10;
543 BtActStatus.motion_no = 0x10;
544 driveNoInterpolate = 1;
545 CharaMain.motion_type.state.time = CharaMain.motion_type.motion_info[16].start;
546 }
547 }
548
549 if (BtActStatus.action_no == 0x10) {
550 BtActStatus.motion_no = 0x10;
551
552 if (BtActStatus.jump_velocity_y <= -0.4f) {
553 BtActStatus.action_no = 3;
554 driveNoInterpolate = 1;
555 CWeaponFx.Set(0x14, 16.0f, 64.0f);
556 CharaMain.motion_type.state.time = CharaMain.motion_type.motion_info[3].start;
557 SndSePlay(SE_CHARA_SHOUT_3, -1, 0);
558 }
559 }
560
561 if (BtActStatus.action_no == 3) {
562 BtActStatus.motion_no = 3;
563
564 float end = CharaMain.motion_type.motion_info[3].end;
565
566 if (time >= end - 1.0f && time <= end) {
567 BtActStatus.action_no = 0x19;
568 driveNoInterpolate = 1;
569 CharaMain.motion_type.state.time = CharaMain.motion_type.motion_info[0x19].start;
570 }
571 }
572
573 if (BtActStatus.action_no == 0x19) {
574 BtActStatus.motion_no = 0x19;
575
576 if (BtActStatus.ground_height < 2.0f) {
577 BtActStatus.action_no = 0x11;
578 BtActStatus.jumping = 0;
579 driveNoInterpolate = 1;
580 CharaMain.motion_type.state.time = CharaMain.motion_type.motion_info[0x11].start;
581 }
582 }
583
584 if (BtActStatus.action_no == 0x11) {
585 BtActStatus.motion_no = 0x11;
586
587 float end = CharaMain.motion_type.motion_info[0x11].end;
588
589 if (time >= end - 1.0f && time <= end) {
590 if (lockOnTargetFlag != 0) {
591 BtActStatus.motion_no = 0x12;
592 }
593
594 BtActStatus.unk_028 = 0;
595 BtActStatus.motion_no = 0;
596 BtActStatus.action_on = 0;
597 BtActStatus.invincible_frames = 0;
598 BtActStatus.action_busy = 0;
599 BtActStatus.can_act = 1;
600 }
601 }
602}
603
604void UngagaKey_On() {
605 if (BtActStatus.special_cooldown > 0) {
606 return;
607 }
608
609 CUserStatus *status = UserStatus;
610
611 status->skill_owned[4] = 1;
612
613 if (BtActStatus.action_on == 0) {
614 sceVu0FVECTOR rotation;
615
616 BtActStatus.refill_frames = 0;
617 BtActStatus.action_no = 0x25;
618 BtActStatus.action_on = 1;
619 BtActStatus.action_step = 0;
620 BtActStatus.charge_time = 1.0f;
621 BtActStatus.charge_level = 0;
622 driveNoInterpolate = 1;
623 CharaMain.motion_type.state.time = 136.0f;
624 BtActStatus.combo_window = 0;
625 BtActStatus.combo_queued = 0;
626 BtActStatus.frames_since_attack = 0;
627 CharaMain.GetRotation(rotation);
628 BtActStatus.swing_heading = rotation[1];
629 } else {
630 if (BtActStatus.action_no == 0x25 && BtActStatus.combo_window != 0 && BtActStatus.action_gauge >= 40.0f) {
631 BtActStatus.combo_queued = 1;
632 BtActStatus.refill_frames = 0;
633 }
634
635 if (BtActStatus.action_no == 0x26 && BtActStatus.combo_window != 0 && BtActStatus.action_gauge >= 40.0f) {
636 BtActStatus.combo_queued = 1;
637 BtActStatus.refill_frames = 0;
638 }
639 }
640}
641
642void UngagaKey_Play() {
643 float time = CharaMain.motion_type.state.time;
644 sceVu0FVECTOR hit_left;
645 sceVu0FVECTOR hit_right;
646 sceVu0FVECTOR chara_pos;
647
648 getFramePos((CFrameVu1 *) NowWeapon->frame, "dcol0", hit_left);
649 getFramePos((CFrameVu1 *) NowWeapon->frame, "dcol1", hit_right);
650 sceVu0CopyVector(chara_pos, CharaMain.pos);
651
652 int element_se;
653
654 if (NowWeaponHave->best_elem < 5) {
655 element_se = NowWeaponHave->best_elem + 0x65;
656 }
657
658 int damage = NowWeaponHave->attack;
659
660 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
661 damage *= 2;
662 }
663
664 if (time >= 674 && time <= 677) {
665 NowColData->Set(hit_left, damage, 1, 6.0f, 0, 2, 2, 0, 0);
666 basic_damage(0, 4);
667 NowColData->SetKickBack(chara_pos, 1.2f, 0.1f, 2);
668 NowColData->Set(hit_right, damage, 1, 6.0f, 0.0f, 2, 2, 0, 0);
669 basic_damage(0, 4);
670 NowColData->SetKickBack(chara_pos, 1.2f, 0.1f, 2);
671 }
672
673 if (time >= 686 && time <= 692.0f) {
674 NowColData->Set(hit_left, damage, 1, 6.0f, 0.0f, 2, 2, 0, 0);
675 basic_damage(0, 4);
676 NowColData->SetKickBack(chara_pos, 1.5f, 0.1f, 2);
677 NowColData->Set(hit_right, damage, 1, 6.0f, 0.0f, 2, 2, 0, 0);
678 basic_damage(0, 4);
679 NowColData->SetKickBack(chara_pos, 1.5f, 0.1f, 2);
680 }
681
682 if (time >= 700.0f && time <= 704.0f) {
683 NowColData->Set(hit_left, damage, 1, 6.0f, 0.0f, 2, 2, 0, 0);
684 basic_damage(0, 4);
685 NowColData->SetKickBack(chara_pos, 2.0f, 0.1f, 2);
686 NowColData->Set(hit_right, damage, 1, 6.0f, 0.0f, 2, 2, 0, 0);
687 basic_damage(0, 4);
688 NowColData->SetKickBack(chara_pos, 2.0f, 0.1f, 2);
689 }
690
691 int swing_motions[3] = {0x25, 0x26, 0x27};
692
693 for (int i = 0; i < 3; i++) {
694 float swing_start = CharaMain.motion_type.motion_info[swing_motions[i]].start;
695 float swing_end = CharaMain.motion_type.motion_info[swing_motions[i]].end;
696
697 if (swing_start < time && swing_end > time) {
698 BtActStatus.swinging = 1;
699 }
700 }
701
702 if (time >= 674 && time <= 674.5f) {
703 CWeaponFx.Set(0x10, 16.0f, 64.0f);
704 }
705
706 if (time >= 686 && time <= 686.5f) {
707 CWeaponFx.Set(0x10, 16.0f, 64.0f);
708 }
709
710 if (time >= 699 && time <= 699.5f) {
711 CWeaponFx.Set(0x10, 16.0f, 64.0f);
712 }
713
714 sound_play(675, 675.3f, time, 0x1A4);
715 sound_play(687, 687.3f, time, 0x1A5);
716 sound_play(700.0f, 700.3f, time, 0x1A5);
717
718 sceVu0FVECTOR forward = {0.0f, 0.0f, 1.0f, 1.0f};
719 sceVu0FVECTOR rotation;
720 sceVu0FMATRIX matrix;
721
722 CharaMain.frame->GetRotation(rotation);
723 sceVu0UnitMatrix(matrix);
724 sceVu0RotMatrixY(matrix, matrix, rotation[1]);
725 sceVu0ApplyMatrix(BtActStatus.move_vector, matrix, forward);
726
727 if (BtActStatus.action_no == 0x25) {
728 if (GamePad.On(PadInput_OK) == 0) {
729 BtActStatus.action_step = 1;
730 }
731
732 BtActStatus.motion_no = 0x25;
733
734 float end = CharaMain.motion_type.motion_info[0x25].end;
735
736 BtActStatus.combo_window = 1;
737
738 if (time >= end - 1.0f && time <= end) {
739 if (BtActStatus.combo_queued == 1) {
740 BtActStatus.action_gauge -= 20.0f;
741
742 if (BtActStatus.action_gauge <= 0.0f) {
743 BtActStatus.action_gauge = 0.0f;
744 }
745
746 BtActStatus.action_no = 0x26;
747 BtActStatus.motion_no = 0x26;
748 driveNoInterpolate = 1;
749 BtActStatus.frames_since_attack = 0;
750 BtActStatus.combo_window = 0;
751 BtActStatus.combo_queued = 0;
752 BtActStatus.swing_heading = atan2f(BtActStatus.move_x, BtActStatus.move_z);
753 } else {
754 if (BtActStatus.action_step == 0) {
755 BtActStatus.motion_no = 13;
756 BtActStatus.action_no = 13;
757 driveNoInterpolate = 1;
758 return;
759 }
760
761 if (lockOnTargetFlag != 0) {
762 BtActStatus.motion_no = 0x12;
763 }
764
765 BtActStatus.unk_028 = 0;
766 BtActStatus.motion_no = 0;
767 BtActStatus.action_on = 0;
768 BtActStatus.move_power = 0.0f;
769 BtActStatus.move_power_decay = 0.0f;
770 BtActStatus.special_cooldown = 20;
771 }
772 }
773 }
774
775 if (BtActStatus.action_no == 0x26) {
776 if (time >= 679 && time <= 679.5f) {
777 BtActStatus.move_power = 0.25f;
778 BtActStatus.move_power_decay = 0.0f;
779 }
780
781 if (GamePad.On(PadInput_OK) == 0) {
782 BtActStatus.action_step = 1;
783 }
784
785 BtActStatus.motion_no = 0x26;
786
787 float end = CharaMain.motion_type.motion_info[0x26].end;
788
789 BtActStatus.combo_window = 1;
790
791 if (time >= end - 0.5f && time <= end) {
792 if (BtActStatus.combo_queued == 1) {
793 BtActStatus.action_gauge -= 20.0f;
794
795 if (BtActStatus.action_gauge <= 0.0f) {
796 BtActStatus.action_gauge = 0.0f;
797 }
798
799 BtActStatus.action_no = 0x27;
800 BtActStatus.motion_no = 0x27;
801 driveNoInterpolate = 1;
802 BtActStatus.frames_since_attack = 0;
803 BtActStatus.combo_window = 0;
804 BtActStatus.combo_queued = 0;
805 } else {
806 if (lockOnTargetFlag != 0) {
807 BtActStatus.motion_no = 0x12;
808 }
809
810 BtActStatus.unk_028 = 0;
811 BtActStatus.motion_no = 0;
812 BtActStatus.action_on = 0;
813 BtActStatus.move_power = 0.0f;
814 BtActStatus.move_power_decay = 0.0f;
815 }
816 }
817 }
818
819 if (BtActStatus.action_no == 0x27) {
820 if (time >= 699 && time <= 699.5f) {
821 BtActStatus.move_power = 0.0f;
822 BtActStatus.move_power_decay = 0.0f;
823 }
824
825 if (GamePad.On(PadInput_OK) == 0) {
826 BtActStatus.action_step = 1;
827 }
828
829 BtActStatus.motion_no = 0x27;
830
831 float end = CharaMain.motion_type.motion_info[0x27].end;
832
833 BtActStatus.combo_window = 1;
834
835 if (time >= end - 1.0f && time <= end) {
836 if (lockOnTargetFlag != 0) {
837 BtActStatus.motion_no = 0x12;
838 }
839
840 BtActStatus.unk_028 = 0;
841 BtActStatus.motion_no = 0;
842 BtActStatus.action_on = 0;
843 BtActStatus.move_power = 0.0f;
844 BtActStatus.move_power_decay = 0.0f;
845 }
846 }
847
848 if (BtActStatus.action_no == 13) {
849 if (GamePad.On(PadInput_OK) == 0) {
850 BtActStatus.action_step = 1;
851 }
852
853 BtActStatus.motion_no = 13;
854
855 if (BtActStatus.action_step != 0) {
856 BtActStatus.unk_028 = 0;
857 BtActStatus.motion_no = 0;
858 BtActStatus.action_on = 0;
859
860 if (lockOnTargetFlag != 0) {
861 BtActStatus.motion_no = 0x12;
862 }
863 }
864
865 float end = CharaMain.motion_type.motion_info[13].end;
866
867 if (time >= end - 2.0f && time <= end) {
868 BtActStatus.motion_no = 14;
869 BtActStatus.action_no = 14;
870 SndSePlay(SE_CHARA_SHOUT_3, -1, 0);
871 }
872 }
873
874 if (BtActStatus.action_no == 14) {
875 if (GamePad.On(PadInput_OK) == 0) {
876 BtActStatus.action_step = 1;
877 }
878
879 BtActStatus.motion_no = 14;
880
881 static int wait;
882 static s8 init;
883
884 if (init == 0) {
885 wait = 0;
886 init = 1;
887 }
888
889 wait++;
890
891 if (wait >= 30) {
892 sceVu0FVECTOR effect_pos;
893 sceVu0FVECTOR effect_vector;
894
895 SndSeSeqPlayStop(0x192, 30, 1);
896 wait = 0;
897 getFramePos((CFrameVu1 *) CharaMain.frame, "weapon", effect_pos);
898 getCharacterVector(effect_vector, 0.0f);
899 effect_vector[0] += effect_pos[0];
900 effect_vector[1] += effect_pos[1];
901 effect_vector[2] += effect_pos[2];
902 NowMainEffect->Set(effect_pos, effect_vector, 4, 2, 0, NULL, -1);
903 NowMainEffect->SetVsMonster(NowWeaponHave->vs_monster);
904 NowMainEffect->SetWepStatus(NowWeaponHave->flags);
905 NowMainEffect->SetAttribute(GetWeaponElementAttr(NowWeaponHave->best_elem));
906 NowMainEffect->SetDmg((int) (1.5f * (float) damage));
907 NowMainEffect->SetWait(45);
908 SwordDmgCheck1(0.8f, 0);
909 }
910
911 if (BtActStatus.action_step != 0) {
912 BtActStatus.motion_no = 0xF;
913 BtActStatus.action_no = 0xF;
914 }
915 }
916
917 if (BtActStatus.action_no == 0xF) {
918 BtActStatus.motion_no = 0xF;
919
920 float end = CharaMain.motion_type.motion_info[15].end;
921
922 if (time >= end - 2.0f && time <= end) {
923 BtActStatus.unk_028 = 0;
924 BtActStatus.motion_no = 0;
925 BtActStatus.action_on = 0;
926
927 if (lockOnTargetFlag != 0) {
928 BtActStatus.motion_no = 0x12;
929 }
930
931 NowMainEffect->EndEffect();
932 }
933 }
934}
935
936void GoroKey_On() {
937 if (BtActStatus.action_on == 0) {
938 if (BtActStatus.action_gauge >= 100.0f) {
939 sceVu0FVECTOR rotation;
940
941 BtActStatus.action_no = 0x24;
942 BtActStatus.action_on = 1;
943 BtActStatus.action_step = 0;
944 BtActStatus.charge_time = 1.0f;
945 BtActStatus.action_gauge = 0.0f;
946 BtActStatus.charge_level = 0;
947 driveNoInterpolate = 1;
948 CharaMain.motion_type.state.time = 136.0f;
949 BtActStatus.combo_window = 0;
950 BtActStatus.combo_queued = 0;
951 BtActStatus.frames_since_attack = 0;
952 CharaMain.GetRotation(rotation);
953 BtActStatus.swing_heading = rotation[1];
954 }
955
956 return;
957 }
958}
959
960void GoroKey_Play() {
961 float time = CharaMain.motion_type.state.time;
962 int damage = NowWeaponHave->attack;
963
964 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
965 damage *= 2;
966 }
967
968 int element_se = -1;
969
970 if (NowWeaponHave->best_elem < 5) {
971 element_se = NowWeaponHave->best_elem + 0x65;
972 }
973
974 if (element_se == 0x66) {
975 element_se = 0x66;
976 }
977
978 sceVu0FVECTOR shot_vector = {0.001f, 1.0f, 0.001f, 1.0f};
979 sceVu0FVECTOR hit_pos;
980 sceVu0FVECTOR chara_pos;
981
982 getFramePos((CFrameVu1 *) NowWeapon->frame, "dcol0", hit_pos);
983 sceVu0CopyVector(chara_pos, CharaMain.pos);
984
985 if (time >= 99.0f && time <= 102.0f) {
986 NowColData->Set(hit_pos, damage, 1, 5.0f, 0.0f, 2, 2, 0, 0);
987 basic_damage(0, 2);
988 NowColData->SetKickBack(chara_pos, 2.5f, 0.1f, 2);
989 }
990
991 if (time >= 462.0f && time <= 482.0f) {
992 damage *= 1.5;
993 NowColData->Set(hit_pos, damage, 1, 5.0f, 0.0f, 2, 2, 0, 0);
994
995 NowColData->hit[NowColData->now_hit].vs_monster = NowWeaponHave->vs_monster;
996 NowColData->hit[NowColData->now_hit].weapon_flags = NowWeaponHave->flags;
997
998 s8 elem = NowWeaponHave->best_elem;
999 CCollisionData *attr_col = NowColData;
1000
1001 attr_col->hit[attr_col->now_hit].flags = GetWeaponElementAttr(elem);
1002
1003 CCollisionData *owner_col = NowColData;
1004
1005 owner_col->hit[owner_col->now_hit].owner = 2;
1006 owner_col->hit[owner_col->now_hit].attack_no = 1;
1007 }
1008
1009 if (time >= 482.0f && time < 482.4f) {
1010 NowMainEffect->Set(hit_pos, shot_vector, 2, -1, 0, NULL, -1);
1011 NowMainEffect->SetWepStatus(NowWeaponHave->flags);
1012 NowMainEffect->SetVsMonster(NowWeaponHave->vs_monster);
1013 NowMainEffect->SetDmg((int) (1.2f * (float) damage));
1014 NowMainEffect->SetWait(45);
1015 NowMainEffect->SetAttribute(GetWeaponElementAttr(NowWeaponHave->best_elem));
1016 NowColData->SetKickBack(chara_pos, 2.5f, 0.1f, 2);
1017 BtActStatus.camera_shake = 8.0f;
1018 BtActStatus.camera_shake_decay = 0.1f;
1019 BtActStatus.camera_shake_frames = 30;
1020 }
1021
1022 if (time >= 103.0f && time < 103.4f) {
1023 BtActStatus.camera_shake = 2.0f;
1024 BtActStatus.camera_shake_decay = 0.01f;
1025 BtActStatus.camera_shake_frames = 20;
1026 }
1027
1028 if (time >= 98.0f && time < 98.3f) {
1029 SndSePlay(SE_CHARA_SHOUT, -1, 0);
1030 }
1031
1032 if (time >= 471 && time < 471.4f) {
1033 SndSePlay(SE_CHARA_SHOUT_2, -1, 0);
1034 }
1035
1036 if (time >= 471 && time < 471.4f) {
1037 SndSePlay(SE_CHARA_ACTION_3, -1, 0);
1038 }
1039
1040 if (time >= 478.0f && time < 478.4f) {
1041 SndSePlay(SE_CHARA_ACTION_3, -1, 0);
1042 }
1043
1044 if (time >= 481 && time < 481.4f) {
1045 SndSePlay(SE_CHARA_ACTION_4, -1, 0);
1046 }
1047
1048 sceVu0FVECTOR forward = {0.0f, 0.0f, 1.0f, 1.0f};
1049 sceVu0FVECTOR rotation;
1050 sceVu0FMATRIX matrix;
1051
1052 CharaMain.frame->GetRotation(rotation);
1053 sceVu0UnitMatrix(matrix);
1054 sceVu0RotMatrixY(matrix, matrix, rotation[1]);
1055 sceVu0ApplyMatrix(BtActStatus.move_vector, matrix, forward);
1056
1057 if (BtActStatus.action_no == 0x24) {
1058 if (time >= 94.5f && time <= 95.0f) {
1059 BtActStatus.move_power = 0.25f;
1060 BtActStatus.move_power_decay = 0.01f;
1061 }
1062
1063 BtActStatus.motion_no = 0x24;
1064
1065 if (GamePad.On(PadInput_OK) == 0) {
1066 BtActStatus.action_step = 1;
1067 }
1068
1069 float end = CharaMain.motion_type.motion_info[36].end;
1070
1071 BtActStatus.combo_window = 1;
1072
1073 if (time >= 95.0f && time <= 95.5f && BtActStatus.action_step == 0) {
1074 BtActStatus.action_step = 0;
1075 BtActStatus.motion_no = 13;
1076 BtActStatus.action_no = 13;
1077 BtActStatus.move_power = 0.0f;
1078 BtActStatus.move_power_decay = 0.0f;
1079 return;
1080 }
1081
1082 if (time >= end - 1.0f && time <= end) {
1083 if (lockOnTargetFlag != 0) {
1084 BtActStatus.motion_no = 0x12;
1085 }
1086
1087 BtActStatus.unk_028 = 0;
1088 BtActStatus.motion_no = 0;
1089 BtActStatus.action_on = 0;
1090 BtActStatus.move_power = 0.0f;
1091 BtActStatus.move_power_decay = 0.0f;
1092 BtActStatus.combo_window = 0;
1093 BtActStatus.combo_queued = 0;
1094 }
1095 }
1096
1097 if (BtActStatus.action_no == 13) {
1098 BtActStatus.action_step++;
1099
1100 if (BtActStatus.action_step >= 45) {
1101 if (BtActStatus.action_step == 45) {
1102 setUnitAmbientAnime(15.0f, 1.0f, 0.0f, 122.0f, 208.0f);
1103 }
1104
1105 BtActStatus.action_step = 46;
1106 }
1107
1108 BtActStatus.motion_no = 13;
1109
1110 if (GamePad.On(PadInput_OK) == 0) {
1111 if (BtActStatus.action_step < 45) {
1112 sceVu0FVECTOR restart_rotation;
1113
1114 BtActStatus.action_on = 1;
1115 BtActStatus.action_step = 0;
1116 BtActStatus.charge_time = 1.0f;
1117 BtActStatus.action_gauge -= 15.0f;
1118 BtActStatus.charge_level = 0;
1119 BtActStatus.combo_window = 0;
1120 BtActStatus.combo_queued = 0;
1121 BtActStatus.frames_since_attack = 0;
1122 CharaMain.GetRotation(restart_rotation);
1123 BtActStatus.swing_heading = restart_rotation[1];
1124 BtActStatus.action_no = 0x24;
1125 } else {
1126 BtActStatus.action_no = 14;
1127 BtActStatus.action_gauge = 0.0f;
1128 BtActStatus.invincible_frames = 1;
1129 BtActStatus.action_busy = 1;
1130 BtActStatus.can_act = 0;
1131 BtActStatus.invincible_frames = 0x3E7;
1132 SwordDmgCheck1(2.0f, 0);
1133 SndSePlay(SE_GORO_SMASH, -1, 0);
1134 }
1135 }
1136 }
1137
1138 if (BtActStatus.action_no == 14) {
1139 BtActStatus.motion_no = 14;
1140
1141 float end = CharaMain.motion_type.motion_info[14].end;
1142
1143 if (time >= end - 1.0f && time <= end) {
1144 BtActStatus.unk_028 = 0;
1145 BtActStatus.motion_no = 0;
1146 BtActStatus.action_on = 0;
1147 BtActStatus.invincible_frames = 0;
1148 BtActStatus.action_busy = 0;
1149 BtActStatus.invincible_frames = 0;
1150 BtActStatus.can_act = 1;
1151
1152 if (lockOnTargetFlag != 0) {
1153 BtActStatus.motion_no = 0x12;
1154 }
1155 }
1156 }
1157}
CFrame * frame
tagMOTION_TYPE motion_type
int Set(float *position, int damage, int life, float radius, float scale_rate, int target_mask, int kind, int flags, int attribute)
COLLISION_HIT hit[96]
void SetKickBack(float *origin, float speed, float decay, int mode)
int On(int mask)
Definition gamepad.cpp:557
virtual void GetRotation(float *out_rotation)
Definition object.cpp:116
float pos[4]
Definition object.hpp:18
void SetVsMonster(char *effectiveness)
void SetWepStatus(int status)
void SetDmg(int damage)
void SetWait(int wait)
void SetAttribute(int attribute)
int Set(float *position, float *target, int owner, int sub_id, int source, CFrame *parent, int initial_phase)
s32 skill_owned[6]
void Set(int hold, float fade, float fade_out)
float jump_velocity_z
float move_power_decay
float jump_velocity_y
sceVu0FVECTOR move_vector
float jump_velocity_x
float camera_shake_decay
char vs_monster[10]
Definition itemdata.hpp:699
MOTION_INFO * motion_info
Definition gameutil.hpp:275
MOTION_STATE state
Definition gameutil.hpp:273