From 2bb51abae1c5198b609379ed03e1bc420c388936 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 2 Sep 2020 21:20:44 +1000 Subject: [PATCH] Decompile func0f0010d8 --- src/game/dlights.c | 44 +++++++++++++++----------------------- src/include/constants.h | 2 ++ src/include/game/dlights.h | 2 +- src/include/types.h | 7 +++--- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/src/game/dlights.c b/src/game/dlights.c index cdfcee5d9..56ae84073 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -313,33 +313,23 @@ void func0f0010b4(void) var80061424 = 1; } -GLOBAL_ASM( -glabel func0f0010d8 -/* f0010d8: 3c013f80 */ lui $at,0x3f80 -/* f0010dc: 44810000 */ mtc1 $at,$f0 -/* f0010e0: 44801000 */ mtc1 $zero,$f2 -/* f0010e4: 9098004e */ lbu $t8,0x4e($a0) -/* f0010e8: 94880000 */ lhu $t0,0x0($a0) -/* f0010ec: 240e00ff */ addiu $t6,$zero,0xff -/* f0010f0: 240f0080 */ addiu $t7,$zero,0x80 -/* f0010f4: 3319ff0f */ andi $t9,$t8,0xff0f -/* f0010f8: 3109fc3f */ andi $t1,$t0,0xfc3f -/* f0010fc: a0800048 */ sb $zero,0x48($a0) -/* f001100: a08e0049 */ sb $t6,0x49($a0) -/* f001104: a080004a */ sb $zero,0x4a($a0) -/* f001108: a48f0050 */ sh $t7,0x50($a0) -/* f00110c: a4800052 */ sh $zero,0x52($a0) -/* f001110: a080004b */ sb $zero,0x4b($a0) -/* f001114: a099004e */ sb $t9,0x4e($a0) -/* f001118: a4890000 */ sh $t1,0x0($a0) -/* f00111c: e480006c */ swc1 $f0,0x6c($a0) -/* f001120: e4800070 */ swc1 $f0,0x70($a0) -/* f001124: e480005c */ swc1 $f0,0x5c($a0) -/* f001128: e4820060 */ swc1 $f2,0x60($a0) -/* f00112c: e4820064 */ swc1 $f2,0x64($a0) -/* f001130: 03e00008 */ jr $ra -/* f001134: e4820068 */ swc1 $f2,0x68($a0) -); +void func0f0010d8(struct room *room) +{ + room->unk48 = 0; + room->unk49 = 255; + room->unk4a = 0; + room->brightness = 128; + room->unk52 = 0; + room->unk4b = 0; + room->bitfield.prevop = 0; + room->flags &= ~(ROOMFLAG_0200 | ROOMFLAG_DIRTY | ROOMFLAG_0080 | ROOMFLAG_0040); + room->unk6c = 1; + room->unk70 = 1; + room->unk5c = 1; + room->unk60 = 0; + room->unk64 = 0; + room->unk68 = 0; +} GLOBAL_ASM( glabel func0f001138 diff --git a/src/include/constants.h b/src/include/constants.h index 09ea2282c..d47373ecc 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -2408,7 +2408,9 @@ #define ROOMFLAG_VISIBLEBYPLAYER 0x0004 #define ROOMFLAG_VISIBLEBYAIBOT 0x0008 #define ROOMFLAG_0040 0x0040 +#define ROOMFLAG_0080 0x0080 #define ROOMFLAG_DIRTY 0x0100 +#define ROOMFLAG_0200 0x0200 #define ROOMFLAG_1000 0x1000 #define ROOMFLAG_LIGHTSOFF 0x2000 #define ROOMFLAG_PLAYAMBIENTTRACK 0x4000 diff --git a/src/include/game/dlights.h b/src/include/game/dlights.h index 80f2b7d27..c2cc334d9 100644 --- a/src/include/game/dlights.h +++ b/src/include/game/dlights.h @@ -17,7 +17,7 @@ bool lightIsHealthy(s32 roomnum, s32 lightnum); bool func0f000f94(s32 roomnum, s32 lightnum); bool lightIsOn(s32 roomnum, s32 lightnum); void roomSetUnk52(s32 roomnum, s32 value); -u32 func0f0010d8(void); +void func0f0010d8(struct room *room); u32 func0f001138(void); u32 func0f001300(void); u32 func0f0013c8(void); diff --git a/src/include/types.h b/src/include/types.h index 04094e1d1..035d75504 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3394,7 +3394,8 @@ struct room { /*0x3c*/ u32 unk3c; /*0x40*/ u32 unk40; /*0x44*/ u32 unk44; - /*0x48*/ u16 unk48; + /*0x48*/ u8 unk48; + /*0x49*/ u8 unk49; /*0x4a*/ u8 unk4a; /*0x4b*/ u8 unk4b; /*0x4c*/ u8 unk4c; @@ -3408,8 +3409,8 @@ struct room { /*0x60*/ f32 unk60; /*0x64*/ f32 unk64; /*0x68*/ f32 unk68; - /*0x6c*/ u32 unk6c; - /*0x70*/ u32 unk70; + /*0x6c*/ f32 unk6c; + /*0x70*/ f32 unk70; /*0x74*/ u32 unk74; /*0x78*/ u32 unk78; /*0x7c*/ u32 unk7c;