From e29378b8690d4f3f190546045795c31cc2ed3e5b Mon Sep 17 00:00:00 2001 From: theo3 Date: Sun, 19 Dec 2021 18:19:19 -0800 Subject: [PATCH] propagate changes --- assets/sounds.json | 2 +- constants/audio_constants.inc | 2 +- data/sound/sounds.s | 2 +- include/audio.h | 2 +- include/room.h | 4 +-- src/audio.c | 4 +-- src/npc/rem.c | 2 +- src/playerItemUtils.c | 4 +-- src/room.c | 67 +++++++++++++++++------------------ 9 files changed, 44 insertions(+), 45 deletions(-) diff --git a/assets/sounds.json b/assets/sounds.json index 1b348d4e..e5769e56 100644 --- a/assets/sounds.json +++ b/assets/sounds.json @@ -3026,7 +3026,7 @@ "size": 28 }, { - "path": "sounds/sfx11B.bin", + "path": "sounds/sfxChestOpen.bin", "start": 14558640, "type": "midi", "options": { diff --git a/constants/audio_constants.inc b/constants/audio_constants.inc index 07cb901e..94589a41 100644 --- a/constants/audio_constants.inc +++ b/constants/audio_constants.inc @@ -281,7 +281,7 @@ .equiv SFX_ITEM_SHIELD_BOUNCE, 0x118 .equiv SFX_ITEM_GLOVES_KNOCKBACK, 0x119 .equiv SFX_EM_ARMOS_ON, 0x11a - .equiv SFX_11B, 0x11b + .equiv SFX_CHEST_OPEN, 0x11b .equiv SFX_11C, 0x11c .equiv SFX_11D, 0x11d .equiv SFX_EM_MOBLIN_SPEAR, 0x11e diff --git a/data/sound/sounds.s b/data/sound/sounds.s index a2a6df41..fb2a0819 100644 --- a/data/sound/sounds.s +++ b/data/sound/sounds.s @@ -247,7 +247,7 @@ .include "sounds/sfxItemShieldBounce.s" .include "sounds/sfxItemGlovesKnockback.s" .include "sounds/sfxEmArmosOn.s" - .include "sounds/sfx11B.s" + .include "sounds/sfxChestOpen.s" .include "sounds/sfx11C.s" .include "sounds/sfx11D.s" .include "sounds/sfxEmMoblinSpear.s" diff --git a/include/audio.h b/include/audio.h index ccfdee57..2add23dd 100644 --- a/include/audio.h +++ b/include/audio.h @@ -291,7 +291,7 @@ typedef enum { SFX_ITEM_SHIELD_BOUNCE, SFX_ITEM_GLOVES_KNOCKBACK, SFX_EM_ARMOS_ON, - SFX_11B, + SFX_CHEST_OPEN, SFX_11C, SFX_11D, SFX_EM_MOBLIN_SPEAR, diff --git a/include/room.h b/include/room.h index 568c3f61..fb706547 100644 --- a/include/room.h +++ b/include/room.h @@ -152,7 +152,7 @@ typedef struct { u8 _6; u8 _7; } TileEntity; -extern TileEntity gSmallChests[]; +extern TileEntity gSmallChests[8]; typedef enum { NONE, @@ -167,7 +167,7 @@ typedef enum { DARKNESS, DESTRUCTIBLE_TILE, GRASS_DROP_CHANGER, - TILE_ENTITY_C, + LOCATION_CHANGER, TILE_ENTITY_D } TileEntityType; diff --git a/src/audio.c b/src/audio.c index 2b57b183..1da1714a 100644 --- a/src/audio.c +++ b/src/audio.c @@ -478,7 +478,7 @@ extern const SongHeader sfx117; extern const SongHeader sfxItemShieldBounce; extern const SongHeader sfxItemGlovesKnockback; extern const SongHeader sfxEmArmosOn; -extern const SongHeader sfx11B; +extern const SongHeader sfxChestOpen; extern const SongHeader sfx11C; extern const SongHeader sfx11D; extern const SongHeader sfxEmMoblinSpear; @@ -1110,7 +1110,7 @@ const Song gSongTable[] = { [SFX_ITEM_SHIELD_BOUNCE] = { &sfxItemShieldBounce, MUSIC_PLAYER_07, MUSIC_PLAYER_07 }, [SFX_ITEM_GLOVES_KNOCKBACK] = { &sfxItemGlovesKnockback, MUSIC_PLAYER_14, MUSIC_PLAYER_14 }, [SFX_EM_ARMOS_ON] = { &sfxEmArmosOn, MUSIC_PLAYER_13, MUSIC_PLAYER_13 }, - [SFX_11B] = { &sfx11B, MUSIC_PLAYER_12, MUSIC_PLAYER_12 }, + [SFX_CHEST_OPEN] = { &sfxChestOpen, MUSIC_PLAYER_12, MUSIC_PLAYER_12 }, [SFX_11C] = { &sfx11C, MUSIC_PLAYER_11, MUSIC_PLAYER_11 }, [SFX_11D] = { &sfx11D, MUSIC_PLAYER_10, MUSIC_PLAYER_10 }, [SFX_EM_MOBLIN_SPEAR] = { &sfxEmMoblinSpear, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F }, diff --git a/src/npc/rem.c b/src/npc/rem.c index d4c5ede5..94356c93 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -139,7 +139,7 @@ void sub_0806A550(Entity* this) { this->frame = 0; sub_08080964(8, 2); gActiveScriptInfo.unk_00 |= 0x100; - SoundReq(SFX_11B); + SoundReq(SFX_CHEST_OPEN); } if ((this->frame & 0x80) != 0) { this->action = 5; diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c index 5863d96f..9871639a 100644 --- a/src/playerItemUtils.c +++ b/src/playerItemUtils.c @@ -48,7 +48,7 @@ Entity* GiveItemWithCutscene(u32 type, u32 type2, u32 delay) { } void ClearSmallChests(void) { - MemClear(gSmallChests, 0x40); + MemClear(gSmallChests, sizeof(gSmallChests)); } void sub_080A7C8C(u32 pos, u32 layer) { @@ -70,7 +70,7 @@ void sub_080A7C8C(u32 pos, u32 layer) { } sub_0807B7D8(0x74, pos, layer); RequestPriorityDuration(NULL, 120); - SoundReq(SFX_11B); + SoundReq(SFX_CHEST_OPEN); } } diff --git a/src/room.c b/src/room.c index d4feb11f..ae2bb9f0 100644 --- a/src/room.c +++ b/src/room.c @@ -4,6 +4,7 @@ #include "flags.h" #include "functions.h" #include "utils.h" +#include "object.h" extern void sub_0804B058(EntityData* dat); extern void sub_0801AC98(); @@ -29,14 +30,13 @@ void sub_0806F704(Entity*, u32); void sub_0805BB00(u32, u32); -static void sub_0804B290(TileEntity*); -static void sub_0804B29C(TileEntity*); -static void sub_0804B300(TileEntity*); -static void sub_0804B334(TileEntity*); -static void sub_0804B340(TileEntity*); -static void sub_0804B260(TileEntity*); -static void sub_0804B27C(TileEntity*); - +static void LoadRoomVisitTile(TileEntity*); +static void LoadSmallChestTile(TileEntity*); +static void LoadBombableWallTile(TileEntity*); +static void LoadDarknessTile(TileEntity*); +static void LoadDestructibleTile(TileEntity*); +static void LoadGrassDropTile(TileEntity*); +static void LoadLocationTile(TileEntity*); typedef struct { u8 filler[0x20]; @@ -221,7 +221,6 @@ void sub_0804B0E8(u32 arg0, u32 arg1) { void (*func)(); // init function at index 4 of room data - func = (void (*)())GetRoomProperty(arg0, arg1, 4); if (func != NULL) { func(); @@ -270,58 +269,58 @@ void LoadRoomTileEntities(TileEntity* list) { for (t; t->type != 0; ++t) { switch (t->type) { - case 1: - sub_0804B290(t); + case ROOM_VISIT_MARKER: + LoadRoomVisitTile(t); break; - case 2: - sub_0804B29C(t); + case SMALL_CHEST: + LoadSmallChestTile(t); break; - case 4: - sub_0804B300(t); + case BOMBABLE_WALL: + LoadBombableWallTile(t); break; - case 7: + case MUSIC_SETTER: gArea.pMusicIndex = t->_3; break; - case 9: - sub_0804B334(t); + case DARKNESS: + LoadDarknessTile(t); break; - case 10: - sub_0804B340(t); + case DESTRUCTIBLE_TILE: + LoadDestructibleTile(t); break; - case 11: - sub_0804B260(t); + case GRASS_DROP_CHANGER: + LoadGrassDropTile(t); break; - case 12: - sub_0804B27C(t); + case LOCATION_CHANGER: + LoadLocationTile(t); break; - case 13: + case TILE_ENTITY_D: gRoomVars.field_0x9 = t->_3; break; } } } -static void sub_0804B260(TileEntity* tile) { +static void LoadGrassDropTile(TileEntity* tile) { MemCopy(&gUnk_080015BC[tile->_1], &gRoomVars.filler4[44], 0x20); } -static void sub_0804B27C(TileEntity* tile) { +static void LoadLocationTile(TileEntity* tile) { gArea.locationIndex = tile->_1; sub_08054524(); } -static void sub_0804B290(TileEntity* tile) { +static void LoadRoomVisitTile(TileEntity* tile) { SetLocalFlag(tile->_1); } -static void sub_0804B29C(TileEntity* tile) { +static void LoadSmallChestTile(TileEntity* tile) { TileEntity* t = gSmallChests; u32 i = 0; for (i = 0; i < 8; ++i, ++t) { if (!t->_4) { MemCopy(tile, t, sizeof(TileEntity)); if ((t->_6 & 1) && (gRoomControls.unk6 & 2) && !CheckLocalFlag(t->_1)) { - Entity* e = CreateObject(0x52, t->_1, 0); + Entity* e = CreateObject(OBJECT_52, t->_1, 0); if (e != NULL) { sub_0806F704(e, t->_4); } @@ -331,7 +330,7 @@ static void sub_0804B29C(TileEntity* tile) { } } -static void sub_0804B300(TileEntity* tile) { +static void LoadBombableWallTile(TileEntity* tile) { Manager24* mgr = (Manager24*)GetEmptyManager(); if (mgr != NULL) { mgr->manager.type = 9; @@ -344,11 +343,11 @@ static void sub_0804B300(TileEntity* tile) { } } -static void sub_0804B334(TileEntity* tile) { +static void LoadDarknessTile(TileEntity* tile) { sub_0805BB00(tile->_3, 1); } -static void sub_0804B340(TileEntity* tile) { +static void LoadDestructibleTile(TileEntity* tile) { if (CheckLocalFlag(*(u16*)&tile->_2)) { SetTileType(*(u16*)&tile->_6, tile->_4, tile->_1); } else if (!gRoomVars.filler_0x1) { @@ -375,5 +374,5 @@ void sub_0804B388(u32 a1, u32 a2) { } void sub_0804B3C4(void* arg0) { - sub_0804B29C(arg0); + LoadSmallChestTile(arg0); }