mirror of https://github.com/zeldaret/mm.git
				
				
				
			`ovl_En_Test4` with 1 non-matching (#319)
* Decompile update and stuff * Decompile some more * func_80A41FA4 non_matching * init is a disaster * Import bss * match func_80A41D70 * Improve func_80A42AB8 a bit * equivalent EnTest4_Init * Import data * CLOCK_TIME * Run formatter * func_80A42AB8 may be equivalent now, not completely sure * match func_80A42AB8 * Some minor renames * Name some struct members * Format * format in bigpo * fix merge issue * Apply suggestions from code review Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Description: Day transition effects * Un-rename unk_144 * Update include/macros.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * sIsLoaded * Update src/overlays/actors/ovl_En_Test4/z_en_test4.c Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * review * format * daytemp Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									2f000058f5
								
							
						
					
					
						commit
						96cd49b6d5
					
				| 
						 | 
				
			
			@ -1768,7 +1768,7 @@ void func_800FAAB4(GlobalContext* globalCtx, u8 arg1);
 | 
			
		|||
// void func_800FB010(void);
 | 
			
		||||
void func_800FB320(GlobalContext* globalCtx, u8 param_2);
 | 
			
		||||
// void func_800FB388(void);
 | 
			
		||||
// void func_800FB758(void);
 | 
			
		||||
void func_800FB758(GlobalContext* globalCtx);
 | 
			
		||||
// void func_800FB9B4(void);
 | 
			
		||||
// void func_800FBCBC(void);
 | 
			
		||||
// void func_800FBDEC(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -1814,7 +1814,7 @@ void func_800FE658(f32 arg0);
 | 
			
		|||
// void func_800FEA50(void);
 | 
			
		||||
void func_800FEAB0(void);
 | 
			
		||||
// void func_800FEAC0(void);
 | 
			
		||||
// void func_800FEAF4(void);
 | 
			
		||||
void func_800FEAF4(EnvironmentContext* envCtx);
 | 
			
		||||
void* Lib_MemCpy(void* dest, void* src, size_t size);
 | 
			
		||||
void* Lib_MemSet(void* buffer, s32 value, size_t size);
 | 
			
		||||
f32 Math_CosS(s16 angle);
 | 
			
		||||
| 
						 | 
				
			
			@ -2127,7 +2127,7 @@ void func_8010E9F0(s16 arg0, s16 arg1);
 | 
			
		|||
// void func_8010EB50(void);
 | 
			
		||||
// void func_8010EBA0(void);
 | 
			
		||||
// void func_8010EC54(void);
 | 
			
		||||
// void func_8010EE74(void);
 | 
			
		||||
void func_8010EE74(GlobalContext* globalCtx, s32 day);
 | 
			
		||||
void Interface_ChangeAlpha(u16 param_1);
 | 
			
		||||
// void func_8010EF9C(void);
 | 
			
		||||
// void func_8010F0D4(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -2879,7 +2879,7 @@ void func_80150D08(GlobalContext* globalCtx, u32 uParm2);
 | 
			
		|||
// void func_801514B0(void);
 | 
			
		||||
void func_801518B0(GlobalContext* globalCtx, u16 textId, Actor* Actor);
 | 
			
		||||
void func_80151938(GlobalContext* globalCtx, u16 textId);
 | 
			
		||||
void func_80151A68(GlobalContext* globalCtx, u16 param_2);
 | 
			
		||||
void func_80151A68(GlobalContext* globalCtx, u16 textId);
 | 
			
		||||
void func_80151BB4(GlobalContext* globalCtx, u32 uParm2);
 | 
			
		||||
// void func_80151C9C(void);
 | 
			
		||||
// void func_80151DA4(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -3058,7 +3058,7 @@ void func_80169EFC(GlobalContext* globalCtx);
 | 
			
		|||
s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx);
 | 
			
		||||
// UNK_TYPE4 func_8016A02C(s32 param_1, s32 param_2, s16* param_3);
 | 
			
		||||
// void func_8016A0AC(void);
 | 
			
		||||
// void func_8016A168(void);
 | 
			
		||||
s32 func_8016A168(void);
 | 
			
		||||
// void func_8016A178(void);
 | 
			
		||||
// void func_8016A268(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6);
 | 
			
		||||
void Play_Init(GameState* gameState);
 | 
			
		||||
| 
						 | 
				
			
			@ -3871,7 +3871,7 @@ void func_8019FDC8(UNK_PTR arg0, u16 sfxId, UNK_TYPE arg2);
 | 
			
		|||
// void func_8019FF9C(void);
 | 
			
		||||
// void func_801A0048(void);
 | 
			
		||||
// void func_801A00EC(void);
 | 
			
		||||
// void func_801A0124(void);
 | 
			
		||||
void func_801A0124(Vec3f* pos, u8 arg1);
 | 
			
		||||
// void func_801A0184(void);
 | 
			
		||||
// void func_801A01C4(void);
 | 
			
		||||
void func_801A0204(UNK_TYPE);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,7 @@
 | 
			
		|||
#define CURRENT_DAY (((void)0, gSaveContext.day) % 5)
 | 
			
		||||
 | 
			
		||||
#define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)))
 | 
			
		||||
#define CLOCK_TIME_MINUTE  (CLOCK_TIME(0, 1))
 | 
			
		||||
 | 
			
		||||
#define SLOT(item) gItemSlots[item]
 | 
			
		||||
#define AMMO(item) gSaveContext.inventory.ammo[SLOT(item)]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -949,7 +949,7 @@ extern GameStateOverlay daytelopGameStateInfo;
 | 
			
		|||
// extern UNK_TYPE2 D_801BDA74;
 | 
			
		||||
// extern UNK_TYPE2 D_801BDA78;
 | 
			
		||||
// extern UNK_TYPE2 D_801BDA7C;
 | 
			
		||||
// extern UNK_TYPE4 D_801BDA9C;
 | 
			
		||||
extern s32 D_801BDA9C;
 | 
			
		||||
extern UNK_TYPE4 D_801BDAA0;
 | 
			
		||||
// extern UNK_TYPE4 D_801BDAA4;
 | 
			
		||||
// extern UNK_TYPE2 D_801BDAA8;
 | 
			
		||||
| 
						 | 
				
			
			@ -3312,7 +3312,7 @@ extern u8 actorCutsceneNextCutscenes[16];
 | 
			
		|||
extern f32 D_801F4E70;
 | 
			
		||||
// extern UNK_TYPE1 D_801F4E74;
 | 
			
		||||
// extern UNK_TYPE1 D_801F4E78;
 | 
			
		||||
// extern UNK_TYPE1 D_801F4E7A;
 | 
			
		||||
extern s16 D_801F4E7A;
 | 
			
		||||
// extern UNK_TYPE1 D_801F4E80;
 | 
			
		||||
// extern UNK_TYPE1 D_801F4EE0;
 | 
			
		||||
// extern UNK_TYPE1 D_801F4EE8;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,8 @@ typedef enum {
 | 
			
		|||
} UpgradeType;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    /* 0x01 */ ITEM_BOW = 0x01,
 | 
			
		||||
    /* 0x00 */ ITEM_OCARINA,
 | 
			
		||||
    /* 0x01 */ ITEM_BOW,
 | 
			
		||||
    /* 0x06 */ ITEM_BOMB = 0x06,
 | 
			
		||||
    /* 0x07 */ ITEM_BOMBCHU,
 | 
			
		||||
    /* 0x08 */ ITEM_STICK,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,9 +93,7 @@ typedef enum LightType {
 | 
			
		|||
    /* 0x02 */ LIGHT_POINT_GLOW
 | 
			
		||||
} LightType;
 | 
			
		||||
 | 
			
		||||
typedef struct GlobalContext GlobalContext;
 | 
			
		||||
 | 
			
		||||
typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec);
 | 
			
		||||
typedef void (*LightsPosBindFunc)(Lights* lights, LightParams* params, GlobalContext* globalCtx);
 | 
			
		||||
typedef void (*LightsPosBindFunc)(Lights* lights, LightParams* params, struct GlobalContext* globalCtx);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -176,7 +176,7 @@ typedef struct Player {
 | 
			
		|||
    /* 0x386 */ u16 unk_386;
 | 
			
		||||
    /* 0x388 */ Actor* unk_388;
 | 
			
		||||
    /* 0x38C */ s16 unk_38C;
 | 
			
		||||
    /* 0x390 */ Actor* unk_390;
 | 
			
		||||
    /* 0x390 */ Actor* rideActor;
 | 
			
		||||
    /* 0x394 */ u8 unk_394;
 | 
			
		||||
    /* 0x395 */ u8 unk_395;
 | 
			
		||||
    /* 0x396 */ u8 unk_396;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								spec
								
								
								
								
							
							
						
						
									
										6
									
								
								spec
								
								
								
								
							| 
						 | 
				
			
			@ -2913,9 +2913,11 @@ beginseg
 | 
			
		|||
    name "ovl_En_Test4"
 | 
			
		||||
    compress
 | 
			
		||||
    include "build/src/overlays/actors/ovl_En_Test4/z_en_test4.o"
 | 
			
		||||
    include "build/data/ovl_En_Test4/ovl_En_Test4.data.o"
 | 
			
		||||
    include "build/data/ovl_En_Test4/ovl_En_Test4.bss.o"
 | 
			
		||||
#ifdef NON_MATCHING
 | 
			
		||||
    include "build/src/overlays/actors/ovl_En_Test4/ovl_En_Test4_reloc.o"
 | 
			
		||||
#else
 | 
			
		||||
    include "build/data/ovl_En_Test4/ovl_En_Test4.reloc.o"
 | 
			
		||||
#endif
 | 
			
		||||
endseg
 | 
			
		||||
 | 
			
		||||
beginseg
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,9 @@ struct EnHorse;
 | 
			
		|||
 | 
			
		||||
typedef struct EnHorse {
 | 
			
		||||
    /* 0x000 */ Actor actor;
 | 
			
		||||
    /* 0x144 */ char unk_144[0x450];
 | 
			
		||||
    /* 0x144 */ char unk_144[0x00C];
 | 
			
		||||
    /* 0x150 */ s32 unk_150;
 | 
			
		||||
    /* 0x154 */ char unk_154[0x440];
 | 
			
		||||
} EnHorse; // size = 0x594
 | 
			
		||||
 | 
			
		||||
extern const ActorInit En_Horse_InitVars;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,12 @@
 | 
			
		|||
/*
 | 
			
		||||
 * File: z_en_test4.c
 | 
			
		||||
 * Overlay: ovl_En_Test4
 | 
			
		||||
 * Description: Day transition effects
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "z_en_test4.h"
 | 
			
		||||
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
 | 
			
		||||
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
 | 
			
		||||
 | 
			
		||||
#define FLAGS 0x00100030
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +19,6 @@ void EnTest4_Update(Actor* thisx, GlobalContext* globalCtx);
 | 
			
		|||
void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx);
 | 
			
		||||
void func_80A42F20(EnTest4* this, GlobalContext* globalCtx);
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
const ActorInit En_Test4_InitVars = {
 | 
			
		||||
    ACTOR_EN_TEST4,
 | 
			
		||||
    ACTORCAT_SWITCH,
 | 
			
		||||
| 
						 | 
				
			
			@ -24,28 +31,558 @@ const ActorInit En_Test4_InitVars = {
 | 
			
		|||
    (ActorFunc)NULL,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static s32 sIsLoaded = false;
 | 
			
		||||
// "Night of ..."
 | 
			
		||||
static s16 sNightMessages1[] = { 0x1BB4, 0x1BB5, 0x1BB6 };
 | 
			
		||||
// "Dawn of ..." (Note: first two message are the same)
 | 
			
		||||
static s16 sDayMessages1[] = { 0x1BB2, 0x1BB2, 0x1BB3 };
 | 
			
		||||
// "Night of ..."
 | 
			
		||||
static s16 sNightMessages2[] = { 0x1BB4, 0x1BB5, 0x1BB6 };
 | 
			
		||||
// "Dawn of ..." (Note: first two message are the same)
 | 
			
		||||
static s16 sDayMessages2[] = { 0x1BB2, 0x1BB2, 0x1BB3 };
 | 
			
		||||
static u16 D_80A43364[] = { CLOCK_TIME(6, 0), CLOCK_TIME(18, 0) };
 | 
			
		||||
 | 
			
		||||
static s16 sCutscenes[2];
 | 
			
		||||
static s16 sCurrentCs;
 | 
			
		||||
 | 
			
		||||
void func_80A41D70(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    if (this->unk_144 != 0) {
 | 
			
		||||
        func_80151A68(globalCtx, sNightMessages1[CURRENT_DAY - 1]);
 | 
			
		||||
    } else if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0)) {
 | 
			
		||||
        if (globalCtx->actorCtx.unk5 & 2) {
 | 
			
		||||
            Sram_IncrementDay();
 | 
			
		||||
            gSaveContext.time = CLOCK_TIME(6, 0);
 | 
			
		||||
            func_80151A68(globalCtx, sDayMessages1[CURRENT_DAY - 1]);
 | 
			
		||||
        } else {
 | 
			
		||||
            this->unk_144 = 0;
 | 
			
		||||
            this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        func_8010EE74(globalCtx, CURRENT_DAY);
 | 
			
		||||
        D_801BDBC8 = 0xFE;
 | 
			
		||||
        func_800FB758(globalCtx);
 | 
			
		||||
        func_800FEAF4(&globalCtx->envCtx);
 | 
			
		||||
        this->actionFunc = func_80A42AB8;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (gSaveContext.cutsceneTrigger == 0) {
 | 
			
		||||
        if ((sCutscenes[this->unk_144] >= 0) && !(globalCtx->actorCtx.unk5 & 2)) {
 | 
			
		||||
            this->actionFunc = func_80A42F20;
 | 
			
		||||
            sCurrentCs = sCutscenes[this->unk_144];
 | 
			
		||||
            this->transitionCsTimer = 0;
 | 
			
		||||
            gSaveContext.eventInf[1] |= 0x80;
 | 
			
		||||
        } else if (this->unk_144 == 0) {
 | 
			
		||||
            play_sound(NA_SE_EV_CHICKEN_CRY_M);
 | 
			
		||||
        } else {
 | 
			
		||||
            func_8019F128(NA_SE_EV_DOG_CRY_EVENING);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        this->actionFunc = func_80A42AB8;
 | 
			
		||||
        if (this->unk_144 == 0) {
 | 
			
		||||
            this->unk_144 = 1;
 | 
			
		||||
        } else {
 | 
			
		||||
            this->unk_144 = 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void func_80A41FA4(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    if (this->unk_144 != 0) {
 | 
			
		||||
        func_80151A68(globalCtx, sNightMessages2[CURRENT_DAY - 1]);
 | 
			
		||||
    } else if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0)) {
 | 
			
		||||
        Sram_IncrementDay();
 | 
			
		||||
        gSaveContext.time = CLOCK_TIME(6, 0);
 | 
			
		||||
        func_8010EE74(globalCtx, CURRENT_DAY);
 | 
			
		||||
        func_80151A68(globalCtx, sDayMessages2[CURRENT_DAY - 1]);
 | 
			
		||||
        D_801BDBC8 = 0xFE;
 | 
			
		||||
        func_800FB758(globalCtx);
 | 
			
		||||
        func_800FEAF4(&globalCtx->envCtx);
 | 
			
		||||
        this->actionFunc = func_80A42AB8;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (gSaveContext.cutsceneTrigger == 0) {
 | 
			
		||||
        if ((sCutscenes[this->unk_144] >= 0) && ((globalCtx->actorCtx.unk5 & 2) == 0)) {
 | 
			
		||||
            this->actionFunc = func_80A42F20;
 | 
			
		||||
            sCurrentCs = sCutscenes[this->unk_144];
 | 
			
		||||
            this->transitionCsTimer = 0;
 | 
			
		||||
            gSaveContext.eventInf[1] |= 0x80;
 | 
			
		||||
        } else if (this->unk_144 == 0) {
 | 
			
		||||
            play_sound(NA_SE_EV_CHICKEN_CRY_M);
 | 
			
		||||
        } else {
 | 
			
		||||
            func_8019F128(NA_SE_EV_DOG_CRY_EVENING);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        this->actionFunc = func_80A42AB8;
 | 
			
		||||
        if (this->unk_144 == 0) {
 | 
			
		||||
            this->unk_144 = 1;
 | 
			
		||||
        } else {
 | 
			
		||||
            this->unk_144 = 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Bells on last day
 | 
			
		||||
void func_80A42198(EnTest4* this) {
 | 
			
		||||
    if ((gSaveContext.time >= CLOCK_TIME(6, 0)) && (gSaveContext.time <= CLOCK_TIME(18, 0))) {
 | 
			
		||||
        if (gSaveContext.time < CLOCK_TIME(17, 30)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 30);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 36)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 36);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 42)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 42);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 48)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 48);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 54)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 54);
 | 
			
		||||
        } else {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(0, 0);
 | 
			
		||||
        }
 | 
			
		||||
    } else if (gSaveContext.time > CLOCK_TIME(6, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(0, 0);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(0, 10)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(0, 10);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(0, 20)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(0, 20);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(0, 30)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(0, 30);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(0, 40)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(0, 40);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(0, 50)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(0, 50);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(1, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(1, 0);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(1, 10)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(1, 10);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(1, 20)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(1, 20);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(1, 30) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(1, 30) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(1, 40) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(1, 40) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(1, 50) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(1, 50) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(2, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(2, 0);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(2, 10)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(2, 10);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(2, 20)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(2, 20);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(2, 30)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(2, 30);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(2, 40)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(2, 40);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(2, 50)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(2, 50);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(3, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(3, 0);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(3, 10)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(3, 10);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(3, 20)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(3, 20);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(3, 30)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(3, 30);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(3, 40)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(3, 40);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(3, 50)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(3, 50);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(4, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(4, 0);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(4, 10)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(4, 10);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(4, 20)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(4, 20);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(4, 30) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(4, 30) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(4, 40) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(4, 40) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(4, 50) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(4, 50) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 0);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 5)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 5);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 10)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 10);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 15) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 15) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 20)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 20);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 25) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 25) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 30)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 30);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 33) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 33) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 36)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 36);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 39) - 1) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 39) - 1;
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 42)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 42);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 45)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 45);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 48)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 48);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 51)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 51);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 54)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 54);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(5, 57)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(5, 57);
 | 
			
		||||
    } else if (gSaveContext.time < CLOCK_TIME(6, 0)) {
 | 
			
		||||
        this->nextBellTime = CLOCK_TIME(6, 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Bells on first and second day
 | 
			
		||||
void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    gSaveContext.unk_3F64 = 1000.0f;
 | 
			
		||||
 | 
			
		||||
    if ((gSaveContext.time >= CLOCK_TIME(6, 0)) && (gSaveContext.time < CLOCK_TIME(18, 0))) {
 | 
			
		||||
        if (gSaveContext.time < CLOCK_TIME(17, 30)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 30);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 36)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 36);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 42)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 42);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 48)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 48);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(17, 54)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 54);
 | 
			
		||||
        } else {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(5, 30);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        if (gSaveContext.time < CLOCK_TIME(5, 30)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(5, 30);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(5, 36)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(5, 36);
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(5, 42)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(5, 42);
 | 
			
		||||
            gSaveContext.unk_3F64 -= 50.0f;
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(5, 48)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(5, 48);
 | 
			
		||||
            gSaveContext.unk_3F64 -= 100.0f;
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(5, 54)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(5, 54);
 | 
			
		||||
            gSaveContext.unk_3F64 -= 150.0f;
 | 
			
		||||
        } else if (gSaveContext.time < CLOCK_TIME(6, 0)) {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 30);
 | 
			
		||||
            gSaveContext.unk_3F64 -= 200.0f;
 | 
			
		||||
        } else {
 | 
			
		||||
            this->nextBellTime = CLOCK_TIME(17, 30);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0) || (CURRENT_DAY == 3) ||
 | 
			
		||||
            (gSaveContext.time >= CLOCK_TIME(17, 0))) {
 | 
			
		||||
            gSaveContext.unk_3F64 = 1000.0f;
 | 
			
		||||
        }
 | 
			
		||||
        if (gSaveContext.unk_3F64 != 1000.0f) {
 | 
			
		||||
            gSaveContext.unk_3F60 = 1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef NON_MATCHING
 | 
			
		||||
// 1 instruction in the wrong place
 | 
			
		||||
void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) {
 | 
			
		||||
    s32 dayTemp;
 | 
			
		||||
    EnTest4* this = THIS;
 | 
			
		||||
    Player* player = PLAYER;
 | 
			
		||||
    s8 temp_v0 = this->actor.cutscene;
 | 
			
		||||
 | 
			
		||||
    sCutscenes[0] = temp_v0;
 | 
			
		||||
    if (temp_v0 >= 0) {
 | 
			
		||||
        ActorCutscene* temp_v0_2 = ActorCutscene_GetCutscene(sCutscenes[0]);
 | 
			
		||||
 | 
			
		||||
        gSaveContext.eventInf[5] |= 0x4;
 | 
			
		||||
        sCutscenes[1] = temp_v0_2->additionalCutscene;
 | 
			
		||||
    } else {
 | 
			
		||||
        gSaveContext.eventInf[5] &= (u8)~0x4;
 | 
			
		||||
        sCutscenes[1] = sCutscenes[0];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (sIsLoaded || (gSaveContext.eventInf[2] & 0x80)) {
 | 
			
		||||
        Actor_MarkForDeath(&this->actor);
 | 
			
		||||
    } else {
 | 
			
		||||
        sIsLoaded = true;
 | 
			
		||||
        this->actor.room = -1;
 | 
			
		||||
        gSaveContext.unk_3F60 = 0;
 | 
			
		||||
        gSaveContext.unk_3F64 = 1000.0f;
 | 
			
		||||
        if (CURRENT_DAY == 0) {
 | 
			
		||||
            if (gSaveContext.time < CLOCK_TIME(6, 1)) {
 | 
			
		||||
                gSaveContext.time = CLOCK_TIME(6, 0);
 | 
			
		||||
                gSaveContext.gameMode = 0;
 | 
			
		||||
                do {
 | 
			
		||||
                    GameState* state = &globalCtx->state;
 | 
			
		||||
                    state->running = false;
 | 
			
		||||
                } while (0);
 | 
			
		||||
                SET_NEXT_GAMESTATE(&globalCtx->state, Daytelop_Init, DaytelopContext);
 | 
			
		||||
                this->unk_144 = 1;
 | 
			
		||||
                gSaveContext.time = CLOCK_TIME(6, 0);
 | 
			
		||||
                Actor_MarkForDeath(&this->actor);
 | 
			
		||||
            } else {
 | 
			
		||||
                gSaveContext.day = 1;
 | 
			
		||||
                dayTemp = gSaveContext.day;
 | 
			
		||||
                gSaveContext.daysElapsed = dayTemp;
 | 
			
		||||
                this->unk_144 = 1;
 | 
			
		||||
                this->unk_146 = gSaveContext.time;
 | 
			
		||||
                this->actionFunc = func_80A42AB8;
 | 
			
		||||
            }
 | 
			
		||||
        } else if (gSaveContext.time == CLOCK_TIME(6, 0)) {
 | 
			
		||||
            this->unk_144 = 0;
 | 
			
		||||
            func_80A41D70(this, globalCtx);
 | 
			
		||||
            if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) &&
 | 
			
		||||
                !(globalCtx->actorCtx.unk5 & 2)) {
 | 
			
		||||
                player->stateFlags1 |= 0x200;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if ((gSaveContext.time > CLOCK_TIME(18, 0)) || (gSaveContext.time < CLOCK_TIME(6, 0))) {
 | 
			
		||||
                this->unk_144 = 0;
 | 
			
		||||
            } else {
 | 
			
		||||
                this->unk_144 = 1;
 | 
			
		||||
            }
 | 
			
		||||
            this->unk_146 = gSaveContext.time;
 | 
			
		||||
            this->actionFunc = func_80A42AB8;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (CURRENT_DAY == 3) {
 | 
			
		||||
        func_80A42198(this);
 | 
			
		||||
    } else {
 | 
			
		||||
        func_80A425E4(this, globalCtx);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this->lastBellTime = gSaveContext.time;
 | 
			
		||||
    if ((sCutscenes[this->unk_144] < 0) || (globalCtx->actorCtx.unk5 & 2)) {
 | 
			
		||||
        gSaveContext.unk_3F60 = 0;
 | 
			
		||||
        gSaveContext.unk_3F64 = 1000.0f;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/EnTest4_Init.s")
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A41D70.s")
 | 
			
		||||
void EnTest4_Destroy(Actor* thisx, GlobalContext* globalCtx) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A41FA4.s")
 | 
			
		||||
void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    Player* player = PLAYER;
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A42198.s")
 | 
			
		||||
    if ((globalCtx->unk_18B4A == 0) && (func_801690CC(globalCtx) == 0) && (globalCtx->numSetupActors <= 0) &&
 | 
			
		||||
        (globalCtx->roomCtx.unk31 == 0) && (func_8016A168() == 0)) {
 | 
			
		||||
        s16 temp_a2;
 | 
			
		||||
        u16 temp_a0 = D_80A43364[this->unk_144];
 | 
			
		||||
        s16 temp_a3;
 | 
			
		||||
        s16 bellDiff;
 | 
			
		||||
        s16 new_var;
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A425E4.s")
 | 
			
		||||
        temp_a3 = gSaveContext.time - temp_a0;
 | 
			
		||||
        temp_a2 = this->unk_146 - temp_a0;
 | 
			
		||||
        bellDiff = this->lastBellTime - this->nextBellTime;
 | 
			
		||||
        new_var = gSaveContext.time - this->nextBellTime;
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/EnTest4_Init.s")
 | 
			
		||||
        if ((temp_a3 * temp_a2) <= 0) {
 | 
			
		||||
            gSaveContext.unk_3CA7 = 1;
 | 
			
		||||
            if (globalCtx->actorCtx.unk5 & 0x4) {
 | 
			
		||||
                globalCtx->actorCtx.unk5 &= ~0x4;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/EnTest4_Destroy.s")
 | 
			
		||||
            if (temp_a0 != CLOCK_TIME(6, 0)) {
 | 
			
		||||
                func_80A41FA4(this, globalCtx);
 | 
			
		||||
            } else if (temp_a0 == CLOCK_TIME(6, 0)) {
 | 
			
		||||
                if (CURRENT_DAY == 3) {
 | 
			
		||||
                    func_8011C808(globalCtx);
 | 
			
		||||
                    Actor_MarkForDeath(&this->actor);
 | 
			
		||||
                    gSaveContext.eventInf[1] |= 0x80;
 | 
			
		||||
                } else if (((sCutscenes[this->unk_144] < 0) || (globalCtx->actorCtx.unk5 & 2)) && CURRENT_DAY != 3) {
 | 
			
		||||
                    func_80A41FA4(this, globalCtx);
 | 
			
		||||
                } else {
 | 
			
		||||
                    gSaveContext.unk_3F64 = 0.0f;
 | 
			
		||||
                    func_80169DCC(globalCtx, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF,
 | 
			
		||||
                                  &player->unk_3C0, player->unk_3CC);
 | 
			
		||||
                    func_80169EFC(globalCtx);
 | 
			
		||||
                    if (player->stateFlags1 & 0x800000) {
 | 
			
		||||
                        EnHorse* rideActor = (EnHorse*)player->rideActor;
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A42AB8.s")
 | 
			
		||||
                        if ((rideActor->unk_150 == 0) || (rideActor->unk_150 == 2)) {
 | 
			
		||||
                            if (CURRENT_DAY < 3) {
 | 
			
		||||
                                D_801BDA9C = 1;
 | 
			
		||||
                            } else {
 | 
			
		||||
                                D_801BDA9C = 0;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A42F20.s")
 | 
			
		||||
                    gSaveContext.respawnFlag = -4;
 | 
			
		||||
                    gSaveContext.eventInf[2] |= 0x80;
 | 
			
		||||
                    Actor_MarkForDeath(&this->actor);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A430C8.s")
 | 
			
		||||
            if ((sCutscenes[this->unk_144] >= 0) && ((globalCtx->actorCtx.unk5 & 2) == 0)) {
 | 
			
		||||
                player->stateFlags1 |= 0x200;
 | 
			
		||||
                this->unk_146 = gSaveContext.time;
 | 
			
		||||
            } else {
 | 
			
		||||
                if (this->unk_144 == 0) {
 | 
			
		||||
                    this->unk_144 = 1;
 | 
			
		||||
                } else {
 | 
			
		||||
                    this->unk_144 = 0;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A431C8.s")
 | 
			
		||||
                this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE;
 | 
			
		||||
            }
 | 
			
		||||
        } else if ((new_var * bellDiff) <= 0) {
 | 
			
		||||
            func_801A0124(&this->actor.projectedPos, (this->actor.params >> 5) & 0xF);
 | 
			
		||||
            this->lastBellTime = gSaveContext.time;
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/func_80A4323C.s")
 | 
			
		||||
            if (CURRENT_DAY == 3) {
 | 
			
		||||
                if ((this->nextBellTime == CLOCK_TIME(0, 0)) &&
 | 
			
		||||
                    ((gSaveContext.inventory.items[ITEM_OCARINA] == ITEM_NONE) ||
 | 
			
		||||
                     (globalCtx->sceneNum == SCENE_CLOCKTOWER))) {
 | 
			
		||||
                    s32 phi_v0;
 | 
			
		||||
                    u32 entranceIndex = gSaveContext.entranceIndex;
 | 
			
		||||
 | 
			
		||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test4/EnTest4_Update.s")
 | 
			
		||||
                    if ((globalCtx->actorCtx.unk5 & 2)) {
 | 
			
		||||
                        phi_v0 = 0xCFF;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        phi_v0 = 0xBFF;
 | 
			
		||||
                    }
 | 
			
		||||
                    func_80169DCC(globalCtx, 1, entranceIndex, player->unk_3CE, phi_v0, &player->unk_3C0,
 | 
			
		||||
                                  player->unk_3CC);
 | 
			
		||||
 | 
			
		||||
                    if ((globalCtx->sceneNum == SCENE_TENMON_DAI) || (globalCtx->sceneNum == SCENE_00KEIKOKU)) {
 | 
			
		||||
                        globalCtx->nextEntranceIndex = 0x5400;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        globalCtx->nextEntranceIndex = 0xD800;
 | 
			
		||||
                    }
 | 
			
		||||
                    gSaveContext.nextCutsceneIndex = 0xFFF1;
 | 
			
		||||
                    globalCtx->sceneLoadFlag = 0x14;
 | 
			
		||||
                    globalCtx->unk_1887F = 2;
 | 
			
		||||
                    player->stateFlags1 |= 0x200;
 | 
			
		||||
                    Actor_MarkForDeath(&this->actor);
 | 
			
		||||
                }
 | 
			
		||||
                func_80A42198(this);
 | 
			
		||||
            } else {
 | 
			
		||||
                func_80A425E4(this, globalCtx);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    if (!this->transitionCsTimer) {
 | 
			
		||||
        if (sCurrentCs >= 0) {
 | 
			
		||||
            if (ActorCutscene_GetCanPlayNext(sCurrentCs) == 0) {
 | 
			
		||||
                ActorCutscene_SetIntentToPlay(sCurrentCs);
 | 
			
		||||
            } else {
 | 
			
		||||
                ActorCutscene_Start(sCurrentCs, &this->actor);
 | 
			
		||||
                this->transitionCsTimer = 1;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            this->transitionCsTimer = 1;
 | 
			
		||||
        }
 | 
			
		||||
    } else if (this->transitionCsTimer < 60) {
 | 
			
		||||
        this->transitionCsTimer++;
 | 
			
		||||
        if (this->transitionCsTimer == 10) {
 | 
			
		||||
            if (this->unk_144 == 0) {
 | 
			
		||||
                play_sound(NA_SE_EV_CHICKEN_CRY_M);
 | 
			
		||||
            } else {
 | 
			
		||||
                func_8019F128(NA_SE_EV_DOG_CRY_EVENING);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (this->transitionCsTimer == 60) {
 | 
			
		||||
            Player* player = PLAYER;
 | 
			
		||||
 | 
			
		||||
            gSaveContext.time += CLOCK_TIME_MINUTE;
 | 
			
		||||
            this->unk_146 = gSaveContext.time;
 | 
			
		||||
            globalCtx->numSetupActors = -globalCtx->numSetupActors;
 | 
			
		||||
            player->stateFlags1 &= ~0x200;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        this->actionFunc = func_80A42AB8;
 | 
			
		||||
        if (this->unk_144 == 0) {
 | 
			
		||||
            this->unk_144 = 1;
 | 
			
		||||
        } else {
 | 
			
		||||
            this->unk_144 = 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (sCurrentCs >= 0) {
 | 
			
		||||
            ActorCutscene_Stop(sCurrentCs);
 | 
			
		||||
        }
 | 
			
		||||
        gSaveContext.unk_3F22 = 0;
 | 
			
		||||
        gSaveContext.eventInf[1] &= (u8)~0x80;
 | 
			
		||||
        Interface_ChangeAlpha(50);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void func_80A430C8(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    if ((CURRENT_DAY == 2) && (gSaveContext.time >= CLOCK_TIME(7, 0)) && (gSaveContext.time < CLOCK_TIME(17, 30)) &&
 | 
			
		||||
        (globalCtx->envCtx.unk_F2[2] == 0)) {
 | 
			
		||||
        // rain?
 | 
			
		||||
 | 
			
		||||
        D_801BDBB0 = 1;
 | 
			
		||||
        func_800FD78C(globalCtx);
 | 
			
		||||
        globalCtx->envCtx.unk_E3 = 1;
 | 
			
		||||
        globalCtx->envCtx.unk_F2[0] = 0x3C;
 | 
			
		||||
    } else {
 | 
			
		||||
        if (globalCtx->envCtx.unk_F2[0] != 0) {
 | 
			
		||||
            if ((globalCtx->state.frames % 4) == 0) {
 | 
			
		||||
                globalCtx->envCtx.unk_F2[0]--;
 | 
			
		||||
                if ((globalCtx->envCtx.unk_F2[0]) == 8) {
 | 
			
		||||
                    func_800FD858(globalCtx);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (D_801BDBB0 == 1) {
 | 
			
		||||
        this->state = TEST4_STATE_1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void func_80A431C8(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    if (((gSaveContext.time >= CLOCK_TIME(17, 30)) && (gSaveContext.time < CLOCK_TIME(23, 0)) &&
 | 
			
		||||
         (globalCtx->envCtx.unk_F2[0] != 0)) ||
 | 
			
		||||
        (globalCtx->envCtx.unk_F2[2] != 0)) {
 | 
			
		||||
        D_801BDBB0 = 0;
 | 
			
		||||
        globalCtx->envCtx.unk_E3 = 2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (D_801BDBB0 == 0) {
 | 
			
		||||
        this->state = TEST4_STATE_0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void func_80A4323C(EnTest4* this, GlobalContext* globalCtx) {
 | 
			
		||||
    s32 temp_v0 = (this->actor.params >> 0xA) * 0x64;
 | 
			
		||||
 | 
			
		||||
    if (temp_v0 > 0) {
 | 
			
		||||
        D_801F4E7A = temp_v0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EnTest4_Update(Actor* thisx, GlobalContext* globalCtx) {
 | 
			
		||||
    EnTest4* this = THIS;
 | 
			
		||||
    Player* player = PLAYER;
 | 
			
		||||
 | 
			
		||||
    if (!(player->stateFlags1 & 2)) {
 | 
			
		||||
        this->actionFunc(this, globalCtx);
 | 
			
		||||
 | 
			
		||||
        if (func_800FE4B8(globalCtx) != 0) {
 | 
			
		||||
            switch (this->state) {
 | 
			
		||||
                case TEST4_STATE_0:
 | 
			
		||||
                    func_80A430C8(this, globalCtx);
 | 
			
		||||
                    break;
 | 
			
		||||
                case TEST4_STATE_1:
 | 
			
		||||
                    func_80A431C8(this, globalCtx);
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        func_80A4323C(this, globalCtx);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,10 +9,20 @@ typedef void (*EnTest4ActionFunc)(struct EnTest4*, GlobalContext*);
 | 
			
		|||
 | 
			
		||||
typedef struct EnTest4 {
 | 
			
		||||
    /* 0x0000 */ Actor actor;
 | 
			
		||||
    /* 0x0144 */ char unk_144[0xC];
 | 
			
		||||
    /* 0x0144 */ s8 unk_144; // 0 on night, 1 on day
 | 
			
		||||
    /* 0x0145 */ u8 transitionCsTimer;
 | 
			
		||||
    /* 0x0146 */ u16 unk_146;
 | 
			
		||||
    /* 0x0148 */ u16 nextBellTime; // Next time the bell will sound
 | 
			
		||||
    /* 0x014A */ u16 lastBellTime; // Last time the bell sounded
 | 
			
		||||
    /* 0x014C */ u8 state;
 | 
			
		||||
    /* 0x0150 */ EnTest4ActionFunc actionFunc;
 | 
			
		||||
} EnTest4; // size = 0x154
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    /* 0 */ TEST4_STATE_0,
 | 
			
		||||
    /* 1 */ TEST4_STATE_1
 | 
			
		||||
} EnTest4State;
 | 
			
		||||
 | 
			
		||||
extern const ActorInit En_Test4_InitVars;
 | 
			
		||||
 | 
			
		||||
#endif // Z_EN_TEST4_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -978,13 +978,13 @@
 | 
			
		|||
    0x801BDBA0:("D_801BDBA0","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBA4:("D_801BDBA4","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBA8:("D_801BDBA8","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBB0:("D_801BDBB0","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBB0:("D_801BDBB0","u8","",0x1),
 | 
			
		||||
    0x801BDBB4:("D_801BDBB4","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBB8:("D_801BDBB8","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBBC:("D_801BDBBC","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBC0:("D_801BDBC0","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBC4:("D_801BDBC4","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBC8:("D_801BDBC8","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDBC8:("D_801BDBC8","u8","",0x1),
 | 
			
		||||
    0x801BDBCC:("D_801BDBCC","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BDCF4:("D_801BDCF4","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801BE38E:("D_801BE38E","UNK_TYPE1","",0x1),
 | 
			
		||||
| 
						 | 
				
			
			@ -4064,7 +4064,7 @@
 | 
			
		|||
    0x801F4E70:("D_801F4E70","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801F4E74:("D_801F4E74","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801F4E78:("D_801F4E78","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801F4E7A:("D_801F4E7A","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801F4E7A:("D_801F4E7A","s16","",0x2),
 | 
			
		||||
    0x801F4E80:("D_801F4E80","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801F4EE0:("D_801F4EE0","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x801F4EE8:("D_801F4EE8","UNK_TYPE1","",0x1),
 | 
			
		||||
| 
						 | 
				
			
			@ -11773,14 +11773,14 @@
 | 
			
		|||
    0x80A41D68:("D_80A41D68","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A41D6C:("D_80A41D6C","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A43320:("En_Test4_InitVars","ActorInit","",0x20),
 | 
			
		||||
    0x80A43340:("D_80A43340","UNK_TYPE4","",0x4),
 | 
			
		||||
    0x80A43342:("D_80A43342","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A4334A:("D_80A4334A","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A43352:("D_80A43352","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A4335A:("D_80A4335A","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A43364:("D_80A43364","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A434D0:("D_80A434D0","s16","[2]",0x4),
 | 
			
		||||
    0x80A434D4:("D_80A434D4","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A43340:("sIsLoaded","s32","[3]",0x6),
 | 
			
		||||
    0x80A43342:("sNightMessages1","s16","[3]",0x6),
 | 
			
		||||
    0x80A4334A:("sDayMessages1","s16","[3]",0x6),
 | 
			
		||||
    0x80A43352:("sNightMessages2","s16","[3]",0x6),
 | 
			
		||||
    0x80A4335A:("sDayMessages2","s16","[3]",0x6),
 | 
			
		||||
    0x80A43364:("D_80A43364","u16","[2]",0x4),
 | 
			
		||||
    0x80A434D0:("sCutscenes","s16","[2]",0x4),
 | 
			
		||||
    0x80A434D4:("sCurrentCs","s16","",0x2),
 | 
			
		||||
    0x80A449E0:("En_Bat_InitVars","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A44A00:("D_80A44A00","UNK_TYPE1","",0x1),
 | 
			
		||||
    0x80A44A2C:("D_80A44A2C","UNK_TYPE1","",0x1),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ ABS = "int"
 | 
			
		|||
SQ = "int"
 | 
			
		||||
CLAMP = "int"
 | 
			
		||||
CLOCK_TIME = "int"
 | 
			
		||||
CURRENT_DAY = "int"
 | 
			
		||||
 | 
			
		||||
[decompme.compilers]
 | 
			
		||||
"tools/ido_recomp/linux/7.1/cc" = "ido7.1"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,9 @@ def fix_sfx_flag(id):
 | 
			
		|||
    if(id.endswith(' - SFX_FLAG')):
 | 
			
		||||
        splitdata = id.split('-')
 | 
			
		||||
        return splitdata[0].strip(), ' -' + splitdata[1]
 | 
			
		||||
    if not(int(id,16) & 0x800):
 | 
			
		||||
    if id.endswith("U"):
 | 
			
		||||
        id = id[:-1]
 | 
			
		||||
    if not(int(id, 16) & 0x800):
 | 
			
		||||
        newid = '0x' + format(int(id,16) + 0x800,'X')
 | 
			
		||||
        sfxFlag = ' - SFX_FLAG'
 | 
			
		||||
    else :
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue