add tiles.h

This commit is contained in:
theo3 2021-10-26 22:06:24 -07:00
parent d29468c30b
commit 6ecaea44c5
20 changed files with 69 additions and 55 deletions

View File

@ -5,8 +5,8 @@
.text .text
thumb_func_start sub_08050154 thumb_func_start UpdateFade
sub_08050154: @ 0x08050154 UpdateFade: @ 0x08050154
push {r4, r5, r6, lr} push {r4, r5, r6, lr}
ldr r4, _08050180 @ =gFadeControl ldr r4, _08050180 @ =gFadeControl
ldrh r0, [r4, #8] ldrh r0, [r4, #8]

View File

@ -329,7 +329,7 @@
.2byte \s .2byte \s
.endm .endm
.macro _0807E788 w:req .macro SetFadeMask w:req
.2byte 0x0c39 .2byte 0x0c39
.4byte \w .4byte \w
.endm .endm

View File

@ -31,7 +31,7 @@ script_08012368:
StopBgm StopBgm
BeginBlock BeginBlock
_0807E778 0x0004 _0807E778 0x0004
_0807E788 0x00007fff SetFadeMask 0x00007fff
DoFade5 DoFade5
_0807E858 0x0080 _0807E858 0x0080
EndBlock EndBlock
@ -55,7 +55,7 @@ script_08012368:
Wait 0x003c Wait 0x003c
BeginBlock BeginBlock
_0807E778 0x0004 _0807E778 0x0004
_0807E788 0xffffffff SetFadeMask 0xffffffff
DoFade4 DoFade4
_0807E858 0x0080 _0807E858 0x0080
EndBlock EndBlock

View File

@ -77,7 +77,7 @@ script_0801248A:
MoveEntityToPlayer MoveEntityToPlayer
Call sub_0807F844 Call sub_0807F844
CameraTargetPlayer CameraTargetPlayer
_0807E788 0xffffffff SetFadeMask 0xffffffff
_0807E778 0x0004 _0807E778 0x0004
_0807E800 0x00000000 _0807E800 0x00000000
WaitFor_2 WaitFor_2

View File

@ -49,7 +49,7 @@ SCRIPT_START script_080131AC
_0807EA94 _0807EA94
_0807E5F8 0x00000020 _0807E5F8 0x00000020
WaitForSomething2 0x00000040 WaitForSomething2 0x00000040
_0807E788 0xffff7fff SetFadeMask 0xffff7fff
_0807E778 0x0004 _0807E778 0x0004
DoFade5 DoFade5
WaitFor_2 WaitFor_2
@ -60,7 +60,7 @@ SCRIPT_START script_080131AC
Call sub_0807F5C0 Call sub_0807F5C0
TextboxNoOverlapFollowPos 0x1604, 0x0007 TextboxNoOverlapFollowPos 0x1604, 0x0007
_0807EA94 _0807EA94
_0807E788 0xffffffff SetFadeMask 0xffffffff
_0807E778 0x0004 _0807E778 0x0004
DoFade4 DoFade4
WaitFor_2 WaitFor_2

View File

@ -62,4 +62,4 @@ SCRIPT_START script_08016384
WaitFor_1 WaitFor_1
WaitFor_2 WaitFor_2
_0807E778 0x0004 _0807E778 0x0004
_0807E788 0x0000ffff SetFadeMask 0x0000ffff

View File

@ -89,7 +89,7 @@ extern void DoSoftReset(void);
extern void sub_08056260(void); extern void sub_08056260(void);
extern void VBlankIntrWait(); extern void VBlankIntrWait();
extern void MessageUpdate(void); extern void MessageUpdate(void);
extern void sub_08050154(void); extern void UpdateFade(void);
extern u8 gUnk_03003DE4; extern u8 gUnk_03003DE4;

View File

@ -93,7 +93,7 @@ typedef struct {
u8 field_0x1; u8 field_0x1;
u8 field_0x2; u8 field_0x2;
u8 field_0x3; u8 field_0x3;
u32 field_0x4; u32 mask;
u16 fadeType; // fade in or out, are there others? u16 fadeType; // fade in or out, are there others?
u16 fadeSpeed; // subtracted from duration u16 fadeSpeed; // subtracted from duration
u16 fadeDuration; u16 fadeDuration;
@ -103,9 +103,9 @@ typedef struct {
s16 field_0x14; s16 field_0x14;
u16 field_0x16; u16 field_0x16;
u16 field_0x18; u16 field_0x18;
} struct_03000FD0; } FadeControl;
extern struct_03000FD0 gFadeControl; extern FadeControl gFadeControl;
typedef struct { typedef struct {
u8 filler0[0x1A]; u8 filler0[0x1A];

18
include/tiles.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef TILES_H
#define TILES_H
typedef enum {
CUT_BUSH = 0x1C,
CUT_GRASS = 0x1D,
CUT_SIGNPOST = 0x1E,
CUT_TREE = 0x1F,
ROCK = 0x55,
CHEST = 0x73,
SIGNPOST = 0x176,
PERMA_ROCK = 0x1D3,
PERMA_ROCK2 = 0x1D4,
PERMA_ROCK3 = 0x1D5,
PERMA_ROCK4 = 0x1D6,
} Tile;
#endif // TILES_H

View File

@ -198,7 +198,6 @@ s32 fade(s32 target, s32 current) {
void doPlaySound(u32 sound) { void doPlaySound(u32 sound) {
u32 volume; u32 volume;
u32 iVar2;
MusicPlayerInfo* musicPlayerInfo; MusicPlayerInfo* musicPlayerInfo;
if (sound == 0) if (sound == 0)
@ -209,8 +208,7 @@ void doPlaySound(u32 sound) {
} else { } else {
volume = gSoundPlayingInfo.volumeSfx; volume = gSoundPlayingInfo.volumeSfx;
} }
iVar2 = gSoundPlayingInfo.volumeMaster; volume = gSoundPlayingInfo.volumeMaster * volume / 0x100;
volume = iVar2 * volume / 0x100;
musicPlayerInfo = gMusicPlayers[gSongTable[sound].musicPlayerIndex].info; musicPlayerInfo = gMusicPlayers[gSongTable[sound].musicPlayerIndex].info;
m4aMPlayImmInit(musicPlayerInfo); m4aMPlayImmInit(musicPlayerInfo);
m4aMPlayVolumeControl(musicPlayerInfo, 0xffff, volume); m4aMPlayVolumeControl(musicPlayerInfo, 0xffff, volume);

View File

@ -67,7 +67,7 @@ void sub_0805212C(void) {
#else #else
sub_08052418(0, 0); sub_08052418(0, 0);
gScreen.lcd.displayControl |= 0x600; gScreen.lcd.displayControl |= 0x600;
gFadeControl.field_0x4 = 0xffff; gFadeControl.mask = 0x0000ffff;
DoFade(4, 0x10); DoFade(4, 0x10);
#endif #endif
} }
@ -97,7 +97,7 @@ void sub_080521A0(void) {
gMenu.field_0x3 = 0; gMenu.field_0x3 = 0;
sub_080A7114(1); sub_080A7114(1);
sub_08052418(0, 0); sub_08052418(0, 0);
gFadeControl.field_0x4 = 0xffffffff; gFadeControl.mask = 0xffffffff;
break; break;
case 1: case 1:
if (gMenu.transitionTimer == 0) { if (gMenu.transitionTimer == 0) {

View File

@ -285,7 +285,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) {
gIntroState.subState++; gIntroState.subState++;
gScreen.bg.bg1yOffset = 0; gScreen.bg.bg1yOffset = 0;
gScreen.bg.bg1Control = 0xc09; gScreen.bg.bg1Control = 0xc09;
gFadeControl.field_0x4 = 0x40; gFadeControl.mask = 0x00000040;
DoFade(6, 0x10); DoFade(6, 0x10);
SoundReq(SFX_F8); SoundReq(SFX_F8);
} }
@ -293,7 +293,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) {
break; break;
case 1: case 1:
if (!gFadeControl.active) { if (!gFadeControl.active) {
gFadeControl.field_0x4 = -1; gFadeControl.mask = 0xFFFFFFFF;
gIntroState.subState++; gIntroState.subState++;
#if defined(JP) || defined(EU) #if defined(JP) || defined(EU)
gIntroState.timer = 120; gIntroState.timer = 120;

View File

@ -81,7 +81,7 @@ void AgbMain(void) {
gMain.ticks++; gMain.ticks++;
sScreenHandlers[gMain.screen](); sScreenHandlers[gMain.screen]();
MessageUpdate(); MessageUpdate();
sub_08050154(); UpdateFade();
SoundLoop(); SoundLoop();
break; break;
} }

View File

@ -9,6 +9,7 @@
#include "textbox.h" #include "textbox.h"
#include "script.h" #include "script.h"
#include "utils.h" #include "utils.h"
#include "tiles.h"
void sub_08058ECC(ManagerF*); void sub_08058ECC(ManagerF*);
@ -335,7 +336,7 @@ void sub_0805930C(ManagerF* this) {
} }
void SetDirtTile(u32 tile) { void SetDirtTile(u32 tile) {
SetTileType(0x1d, tile, 1); SetTileType(CUT_GRASS, tile, 1);
SetTileType(0, tile, 2); SetTileType(0, tile, 2);
SetTileType(0, tile - 0x40, 2); SetTileType(0, tile - 0x40, 2);
} }

View File

@ -75,7 +75,7 @@ void ScriptCommand_WaitForPlayerAction0x17(Entity* entity, ScriptExecutionContex
void ScriptCommand_WaitFor_1(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_WaitFor_1(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_WaitFor_2(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_WaitFor_2(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_0807E788(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_SetFadeMask(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context);
void ScriptCommandNop2(Entity* entity, ScriptExecutionContext* context); void ScriptCommandNop2(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_DoFade4(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_DoFade4(Entity* entity, ScriptExecutionContext* context);
@ -220,7 +220,7 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop,
ScriptCommand_WaitFor_1, ScriptCommand_WaitFor_1,
ScriptCommand_WaitFor_2, ScriptCommand_WaitFor_2,
ScriptCommand_0807E778, ScriptCommand_0807E778,
ScriptCommand_0807E788, ScriptCommand_SetFadeMask,
ScriptCommand_0807E79C, ScriptCommand_0807E79C,
ScriptCommandNop2, ScriptCommandNop2,
ScriptCommand_DoFade4, ScriptCommand_DoFade4,
@ -1005,8 +1005,8 @@ void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context) {
gActiveScriptInfo.unk_08 = context->scriptInstructionPointer[1]; gActiveScriptInfo.unk_08 = context->scriptInstructionPointer[1];
} }
void ScriptCommand_0807E788(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_SetFadeMask(Entity* entity, ScriptExecutionContext* context) {
gFadeControl.field_0x4 = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); gFadeControl.mask = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
} }
void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context) {

View File

@ -6,5 +6,5 @@ extern u32 gUnk_020354C0;
void sub_08050008() { void sub_08050008() {
MemClear(&gUnk_020354C0, 128); MemClear(&gUnk_020354C0, 128);
gFadeControl.field_0x4 = -1; gFadeControl.mask = 0xFFFFFFFF;
} }

View File

@ -9,7 +9,7 @@ Entity* sub_0805E374(Entity* param_1) {
u8 r3 = gScreenTransition.field_0x24[8]; u8 r3 = gScreenTransition.field_0x24[8];
u8* array = gUnk_081091F8; u8* array = gUnk_081091F8;
if (r3 != '\x02') { if (r3 != 2) {
array = gUnk_081091EE; array = gUnk_081091EE;
} }
return sub_0805E3A0(param_1, array[param_1->kind]); return sub_0805E3A0(param_1, array[param_1->kind]);

View File

@ -9,46 +9,46 @@ void sub_0807B7D8(u32 param_1, u32 param_2, u32 param_3) {
sub_08000152(53); sub_08000152(53);
sub_0807B778(param_2, param_3); sub_0807B778(param_2, param_3);
sub_0807B778(param_2 + 1, param_3); sub_0807B778(param_2 + 1, param_3);
sub_0807B778(param_2 + -1, param_3); sub_0807B778(param_2 - 1, param_3);
sub_0807B778(param_2 + 64, param_3); sub_0807B778(param_2 + 64, param_3);
sub_0807B778(param_2 + -64, param_3); sub_0807B778(param_2 - 64, param_3);
} else { } else {
SetTileType(param_1, param_2, param_3); SetTileType(param_1, param_2, param_3);
} }
} }
void sub_0807B820(u32 param_1) { void sub_0807B820(u32 param_1) {
SetTileType(620, param_1 + -65, 1); SetTileType(620, param_1 - 65, 1);
SetTileType(627, param_1 + -65, 2); SetTileType(627, param_1 - 65, 2);
SetTileType(621, param_1 + -64, 1); SetTileType(621, param_1 - 64, 1);
SetTileType(628, param_1 + -64, 2); SetTileType(628, param_1 - 64, 2);
SetTileType(622, param_1 + -63, 1); SetTileType(622, param_1 - 63, 1);
SetTileType(629, param_1 + -63, 2); SetTileType(629, param_1 - 63, 2);
SetTileType(623, param_1 + -1, 1); SetTileType(623, param_1 - 1, 1);
SetTileType(624, param_1, 1); SetTileType(624, param_1, 1);
SetTileType(626, param_1 + 1, 1); SetTileType(626, param_1 + 1, 1);
} }
void sub_0807B8A8(u32 param_1) { void sub_0807B8A8(u32 param_1) {
SetTileType(636, param_1 + -65, 1); SetTileType(636, param_1 - 65, 1);
SetTileType(643, param_1 + -65, 2); SetTileType(643, param_1 - 65, 2);
SetTileType(637, param_1 + -64, 1); SetTileType(637, param_1 - 64, 1);
SetTileType(644, param_1 + -64, 2); SetTileType(644, param_1 - 64, 2);
SetTileType(638, param_1 + -63, 1); SetTileType(638, param_1 - 63, 1);
SetTileType(645, param_1 + -63, 2); SetTileType(645, param_1 - 63, 2);
SetTileType(639, param_1 + -1, 1); SetTileType(639, param_1 - 1, 1);
SetTileType(640, param_1, 1); SetTileType(640, param_1, 1);
SetTileType(642, param_1 + 1, 1); SetTileType(642, param_1 + 1, 1);
} }
void sub_0807B930(int param_1) { void sub_0807B930(int param_1) {
SetTileType(652, param_1 + -65, 1); SetTileType(652, param_1 - 65, 1);
SetTileType(659, param_1 + -65, 2); SetTileType(659, param_1 - 65, 2);
SetTileType(653, param_1 + -64, 1); SetTileType(653, param_1 - 64, 1);
SetTileType(660, param_1 + -64, 2); SetTileType(660, param_1 - 64, 2);
SetTileType(654, param_1 + -63, 1); SetTileType(654, param_1 - 63, 1);
SetTileType(661, param_1 + -63, 2); SetTileType(661, param_1 - 63, 2);
SetTileType(655, param_1 + -1, 1); SetTileType(655, param_1 - 1, 1);
SetTileType(656, param_1, 1); SetTileType(656, param_1, 1);
SetTileType(658, param_1 + 1, 1); SetTileType(658, param_1 + 1, 1);
} }

View File

@ -11,7 +11,7 @@ u32 sub_080A554C(u32 arg0) {
if (arg0 != 0) { if (arg0 != 0) {
for (i = 0; i < 17; i++) { for (i = 0; i < 17; i++) {
if (arg0 == (&gUnk_02000090)[i]) if (arg0 == gMenu.focusCoords[i])
return i; return i;
} }
} }

View File

@ -3,8 +3,5 @@
extern u8 gUnk_08127D30[69]; extern u8 gUnk_08127D30[69];
u32 sub_08052654(u32 r0) { u32 sub_08052654(u32 r0) {
// u32 r1 = gUnk_08127D30;
// u32 r1 = gUnk_08127D30;
return gUnk_08127D30[r0 * 4] == 129; return gUnk_08127D30[r0 * 4] == 129;
} }