Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
events.c
Go to the documentation of this file.
1/* FIGHTSTG's events: the queue of the battle's events in time
2 (FIGHTSTG_events), and the functions that queue turns, statuses, recovery
3 and the end of boosts: one module, as the original's jump tables are
4 8-aligned from its start and a cut between these would move the second
5 one's. */
6
8
9/* FIGHTSTG_events.funcs.push: queues an event in the first free one of the
10 99 slots, due after its delay */
12 s32 i = 0;
13 s32 free = -1;
14
15 for (; i < 99; i++) {
16 if (FIGHTSTG_events.events[i].type == 0) {
17 free = i;
18 break;
19 }
20 }
21 if (free != -1) {
22 FIGHTSTG_events.events[free].type = event->type;
23 FIGHTSTG_events.events[free].time = event->delay;
24 for (i = 0; i < 6; i++) {
25 FIGHTSTG_events.events[free].args[i] = event->args[i];
26 }
27 }
28}
29
30/* per event type, whether FIGHTSTG_popEvent takes (1), peeks at (-1) or
31 drops (0) it */
33 0, 1, 1, 1,
34 -1, 1, -1, 1,
35 1, -1, 1, 1,
36 1, 1, 1, 1,
37 1, 1, 1, 1,
38 1, 1, 1, 1,
39 1, 0,
40};
41
42/* the battle's events and their functions */
51
52/* FIGHTSTG_events.funcs.pushFirst: queues an event ahead of all the others,
53 which wait its delay longer (at least 1, 2 in the European version) */
55 s32 i;
56
57#if VERSION_US
58 if (event->delay <= 0) {
59 event->delay = 1;
60 }
61#elif VERSION_EU || VERSION_JP
62 if (event->delay < 2) {
63 event->delay = 2;
64 }
65#endif
66 for (i = 0; i < 99; i++) {
67 if (FIGHTSTG_events.events[i].type != 0) {
68 FIGHTSTG_events.events[i].time += event->delay;
69 }
70 }
71#if VERSION_US
72 event->delay = 0;
73#elif VERSION_EU || VERSION_JP
74 event->delay = 1;
75#endif
76 FIGHTSTG_pushEvent(event);
77}
78
79/* Pops the next event: the one due soonest (in EU, events of types 2 and 3
80 give way to any due no later), moving all the others' times on by its.
81 Returns its type, or 0 when there's none or FIGHTSTG_eventPopModes says to
82 drop it. */
84 s32 min = 0x7FFF;
85 s32 best = -1;
86 s32 i;
87 s32 time;
88#if VERSION_EU || VERSION_JP
89 QueuedEvent *event;
90#endif
91 s32 type;
92
93 for (i = 0; i < 99; i++) {
94 if (FIGHTSTG_events.events[i].type != 0) {
95#if VERSION_EU || VERSION_JP
96 if (best != -1 && FIGHTSTG_events.events[i].time <= FIGHTSTG_events.events[best].time &&
98 best = i;
100 }
101#endif
102 if (FIGHTSTG_events.events[i].time < min) {
103 best = i;
104 min = FIGHTSTG_events.events[i].time;
105 }
106 }
107 }
108 if (best == -1) {
109 return 0;
110 }
111#if VERSION_US
112 time = FIGHTSTG_events.events[best].time;
113 for (i = 0; i < 99; i++) {
114 if (FIGHTSTG_events.events[i].type != 0) {
115 FIGHTSTG_events.events[i].time -= time;
116 }
117 }
120 case 0:
121 return 0;
122 case -1:
123 type = FIGHTSTG_events.events[best].type;
125 return type;
126 default:
127 type = FIGHTSTG_events.events[best].type;
129 FIGHTSTG_events.events[best].type = 0;
130 return type;
131 }
132#elif VERSION_EU || VERSION_JP
133 event = &FIGHTSTG_events.events[best];
134 time = event->time;
135 for (i = 0; i < 99; i++) {
136 if (FIGHTSTG_events.events[i].type != 0) {
137 FIGHTSTG_events.events[i].time -= time;
138 }
139 }
140 FIGHTSTG_events.curType = event->type;
142 case 0:
143 return 0;
144 case -1:
145 type = event->type;
147 return type;
148 default:
149 type = event->type;
150 event->type = 0;
152 return type;
153 }
154#endif
155}
156
157/* The first queued event from slot start of the type being looked for
158 (FIGHTSTG_events.findType, 1-24), or -1 */
161 s32 i;
162
163 if (type < 1 || type > 24) {
164 return -1;
165 }
166 for (i = start; i < 99; i++) {
167 if (FIGHTSTG_events.events[i].type == type) {
168 return i;
169 }
170 }
171 return -1;
172}
173
174/* FIGHTSTG_events.funcs.first: the first queued event of type, or -1 */
179
180/* FIGHTSTG_events.funcs.next: the next queued event of the same type, or -1 */
184
185/* FIGHTSTG_events.funcs.find: the first queued event of type for side's
186 fighter, or -1 */
198
199/* FIGHTSTG_events.funcs.remove: drops every queued event of key's side and
200 fighter */
202 s32 i;
203 s32 fighter = key->fighter;
204 s32 side = key->side;
205
206 for (i = 0; i < 99; i++) {
207 if (FIGHTSTG_events.events[i].type != 0 && FIGHTSTG_events.events[i].args[0] == side && FIGHTSTG_events.events[i].args[1] == fighter) {
209 }
210 }
211}
212
213/* the delay ranges of FIGHTSTG_getEventDelay's kinds */
215 { 1000, 707, 1414 }, { 250, 176, 353 }, { 2001, 1001, 0 }, { 2000, 0, 0 },
216 { 2500, 0, 0 }, { 3000, 0, 0 }, { 3500, 0, 0 }, { 4000, 0, 0 },
217 { 0, 2000, 6000 }, { 500, 1000, 0 }, { 500, 1000, 0 }, { 500, 500, 0 },
218 { 2001, 0, 0 },
219};
220
221/* FIGHTSTG_events.funcs.getDelay: the time until side's next event of kind
222 (FIGHTSTG_eventDelays): random, or from the active fighters' stats and
223 the other side's resistances, within the kind's range */
225 s32 delay;
226
227 /* the match depends on each case having its own row and stats */
228 switch (kind) {
229 case 2: {
230 s32 row = side != 0;
232
233 delay = RANDOM.next() % FIGHTSTG_eventDelays[kind].div + own->stats[BATTLE_STAT_SPIRIT] * 10;
234 break;
235 }
236 case 8:
237 delay = RANDOM.next() % 8001;
238 break;
239 case 9: {
240 s32 row = side != 0;
242 BattleStats *other = FIGHTSTG_battleFuncs.computeStats((side == 0) << 4, 0, FIGHTSTG_battle.state.active[1 - row]);
243
245 - (other->resist[RESIST_PARALYSIS] + other->resist[4]) * 8;
246 break;
247 }
248 case 10: {
249 s32 row = side != 0;
251 BattleStats *other = FIGHTSTG_battleFuncs.computeStats((side == 0) << 4, 0, FIGHTSTG_battle.state.active[1 - row]);
252
254 - (other->resist[RESIST_CONFUSION] + other->resist[3]) * 8;
255 break;
256 }
257 case 11: {
258 s32 row = side != 0;
260 BattleStats *other = FIGHTSTG_battleFuncs.computeStats((side == 0) << 4, 0, FIGHTSTG_battle.state.active[1 - row]);
261
263 - (other->resist[RESIST_SLEEP] + other->resist[2]) * 8;
264 break;
265 }
266 case 12: {
267 s32 row = side != 0;
269
270 delay = RANDOM.next() % FIGHTSTG_eventDelays[kind].div + 2000 + own->stats[BATTLE_STAT_SPIRIT] * 10;
271 break;
272 }
273 default: {
274 s32 row = side != 0;
277 s32 square = own->stats[BATTLE_STAT_SPEED] * other->stats[BATTLE_STAT_SPEED];
278 s32 root = 999;
279 s32 i;
280
281 /* Newton's square root */
282 for (i = 0; i < 10; i++) {
283 root = (root + square / root) / 2;
284 }
285 delay = FIGHTSTG_eventDelays[kind].div * other->stats[BATTLE_STAT_SPEED] / root;
286 break;
287 }
288 }
289 if (FIGHTSTG_eventDelays[kind].min != 0 && delay < FIGHTSTG_eventDelays[kind].min) {
290 delay = FIGHTSTG_eventDelays[kind].min;
291 }
292 if (FIGHTSTG_eventDelays[kind].max != 0 && delay > FIGHTSTG_eventDelays[kind].max) {
293 delay = FIGHTSTG_eventDelays[kind].max;
294 }
295 return delay;
296}
297
298/* the status events FIGHTSTG_cureStatus clears, by kind of status, */
303/* and the flags it clears with them (all six for kind 3) */
307
308/* An item's cure (FIGHTSTG_events.funcs.cureStatus): items 0xBE-0xC5 clear a
309 status of the fighter and remove its events, 0xC4 and 0xC5 all of them */
310void FIGHTSTG_cureStatus(u8 side, s32 fighter, s32 item) {
311 s32 kind;
312 s32 index;
313 BattleFighter *fighters;
314 s32 i;
315 s32 row;
316
317 switch (item) {
318 case 0xBE:
319 case 0xBF:
320 default:
321 kind = 0;
322 break;
323 case 0xC0:
324 case 0xC1:
325 kind = 1;
326 break;
327 case 0xC2:
328 case 0xC3:
329 kind = 2;
330 break;
331 case 0xC4:
332 case 0xC5:
333 kind = 3;
334 break;
335 }
336 /* the match depends on the row local, and on kind becoming the event type */
337 row = side != 0;
338 fighters = FIGHTSTG_battle.state.fighters[row];
339 if (fighters[fighter].id == 0) {
340 return;
341 }
342 fighters[fighter].flags &= ~FIGHTSTG_statusFlags[kind];
343 if (kind != 3) {
344 kind = FIGHTSTG_statusEvents[kind];
345 index = FIGHTSTG_events.funcs.find(kind, side, fighter);
346 if (index >= 0) {
347 FIGHTSTG_events.events[index].type = 0;
348 }
349 } else {
350 for (i = 0; i < 6; i++) {
351 index = FIGHTSTG_events.funcs.find(FIGHTSTG_statusEvents[i], side, fighter);
352 if (index >= 0) {
353 FIGHTSTG_events.events[index].type = 0;
354 }
355 }
356 }
357}
358
359/* Queues the player's turn (event 2) in delay */
366
367/* Queues the enemy's turn (event 3) in delay */
374
375/* Ends the battle: queues event 1 ahead of the others, with how it ended
376 (BATTLE_FLED, BATTLE_WON or BATTLE_LOST) for WFIGHTMN */
384
385/* Queues side's attempt to run away (event 4) */
393
394/* Queues the end of side's automatic recovery (item 0xBD), or pushes back the
395 one already queued */
397 s32 other = side != 0;
399 s32 time = FIGHTSTG_getEventDelay(side, 2);
400
401 if (i >= 0) {
402 QueuedEvent *queued = &FIGHTSTG_events.events[i];
403
404 queued->time = time;
405 } else {
408 FIGHTSTG_newEvent.args[0] = side;
410 FIGHTSTG_newEvent.args[2] = 0xBD;
412 }
413}
414
415/* Queues a fighter's recovery of HP (event 6, with what getHeal takes as
416 big), or sets the one already queued to 0xBD */
417void FIGHTSTG_queueRecovery(u8 side, s32 fighter, s32 big) {
418 s32 i = FIGHTSTG_findEvent(EVENT_RECOVERY, side, fighter);
419
420 if (i >= 0) {
421 QueuedEvent *queued = &FIGHTSTG_events.events[i];
422
423 queued->args[2] = 0xBD;
424 } else {
427 FIGHTSTG_newEvent.args[0] = side;
428 FIGHTSTG_newEvent.args[1] = fighter;
429 FIGHTSTG_newEvent.args[2] = big;
431 }
432}
433
434/* Queues the field's clearing in time (at most 0x7FFF), or moves the one
435 already queued to it */
437 s32 i;
438
441 if (time > 0x7FFF) {
442 time = 0x7FFF;
443 }
444 if (i >= 0) {
445 FIGHTSTG_events.events[i].time = time;
446 } else {
449 FIGHTSTG_newEvent.args[0] = -1;
451 }
452}
453
454/* Poisons a fighter (FIGHTER_POISONED), and queues its damage or updates the
455 one already queued */
456void FIGHTSTG_inflictPoison(u8 side, s32 fighter, s32 damage) {
457 s32 i = FIGHTSTG_findEvent(EVENT_STATUS_DAMAGE, side, fighter);
458 s32 other;
459 BattleFighter *entry;
460
461 if (i >= 0) {
462 QueuedEvent *queued = &FIGHTSTG_events.events[i];
463
464 queued->args[2] = damage;
465 } else {
468 FIGHTSTG_newEvent.args[0] = side;
469 FIGHTSTG_newEvent.args[1] = fighter;
470 FIGHTSTG_newEvent.args[2] = damage;
472 }
473 other = side != 0;
474 entry = &FIGHTSTG_battle.state.fighters[other][fighter];
475 entry->flags |= FIGHTER_POISONED;
476}
477
478/* Paralyzes side's active fighter (FIGHTER_PARALYZED) with a strength, and
479 queues its end, which the strength puts off, or pushes back the one
480 already queued */
481void FIGHTSTG_inflictParalysis(u8 side, s32 unused, u8 strength) {
482 s32 other = side != 0;
484 s32 time;
485 BattleFighter *entry;
486
488 time = FIGHTSTG_getEventDelay(side, 9);
489 if (i >= 0) {
490 FIGHTSTG_events.events[i].time = time;
491 } else {
494 FIGHTSTG_newEvent.args[0] = side;
497 }
499 entry->paralysis = strength;
500 entry->flags |= FIGHTER_PARALYZED;
501}
502
503/* Confuses side's active fighter (FIGHTER_CONFUSED) with a strength, and
504 queues its end (put off by the strength when a technique, fromTech,
505 causes it) or pushes back the one already queued */
506void FIGHTSTG_inflictConfusion(u8 side, s32 fromTech, u8 strength) {
507 s32 other = side != 0;
509 s32 time;
510 BattleFighter *entry;
511
512 if (fromTech == 0) {
513 time = FIGHTSTG_getEventDelay(side, 8);
514 } else {
516 time = FIGHTSTG_getEventDelay(side, 10);
517 }
518 if (i >= 0) {
519 FIGHTSTG_events.events[i].time = time;
520 } else {
523 FIGHTSTG_newEvent.args[0] = side;
526 }
528 entry->confusion = strength;
529 entry->flags |= FIGHTER_CONFUSED;
530}
531
532/* Puts side's active fighter to sleep (FIGHTER_ASLEEP) with a strength, and
533 queues its end, which the strength puts off, or pushes back the one
534 already queued */
535void FIGHTSTG_inflictSleep(u8 side, s32 unused, u8 strength) {
536 s32 other = side != 0;
538 s32 time;
539 BattleFighter *entry;
540
542 time = FIGHTSTG_getEventDelay(side, 11);
543 if (i >= 0) {
544 FIGHTSTG_events.events[i].time = time;
545 } else {
548 FIGHTSTG_newEvent.args[0] = side;
551 }
553 entry->sleep = strength;
554 entry->flags |= FIGHTER_ASLEEP;
555}
556
557/* the event types of FIGHTSTG_queueBoostEnd, by the stat boosted */
561
562/* Queues the end of a fighter's boost of stat kind, 12 frames on when a
563 technique (tech) gave it and 8 when an item did (tech 0), or pushes back
564 the one already queued */
565void FIGHTSTG_queueBoostEnd(u8 side, s32 fighter, s32 kind, s32 tech) {
566 s32 i = FIGHTSTG_findEvent(FIGHTSTG_boostEvents[kind], side, fighter);
567 s32 time;
568
569 if (tech != 0) {
570 time = FIGHTSTG_getEventDelay(side, 12);
571 } else {
572 time = FIGHTSTG_getEventDelay(side, 8);
573 }
574 if (i >= 0) {
575 FIGHTSTG_events.events[i].time = time;
576 } else {
579 FIGHTSTG_newEvent.args[0] = side;
580 FIGHTSTG_newEvent.args[1] = fighter;
581 FIGHTSTG_newEvent.args[2] = kind;
583 }
584}
Battle FIGHTSTG_battle
the battle: its fighters, speed and drawing functions
Definition battle.c:16
BattleFuncs FIGHTSTG_battleFuncs
the battle's stats and the functions that compute with them
Definition battle.c:25
#define FIGHTER_PARALYZED
loses turns at random (FIGHTSTG_battleFuncs.testParalysis)
Definition battle.h:183
#define EVENT_AUTO_RECOVER_END
Definition battle.h:85
#define EVENT_STATUS_DAMAGE
the damage of a poisoned fighter (FIGHTER_POISONED)
Definition battle.h:89
#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 FIGHTER_POISONED
BattleFighter.flags: the statuses, which the techniques give (FIGHTSTG_inflict*) and events of type E...
Definition battle.h:182
#define BATTLE_STAT_SPEED
physical accuracy, evasion and running away
Definition battle.h:33
#define EVENT_CLEAR_FIELD
Definition battle.h:87
#define EVENT_PLAYER_TURN
Definition battle.h:82
#define EVENT_BOOST_END
13-15: the end of a boost, by the stat
Definition battle.h:91
#define BATTLE_STAT_SPIRIT
magic damage, and against it
Definition battle.h:31
#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 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 RESIST_PARALYSIS
Definition battle.h:48
#define FIGHTER_ASLEEP
can't act or run away; a hit may wake it up
Definition battle.h:185
#define RESIST_SLEEP
Definition battle.h:50
#define SIDE_ENEMY
Definition battle.h:178
#define RESIST_CONFUSION
Definition battle.h:49
#define FIGHTER_CONFUSED
Definition battle.h:184
s32 FIGHTSTG_findNextEvent(void)
FIGHTSTG_events.funcs.next: the next queued event of the same type, or -1.
Definition events.c:181
void FIGHTSTG_cureStatus(u8 side, s32 fighter, s32 item)
An item's cure (FIGHTSTG_events.funcs.cureStatus): items 0xBE-0xC5 clear a status of the fighter and ...
Definition events.c:310
EventDelay FIGHTSTG_eventDelays[]
the delay ranges of FIGHTSTG_getEventDelay's kinds
Definition events.c:214
void FIGHTSTG_inflictConfusion(u8 side, s32 fromTech, u8 strength)
Confuses side's active fighter (FIGHTER_CONFUSED) with a strength, and queues its end (put off by the...
Definition events.c:506
void FIGHTSTG_queueRecovery(u8 side, s32 fighter, s32 big)
Queues a fighter's recovery of HP (event 6, with what getHeal takes as big), or sets the one already ...
Definition events.c:417
void FIGHTSTG_queueAutoRecoverEnd(u8 side)
Queues the end of side's automatic recovery (item 0xBD), or pushes back the one already queued.
Definition events.c:396
void FIGHTSTG_queueClearField(s32 time)
Queues the field's clearing in time (at most 0x7FFF), or moves the one already queued to it.
Definition events.c:436
void FIGHTSTG_pushEventFirst(BattleEvent *event)
FIGHTSTG_events.funcs.pushFirst: queues an event ahead of all the others, which wait its delay longer...
Definition events.c:54
void FIGHTSTG_inflictParalysis(u8 side, s32 unused, u8 strength)
Paralyzes side's active fighter (FIGHTER_PARALYZED) with a strength, and queues its end,...
Definition events.c:481
s32 FIGHTSTG_boostEvents[]
the event types of FIGHTSTG_queueBoostEnd, by the stat boosted
Definition events.c:558
void FIGHTSTG_inflictPoison(u8 side, s32 fighter, s32 damage)
Poisons a fighter (FIGHTER_POISONED), and queues its damage or updates the one already queued.
Definition events.c:456
void FIGHTSTG_removeEvents(EventKey *key)
FIGHTSTG_events.funcs.remove: drops every queued event of key's side and fighter.
Definition events.c:201
u8 FIGHTSTG_statusFlags[]
and the flags it clears with them (all six for kind 3)
Definition events.c:304
s32 FIGHTSTG_eventPopModes[]
per event type, whether FIGHTSTG_popEvent takes (1), peeks at (-1) or drops (0) it
Definition events.c:32
s32 FIGHTSTG_getEventDelay(u8 side, s32 kind)
FIGHTSTG_events.funcs.getDelay: the time until side's next event of kind (FIGHTSTG_eventDelays): rand...
Definition events.c:224
void FIGHTSTG_inflictSleep(u8 side, s32 unused, u8 strength)
Puts side's active fighter to sleep (FIGHTER_ASLEEP) with a strength, and queues its end,...
Definition events.c:535
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_pushEvent(BattleEvent *event)
FIGHTSTG_events.funcs.push: queues an event in the first free one of the 99 slots,...
Definition events.c:11
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
u8 FIGHTSTG_statusEvents[]
the status events FIGHTSTG_cureStatus clears, by kind of status,
Definition events.c:299
s32 FIGHTSTG_findEventFrom(s32 start)
The first queued event from slot start of the type being looked for (FIGHTSTG_events....
Definition events.c:159
s32 FIGHTSTG_findEvent(s32 type, u8 side, s32 fighter)
FIGHTSTG_events.funcs.find: the first queued event of type for side's fighter, or -1.
Definition events.c:187
s32 FIGHTSTG_findFirstEvent(s32 type)
FIGHTSTG_events.funcs.first: the first queued event of type, or -1.
Definition events.c:175
s32 FIGHTSTG_popEvent(void)
Pops the next event: the one due soonest (in EU, events of types 2 and 3 give way to any due no later...
Definition events.c:83
void FIGHTSTG_queueEnemyTurn(s32 delay)
Queues the enemy's turn (event 3) in delay.
Definition events.c:368
void FIGHTSTG_queueBoostEnd(u8 side, s32 fighter, s32 kind, s32 tech)
Queues the end of a fighter's boost of stat kind, 12 frames on when a technique (tech) gave it and 8 ...
Definition events.c:565
FIGHTSTG.PRO: the battle.
signed int s32
Definition common.h:11
unsigned char u8
Definition common.h:8
BattleEvent FIGHTSTG_newEvent
what FIGHTSTG_pushEvent is given
Random RANDOM
Definition random.c:533
Task * start(void)
The mode's entry point (MODE_ENTRY_POINTS): starts its root task (update_scene.inc....
Definition start.inc.c:3
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
u8 sleep
FIGHTER_ASLEEP's.
Definition battle.h:206
u8 confusion
FIGHTER_CONFUSED's.
Definition battle.h:207
BattleStats *(* computeStats)(u8 side, s32 which, s32 index)
Definition battle.h:331
s32 active[2]
each side's fighter
Definition battle.h:226
BattleFighter fighters[2][3]
Definition battle.h:227
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 resist[12]
Definition battle.h:308
BattleState state
Definition battle.h:240
An event kind's delay range (FIGHTSTG_eventDelays, by kind): FIGHTSTG_getEventDelay adds a random par...
Definition battle.h:155
s16 min
Definition battle.h:157
s16 div
Definition battle.h:156
s16 max
Definition battle.h:158
What FIGHTSTG_removeEvents removes the events of: an event's first two args, as FIGHTSTG_queueRecover...
Definition battle.h:117
s32 fighter
its index in the side's fighters
Definition battle.h:119
u8 side
SIDE_PLAYER or SIDE_ENEMY.
Definition battle.h:118
u8 statusStrength
getDelay's, for the end of a status (kinds 9 to 11)
Definition battle.h:140
u8 result
the battle's, for WFIGHTMN (BATTLE_FLED...)
Definition battle.h:139
s32(* find)(s32 type, u8 side, s32 fighter)
Definition battle.h:146
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
s8 findType
what first and next look for, 1-24
Definition battle.h:169
s8 curType
the type of the event popped last
Definition battle.h:167
s8 found
the event they found, or -1
Definition battle.h:170
QueuedEvent events[99]
Definition battle.h:165
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