Skip to content

Commit bbbda9d

Browse files
committed
Name global cutscene timer, comments
1 parent 0b16915 commit bbbda9d

File tree

16 files changed

+112
-86
lines changed

16 files changed

+112
-86
lines changed

configs/USA/maps/sym.map3_s06.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ MAP_MESSAGES = 0x800D23BC; // type:u32 size:0xBC
144144
//----------------------------------------------------
145145
//--- PA: 0x008F00 VA: 0x800D2478 subsegment: data
146146
//----------------------------------------------------
147+
g_CutsceneTimer = 0x800D2704; // type:s32
147148
sharedData_800DFB4C_0_s00 = 0x800D2708;
148149
sharedData_800DFB50_0_s00 = 0x800D270C;
149150
g_Particle_SpeedX = 0x800D273C; // type:s32

configs/USA/maps/sym.map5_s01.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
//-----------------------------------------------------------------
1212
sharedData_800CAA98_0_s01 = 0x800CA898; // type:s32 size:0xD6C
1313

14+
//------------------------------------------------------
15+
//--- PA: 0x003515 VA: 0x800CCA8D subsegment: rodata
16+
//------------------------------------------------------
17+
1418

1519

1620
//================================================

include/game.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,19 @@ struct _Model;
194194
* @bug Some maps appear to have a bug where the negative position check will never be true because they check
195195
* if the chunk index will be a positive number. Seems like they forgot to use `ABS`?
196196
*/
197-
#define PLAYER_IN_MAP_CHUNK(comp, x0, x1, x2, x3) \
198-
(__chunkIdx = g_SysWork.player_4C.chara_0.position_18.comp / Q12(40.0f), \
199-
((g_SysWork.player_4C.chara_0.position_18.comp > Q12(0.0f) && (__chunkIdx + (x0)) == (x1)) || \
197+
#define PLAYER_IN_MAP_CHUNK(comp, x0, x1, x2, x3) \
198+
(__chunkIdx = g_SysWork.player_4C.chara_0.position_18.comp / Q12(40.0f), \
199+
((g_SysWork.player_4C.chara_0.position_18.comp > Q12(0.0f) && (__chunkIdx + (x0)) == (x1)) || \
200200
(g_SysWork.player_4C.chara_0.position_18.comp <= Q12(0.0f) && (__chunkIdx + (x2)) == (x3))))
201201

202-
#define PLAYER_NOT_IN_MAP_CHUNK(comp, x0, x1, x2, x3) \
203-
(__chunkIdx = g_SysWork.player_4C.chara_0.position_18.comp / Q12(40.0f), \
204-
((g_SysWork.player_4C.chara_0.position_18.comp > Q12(0.0f) && (__chunkIdx + (x0)) != (x1)) || \
202+
#define PLAYER_NOT_IN_MAP_CHUNK(comp, x0, x1, x2, x3) \
203+
(__chunkIdx = g_SysWork.player_4C.chara_0.position_18.comp / Q12(40.0f), \
204+
((g_SysWork.player_4C.chara_0.position_18.comp > Q12(0.0f) && (__chunkIdx + (x0)) != (x1)) || \
205205
(g_SysWork.player_4C.chara_0.position_18.comp <= Q12(0.0f) && (__chunkIdx + (x2)) != (x3))))
206206

207-
#define PLAYER_NEAR_POS(comp, base, tol) \
208-
(((g_SysWork.player_4C.chara_0.position_18.comp - Q12(base)) >= 0) ? ((g_SysWork.player_4C.chara_0.position_18.comp - Q12(base)) < Q12(tol)) : ((Q12(base) - g_SysWork.player_4C.chara_0.position_18.comp) < Q12(tol)))
207+
#define PLAYER_NEAR_POS(comp, base, tol) \
208+
(((g_SysWork.player_4C.chara_0.position_18.comp - Q12(base)) >= Q12(0.0f)) ? ((g_SysWork.player_4C.chara_0.position_18.comp - Q12(base)) < Q12(tol)) : \
209+
((Q12(base) - g_SysWork.player_4C.chara_0.position_18.comp) < Q12(tol)))
209210

210211
#define HAS_FLAG(ptr, idx) \
211212
((((u32*)ptr)[(idx) >> 5] >> ((idx) & 0x1F)) & (1 << 0))
@@ -892,7 +893,7 @@ typedef union
892893
s8 rightY;
893894
s8 leftX;
894895
s8 leftY;
895-
} sticks_0; // Range is `[-128, 127]`?
896+
} sticks_0; // Normalized range: `[-128, 127]`.
896897
} s_AnalogSticks;
897898

898899
typedef struct _AnalogController

include/maps/map3/map3_s06.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ extern u16 D_800D26D0;
2222

2323
extern VECTOR3 D_800D26F8;
2424

25-
extern q19_12 D_800D2704; // Time.
25+
extern q19_12 g_CutsceneTimer;
2626

2727
extern VECTOR3 D_800D2718;
2828

2929
extern VECTOR3 D_800D2728;
3030

31-
extern s16 D_800D2734;
31+
extern q3_12 D_800D2734; // Timer. Only used for `func_800D0C14`, state 8.
3232

33-
extern u8 D_800D2736;
33+
extern u8 D_800D2736; // Sound index.
3434

35-
extern u8 D_800D2737;
35+
extern u8 D_800D2737; // `bool`
3636

3737
extern u8 D_800D2738;
3838

39-
extern s_WorldObjectDesc g_WorldObject_SavePad; //D_800D5ED8;
40-
extern s_WorldObjectDesc g_WorldObject_Map; //D_800D5F08;
41-
extern s_WorldObjectDesc g_WorldObject_Map2; //D_800D5F38;
42-
extern s_WorldObjectDesc g_WorldObject_Key; //D_800D5F68;
43-
extern s_WorldObjectDesc g_WorldObject_FirstAidKit; //D_800D5F98;
39+
extern s_WorldObjectDesc g_WorldObject_SavePad; // D_800D5ED8;
40+
extern s_WorldObjectDesc g_WorldObject_Map; // D_800D5F08;
41+
extern s_WorldObjectDesc g_WorldObject_Map2; // D_800D5F38;
42+
extern s_WorldObjectDesc g_WorldObject_Key; // D_800D5F68;
43+
extern s_WorldObjectDesc g_WorldObject_FirstAidKit; // D_800D5F98;
4444

4545
void func_800D07A0(s32 arg0);
4646

include/maps/shared/SysWork_StateStepIncrementAfterTime.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
/** @brief Waits for an external timer to be above `timeMin`, incrementing the timer until it reaches
2-
* `timeMax`. After this time, it increments `StateStep`.
2+
* `timeMax`. After this time, it increments the cutscene state step.
3+
*
4+
* TODO: Specific to cutscene map events. Revised name could be `SysWork_CutsceneStateStepIncrement` or `Map_CutsceneStateStepIncrement`.
35
*
46
* @param timer External timer.
57
* @param timeInc Time increment.
68
* @param timeMin Minimum time before the external timer can be incremented.
79
* @param timeMax Maximum time before the system state step can be incremented.
810
* @param setTimerToMax Clamp the external timer to the max time when it is reached.
9-
* @param incStateStep Increment the system state step when max time is reached.
11+
* @param incStateStep Increment the cutscene state step when max time is reached.
1012
*/
11-
void SysWork_StateStepIncrementAfterTime(q19_12* timer, q19_12 inc, q19_12 timeMin, q19_12 timeMax, bool setTimerToMax, bool incStateStep) // 0x800DA8E8
13+
void SysWork_StateStepIncrementAfterTime(q19_12* timer, q19_12 timeInc, q19_12 timeMin, q19_12 timeMax, bool setTimerToMax, bool incStateStep) // 0x800DA8E8
1214
{
15+
// Clamp timer to min.
1316
if (*timer < timeMin)
1417
{
1518
*timer = timeMin;
1619
return;
1720
}
1821

19-
*timer += FP_MULTIPLY_PRECISE(g_DeltaTime0, inc, Q12_SHIFT);
20-
if (timeMax < *timer)
22+
// Increment timer.
23+
*timer += FP_MULTIPLY_PRECISE(g_DeltaTime0, timeInc, Q12_SHIFT);
24+
25+
// End timer and increment state step.
26+
if (*timer > timeMax)
2127
{
2228
if (setTimerToMax)
2329
{

src/maps/map0_s01/map0_s01_events.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void MapEvent_CafeCutscene(void) // 0x800DA980
105105
Chara_ProcessLoads();
106106
Chara_Spawn(Chara_Cybil, 0, Q12(4.4f), Q12(269.9f), FP_ANGLE(0.0f), 2);
107107

108-
g_Timer0 = 0;
108+
g_Timer0 = Q12(0.0f);
109109
SysWork_StateStepIncrement(0);
110110

111111
case 1:
@@ -907,13 +907,10 @@ void Map_WorldObjectsInit(void) // 0x800DC9C8
907907
WorldObject_ModelNameSet(&D_800E2450[0], "OUT1_HID");
908908
WorldObject_ModelNameSet(&D_800E2450[1], "OUT_BLD_");
909909

910-
WorldObjectInit(&g_EventThing_KitchenKnife, "KNIFE_HI", 5.09f, -1.01f, 274.12f, 0.0f, 32.0f, 0.0f);
911-
912-
WorldObjectInit(&g_EventThing_Flashlight, "FLASH_HI", 5.18f, -1.0f, 267.28f, -3.0f, 111.0f, 0.0f);
913-
914-
WorldObjectInit(&g_EventThing_Map, "MAP_HIDE", 5.24f, -1.0f, 267.21f, 0.0f, 57.0f, 0.0f);
915-
916-
WorldObjectInit(&g_EventThing_PocketRadio, "RADIO_HI", 2.31f, -0.6f, 273.95f, 0.0f, 147.0f, 0.0f);
910+
WorldObjectInit(&g_EventThing_KitchenKnife, "KNIFE_HI", 5.09f, -1.01f, 274.12f, 0.0f, 32.0f, 0.0f);
911+
WorldObjectInit(&g_EventThing_Flashlight, "FLASH_HI", 5.18f, -1.0f, 267.28f, -3.0f, 111.0f, 0.0f);
912+
WorldObjectInit(&g_EventThing_Map, "MAP_HIDE", 5.24f, -1.0f, 267.21f, 0.0f, 57.0f, 0.0f);
913+
WorldObjectInit(&g_EventThing_PocketRadio, "RADIO_HI", 2.31f, -0.6f, 273.95f, 0.0f, 147.0f, 0.0f);
917914

918915
if (Savegame_EventFlagGet(EventFlag_40) && !Savegame_EventFlagGet(EventFlag_47))
919916
{

src/maps/map1_s01/map1_s01.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ void func_800D8794(void) // 0x800D8794
971971
MapMsg_DisplayWithTexture(FILE_TIM_LOCKER0_TIM, Q12(0.0f), Q12(0.0f), 32);
972972
}
973973

974-
extern s32 g_Timer0;
974+
extern s32 g_Timer0; // Cutscene timer.
975975
extern u8 D_800DD598;
976976
extern VECTOR3 g_CameraPositionTarget;
977977
extern VECTOR3 g_CameraLookAtTarget;

src/maps/map1_s04/map1_s04.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void func_800CCA2C(void) // 0x800CCA2C
221221

222222
Gfx_DebugStringPosition(50, 50);
223223

224-
if (g_Controller0->btnsClicked_10 & g_GameWorkPtr->config_0.controllerConfig_0.skip_4)
224+
if ((g_Controller0->btnsClicked_10 & g_GameWorkPtr->config_0.controllerConfig_0.skip_4))
225225
{
226226
SysWork_StateStepIncrement(0);
227227
}

src/maps/map1_s05/map1_s05.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void func_800D49AC(void) // 0x800D49AC
292292
{
293293
s32 i;
294294

295-
if (g_Controller0->btnsClicked_10 & g_GameWorkPtr->config_0.controllerConfig_0.skip_4)
295+
if ((g_Controller0->btnsClicked_10 & g_GameWorkPtr->config_0.controllerConfig_0.skip_4))
296296
{
297297
if (g_SysWork.sysStateStep_C[0] >= 3)
298298
{

src/maps/map1_s06/map1_s06.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ void func_800D5DD8(void) // 0x800D5DD8
589589
{
590590
#define CUTSCENE_SKIP_STATE 14
591591

592-
if (g_Controller0->btnsClicked_10 & g_GameWorkPtr->config_0.controllerConfig_0.skip_4)
592+
if ((g_Controller0->btnsClicked_10 & g_GameWorkPtr->config_0.controllerConfig_0.skip_4))
593593
{
594594
if (g_SysWork.sysStateStep_C[0] > 0 && g_SysWork.sysStateStep_C[0] < 6)
595595
{

0 commit comments

Comments
 (0)