Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
camera_task.c
Go to the documentation of this file.
1/* The last object of FIGHTSTG.PRO (see model_mesh.c). The USA version has the
2 task of FIGHTSTG_updateCameraTurn here, which the European one has in
3 battle_script.c; the European version has a task of its own here
4 instead, whose jump table starts its rodata at 0x800832B8. */
5
7
8#if VERSION_US
9#include "camera_turn.h"
10#elif VERSION_EU || VERSION_JP
11/* the lists of shots of the European version's own camera (FIGHTSTG_updateCameraShots) */
13 { { 64, 6 }, { 2, 3 }, { -1, 0 } },
14 { { 32, 1 }, { 32, 4 }, { -1, 0 } },
15 { { 32, 2 }, { 32, 4 }, { -1, 0 } },
16};
17
18/* A camera of the European version's own: one of the three lists of shots of
19 FIGHTSTG_euCameraShots, picked at random, from the views of the fighters and
20 the enemy, fades to them and a turn, then the enemy's view. The match
21 depends on the turn's time * 32, which written as a shift reads only the
22 time's low half */
24 switch (task->state) {
25 case 0:
26 default:
27 task->nextState(task);
28 task->list = RANDOM.next() & 3;
29 if (task->list == 3) {
30 task->list = 0;
31 }
32 task->shot = 0;
33 task->time = FIGHTSTG_euCameraShots[task->list][task->shot].time;
34 task->setSubstate(task, FIGHTSTG_euCameraShots[task->list][task->shot].substate);
37 task->view = task->camera->getEnemyView(task->camera);
38 /* fallthrough */
39 case 1:
40 if (task->time <= 0) {
41 if (FIGHTSTG_euCameraShots[task->list][++task->shot].time == -1) {
42 task->setState(task, 3);
43 break;
44 }
45 task->time = FIGHTSTG_euCameraShots[task->list][task->shot].time;
46 task->setSubstate(task, FIGHTSTG_euCameraShots[task->list][task->shot].substate);
47 }
48 switch (task->substate) {
49 case 1:
50 task->view = task->camera->getFighterView(task->camera, 0x10, 0);
51 task->camera->set(task->camera, task->view);
52 task->substate = 0;
53 break;
54 case 2:
55 task->view = task->camera->getFighterView(task->camera, 0, 8);
56 task->camera->set(task->camera, task->view);
57 task->substate = 0;
58 break;
59 case 3:
60 task->view = task->camera->getEnemyView(task->camera);
61 task->camera->set(task->camera, task->view);
62 task->substate = 0;
63 break;
64 case 4:
65 task->to = *task->camera->getEnemyView(task->camera);
66 task->camera->fade(task->camera, NULL, &task->to, task->time);
67 task->substate = 0;
68 break;
69 case 5:
70 task->to = *task->camera->getFighterView(task->camera, 0, 10);
71 task->camera->fade(task->camera, NULL, &task->to, task->time);
72 task->substate = 0;
73 break;
74 case 6:
75 if (task->step == 0) {
76 task->view = task->camera->getEnemyView(task->camera);
77 task->rx = task->view->rot.vx;
78 task->ry = task->view->rot.vy;
79 task->view->rot.vx = task->rx - 0x155;
80 task->view->rot.vy = task->ry + 0x800;
81 task->step++;
82 }
83 task->view->rot.vx = task->rx - task->time * 0x155 / 64;
84 task->view->rot.vy = task->ry + task->time * 32;
85 task->camera->set(task->camera, task->view);
86 break;
87 }
88 task->time -= GFX.funcs.getFrameTime();
89 break;
90 case 3:
91 task->view = task->camera->getEnemyView(task->camera);
92 task->camera->set(task->camera, task->view);
93 break;
94 case 2:
95 break;
96 }
97}
98
99/* Starts the European version's own camera */
103#endif
#define BATTLE_TASK_CAMERA
Definition types.h:21
#define BATTLE_TASK_MODELS
the fighters'
Definition types.h:23
FIGHTSTG.PRO: the battle.
void FIGHTSTG_updateCameraShots(CameraShots *task)
A camera of the European version's own: one of the three lists of shots of FIGHTSTG_euCameraShots,...
Definition camera_task.c:23
CameraShots * FIGHTSTG_startCameraShots(void)
Starts the European version's own camera.
CameraShot FIGHTSTG_euCameraShots[3][3]
the lists of shots of the European version's own camera (FIGHTSTG_updateCameraShots)
Definition camera_task.c:12
The camera's turn around the fighters, a task that both versions have: the USA version in camera_task...
#define NULL
Definition common.h:17
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
Random RANDOM
Definition random.c:533
TaskRegistry TASK_REGISTRY
Definition registry.c:122
CameraView *(* getFighterView)(struct BattleCamera *task, s32 id, s32 camera)
Definition camera.h:77
CameraView *(* getEnemyView)(struct BattleCamera *task)
Definition camera.h:76
void(* set)(struct BattleCamera *task, CameraView *view)
Definition camera.h:74
void(* fade)(struct BattleCamera *task, CameraView *from, CameraView *to, s32 time)
from: NULL for the current
Definition camera.h:75
A shot of FIGHTSTG_updateShotCamera's camera.
Definition camera.h:26
s16 substate
Definition camera.h:28
s16 time
-1 ends the list
Definition camera.h:27
The European version's camera (FIGHTSTG_startCameraShots): one of three lists of shots (FIGHTSTG_euCa...
Definition camera.h:84
void(* setSubstate)(struct CameraShots *task, s32 substate)
Definition camera.h:85
void(* nextState)(struct CameraShots *task)
Definition camera.h:85
struct Models * models
Definition camera.h:88
s32 step
Definition camera.h:85
struct BattleCamera * camera
Definition camera.h:86
s32 time
Definition camera.h:94
void(* setState)(struct CameraShots *task, s32 state)
Definition camera.h:85
struct CameraView to
where substates 4 and 5 fade to
Definition camera.h:96
s16 shot
Definition camera.h:90
s32 substate
Definition camera.h:85
s16 ry
where the turn of substate 6 starts
Definition camera.h:91
s32 state
Definition camera.h:85
struct CameraView * view
Definition camera.h:87
s16 list
Definition camera.h:89
SVECTOR rot
Definition camera.h:59
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
s32(* next)(void)
0 to RANDOM_COUNT - 1
Definition random.h:15
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