Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
hit_effect.c
Go to the documentation of this file.
1/* FIGHTSTG's hit effect, the spark and script of a hit. */
2
4
5/* where FIGHTSTG_updateHitEffect's effect 0x33 is: a screen position, in
6 front (z 0x7FFF, see FIGHTSTG_drawSpriteAnim) */
7const SVECTOR FIGHTSTG_hitEffectPos = { 0, 120, 0x7FFF, 0 };
8
9/* Loads effect 0x33, then turns the camera to the enemy's view, plays the
10 effect with a sound and, 10 frames on, the hit's or the knockout's script */
12 BattleCamera *camera = task->camera;
13
14 switch (task->state) {
15 case 0:
16 default:
17 switch (task->substate) {
18 case 0:
19 default:
22 task->nextSubstate(task);
23 /* fallthrough */
24 case 1:
25 switch (task->step) {
26 case 0:
27 default:
28 FIGHTSTG_findEffectSheet(0x33, &task->effectImages, &task->sheet, &task->texPos);
29 task->nextStep(task);
30 /* fallthrough */
31 case 1:
32 if (FILE_CACHE.isLoading(task->sheet >> 16) == 0) {
33 task->nextState(task);
34 }
35 break;
36 }
37 break;
38 }
39 break;
40 case 1:
41 switch (task->substate) {
42 case 0:
43 camera->set(camera, camera->getEnemyView(camera));
46 task->nextSubstate(task);
47 /* fallthrough */
48 case 1:
49 task->counter += GFX.funcs.getFrameTime();
50 if (task->counter < 10) {
51 break;
52 }
54 children->script->enemy = 0;
55 children->script->index = task->result + 1;
56 children->script->unk74 = task->unk5C;
57 task->nextSubstate(task);
58 /* fallthrough */
59 case 2:
60 if (children->script == NULL) {
61 task->setState(task, 3);
62 }
63 break;
64 }
65 break;
66 case 2:
67 case 3:
68 break;
69 }
70}
71
72/* Starts the effect of a hit on the player's fighter (result 1) or of its
73 knockout (2) */
76
77 task->result = result;
78 task->unk5C = arg1;
79 return task;
80}
#define BATTLE_TASK_CAMERA
Definition types.h:21
#define BATTLE_TASK_MODELS
the fighters'
Definition types.h:23
FIGHTSTG.PRO: the battle.
BattleScript * FIGHTSTG_createBattleScript(void)
Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript)
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
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,...
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
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
const SVECTOR FIGHTSTG_hitEffectPos
where FIGHTSTG_updateHitEffect's effect 0x33 is: a screen position, in front (z 0x7FFF,...
Definition hit_effect.c:7
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
#define SOUND_COMCD103
Definition sound.h:53
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.
The battle camera (FIGHTSTG_createBattleCamera), registered as BATTLE_TASK_CAMERA on a layer: set put...
Definition camera.h:66
CameraView *(* getEnemyView)(struct BattleCamera *task)
Definition camera.h:76
void(* set)(struct BattleCamera *task, CameraView *view)
Definition camera.h:74
s32 enemy
the script is the enemy's (nonzero) or the partner's
Definition effect.h:146
s32 unk74
HitEffect.unk5C; nothing reads it.
Definition effect.h:152
s32 index
the script, in the fighter's archive
Definition effect.h:147
s32(* isLoading)(s32 file)
Definition file.h:88
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
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
s32 step
Definition effect.h:93
s32 counter
Definition effect.h:93
void(* nextStep)(struct HitEffect *task)
Definition effect.h:93
struct BattleCamera * camera
Definition effect.h:95
s32 effectImages
FIGHTSTG_findEffectSheet's.
Definition effect.h:98
void(* setState)(struct HitEffect *task, s32 state)
Definition effect.h:93
struct Models * models
Definition effect.h:94
s32 state
Definition effect.h:93
s32 substate
Definition effect.h:93
void(* nextState)(struct HitEffect *task)
Definition effect.h:93
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
void(* nextSubstate)(struct HitEffect *task)
Definition effect.h:93
s32 sheet
its file in the high half
Definition effect.h:99
Vec2 texPos
Definition effect.h:100
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
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105