Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
update_darkness.inc.c
Go to the documentation of this file.
1/*
2 * The darkness: the screen drawn black (a white quad subtracted from it,
3 * blend mode 2) while in TASK_DONE (GAME.dark is set then)
4 */
6 Layer *layer;
7 u_long *ot;
8 POLY_F4 *poly;
9 DR_TPAGE *mode;
10
11 if (task->state == TASK_INIT) {
12 if (GAME.dark != 0) {
13 task->setState(task, TASK_DONE);
14 } else {
15 task->setState(task, TASK_RUN);
16 }
17 }
18 switch (task->state) {
19 case TASK_RUN:
20 if (task->key1 != 0) {
21 if (task->substate != 5) {
22 task->nextSubstate(task);
23 } else {
24 task->key1 = 0;
25 task->setState(task, TASK_DONE);
27 }
28 }
29 GAME.dark = 0;
30 break;
31 case TASK_DONE:
33 ot = layer->getOtEntry(layer, 6);
34 poly = GFX.funcs.getPrim();
35 setlen(poly, 5);
36 poly->code = 0x2A;
37 poly->r0 = poly->g0 = poly->b0 = 0xFF;
38 poly->x1 = poly->x3 = 320;
39 poly->x0 = poly->x2 = 0;
40 poly->y0 = poly->y1 = 0;
41 poly->y2 = poly->y3 = 256;
42 addPrim(ot, poly);
43 mode = (DR_TPAGE *)(poly + 1);
44 setlen(mode, 1);
45 mode->code[0] = 0xE1000245;
46 addPrim(ot, mode);
47 GFX.funcs.setPrim(mode + 1);
48 GAME.dark = 1;
49 break;
50 case TASK_INIT:
51 case TASK_KILL:
52 break;
53 }
54}
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
GameState GAME
The save data, the game mode and the methods.
Definition state.c:64
#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
#define FIELD_LAYER_MAP
the map, its objects and characters, and the menus
Definition field_map.h:20
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_SWITCH02
Definition sound.h:51
void *(* getPrim)(void)
Definition gfx.h:19
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
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
The task a stage starts (startStage), updated by its updateStage.
Definition stage.h:26
void(* nextSubstate)(struct StageTask *task)
Definition stage.h:27
s32 substate
Definition stage.h:27
s32 state
Definition stage.h:27
s32 key1
Definition stage.h:27
void(* setState)(struct StageTask *task, s32 state)
Definition stage.h:27
void updateDarkness(StageTask *task)
The darkness: the screen drawn black (a white quad subtracted from it, blend mode 2) while in TASK_DO...