audio odyssey (#744)

* first pass

* seq cmd args retyping

* some SEF commands

* etc

* couple more SND commands

* more functions

* checkpoint

* five more

* another one

* more funcs + cleanup

* reverted unnecessary unions

* all SEF commands done

* a bunch more

* more!

* morrrrrrre

* almost done for now

* 99%

* 100

* few names and types

* reorg

* minor chnages

* miscmiscmisc

* yet more

* another day another func

* eth wip func_8004EC68

* some sym names

* retyping sound mgr fields

* minor renames

* D_80078400

* bigger func

* retypings

* enhanced drum info

* the evil is defeated

* merged

* prelim ambient sound func names

* audio frame

* checkpoint

* renames

* learnin bout sounds

* latest

* fix snd_load_BK_to_bank

* func_80056FA4

* warnings

* cosmetics

* func_800522A8

* struct reorg

* figured some stuff out

* much more info

* fx params

* cleanin up

* revert accidental changes to jp

* more accidental jp changes reverted

* misc names

* small stuff

* migrated all audio data

* checkpoint

* header reorg begins

* audio public/private headers

* fixed headers

* fixin warnins

* oops

* 51 fixed

* formatted binary data in 30450

* workwork

* cleanup

* misc

* flip macro arg order

* more names

* audio event triggers

* various

* sfx player cleanup

* start bgm player cleanup

* names names names

* priorities

* merlow

* misc enum vals

* rocking chair

* kmr_00 funcs

* enough

* restore delete jp file

* func_80055EB4

* fix func name

* addressed comments

* demoted a couple variables from global

* couple hidden panel things

* credits mostly

* credits dedupe in progress

* jump table repair

* 'finished' end dedupe

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
Co-authored-by: Ethan Roseman <ethteck@gmail.com>
This commit is contained in:
HailSanta 2022-08-06 08:14:04 -04:00 committed by GitHub
parent ae64b1b5cc
commit 1ce49b1ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
406 changed files with 13278 additions and 23250 deletions

115
include/PR/n_abi.h Normal file
View File

@ -0,0 +1,115 @@
/*====================================================================
*
* Copyright 1993, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
#ifndef __N_ABI__
#define __N_ABI__
/*
* BEGIN C-specific section: (typedef's)
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/*
* Macros to assemble the audio command list
*/
#define n_aADPCMdec(pkt, s, f, c, a, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(s, 0, 24)); \
_a->words.w1 = (_SHIFTL(f, 28, 4) | _SHIFTL(c, 16, 12) | \
_SHIFTL(a, 12, 4) | _SHIFTL(d, 0, 12)); \
}
#define n_aPoleFilter(pkt, f, g, t, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = (_SHIFTL(t, 24, 8) | \
_SHIFTL((unsigned int)(s), 0, 24)); \
}
#define n_aEnvMixer(pkt, f, t, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8) |\
_SHIFTL(t, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
}
#define n_aInterleave(pkt) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
}
#define n_aLoadBuffer(pkt, c, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_LOADBUFF, 24, 8) | _SHIFTL(c, 12, 12)|\
_SHIFTL(d, 0, 12)); \
_a->words.w1 = (unsigned int)(s); \
}
#define n_aResample(pkt, s, f, p, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(s, 0, 24));\
_a->words.w1 = (_SHIFTL(f, 30, 2) | _SHIFTL(p, 14, 16) | \
_SHIFTL(i, 2, 12) | _SHIFTL(o, 0, 2)); \
}
#define n_aSaveBuffer(pkt, c, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SAVEBUFF, 24, 8) | _SHIFTL(c, 12, 12)|\
_SHIFTL(d, 0, 12)); \
_a->words.w1 = (unsigned int)(s); \
}
#define n_aSetVolume(pkt, f, v, t, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(v, 0, 16)); \
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
}
#define n_aLoadADPCM(pkt, c, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
_a->words.w1 = (unsigned int) d; \
}
#endif /* _LANGUAGE_C */
#endif /* __N_ABI__ */

View File

@ -13,6 +13,12 @@ typedef ApiStatus(*ApiFunc)(struct Evt*, s32);
typedef Bytecode EvtScript[0];
typedef void NoArgCallback(void*);
#define MSG_PTR u8*
#define IMG_PTR u8*
#define PAL_PTR u16*
typedef struct {
u8 r, g, b, a;
} Color_RGBA8;
@ -560,21 +566,29 @@ typedef DynamicEntity* DynamicEntityList[MAX_DYNAMIC_ENTITIES];
typedef struct MusicSettings {
/* 0x00 */ u16 flags;
/* 0x02 */ s16 unk_02;
/* 0x02 */ s16 state;
/* 0x04 */ s32 fadeOutTime;
/* 0x08 */ s32 fadeInTime;
/* 0x0C */ s16 unk_0C;
/* 0x0E */ s16 unk_0E;
/* 0x0C */ s16 fadeStartVolume;
/* 0x0E */ s16 fadeEndVolume;
/* 0x10 */ s32 songID;
/* 0x14 */ s32 variation;
/* 0x18 */ s32 songName;
/* 0x1C */ s32 unk_1C;
/* 0x20 */ s32 unk_20;
/* 0x24 */ s32 unk_24;
/* 0x28 */ s32 unk_28;
/* 0x2C */ s32 unk_2C;
/* 0x1C */ s32 battleSongID;
/* 0x20 */ s32 battleVariation;
/* 0x24 */ s32 savedSongID;
/* 0x28 */ s32 savedVariation;
/* 0x2C */ s32 savedSongName;
} MusicSettings; // size = 0x30
typedef struct MusicProximityTrigger {
/* 0x00 */ Vec2XZf pos;
/* 0x08 */ f32 innerDist;
/* 0x0C */ f32 outerDist;
/* 0x10 */ s32 unk;
/* 0x14 */ s32 manualActivationFlag;
} MusicProximityTrigger; // size = 0x18
typedef struct UiStatus {
/* 0x00 */ s32 hpIconIndices[2];
/* 0x08 */ s32 fpIconIndices[2];
@ -908,6 +922,7 @@ typedef struct BattleStatus {
/* 0x45C */ char unk_45C[4];
} BattleStatus; // size = 0x460
// alternative name: TileDescriptor
typedef struct TextureHeader {
/* 0x00 */ s8 name[32];
/* 0x20 */ s16 auxW;
@ -1237,11 +1252,11 @@ typedef struct MessageCharset {
} MessageCharset; // size = 0xA;
typedef struct MesasgeFontGlyphData {
/* 0x0 */ s8* raster;
/* 0x4 */ s16* palette;
/* 0x8 */ Vec2b texSize;
/* 0xA */ s8 charWidth;
/* 0xB */ s8 charHeight;
/* 0x0 */ IMG_PTR raster;
/* 0x4 */ PAL_PTR palette;
/* 0x8 */ Vec2bu texSize;
/* 0xA */ u8 charWidth;
/* 0xB */ u8 charHeight;
} MesasgeFontGlyphData; // size = 0xC
typedef struct MessageImageData {
@ -1286,7 +1301,7 @@ typedef struct ShopItemLocation {
typedef struct ShopItemData {
/* 0x0 */ u32 itemID;
/* 0x4 */ s32 price;
/* 0x8 */ s32 unk_08;
/* 0x8 */ s32 descMsg;
} ShopItemData; // size = 0xC
typedef struct ShopSellPriceData {
@ -2251,14 +2266,14 @@ typedef struct PopupMessage {
/* 0x18 */ Message* message;
} PopupMessage; // size = 0x1C
typedef struct Struct8015A578 {
/* 0x00 */ s8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ s8 unk_02;
/* 0x03 */ u8 unk_03[5];
/* 0x08 */ f32 unk_08;
typedef struct HiddenPanelsData {
/* 0x00 */ s8 tryFlipTrigger;
/* 0x01 */ u8 panelsCount;
/* 0x02 */ s8 activateISpy;
/* 0x03 */ char unk_03[0x5];
/* 0x08 */ f32 flipTriggerPosY;
/* 0x0C */ char unk_0C[0x4];
} Struct8015A578; // size = 0x10
} HiddenPanelsData; // size = 0x10
typedef struct SpriteShadingLightSource {
/* 0x00 */ s8 flags;
@ -2300,8 +2315,8 @@ typedef struct UnkStruct0 {
} UnkStruct0;
typedef struct FoldImageRecPart {
/* 0x00 */ s8* raster;
/* 0x04 */ s8* palette;
/* 0x00 */ IMG_PTR raster;
/* 0x04 */ PAL_PTR palette;
/* 0x08 */ u16 width;
/* 0x0A */ u16 height;
/* 0x0C */ s16 xOffset;
@ -2326,4 +2341,108 @@ typedef struct FoldImageRec {
/* 0x24 */ u8 alphaMultiplier;
} FoldImageRec; // size = 0x25
typedef struct SongUpdateEvent {
/* 0x00 */ s32 songName;
/* 0x04 */ s32 duration;
/* 0x08 */ s32 startVolume;
/* 0x0C */ s32 finalVolume;
/* 0x10 */ s32 variation;
/* 0x14 */ s32 unk14;
/* 0x18 */ s32 unk18;
/* 0x1C */ s32 unk1C; // may be fake
} SongUpdateEvent; // size = 0x1C or 0x20
// unfortunately, cant use bitfield for this
// format: ABCC00DD
// A = playerID
// B = trackIndex
// C = musicEventID
// D = scriptSelector
typedef u32 MusicEventTrigger;
// allows Evt scripts to be triggered by BGM commands
typedef struct MusicEvent {
s32 musicEventID; // user-defined, events will respond to BGM Trigger commands with matching ID
EvtScript* scripts[4];
} MusicEvent;
typedef struct ParadeNpcInfo {
/* 0x00 */ u32 initialAnim;
/* 0x04 */ u32** animList;
/* 0x08 */ Vec3f pos;
/* 0x14 */ f32 yaw;
} ParadeNpcInfo; // size = 0x18
typedef struct CreditsEntry {
/* 0x00 */ s32 msgID;
/* 0x04 */ s32 posX;
/* 0x08 */ s32 posY;
/* 0x0C */ s32 palette;
/* 0x10 */ s32 appearMode;
/* 0x14 */ s32 appearTime;
/* 0x18 */ s32 perCharDelayIn;
/* 0x1C */ s32 holdMode;
/* 0x20 */ s32 holdTime;
/* 0x24 */ s32 vanishMode;
/* 0x28 */ s32 vanishTime;
/* 0x2C */ s32 perCharDelayOut;
/* 0x30 */ s32 next;
/* 0x34 */ s16 flags;
/* 0x36 */ char pad_36[2];
} CreditsEntry; // size = 0x38
typedef struct CreditsLine {
/* 0x00 */ u8* message;
/* 0x04 */ s32 unk__04;
/* 0x08 */ s32 time;
/* 0x0C */ s32 state;
/* 0x10 */ s32 palette;
/* 0x14 */ s32 msgWidth;
/* 0x18 */ s32 appearMode;
/* 0x1C */ s32 appearTime;
/* 0x20 */ s32 perCharDelayIn;
/* 0x24 */ s32 unk__24;
/* 0x28 */ s32 unk__28;
/* 0x2C */ s32 unk__2C;
/* 0x30 */ s32 unk__30;
/* 0x34 */ s32 holdMode;
/* 0x38 */ s32 holdTime;
/* 0x3C */ s32 unk__3C;
/* 0x40 */ s32 unk__40;
/* 0x44 */ s32 unk__44;
/* 0x48 */ s32 unk__48;
/* 0x4C */ s32 vanishMode;
/* 0x50 */ s32 vanishTime;
/* 0x54 */ s32 perCharDelayOut;
/* 0x58 */ s32 unk__58;
/* 0x5C */ s32 unk__5C;
/* 0x60 */ s32 unk__60;
/* 0x64 */ s32 unk__64;
/* 0x68 */ s32 posX;
/* 0x6C */ s32 posY;
/* 0x70 */ s16 flags;
/* 0x72 */ char unk_72[2];
} CreditsLine; // size = 0x74
typedef struct CreditsChar {
/* 0x00 */ s32 charIndex;
/* 0x04 */ s32 font;
/* 0x08 */ s32 variation;
/* 0x0C */ s32 palette;
/* 0x10 */ s32 posX;
/* 0x14 */ s32 posY;
/* 0x18 */ s32 fadeInTime;
} CreditsChar; // size = unk
typedef struct CreditsData {
/* 0x00 */ u32 workerID;
/* 0x04 */ CreditsLine lines[32];
} CreditsData; // size = 0x74
typedef struct CreditsUnkBeta {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ s16 size;
} CreditsUnkBeta; // size = 0x4
#endif

View File

@ -589,6 +589,7 @@ enum SoundIDs {
SOUND_METAL_GATE_CLOSE = 0x000001CA,
SOUND_1CB = 0x000001CB,
SOUND_1CC = 0x000001CC,
SOUND_CREAKY_ROCKING_CHAIR = 0x000001D6,
SOUND_1E2 = 0x000001E2,
SOUND_211 = 0x00000211,
SOUND_213 = 0x00000213,
@ -655,6 +656,7 @@ enum SoundIDs {
SOUND_32E = 0x0000032E,
SOUND_32F = 0x0000032F,
SOUND_349 = 0x00000349,
SOUND_34A = 0x0000034A,
SOUND_34E = 0x0000034E,
SOUND_359 = 0x00000359,
SOUND_35D = 0x0000035D,
@ -811,6 +813,68 @@ enum SoundIDs {
SOUND_B000001E = 0xB000001E,
};
enum SoundInstanceFlags {
SOUND_INSTANCE_FLAG_4 = 0x00000004,
};
enum SoundType {
SOUND_TYPE_SPECIAL = 0x80000000,
SOUND_TYPE_LOOPING = 0,
SOUND_TYPE_DOOR1 = 1,
SOUND_TYPE_DOOR2 = 2,
SOUND_TYPE_ALTERNATING = 3
};
enum SoundIDBits {
SOUND_ID_10000 = 0x00010000,
SOUND_ID_LOWER = 0x000023FF,
SOUND_ID_MID = 0x00000C00,
};
typedef enum AuResult {
AU_RESULT_OK = 0,
AU_ERROR_1 = 1,
AU_AMBIENCE_ERROR_1 = 1,
AU_ERROR_SONG_NOT_PLAYING = 2, // player not found for songName
AU_AMBIENCE_ERROR_2 = 2,
AU_ERROR_NULL_SONG_NAME = 3, // songName is NULL
AU_AMBIENCE_ERROR_3 = 3,
AU_ERROR_INVALID_SONG_DURATION = 4, // duration out of bounds: (250,10000)
AU_ERROR_6 = 6,
AU_ERROR_7 = 7,
AU_ERROR_11 = 11,
AU_ERROR_SBN_INDEX_OUT_OF_RANGE = 101,
AU_ERROR_SBN_FORMAT_MISMATCH = 102,
AU_ERROR_151 = 151,
AU_ERROR_201 = 201
} AuResult;
typedef enum AuFileFormat {
AU_FMT_BGM = 0x10,
AU_FMT_SEF = 0x20,
AU_FMT_BK = 0x30,
AU_FMT_PER = 0x40,
AU_FMT_PRG = 0x40,
AU_FMT_MSEQ = 0x40
} AuFileFormat;
enum {
MUSIC_PROXIMITY_FAR,
MUSIC_PROXIMITY_NEAR,
MUSIC_PROXIMITY_FULL
};
typedef enum MusicTrackVols {
TRACK_VOLS_0 = 0,
TRACK_VOLS_1 = 1,
TRACK_VOLS_2 = 2,
TRACK_VOLS_3 = 3,
TRACK_VOLS_KPA_OUTSIDE = 4,
TRACK_VOLS_KPA_1 = 5,
TRACK_VOLS_KPA_2 = 6,
TRACK_VOLS_KPA_3 = 7
} MusicTrackVols;
enum Cams {
CAM_DEFAULT = 0,
CAM_BATTLE = 1,
@ -1338,7 +1402,10 @@ enum AmbientSounds {
AMBIENT_UNDER_SEA6 = 11,
AMBIENT_BIRDS = 12,
AMBIENT_SEA = 13,
AMBIENT_MUSIC = 16,
AMBIENT_RADIO = 16, // radio songs for nok
// the following 4 IDs are reserved for additional radio songs,
// and no more are expected to follow after that
// see: func_80053F80
};
enum EncounterOutcomes {
@ -3696,10 +3763,25 @@ enum FoldStateFlags {
FOLD_STATE_FLAG_8000 = 0x00008000,
FOLD_STATE_FLAG_10000 = 0x00010000,
FOLD_STATE_FLAG_20000 = 0x00020000,
FOLD_STATE_FLAG_40000 = 0x00040000,
FOLD_STATE_FLAG_80000 = 0x00080000,
FOLD_STATE_FLAG_100000 = 0x00100000,
};
typedef enum FoldType {
FOLD_TYPE_NONE = 0x0,
FOLD_TYPE_1 = 0x1,
FOLD_TYPE_2 = 0x2,
FOLD_TYPE_3 = 0x3,
FOLD_TYPE_4 = 0x4,
FOLD_TYPE_5 = 0x5,
FOLD_TYPE_6 = 0x6,
FOLD_TYPE_7 = 0x7,
FOLD_TYPE_8 = 0x8,
FOLD_TYPE_9 = 0x9,
FOLD_TYPE_A = 0xA,
} FoldType;
enum MoveType {
MOVE_TYPE_NONE = 0,
MOVE_TYPE_HAMMER = 1,

View File

@ -266,11 +266,7 @@ s32 round(f32);
f32 atan2(f32 startX, f32 startZ, f32 endX, f32 endZ);
f32 clamp_angle(f32 theta);
s32 sign(s32 value);
s32 func_80055448(s32);
s32 func_80055464(s32, s32);
s32 func_80055618(s32, s32);
s32 func_800557CC(s32);
s32 func_80055848(s32);
s32 func_800E0208(void);
s32 battle_heap_create(void);
@ -515,18 +511,15 @@ f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by);
f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz);
void add_vec2D_polar(f32* x, f32* y, f32 r, f32 theta);
s32 sfx_adjust_env_sound_pos(s32 soundID, s32 arg1, f32 arg2, f32 arg3, f32 arg4);
void sfx_play_sound(s32 soundID);
void sfx_play_sound_at_position(s32 soundID, s32 value2, f32 posX, f32 posY, f32 posZ);
void sfx_play_sound_at_player(s32 soundID, s32 arg0);
void sfx_play_sound_at_npc(s32 soundID, s32 arg1, s32 npcID);
//TODO -- remove these and use audio/public.h instead
s32 bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume);
void bgm_set_battle_song(s32, s32);
void bgm_push_battle_song(void);
void func_801497FC(s32 arg0);
s32 bgm_adjust_proximity(s32 playerIndex, s32 arg1, s16 arg2);
s32 func_8014A964(s32 playerIndex, s32 songID, s32 variation, s32 fadeInTime, s16 arg4, s16 arg5);
s32 func_8014AA54(s32 playerIndex, s32 arg1, s16 arg2);
s32 func_8014AB0C(s32 playerIndex, s16 arg1);
#include "audio/public.h"
void basic_window_update(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY,
f32* rotX, f32* rotY, f32* rotZ, s32* darkening, s32* opacity);
@ -577,9 +570,7 @@ void update_entities(void);
void func_80138198(void);
void bgm_update_music_settings(void);
void update_ambient_sounds(void);
void sfx_update_looping_sound_params(void);
void update_windows(void);
void sfx_stop_env_sounds(void);
void player_render_interact_prompts(void);
void func_802C3EE4(void);
void render_screen_overlay_backUI(void);
@ -597,7 +588,6 @@ void func_80028838(void);
void clear_screen_overlays(void);
void bgm_reset_sequence_players(void);
void reset_ambient_sounds(void);
void sfx_clear_sounds(void);
void poll_rumble(void);
void bgm_pop_song(void);
void bgm_push_song(s32 songID, s32 variation);
@ -621,8 +611,6 @@ void suspend_all_group(s32 groupFlags);
void kill_script(Evt* instanceToKill);
void exec_entity_commandlist(Entity* entity);
void sfx_reset_door_sounds(void);
void show_start_recovery_shimmer(f32 x, f32 y, f32 z, s32 arg3);
void show_recovery_shimmer(f32 x, f32 y, f32 z, s32 arg3);
@ -778,13 +766,11 @@ s32 create_generic_entity_world(WorldArgs, WorldArgs);
EntityModel* get_entity_model(s32 idx);
f32 phys_get_spin_history(s32 lag, s32* x, s32* y, s32* z);
void fold_update(u32, s32, s32, s32, s32, s32, s32);
void fold_update(u32, FoldType, s32, s32, s32, s32, s32);
s32 fold_appendGfx_component(s32, FoldImageRecPart*, u32, Matrix4f);
s32 func_8013A704(s32);
void free_generic_entity(s32);
void sfx_get_spatialized_sound_params(f32 arg0, f32 arg1, f32 arg2, s16* arg3, s16* arg4, s32 arg5);
void sfx_play_sound_with_params(s32 arg0, u8 arg1, u8 arg2, s16 arg3);
s32 ai_check_fwd_collisions(Npc* npc, f32 arg1, f32* arg2, f32* arg3, f32* arg4, f32* arg5);
void basic_ai_loiter_init(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory);
void PatrolAI_LoiterInit(Evt* script, NpcAISettings* aiSettings, EnemyDetectVolume* territory);
@ -825,19 +811,12 @@ void func_800EF3E4(void);
void func_80268858(void);
void func_80269118(void);
s32 func_80268224(s32);
void func_80149A6C(s32, s32);
void func_800EF300(void);
void enable_player_shadow(void);
s32 get_msg_lines(s32 messageID);
void set_window_properties(s32 panelID, s32 posX, s32 posY, s32 width, s32 height, u8, void* drawContents, void* drawContentsArg, s8 parent);
void set_window_update(s32 panelID, s32);
void set_windows_visible(s32 groupIdx);
void snd_stop_sound(s32 soundID);
void snd_start_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
void snd_adjust_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
void sfx_adjust_env_sound_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
void sfx_stop_sound(s32 soundID);
void partner_disable_input(void);
void partner_set_goal_pos(s32 x, s32 z);

View File

@ -65,9 +65,4 @@ MapConfig* get_current_map_header(void);
/// Zero-terminated.
extern Area gAreas[29];
/// Lists the songs that are forced to use the variation determined by `map.songVariation & 1`.
/// @see bgm_get_map_default_variation
extern s32 gSongsUsingVariationFlag[6];
extern s16 D_8014F738;
#endif

View File

@ -78,24 +78,9 @@ typedef struct ModelTreeInfo {
/* 0x03 */ char unk_03;
} ModelTreeInfo; // size = 0x04
typedef struct TileDescriptor {
/* 0x00 */ s8 name[32];
/* 0x20 */ u16 auxW;
/* 0x22 */ u16 mainW;
/* 0x24 */ u16 auxH;
/* 0x26 */ u16 mainH;
/* 0x28 */ char unk_28;
/* 0x29 */ u8 extraTiles;
/* 0x2A */ u16 colorCombine;
/* 0x2C */ u8 bitDepth;
/* 0x2D */ u8 wrapH;
/* 0x2E */ u8 wrapV;
/* 0x2F */ u8 filtering;
} TileDescriptor; // size = 0x30
typedef struct TextureHandle {
/* 0x00 */ Gfx* gfx;
/* 0x04 */ TileDescriptor desc;
/* 0x04 */ TextureHeader header;
/* 0x34 */ s32* raster;
/* 0x38 */ s32* palette;
/* 0x3C */ s32* auxRaster;

View File

@ -74,13 +74,13 @@ extern s8 D_800A0900;
extern f32 GravityParamsStartFall[];
extern s16 D_800F7B80;
extern u8* D_801512F0;
extern s16 D_80151308;
extern u16 D_80151308;
extern s32 gEntityHideMode;
extern s32 D_8010C92C;
extern s32 D_8010C950;
extern s32 D_801595A0;
extern Struct8015A578 D_8015A578;
extern HiddenPanelsData gCurrentHiddenPanels;
extern BackgroundHeader gBackgroundImage;
@ -176,7 +176,7 @@ extern f32 gCurtainFade;
extern f32 gCurtainFadeGoal;
extern UNK_FUN_PTR(gCurtainDrawCallback);
extern s16 gCurrentDoorSoundsSet;
extern u16 gCurrentDoorSoundsSet;
extern s32 D_800D9620;
extern UNK_TYPE D_800E92D8;
@ -231,12 +231,7 @@ extern EvtScript SCRIPT_NpcDefeat;
extern EvtScript ShakeCam1;
extern EvtScript ShakeCamX;
extern s16 gMusicUnkVolume;
extern s16 gMusicUnkVolume2;
extern s16 gMusicCurrentVolume;
extern s16 gMusicTargetVolume;
extern MusicSettings gMusicSettings[4];
extern MusicSettings D_8014F6F0;
// OS
extern OSThread D_800A4270; // idle thread, id 1

View File

@ -1,7 +1,7 @@
#include "common.h"
#include "filemenu.h"
#include "hud_element.h"
#include "audio.h"
#include "audio/public.h"
#include "fio.h"
extern HudScript* filemenu_hudElemScripts[14];

View File

@ -55,7 +55,7 @@ void filemenu_info_handle_input(void) {
filemenu_8024C098 = 0;
switch(menu->page) {
switch (menu->page) {
case 1:
menu->page = 0;
set_window_update(WINDOW_ID_51, (s32)filemenu_update_show_options_left);

View File

@ -236,7 +236,7 @@ void btl_state_update_begin_player_turn(void) {
gBattleState2 = BATTLE_STATE2_PLAYER_DEFEATED;
} else {
battleStatus->battlePhase = 0xC;
script = start_script(partner->onTurnChanceScriptSource, 0xA, 0);
script = start_script(partner->onTurnChanceScriptSource, EVT_PRIORITY_A, 0);
partner->onTurnChangeScript = script;
gBattleState2 = BATTLE_STATE2_UNK_14;
partner->onTurnChangeID = script->id;
@ -462,7 +462,7 @@ void btl_state_update_begin_player_turn(void) {
if (battleStatus->hammerLossTurns >= 0) {
battleStatus->hammerLossTurns--;
if (battleStatus->hammerLossTurns == -1) {
script = start_script(RegainAbility, 0xA, 0);
script = start_script(RegainAbility, EVT_PRIORITY_A, 0);
player->takeTurnScript = script;
player->takeTurnID = script->id;
script->varTable[0] = 1;
@ -477,7 +477,7 @@ void btl_state_update_begin_player_turn(void) {
if (battleStatus->jumpLossTurns >= 0) {
battleStatus->jumpLossTurns--;
if (battleStatus->jumpLossTurns == -1) {
script = start_script(RegainAbility, 0xA, 0);
script = start_script(RegainAbility, EVT_PRIORITY_A, 0);
player->takeTurnScript = script;
player->takeTurnID = script->id;
script->varTable[0] = phi_s0_3;
@ -491,7 +491,7 @@ void btl_state_update_begin_player_turn(void) {
if (battleStatus->itemLossTurns >= 0) {
battleStatus->itemLossTurns--;
if (battleStatus->itemLossTurns == -1) {
script = start_script(RegainAbility, 0xA, 0);
script = start_script(RegainAbility, EVT_PRIORITY_A, 0);
player->takeTurnScript = script;
player->takeTurnID = script->id;
script->varTable[10] = 2;
@ -651,7 +651,7 @@ block_27:
Evt* script;
battleStatus->battlePhase = 0xC;
script = start_script(partner->onTurnChanceScriptSource, 0xA, 0);
script = start_script(partner->onTurnChanceScriptSource, EVT_PRIORITY_A, 0);
partner->onTurnChangeScript = script;
partner->onTurnChangeID = script->id;
script->owner1.actorID = ACTOR_PARTNER;
@ -1037,7 +1037,7 @@ void btl_state_update_end_training_battle(void) {
Evt* script;
battleStatus->battlePhase = PHASE_ENEMY_BEGIN;
script = start_script(partner->onTurnChanceScriptSource, 0xA, 0);
script = start_script(partner->onTurnChanceScriptSource, EVT_PRIORITY_A, 0);
partner->onTurnChangeScript = script;
gBattleState2 = BATTLE_STATE2_UNK_C;
partner->onTurnChangeID = script->id;
@ -1122,7 +1122,7 @@ void btl_state_update_end_battle(void) {
gBattleState2 = BATTLE_STATE2_UNK_4;
return;
}
script = start_script(stage->postBattle, 0xA, 0);
script = start_script(stage->postBattle, EVT_PRIORITY_A, 0);
battleStatus->controlScript = script;
gBattleState2 = BATTLE_STATE2_UNK_3;
battleStatus->controlScriptID = script->id;
@ -1274,12 +1274,12 @@ void btl_state_update_run_away(void) {
player->state.varTable[0] = 100;
}
battleStatus->battlePhase = 3;
script = start_script(PlayerScriptDispatcher, 0xA, 0);
script = start_script(PlayerScriptDispatcher, EVT_PRIORITY_A, 0);
player->takeTurnScript = script;
player->takeTurnID = script->id;
script->owner1.actorID = ACTOR_PLAYER;
if (partner != NULL && partner->koStatus == 0) {
script = start_script(partner->takeTurnScriptSource, 0xA, 0);
script = start_script(partner->takeTurnScriptSource, EVT_PRIORITY_A, 0);
partner->takeTurnScript = script;
partner->takeTurnID = script->id;
script->owner1.actorID = ACTOR_PARTNER;
@ -1353,12 +1353,12 @@ void btl_state_update_run_away(void) {
switch (gBattleState2) {
case BATTLE_STATE2_UNK_3:
battleStatus->battlePhase = 7;
script = start_script(PlayerScriptDispatcher, 0xA, 0);
script = start_script(PlayerScriptDispatcher, EVT_PRIORITY_A, 0);
player->takeTurnScript = script;
player->takeTurnID = script->id;
script->owner1.actorID = ACTOR_PLAYER;
if (partner != NULL && partner->koStatus == 0) {
script = start_script(partner->takeTurnScriptSource, 0xA, 0);
script = start_script(partner->takeTurnScriptSource, EVT_PRIORITY_A, 0);
partner->takeTurnScript = script;
partner->takeTurnID = script->id;
script->owner1.actorID = ACTOR_PARTNER;
@ -1981,7 +1981,7 @@ void btl_state_update_next_enemy(void) {
Evt* onTurnChanceScript;
battleStatus->battlePhase = PHASE_ENEMY_BEGIN;
onTurnChanceScript = start_script(enemy->onTurnChanceScriptSource, 0xA, 0);
onTurnChanceScript = start_script(enemy->onTurnChanceScriptSource, EVT_PRIORITY_A, 0);
enemy->onTurnChangeScript = onTurnChanceScript;
enemy->onTurnChangeID = onTurnChanceScript->id;
onTurnChanceScript->owner1.actorID = battleStatus->activeEnemyActorID;
@ -2071,7 +2071,7 @@ void btl_state_update_partner_striking_first(void) {
actor = get_actor(ACTOR_ENEMY0);
if (actor->onHitScriptSource != NULL) {
actor->lastEventType = EVENT_BEGIN_FIRST_STRIKE;
script = start_script(actor->onHitScriptSource, 0xA, 0x20);
script = start_script(actor->onHitScriptSource, EVT_PRIORITY_A, EVT_FLAG_20);
actor->onHitScript = script;
actor->onHitID = script->id;
script->owner1.actorID = actor->actorID;
@ -2094,7 +2094,7 @@ void btl_state_update_partner_striking_first(void) {
btl_cam_target_actor(ACTOR_PARTNER);
reset_actor_turn_info();
battleStatus->battlePhase = PHASE_FIRST_STRIKE;
script = start_script(partner->takeTurnScriptSource, 0xA, 0);
script = start_script(partner->takeTurnScriptSource, EVT_PRIORITY_A, 0);
partner->takeTurnScript = script;
D_8029F248 = 3;
gBattleState2 = BATTLE_STATE2_UNK_2;
@ -2154,7 +2154,7 @@ void btl_state_update_partner_striking_first(void) {
if (actor != NULL) {
if (actor->onHitScriptSource != NULL) {
actor->lastEventType = EVENT_END_FIRST_STRIKE;
script = start_script(actor->onHitScriptSource, 0xA, 0x20);
script = start_script(actor->onHitScriptSource, EVT_PRIORITY_A, EVT_FLAG_20);
actor->onHitScript = script;
actor->onHitID = script->id;
script->owner1.actorID = actor->actorID;
@ -2320,7 +2320,7 @@ void btl_state_update_enemy_striking_first(void) {
enemy = battleStatus->currentTurnEnemy;
reset_actor_turn_info();
battleStatus->battlePhase = 1;
script = start_script(enemy->takeTurnScriptSource, 0xA, 0);
script = start_script(enemy->takeTurnScriptSource, EVT_PRIORITY_A, 0);
enemy->takeTurnScript = script;
D_8029F248 = 3;
enemy->takeTurnID = script->id;
@ -2455,7 +2455,7 @@ void btl_state_update_end_demo_battle(void) {
if (stage->postBattle == NULL) {
gBattleState2 = BATTLE_STATE2_UNK_4;
} else {
battleStatus->controlScript = start_script(stage->postBattle, 0xA, 0);
battleStatus->controlScript = start_script(stage->postBattle, EVT_PRIORITY_A, 0);
gBattleState2 = BATTLE_STATE2_UNK_3;
battleStatus->controlScriptID = battleStatus->controlScript->id;
}

View File

@ -78,8 +78,8 @@ EvtScript BtlBringPartnerOut = {
};
extern s32 D_8029DA30;
extern s32 D_8029DA34;
extern s32 bSavedPartner;
extern s32 bSavedOverrideFlags;
extern s32 D_8029DA40;
extern s32 D_8029DA44;
extern s32 D_8029DA48;
@ -157,7 +157,7 @@ void initialize_battle(void) {
gBattleStatus.flags1 = 0;
gBattleStatus.flags2 = 0;
gBattleStatus.flags1 = 0;
D_8029DA34 = gOverrideFlags;
bSavedOverrideFlags = gOverrideFlags;
gOverrideFlags &= ~GLOBAL_OVERRIDES_80;
gBattleStatus.inputBitmask = -1;
gOverrideFlags &= ~GLOBAL_OVERRIDES_80;
@ -225,7 +225,7 @@ void initialize_battle(void) {
playerData->battlesCount++;
}
D_8029DA30 = playerData->currentPartner;
bSavedPartner = playerData->currentPartner;
if (gBattleStatus.flags2 & BS_FLAGS2_40) {
playerData->currentPartner = PARTNER_TWINK;
}
@ -964,14 +964,14 @@ void btl_restore_world_cameras(void) {
playerStatus->position.y = D_8029EFB4;
playerStatus->position.z = D_8029EFB8;
if (D_8029DA34 & 0x80) {
if (bSavedOverrideFlags & GLOBAL_OVERRIDES_80) {
gOverrideFlags |= GLOBAL_OVERRIDES_80;
} else {
gOverrideFlags &= ~GLOBAL_OVERRIDES_80;
}
if (gBattleStatus.flags2 & 0x40) {
playerData->currentPartner = D_8029DA30;
playerData->currentPartner = bSavedPartner;
}
}

View File

@ -1528,7 +1528,7 @@ void close_action_command_instruction_popup(void) {
void func_8024FB3C(void* data) {
PopupMessage* popup = data;
BattleStatus* battleStatus = &gBattleStatus;
s32 cond = FALSE;
s32 shouldDisposeWindow = FALSE;
s32 temp_a0;
@ -1605,7 +1605,7 @@ void func_8024FB3C(void* data) {
}
break;
case 4:
cond = TRUE;
shouldDisposeWindow = TRUE;
break;
case 3:
popup->unk_16 = 4;
@ -1637,7 +1637,7 @@ void func_8024FB3C(void* data) {
D_8029F64A = TRUE;
if (temp_a0 == 0) {
D_8029F64A = FALSE;
cond = TRUE;
shouldDisposeWindow = TRUE;
break;
}
@ -1783,11 +1783,11 @@ void func_8024FB3C(void* data) {
case 1:
if (gBattleStatus.flags1 & BS_FLAGS1_10000) {
gBattleStatus.flags1 &= ~BS_FLAGS1_4000;
set_window_update(9, 7);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW_TRANSPARENT);
popup->duration = 0;
popup->unk_16 = 2;
} else if (!(gBattleStatus.flags1 & BS_FLAGS1_4000) && (temp_a0 != 2)) {
set_window_update(9, 7);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW_TRANSPARENT);
switch (popup->messageIndex) {
case 49:
hud_element_set_script(D_8029F642, &HES_MashAButton);
@ -1923,7 +1923,7 @@ void func_8024FB3C(void* data) {
break;
}
D_8029F64A = FALSE;
cond = TRUE;
shouldDisposeWindow = TRUE;
}
}
}
@ -1960,7 +1960,7 @@ void func_8024FB3C(void* data) {
popup->unk_16 = 4;
break;
case 4:
cond = TRUE;
shouldDisposeWindow = TRUE;
break;
}
break;
@ -2017,14 +2017,14 @@ void func_8024FB3C(void* data) {
popup->duration--;
break;
}
cond = TRUE;
shouldDisposeWindow = TRUE;
hud_element_free(D_8029F642);
break;
}
break;
}
if (cond) {
set_window_update(9, 2);
if (shouldDisposeWindow) {
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_HIDE);
D_802838F8 = NULL;
free_popup(popup);
}
@ -2354,8 +2354,8 @@ void btl_show_message_popup(void* data) {
width = msgWidth;
numLines = get_msg_lines(messageID) - 1;
height = bMsgHeights[numLines];
set_window_properties(9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(9, 1);
set_window_properties(WINDOW_ID_9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW);
}
break;
case 73:
@ -2371,8 +2371,8 @@ void btl_show_message_popup(void* data) {
posX = 160 - (msgWidth / 2);
width = msgWidth;
height = 40;
set_window_properties(9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(9, 1);
set_window_properties(WINDOW_ID_9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW);
}
break;
case 4:
@ -2396,8 +2396,8 @@ void btl_show_message_popup(void* data) {
width = msgWidth;
numLines = get_msg_lines(messageID) - 1;
height = bMsgHeights[numLines];
set_window_properties(9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(9, 1);
set_window_properties(WINDOW_ID_9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW);
}
break;
case 81:
@ -2412,8 +2412,8 @@ void btl_show_message_popup(void* data) {
width = msgWidth;
numLines = get_msg_lines(messageID) - 1;
height = bMsgHeights[numLines];
set_window_properties(9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(9, 1);
set_window_properties(WINDOW_ID_9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW);
}
break;
case 46:
@ -2456,11 +2456,11 @@ void btl_show_message_popup(void* data) {
D_8029F650 = D_802835D8[numLines];
posY = D_8029F64E + D_8029F650;
set_window_properties(9, posX, posY, width, height, 0, func_80250818, popup, -1);
set_window_properties(WINDOW_ID_9, posX, posY, width, height, 0, func_80250818, popup, -1);
if (popup->messageIndex == 0x3B) {
set_window_update(9, 1);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW);
} else {
set_window_update(9, 8);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW_DARKENED);
}
}
break;

View File

@ -456,54 +456,54 @@ s32 calc_item_damage_enemy(void) {
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_SLEEP) && wasStatusInflicted) {
script = start_script(DoSleepHit, EVT_PRIORITY_A, 0);
script = start_script(&DoSleepHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
sfx_play_sound_at_position(SOUND_INFLICT_SLEEP, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY) && wasStatusInflicted) {
script = start_script(DoDizzyHit, EVT_PRIORITY_A, 0);
script = start_script(&DoDizzyHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
sfx_play_sound_at_position(SOUND_INFLICT_STATUS, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE) && wasStatusInflicted) {
script = start_script(DoParalyzeHit, EVT_PRIORITY_A, 0);
script = start_script(&DoParalyzeHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
sfx_play_sound_at_position(SOUND_INFLICT_STATUS, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_POISON) && wasStatusInflicted) {
script = start_script(DoPoisonHit, EVT_PRIORITY_A, 0);
script = start_script(&DoPoisonHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
sfx_play_sound_at_position(SOUND_INFLICT_STATUS, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_STOP) && wasStatusInflicted) {
script = start_script(DoStopHit, EVT_PRIORITY_A, 0);
script = start_script(&DoStopHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
sfx_play_sound_at_position(SOUND_INFLICT_STATUS, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_FROZEN) && wasStatusInflicted) {
script = start_script(DoFreezeHit, EVT_PRIORITY_A, 0);
script = start_script(&DoFreezeHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
script->varTable[3] = target;
script->varTablePtr[3] = target;
sfx_play_sound_at_position(SOUND_INFLICT_STATUS, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackStatus & STATUS_FLAG_SHRINK) && wasStatusInflicted) {
script = start_script(DoShrinkHit, EVT_PRIORITY_A, 0);
script = start_script(&DoShrinkHit, EVT_PRIORITY_A, 0);
script->varTable[0] = state->goalPos.x;
script->varTable[1] = state->goalPos.y;
script->varTable[2] = state->goalPos.z;
script->varTable[3] = target;
script->varTablePtr[3] = target;
sfx_play_sound_at_position(SOUND_INFLICT_STATUS, 0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
}
if ((battleStatus->currentAttackElement & DAMAGE_TYPE_SMASH) && (target->actorType == ACTOR_TYPE_GOOMNUT_TREE)) {

View File

@ -618,7 +618,7 @@ void btl_state_update_celebration(void) {
hud_element_set_tint(id, 128, 128, 128);
x = 20;
y = 186;
set_window_properties(8, 20, 186, 280, 32, 20, func_80260948, NULL, -1);
set_window_properties(WINDOW_ID_8, 20, 186, 280, 32, 20, func_80260948, NULL, -1);
set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW);
gBattleState2 = BATTLE_STATE2_UNK_8;
}
@ -769,7 +769,7 @@ void btl_state_update_celebration(void) {
width = get_msg_width(0x1D00AB, 0) + 31;
x = 160 - (width / 2);
y = 80;
set_window_properties(9, x, y, width, 28, 10, func_80260A20, NULL, -1);
set_window_properties(WINDOW_ID_9, x, y, width, 28, 10, func_80260A20, NULL, -1);
set_window_update(WINDOW_ID_9, WINDOW_UPDATE_SHOW);
D_8029FB4C = 60;
gBattleState2 = BATTLE_STATE2_UNK_10;

View File

@ -1,348 +0,0 @@
#include "common.h"
#include "audio.h"
void snd_SEFCmd_00_SetVolume(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_01_SetPan(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_02_SetInstrument(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_03_SetReverb(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_04(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_05(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_06(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_07(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_08(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_09_StartLoop(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_0A_EndLoop(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_0B(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_0C(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_0D(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_0E(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_0F(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_10_Jump(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_13(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_14(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_15(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_16(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_17(SoundManager* manager, SoundPlayer* player);
void snd_SEFCmd_18(SoundManager* manager, SoundPlayer* player);
void func_8004B440(SoundManager* manager, u8 arg1, u8 arg2, UnkAl19E0* arg3, u8 arg4) {
u32 i;
s32 c = 0x6A25E;
manager->soundData = arg3;
manager->unkCounterStep = 312500;
manager->unkCounterMax = manager->unkCounter = c;
manager->unk_BC = arg1;
manager->unk_BE = arg2;
if (arg4 > 0x10) {
manager->sfxPlayerSelector = 0x10;
} else {
manager->sfxPlayerSelector = arg4;
}
manager->unk_5C = 0x8000;
manager->unk_B8 = 0x8000;
manager->playCounter = 0;
manager->unk_60 = 0;
for (i = 0; i < ARRAY_COUNT(manager->unk_16C); i++) {
SoundPlayer* sub = &manager->unk_16C[i];
sub->sefDataReadPos = 0;
sub->sfxVolume = 0;
sub->unk_8E = 0;
sub->unk_90 = 0;
sub->unk_92 = 0;
sub->unk_94 = 0;
sub->sfxPan = 0;
sub->reverb = 0;
sub->instrumentIndex = 0;
sub->unk_9E = 0;
sub->unk_9F = 0;
sub->unk_99 = 0;
sub->locatorB = 0;
sub->locatorC = 0;
sub->locatorD = 0;
sub->unk_7B = 0x40;
sub->unk_7C = 0;
sub->unk_7D = 0xB0;
sub->unk_7E = 0;
sub->unk_7F = 0;
}
for (i = 0; i < ARRAY_COUNT(manager->unk_90); i++) {
manager->unk_90[i] = 0;
}
for (i = 0; i < ARRAY_COUNT(manager->unk_A0); i++) {
manager->unk_A0[i].x = 0;
}
manager->unk_168 = 0;
func_8004BA54(manager, 0);
snd_clear_sfx_queue(manager);
snd_initialize_bgm_fade(&manager->unk_40, 0, 0x7FFF, 0x7FFF);
func_80053A98(manager->unk_BE, manager->unk_40.currentVolume.u16, manager->unk_5C);
manager->unk_8C = 0xFF;
manager->unk_64[0] = &D_80078290;
manager->unk_64[1] = &D_800782F8;
manager->unk_64[2] = &D_80078320;
manager->unk_64[3] = &D_80078348;
manager->unk_64[4] = &D_80078348;
manager->unk_64[5] = &D_80078348;
manager->unk_64[6] = &D_80078348;
manager->unk_64[7] = &D_80078348;
manager->unk_84[0] = 0x10;
manager->unk_84[1] = 0x20;
manager->unk_84[2] = 0x20;
manager->unk_84[3] = 0x20;
manager->unk_84[4] = 0x20;
manager->unk_84[5] = 0x30;
manager->unk_84[6] = 0x40;
manager->unk_84[7] = 0x50;
func_8004B9E4(manager, 0);
}
INCLUDE_ASM(void, "26840_len_20d0", snd_load_sfx_groups_from_SEF, SoundManager* manager);
void snd_clear_sfx_queue(SoundManager* manager) {
s32 i;
for (i =