Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
menu.c
Go to the documentation of this file.
1/* The battle menu: its task, the states that run the turn's events (the
2 player's commands, the battle's end, recoveries, damage and statuses, the
3 blast, knock-outs and the last enemy), its main state and WFIGHTMN's entry
4 point. The states stay in one module: a cut between them moves a jump
5 table off its 8-byte place. */
6
8
9/* Sets the battle's kind from the mode it came from and the battle: the
10 escape, UNK2, no-damage and final battles, or a normal one */
11static inline void setBattleKind(void) {
12 s32 mode;
13
14 mode = GAME.funcs.getPrevMode();
15 if (mode == 0x22D && BATTLE_SETUP.battle == 0x143) {
17 } else if (mode == 0x23A && BATTLE_SETUP.battle == 0xB) {
19 } else if (mode == 0x272 && BATTLE_SETUP.battle == 0x1E) {
21 } else if (BATTLE_SETUP.battle == 0x144) {
26 } else {
28 }
29}
30
31/* Adds the partner's Digimon (its battle digivolution, but not after an
32 ambush) and the enemy, the partner weak when its HP is low */
33static inline void addFighters(BattleMenu *task, BattleMenuChildren *children) {
34 s16 slots[4];
35 s32 digimon;
36 s32 partner;
37 BattleFighter *unit;
38
39 partner = GAME.funcs.getPartyMember(0);
40 if (WFIGHTMN_rollAmbush() != 0) {
41 digimon = DIGIMON_DATA[partner].id;
42 task->counter = 1;
43 } else if (GAME.funcs.getPartnerSlots(partner, slots) > 0 && GAME.partners[partner].battleDigivolve != 0) {
44 digimon = GAME.partners[partner].battleDigivolve;
45 } else {
46 digimon = DIGIMON_DATA[partner].id;
47 }
48 children->models->add(children->models, 0, digimon, 1);
49 children->models->face(children->models, 0);
50 children->models->add(children->models, 0x10, BATTLE_SETUP.enemies[0].fighter, 1);
51 children->models->face(children->models, 0x10);
52 WFIGHTMN_initFighters(digimon);
54 if (unit->maxHp / 4 >= unit->hp) {
55 children->models->setIdleMotion(children->models, 0, 1);
56 }
57}
58
59/* Queues the first turns: the enemy's first after an ambush, with its
60 message, or by a roll on the fighters' speeds */
61static inline void queueFirstTurns(BattleMenu *task, BattleMenuChildren *children) {
62 BattleStats *stats;
63 s32 chance;
64
65 if (task->counter != 0) {
69 task->args[0] = 7;
70 children->task.message->show(children->task.message, 1, task->args);
71 task->step++;
73 } else {
76 if (RANDOM.next() % 128 < chance) {
80 } else {
83 }
84 task->nextState(task);
85 }
86}
87
88/* Plays MUSIC_CONFUSION once a partner is confused, and the battle's music
89 again once none is */
90static inline void switchConfusionMusic(BattleMenu *task) {
91 BattleFighter *units;
92 s32 found;
93 s32 i;
94
96 if (task->confusionSound == 0) {
97 for (i = 0; i < 3; i++) {
98 if (units[i].flags & FIGHTER_CONFUSED) {
100 task->confusionSound = 1;
101 break;
102 }
103 }
104 } else {
105 found = 0;
106 for (i = 0; i < 3; i++) {
107 if (units[i].flags & FIGHTER_CONFUSED) {
108 found = 1;
109 break;
110 }
111 }
112 if (!found) {
114 task->confusionSound = 0;
115 }
116 }
117}
118
119/* The battle menu's task: sets up the battle (its music, FIGHTSTG's tasks,
120 setBattleKind, the fighters' models in addFighters and queueFirstTurns),
121 then runs the menu (WFIGHTMN_runTurn), playing MUSIC_CONFUSION once a
122 partner is confused and the battle's music again after
123 (switchConfusionMusic) */
125 switch (task->state) {
126 case 0:
127 default:
128 switch (task->substate) {
129 case 0:
130 default:
132 task->nextSubstate(task);
133 /* fallthrough */
134 case 1:
135 switch (task->step) {
136 case 0:
137 default:
138 SOUND.loadBank((BATTLE_SETUP.music >> 18) & 0x7F);
139 task->nextStep(task);
140 /* fallthrough */
141 case 1:
142 if (SOUND.isLoading() == 0) {
144 task->nextSubstate(task);
145 }
146 break;
147 }
148 break;
149 case 2:
150 switch (task->step) {
151 case 0:
152 default:
156 children->models = FIGHTSTG_createModels();
158 task->nextStep(task);
159 break;
160 case 1:
162 addFighters(task, children);
163#if VERSION_EU || VERSION_JP
164 GFX.frameTime = 1;
166#else
167 children->camera->set(children->camera, children->camera->getEnemyView(children->camera));
168#endif
169 task->step++;
170 break;
171 case 2:
172#if VERSION_EU || VERSION_JP
173 GFX.frameTime = 1;
174#endif
175 children->loader = WFIGHTMN_createLoader();
176 task->step++;
177 break;
178 case 3:
179 if (children->loader == NULL) {
180 task->step++;
181 }
182 break;
183 case 4:
185 task->step++;
186 break;
187 case 5:
188 queueFirstTurns(task, children);
190 break;
191 case 6:
192 if (children->task.task == NULL) {
193 task->nextState(task);
194 }
195 break;
196 }
197 break;
198 }
199 break;
200 case 1:
201 WFIGHTMN_runTurn(task);
203 break;
204 case 2:
205 case 3:
206 break;
207 }
208}
209
210/* Ends the current partner's temporary Digimon and the actions that go with it */
215
216 if (unit->temporary != 0) {
217 if (index >= 0) {
218 FIGHTSTG_events.events[index].type = 0;
219 }
220 BATTLE_SETUP.gauges[member] = 0;
221 unit->temporary = 0;
223 if (index >= 0) {
224 FIGHTSTG_events.events[index].type = 0;
225 }
226 }
227}
228
229/* The player's turn (EVENT_PLAYER_TURN): drops the partner's queued technique
230 and running away, then loses the turn to FIGHTER_PARALYZED, goes on to
231 WFIGHTMN_runConfusedCommand when FIGHTER_CONFUSED, or lets the player pick
232 a command and starts the state or the task that runs it */
234 BattleFighter *unit;
235 s32 index;
236
237 switch (task->step) {
238 case 0:
239 default:
241 if (index >= 0) {
242 FIGHTSTG_events.events[index].type = 0;
243 }
245 if (index >= 0) {
246 children->task.message = FIGHTSTG_createMessage();
247 task->args[0] = 0x42;
248 task->args[1] = 0;
249 children->task.message->show(children->task.message, 2, task->args);
250 FIGHTSTG_events.events[index].type = 0;
251 }
252 task->step++;
253 break;
254 case 1:
255 if (children->task.task == NULL) {
258 children->task.message = FIGHTSTG_createMessage();
259 task->args[0] = 0x56;
260 task->args[1] = 0;
261 children->task.message->show(children->task.message, 2, task->args);
263 task->setSubstate(task, 2);
264 } else if (unit->flags & FIGHTER_CONFUSED) {
265 task->setSubstate(task, 0x11);
266 } else {
268 task->step = 2;
269 }
270 }
271 break;
272 case 2:
273 if (FIGHTSTG_isPlayerChoosing() == 0) {
274 switch (children->commands->action) {
275 case 1:
278 children->task.message = FIGHTSTG_createMessage();
279 task->args[0] = 0x41;
280 task->args[1] = 0;
281 children->task.message->show(children->task.message, 2, task->args);
282 task->setSubstate(task, 2);
284 break;
285 case 0:
286 children->task.attack = FIGHTSTG_startFirstTech(0);
287 task->setSubstate(task, 2);
288 break;
289 case 4:
290 children->task.tech = FIGHTSTG_startTechAction(0, children->commands->arg);
291 task->setSubstate(task, 2);
292 break;
293 case 2:
294 task->setSubstate(task, 4);
296 break;
297 case 5:
298 task->setSubstate(task, 5);
300 break;
301 case 6:
302 task->setSubstate(task, 6);
303 break;
304 case 3:
305 children->task.item = FIGHTSTG_startItem(children->commands->arg);
306 task->setSubstate(task, 2);
307 break;
308 default:
309 task->substate = -1;
310 break;
311 }
313 }
314 break;
315 }
316}
317
318/* The state that changes the current partner's Digimon to the one picked
319 (commands->digimon), then says so */
321 BattleFighter *unit;
322 DigimonData *digimon;
323
324 switch (task->step) {
325 case 0:
326 default:
328 unit->id = children->commands->digimon;
331 children->task.change = FIGHTSTG_startDigimonChange(unit->id, 0);
332 task->step++;
333 break;
334 case 1:
335 if (children->task.task == NULL) {
336 digimon = GET_DIGIMON(ACTIVE_FIGHTER(0)->id);
337 children->task.message = FIGHTSTG_createMessage();
338 task->args[0] = 0;
339 task->args[1] = digimon->nameId;
340 children->task.message->show(children->task.message, 0xC, task->args);
341 task->setSubstate(task, 2);
342 }
343 break;
344 }
345}
346
347/* Swaps the partner on the field for the one picked (children->commands):
348 message 0x38, then the swap effect with current[0] set to the new partner's
349 slot for it, then the switch itself and message 0x39 */
351 s32 member;
352 s32 slot;
353 s32 newSlot;
354 s32 i;
355 BattleFighter *unit;
356
357 switch (task->step) {
358 case 0:
359 default:
360 children->task.message = FIGHTSTG_createMessage();
361 task->args[0] = 0x38;
362 task->args[1] = 0;
363 children->task.message->show(children->task.message, 2, task->args);
364 task->step++;
365 break;
366 case 1:
367 if (children->task.task == NULL) {
368 /* the match depends on setting i here, before the call, which
369 gives i and slot their registers */
370 i = 0;
371 slot = -1;
372 member = GAME.funcs.getPartyMember(children->commands->arg);
373 for (; i < 3; i++) {
374 if (GAME.funcs.getPartyMember(i) == member) {
375 slot = i;
376 break;
377 }
378 }
379 task->args[0] = slot;
380 task->args[1] = FIGHTSTG_battle.state.active[0];
381 FIGHTSTG_battle.state.active[0] = task->args[0];
383 FIGHTSTG_battle.state.active[0] = task->args[1];
384 task->step++;
385 }
386 break;
387 case 2:
388 if (children->task.entrance->done != 0) {
389 newSlot = task->args[0];
390 unit = ACTIVE_FIGHTER(0);
391 if (unit->special != 0) {
392 unit->special = 0;
393#if VERSION_US
394 /* FIGHTSTG_queueSpecialEnd's event, built in the arguments */
395 task->args[0] = EVENT_SPECIAL_END;
396 task->args[1] = 1;
397 task->args[2] = 0;
398 task->args[3] = FIGHTSTG_battle.state.active[0];
400#elif VERSION_EU || VERSION_JP
402#endif
403 }
405 FIGHTSTG_battle.state.active[0] = newSlot;
406 unit = FIGHTSTG_battle.state.fighters[0] + newSlot;
407 unit->id = children->commands->digimon;
409 task->step++;
410 }
411 break;
412 case 3:
413 if (children->task.task == NULL) {
414 children->task.message = FIGHTSTG_createMessage();
415 task->args[0] = 0x39;
416 task->args[1] = 0;
417 children->task.message->show(children->task.message, 2, task->args);
418 task->setSubstate(task, 2);
419 }
420 break;
421 }
422}
423
424/* State 6, the pair technique (the player turn's action 6): the outgoing
425 and incoming partners do commands->pairTech, then the incoming one tags in
426 (state 5, past its message) while an enemy is left; otherwise the turn ends
427 with the partner marked as fought */
429 s32 i;
430 BattleFighter *unit;
431
432 switch (task->step) {
433 case 0:
434 default:
435 children->task.tech = FIGHTSTG_startTechAction(0, children->commands->pairTech);
436 task->step++;
437 break;
438 case 1:
439 if (children->task.task == NULL) {
440 for (i = 0, unit = FIGHTSTG_battle.state.fighters[1]; i < 3; i++, unit++) {
441 if (unit->id != 0 && unit->hp != 0) {
442 task->setSubstate(task, 5);
443 task->step = 1;
444 return;
445 }
446 }
447 WFIGHTMN_markPicked(task, children);
448 task->setSubstate(task, 0);
449 }
450 break;
451 }
452}
453
454/* After a won battle, picks the enemy whose item the player may get; saves the
455 partners' HP and MP, fades out and requests the next mode */
457 Battle *battle;
458 BattleFighter *units;
459 BattleFighter *unit;
460 BattleTableEntry *info;
461 ScreenFade *end;
462 Layer *layer;
463 s32 count;
464 s32 pick;
465 s32 i;
466 s32 partner;
467 s32 member;
468 s32 mode;
469
470 switch (task->step) {
471 case 0:
472 default:
473#if VERSION_EU || VERSION_JP
474 if (children->cameraMove.task != NULL && children->cameraMove.task->state != TASK_DONE) {
475 break;
476 }
477#endif
479 count = 0;
480 battle = &FIGHTSTG_battle;
481 units = battle->state.fighters[1];
483 BATTLE_RESULT.member = battle->state.active[0];
484 for (i = 0; i < 3; i++) {
485 if (units[i].id != 0 && units[i].item != 0) {
486 count++;
487 }
488 }
489 pick = RANDOM.next() % count;
490 count = 0;
491 for (i = 0; i < 3; i++) {
492 if (units[i].id != 0 && units[i].item != 0) {
493 if (pick == count) {
494 break;
495 }
496 count++;
497 }
498 }
499 /* an address sum with the offset first: the match depends on it, which
500 puts the offset first in the addu */
501 unit = (BattleFighter *)(count * sizeof(BattleFighter) + (s32)units);
502 info = FIGHTSTG_battleTableFunc(unit->id);
503 if (unit->item > 0 && info->itemChance + 1 > RANDOM.next() % 1024) {
504 BATTLE_RESULT.item = unit->item;
505 } else {
507 }
508 if (BATTLE_SETUP.hasPrize == 1) {
510 }
511 }
512 for (member = 0; member < 3; member++) {
513 partner = GAME.funcs.getPartyMember(member);
514 if (partner >= 0) {
515 if ((FIGHTSTG_battle.state.fighters[0] + member)->hp <= 0) {
516 GAME.partners[partner].info.stats[STAT_HP] = 1;
517 BATTLE_RESULT.partners[member].fought = 0;
518 BATTLE_RESULT.partners[member].used[0] = 0;
519 BATTLE_RESULT.partners[member].used[1] = 0;
520 BATTLE_RESULT.partners[member].used[2] = 0;
521 } else {
522 GAME.partners[partner].info.stats[STAT_HP] = (FIGHTSTG_battle.state.fighters[0] + member)->hp;
523 }
524 GAME.partners[partner].info.stats[STAT_MP] = (FIGHTSTG_battle.state.fighters[0] + member)->mp;
525 }
526 }
527 end = FIGHTSTG_createFader();
528 children->task.fade = end;
529 end->start(end, 0, 10);
530 task->step++;
531 break;
532 case 1:
533 if (children->task.task->state == TASK_DONE) {
535 layer->setBgColor(layer, 0, 0, 0);
536#if VERSION_EU || VERSION_JP
537 if (children->cameraMove.task != NULL) {
538 children->cameraMove.task->setState(children->cameraMove.task, TASK_KILL);
539 }
540#endif
541 task->step++;
542 }
543 break;
544 case 2:
546 switch (FIGHTSTG_events.funcs.result) {
547 case BATTLE_FLED:
548 default:
550 break;
551 case BATTLE_WON:
552 mode = MODE_ENDING;
554 mode = MODE_BATTLE_REPORT;
555 }
556 GAME.funcs.requestMode(mode, 0);
557 break;
558 case BATTLE_LOST:
560 break;
561 }
562 break;
563 }
564}
565
566/* Asks FIGHTSTG (FIGHTSTG_battleFuncs.testRunAway) whether the current action's actor gets away; if
567 so shows message 0x43 (a partner) or 0x5F (an enemy) and waits for the
568 window to close, otherwise sets the event's time from getDelay */
570 QueuedEvent *action;
571
572 switch (task->counter) {
573 case 0:
574 default:
576 if (FIGHTSTG_battleFuncs.testRunAway(action->args[0]) != 0) {
577 task->counter = 1;
578 action->type = 0;
579 children->task.message = FIGHTSTG_createMessage();
580 /* the match depends on args[1] being set in both branches: set once
581 after them, task swaps saved registers with a global's address */
582 if (action->args[0] == 0) {
583 task->args[0] = 0x43;
584 task->args[1] = action->args[0];
585 } else {
586 task->args[0] = 0x5F;
587 task->args[1] = action->args[0];
588 }
589 children->task.message->show(children->task.message, 2, task->args);
590 } else {
591 action->time = FIGHTSTG_events.funcs.getDelay(action->args[0], 1);
592 task->setSubstate(task, 0);
593 }
594 break;
595 case 1:
596 if (children->task.task == NULL) {
598 task->setSubstate(task, 0);
599 }
600 break;
601 }
602}
603
604/* Removes the current action's EVENT_RECOVERY event, unless the partner it is for
605 has WFIGHTMN_RECOVERY_ITEM equipped */
608 s32 index = FIGHTSTG_events.funcs.find(EVENT_RECOVERY, action->args[0], action->args[1]);
609 QueuedEvent *found;
610 PartnerStats *stats;
611
612 if (index >= 0) {
613 found = &FIGHTSTG_events.events[index];
614 children->task.message = FIGHTSTG_createMessage();
615 task->args[0] = 0x5A;
616 task->args[1] = action->args[0];
617 task->args[2] = action->args[1];
618 children->task.message->show(children->task.message, 7, task->args);
619 if (found->args[0] == 0) {
621 if (stats->equip[4] == WFIGHTMN_RECOVERY_ITEM || stats->equip[5] == WFIGHTMN_RECOVERY_ITEM) {
622 found->type = EVENT_RECOVERY;
623 found->args[2] = 0;
624 } else {
625 found->type = 0;
626 }
627 } else {
628 found->type = 0;
629 }
630 }
631 task->setSubstate(task, 2);
632}
633
634/* A fighter's recovery (EVENT_RECOVERY): unless its HP is full, plays
635 technique 0xBD on it when it is the side's active fighter, shows message
636 0xA with the amount and adds it, up to the maximum */
639 s32 side = action->args[0] >> 4;
640 BattleFighter *unit = &FIGHTSTG_battle.state.fighters[side][action->args[1]];
641
642 switch (task->step) {
643 case 0:
644 default:
645 action->time = 1000;
646 task->counter = FIGHTSTG_battleFuncs.getHeal(action->args[0], action->args[1], action->args[2]);
647 if (unit->hp < unit->maxHp) {
648 if (action->args[1] == FIGHTSTG_battle.state.active[side]) {
649 children->task.script = WFIGHTMN_startTech(action->args[0], 0xBD);
650 WFIGHTMN_setIdleMotion(action->args[0], -task->counter);
651 }
652 task->step++;
653 } else {
654 task->setSubstate(task, 0);
655 }
656 break;
657 case 1:
658 if (children->task.task == NULL) {
659 children->task.message = FIGHTSTG_createMessage();
660 task->args[0] = action->args[0];
661 task->args[1] = action->args[1];
662 task->args[2] = task->counter;
663 children->task.message->show(children->task.message, 0xA, task->args);
664 task->step++;
665 }
666 break;
667 case 2:
668 if (children->task.task == NULL) {
669 unit->hp += task->counter;
670 if (unit->hp > unit->maxHp) {
671 unit->hp = unit->maxHp;
672 }
673 task->setSubstate(task, 0);
674 }
675 break;
676 }
677}
678
679/* EVENT_CLEAR_FIELD: shows message 0x6A and ends the element boost
680 (FIGHTSTG_battle.state.boost.element) */
682 children->task.message = FIGHTSTG_createMessage();
683 task->args[0] = 0x6A;
684 children->task.message->show(children->task.message, 1, task->args);
687 task->setSubstate(task, 2);
688}
689
690/* Carries out the current action's damage (FIGHTSTG_battleFuncs.getDamage) on
691 its unit */
693 QueuedEvent *action;
694 BattleFighter *unit;
695 BattleFighter *hit;
696 s32 side;
697 s32 damage;
698
699 switch (task->step) {
700 case 0:
701 default:
703 side = action->args[0] >> 4;
704 task->args[0] = action->args[0];
705 task->args[1] = action->args[1];
706 damage = FIGHTSTG_battleFuncs.getDamage(&action->args[0]);
707 task->args[2] = damage;
708 if (action->args[1] == FIGHTSTG_battle.state.active[side]) {
709 unit = &FIGHTSTG_battle.state.fighters[side][action->args[1]];
710 if (action->args[0] == 0) {
711 children->task.hitEffect = FIGHTSTG_startHitEffect(unit->hp - damage <= 0 ? 2 : 1, 1, damage);
712 } else {
714 children->task.script->enemy = 0;
715 children->task.script->index = 0xE;
716 children->task.script->effect = 0x13;
717 children->task.script->sound = 0x1A;
718 children->task.script->stage = -1;
719 if (unit->hp - task->args[2] <= 0) {
720 children->task.script->hits[3] = 2;
721 } else {
722 children->task.script->hits[3] = 1;
723 }
724 }
725 WFIGHTMN_setIdleMotion(action->args[0], task->args[2]);
726 task->step++;
727 } else {
728 task->setSubstate(task, 0);
729 }
730 action->time = 1000;
731 break;
732 case 1:
733 if (children->task.task == NULL) {
734 hit = &FIGHTSTG_battle.state.fighters[task->args[0] >> 4][task->args[1]];
735 hit->hp -= task->args[2];
736 if (hit->hp <= 0) {
737 hit->hp = 0;
739 }
740 children->task.message = FIGHTSTG_createMessage();
741 children->task.message->show(children->task.message, 0xF, task->args);
742 task->step++;
743 }
744 break;
745 case 2:
746 if (children->task.task == NULL) {
747 task->setSubstate(task, 0);
748 }
749 break;
750 }
751}
752
753/* States 13-15: end the current action's unit's paralysis, confusion or sleep */
756 BattleFighter *unit;
757
758 switch (task->step) {
759 case 0:
760 default:
761 task->args[0] = task->substate + 0x1C;
762 task->args[1] = action->args[0];
763 task->args[2] = action->args[1];
764 children->task.message = FIGHTSTG_createMessage();
765 children->task.message->show(children->task.message, 7, task->args);
766 task->step++;
767 break;
768 case 1:
769 if (children->task.task == NULL) {
770 unit = &FIGHTSTG_battle.state.fighters[action->args[0] != 0][action->args[1]];
771 switch (task->substate) {
772 case 13:
773 default:
774 unit->flags &= ~FIGHTER_PARALYZED;
775 break;
776 case 14:
777 unit->flags &= ~FIGHTER_CONFUSED;
778 break;
779 case 15:
780 unit->flags &= ~FIGHTER_ASLEEP;
781 break;
782 }
783 task->setSubstate(task, 0);
784 }
785 break;
786 }
787}
788
789/* Clears the boost (BattleFighter.boosts) that the current action ends */
792 BattleFighter *unit;
793
794 switch (task->step) {
795 case 0:
796 default:
797 children->task.message = FIGHTSTG_createMessage();
798 task->args[0] = action->args[2] + 0x5B;
799 task->args[1] = action->args[0];
800 task->args[2] = action->args[1];
801 children->task.message->show(children->task.message, 7, task->args);
802 task->step++;
803 break;
804 case 1:
805 if (children->task.task == NULL) {
806 unit = &FIGHTSTG_battle.state.fighters[action->args[0] >> 4][action->args[1]];
807 unit->boosts[action->args[2]] = 0;
808 task->setSubstate(task, 0);
809 }
810 break;
811 }
812}
813
814/* A confused partner's turn (FIGHTER_CONFUSED): the player's turn at step 3,
815 where only an attack does anything */
817 switch (task->step) {
818 case 0:
819 default:
821 task->step++;
822 break;
823 case 1:
824 if (FIGHTSTG_isPlayerChoosing() == 0) {
825 if (children->commands->action == 0) {
826 children->task.attack = FIGHTSTG_startFirstTech(0);
827 task->setSubstate(task, 2);
828 } else {
829 task->setSubstate(task, 0);
830 }
832 }
833 break;
834 }
835}
836
837/* Clears the restriction that the current action ends (FIGHTER_NO_SWITCH or
838 FIGHTER_NO_DIGIVOLVE) from its unit */
841 BattleFighter *unit;
842
843 switch (task->step) {
844 case 0:
845 default:
846 children->task.message = FIGHTSTG_createMessage();
847 task->args[0] = action->args[2] + 0x57;
848 task->args[1] = action->args[0];
849 task->args[2] = action->args[1];
850 children->task.message->show(children->task.message, 7, task->args);
851 task->step++;
852 break;
853 case 1:
854 if (children->task.task == NULL) {
855 unit = &FIGHTSTG_battle.state.fighters[action->args[0] >> 4][action->args[1]];
856 unit->flags &= ~(1 << (action->args[2] + 4));
857 task->setSubstate(task, 0);
858 }
859 break;
860 }
861}
862
863/* Digivolves the current partner for the battle, to the Digimon its level
864 reaches (DigimonData.blastForms), and heals it when the change ends */
866 Models *models;
867 BattleFighter *unit;
868 DigimonData *digimon;
869 s32 partner;
870 s32 level;
871 s32 tier;
872#if VERSION_EU || VERSION_JP
873 s32 index;
874#endif
875
876 switch (task->step) {
877 case 0:
878 default:
879 children->task.message = FIGHTSTG_createMessage();
880 task->args[0] = 0x61;
881 task->args[1] = 0;
882 children->task.message->show(children->task.message, 2, task->args);
883 task->step++;
884 break;
885 case 1:
886 if (children->task.task == NULL) {
888 level = GAME.funcs.getPartnerStats(partner)->stats[STAT_LEVEL];
889 if (level < 4) {
890 tier = 0;
891 } else if (level < 19) {
892 tier = 1;
893 } else if (level < 39) {
894 tier = 2;
895 } else if (level < 70) {
896 tier = 3;
897 } else {
898 tier = 4;
899 }
901 digimon = GET_DIGIMON(DIGIMON_DATA[partner].id);
902 unit->prevId = unit->id;
903 unit->id = DIGIMON_DATA[digimon->blastForms[tier] - 1].id;
904 unit->temporary = 1;
905 FIGHTSTG_queueBlastEnd(partner);
906 children->task.change = FIGHTSTG_startDigimonChange(unit->id, 1);
907 task->step++;
908 }
909 break;
910 case 2:
911 models = TASK_REGISTRY.funcs.find(BATTLE_TASK_MODELS, -1, -1);
912 if (models->get(models, 0)->motion == 13) {
914 current->hp = current->maxHp;
915#if VERSION_EU || VERSION_JP
916 if (current->flags & FIGHTER_CONFUSED) {
918 if (index >= 0) {
919 FIGHTSTG_events.events[index].type = 0;
920 FIGHTSTG_events.events[index].time = 0;
921 }
922 current->flags &= ~FIGHTER_CONFUSED;
923 task->confusionSound = 0;
924 }
925#endif
926 task->setSubstate(task, 2);
927 }
928 break;
929 }
930}
931
932/* Turns the current partner back into the Digimon it was (prevId) */
934 BattleFighter *unit;
935
936 switch (task->step) {
937 case 0:
938 default:
940 unit->id = unit->prevId;
942 children->task.entrance = FIGHTSTG_startEntrance(unit->id, 0, WFIGHTMN_setIdleMotion(0, 0));
943 task->step++;
944 break;
945 case 1:
946 if (children->task.task == NULL) {
947 children->task.message = FIGHTSTG_createMessage();
948 task->args[0] = 0x62;
949 task->args[1] = 0;
950 children->task.message->show(children->task.message, 2, task->args);
951 task->setSubstate(task, 2);
952 }
953 break;
954 }
955}
956
957/* Takes the fallen fighter's event off the queue, shows message 0x50 or
958 0x51 and clears its status, ending the partner's special */
959static inline void announceKnockOut(BattleMenu *task, BattleMenuChildren *children, QueuedEvent *action) {
960 BattleFighter *fighter;
961 s32 side;
962
963 /* the key is the event's first two args: args[0]'s low byte and args[1] */
964 FIGHTSTG_events.funcs.remove((EventKey *)&action->args[0]);
965 side = action->args[0] >> 4;
966 fighter = ACTIVE_FIGHTER(side);
967 if (side == 0) {
968 if (fighter->special != 0) {
969 fighter->special = 0;
970#if VERSION_US
971 /* FIGHTSTG_queueSpecialEnd's event, built in the arguments */
972 task->args[0] = EVENT_SPECIAL_END;
973 task->args[1] = 1;
974 task->args[2] = 0;
975 task->args[3] = FIGHTSTG_battle.state.active[0];
977#elif VERSION_EU || VERSION_JP
979#endif
980 }
981 task->args[0] = 0x50;
982 task->args[1] = 0;
983 } else {
984 task->args[0] = 0x51;
985 task->args[1] = 0x10;
986 }
987 children->task.message->show(children->task.message, 2, task->args);
988 fighter->charge = 0;
989 fighter->flags = 0;
990 fighter->confusion = 0;
991 fighter->sleep = 0;
992 fighter->paralysis = 0;
993}
994
995/* With no fighter left on the side, ends the battle: lost (message 0x53)
996 or won (message 0x52, the partner's motion 0xD and, but in
997 BATTLE_KIND_FINAL_LAST, the win jingle) */
998static inline void endBattleOnKnockOut(BattleMenu *task, BattleMenuChildren *children, QueuedEvent *event) {
999 Models *models;
1000
1001 children->task.message = FIGHTSTG_createMessage();
1002 if (event->args[0] == 0) {
1005 task->args[0] = 0x53;
1006 task->setSubstate(task, 2);
1008 } else {
1012 }
1013 task->args[0] = 0x52;
1014 task->setSubstate(task, 0x18);
1015 task->args[1] = GFX.funcs.getTime();
1016 task->args[2] = 100;
1017 models = TASK_REGISTRY.funcs.find(BATTLE_TASK_MODELS, -1, -1);
1018 models->get(models, 0)->motion = 0xD;
1019 }
1020 children->task.message->show(children->task.message, 1, task->args);
1021}
1022
1023/* In BATTLE_KIND_FINAL, brings in the enemy's second fighter in place of
1024 the first, then lets the enemy's turn come at once */
1025static inline void bringSecondEnemy(BattleMenu *task, BattleMenuChildren *children) {
1026 s32 index;
1027
1028 switch (task->counter) {
1029 case 0:
1030 default:
1031 if (children->task.task == NULL) {
1036 task->counter++;
1037 }
1038 break;
1039 case 1:
1040 if (children->task.entrance->done != 0) {
1043 FIGHTSTG_battle.state.fighters[1][1].id = 0;
1044 task->counter++;
1045 }
1046 break;
1047 case 2:
1049 if (index >= 0) {
1050 FIGHTSTG_events.events[index].time = 0;
1051 }
1052 task->setSubstate(task, 2);
1053 break;
1054 }
1055}
1056
1057/* EVENT_KNOCK_OUT (substate 0x15), a fighter's fall: case 0 takes its event
1058 off the queue, shows message 0x50 or 0x51 and clears its status (announceKnockOut); case 1 looks for the
1059 side's next fighter standing. The player's side picks one
1060 (FIGHTSTG_setPlayerTurnStep(4)), the enemy's brings in the first; with none
1061 left the battle ends (endBattleOnKnockOut: 0x53 lost, 0x52 won). Case 5
1062 brings in the enemy's second fighter in BATTLE_KIND_FINAL
1063 (bringSecondEnemy). */
1065 QueuedEvent *action;
1066 QueuedEvent *event;
1067 BattleFighter *unit;
1068 BattleFighter *enemy;
1069 BattleTableEntry *entry;
1070 s32 slot;
1071 s32 i;
1072
1073 switch (task->step) {
1074 case 0:
1075 default:
1077 children->task.message = FIGHTSTG_createMessage();
1078 if (action->args[0] != 0 && FIGHTSTG_battle.state.kind == BATTLE_KIND_FINAL) {
1079 task->args[0] = 0x8B;
1080 children->task.message->show(children->task.message, 1, task->args);
1081 task->setStep(task, 5);
1082 return;
1083 }
1084 announceKnockOut(task, children, action);
1085 task->step++;
1086 break;
1087 case 1:
1088 if (children->task.task == NULL) {
1089 /* event and not action, and unit for the search too: the
1090 match depends on both, which give the registers */
1092 slot = -1;
1093 unit = FIGHTSTG_battle.state.fighters[event->args[0] >> 4];
1094 for (i = 0; i < 3; i++) {
1095 if (unit[i].id != 0 && unit[i].hp != 0) {
1096 slot = i;
1097 break;
1098 }
1099 }
1100 if (slot != -1) {
1101 if (event->args[0] == 0) {
1103 task->step = 2;
1104 } else {
1105 unit = FIGHTSTG_battle.state.fighters[1] + slot;
1106 task->step = 3;
1107 task->args[0] = slot;
1108 task->args[1] = FIGHTSTG_battle.state.active[1];
1109 FIGHTSTG_battle.state.active[1] = slot;
1111 FIGHTSTG_battle.state.active[1] = task->args[1];
1112 }
1113 break;
1114 }
1115 endBattleOnKnockOut(task, children, event);
1116 }
1117 break;
1118 case 2:
1119 if (FIGHTSTG_isPlayerChoosing() == 0) {
1120 task->setSubstate(task, 5);
1121 task->step = 1;
1122 }
1123 break;
1124 case 3:
1125 if (children->task.entrance->done != 0) {
1126 FIGHTSTG_battle.state.active[1] = task->args[0];
1127 task->step++;
1128 }
1129 break;
1130 case 4:
1131 if (children->task.task == NULL) {
1132 /* through a pointer: the match depends on it, which loads
1133 active[1] from the address of fighters[1] */
1134 enemy = FIGHTSTG_battle.state.fighters[1];
1135 entry = FIGHTSTG_battleTableFunc((enemy + FIGHTSTG_battle.state.active[1])->id);
1136 children->task.message = FIGHTSTG_createMessage();
1137 task->args[0] = entry->nameId;
1138 children->task.message->show(children->task.message, 0xD, task->args);
1139 task->setSubstate(task, 2);
1140 }
1141 break;
1142 case 5:
1143 bringSecondEnemy(task, children);
1144 break;
1145 }
1146}
1147
1148/* The end of the partner's special state (EVENT_SPECIAL_END): clears it and
1149 shows message 0x59 */
1152 BattleFighter *unit;
1153
1154 unit = &FIGHTSTG_battle.state.fighters[0][action->args[1]];
1155 unit->special = 0;
1156 children->task.message = FIGHTSTG_createMessage();
1157 task->args[0] = 0x59;
1158 task->args[1] = action->args[0];
1159 task->args[2] = action->args[1];
1160 children->task.message->show(children->task.message, 7, task->args);
1161 task->setSubstate(task, 2);
1162}
1163
1164/* EVENT_DIGIDEVOLVE: the partner goes back to its own form, its blast and its
1165 queued technique are dropped, and it comes in again with message 0x47 */
1167 Battle *battle;
1168 EventQueue *actions;
1169 s32 index;
1170 BattleFighter *unit;
1171 BattleFighter *units;
1172
1173 switch (task->step) {
1174 case 0:
1175 default:
1176 battle = &FIGHTSTG_battle;
1177 units = battle->state.fighters[0];
1178 index = GAME.funcs.getPartyMember(battle->state.active[0]);
1179 unit = units + battle->state.active[0];
1180 unit->id = DIGIMON_DATA[index].id;
1181 unit->charge = 0;
1183 actions = &FIGHTSTG_events;
1184 index = actions->funcs.find(EVENT_PARTNER_TECH, 0, battle->state.active[0]);
1185 if (index >= 0) {
1186 actions->events[index].type = 0;
1187 }
1188 children->task.entrance = FIGHTSTG_startEntrance(unit->id, 0, WFIGHTMN_setIdleMotion(0, 0));
1189 task->step++;
1190 break;
1191 case 1:
1192 if (children->task.task == NULL) {
1193 children->task.message = FIGHTSTG_createMessage();
1194 task->args[0] = 0x47;
1195 task->args[1] = 0;
1196 children->task.message->show(children->task.message, 2, task->args);
1197 task->setSubstate(task, 2);
1198 }
1199 break;
1200 }
1201}
1202
1203/* Shows the won message (from WFIGHTMN_knockOut) for its time, then closes it */
1205 switch (task->step) {
1206 case 0:
1207 default:
1208 if (children->task.task != NULL) {
1209 if (GFX.funcs.getTime() - task->args[1] > task->args[2]) {
1210 children->task.message->finish(children->task.message);
1211 task->step++;
1212 }
1213 break;
1214 }
1215 task->setSubstate(task, 0);
1216 break;
1217 case 1:
1218 if (children->task.task != NULL) {
1219 children->task.task->state = TASK_KILL;
1220 }
1221 task->setSubstate(task, 0);
1222 break;
1223 }
1224}
1225
1226/* The enemy's third fighter comes in (BATTLE_KIND_FINAL_LAST), takes the first's
1227 place, and technique 440 is made from 443 with FIGHTSTG_battle.state.tech's
1228 effect (its look from WFIGHTMN_effectVisuals) and element (from
1229 WFIGHTMN_elementVisuals) before message 0x16 names it (?) */
1231 TechData *tech;
1232 TechData *dst;
1233 s32 id;
1234 s32 i;
1235
1236 switch (task->step) {
1237 case 0:
1238 default:
1243 task->step++;
1244 break;
1245 case 1:
1246 if (children->task.entrance->done != 0) {
1249 FIGHTSTG_battle.state.fighters[1][2].id = 0;
1250 task->step++;
1251 }
1252 break;
1253 case 2:
1254 if (children->task.task == NULL) {
1255 dst = &TECHS[439];
1257 *dst = TECHS[442];
1258 if (id != 0) {
1259 tech = &TECHS[id - 1];
1260 if (tech->script != 5 && tech->script != 12) {
1261 if (tech->effect >= TECH_EFFECT_FIRST && !(tech->effect == TECH_EFFECT_MULTI_HIT || tech->effect == TECH_EFFECT_ENEMY_ONLY) && tech->effect != TECH_EFFECT_STEAL) {
1262 dst->effect = tech->effect;
1263 dst->effectPower = tech->effectPower;
1264 dst->effectChance = tech->effectChance;
1265 for (i = 0; WFIGHTMN_effectVisuals[i].effect != -1; i++) {
1266 if (WFIGHTMN_effectVisuals[i].effect == tech->effect) {
1269 dst->scriptStage = 0;
1270 break;
1271 }
1272 }
1273 }
1274 if (tech->element >= ELEMENT_FIRST) {
1275 dst->element = tech->element;
1276 dst->elementPower = tech->elementPower;
1277 if (dst->effect < TECH_EFFECT_FIRST) {
1278 /* while (1), not for (;;): the match depends on it,
1279 which leaves the loop's test at its top */
1280 i = 0;
1281 while (1) {
1282 if (WFIGHTMN_elementVisuals[i].element == tech->element) {
1286 break;
1287 }
1288 i++;
1289 }
1290 }
1291 }
1292 }
1293 children->task.message = FIGHTSTG_createMessage();
1294 task->args[0] = FIGHTSTG_battle.state.tech;
1295 children->task.message->show(children->task.message, 0x16, task->args);
1296 task->step = 3;
1297 } else {
1298 task->step = 4;
1299 }
1300 }
1301 break;
1302 case 3:
1303 if (children->task.task == NULL) {
1304 task->step++;
1305 }
1306 break;
1307 case 4:
1308 task->setSubstate(task, 2);
1309 break;
1310 }
1311}
1312
1313/* The end of the enemy's weakness (EVENT_WEAKNESS_END): its lowered stats
1314 come back and it takes its turn first */
1316 BattleEvent request;
1318
1319 if (index >= 0) {
1320 FIGHTSTG_events.events[index].type = 0;
1321 }
1322 request.type = EVENT_ENEMY_TURN;
1323 request.delay = 1;
1324 request.args[0] = -1;
1326 FIGHTSTG_battle.state.fighters[1][0].boosts[3] = 0;
1327 FIGHTSTG_battle.state.fighters[1][0].boosts[1] = 0;
1328 task->setSubstate(task, 2);
1329}
1330
1331/* The battle menu's main state: waits for FIGHTSTG's turn (FIGHTSTG_events.funcs.pop),
1332 then runs the state of the command it gets (WFIGHTMN_states) */
1334 BattleMenuChildren *children = task->children;
1335
1336 switch (task->substate) {
1337 default:
1338 if (task->substate >= 3 && task->substate < 27) {
1339 WFIGHTMN_states[task->substate](task, children);
1340 } else {
1341#if VERSION_EU || VERSION_JP
1342 task->setSubstate(task, 1);
1343#endif
1344 task->step = FIGHTSTG_events.funcs.pop();
1345 if (task->step == 0) {
1348 task->setSubstate(task, 0);
1349 }
1350#if VERSION_US
1351 else {
1352 task->setSubstate(task, 1);
1353 }
1354#endif
1355 }
1356 break;
1357 case 0:
1358#if VERSION_EU || VERSION_JP
1359 task->setSubstate(task, 1);
1360 task->step = FIGHTSTG_events.funcs.pop();
1361#else
1362 task->step = FIGHTSTG_events.funcs.pop();
1363 if (task->step != 0) {
1364 task->substate = 1;
1365 }
1366#endif
1367 break;
1368 case 1:
1369 switch (task->step) {
1370 default:
1371 task->setSubstate(task, 3);
1372 break;
1373 case EVENT_END_BATTLE:
1374 task->setSubstate(task, 7);
1375 break;
1376 case EVENT_ENEMY_TURN:
1379 task->setSubstate(task, 2);
1381 children->task.enemyAttack = FIGHTSTG_startEnemyAttack(0, 0);
1382 task->setSubstate(task, 2);
1383 } else {
1384 ACTIVE_FIGHTER(1)->turns++;
1386 task->setSubstate(task, 2);
1387 }
1388 break;
1389 case EVENT_RUN_AWAY:
1390 task->setSubstate(task, 8);
1391 break;
1393 task->setSubstate(task, 9);
1394 break;
1395 case EVENT_RECOVERY:
1396 task->setSubstate(task, 0xA);
1397 break;
1398 case EVENT_CLEAR_FIELD:
1399 task->setSubstate(task, 0xB);
1400 break;
1402 task->setSubstate(task, 0xC);
1403 break;
1404 case EVENT_STATUS_END:
1405 task->setSubstate(task, 0xD);
1406 break;
1407 case EVENT_STATUS_END + 1:
1408 task->setSubstate(task, 0xE);
1409 break;
1410 case EVENT_STATUS_END + 2:
1411 task->setSubstate(task, 0xF);
1412 break;
1413 case EVENT_BOOST_END:
1414 case EVENT_BOOST_END + 1:
1415 case EVENT_BOOST_END + 2:
1416 task->setSubstate(task, 0x10);
1417 break;
1419 case EVENT_RESTRICTION_END + 1:
1420 task->setSubstate(task, 0x12);
1421 break;
1422 case EVENT_BLAST:
1423 task->setSubstate(task, 0x13);
1424 break;
1425 case EVENT_BLAST_END:
1426 task->setSubstate(task, 0x14);
1427 break;
1428 case EVENT_KNOCK_OUT:
1429 task->setSubstate(task, 0x15);
1430 break;
1431 case EVENT_SPECIAL_END:
1432 task->setSubstate(task, 0x16);
1433 break;
1434 case EVENT_DIGIDEVOLVE:
1435 task->setSubstate(task, 0x17);
1436 break;
1437 case EVENT_LAST_ENEMY:
1438 task->setSubstate(task, 0x19);
1439 break;
1440 case EVENT_WEAKNESS_END:
1441 task->setSubstate(task, 0x1A);
1442 break;
1443 }
1444 break;
1445 case 2:
1446 if (children->task.task == NULL) {
1447 task->setSubstate(task, 0);
1448 }
1449 break;
1450 }
1451}
1452
1453/* WFIGHTMN's entry point: creates the battle menu, and zeroes FIGHTSTG_battle's
1454 state and BATTLE_RESULT */
Battle FIGHTSTG_battle
the battle: its fighters, speed and drawing functions
Definition battle.c:16
void FIGHTSTG_queueSpecialEnd(void)
Queues the end of the partner's special state (event 21): the USA version pushes back the one already...
Definition battle.c:117
BattleFuncs FIGHTSTG_battleFuncs
the battle's stats and the functions that compute with them
Definition battle.c:25
void FIGHTSTG_queueKnockOut(u8 side)
Queues the fall of side's active fighter (event 20), first.
Definition battle.c:107
void FIGHTSTG_queueBlastEnd(s32 kind)
Queues the end of the partner's digivolution for the battle (event 19), after delay kind + 3.
Definition battle.c:98
#define EVENT_KNOCK_OUT
Definition battle.h:95
#define FIGHTER_PARALYZED
loses turns at random (FIGHTSTG_battleFuncs.testParalysis)
Definition battle.h:183
#define BATTLE_KIND_ESCAPE
the enemy runs away under a tenth of its HP
Definition battle.h:125
#define TECH_EFFECT_MULTI_HIT
Definition battle.h:258
#define EVENT_AUTO_RECOVER_END
Definition battle.h:85
#define EVENT_WEAKNESS_END
the end of the enemy's weakness (BATTLE_KIND_FINAL_LAST)
Definition battle.h:99
#define BATTLE_LOST
Definition battle.h:135
#define EVENT_STATUS_DAMAGE
the damage of a poisoned fighter (FIGHTER_POISONED)
Definition battle.h:89
#define TECH_EFFECT_FIRST
A technique's effect (TechData.effect), which FIGHTSTG_applyTechEffect carries out when its hit lands...
Definition battle.h:251
#define EVENT_END_BATTLE
The types of the battle's events: WFIGHTMN runs a state for each (WFIGHTMN_runTurn)
Definition battle.h:81
#define EVENT_RUN_AWAY
Definition battle.h:84
#define BATTLE_KIND_NORMAL
The kinds of battle (Battle.kind), which WFIGHTMN picks by the battle and the mode it came from.
Definition battle.h:124
#define BATTLE_FLED
How a battle ends (FIGHTSTG_endBattle)
Definition battle.h:133
#define BATTLE_STAT_SPEED
physical accuracy, evasion and running away
Definition battle.h:33
#define EVENT_DIGIDEVOLVE
Definition battle.h:97
#define EVENT_CLEAR_FIELD
Definition battle.h:87
#define EVENT_LAST_ENEMY
the last battle's third enemy comes in
Definition battle.h:98
#define BATTLE_KIND_UNK2
the enemy keeps an eleventh of its HP
Definition battle.h:126
#define BATTLE_WON
Definition battle.h:134
#define EVENT_BOOST_END
13-15: the end of a boost, by the stat
Definition battle.h:91
#define TECH_EFFECT_ENEMY_ONLY
does nothing but for the enemy whose battle table entry lists it first
Definition battle.h:259
#define BATTLE_KIND_NO_DAMAGE
the partner's hits do no damage
Definition battle.h:127
#define EVENT_BLAST_END
Definition battle.h:94
#define ACTIVE_FIGHTER(side)
SIDE's active fighter as its row plus the index, which GCC adds with the row's address first.
Definition battle.h:493
#define EVENT_SPECIAL_END
the end of the partner's special state
Definition battle.h:96
#define EVENT_ENEMY_TURN
Definition battle.h:83
#define EVENT_STATUS_END
10-12: the end of FIGHTER_PARALYZED, FIGHTER_CONFUSED or FIGHTER_ASLEEP
Definition battle.h:90
#define BATTLE_KIND_FINAL
battle 0x144, the last one: its first enemy
Definition battle.h:128
#define EVENT_PARTNER_TECH
a technique of the partner's, run as its command
Definition battle.h:88
#define BATTLE_KIND_FINAL_LAST
its third enemy; winning plays the ending
Definition battle.h:130
#define EVENT_BLAST
the partner's digivolution for the battle
Definition battle.h:93
#define BATTLE_KIND_FINAL_SECOND
its second enemy
Definition battle.h:129
#define EVENT_RESTRICTION_END
16-17: the end of a restriction (FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE)
Definition battle.h:92
#define EVENT_RECOVERY
Definition battle.h:86
#define TECH_EFFECT_STEAL
the enemy's item
Definition battle.h:261
#define SIDE_PLAYER
The battle's sides, as the functions that take a side want them: side >> 4 is its row of FIGHTSTG_bat...
Definition battle.h:177
#define SIDE_ENEMY
Definition battle.h:178
#define ELEMENT_FIRST
The elements (TechData.element, BattleStats.element) and the families (TechData.family,...
Definition battle.h:37
#define FIGHTER_CONFUSED
Definition battle.h:184
void FIGHTSTG_endBattle(s32 result)
Ends the battle: queues event 1 ahead of the others, with how it ended (BATTLE_FLED,...
Definition events.c:377
void FIGHTSTG_queuePlayerTurn(s32 delay)
Queues the player's turn (event 2) in delay.
Definition events.c:360
void FIGHTSTG_queueRunAway(u8 side)
Queues side's attempt to run away (event 4)
Definition events.c:386
EventQueue FIGHTSTG_events
the battle's events and their functions
Definition events.c:43
void FIGHTSTG_queueEnemyTurn(s32 delay)
Queues the enemy's turn (event 3) in delay.
Definition events.c:368
ScreenFade * FIGHTSTG_createFader(void)
Creates the screen fade, idle until started, on layer BATTLE_LAYER_FRONT.
Definition fader.c:42
#define BATTLE_LAYER_CAMERA
The battle's layers, over the screen's (SCREEN_LAYER)
Definition types.h:27
#define BATTLE_TASK_MENU
The ids that the battle's tasks register with, for the others to find them (TASK_REGISTRY....
Definition types.h:18
#define BATTLE_TASK_MODELS
the fighters'
Definition types.h:23
void WFIGHTMN_endSpecial(BattleMenu *task, BattleMenuChildren *children)
The end of the partner's special state (EVENT_SPECIAL_END): clears it and shows message 0x59.
Definition menu.c:1150
void WFIGHTMN_blast(BattleMenu *task, BattleMenuChildren *children)
Digivolves the current partner for the battle, to the Digimon its level reaches (DigimonData....
Definition menu.c:865
void WFIGHTMN_clearField(BattleMenu *task, BattleMenuChildren *children)
EVENT_CLEAR_FIELD: shows message 0x6A and ends the element boost (FIGHTSTG_battle....
Definition menu.c:681
void WFIGHTMN_recover(BattleMenu *task, BattleMenuChildren *children)
A fighter's recovery (EVENT_RECOVERY): unless its HP is full, plays technique 0xBD on it when it is t...
Definition menu.c:637
static void addFighters(BattleMenu *task, BattleMenuChildren *children)
Adds the partner's Digimon (its battle digivolution, but not after an ambush) and the enemy,...
Definition menu.c:33
void WFIGHTMN_runCommand(BattleMenu *task, BattleMenuChildren *children)
The player's turn (EVENT_PLAYER_TURN): drops the partner's queued technique and running away,...
Definition menu.c:233
void WFIGHTMN_tag(BattleMenu *task, BattleMenuChildren *children)
Swaps the partner on the field for the one picked (children->commands): message 0x38,...
Definition menu.c:350
void WFIGHTMN_runAway(BattleMenu *task, BattleMenuChildren *children)
Asks FIGHTSTG (FIGHTSTG_battleFuncs.testRunAway) whether the current action's actor gets away; if so ...
Definition menu.c:569
static void switchConfusionMusic(BattleMenu *task)
Plays MUSIC_CONFUSION once a partner is confused, and the battle's music again once none is.
Definition menu.c:90
void WFIGHTMN_bringLastEnemy(BattleMenu *task, BattleMenuChildren *children)
The enemy's third fighter comes in (BATTLE_KIND_FINAL_LAST), takes the first's place,...
Definition menu.c:1230
void WFIGHTMN_restoreEnemy(BattleMenu *task, BattleMenuChildren *children)
The end of the enemy's weakness (EVENT_WEAKNESS_END): its lowered stats come back and it takes its tu...
Definition menu.c:1315
void WFIGHTMN_digivolve(BattleMenu *task, BattleMenuChildren *children)
The state that changes the current partner's Digimon to the one picked (commands->digimon),...
Definition menu.c:320
void WFIGHTMN_pairTech(BattleMenu *task, BattleMenuChildren *children)
State 6, the pair technique (the player turn's action 6): the outgoing and incoming partners do comma...
Definition menu.c:428
static void bringSecondEnemy(BattleMenu *task, BattleMenuChildren *children)
In BATTLE_KIND_FINAL, brings in the enemy's second fighter in place of the first, then lets the enemy...
Definition menu.c:1025
void WFIGHTMN_digidevolve(BattleMenu *task, BattleMenuChildren *children)
EVENT_DIGIDEVOLVE: the partner goes back to its own form, its blast and its queued technique are drop...
Definition menu.c:1166
void WFIGHTMN_cancelBlast(void)
Ends the current partner's temporary Digimon and the actions that go with it.
Definition menu.c:211
static void setBattleKind(void)
Sets the battle's kind from the mode it came from and the battle: the escape, UNK2,...
Definition menu.c:11
void WFIGHTMN_endBlast(BattleMenu *task, BattleMenuChildren *children)
Turns the current partner back into the Digimon it was (prevId)
Definition menu.c:933
void WFIGHTMN_endRestriction(BattleMenu *task, BattleMenuChildren *children)
Clears the restriction that the current action ends (FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE) from ...
Definition menu.c:839
void WFIGHTMN_knockOut(BattleMenu *task, BattleMenuChildren *children)
EVENT_KNOCK_OUT (substate 0x15), a fighter's fall: case 0 takes its event off the queue,...
Definition menu.c:1064
void WFIGHTMN_runConfusedCommand(BattleMenu *task, BattleMenuChildren *children)
A confused partner's turn (FIGHTER_CONFUSED): the player's turn at step 3, where only an attack does ...
Definition menu.c:816
void WFIGHTMN_updateMenu(BattleMenu *task, BattleMenuChildren *children)
The battle menu's task: sets up the battle (its music, FIGHTSTG's tasks, setBattleKind,...
Definition menu.c:124
void WFIGHTMN_endBattle(BattleMenu *task, BattleMenuChildren *children)
After a won battle, picks the enemy whose item the player may get; saves the partners' HP and MP,...
Definition menu.c:456
Task * WFIGHTMN_start(void)
WFIGHTMN's entry point: creates the battle menu, and zeroes FIGHTSTG_battle's state and BATTLE_RESULT...
Definition menu.c:1455
void WFIGHTMN_endAutoRecover(BattleMenu *task, BattleMenuChildren *children)
Removes the current action's EVENT_RECOVERY event, unless the partner it is for has WFIGHTMN_RECOVERY...
Definition menu.c:606
static void announceKnockOut(BattleMenu *task, BattleMenuChildren *children, QueuedEvent *action)
Takes the fallen fighter's event off the queue, shows message 0x50 or 0x51 and clears its status,...
Definition menu.c:959
void WFIGHTMN_endBoost(BattleMenu *task, BattleMenuChildren *children)
Clears the boost (BattleFighter.boosts) that the current action ends.
Definition menu.c:790
void WFIGHTMN_runTurn(BattleMenu *task)
The battle menu's main state: waits for FIGHTSTG's turn (FIGHTSTG_events.funcs.pop),...
Definition menu.c:1333
void WFIGHTMN_takeDamage(BattleMenu *task, BattleMenuChildren *children)
Carries out the current action's damage (FIGHTSTG_battleFuncs.getDamage) on its unit.
Definition menu.c:692
void WFIGHTMN_cureStatus(BattleMenu *task, BattleMenuChildren *children)
States 13-15: end the current action's unit's paralysis, confusion or sleep.
Definition menu.c:754
void WFIGHTMN_showWon(BattleMenu *task, BattleMenuChildren *children)
Shows the won message (from WFIGHTMN_knockOut) for its time, then closes it.
Definition menu.c:1204
static void endBattleOnKnockOut(BattleMenu *task, BattleMenuChildren *children, QueuedEvent *event)
With no fighter left on the side, ends the battle: lost (message 0x53) or won (message 0x52,...
Definition menu.c:998
static void queueFirstTurns(BattleMenu *task, BattleMenuChildren *children)
Queues the first turns: the enemy's first after an ambush, with its message, or by a roll on the figh...
Definition menu.c:61
BattleCamera * FIGHTSTG_createBattleCamera(s32 layerId)
Creates the battle camera (BATTLE_TASK_CAMERA) on a layer.
BattleScript * FIGHTSTG_createBattleScript(void)
Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript)
BattleTableEntry *(* FIGHTSTG_battleTableFunc)(s32 id)
how the fight stage and WFIGHTMN read the battle table
CameraShots * FIGHTSTG_startCameraShots(void)
Starts the European version's own camera.
CameraTurn * FIGHTSTG_startCameraTurn(void)
Starts the camera's turn around the fighters.
Definition camera_turn.h:59
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
DigimonData DIGIMON_DATA[55]
55 entries: the 52 Digimon, then three placeholders (0x1D4-0x1D6)
Definition digimon.c:7
DigimonChange * FIGHTSTG_startDigimonChange(s32 key1, s32 key2)
Starts a partner's Digimon change (FIGHTSTG_updateDigimonChange)
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
HitEffect * FIGHTSTG_startHitEffect()
WFIGHTMN passes the damage as a third argument, which it doesn't read; its code loads it,...
EnemyAttack * FIGHTSTG_startEnemyAttack(s32 kind, s32 noKnockout)
Starts an attack on the player's active fighter (FIGHTSTG_updateEnemyAttack): kind 0 for the enemy's ...
EnemyTurn * FIGHTSTG_startEnemyTurn(void)
Starts the enemy's turn (FIGHTSTG_updateEnemyTurn)
Definition enemy_turn.c:293
GameState GAME
The save data, the game mode and the methods.
Definition state.c:64
#define TASK_KILL
Definition task.h:37
#define TASK_DONE
Definition task.h:36
Entrance * FIGHTSTG_startEntrance(s32 id, s32 side, s32 weak)
Starts a fighter's entrance: Digimon id on the player's side (side 0) or the enemy's.
Definition entrance.c:175
FirstTech * FIGHTSTG_startFirstTech(s32 side)
Starts side's first technique (FIGHTSTG_updateFirstTech)
Definition first_tech.c:238
#define MODE_BATTLE_REPORT
STFGTREP.
Definition game_state.h:453
#define STAT_MP
Definition game_state.h:283
#define MODE_TITLE
STDWTITL's title screen; its movies follow.
Definition game_state.h:438
#define STAT_HP
Definition game_state.h:281
#define STAT_LEVEL
Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)
Definition game_state.h:279
#define MODE_ENDING
Definition game_state.h:447
DigimonData *(* GET_DIGIMON)(s32 id)
getDigimon for the overlays, in the small data (.sdata) between game/items.c's and file/file_table....
Definition get_digimon.c:10
#define SCREEN_LAYER
The layer over the whole screen that most modes create first and draw their menus on (FIELDSTG and ST...
Definition gfx.h:45
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
Definition heap.c:184
BattleItem * FIGHTSTG_startItem(s32 item)
Starts an item's script (FIGHTSTG_updateItem)
Definition item.c:870
TechData TECHS[443]
The techniques, from 1: technique n is TECHS[n - 1].
Definition items.c:906
BattleSetup BATTLE_SETUP
Definition items.c:886
BattleResult BATTLE_RESULT
Definition items.c:888
Lights * FIGHTSTG_createLights(s32 layerId)
Creates the stage lights (id 0x13) for layer layerId.
Definition lights.c:118
BattleLoader * WFIGHTMN_createLoader(void)
Starts loading the battle menu's files.
Definition loader.c:125
BattleMessageBox * FIGHTSTG_createMessage(void)
Creates a battle message box (FIGHTSTG_updateMessage)
Definition message.c:440
Models * FIGHTSTG_createModels(void)
Creates the fighters' models (Models), with no fighters yet.
Definition models.c:154
WFIGHTMN.PRO: the battle's sub-overlay.
#define WFIGHTMN_RECOVERY_ITEM
The item a partner can equip that makes FIGHTSTG's FIGHTSTG_queueRecovery act on it at the start of t...
OneHpTurn * FIGHTSTG_startOneHpTurn(void)
Starts BATTLE_KIND_FINAL_SECOND's enemy turn.
Definition one_hp_turn.c:59
void FIGHTSTG_setPlayerTurnStep(s32 substate)
Sets the player's turn's substate, while it runs (4 picks the next fighter)
s32 FIGHTSTG_isPlayerChoosing(void)
Whether the player's turn has a menu open (its substate isn't 0)
PlayerTurn * FIGHTSTG_startPlayerTurn(void)
Starts the player's turn (FIGHTSTG_updatePlayerTurn, id 0xE)
Random RANDOM
Definition random.c:533
TaskRegistry TASK_REGISTRY
Definition registry.c:122
void WFIGHTMN_createLayers(void)
Sets up the display and the battle's layers.
Definition setup.c:7
s32 WFIGHTMN_rollAmbush(void)
Checks the chance in BATTLE_SETUP.ambushChance, scaled by how far the first partner's level and the f...
Definition setup.c:60
void WFIGHTMN_markFought(void)
Marks in BATTLE_RESULT that the current partner fought, and with which of its slots' Digimon if it is...
Definition setup.c:109
void WFIGHTMN_markPicked(BattleMenu *task, BattleMenuChildren *children)
Records in BATTLE_RESULT that the partner of the player's turn fought, and which of its digivolution ...
Definition setup.c:132
void WFIGHTMN_initFighters(s32 digimon)
Fills the battle's fighters: the party's partners (the first one with the id DIGIMON) and the encount...
Definition setup.c:20
void WFIGHTMN_checkParty(void)
Checks each of the party's three partners for WFIGHTMN_RECOVERY_ITEM (WFIGHTMN_checkEquip)
Definition setup.c:99
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
Definition sound.c:180
#define SOUND_WIN_JINGLE
W_JINGLE: a battle won.
Definition sound.h:48
#define MUSIC_GAME_OVER
GAMEOVER: a battle lost (WFIGHTMN endBattleOnKnockOut)
Definition sound.h:75
#define MUSIC_CONFUSION
The music by where the game plays it (FieldState.music, AreaBattle.music, the screens'),...
Definition sound.h:74
FightStage * FIGHTSTG_createStage(s32 id, s32 fadeInTime)
Creates the fight stage (id 0x15), which loads stage id and fades it in over fadeInTime.
Definition stage.c:213
CameraView *(* getEnemyView)(struct BattleCamera *task)
Definition camera.h:76
void(* set)(struct BattleCamera *task, CameraView *view)
Definition camera.h:74
s32 fighter
0 for none
Definition game_state.h:354
An event of the battle, as it is queued (FIGHTSTG_pushEvent)
Definition battle.h:102
s32 delay
Definition battle.h:104
s32 args[6]
Definition battle.h:105
s32 type
EVENT_END_BATTLE...
Definition battle.h:103
One of the battle's fighters, three on each side (WFIGHTMN's BattleUnit): a partner's HP and MP go ba...
Definition battle.h:191
u8 paralysis
FIGHTER_PARALYZED's strength.
Definition battle.h:205
u8 flags
FIGHTER_*.
Definition battle.h:204
s16 charge
added in 64ths to its next technique's damage, which uses it up
Definition battle.h:199
u8 temporary
id is a temporary Digimon
Definition battle.h:202
s16 item
an enemy's
Definition battle.h:201
s16 id
the Digimon (DIGIMON_DATA)
Definition battle.h:192
s16 prevId
its own id while id is a temporary one
Definition battle.h:193
s16 boosts[4]
added to the stats FIGHTSTG_boostStats picks
Definition battle.h:200
u8 sleep
FIGHTER_ASLEEP's.
Definition battle.h:206
u8 confusion
FIGHTER_CONFUSED's.
Definition battle.h:207
u8 special
the partner's special state (EVENT_SPECIAL_END): doubles its effects
Definition battle.h:203
s32(* getHeal)(u8 side, s32 index, s32 big)
a part of its max HP
Definition battle.h:337
s32(* testParalysis)(u8 side)
whether side's paralysis costs it the turn
Definition battle.h:358
s32(* testRunAway)(u8 side)
Definition battle.h:355
s32(* getDamage)(s32 *args)
of the event whose args these are
Definition battle.h:334
BattleStats *(* computeStats)(u8 side, s32 which, s32 index)
Definition battle.h:331
The battle menu's children.
BattleCamera * camera
FIGHTSTG_createBattleCamera.
BattleLoader * loader
FightStage * stage
BattleChild task
what the state waits for, NULL when done
BattleChild cameraMove
the European version's shots, or the turn when the player loses
PlayerTurn * commands
the player's turn (FIGHTSTG_startPlayerTurn)
The battle menu (WFIGHTMN_start), registered as BATTLE_TASK_MENU.
void * children
void(* nextState)(struct BattleMenu *task)
void(* setSubstate)(struct BattleMenu *task, s32 substate)
void(* setStep)(struct BattleMenu *task, s32 step)
void(* nextStep)(struct BattleMenu *task)
void(* nextSubstate)(struct BattleMenu *task)
s32 args[8]
the message's arguments, or a BattleEvent to push first
void(* finish)(struct BattleMessageBox *task)
FIGHTSTG_finishMessage: closes after 0x14 ticks or Cross.
Definition menu.h:183
void(* show)()
FIGHTSTG_showMessage: (task, type, data)
Definition menu.h:182
s16 member
the party member whose accessory adds money
Definition game_state.h:400
s16 battle
row of STFGTREP_rewards
Definition game_state.h:398
struct BattleResult::@9 partners[3]
u8 used[3]
the Digimon of each slot was used
Definition game_state.h:403
s16 item
the item won, 0 for none
Definition game_state.h:399
s32 enemy
the script is the enemy's (nonzero) or the partner's
Definition effect.h:146
s32 sound
what the sound commands' 0x62 and 0x63 stand for on a hit
Definition effect.h:151
s32 effect
the sprite effect the effect command's 9999 stands for
Definition effect.h:150
s32 hits[4]
0 a hit, 3 a miss; [3] how it ended
Definition effect.h:148
s32 index
the script, in the fighter's archive
Definition effect.h:147
s32 stage
what the stage command's 0x38 stands for
Definition effect.h:149
s32 prize
an item (BattleResult.item)
Definition game_state.h:391
s32 battle
the battle (BattleResult.battle)
Definition game_state.h:384
s16 gauges[8]
filled in battle, up to 1000
Definition game_state.h:393
BattleEnemy enemies[3]
Definition game_state.h:386
s32 music
the battle's music
Definition game_state.h:385
s32 stage
the battle's fight stage
Definition game_state.h:383
s32 hasPrize
1: the battle always gives prize
Definition game_state.h:390
s16 runAttempts
the player's, each of which makes running away likelier (FIGHTSTG_testRunAway)
Definition battle.h:229
s8 hitCount
BATTLE_KIND_FINAL_LAST: the partner's hits that did damage.
Definition battle.h:232
s32 active[2]
each side's fighter
Definition battle.h:226
BattleFighter fighters[2][3]
Definition battle.h:227
s16 kind
the kind of battle
Definition battle.h:230
u8 weakened
BATTLE_KIND_FINAL_LAST: the enemy is weakened (FIGHTSTG_weakenEnemy)
Definition battle.h:233
ElementBoost boost
Definition battle.h:228
s16 tech
a technique id, set by WFIGHTMN
Definition battle.h:231
A side's stats as FIGHTSTG_computeStats works them out.
Definition battle.h:305
s16 stats[5]
with the fighter's boosts
Definition battle.h:307
s16 nameId
string in file 0x4F
Definition battle.h:62
s16 itemChance
in 1024ths, less one
Definition battle.h:61
FIGHTSTG_battle: the battle.
Definition battle.h:237
BattleState state
Definition battle.h:240
Digimon definition (DIGIMON_DATA, 52 of them; the first 8 are the partners)
Definition game_state.h:86
u8 nameId
string in file 0x4F
Definition game_state.h:105
u8 blastForms[5]
what a blast turns a partner into (from 1), by its level's tier
Definition game_state.h:104
s32 effect
TechData.effect, -1 ends the list.
s16 amount
in 128ths
Definition battle.h:220
s16 element
under ELEMENT_FIRST: none
Definition battle.h:219
s32 done
Definition effect.h:133
What FIGHTSTG_removeEvents removes the events of: an event's first two args, as FIGHTSTG_queueRecover...
Definition battle.h:117
s32(* pop)(void)
the next event due
Definition battle.h:143
s32(* first)(s32 type)
Definition battle.h:144
s32(* getDelay)(u8 side, s32 kind)
FIGHTSTG_getEventDelay: when an event of side's runs.
Definition battle.h:148
u8 result
the battle's, for WFIGHTMN (BATTLE_FLED...)
Definition battle.h:139
void(* pushFirst)(BattleEvent *event)
before all the others
Definition battle.h:142
s32(* find)(s32 type, u8 side, s32 fighter)
Definition battle.h:146
void(* remove)(EventKey *key)
the events whose first two args are its
Definition battle.h:147
The battle's events (FIGHTSTG_events)
Definition battle.h:164
EventQueueFuncs funcs
Definition battle.h:171
s8 curIndex
and where it is
Definition battle.h:168
QueuedEvent events[99]
Definition battle.h:165
struct PartnerStats *(* getPartnerStats)(s32 partner)
Definition game_state.h:38
void(* requestMode)(s32 mode, s32 arg)
Definition game_state.h:21
s32(* getPrevMode)()
Definition game_state.h:23
s32(* getPartyMember)(u32 index)
Definition game_state.h:24
s32(* getPartnerSlots)()
(partner, s16 *out): the count
Definition game_state.h:32
Partner partners[PARTNER_COUNT]
Definition game_state.h:517
s32 fieldMode
where the menu returns to
Definition game_state.h:503
GameFuncs funcs
Definition game_state.h:582
struct Layer *(* getLayer)(s32 id)
Definition gfx.h:28
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
s32 frameTime
vsyncs that the last frame took
Definition gfx.h:67
void(* zero)(void *ptr, s32 size)
Definition heap.h:32
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
void(* setBgColor)()
no prototype: callers would truncate u8 args
Definition gfx.h:152
s32 motion
the motion to play
Definition model.h:102
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
Definition model.h:284
void(* setIdleMotion)(struct Models *task, s32 id, s32 motion)
Definition model.h:293
void(* face)(struct Models *task, s32 id)
ids under 0x10 are one side
Definition model.h:292
void(* add)(struct Models *task, s32 id, s32 fighter, s32 visible)
Definition model.h:288
ModelControl *(* get)(struct Models *task, s32 id)
Definition model.h:289
A partner Digimon from its name on (Partner.info), as getPartnerStats gives it.
Definition game_state.h:303
s16 stats[19]
Definition game_state.h:306
PartnerStats info
Definition game_state.h:349
s32 battleDigivolve
an entry id, compared with the slots': the Digimon the battle starts it as, 0 for its own
Definition game_state.h:348
s32 arg
the action's: the item, the technique, or the party slot of the partner that digivolves or switches o...
Definition menu.h:38
s32 action
what the turn does
Definition menu.h:37
s32 pairTech
FIGHTSTG_createPairSwitchMenu's technique, which the outgoing and incoming partners do together (acti...
Definition menu.h:40
s32 digimon
the Digimon a partner changes into, or the one it switches to
Definition menu.h:39
A queued event: its time counts down to when it runs.
Definition battle.h:109
s16 type
0 for a free entry
Definition battle.h:110
s32 args[6]
Definition battle.h:112
s32(* next)(void)
0 to RANDOM_COUNT - 1
Definition random.h:15
Fades the whole screen to black and back with a subtractive rectangle.
Definition gfx.h:361
void(* start)(struct ScreenFade *fade, s32 fadeIn, s32 frames)
TASK_DONE when done.
Definition gfx.h:368
s32(* isLoading)(void)
Definition sound.h:193
void(* loadBank)(s32 id)
Definition sound.h:190
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
void *(* find)(s32 id, s32 key1, s32 key2)
Definition task.h:18
TaskFuncs funcs
Definition task.h:76
Any task, seen through its header.
Definition task.h:62
void(* setState)(struct Task *task, s32 state)
Definition task.h:63
s32 state
Definition task.h:63
A technique (TECHS, from 1: technique n is TECHS[n - 1])
Definition game_state.h:110
u8 effectChance
Definition game_state.h:120
u8 scriptSound
its script's hit sound (BattleScript.sound)
Definition game_state.h:124
u8 scriptEffect
its script's sprite effect (BattleScript.effect)
Definition game_state.h:123
u8 effect
TECH_EFFECT_* (fightstg/battle.h), under TECH_EFFECT_FIRST none.
Definition game_state.h:119
u8 effectPower
the effect's strength (a boost's amount, a drain's 128ths)
Definition game_state.h:121
u8 element
ELEMENT_FIRST and up, under it none.
Definition game_state.h:116
u8 elementPower
how much the element adds, against the target's resistance
Definition game_state.h:117
u8 scriptStage
its script's stage (BattleScript.stage)
Definition game_state.h:122
u8 script
its script in the user's archive (BattleScript.index); 5 and 12 are special
Definition game_state.h:125
void * createTaskWithId(void(*update)(), s32 size, s32 childrenSize, s32 id)
Allocates a zeroed task of size bytes (header included) with room for childrenSize / 4 child tasks.
Definition task.c:80
TechAction * FIGHTSTG_startTechAction(s32 side, s32 tech)
Starts side's (0 or 0x10) technique or item tech.
BattleScript * WFIGHTMN_startTech(u8 actor, s32 id)
Starts the effect of actor's move id (FIGHTSTG's FIGHTSTG_createBattleScript): its kind and motions f...
Definition techs.c:150
void WFIGHTMN_endWeakness(u8 side)
In BATTLE_KIND_FINAL_LAST, anything the partner does but an attack ends the enemy's weakness (FIGHTST...
Definition techs.c:312
s32 WFIGHTMN_setIdleMotion(u8 id, s32 damage)
Sets the idle motion of side id >> 4's fighter: 1 (weak) if damage leaves it with a quarter of its HP...
Definition techs.c:280
CameraShots * cameraShots
the European version's (FIGHTSTG_startCameraShots)
Definition task.h:30
Entrance * entrance
a fighter's (FIGHTSTG_startEntrance)
Definition task.h:20
BattleMessageBox * message
FIGHTSTG_createMessage.
Definition task.h:18
DigimonChange * change
a partner's Digimon change (FIGHTSTG_startDigimonChange)
Definition task.h:21
ScreenFade * fade
FIGHTSTG_createFader.
Definition task.h:31
Task * task
Definition task.h:17
HitEffect * hitEffect
effect 0x33, then a script (FIGHTSTG_startHitEffect)
Definition task.h:26
FirstTech * attack
FIGHTSTG_startFirstTech.
Definition task.h:22
BattleScript * script
a technique's (FIGHTSTG_createBattleScript)
Definition task.h:19
TechAction * tech
a technique or an item (FIGHTSTG_startTechAction)
Definition task.h:23
EnemyTurn * enemyTurn
FIGHTSTG_startEnemyTurn.
Definition task.h:27
EnemyAttack * enemyAttack
an attack on the player's fighter (FIGHTSTG_startEnemyAttack)
Definition task.h:25
OneHpTurn * oneHpTurn
BATTLE_KIND_FINAL_SECOND's enemy turn (FIGHTSTG_startOneHpTurn)
Definition task.h:28
BattleItem * item
FIGHTSTG_startItem.
Definition task.h:24
CameraTurn * cameraTurn
when the player loses (FIGHTSTG_startCameraTurn)
Definition task.h:29
ElementLook WFIGHTMN_elementVisuals[]
A technique's look (its scriptEffect, scriptSound and scriptStage) by its element,...
Definition wfightmn_2.c:37
EffectLook WFIGHTMN_effectVisuals[]
A technique's look (its scriptEffect and scriptSound) by its effect, for WFIGHTMN_bringLastEnemy; the...
Definition wfightmn_2.c:24
void(* WFIGHTMN_states[])(BattleMenu *task, BattleMenuChildren *children)
The battle menu's states, by its substate.
Definition wfightmn_2.c:47