z_parameter: Timers (#1031)

* import timers from parameter branch

* more cleanup

* small namechange

* improved docs

* more cleanup

* one more namechange

* another small cleanup...

* fix destroy

* plurals

* revert graphic function names

* PR suggestions, better docs

* revert namechange, better postman timer name

* oops

* fix merge

* fix merge

* fix bss

* PR Suggestions
This commit is contained in:
engineer124
2022-09-29 09:57:44 -03:00
committed by GitHub
parent 084bafcfcc
commit 8f2fe9b3c7
37 changed files with 1016 additions and 282 deletions
+10 -17
View File
@@ -1651,7 +1651,7 @@ s16 func_80105318(void);
void func_8010549C(PlayState* play, void* segmentAddress);
void func_8010565C(PlayState* play, u8 num, void* segmentAddress);
void func_80105818(PlayState* play, u32 uParm2, TransitionActorEntry* puParm3);
void func_80105A40(void);
void func_80105A40(PlayState* play);
void func_80105B34(PlayState* play);
void func_80105C40(s16 arg0);
// void func_80105FE0(void);
@@ -1728,7 +1728,7 @@ s32 func_8010A0A4(PlayState* play);
// void func_8010A2AC(PlayState* play);
void Minimap_SavePlayerRoomInitInfo(PlayState* play);
void Map_InitRoomData(PlayState* play, s16 room);
// void Map_Destroy(void);
void Map_Destroy(PlayState* play);
// void Map_Init(PlayState* play);
// void Minimap_Draw(PlayState* play);
// void Map_Update(PlayState* play);
@@ -1811,17 +1811,13 @@ Gfx* func_8010CD98(Gfx* displayListHead, void* texture, s16 textureWidth, s16 te
// void func_8010CFBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14);
// void func_8010D2D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11);
// void func_8010D480(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16);
// void func_8010D7D0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10);
Gfx* func_8010D7D0(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy);
// void func_8010D9F4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14);
Gfx* func_8010DC58(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, u16 i);
// void func_8010DE38(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6);
// void func_8010E028(void);
// void func_8010E968(void);
void func_8010E9F0(s16 arg0, s16 arg1);
void func_8010EA9C(s32 arg0, s32 arg1);
// void func_8010EB50(void);
// void func_8010EBA0(void);
// void func_8010EC54(void);
void Interface_StartTimer(s16 timerId, s16 seconds);
void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState);
void func_8010EE74(PlayState* play, s32 day);
void Interface_SetHudVisibility(u16 hudVisibility);
// void func_80110038(void);
@@ -1870,17 +1866,14 @@ void func_8011B4E0(PlayState* play, s32 arg1);
// void func_8011B9E0(void);
// void func_8011BF70(void);
// void func_8011C4C4(void);
void func_8011C808(PlayState* play);
// void func_8011C898(void);
// void func_8011CA64(void);
// void func_8011E3B4(void);
void Interface_StartMoonCrash(PlayState* play);
// void func_8011E730(void);
// void func_8011F0E0(UNK_TYPE4 ctxt);
// void func_80120F90(void);
// void func_80121000(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE1 param_8, UNK_TYPE1 param_9, UNK_TYPE1 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE4 param_13, UNK_TYPE4 param_14);
// void func_80121064(void);
// void func_801210E0(void);
// void func_80121F94(void);
void Interface_Destroy(PlayState* play);
void func_80121FC4(PlayState* play);
Path* Path_GetByIndex(PlayState* play, s16 index, s16 max);
f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw);
@@ -1947,7 +1940,7 @@ s32 Player_ActionToExplosive(Player* player, s32 actionParam);
s32 Player_GetExplosiveHeld(Player* player);
s32 func_80124278(Actor* actor, s32 arg1);
s32 func_801242B4(Player* player);
s32 func_801242DC(PlayState* play);
s32 Player_GetEnvTimerType(PlayState* play);
void func_80124420(Player* player);
void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2);
void func_801246F4(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, s32 face, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor);
@@ -2703,8 +2696,8 @@ void Main(void* arg);
u32 Padmgr_GetControllerBitmask(void);
void func_80174F24(void (*arg0)(void*), void* arg1);
void func_80174F44(void (*arg0)(void*), void* arg1);
// void func_80174F7C(void);
// void func_80174F9C(void);
void func_80174F7C(void (*arg0)(s32), void* arg1);
void func_80174F9C(void (*arg0)(s32), void* arg1);
// OSMesgQueue* Padmgr_GetEventCallback(void);
// void func_80175008(void);
void Padmgr_SetEventCallback(OSMesg pvParm1);
+2
View File
@@ -71,6 +71,8 @@
#define R_A_ICON_X XREG(20)
#define R_A_BTN_COLOR(i) XREG(22 + i)
#define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41)
#define R_MOON_CRASH_TIMER_Y XREG(80)
#define R_MOON_CRASH_TIMER_X XREG(81)
#define R_MINIMAP_DISABLED XREG(95)
#define R_B_LABEL_DD WREG(0)
#define R_OW_MINIMAP_X WREG(29)
+13 -13
View File
@@ -1031,21 +1031,21 @@ extern UNK_PTR D_801BF5C0;
// extern UNK_TYPE2 sMagicMeterOutlinePrimBlue;
// extern UNK_TYPE2 sMagicBorderRatio;
// extern UNK_TYPE2 sMagicBorderStep;
// extern UNK_TYPE2 D_801BF8DC;
// extern UNK_TYPE2 D_801BF8E0;
// extern UNK_TYPE2 D_801BF8E4;
// extern UNK_TYPE4 D_801BF8E8;
// extern UNK_TYPE4 D_801BF8F0;
// extern UNK_TYPE2 sEnvTimerType;
// extern UNK_TYPE2 sEnvTimerActive;
// extern UNK_TYPE2 sPostmanBunnyHoodState;
// extern UNK_TYPE4 sTimerPausedOsTime;
// extern UNK_TYPE4 sBottleTimerPausedOsTime;
// extern UNK_TYPE4 D_801BF8F4;
// extern UNK_TYPE4 D_801BF8F8;
// extern UNK_TYPE4 D_801BF8FC;
// extern UNK_TYPE4 D_801BF930;
// extern UNK_TYPE4 D_801BF934;
// extern UNK_TYPE1 D_801BF968;
// extern UNK_TYPE1 sIsTimerPaused;
// extern UNK_TYPE1 D_801BF96A;
// extern UNK_TYPE1 D_801BF96C;
// extern UNK_TYPE1 sIsBottleTimerPaused;
// extern UNK_TYPE1 D_801BF96E;
// extern UNK_TYPE2 D_801BF970;
// extern UNK_TYPE2 sTimerId;
// extern UNK_TYPE1 D_801BF972;
// extern UNK_TYPE2 D_801BF974;
// extern UNK_TYPE2 D_801BF978;
@@ -1083,7 +1083,7 @@ extern UNK_PTR D_801BF5C0;
// extern UNK_TYPE2 D_801BFA4C;
// extern UNK_TYPE2 D_801BFA64;
// extern UNK_TYPE2 D_801BFA74;
// extern UNK_TYPE4 D_801BFA84;
// extern UNK_TYPE4 sPostmanTimerInputBtnAPressed;
// extern UNK_TYPE1 D_801BFAB0;
// extern UNK_TYPE1 D_801BFAB8;
// extern UNK_TYPE1 D_801BFAC4;
@@ -1135,15 +1135,15 @@ extern UNK_PTR D_801BF5C0;
// extern UNK_TYPE2 D_801BFCA8;
// extern UNK_TYPE1 D_801BFCB8;
// extern UNK_TYPE4 D_801BFCC4;
// extern UNK_TYPE2 D_801BFCE4;
// extern UNK_TYPE2 D_801BFCE8;
// extern UNK_TYPE2 sTimerStateTimer;
// extern UNK_TYPE2 sTimerDigits;
// extern UNK_TYPE2 D_801BFCEA;
// extern UNK_TYPE2 D_801BFCEC;
// extern UNK_TYPE2 D_801BFCEE;
// extern UNK_TYPE2 D_801BFCF0;
// extern UNK_TYPE2 D_801BFCF2;
// extern UNK_TYPE2 D_801BFCF4;
// extern UNK_TYPE2 D_801BFCF8;
// extern UNK_TYPE2 sTimerBeepSfxSeconds;
// extern UNK_TYPE2 D_801BFCFC;
// extern UNK_TYPE2 D_801BFD0C;
// extern UNK_TYPE1 D_801BFD1C;
@@ -3151,7 +3151,7 @@ extern s16 D_801F4E7A;
// extern UNK_TYPE1 D_801F57B4;
// extern UNK_TYPE1 D_801F5834;
// extern NmiBuff* gNMIBuffer;
// extern UNK_TYPE1 D_801F5850;
// extern UNK_TYPE1 sPostmanTimerInput;
// extern UNK_TYPE1 D_801F58B0;
// extern UNK_TYPE1 D_801F59AC;
// extern UNK_TYPE1 D_801F59B0;
+9 -1
View File
@@ -70,6 +70,14 @@ typedef enum {
/* 0x19 */ PLAYER_MASK_MAX
} PlayerMask;
typedef enum {
/* 0 */ PLAYER_ENV_TIMER_NONE,
/* 1 */ PLAYER_ENV_TIMER_HOTROOM,
/* 2 */ PLAYER_ENV_TIMER_UNDERWATER_FLOOR,
/* 3 */ PLAYER_ENV_TIMER_SWIMMING,
/* 4 */ PLAYER_ENV_TIMER_UNDERWATER_FREE
} PlayerEnvTimerType;
typedef enum PlayerActionParam {
/* -1 */ PLAYER_AP_MINUS1 = -1,
/* 0x00 */ PLAYER_AP_NONE,
@@ -594,7 +602,7 @@ typedef struct Player {
/* 0xAD0 */ f32 linearVelocity;
/* 0xAD4 */ s16 currentYaw;
/* 0xAD6 */ s16 targetYaw;
/* 0xAD8 */ u16 unk_AD8;
/* 0xAD8 */ u16 underwaterTimer;
/* 0xADA */ s8 meleeWeaponAnimation;
/* 0xADB */ s8 meleeWeaponState;
/* 0xADC */ s8 unk_ADC;
+66 -15
View File
@@ -2,6 +2,7 @@
#define Z64SAVE_H
#include "ultra64.h"
#include "z64item.h"
#include "z64math.h"
#include "os.h"
@@ -54,6 +55,56 @@ typedef enum {
#define MAGIC_NORMAL_METER 0x30
#define MAGIC_DOUBLE_METER (2 * MAGIC_NORMAL_METER)
#define SECONDS_TO_TIMER(seconds) ((seconds) * 100)
#define OSTIME_TO_TIMER(osTime) ((osTime) * 64 / 3000 / 10000)
#define OSTIME_TO_TIMER_ALT(osTime) ((osTime) / 10000 * 64 / 3000)
// 1 centisecond = 10 milliseconds = 1/100 seconds
#define SECONDS_TO_TIMER_PRECISE(seconds, centiSeconds) ((seconds) * 100 + (centiSeconds))
typedef enum {
/* 0 */ TIMER_ID_POSTMAN, // postman's counting minigame
/* 1 */ TIMER_ID_MINIGAME_1, // minigame timer
/* 2 */ TIMER_ID_2,
/* 3 */ TIMER_ID_MOON_CRASH, // timer used for mooncrash on the clocktower roof
/* 4 */ TIMER_ID_MINIGAME_2, // minigame timer
/* 5 */ TIMER_ID_ENV, // environmental timer (underwater or hot room)
/* 6 */ TIMER_ID_GORON_RACE_UNUSED,
/* 7 */ TIMER_ID_MAX,
/* 99 */ TIMER_ID_NONE = 99,
} TimerId;
typedef enum {
/* 0 */ TIMER_COUNT_DOWN,
/* 1 */ TIMER_COUNT_UP
} TimerDirection;
typedef enum {
/* 0 */ TIMER_STATE_OFF,
/* 1 */ TIMER_STATE_START,
/* 2 */ TIMER_STATE_HOLD_TIMER, // Hold timer frozen at the screen center
/* 3 */ TIMER_STATE_MOVING_TIMER, // Move timer to a target location
/* 4 */ TIMER_STATE_COUNTING,
/* 5 */ TIMER_STATE_STOP,
/* 6 */ TIMER_STATE_6, // like `TIMER_STATE_STOP` but with extra minigame checks
/* 7 */ TIMER_STATE_7, // stopped but still update `timerCurTimes`
/* 8 */ TIMER_STATE_ENV_START,
/* 9 */ TIMER_STATE_ALT_START,
/* 10 */ TIMER_STATE_10, // precursor to `TIMER_STATE_ALT_COUNTING`
/* 11 */ TIMER_STATE_ALT_COUNTING,
/* 12 */ TIMER_STATE_12, // Updated paused time?
/* 13 */ TIMER_STATE_POSTMAN_START,
/* 14 */ TIMER_STATE_POSTMAN_COUNTING,
/* 15 */ TIMER_STATE_POSTMAN_STOP,
/* 16 */ TIMER_STATE_POSTMAN_END
} TimerState;
typedef enum {
/* 0 */ BOTTLE_TIMER_STATE_OFF,
/* 1 */ BOTTLE_TIMER_STATE_COUNTING
} BottleTimerState;
typedef enum {
/* 0 */ HUD_VISIBILITY_IDLE,
/* 1 */ HUD_VISIBILITY_NONE,
@@ -242,11 +293,11 @@ typedef struct SaveContext {
/* 0x1015 */ u8 unk_1015;
/* 0x1016 */ u16 jinxTimer;
/* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct"
/* 0x101A */ u8 unk_101A[6]; // "bottle_status", one entry for each bottle
/* 0x1020 */ OSTime unk_1020[6]; // "bottle_ostime", one entry for each bottle
/* 0x1050 */ OSTime unk_1050[6]; // "bottle_sub", one entry for each bottle
/* 0x1080 */ OSTime unk_1080[6]; // "bottle_time", one entry for each bottle
/* 0x10B0 */ OSTime unk_10B0[6]; // "bottle_stop_time", one entry for each bottle
/* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status"
/* 0x1020 */ OSTime bottleTimerStartOsTimes[BOTTLE_MAX]; // The osTime when the timer starts. "bottle_ostime"
/* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub"
/* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time"
/* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time"
/* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo
/* 0x3CA0 */ s32 fileNum; // "file_no"
/* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer"
@@ -265,16 +316,16 @@ typedef struct SaveContext {
/* 0x3DBF */ u8 showTitleCard; // "name_display"
/* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer"
/* 0x3DC2 */ u8 unk_3DC2; // "pad1"
/* 0x3DC8 */ OSTime unk_3DC8; // "get_time"
/* 0x3DD0 */ u8 unk_3DD0[7]; // "event_fg"
/* 0x3DD7 */ u8 unk_3DD7[7]; // "calc_flag"
/* 0x3DE0 */ OSTime unk_3DE0[7]; // "event_ostime"
/* 0x3E18 */ OSTime unk_3E18[7]; // "event_sub"
/* 0x3E50 */ OSTime unk_3E50[7]; // "func_time"
/* 0x3E88 */ OSTime unk_3E88[7]; // "func_end_time"
/* 0x3EC0 */ OSTime unk_3EC0[7]; // "func_stop_time"
/* 0x3EF8 */ s16 timerX[7]; // "event_xp"
/* 0x3F06 */ s16 timerY[7]; // "event_yp"
/* 0x3DC8 */ OSTime postmanTimerStopOsTime; // The osTime when the timer stops for the postman minigame. "get_time"
/* 0x3DD0 */ u8 timerStates[TIMER_ID_MAX]; // See the `TimerState` enum. "event_fg"
/* 0x3DD7 */ u8 timerDirections[TIMER_ID_MAX]; // See the `TimerDirection` enum. "calc_flag"
/* 0x3DE0 */ u64 timerCurTimes[TIMER_ID_MAX]; // For countdown, the remaining time left. For countup, the time since the start. In centiseconds (1/100th sec). "event_ostime"
/* 0x3E18 */ u64 timerTimeLimits[TIMER_ID_MAX]; // The original total time given for the timer to count from, in centiseconds (1/100th sec). "event_sub"
/* 0x3E50 */ OSTime timerStartOsTimes[TIMER_ID_MAX]; // The osTime when the timer starts. "func_time"
/* 0x3E88 */ u64 timerStopTimes[TIMER_ID_MAX]; // The total amount of time taken between the start and end of the timer, in centiseconds (1/100th sec). "func_end_time"
/* 0x3EC0 */ OSTime timerPausedOsTimes[TIMER_ID_MAX]; // The cumulative osTime spent with the timer paused. "func_stop_time"
/* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp"
/* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp"
/* 0x3F14 */ s16 unk_3F14; // "character_change"
/* 0x3F16 */ u8 seqIndex; // "old_bgm"
/* 0x3F17 */ u8 nightSeqIndex; // "old_env"
-1
View File
@@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
u8 D_80096B20 = 1;
+1 -1
View File
@@ -688,7 +688,7 @@ void Inventory_SetMapVisibility(s16 tingleIndex) {
void Inventory_SaveDekuPlaygroundHighScore(s16 timerId) {
s16 i;
gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.unk_3DE0[timerId];
gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.timerCurTimes[timerId];
for (i = 0; i < 8; i++) {
gSaveContext.save.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] =
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "vt.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
+3 -3
View File
@@ -18,14 +18,14 @@ static s16 sGameOverTimer = 0;
void GameOver_Update(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
s16 i;
s16 timerId;
switch (gameOverCtx->state) {
case GAMEOVER_DEATH_START:
func_801477B4(play);
for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) {
gSaveContext.unk_3DD0[i] = 0;
for (timerId = 0; timerId < TIMER_ID_MAX; timerId++) {
gSaveContext.timerStates[timerId] = TIMER_STATE_OFF;
}
gSaveContext.eventInf[1] &= ~1;
+2 -2
View File
@@ -169,8 +169,8 @@ void Map_InitRoomData(PlayState* play, s16 room) {
}
}
void Map_Destroy(void) {
func_80105A40();
void Map_Destroy(PlayState* play) {
func_80105A40(play);
}
void Map_Init(PlayState* play) {
+692 -38
View File
File diff suppressed because it is too large Load Diff
+13 -12
View File
@@ -860,39 +860,40 @@ s32 func_80124278(Actor* actor, s32 actionParam) {
}
s32 func_801242B4(Player* player) {
return (player->stateFlags1 & PLAYER_STATE1_8000000) && player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER;
return (player->stateFlags1 & PLAYER_STATE1_8000000) && (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER);
}
s32 func_801242DC(PlayState* play) {
s32 Player_GetEnvTimerType(PlayState* play) {
Player* player = GET_PLAYER(play);
TextTriggerEntry* triggerEntry;
s32 envIndex;
s32 envTimerType;
if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot
envIndex = 0;
} else if ((player->transformation != PLAYER_FORM_ZORA) && (player->unk_AD8 > 80)) {
envIndex = 3;
envTimerType = PLAYER_ENV_TIMER_HOTROOM - 1;
} else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) {
envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FREE - 1;
} else if (player->stateFlags1 & PLAYER_STATE1_8000000) {
if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) &&
(player->actor.bgCheckFlags & 1)) {
envIndex = 1;
envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FLOOR - 1;
} else {
envIndex = 2;
envTimerType = PLAYER_ENV_TIMER_SWIMMING - 1;
}
} else {
return 0;
return PLAYER_ENV_TIMER_NONE;
}
// Trigger general textboxes under certain conditions, like "It's so hot in here!". Unused in MM
triggerEntry = &sEnvironmentTextTriggers[envIndex];
triggerEntry = &sEnvironmentTextTriggers[envTimerType];
if (!Player_InCsMode(play)) {
if ((triggerEntry->flag) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) && (envIndex == 0)) {
if ((triggerEntry->flag) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) &&
(envTimerType == (PLAYER_ENV_TIMER_HOTROOM - 1))) {
Message_StartTextbox(play, triggerEntry->textId, NULL);
gSaveContext.textTriggerFlags |= triggerEntry->flag;
}
}
return envIndex + 1;
return envTimerType + 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80124420.s")
+22 -22
View File
@@ -219,13 +219,13 @@ void Sram_ActivateOwl(u8 owlId) {
void Sram_ClearHighscores(void) {
gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF) | 0x130000;
gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF0000) | 0xA;
gSaveContext.save.horseBackBalloonHighScore = 6000; // 60 seconds
gSaveContext.save.horseBackBalloonHighScore = SECONDS_TO_TIMER(60);
SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(39);
SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(10);
gSaveContext.save.dekuPlaygroundHighScores[0] = 7500; // 75 seconds
gSaveContext.save.dekuPlaygroundHighScores[1] = 7500; // 75 seconds
gSaveContext.save.dekuPlaygroundHighScores[2] = 7600; // 76 seconds
gSaveContext.save.dekuPlaygroundHighScores[0] = SECONDS_TO_TIMER(75);
gSaveContext.save.dekuPlaygroundHighScores[1] = SECONDS_TO_TIMER(75);
gSaveContext.save.dekuPlaygroundHighScores[2] = SECONDS_TO_TIMER(76);
}
/**
@@ -646,7 +646,7 @@ Inventory sSaveDefaultInventory = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
// dungeonKeys
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
// defenceHearts
// defenseHearts
0,
// strayFairies
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -792,7 +792,7 @@ Inventory sSaveDebugInventory = {
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 },
// dungeonKeys
{ 8, 8, 8, 8, 8, 8, 8, 8, 8 },
// defenceHearts
// defenseHearts
0,
// strayFairies
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -894,13 +894,13 @@ void func_80144A94(SramContext* sramCtx) {
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible;
}
for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) {
gSaveContext.unk_3DD0[i] = 0;
gSaveContext.unk_3DE0[i] = 0;
gSaveContext.unk_3E18[i] = 0;
gSaveContext.unk_3E50[i] = 0;
gSaveContext.unk_3E88[i] = 0;
gSaveContext.unk_3EC0[i] = 0;
for (i = 0; i < TIMER_ID_MAX; i++) {
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTimes[i] = 0;
gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerPausedOsTimes[i] = 0;
}
D_801BDAA0 = 1;
@@ -969,13 +969,13 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) {
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible;
}
for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) {
gSaveContext.unk_3DD0[i] = 0;
gSaveContext.unk_3DE0[i] = 0;
gSaveContext.unk_3E18[i] = 0;
gSaveContext.unk_3E50[i] = 0;
gSaveContext.unk_3E88[i] = 0;
gSaveContext.unk_3EC0[i] = 0;
for (i = 0; i < TIMER_ID_MAX; i++) {
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTimes[i] = 0;
gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerPausedOsTimes[i] = 0;
}
if (gSaveContext.save.isFirstCycle) {
@@ -1598,7 +1598,7 @@ void func_80147068(SramContext* sramCtx) {
sramCtx->status = 4;
}
}
} else if (((osGetTime() - sramCtx->unk_18) * 0x40) / 3000 / 10000 >= 200) {
} else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->unk_18) >= SECONDS_TO_TIMER(2)) {
sramCtx->status = 0;
}
}
@@ -1635,7 +1635,7 @@ void func_80147198(SramContext* sramCtx) {
sramCtx->status = 4;
}
}
} else if (((osGetTime() - sramCtx->unk_18) * 0x40) / 3000 / 10000 >= 200) {
} else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->unk_18) >= SECONDS_TO_TIMER(2)) {
sramCtx->status = 0;
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
gSaveContext.save.isOwlSave = false;
+8 -8
View File
@@ -1045,11 +1045,11 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) {
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.unk_3DD0[3] == 0) {
if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) {
// Starts a 5 minute (300 second) timer until the moon falls.
func_8010E9F0(3, 300);
XREG(80) = 200;
XREG(81) = 115;
Interface_StartTimer(TIMER_ID_MOON_CRASH, 300);
R_MOON_CRASH_TIMER_Y = 200;
R_MOON_CRASH_TIMER_X = 115;
}
if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) {
@@ -1062,12 +1062,12 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
} else if (gSaveContext.sceneSetupIndex == 3) {
this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED;
if (gSaveContext.unk_3DD0[3] == 0) {
if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) {
// This code is called when the Giants fail to stop the moon.
// Starts a 1 minute (60 second) timer until the moon falls.
func_8010E9F0(3, 60);
XREG(80) = 200;
XREG(81) = 115;
Interface_StartTimer(TIMER_ID_MOON_CRASH, 60);
R_MOON_CRASH_TIMER_Y = 200;
R_MOON_CRASH_TIMER_X = 115;
}
this->actor.world.pos.y = 120.0f;
+7 -7
View File
@@ -402,7 +402,7 @@ void EnAz_Destroy(Actor* thisx, PlayState* play2) {
EnAz* this = THIS;
if (gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 1)) {
gSaveContext.unk_3DD0[4] = 5;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
}
Collider_DestroyCylinder(play2, &this->collider);
}
@@ -1486,11 +1486,11 @@ void func_80A97D5C(EnAz* this, PlayState* play) {
gSaveContext.minigameScore = (this->unk_374 & 2) ? 25 : 20;
play->interfaceCtx.unk_280 = 1;
if ((this->unk_2FA == 1) || (this->unk_2FA == 3)) {
func_8010E9F0(4, 120);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 120);
} else if (gSaveContext.save.weekEventReg[25] & 1) {
func_8010E9F0(4, 100);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 100);
} else {
func_8010E9F0(4, 110);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 110);
}
this->actionFunc = func_80A97E48;
}
@@ -1547,7 +1547,7 @@ void func_80A97F9C(EnAz* this, PlayState* play) {
} else {
gSaveContext.save.weekEventReg[24] |= 1;
}
gSaveContext.unk_3DD0[4] = 5;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
this->unk_374 &= ~0x10;
play->nextEntrance = Entrance_CreateFromSpawn(2);
gSaveContext.nextCutsceneIndex = 0;
@@ -1557,8 +1557,8 @@ void func_80A97F9C(EnAz* this, PlayState* play) {
this->actor.speedXZ = 0.0f;
func_80A979DC(this, play);
} else {
if (gSaveContext.unk_3DE0[4] == 0) {
gSaveContext.unk_3DD0[4] = 5;
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
this->unk_374 |= 0x4000;
func_80A97A28(this, play);
}
+2 -2
View File
@@ -220,7 +220,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) {
} else {
SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C);
thisx->room = -1;
gSaveContext.unk_3DD0[1] = 5;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
this->unk_3B0 |= 1;
this->actionFunc = func_80A72438;
@@ -821,7 +821,7 @@ void func_80A73244(EnDno* this, PlayState* play) {
this->unk_328 = 2;
this->actor.speedXZ = 0.0f;
Flags_UnsetSwitch(play, ENDNO_GET_3F80(&this->actor));
gSaveContext.unk_3DD0[1] = 5;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->unk_44E = 0;
this->actionFunc = func_80A732C8;
}
+13 -12
View File
@@ -401,7 +401,8 @@ void func_80962340(EnFu* this, PlayState* play) {
Message_StartTextbox(play, 0x287E, &this->actor);
this->unk_552 = 0x287E;
}
} else if ((gSaveContext.unk_3DE0[4] == 0) && (this->unk_552 != 0x2888)) {
} else if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) &&
(this->unk_552 != 0x2888)) {
Message_StartTextbox(play, 0x2886, &this->actor);
this->unk_552 = 0x2886;
} else {
@@ -644,7 +645,7 @@ void func_80962A10(EnFu* this, PlayState* play) {
play_sound(NA_SE_SY_FOUND);
player->stateFlags1 &= ~0x20;
func_8010E9F0(4, 60);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 60);
if (this->unk_546 == 1) {
func_809616E0(this, play);
} else {
@@ -681,7 +682,7 @@ void func_80962BCC(EnFu* this, PlayState* play) {
play_sound(NA_SE_SY_FOUND);
player->stateFlags1 &= ~0x20;
player->stateFlags3 |= 0x400000;
func_8010E9F0(4, 60);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 60);
if (this->unk_546 == 1) {
func_809616E0(this, play);
@@ -712,7 +713,7 @@ void func_80962D60(EnFu* this, PlayState* play) {
play_sound(NA_SE_SY_FOUND);
player->stateFlags1 &= ~0x20;
player->stateFlags3 |= 0x400000;
func_8010E9F0(4, 60);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 60);
if (this->unk_546 == 1) {
func_809616E0(this, play);
@@ -760,11 +761,11 @@ void func_80962F4C(EnFu* this, PlayState* play) {
break;
}
if (gSaveContext.unk_3DE0[4] < 2000) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(20)) {
s16 val = D_80964B00[this->unk_542] + 200;
Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5);
} else if (gSaveContext.unk_3DE0[4] < 4000) {
} else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(40)) {
s16 val = D_80964B00[this->unk_542] + 100;
Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5);
@@ -776,12 +777,12 @@ void func_80962F4C(EnFu* this, PlayState* play) {
if ((!DynaPolyActor_IsInRidingRotatingState((DynaPolyActor*)this->actor.child) &&
(player->actor.bgCheckFlags & 1)) ||
(gSaveContext.unk_3DE0[4] < 1) || (this->unk_548 == this->unk_54C)) {
(gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] <= SECONDS_TO_TIMER(0)) || (this->unk_548 == this->unk_54C)) {
player->stateFlags3 &= ~0x400000;
func_80961E88(play);
player->stateFlags1 |= 0x20;
if (this->unk_548 < this->unk_54C) {
if (gSaveContext.unk_3DE0[4] == 0) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) {
Message_StartTextbox(play, 0x2885, &this->actor);
this->unk_552 = 0x2885;
} else {
@@ -789,15 +790,15 @@ void func_80962F4C(EnFu* this, PlayState* play) {
this->unk_552 = 0x2888;
}
func_801A2C20();
gSaveContext.unk_3DE0[4] = 0;
gSaveContext.unk_3DD0[4] = 5;
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
this->unk_548 = 0;
func_809632D0(this);
} else {
this->unk_548 = 0;
func_801A2C20();
gSaveContext.unk_3DE0[4] = 0;
gSaveContext.unk_3DD0[4] = 5;
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
func_801A3098(NA_BGM_GET_ITEM | 0x900);
func_8011B4E0(play, 1);
this->unk_54A = 3;
+5 -5
View File
@@ -459,7 +459,7 @@ void func_80B10240(EnGb2* this, PlayState* play) {
D_80B119B0[this->unk_280].unk_04.y, D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0,
this->unk_27E);
if (this->unk_280 == 0) {
func_8010E9F0(1, 180);
Interface_StartTimer(TIMER_ID_MINIGAME_1, 180);
}
this->actionFunc = func_80B10344;
} else {
@@ -487,7 +487,7 @@ void func_80B10344(EnGb2* this, PlayState* play) {
if (this->unk_26C & 0x200) {
if (this->unk_280 == 3) {
this->unk_26C &= ~0x200;
gSaveContext.unk_3DD0[1] = 5;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
func_800FE498();
gSaveContext.eventInf[4] |= 0x40;
func_80B0FE7C(play);
@@ -506,7 +506,7 @@ void func_80B10344(EnGb2* this, PlayState* play) {
}
if (gSaveContext.save.playerData.health < 49) {
gSaveContext.unk_3DD0[1] = 5;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.eventInf[4] |= 0x40;
gSaveContext.eventInf[4] |= 0x20;
@@ -519,8 +519,8 @@ void func_80B10344(EnGb2* this, PlayState* play) {
}
func_80B0FE7C(play);
} else if (gSaveContext.unk_3DE0[1] == 0) {
gSaveContext.unk_3DD0[1] = 5;
} else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.eventInf[4] |= 0x40;
gSaveContext.eventInf[4] |= 0x10;
+1 -1
View File
@@ -645,7 +645,7 @@ void func_80B51760(EnGk* this, PlayState* play) {
this->unk_1E4 |= 2;
}
} else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) &&
(gSaveContext.save.entrance != 0xD010)) {
(gSaveContext.save.entrance != ENTRANCE(GORON_RACETRACK, 1))) {
func_800B863C(&this->actor, play);
}
@@ -121,7 +121,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) {
return false;
}
func_8010E9F0(4, 0);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 0);
play->interfaceCtx.unk_280 = 1;
this->horse1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0,
@@ -145,7 +145,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) {
}
s32 func_808F8E94(EnHorseGameCheck* this, PlayState* play) {
gSaveContext.unk_3DD0[4] = 0;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
return true;
}
@@ -247,11 +247,11 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
return true;
}
if (gSaveContext.unk_3DE0[4] >= 0x4650) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.unk_3DD0[4] = 6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_4);
this->unk_174 = 60;
}
@@ -284,7 +284,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.unk_3DD0[4] = 6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_3);
this->unk_174 = 60;
}
@@ -317,7 +317,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x02000000;
gSaveContext.unk_3DD0[4] = 6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_3);
this->unk_174 = 60;
}
@@ -346,7 +346,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x800;
gSaveContext.unk_3DD0[4] = 6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_2);
this->unk_174 = 60;
}

Some files were not shown because too many files have changed in this diff Show More