Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
battle_script.c
Go to the documentation of this file.
1/* FIGHTSTG's battle scripts: the commands of a fighter's script (models,
2 effects, camera, waits, stage, sounds and fades) and its task. The
3 European version has the camera turn here too (camera_turn.h), which the
4 USA one has in camera_task.c. */
5
7
8/* The model a script command names by TYPE: 0 the script's own side's, 1-3
9 the partner's slots and 4-6 the enemy's */
11 switch (type) {
12 case 0:
13 default:
14 return script->enemy != 0 ? 0x10 : 0;
15 case 1:
16 return 0;
17 case 2:
18 return 1;
19 case 3:
20 return 2;
21 case 4:
22 return 0x10;
23 case 5:
24 return 0x11;
25 case 6:
26 return 0x12;
27 }
28}
29
30/* The battle script's hit command: 0 starts the other side's script for the
31 last hit's result, 5 the one for the next hit's */
33 s32 hit;
34
35 switch (*script->pc++) {
36 case 0:
37 if (children->script != NULL) {
38 children->script->destroy(children->script);
39 }
41 children->script->enemy = script->enemy == 0;
42 children->script->index = script->hits[3] + 1;
43 break;
44 /* these cases do nothing, but the match depends on them: they shape the
45 tree of tests the switch is compiled to */
46 case 1:
47 case 2:
48 case 3:
49 case 4:
50 break;
51 case 5:
52 if (children->script != NULL) {
53 children->script->destroy(children->script);
54 }
56 children->script->enemy = script->enemy == 0;
57 switch (script->hitsPlayed) {
58 case 0:
59 default:
60 hit = script->hits[0];
61 break;
62 case 1:
63 hit = script->hits[1];
64 break;
65 case 2:
66 hit = script->hits[2];
67 break;
68 }
69 children->script->index = hit + 1;
70 script->hitsPlayed++;
71 break;
72 }
73}
74
75/* Model command 0 with 1: puts the model back to its idle motion. */
76static inline void playIdleMotion(ModelControl *control) {
77 control->motionDone = 0;
78 control->motion = control->idleMotion + 1;
79}
80
81/* Model command 0 with any other MOTION: plays the model's motion MOTION
82 from its start. */
83static inline void playMotion(ModelControl *control, s32 motion) {
84 control->motion = motion + 1;
85 control->restart = 1;
86 control->motionDone = 0;
87}
88
89/* Model command 4: sets the model's rotation from the script. */
90static inline void turnModel(BattleScript *script, ModelControl *control) {
91 control->rot.x = *script->pc++;
92 control->rot.y = -*script->pc++;
93 control->rot.z = -*script->pc++;
94 script->pc++;
95}
96
97/* Model command 5: replaces the model's jump with a new one of kind KIND
98 (DISTANCE only for kind 4). */
99static inline void startModelJump(BattleScriptChildren *children, ModelControl *control, s32 kind, s32 distance) {
100 if (children->jump != NULL) {
101 children->jump->destroy(children->jump);
102 }
103 children->jump = FIGHTSTG_startJump(control, kind, distance);
104}
105
106/* Model command 6: adds fighter FIGHTER's model to the battle as model ID. */
107static inline void addModel(s32 id, s32 fighter) {
109
110 models->add(models, id, fighter, 0);
111}
112
113/* Model command 7: moves the model back home over the script's time, or at
114 once when it is 0. */
115static inline void moveModelHome(BattleScript *script, BattleScriptChildren *children, ModelControl *control) {
116 s32 time = *script->pc++;
117
118 if (time != 0) {
119 children->move = FIGHTSTG_startMove(control, &control->homePos, time);
120 } else {
121 control->pos.x = control->homePos.x;
122 control->pos.y = control->homePos.y;
123 control->pos.z = control->homePos.z;
124 }
125}
126
127/* Model command 9: removes model ID from the battle. */
128static inline void removeModel(s32 id) {
130
131 models->remove(models, id);
132}
133
134/* The battle script's model command, on the model given by FIGHTSTG_getScriptModel:
135 0 plays a motion (0 waits for the one playing, 1 goes back to idle), 1
136 and 2 turn layers[0] on and off, 3 moves it to a position in the script
137 (over a time, or at once when it is 0), 4 turns it, 5 makes it jump (0
138 waits for the jump), 6 adds a model (waiting while its file loads in
139 script 12), 7 moves it home, 8 0x2800 from home and 9 removes it.
140 Returning 0 runs the command again. The match depends on each case's
141 time being its own and on case 3's being read before the position. */
143 ShortVec3 pos;
144 s32 arg = 0;
145 ModelControl *control = NULL;
146 s32 cmd = *script->pc++;
147 s32 id = FIGHTSTG_getScriptModel(script, *script->pc++);
148
149 switch (cmd) {
150 case 1:
151 case 2:
152 case 3:
153 case 4:
154 case 7:
155 case 8:
156 case 9:
157 break;
158 default:
159 arg = *script->pc++;
160 break;
161 }
162 if (cmd != 6 && cmd != 9) {
163 control = script->models->get(script->models, id);
164 }
165 switch (cmd) {
166 case 0:
167 switch (arg) {
168 case 0:
169 if (control->motionDone == 0) {
170 script->pc -= 4;
171 return 0;
172 }
173 return 1;
174 case 1:
175 playIdleMotion(control);
176 break;
177 default:
178 playMotion(control, arg);
179 break;
180 }
181 break;
182 case 5:
183 switch (arg) {
184 case 0:
185 if (children->jump == NULL) {
186 return 1;
187 }
188 if (children->jump->state < 2) {
189 script->pc -= 4;
190 return 0;
191 }
192 return 1;
193 case 1:
194 case 2:
195 case 3:
196 case 5:
197 case 6:
198 startModelJump(children, control, arg, 0);
199 break;
200 case 4:
201 startModelJump(children, control, arg, *script->pc++);
202 break;
203 }
204 break;
205 case 1:
206 control->layers[0].enabled = 1;
207 return 1;
208 case 2:
209 control->layers[0].enabled = 0;
210 break;
211 case 3: {
212 s32 time = script->pc[3];
213
214 pos.x = script->pc[0];
215 pos.y = -script->pc[1];
216 pos.z = -script->pc[2];
217 script->pc += 4;
218 if (time != 0) {
219 children->move = FIGHTSTG_startMove(control, &pos, time);
220 } else {
221 control->pos.x = pos.x;
222 control->pos.y = pos.y;
223 control->pos.z = pos.z;
224 }
225 break;
226 }
227 case 4:
228 turnModel(script, control);
229 break;
230 case 6:
231 if (script->index == 12 && FILE_CACHE.isLoading(FIGHTSTG_fighterCache.funcs.getInfo(arg)->model >> 16)) {
232 script->pc -= 4;
233 return 0;
234 }
235 addModel(id, arg);
236 return 1;
237 case 7:
238 moveModelHome(script, children, control);
239 break;
240 case 8: {
241 s32 time = *script->pc++;
242
243 pos.x = control->homePos.x;
244 pos.y = control->homePos.y;
245 if (id & 0xF0) {
246 pos.z = control->homePos.z - 0x2800;
247 } else {
248 pos.z = control->homePos.z + 0x2800;
249 }
250 if (time != 0) {
251 children->move = FIGHTSTG_startMove(control, &pos, time);
252 } else {
253 control->pos.x = pos.x;
254 control->pos.y = pos.y;
255 control->pos.z = pos.z;
256 }
257 break;
258 }
259 case 9:
260 removeModel(id);
261 break;
262 }
263 return 1;
264}
265
266/* The battle script's effect command: 0 starts sprite effect EFFECT (9999 the
267 script's own) at a position in the script, 1 loads its images and sheet,
268 running again until they are in. Returning 0 runs the command again */
270 SVECTOR pos;
271 TimLoader loader;
272 s32 mode = *script->pc++;
273 s32 effect = *script->pc++;
274 s32 i;
275
276 if (effect == 9999) {
277 effect = script->effect;
278 }
279 switch (mode) {
280 case 0:
281 default:
282 pos.vx = *script->pc++;
283 pos.vy = *script->pc++;
284 pos.vz = *script->pc++;
285 for (i = 0; i < 8; i++) {
286 if (children->spriteEffects[i] == NULL) {
287 children->spriteEffects[i] = FIGHTSTG_startSpriteEffect(effect, &pos);
288 break;
289 }
290 }
291 break;
292 case 1:
293 switch (script->loadStep) {
294 case 0:
295 default:
296 if (!FIGHTSTG_findEffectSheet(effect, &script->effectImages, &script->effectSheet, &script->effectTexPos)) {
297 break;
298 }
299 script->loadStep++;
300 /* fallthrough */
301 case 1:
302 if (script->effectImages == 0 || !FILE_CACHE.isLoading(script->effectImages >> 16)) {
303 script->loadStep++;
304 }
305 script->pc -= 3;
306 return 0;
307 case 2:
308 if (script->effectImages != 0) {
309 initTimLoader(&loader);
310 loader.setImagePos(script->effectTexPos.x, script->effectTexPos.y);
312 }
313 script->loadStep++;
314 /* fallthrough */
315 case 3:
316 if (script->effectSheet != 0 && FILE_CACHE.isLoading(script->effectSheet >> 16)) {
317 script->pc -= 3;
318 } else {
319 script->loadStep = 0;
320 }
321 return 0;
322 }
323 }
324 return 1;
325}
326
327/* The battle script's effect model command: 0 starts effect model ID at a
328 position and rotation in the script (their y and z negated), 1 waits while
329 its file loads. Returning 0 runs the command again */
331 SVECTOR pos;
332 SVECTOR rot;
333 s32 mode = *script->pc++;
334 s32 id = *script->pc++;
335 s32 file;
336 s32 i;
337
338 switch (mode) {
339 case 0:
340 default:
341 pos.vx = *script->pc++;
342 pos.vy = -*script->pc++;
343 pos.vz = -*script->pc++;
344 rot.vx = *script->pc++;
345 rot.vy = -*script->pc++;
346 rot.vz = -*script->pc++;
347 for (i = 0; i < 3; i++) {
348 if (children->effects[i] == NULL) {
349 children->effects[i] = FIGHTSTG_startEffectModel(id, &pos, &rot);
350 break;
351 }
352 }
353 break;
354 case 1:
356 if (file != 0 && FILE_CACHE.isLoading(file)) {
357 script->pc -= 3;
358 return 0;
359 }
360 break;
361 }
362 return 1;
363}
364
365/* The battle script's camera command: the time of the fade (0 to cut),
366 then the enemy's view, a fighter's or one given in the script */
369 s32 time = *script->pc++;
370 /* the match depends on pc, which points at the mode, and on view */
371 s16 *pc = script->pc;
373 s32 id;
374
375 switch (*script->pc++) {
376 case 0:
377 default:
378 id = *script->pc++;
379 switch (id) {
380 case 0:
381 default:
382 camera->getEnemyView(camera);
383 break;
384 case 1:
385 case 2:
386 case 3:
387 case 4:
388 camera->getFighterView(camera, 0, id + 7);
389 break;
390 case 5:
391 case 6:
392 case 7:
393 camera->getFighterView(camera, 0x10, id - 5);
394 break;
395 }
396 break;
397 case 1:
398 view->vpx = pc[1];
399 view->vpy = -pc[2];
400 view->vpz = -pc[3];
401 view->vrx = pc[4];
402 view->vry = -pc[5];
403 view->vrz = -pc[6];
404 view->tx = pc[7];
405 view->ty = -pc[8];
406 view->tz = -pc[9];
407 view->rot.vx = pc[10];
408 view->rot.vy = -pc[11];
409 view->rot.vz = -pc[12];
410 view->rz = pc[13];
411 view->proj = pc[14];
412 script->pc = pc + 15;
413 break;
414 }
415 if (time != 0) {
416 camera->fade(camera, NULL, view, time);
417 } else {
418 camera->set(camera, view);
419 }
420}
421
422/* The battle script's wait command: waits the time in the script, returning 0
423 until it is over */
425 switch (script->waiting) {
426 case 0:
427 default:
428 script->wait = *script->pc;
429 script->waiting = 1;
430 script->pc--;
431 return 0;
432 case 1:
433 script->wait -= GFX.funcs.getFrameTime();
434 script->pc--;
435 if (script->wait > 0) {
436 return 0;
437 }
438 script->waiting = 0;
439 script->wait = 0;
440 script->pc += 2;
441 return 1;
442 }
443}
444
445/* The battle script's stage command (0x38 the script's own stage, -1 none): 0
446 changes the fight stage (0 the battle's) with the fade times in the script,
447 keeping the partner's idle motion aside on stage 0x1D and bringing it back
448 on 0x1E; 1 waits while the stage's motions load. Returning 0 runs the
449 command again */
452 s32 mode = *script->pc++;
453 s32 id = *script->pc++;
454 s32 fadeOut;
455 s32 fadeIn;
456 s32 motions;
457 ModelControl *control;
458
459 if (id == 0x38) {
460 id = script->stage;
461 }
462 if (id == -1) {
463 return 1;
464 }
465 switch (mode) {
466 case 0:
467 default:
468 fadeOut = *script->pc++;
469 fadeIn = *script->pc++;
470 if (id == 0) {
471 id = BATTLE_SETUP.stage;
472 }
473 stage->setStage(stage, id, fadeOut, fadeIn);
474 switch (id) {
475 case 0x1D:
476 control = script->models->get(script->models, 0);
478 control->idleMotion = 0;
479 break;
480 case 0x1E:
482 script->models->get(script->models, 0)->motion = 2;
483 }
484 break;
485 }
486 break;
487 case 1:
488 if (id == 0) {
489 return 1;
490 }
491 motions = FIGHTSTG_getStageMotionsFile(id);
492 if (motions != 0 && FILE_CACHE.isLoading(motions)) {
493 script->pc -= 3;
494 return 0;
495 }
496 break;
497 }
498 return 1;
499}
500
501/* The battle script's sound command: plays a battle sound for a time (0x62
502 and 0x63 the hit's sound, or 0x38 for a hit of result 3) */
504 s32 sound = *script->pc++;
505 s32 time = *script->pc++;
506
507 if (sound == 0x62) {
508 sound = script->hits[script->soundsPlayed] == 3 ? 0x38 : script->sound;
509 script->soundsPlayed++;
510 } else if (sound == 0x63) {
511 sound = script->hits[3] == 3 ? 0x38 : script->sound;
512 script->soundsPlayed++;
513 }
514 if (children->sound == NULL) {
515 children->sound = FIGHTSTG_playBattleSound(sound, time);
516 }
517}
518
519/* The battle script's fade command: 0 fades the screen out over the frames in
520 the script, 1 back in */
522 s32 op = *script->pc++;
523 s32 frames = *script->pc++;
524
525 switch (op) {
526 case 0:
527 *fade = FIGHTSTG_startWhiteFlash(frames);
528 break;
529 case 1:
530 if (*fade != NULL) {
531 FIGHTSTG_endWhiteFlash(*fade, frames);
532 }
533 break;
534 }
535}
536
537/* The battle script's task: finds the fighter's effect archive and its script
538 (loading sound bank 0x46 for script 12), then runs its commands until one
539 waits, and ends once its children are done */
541 s32 more;
542 s32 busy;
543 s32 i;
544
545 switch (script->state) {
546 case 0:
547 default:
548 switch (script->substate) {
549 case 0:
550 default:
551 script->model = script->enemy != 0 ? 0x10 : 0;
553 script->fighter = script->models->get(script->models, script->model)->fighter;
556 /* getArchiveEntry gives the entry as a u8 * */
557 script->pc = FILE_CACHE.getArchiveEntry(script->index, FILE_CACHE.getEntry(script->archive));
558 if (script->index != 12) {
559 script->nextState(script);
560 break;
561 }
562 script->nextSubstate(script);
563 /* fallthrough */
564 case 1:
565 switch (script->step) {
566 case 0:
567 default:
568 SOUND.loadBank(0x46);
569 script->nextStep(script);
570 /* fallthrough */
571 case 1:
572 if (SOUND.isLoading()) {
573 return;
574 }
575 }
576 script->nextState(script);
577 break;
578 }
579 break;
580 case 1:
581 do {
582 more = 1;
583 switch (*script->pc++) {
584 case 1:
585 FIGHTSTG_runScriptHits(script, children);
586 break;
587 case 2:
588 more = FIGHTSTG_runScriptModel(script, children);
589 break;
590 case 3:
591 more = FIGHTSTG_runScriptEffect(script, children);
592 break;
593 case 4:
594 more = FIGHTSTG_runScriptStage(script, children);
595 break;
596 case 5:
597 FIGHTSTG_runScriptCamera(script, children);
598 break;
599 case 6:
600 more = FIGHTSTG_runScriptEffectModel(script, children);
601 break;
602 case 7:
603 FIGHTSTG_runScriptFade(script, &children->fade);
604 break;
605 /* these cases do nothing, but the match depends on them, as it does on
606 the outer switch's 2 and 3: they shape its tests */
607 case 8:
608 case 9:
609 break;
610 case 10:
611 FIGHTSTG_runScriptSound(script, children);
612 break;
613 case 11:
614 more = FIGHTSTG_runScriptWait(script, children);
615 break;
616 case 0:
617 case 0xFF:
618 busy = 0;
619 if (children->jump != NULL) {
620 busy = children->jump->state < 2;
621 }
622 if (children->script != NULL) {
623 busy = 1;
624 }
625 for (i = 0; i < 8; i++) {
626 if (children->spriteEffects[i] != NULL) {
627 busy = 1;
628 break;
629 }
630 }
631 if (busy) {
632 script->pc--;
633 } else {
634 script->setState(script, 3);
635 }
636 more = 0;
637 break;
638 }
639 } while (more);
640 break;
641 case 2:
642 case 3:
643 break;
644 }
645}
646
647/* Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript) */
651
652#if VERSION_EU || VERSION_JP
653/* the European version has the task of FIGHTSTG_updateCameraTurn here */
654#include "camera_turn.h"
655#endif
FighterCache FIGHTSTG_fighterCache
the fighters' data, loaded one at a time
Definition battle.c:21
#define BATTLE_TASK_CAMERA
Definition types.h:21
#define BATTLE_TASK_MODELS
the fighters'
Definition types.h:23
#define BATTLE_TASK_STAGE
Definition types.h:24
FIGHTSTG.PRO: the battle.
static void addModel(s32 id, s32 fighter)
Model command 6: adds fighter FIGHTER's model to the battle as model ID.
static void startModelJump(BattleScriptChildren *children, ModelControl *control, s32 kind, s32 distance)
Model command 5: replaces the model's jump with a new one of kind KIND (DISTANCE only for kind 4).
s32 FIGHTSTG_runScriptModel(BattleScript *script, BattleScriptChildren *children)
The battle script's model command, on the model given by FIGHTSTG_getScriptModel: 0 plays a motion (0...
void FIGHTSTG_updateBattleScript(BattleScript *script, BattleScriptChildren *children)
The battle script's task: finds the fighter's effect archive and its script (loading sound bank 0x46 ...
void FIGHTSTG_runScriptCamera(BattleScript *script, BattleScriptChildren *children)
The battle script's camera command: the time of the fade (0 to cut), then the enemy's view,...
BattleScript * FIGHTSTG_createBattleScript(void)
Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript)
void FIGHTSTG_runScriptFade(BattleScript *script, WhiteFlash **fade)
The battle script's fade command: 0 fades the screen out over the frames in the script,...
s32 FIGHTSTG_runScriptEffectModel(BattleScript *script, BattleScriptChildren *children)
The battle script's effect model command: 0 starts effect model ID at a position and rotation in the ...
s32 FIGHTSTG_runScriptWait(BattleScript *script, BattleScriptChildren *children)
The battle script's wait command: waits the time in the script, returning 0 until it is over.
static void turnModel(BattleScript *script, ModelControl *control)
Model command 4: sets the model's rotation from the script.
s32 FIGHTSTG_runScriptStage(BattleScript *script, BattleScriptChildren *children)
The battle script's stage command (0x38 the script's own stage, -1 none): 0 changes the fight stage (...
static void removeModel(s32 id)
Model command 9: removes model ID from the battle.
static void playMotion(ModelControl *control, s32 motion)
Model command 0 with any other MOTION: plays the model's motion MOTION from its start.
s32 FIGHTSTG_runScriptEffect(BattleScript *script, BattleScriptChildren *children)
The battle script's effect command: 0 starts sprite effect EFFECT (9999 the script's own) at a positi...
static void moveModelHome(BattleScript *script, BattleScriptChildren *children, ModelControl *control)
Model command 7: moves the model back home over the script's time, or at once when it is 0.
void FIGHTSTG_runScriptSound(BattleScript *script, BattleScriptChildren *children)
The battle script's sound command: plays a battle sound for a time (0x62 and 0x63 the hit's sound,...
s32 FIGHTSTG_getScriptModel(BattleScript *script, s32 type)
The model a script command names by TYPE: 0 the script's own side's, 1-3 the partner's slots and 4-6 ...
void FIGHTSTG_runScriptHits(BattleScript *script, BattleScriptChildren *children)
The battle script's hit command: 0 starts the other side's script for the last hit's result,...
static void playIdleMotion(ModelControl *control)
Model command 0 with 1: puts the model back to its idle motion.
BattleSound * FIGHTSTG_playBattleSound(s32 index, s32 time)
Plays battle sound index (FIGHTSTG_battleSounds; 0x5A the battle's music, 0x5B stops sound 0x20040006...
The camera's turn around the fighters, a task that both versions have: the USA version in camera_task...
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
EffectModel * FIGHTSTG_startEffectModel(s32 id, SVECTOR *pos, SVECTOR *rot)
Starts the effect model id at pos and rot, its model in FIGHTSTG_effectModels and its textures at (0x...
s32 FIGHTSTG_getEffectModelFile(s32 id)
The model file of effect model id (FIGHTSTG_effectModels), or 0 for none.
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
BattleSetup BATTLE_SETUP
Definition items.c:886
CameraView FIGHTSTG_fighterView
the view FIGHTSTG_getFighterView makes
s32 FIGHTSTG_partnerIdleMotion
the partner's idle motion while stage 0x1D is up
Jump * FIGHTSTG_startJump(ModelControl *control, s32 kind, s32 distance)
Starts a jump of control's model of kind 1-6 (FIGHTSTG_jumps), forward by distance for kind 4.
Definition move.c:89
MoveTask * FIGHTSTG_startMove(ModelControl *control, ShortVec3 *to, s32 time)
Moves control's model from where it is to to over time frames.
Definition move.c:142
TaskRegistry TASK_REGISTRY
Definition registry.c:122
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
s32 FIGHTSTG_findEffectSheet(s32 effect, s32 *images, s32 *sheet, Vec2 *texPos)
Finds 2D effect effect's sheet (FIGHTSTG_spriteEffects, FIGHTSTG_effectSheets) and gives its values; ...
SpriteEffect * FIGHTSTG_startSpriteEffect(s32 effect, const SVECTOR *pos)
Starts 2D effect effect (FIGHTSTG_spriteEffects) at pos; killed at once when it has no entry.
s32 FIGHTSTG_getStageMotionsFile(s32 id)
The file of fight stage ID's motions.
Definition stage.c:205
The battle camera (FIGHTSTG_createBattleCamera), registered as BATTLE_TASK_CAMERA on a layer: set put...
Definition camera.h:66
CameraView *(* getFighterView)(struct BattleCamera *task, s32 id, s32 camera)
Definition camera.h:77
CameraView *(* getEnemyView)(struct BattleCamera *task)
Definition camera.h:76
void(* set)(struct BattleCamera *task, CameraView *view)
Definition camera.h:74
void(* fade)(struct BattleCamera *task, CameraView *from, CameraView *to, s32 time)
from: NULL for the current
Definition camera.h:75
The battle script's children.
Definition effect.h:176
WhiteFlash * fade
Definition effect.h:177
MoveTask * move
Definition effect.h:179
EffectModel * effects[3]
Definition effect.h:182
SpriteEffect * spriteEffects[8]
Definition effect.h:181
BattleSound * sound
Definition effect.h:180
BattleScript * script
one it plays
Definition effect.h:183
A fighter's battle script (FIGHTSTG_updateBattleScript): a list of s16 commands in an archive entry o...
Definition effect.h:144
s32 fighter
Definition effect.h:153
s32 hitsPlayed
how many hits command 5 has played
Definition effect.h:159
s32 waiting
Definition effect.h:161
s32 enemy
the script is the enemy's (nonzero) or the partner's
Definition effect.h:146
s32 soundsPlayed
and the sound commands
Definition effect.h:160
void(* nextSubstate)(struct BattleScript *task)
Definition effect.h:145
s32 archive
Definition effect.h:155
Vec2 effectTexPos
Definition effect.h:166
s32 wait
the time left
Definition effect.h:162
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
void(* nextStep)(struct BattleScript *task)
Definition effect.h:145
s32 effectSheet
Definition effect.h:165
void(* setState)(struct BattleScript *task, s32 state)
Definition effect.h:145
s32 effectImages
FIGHTSTG_findEffectSheet's.
Definition effect.h:164
s32 hits[4]
0 a hit, 3 a miss; [3] how it ended
Definition effect.h:148
s16 * pc
Definition effect.h:158
void(* destroy)(struct BattleScript *task)
Definition effect.h:145
s32 substate
Definition effect.h:145
void(* nextState)(struct BattleScript *task)
Definition effect.h:145
s32 model
the Models task's id
Definition effect.h:154
Models * models
Definition effect.h:157
s32 index
the script, in the fighter's archive
Definition effect.h:147
s32 loadStep
FIGHTSTG_runScriptEffect's, loading a 2D effect.
Definition effect.h:163
s32 stage
what the stage command's 0x38 stands for
Definition effect.h:149
s32 stage
the battle's fight stage
Definition game_state.h:383
Where the battle camera looks from and to, as a GsRVIEW2 with the transform of its coordinate system.
Definition camera.h:49
s32 vry
Definition camera.h:54
s32 vpy
Definition camera.h:51
s32 tz
Definition camera.h:58
s32 tx
Definition camera.h:56
s32 vrx
Definition camera.h:53
s32 rz
the roll, in degrees
Definition camera.h:60
s32 ty
Definition camera.h:57
SVECTOR rot
Definition camera.h:59
s32 vpx
Definition camera.h:50
s32 vpz
Definition camera.h:52
s32 proj
the projection distance
Definition camera.h:61
s32 vrz
Definition camera.h:55
The fight stage (FIGHTSTG_createStage), registered as BATTLE_TASK_STAGE: its model,...
Definition stage.h:38
void(* setStage)(struct FightStage *task, s32 stage, s32 fadeOutTime, s32 fadeInTime)
Definition stage.h:54
FighterInfo * partnerInfo
both hold the info found, read by isEnemy
Definition model.h:270
FighterInfoFuncs funcs
Definition model.h:272
FighterInfo *(* getInfo)(s32 id)
Definition model.h:258
s32 model
Definition model.h:226
s32 effects
its effect scripts' archive
Definition model.h:228
void *(* getArchiveEntry)(s32 index, void *archive)
Definition file.h:97
s32(* isLoading)(s32 file)
Definition file.h:88
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
s32 state
Definition model.h:333
void(* destroy)(struct Jump *task)
Definition model.h:333
What drives a Model, owned by whoever created it.
Definition model.h:99
ShortVec3 rot
Definition model.h:108
s32 restart
play it again from the start
Definition model.h:103
s32 enabled
Definition model.h:112
ShortVec3 pos
Definition model.h:107
struct ModelControl::@3 layers[2]
the model is drawn once for each one enabled
ShortVec3 homePos
Definition model.h:109
s32 motion
the motion to play
Definition model.h:102
s32 fighter
the Models task's
Definition model.h:105
s32 idleMotion
Definition model.h:106
s32 motionDone
Definition model.h:104
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
Definition model.h:284
void(* remove)(struct Models *task, s32 id)
Definition model.h:287
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 position or rotation, without the SVECTOR pad.
Definition model.h:14
s16 x
Definition model.h:15
s16 z
Definition model.h:17
s16 y
Definition model.h:16
s32(* isLoading)(void)
Definition sound.h:193
void(* loadBank)(s32 id)
Definition sound.h:190
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
Uploads TIM images to VRAM (initTimLoader); acts on TIM_LOADER.
Definition gfx.h:325
void(* setImagePos)()
(x, y)
Definition gfx.h:336
void(* loadArchive)()
(archive): each image 64 halfwords to the right
Definition gfx.h:338
s32 y
Definition gfx.h:354
s32 x
Definition gfx.h:353
The white flash (FIGHTSTG_startWhiteFlash): fades the screen to white, and back once ended.
Definition effect.h:105
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
void initTimLoader(TimLoader *obj)
Clears a TIM loader, gives it its methods and binds it.
Definition tim_loader.c:119
WhiteFlash * FIGHTSTG_startWhiteFlash(s32 frames)
Starts a white flash that whitens the screen over FRAMES.
Definition white_flash.c:70
void FIGHTSTG_endWhiteFlash(WhiteFlash *task, s32 frames)
Fades the white flash back out over FRAMES.
Definition white_flash.c:64