Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
logo.c
Go to the documentation of this file.
1/* The title screen's logo */
2
3#include "menus/title.h"
4
5/* Draws the logo once it is visible: sprite 6, and sprites 3 and 5 at their
6 animations' current CLUT rows */
8 SpriteDrawer sprite;
9
10 if (task->visible) {
11 initSpriteDrawer(&sprite);
12 sprite.setLayerId(task->layerId, 0);
13 sprite.setTexture(0x280, STDWTITL_TEXTURE_Y);
14 sprite.draw(FILE_CACHE.getEntry(STDWTITL_spriteBank), 6, 29, 209);
15 initSpriteDrawer(&sprite);
16 sprite.setLayerId(task->layerId, 0);
17 sprite.setTexture(0x280, STDWTITL_TEXTURE_Y);
18 sprite.setClutRow(task->anims[0].frame);
20 initSpriteDrawer(&sprite);
21 sprite.setLayerId(task->layerId, 0);
22 sprite.setTexture(0x280, STDWTITL_TEXTURE_Y);
23 sprite.setClutRow(task->anims[1].frame);
24 sprite.draw(FILE_CACHE.getEntry(STDWTITL_spriteBank), 5, 20, 202);
25 }
26}
27
28/* The logo's task: waits until shown, plays its two animations once
29 (STDWTITL_logoFrames), then keeps it drawn; with skip it starts complete */
31 s32 i;
32
33 switch (task->state) {
34 case TASK_INIT:
35 default:
36 if (task->skip == 0) {
37 task->nextState(task);
38 } else {
39 task->setState(task, TASK_DONE);
40 }
41 break;
42 case TASK_RUN:
43 switch (task->substate) {
44 case 0:
45 break;
46 case 1:
47 task->visible = 1;
48 task->nextSubstate(task);
49 task->anims[0].index = 0;
50 task->anims[1].index = 0;
51 /* fallthrough */
52 case 2:
53 for (i = 0; i < 2; i++) {
54 if (!task->anims[i].done) {
55 if (STDWTITL_logoFrames[i][task->anims[i].index] == -1) {
56 task->anims[i].done = 1;
57 task->anims[i].index--;
58 }
59 task->anims[i].frame = STDWTITL_logoFrames[i][task->anims[i].index];
60 task->anims[i].index++;
61 }
62 }
63 if (task->anims[0].done + task->anims[1].done == 2) {
64 task->setSubstate(task, 2);
65 }
67 break;
68 }
69 break;
70 case TASK_DONE:
71 if (task->substate == 0) {
72 task->anims[0].frame = 11;
73 task->anims[1].frame = 7;
74 task->visible = 1;
75 task->nextSubstate(task);
76 }
78 break;
79 case TASK_KILL:
80 break;
81 }
82}
83
84/* Starts the logo's animations (the task's show), only while it waits */
86 if (task->state == TASK_RUN) {
87 task->setSubstate(task, 1);
88 }
89}
90
91/* Creates the title screen's logo (task); skip: shown complete from the start */
93 LogoTask *task = createTask(STDWTITL_tickLogo, sizeof(LogoTask), 0);
94
95 task->show = STDWTITL_showLogo;
97 task->depth = 2;
98 task->skip = skip;
99 return task;
100}
signed int s32
Definition common.h:11
s32 STDWTITL_spriteBank
Definition title.c:72
#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
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
LogoTask * STDWTITL_startLogoTask(s32 skip)
Creates the title screen's logo (task); skip: shown complete from the start.
Definition logo.c:92
void STDWTITL_showLogo(LogoTask *task)
Starts the logo's animations (the task's show), only while it waits.
Definition logo.c:85
void STDWTITL_tickLogo(LogoTask *task)
The logo's task: waits until shown, plays its two animations once (STDWTITL_logoFrames),...
Definition logo.c:30
void STDWTITL_drawLogo(LogoTask *task)
Draws the logo once it is visible: sprite 6, and sprites 3 and 5 at their animations' current CLUT ro...
Definition logo.c:7
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
s16 STDWTITL_logoFrames[2][13]
The sprite frames of the logo's two animations; -1 ends each.
Definition stdwtitl.c:12
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
s16 index
Definition title.h:119
s32 done
Definition title.h:121
s16 frame
Definition title.h:120
s32 state
Definition title.h:125
void(* nextSubstate)(struct LogoTask *task)
Definition title.h:125
LogoAnim anims[2]
Definition title.h:128
void(* setSubstate)(struct LogoTask *task, s32 substate)
Definition title.h:125
s32 visible
Definition title.h:127
s32 layerId
Definition title.h:129
s32 substate
Definition title.h:125
void(* show)(struct LogoTask *task)
Definition title.h:132
s32 skip
start fully shown
Definition title.h:126
void(* nextState)(struct LogoTask *task)
Definition title.h:125
s32 depth
Definition title.h:130
void(* setState)(struct LogoTask *task, s32 state)
Definition title.h:125
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
Definition gfx.h:223
void(* setLayerId)()
(id, depth)
Definition gfx.h:244
void(* setClutRow)()
(row)
Definition gfx.h:247
void(* draw)()
(sheet, frame, x, y)
Definition gfx.h:246
void(* setTexture)()
(x, y)
Definition gfx.h:242
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
STDWTITL.PRO: the title screen, the opening movies and a notice screen.
#define STDWTITL_TEXTURE_Y
The VRAM row of the title's sprites (SpriteDrawer.setTexture)
Definition title.h:49
#define STDWTITL_TITLE_LAYER
Definition title.h:30