Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
partner_view.c
Go to the documentation of this file.
1/* FIGHTSTG's partner view, the partner's picture beside the menus. */
2
4
5/* Draws the frame around the partner view */
7 SpriteDrawer drawer;
8
9 initSpriteDrawer(&drawer);
11 drawer.setTexture(0x200, 0);
12 drawer.draw(FILE_CACHE.getEntry(FILE_BATTLE_MENU << 16), 10, 246, 74);
13}
14
15/* The partner view's task: makes layer 0x1009 beside the menus, then once the
16 models are there shows the player's active model on it through a new
17 FighterCamera (ending the other one) and draws the frame each frame; when
18 killed, takes the model off the layer and destroys it */
20 Models *models;
21 ModelControl *control;
22 FighterCamera *other;
23 s32 fighter;
24
25 switch (task->state) {
26 case TASK_INIT:
27 default:
33 task->layer->setOffset(task->layer, 0x102, 0x6A);
34 task->layer->allocCallbacks(task->layer, 0x32);
35 task->nextState(task);
36 break;
37 case TASK_RUN:
38 if (task->substate == 0) {
40 if (models != NULL) {
41 control = models->get(models, 0);
42 control->layers[1].enabled = 1;
43 control->layers[1].wireframe = 0;
44 control->layers[1].layerId = 0x1009;
45 fighter = control->fighter;
46 if (cameras[0] == NULL) {
47 cameras[0] = FIGHTSTG_createCamera(fighter, control);
48 other = cameras[1];
49 } else {
50 cameras[1] = FIGHTSTG_createCamera(fighter, control);
51 other = cameras[0];
52 }
53 if (other != NULL) {
54 other->setState(other, 3);
55 }
56 task->nextSubstate(task);
57 }
58 }
59 FIGHTSTG_drawPartnerViewFrame(task, cameras);
60 break;
61 case 2:
62 task->nextState(task);
63 break;
64 case TASK_KILL:
65 if (task->layer != NULL) {
67 models->get(models, 0)->layers[1].enabled = 0;
68 GFX.funcs.destroyLayer(0x1009);
69 }
70 break;
71 }
72}
73
74/* Creates the partner view (FIGHTSTG_updatePartnerView), whose children are
75 its two cameras */
#define BATTLE_LAYER_MENUS
the HUD, the menus and the messages
Definition types.h:31
#define BATTLE_TASK_MODELS
the fighters'
Definition types.h:23
FIGHTSTG.PRO: the battle.
#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
#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
FighterCamera * FIGHTSTG_createCamera(s32 fighter, ModelControl *control)
Creates the camera of a fighter of the partner view, on control's model.
#define FILE_BATTLE_MENU
The battle menu's files (WFIGHTMN, WFIGHTTS): FILE_BATTLE_IMAGES is an archive whose entries go throu...
Definition file.h:294
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
RECT FIGHTSTG_fighterCameraRect
FIGHTSTG_updatePartnerView's layer.
void FIGHTSTG_drawPartnerViewFrame(PartnerView *task, FighterCamera **cameras)
Draws the frame around the partner view.
Definition partner_view.c:6
void FIGHTSTG_updatePartnerView(PartnerView *task, FighterCamera **cameras)
The partner view's task: makes layer 0x1009 beside the menus, then once the models are there shows th...
PartnerView * FIGHTSTG_createPartnerView(void)
Creates the partner view (FIGHTSTG_updatePartnerView), whose children are its two cameras.
TaskRegistry TASK_REGISTRY
Definition registry.c:122
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
A fighter's camera (FIGHTSTG_createCamera) on layer 0x1009, from its FighterInfo; frames counts the f...
Definition camera.h:13
void(* setState)(struct FighterCamera *task, s32 state)
Definition camera.h:14
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
s32(* destroyLayer)(s32 id)
Definition gfx.h:25
struct Layer *(* createLayer)(RECT *rect, s32 otShift, s32 id)
Definition gfx.h:24
GfxFuncs funcs
Definition gfx.h:77
void(* setOffset)()
no prototype: callers would truncate s16 args
Definition gfx.h:147
void(* allocCallbacks)()
Definition gfx.h:159
What drives a Model, owned by whoever created it.
Definition model.h:99
s32 wireframe
they are drawn as wireframe (Mesh.drawWireframe)
Definition model.h:114
s32 enabled
Definition model.h:112
s32 layerId
the layer its meshes are drawn in
Definition model.h:113
struct ModelControl::@3 layers[2]
the model is drawn once for each one enabled
s32 fighter
the Models task's
Definition model.h:105
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
Definition model.h:284
ModelControl *(* get)(struct Models *task, s32 id)
Definition model.h:289
Shows the partner's model on layer 0x1009 (FIGHTSTG_createPartnerView), through the two FighterCamera...
Definition menu.h:159
void(* nextState)(struct PartnerView *task)
Definition menu.h:160
s32 state
Definition menu.h:160
Layer * layer
Definition menu.h:161
s32 substate
Definition menu.h:160
void(* nextSubstate)(struct PartnerView *task)
Definition menu.h:160
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(* draw)()
(sheet, frame, x, y)
Definition gfx.h:246
void(* setTexture)()
(x, y)
Definition gfx.h:242
void *(* find)(s32 id, s32 key1, s32 key2)
Definition task.h:18
TaskFuncs funcs
Definition task.h:76
Any task, seen through its header.
Definition task.h:62
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105