diff options
| author | Elliptic Ellipsis <elliptic.ellipsis@gmail.com> | 2022-03-20 15:39:13 +0000 |
|---|---|---|
| committer | Elliptic Ellipsis <elliptic.ellipsis@gmail.com> | 2022-03-20 16:57:09 +0000 |
| commit | 4a01f2f7d71c1f896fedc24932daddf625eb04e5 (patch) | |
| tree | 1b7cc6a4e53a35a65fe2a9d5161ac0fc3125fbda /src/code_08049CD4.c | |
| parent | d20ff8794838bc5442e9a5d82cba34816a6758e9 (diff) | |
Move top three functions of D30 to CD4 and rename
Diffstat (limited to 'src/code_08049CD4.c')
| -rw-r--r-- | src/code_08049CD4.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/code_08049CD4.c b/src/code_08049CD4.c index 8fb02487..c79effa8 100644 --- a/src/code_08049CD4.c +++ b/src/code_08049CD4.c @@ -5,6 +5,9 @@ extern void MemFill32(u32, void*, u32); +void sub_08049DCC(RoomMemory*); +RoomMemory* sub_08049D88(void); + void ClearRoomMemory(void) { MemFill32(0xFFFFFFFF, gRoomMemory, 0x40); gUnk_020354B0 = gRoomMemory; @@ -23,3 +26,53 @@ u32 sub_08049D1C(u32 arg0) { output &= ~bitmask; return output; } + + +void UpdateRoomTracker(void) { + gUnk_020354B0 = gRoomMemory; + + do { + if (gUnk_020354B0->area == gRoomControls.area && gUnk_020354B0->room == gRoomControls.room) { + sub_08049DCC(gUnk_020354B0); + return; + } + gUnk_020354B0++; + + } while (gUnk_020354B0 < gRoomMemory + 8); + gUnk_020354B0 = sub_08049D88(); +} + +RoomMemory* sub_08049D88(void) { + RoomMemory* r4 = gRoomMemory; + RoomMemory* r1 = r4 + 1; + + do { + if (r1->unk_02 > r4->unk_02) { + r4 = r1; + } + r1++; + } while (r1 < gRoomMemory + 8); + + r4->area = gRoomControls.area; + r4->room = gRoomControls.room; + + r4->unk_02 = 0xFFFF; + r4->unk_04 = 0; + + sub_08049DCC(r4); + + return r4; +} + +void sub_08049DCC(RoomMemory* rm) { + RoomMemory* r1 = gRoomMemory; + + do { + if (r1->unk_02 < rm->unk_02) { + r1->unk_02++; + } + r1++; + } while (r1 < gRoomMemory + 8); + + rm->unk_02 = 0; +}
\ No newline at end of file |
