mirror of
https://github.com/zeldaret/tmc
synced 2026-06-13 22:15:44 -04:00
naming and moving stuff
This commit is contained in:
@@ -1,4 +1,115 @@
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "gba/m4a.h"
|
||||
#include "audio.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void sub_080A35A0(u32);
|
||||
extern void sub_080A35C8(void);
|
||||
extern void sub_080A353C(u32);
|
||||
extern void sub_080A3234(u32);
|
||||
extern void sub_080A35B4(u32);
|
||||
|
||||
#define IS_BGM(song) (song) - 1 <= NUM_BGM - 1
|
||||
#define IS_SFX(song) (song) - 1 > NUM_BGM - 1
|
||||
|
||||
void SoundReq(u32 arg) {
|
||||
u32 song;
|
||||
struct_02021EE0* ptr;
|
||||
if (gMain.field_0x7)
|
||||
return;
|
||||
ptr = &gUnk_02021EE0;
|
||||
song = arg & 0xffff;
|
||||
switch (arg & 0xffff0000) {
|
||||
case SOUND_REQ_ALL_STOP:
|
||||
ptr->currentBgm = 0;
|
||||
m4aMPlayAllStop();
|
||||
return;
|
||||
case 0x80020000:
|
||||
sub_080A3234(0);
|
||||
return;
|
||||
case 0x80030000:
|
||||
sub_080A35C8();
|
||||
ptr->unk_12 = 0x100;
|
||||
sub_080A353C(ptr->currentBgm);
|
||||
return;
|
||||
case 0x80080000:
|
||||
sub_080A35B4(ptr->currentBgm);
|
||||
return;
|
||||
case 0x80090000:
|
||||
if (song == 0)
|
||||
song = ptr->currentBgm;
|
||||
if (IS_SFX(song))
|
||||
return;
|
||||
ptr->currentBgm = song;
|
||||
m4aSongNumStart(song);
|
||||
sub_080A35A0(song);
|
||||
return;
|
||||
case 0x800a0000:
|
||||
if (IS_SFX(song))
|
||||
return;
|
||||
ptr->currentBgm = song;
|
||||
m4aSongNumStartOrContinue(song);
|
||||
sub_080A35A0(song);
|
||||
return;
|
||||
case 0x800c0000:
|
||||
m4aMPlayTempoControl(gMPlayTable[gSongTable[ptr->currentBgm].ms].info, song);
|
||||
return;
|
||||
case 0x80040000:
|
||||
m4aMPlayAllStop();
|
||||
m4aSoundVSyncOff();
|
||||
return;
|
||||
case 0x80050000:
|
||||
if (ptr->currentBgm == 0)
|
||||
return;
|
||||
m4aSongNumStop(ptr->currentBgm);
|
||||
return;
|
||||
case 0x80060000:
|
||||
m4aSoundVSyncOn();
|
||||
case 0x80070000:
|
||||
if (ptr->currentBgm == 0)
|
||||
return;
|
||||
m4aSongNumStartOrContinue(ptr->currentBgm);
|
||||
sub_080A353C(ptr->currentBgm);
|
||||
return;
|
||||
case 0x800b0000:
|
||||
if (IS_SFX(song))
|
||||
return;
|
||||
ptr->currentBgm = song;
|
||||
m4aSongNumStartOrContinue(song);
|
||||
sub_080A35C8();
|
||||
sub_080A353C(song);
|
||||
return;
|
||||
case 0x800d0000:
|
||||
ptr->unk_10 = 0;
|
||||
return;
|
||||
case 0x80100000:
|
||||
ptr->unk_10 = 0;
|
||||
ptr->unk_02 = 1;
|
||||
return;
|
||||
case 0x800e0000:
|
||||
ptr->unk_10 = 0x100;
|
||||
return;
|
||||
case 0x800f0000:
|
||||
sub_080A35C8();
|
||||
return;
|
||||
case 0x80110000:
|
||||
ptr->currentBgm = 0;
|
||||
return;
|
||||
default:
|
||||
if (song != 0) {
|
||||
if (IS_BGM(song)) {
|
||||
ptr->currentBgm = song;
|
||||
m4aSongNumStart(song);
|
||||
sub_080A35C8();
|
||||
} else {
|
||||
m4aSongNumStart(song);
|
||||
}
|
||||
sub_080A353C(song);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
extern const SongHeader song_08DCC48C;
|
||||
extern const SongHeader song_08DCC6CC;
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gRope[6])(Entity*);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08001318(Entity*);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "player.h"
|
||||
#include "screen.h"
|
||||
#include "createObject.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
#include "audio.h"
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "audio.h"
|
||||
#include "textbox.h"
|
||||
#include "structures.h"
|
||||
|
||||
|
||||
+6
-11
@@ -286,10 +286,7 @@ u32 MidiKeyToCgbFreq(u8, u8, u8);
|
||||
void nullsub_141(void);
|
||||
void MPlayJumpTableCopy(void** mplayJumpTable);
|
||||
void SampleFreqSet(u32 freq);
|
||||
void m4aSoundVSyncOn(void);
|
||||
void m4aSoundVSyncOff(void);
|
||||
|
||||
void m4aMPlayTempoControl(MusicPlayerInfo* mplayInfo, u16 tempo);
|
||||
void m4aMPlayVolumeControl(MusicPlayerInfo* mplayInfo, u16 trackBits, u16 volume);
|
||||
void m4aMPlayPitchControl(MusicPlayerInfo* mplayInfo, u16 trackBits, s16 pitch);
|
||||
void m4aMPlayPanpotControl(MusicPlayerInfo* mplayInfo, u16 trackBits, s8 pan);
|
||||
@@ -1152,27 +1149,26 @@ void CgbOscOff(u8 chanNum) {
|
||||
}
|
||||
}
|
||||
|
||||
// CgbModVol does not match because of this
|
||||
static inline int CgbPan(CgbChannel* chan) {
|
||||
u32 rightVolume = chan->rightVolume;
|
||||
u32 leftVolume = chan->leftVolume;
|
||||
// regalloc
|
||||
if ((rightVolume = (u8)rightVolume) >= (leftVolume = (u8)leftVolume)) {
|
||||
if (rightVolume / 2 >= leftVolume) {
|
||||
u8 rightVolume2 = rightVolume;
|
||||
u8 leftVolume2 = leftVolume;
|
||||
if (rightVolume2 >= leftVolume2) {
|
||||
if (rightVolume2 / 2 >= leftVolume2) {
|
||||
chan->pan = 0x0F;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (leftVolume / 2 >= rightVolume) {
|
||||
if (leftVolume2 / 2 >= rightVolume2) {
|
||||
chan->pan = 0xF0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/m4a/CgbModVol.inc", void CgbModVol(CgbChannel* chan)) {
|
||||
void CgbModVol(CgbChannel* chan) {
|
||||
SoundInfo* soundInfo = SOUND_INFO_PTR;
|
||||
|
||||
if (!CgbPan(chan)) {
|
||||
@@ -1194,7 +1190,6 @@ NONMATCH("asm/non_matching/m4a/CgbModVol.inc", void CgbModVol(CgbChannel* chan))
|
||||
chan->sustainGoal = (chan->envelopeGoal * chan->sustain + 15) >> 4;
|
||||
chan->pan &= chan->panMask;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/m4a/CgbSound.inc", void CgbSound(void)) {
|
||||
s32 ch;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "item.h"
|
||||
#include "functions.h"
|
||||
#include "audio.h"
|
||||
|
||||
// TODO - How does this relate to PlayerItemFunctions? Is this just a lookup table?
|
||||
void (*const gItemFunctions[])(ItemBehavior*, u32) = {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "room.h"
|
||||
#include "player.h"
|
||||
#include "random.h"
|
||||
#include "functions.h"
|
||||
#include "audio.h"
|
||||
|
||||
// Facilitates the usage of minish portals.
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "room.h"
|
||||
#include "area.h"
|
||||
#include "utils.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "manager.h"
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08058E60(ManagerE* this) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "structures.h"
|
||||
#include "script.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*gUnk_081140D4[])(Entity*);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
#include "npc.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*gUnk_081115C0[])(Entity*);
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "flags.h"
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Hitbox gUnk_080FD170;
|
||||
extern void script_08016030; // Cutscene data type?
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "textbox.h"
|
||||
#include "script.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08068780(Entity*);
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "entity.h"
|
||||
#include "script.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0806A8C8(Entity*);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "script.h"
|
||||
#include "random.h"
|
||||
#include "npc.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u32*);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_0811EE38[])(Entity*);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
#include "script.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ u16 unk0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
#include "audio.h"
|
||||
|
||||
extern void sub_080A0960(Entity*, u32);
|
||||
extern void sub_0801AF18(u8*, u32, u32);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 sub_08083734(Entity*, u32);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "object.h"
|
||||
#include "menu.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const ThoughtBubble_Behaviors[])(Entity*);
|
||||
|
||||
+5
-7
@@ -58,8 +58,6 @@ const SaveFileEEPROMAddresses gSaveFileEEPROMAddresses[] = { { 0x500, 0x30, 0x10
|
||||
{ 0x20, 0x60, 0x1060, 0xf80, 0x1f80 },
|
||||
{ 0x8, 0xfa0, 0x1fa0, 0xfa0, 0x1fa0 } };
|
||||
|
||||
extern s16 gUnk_02021EE0[6];
|
||||
|
||||
void sub_0807CD9C() {
|
||||
sub_080530C8();
|
||||
}
|
||||
@@ -69,8 +67,8 @@ SaveResult HandleSave(u32 arg0) {
|
||||
}
|
||||
|
||||
SaveResult HandleSaveInit(u32 arg0) {
|
||||
gUnk_02021EE0[5] -= 8;
|
||||
if (gUnk_02021EE0[4] <= 0) {
|
||||
gUnk_02021EE0.unk_0a -= 8;
|
||||
if (gUnk_02021EE0.unk_08 <= 0) {
|
||||
gMenu.field_0xa = 8;
|
||||
gMenu.storyPanelIndex = SAVE_IN_PROGRESS;
|
||||
}
|
||||
@@ -107,9 +105,9 @@ SaveResult HandleSaveDone(u32 arg0) {
|
||||
SaveResult result;
|
||||
|
||||
result = SAVE_BUSY;
|
||||
gUnk_02021EE0[5] += 8;
|
||||
if (gUnk_02021EE0[3] <= gUnk_02021EE0[5]) {
|
||||
gUnk_02021EE0[5] = gUnk_02021EE0[3];
|
||||
gUnk_02021EE0.unk_0a += 8;
|
||||
if (gUnk_02021EE0.unk_06 <= gUnk_02021EE0.unk_0a) {
|
||||
gUnk_02021EE0.unk_0a = gUnk_02021EE0.unk_06;
|
||||
sub_08050384();
|
||||
gMenu.storyPanelIndex = SAVE_INIT;
|
||||
if (gMenu.field_0xa == 1) {
|
||||
|
||||
+8
-7
@@ -9,6 +9,7 @@
|
||||
#include "utils.h"
|
||||
#include "save.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
void InitScriptForEntity(Entity*, ScriptExecutionContext*, u16*);
|
||||
@@ -137,9 +138,9 @@ void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EF3C(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_DoPostScriptAction(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_DoPostScriptAction2(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_PlaySound(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_PlayBgm(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_SoundReq2(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_SoundReq3(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_SoundReq0x80100000(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_ModRupees(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_ModHealth(Entity* entity, ScriptExecutionContext* context);
|
||||
@@ -283,9 +284,9 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop,
|
||||
ScriptCommand_0807EF3C,
|
||||
ScriptCommand_DoPostScriptAction,
|
||||
ScriptCommand_DoPostScriptAction2,
|
||||
ScriptCommand_PlaySound,
|
||||
ScriptCommand_PlayBgm,
|
||||
ScriptCommand_SoundReq,
|
||||
ScriptCommand_SoundReq2,
|
||||
ScriptCommand_SoundReq3,
|
||||
ScriptCommand_SoundReq0x80100000,
|
||||
ScriptCommand_ModRupees,
|
||||
ScriptCommand_ModHealth,
|
||||
@@ -1450,11 +1451,11 @@ void ScriptCommand_DoPostScriptAction2(Entity* entity, ScriptExecutionContext* c
|
||||
context->postScriptActions |= 1 << context->scriptInstructionPointer[1];
|
||||
}
|
||||
|
||||
void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_PlaySound(Entity* entity, ScriptExecutionContext* context) {
|
||||
SoundReq(context->scriptInstructionPointer[1]);
|
||||
}
|
||||
|
||||
void ScriptCommand_SoundReq2(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_PlayBgm(Entity* entity, ScriptExecutionContext* context) {
|
||||
if (context->scriptInstructionPointer[1] >= 100) {
|
||||
SoundReq(gArea.musicIndex);
|
||||
} else {
|
||||
@@ -1462,7 +1463,7 @@ void ScriptCommand_SoundReq2(Entity* entity, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptCommand_SoundReq3(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context) {
|
||||
SoundReq(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user