Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
effect.h
Go to the documentation of this file.
1#ifndef FIGHTSTG_EFFECT_H
2#define FIGHTSTG_EFFECT_H
3
4/* FIGHTSTG's effects and scripts: sprite effects and their animations, hit
5 effects, battle scripts and sounds, the white flash, Digimon changes,
6 entrances and the screen fader (sprite_anim.c to fader.c). */
7
10
11/* The images of a Digimon's change (FIGHTSTG_updateDigimonChange): entry 5 */
12#if VERSION_EU
13#define FILE_CHANGE 0x8A2
14#elif VERSION_US || VERSION_JP
15#define FILE_CHANGE 0x891
16#endif
17
18/* What fighter 0x1D2's entrance (FIGHTSTG_updateEntrance) loads */
19#if VERSION_EU
20#define FILE_ENTRANCE_1D2 0x6E2
21#elif VERSION_US || VERSION_JP
22#define FILE_ENTRANCE_1D2 0x6D3
23#endif
24
25/* A battle sound (FIGHTSTG_playBattleSound) that is keyed off after time */
26typedef struct BattleSound {
28 /* 0x50 */ s32 sound;
29 /* 0x54 */ s32 voice;
30 /* 0x58 */ s32 time;
32
33/* A sprite sheet for the battle's 2D effects: an archive of animations,
34 the sheet and where its texture goes in VRAM */
35typedef struct EffectSheet {
36 /* 0x0 */ s32 images; /* the archive of TIMs a script loads for it, 0 for none */
37 /* 0x4 */ s32 sheet;
38 /* 0x8 */ Vec2 texPos;
40
41/* A 2D effect: its sheet in FIGHTSTG_effectSheets and its animations, an
42 archive of SpriteAnim data; the list (FIGHTSTG_spriteEffects) ends with an
43 id of -1 */
44typedef struct SpriteEffectEntry {
45 /* 0x0 */ s16 id;
46 /* 0x2 */ s16 sheet;
47 /* 0x4 */ s32 file;
49
50/* A 2D effect (FIGHTSTG_startSpriteEffect): a SpriteAnim per animation, killed
51 when they all are */
52typedef struct SpriteEffect {
54 /* 0x50 */ s32 effect; /* -1: not found */
55 /* 0x54 */ s32 sheet;
56 /* 0x58 */ s32 file;
57 /* 0x5C */ SVECTOR pos;
58 /* 0x64 */ s32 count;
60
61/* One animation of a 2D effect (FIGHTSTG_createSpriteAnim), drawn by a layer
62 callback. Its data: flags, stride and duration, the 9 values of the first
63 frame, then per frame the values whose bit is set in flags. */
64typedef struct SpriteAnim {
66 /* 0x50 */ s16 *data;
67 /* 0x54 */ SVECTOR pos; /* vz 0x7FFF: on screen in front, -1: on screen */
68 /* 0x5C */ s32 sheet;
69 /* 0x60 */ Vec2 texPos;
70 /* 0x68 */ s32 layerId;
71 /* 0x6C */ s32 time;
72 /* 0x70 */ s32 flags;
73 /* 0x74 */ s32 stride; /* of a frame's values */
74 /* 0x78 */ s32 duration;
75 /* 0x7C */ s16 frame;
76 /* 0x7E */ s16 clutRow;
77 /* 0x80 */ s16 x;
78 /* 0x82 */ s16 y;
79 /* 0x84 */ union {
80 s16 v[2]; /* x, y; 0x1000 = 1.0 */
81 s32 both; /* to test the two at once */
83 /* 0x88 */ union {
84 s16 v[2]; /* x, y */
85 s32 both;
86 } rot;
87 /* 0x8C */ s16 rotZ;
89
90/* FIGHTSTG_startHitEffect's task: the enemy's view, effect 0x33 on the
91 player's fighter, then the script of a hit or a knockout */
92typedef struct HitEffect {
94 /* 0x50 */ struct Models *models;
95 /* 0x54 */ struct BattleCamera *camera;
96 /* 0x58 */ s32 result; /* 1 a hit, 2 a knockout: the script is result + 1 */
97 /* 0x5C */ s32 unk5C; /* FIGHTSTG_startHitEffect's second argument: 1 from WFIGHTMN, 0 from WFIGHTTS; the script's unk74 */
98 /* 0x60 */ s32 effectImages; /* FIGHTSTG_findEffectSheet's */
99 /* 0x64 */ s32 sheet; /* its file in the high half */
100 /* 0x68 */ Vec2 texPos;
101} HitEffect;
102
103/* The white flash (FIGHTSTG_startWhiteFlash): fades the screen to white,
104 and back once ended */
105typedef struct WhiteFlash {
107 /* 0x50 */ s32 speed; /* 0xFF / the frames */
108 /* 0x54 */ s32 level; /* added to the screen (white), 0-0xFF */
109} WhiteFlash;
110
111/* A partner Digimon's change (FIGHTSTG_startDigimonChange): key1 the new Digimon, key2 the
112 side. The stage and two clipped layers wipe the scene away and back. */
113typedef struct DigimonChange {
115 /* 0x50 */ struct Models *models;
116 /* 0x54 */ struct BattleCamera *camera;
117 /* 0x58 */ struct FightStage *stage;
118 /* 0x5C */ s32 idleMotion; /* the old Digimon's */
119 /* 0x60 */ RECT clip0; /* BATTLE_LAYER_MODELS's */
120 /* 0x68 */ RECT clip1; /* BATTLE_LAYER_WIREFRAME's */
121 /* 0x70 */ s32 file; /* the new Digimon's model's */
123
124typedef struct DigimonChangeChildren {
125 /* 0x00 */ struct WhiteFlash *fade;
126 /* 0x04 */ Task *unused; /* a child slot nothing fills */
127 /* 0x08 */ struct SpriteEffect *effects[4];
129
130/* A fighter's entrance (FIGHTSTG_startEntrance): key1 its Digimon, key2 its side */
131typedef struct Entrance {
133 /* 0x50 */ s32 done;
134 /* 0x54 */ struct Models *models;
135 /* 0x58 */ struct BattleCamera *camera;
136 /* 0x5C */ struct FightStage *stage;
137 /* 0x60 */ s32 file; /* its model's */
138 /* 0x64 */ s32 weak; /* it comes in with motion 2 (WFIGHTMN_setIdleMotion's weak one) */
139} Entrance;
140
141/* A fighter's battle script (FIGHTSTG_updateBattleScript): a list
142 of s16 commands in an archive entry of the fighter's file, which play its
143 motions, effects, sounds and camera moves */
146 /* 0x50 */ s32 enemy; /* the script is the enemy's (nonzero) or the partner's */
147 /* 0x54 */ s32 index; /* the script, in the fighter's archive */
148 /* 0x58 */ s32 hits[4]; /* 0 a hit, 3 a miss; [3] how it ended */
149 /* 0x68 */ s32 stage; /* what the stage command's 0x38 stands for */
150 /* 0x6C */ s32 effect; /* the sprite effect the effect command's 9999 stands for */
151 /* 0x70 */ s32 sound; /* what the sound commands' 0x62 and 0x63 stand for on a hit */
152 /* 0x74 */ s32 unk74; /* HitEffect.unk5C; nothing reads it */
153 /* 0x78 */ s32 fighter;
154 /* 0x7C */ s32 model; /* the Models task's id */
155 /* 0x80 */ s32 archive;
156 /* 0x84 */ s32 pad; /* never read or written */
157 /* 0x88 */ Models *models;
158 /* 0x8C */ s16 *pc;
159 /* 0x90 */ s32 hitsPlayed; /* how many hits command 5 has played */
160 /* 0x94 */ s32 soundsPlayed; /* and the sound commands */
161 /* 0x98 */ s32 waiting;
162 /* 0x9C */ s32 wait; /* the time left */
163 /* 0xA0 */ s32 loadStep; /* FIGHTSTG_runScriptEffect's, loading a 2D effect */
164 /* 0xA4 */ s32 effectImages; /* FIGHTSTG_findEffectSheet's */
165 /* 0xA8 */ s32 effectSheet;
166 /* 0xAC */ Vec2 effectTexPos;
167};
168
169/* FIGHTSTG_updateHitEffect's children */
174
175/* The battle script's children */
176typedef struct BattleScriptChildren {
177 /* 0x00 */ WhiteFlash *fade;
178 /* 0x04 */ Jump *jump;
179 /* 0x08 */ MoveTask *move;
180 /* 0x0C */ BattleSound *sound;
182 /* 0x30 */ EffectModel *effects[3];
183 /* 0x3C */ BattleScript *script; /* one it plays */
185
186/* The tasks FIGHTSTG starts for WFIGHTMN and WFIGHTTS */
187Entrance *FIGHTSTG_startEntrance(s32 id, s32 side, s32 weak);
188/* WFIGHTMN passes the damage as a third argument, which it doesn't read; its
189 code loads it, so no parameter list */
190HitEffect *FIGHTSTG_startHitEffect(); /* (s32 result, s32 arg1): unprototyped, as WFIGHTMN passes it the damage too */
194
195/* Shared between the overlay's objects */
209void FIGHTSTG_startFader(ScreenFade *task, s32 fadeIn, s32 duration);
214void FIGHTSTG_updateEntrance(Entrance *task, WhiteFlash **children);
215void FIGHTSTG_endWhiteFlash(WhiteFlash *task, s32 frames);
217extern s32 FIGHTSTG_battleSounds[]; /* sound ids */
220void FIGHTSTG_nop(void);
221void FIGHTSTG_drawSpriteAnim(void *arg, Layer *layer);
225s32 FIGHTSTG_findEffectSheet(s32 effect, s32 *images, s32 *sheet, Vec2 *texPos);
227SpriteAnim *FIGHTSTG_createSpriteAnim(s16 *data, SVECTOR *pos, s32 sheet, Vec2 *texPos, s32 layerId);
228SpriteEffect *FIGHTSTG_startSpriteEffect(s32 effect, const SVECTOR *pos);
229
230#endif /* FIGHTSTG_EFFECT_H */
FIGHTSTG's shared declarations: the headers it builds on, the ids its tasks register with,...
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
void FIGHTSTG_updateSpriteAnim(SpriteAnim *task)
A frame-by-frame animation of a 2D effect: reads its flags, stride, duration and first values from da...
Definition sprite_anim.c:51
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...
SpriteEffectEntry FIGHTSTG_spriteEffects[]
the 2D effects, ended by an id of -1; the European version's differ
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)
SpriteAnim * FIGHTSTG_createSpriteAnim(s16 *data, SVECTOR *pos, s32 sheet, Vec2 *texPos, s32 layerId)
Creates a sprite animation from data at pos, with frames of sheet (textures at texPos) on layer layer...
void FIGHTSTG_updateHitEffect(HitEffect *task, HitEffectChildren *children)
Loads effect 0x33, then turns the camera to the enemy's view, plays the effect with a sound and,...
Definition hit_effect.c:11
void FIGHTSTG_runScriptFade(BattleScript *script, WhiteFlash **fade)
The battle script's fade command: 0 fades the screen out over the frames in the script,...
EffectSheet FIGHTSTG_effectSheets[]
the 2D effects' sheets; the European version's differ
void FIGHTSTG_drawSpriteAnim(void *arg, Layer *layer)
A layer callback that draws a sprite animation's frame: at its projected position,...
Definition sprite_anim.c:13
void FIGHTSTG_updateDigimonChange(DigimonChange *task, DigimonChangeChildren *children)
A partner Digimon's change: a stage of its own (addNewDigimon), the new Digimon's model in front of a...
WhiteFlash * FIGHTSTG_startWhiteFlash(s32 frames)
Starts a white flash that whitens the screen over FRAMES.
Definition white_flash.c:70
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; ...
void FIGHTSTG_nop(void)
Empty, and nothing calls it.
Definition sprite_anim.c:6
void FIGHTSTG_drawWhiteFlash(WhiteFlash *task)
Draws the white flash: a full-screen quad of the task's level, added to the screen on layer BATTLE_LA...
Definition white_flash.c:7
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_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.
BattleSound * FIGHTSTG_playBattleSound(s32 index, s32 time)
Plays battle sound index (FIGHTSTG_battleSounds; 0x5A the battle's music, 0x5B stops sound 0x20040006...
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 (...
void FIGHTSTG_updateBattleSound(BattleSound *task)
The battle sound's task: keys its sound off once its time is up.
Definition battle_sound.c:6
HitEffect * FIGHTSTG_startHitEffect()
WFIGHTMN passes the damage as a third argument, which it doesn't read; its code loads it,...
void FIGHTSTG_updateSpriteEffect(SpriteEffect *task, SpriteAnim **children)
A 2D effect's task: starts a sprite animation for each entry of its archive (up to 30),...
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...
void FIGHTSTG_drawFader(ScreenFade *task)
void FIGHTSTG_updateWhiteFlash(WhiteFlash *task)
The white flash's task: brightens up to full white and holds it, then once ended (FIGHTSTG_endWhiteFl...
Definition white_flash.c:34
void FIGHTSTG_updateFader(ScreenFade *task)
The screen fade's task: src/shared/update_fader.inc.c, but for its first state, which sets TASK_RUN w...
Definition fader.c:11
void FIGHTSTG_startFader(ScreenFade *task, s32 fadeIn, s32 duration)
s32 FIGHTSTG_battleSounds[]
sound ids
ScreenFade * FIGHTSTG_createFader(void)
Creates the screen fade, idle until started, on layer BATTLE_LAYER_FRONT.
Definition fader.c:42
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)
Shared between the overlay's objects.
DigimonChange * FIGHTSTG_startDigimonChange(s32 key1, s32 key2)
Starts a partner's Digimon change (FIGHTSTG_updateDigimonChange)
Entrance * FIGHTSTG_startEntrance(s32 id, s32 side, s32 weak)
The tasks FIGHTSTG starts for WFIGHTMN and WFIGHTTS.
Definition entrance.c:175
void FIGHTSTG_endWhiteFlash(WhiteFlash *task, s32 frames)
Fades the white flash back out over FRAMES.
Definition white_flash.c:64
void FIGHTSTG_updateEntrance(Entrance *task, WhiteFlash **children)
A fighter's entrance: loads its model and adds it, then shows it behind a fade (FIGHTSTG_startWhiteFl...
Definition entrance.c:61
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,...
#define TASK_HEADER(Type)
Definition task.h:39
FIGHTSTG's models: meshes and their drawing, bones, motions, the models task and its controls,...
The battle camera (FIGHTSTG_createBattleCamera), registered as BATTLE_TASK_CAMERA on a layer: set put...
Definition camera.h:66
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
s32 archive
Definition effect.h:155
s32 unk74
HitEffect.unk5C; nothing reads it.
Definition effect.h:152
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
s32 pad
never read or written
Definition effect.h:156
s32 effectSheet
Definition effect.h:165
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
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
A battle sound (FIGHTSTG_playBattleSound) that is keyed off after time.
Definition effect.h:26
s32 voice
Definition effect.h:29
s32 sound
Definition effect.h:28
s32 time
Definition effect.h:30
struct WhiteFlash * fade
Definition effect.h:125
struct SpriteEffect * effects[4]
Definition effect.h:127
Task * unused
a child slot nothing fills
Definition effect.h:126
A partner Digimon's change (FIGHTSTG_startDigimonChange): key1 the new Digimon, key2 the side.
Definition effect.h:113
struct Models * models
Definition effect.h:115
s32 file
the new Digimon's model's
Definition effect.h:121
struct FightStage * stage
Definition effect.h:117
RECT clip0
BATTLE_LAYER_MODELS's.
Definition effect.h:119
RECT clip1
BATTLE_LAYER_WIREFRAME's.
Definition effect.h:120
struct BattleCamera * camera
Definition effect.h:116
s32 idleMotion
the old Digimon's
Definition effect.h:118
Shows an effect's model at a place until its motion ends (FIGHTSTG_startEffectModel)
Definition model.h:174
A sprite sheet for the battle's 2D effects: an archive of animations, the sheet and where its texture...
Definition effect.h:35
s32 images
the archive of TIMs a script loads for it, 0 for none
Definition effect.h:36
Vec2 texPos
Definition effect.h:38
s32 sheet
Definition effect.h:37
A fighter's entrance (FIGHTSTG_startEntrance): key1 its Digimon, key2 its side.
Definition effect.h:131
s32 weak
it comes in with motion 2 (WFIGHTMN_setIdleMotion's weak one)
Definition effect.h:138
struct FightStage * stage
Definition effect.h:136
s32 done
Definition effect.h:133
struct BattleCamera * camera
Definition effect.h:135
struct Models * models
Definition effect.h:134
s32 file
its model's
Definition effect.h:137
The fight stage (FIGHTSTG_createStage), registered as BATTLE_TASK_STAGE: its model,...
Definition stage.h:38
FIGHTSTG_updateHitEffect's children.
Definition effect.h:170
SpriteEffect * effect
Definition effect.h:171
BattleScript * script
Definition effect.h:172
FIGHTSTG_startHitEffect's task: the enemy's view, effect 0x33 on the player's fighter,...
Definition effect.h:92
struct BattleCamera * camera
Definition effect.h:95
s32 effectImages
FIGHTSTG_findEffectSheet's.
Definition effect.h:98
struct Models * models
Definition effect.h:94
s32 unk5C
FIGHTSTG_startHitEffect's second argument: 1 from WFIGHTMN, 0 from WFIGHTTS; the script's unk74.
Definition effect.h:97
s32 result
1 a hit, 2 a knockout: the script is result + 1
Definition effect.h:96
s32 sheet
its file in the high half
Definition effect.h:99
Vec2 texPos
Definition effect.h:100
A ModelControl's jump (FIGHTSTG_startJump): up and down from its y, or for kinds 4 and 5 also forward...
Definition model.h:332
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
Definition model.h:284
FIGHTSTG_startMove's task: moves a ModelControl to a position.
Definition model.h:200
Fades the whole screen to black and back with a subtractive rectangle.
Definition gfx.h:361
One animation of a 2D effect (FIGHTSTG_createSpriteAnim), drawn by a layer callback.
Definition effect.h:64
SVECTOR pos
vz 0x7FFF: on screen in front, -1: on screen
Definition effect.h:67
s16 x
Definition effect.h:77
s16 y
Definition effect.h:78
s32 sheet
Definition effect.h:68
s32 time
Definition effect.h:71
s32 duration
Definition effect.h:74
Vec2 texPos
Definition effect.h:69
s32 layerId
Definition effect.h:70
s32 stride
of a frame's values
Definition effect.h:73
s16 clutRow
Definition effect.h:76
union SpriteAnim::@1 rot
s16 frame
Definition effect.h:75
s16 v[2]
x, y; 0x1000 = 1.0
Definition effect.h:80
s16 * data
Definition effect.h:66
s32 flags
Definition effect.h:72
union SpriteAnim::@0 scale
s32 both
to test the two at once
Definition effect.h:81
s16 rotZ
Definition effect.h:87
A 2D effect: its sheet in FIGHTSTG_effectSheets and its animations, an archive of SpriteAnim data; th...
Definition effect.h:44
A 2D effect (FIGHTSTG_startSpriteEffect): a SpriteAnim per animation, killed when they all are.
Definition effect.h:52
s32 effect
-1: not found
Definition effect.h:54
SVECTOR pos
Definition effect.h:57
s32 count
Definition effect.h:58
s32 sheet
Definition effect.h:55
Any task, seen through its header.
Definition task.h:62
Definition gfx.h:352
The white flash (FIGHTSTG_startWhiteFlash): fades the screen to white, and back once ended.
Definition effect.h:105
s32 level
added to the screen (white), 0-0xFF
Definition effect.h:108
s32 speed
0xFF / the frames
Definition effect.h:107