mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-24 02:34:17 +01:00
GetWordPhonemes; assign names and improve guess of types
This commit is contained in:
parent
002b394855
commit
5da296e94e
@ -1,62 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_817C858
|
||||
sub_817C858: @ 817C858
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
adds r5, r0, 0
|
||||
lsls r1, 16
|
||||
lsrs r7, r1, 16
|
||||
movs r0, 0
|
||||
strh r0, [r5, 0x4]
|
||||
movs r6, 0
|
||||
ldr r0, =gUnknown_0860A3DC
|
||||
mov r8, r0
|
||||
adds r4, r5, 0
|
||||
adds r4, 0x18
|
||||
_0817C872:
|
||||
lsls r0, r6, 3
|
||||
ldr r1, [r5, 0x30]
|
||||
adds r2, r1, r0
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0xFF
|
||||
beq _0817C8A0
|
||||
movs r1, 0x1
|
||||
ldrsb r1, [r2, r1]
|
||||
lsls r0, 2
|
||||
add r0, r8
|
||||
ldr r0, [r0]
|
||||
adds r1, r0
|
||||
strh r1, [r4]
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x1E
|
||||
adds r1, r6, 0
|
||||
bl sub_817C7DC
|
||||
strh r0, [r4, 0x2]
|
||||
ldrh r0, [r4]
|
||||
ldrh r1, [r5, 0x4]
|
||||
adds r0, r1
|
||||
strh r0, [r5, 0x4]
|
||||
_0817C8A0:
|
||||
adds r4, 0x4
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x5
|
||||
ble _0817C872
|
||||
movs r0, 0
|
||||
strb r0, [r5, 0x1]
|
||||
strh r0, [r5, 0xA]
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_817C858
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -9335,8 +9335,8 @@ _0811EB0A:
|
||||
bx r1
|
||||
thumb_func_end sub_811EAA4
|
||||
|
||||
thumb_func_start sub_811EB10
|
||||
sub_811EB10: @ 811EB10
|
||||
thumb_func_start IsECWordInValidRange
|
||||
IsECWordInValidRange: @ 811EB10
|
||||
push {lr}
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 25
|
||||
@ -9380,7 +9380,7 @@ _0811EB5C:
|
||||
_0811EB5E:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_811EB10
|
||||
thumb_func_end IsECWordInValidRange
|
||||
|
||||
thumb_func_start GetEasyChatWord
|
||||
@ char *GetEasyChatWord(u8 groupId, u16 wordId)
|
||||
|
@ -883,7 +883,7 @@ _081207BC:
|
||||
adds r0, r1
|
||||
ldrh r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl sub_817C7F4
|
||||
bl GetWordSounds
|
||||
str r0, [r6, 0x30]
|
||||
movs r1, 0x3
|
||||
ands r1, r4
|
||||
@ -892,7 +892,7 @@ _081207BC:
|
||||
ands r4, r0
|
||||
adds r1, r4
|
||||
adds r0, r6, 0
|
||||
bl sub_817C858
|
||||
bl GetWordPhonemes
|
||||
ldrb r0, [r6]
|
||||
adds r0, 0x1
|
||||
strb r0, [r6]
|
||||
|
@ -8,7 +8,7 @@ gUnknown_085F5490:: @ 85F5490
|
||||
.4byte 0x19C
|
||||
|
||||
.align 2
|
||||
gUnknown_085F5494:: @ 85F5494
|
||||
gBardSounds_Pokemon:: @ 85F5494
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
@ -1251,7 +1251,7 @@ gUnknown_085FA1D4:: @ 85FA1D4
|
||||
.4byte 0x163
|
||||
|
||||
.align 2
|
||||
gUnknown_085FA1D8:: @ 85FA1D8
|
||||
gBardSounds_Moves:: @ 85FA1D8
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
@ -5397,7 +5397,7 @@ gUnknown_08609B38:: @ 8609B38
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
|
||||
.align 2
|
||||
gUnknown_0860A168:: @ 860A168
|
||||
gBardSoundsTable:: @ 860A168
|
||||
.4byte NULL
|
||||
.4byte gUnknown_085FE468
|
||||
.4byte gUnknown_085FE978
|
||||
@ -5566,7 +5566,7 @@ gUnknown_0860A320:: @ 860A320
|
||||
.4byte gUnknown_0860A30E
|
||||
|
||||
.align 2
|
||||
gUnknown_0860A3AC:: @ 860A3AC
|
||||
gBardSound_InvalidWord:: @ 860A3AC
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
.4byte 0x000000ff, 0x00000000, 0x000000ff, 0x00000000
|
||||
|
41
include/bard_music.h
Normal file
41
include/bard_music.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef GUARD_BARD_MUSIC_H
|
||||
#define GUARD_BARD_MUSIC_H
|
||||
|
||||
// Exported type declarations
|
||||
|
||||
|
||||
struct BardSound
|
||||
{
|
||||
/*0x00*/ u8 var00;
|
||||
/*0x01*/ s8 var01;
|
||||
/*0x02*/ u16 var02;
|
||||
/*0x04*/ u16 volume;
|
||||
/*0x06*/ u16 var06;
|
||||
};
|
||||
|
||||
struct BardPhoneme
|
||||
{
|
||||
/*0x00*/ u16 length;
|
||||
/*0x02*/ u16 pitch;
|
||||
};
|
||||
|
||||
struct BardSong
|
||||
{
|
||||
/*0x00*/ u8 currWord;
|
||||
/*0x01*/ u8 currPhoneme;
|
||||
/*0x02*/ u8 phonemeTimer;
|
||||
/*0x03*/ u8 state;
|
||||
/*0x04*/ s16 length;
|
||||
/*0x06*/ u16 volume;
|
||||
/*0x08*/ s16 pitch;
|
||||
/*0x0A*/ s16 voiceInflection;
|
||||
/*0x0C*/ u16 lyrics[6];
|
||||
/*0x18*/ struct BardPhoneme phonemes[6];
|
||||
/*0x30*/ const struct BardSound *sound;
|
||||
};
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
|
||||
#endif //GUARD_BARD_MUSIC_H
|
@ -34,6 +34,6 @@ void CopyEasyChatWord(u8 *dest, u16 word);
|
||||
bool32 sub_811F8D8(u16 word);
|
||||
void InitializeEasyChatWordArray(u16 *words, u16 length);
|
||||
void ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 length1, u16 length2);
|
||||
bool8 sub_811EB10(u16 word);
|
||||
bool8 IsECWordInValidRange(u16 word);
|
||||
|
||||
#endif // GUARD_EASYCHAT_H
|
||||
|
@ -227,7 +227,6 @@ SECTIONS {
|
||||
asm/intro_credits_graphics.o(.text);
|
||||
asm/evolution_graphics.o(.text);
|
||||
src/bard_music.o(.text);
|
||||
asm/bard_music.o(.text);
|
||||
asm/fldeff_teleport.o(.text);
|
||||
asm/battle_link_817C95C.o(.text);
|
||||
asm/pokemon_animation.o(.text);
|
||||
|
@ -1,42 +1,41 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "bard_music.h"
|
||||
#include "text.h"
|
||||
#include "easy_chat.h"
|
||||
|
||||
// Static type declarations
|
||||
|
||||
// Static RAM declarations
|
||||
|
||||
struct UnkStruct_817C7F4 {
|
||||
u8 unk_00[48];
|
||||
};
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
// .rodata
|
||||
|
||||
extern const struct UnkStruct_817C7F4 gUnknown_085F5494[];
|
||||
extern const struct UnkStruct_817C7F4 gUnknown_085FA1D8[];
|
||||
extern const struct UnkStruct_817C7F4 *const gUnknown_0860A168[];
|
||||
extern const struct BardSound gBardSounds_Pokemon[][6];
|
||||
extern const struct BardSound gBardSounds_Moves[][6];
|
||||
extern const struct BardSound (*const gBardSoundsTable[])[6];
|
||||
extern const s16 *const gUnknown_0860A320[];
|
||||
extern const struct UnkStruct_817C7F4 gUnknown_0860A3AC;
|
||||
extern const int gUnknown_0860A3DC[];
|
||||
extern const struct BardSound gBardSound_InvalidWord[6];
|
||||
|
||||
// .text
|
||||
|
||||
s16 sub_817C7DC(int x, int y)
|
||||
s16 CalcWordPitch(int arg0, int songPos)
|
||||
{
|
||||
return gUnknown_0860A320[x][y];
|
||||
return gUnknown_0860A320[arg0][songPos];
|
||||
}
|
||||
|
||||
const struct UnkStruct_817C7F4 *sub_817C7F4(u16 word)
|
||||
const struct BardSound *GetWordSounds(u16 word)
|
||||
{
|
||||
u32 category;
|
||||
u32 subword;
|
||||
const struct UnkStruct_817C7F4 *ptr;
|
||||
const struct BardSound (*ptr)[6];
|
||||
|
||||
if (sub_811EB10(word))
|
||||
if (IsECWordInValidRange(word))
|
||||
{
|
||||
return &gUnknown_0860A3AC;
|
||||
return gBardSound_InvalidWord;
|
||||
}
|
||||
category = word >> 9;
|
||||
subword = word & 0x1ff;
|
||||
@ -44,18 +43,36 @@ const struct UnkStruct_817C7F4 *sub_817C7F4(u16 word)
|
||||
{
|
||||
case EC_GROUP_POKEMON:
|
||||
case EC_GROUP_POKEMON_2:
|
||||
ptr = gUnknown_085F5494;
|
||||
ptr = gBardSounds_Pokemon;
|
||||
break;
|
||||
case EC_GROUP_MOVE_1:
|
||||
case EC_GROUP_MOVE_2:
|
||||
ptr = gUnknown_085FA1D8;
|
||||
ptr = gBardSounds_Moves;
|
||||
break;
|
||||
default:
|
||||
ptr = gUnknown_0860A168[category];
|
||||
ptr = gBardSoundsTable[category];
|
||||
break;
|
||||
}
|
||||
ptr += subword;
|
||||
return ptr;
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void GetWordPhonemes(struct BardSong *song, u16 word)
|
||||
{
|
||||
int i;
|
||||
const struct BardSound *sound;
|
||||
|
||||
song->length = 0;
|
||||
for (i = 0; i < 6; i ++)
|
||||
{
|
||||
sound = &song->sound[i];
|
||||
if (sound->var00 != 0xFF)
|
||||
{
|
||||
song->phonemes[i].length = sound->var01 + gUnknown_0860A3DC[sound->var00];
|
||||
song->phonemes[i].pitch = CalcWordPitch(word + 30, i);
|
||||
song->length += song->phonemes[i].length;
|
||||
}
|
||||
}
|
||||
song->currPhoneme = 0;
|
||||
song->voiceInflection = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user