Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
white_flash.c
Go to the documentation of this file.
1/* FIGHTSTG's white flash over the screen. */
2
4
5/* Draws the white flash: a full-screen quad of the task's level, added to the
6 screen on layer BATTLE_LAYER_FRONT */
9 u_long *ot = layer->getOtEntry(layer, 0);
10 POLY_F4 *poly = GFX.funcs.getPrim();
11 DR_TPAGE *mode;
12
13 poly->r0 = task->level;
14 poly->g0 = task->level;
15 poly->b0 = task->level;
16 setlen(poly, 5);
17 poly->code = 0x2A;
18 /* the match depends on these chained stores, x3 before x1 */
19 poly->x3 = poly->x1 = 320;
20 poly->x2 = poly->x0 = 0;
21 poly->y1 = poly->y0 = 0;
22 poly->y3 = poly->y2 = 240;
23 addPrim(ot, poly);
24 mode = (DR_TPAGE *)(poly + 1);
25 SetDrawTPage(mode, 0, 1, 0xA0);
26 addPrim(ot, mode);
27 /* the match depends on ++mode: with mode + 1, the OT and 0xFFFFFF
28 outrank mode in the local allocator and take s2 and s3 */
29 GFX.funcs.setPrim(++mode);
30}
31
32/* The white flash's task: brightens up to full white and holds it, then once
33 ended (FIGHTSTG_endWhiteFlash) fades back and dies; draws itself each frame */
35 switch (task->state) {
36 case TASK_INIT: /* the match depends on this case, which default covers */
37 default:
38 task->nextState(task);
39 task->level = 0;
40 /* fallthrough */
41 case TASK_RUN:
42 if (task->substate == 0) {
43 task->level += task->speed * GFX.funcs.getFrameTime();
44 if (task->level >= 0xFF) {
45 task->level = 0xFF;
46 task->nextSubstate(task);
47 }
48 }
49 break;
50 case TASK_DONE:
51 task->level -= task->speed * GFX.funcs.getFrameTime();
52 if (task->level < 0) {
53 task->level = 0;
54 task->setState(task, TASK_KILL);
55 }
56 break;
57 case TASK_KILL:
58 break;
59 }
61}
62
63/* Fades the white flash back out over FRAMES */
65 task->speed = 0xFF / frames;
66 task->setState(task, TASK_DONE);
67}
68
69/* Starts a white flash that whitens the screen over FRAMES */
72
73 task->speed = 0xFF / frames;
74 return task;
75}
#define BATTLE_LAYER_FRONT
the fades, the flashes and the sprite effects over all
Definition types.h:32
FIGHTSTG.PRO: the battle.
signed int s32
Definition common.h:11
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
#define TASK_RUN
Definition task.h:35
#define TASK_KILL
Definition task.h:37
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Definition task.h:34
#define TASK_DONE
Definition task.h:36
void *(* getPrim)(void)
Definition gfx.h:19
s32(* getFrameTime)(void)
Definition gfx.h:32
struct Layer *(* getLayer)(s32 id)
Definition gfx.h:28
void(* setPrim)(void *next)
Definition gfx.h:20
GfxFuncs funcs
Definition gfx.h:77
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
u_long *(* getOtEntry)(struct Layer *, s32 depth)
Definition gfx.h:155
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
void(* setState)(struct WhiteFlash *task, s32 state)
Definition effect.h:106
s32 speed
0xFF / the frames
Definition effect.h:107
void(* nextState)(struct WhiteFlash *task)
Definition effect.h:106
void(* nextSubstate)(struct WhiteFlash *task)
Definition effect.h:106
s32 substate
Definition effect.h:106
s32 state
Definition effect.h:106
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
WhiteFlash * FIGHTSTG_startWhiteFlash(s32 frames)
Starts a white flash that whitens the screen over FRAMES.
Definition white_flash.c:70
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
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_endWhiteFlash(WhiteFlash *task, s32 frames)
Fades the white flash back out over FRAMES.
Definition white_flash.c:64