Decompile move tutor stuff

2 nonmatching.
This commit is contained in:
Phlosioneer 2019-03-08 01:56:38 -05:00
parent aa7657a82a
commit 69aec91577
9 changed files with 556 additions and 513 deletions

View File

@ -6,506 +6,6 @@
.text .text
thumb_func_start InitMoveRelearnerWindows
InitMoveRelearnerWindows: @ 81D2824
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gMoveRelearnerWindowTemplates
bl InitWindows
bl DeactivateAllTextPrinters
movs r0, 0
movs r1, 0x1
movs r2, 0xE0
bl LoadUserWindowBorderGfx
ldr r0, =gUnknown_0860F074
movs r1, 0xF0
movs r2, 0x20
bl LoadPalette
movs r4, 0
_081D284A:
adds r0, r4, 0
movs r1, 0x11
bl FillWindowPixelBuffer
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x4
bls _081D284A
cmp r5, 0
bne _081D287C
movs r0, 0
bl PutWindowTilemap
movs r0, 0
movs r1, 0
movs r2, 0x1
movs r3, 0xE
bl SetWindowBorderStyle
b _081D288E
.pool
_081D287C:
movs r0, 0x1
bl PutWindowTilemap
movs r0, 0x1
movs r1, 0
movs r2, 0x1
movs r3, 0xE
bl SetWindowBorderStyle
_081D288E:
movs r0, 0x2
bl PutWindowTilemap
movs r0, 0x3
bl PutWindowTilemap
movs r0, 0x2
movs r1, 0
movs r2, 0x1
movs r3, 0xE
bl SetWindowBorderStyle
movs r0, 0x3
movs r1, 0
movs r2, 0x1
movs r3, 0xE
bl SetWindowBorderStyle
bl nullsub_79
movs r0, 0x1
bl schedule_bg_copy_tilemap_to_vram
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end InitMoveRelearnerWindows
thumb_func_start nullsub_79
nullsub_79: @ 81D28C4
bx lr
thumb_func_end nullsub_79
thumb_func_start LoadMoveRelearnerMovesList
LoadMoveRelearnerMovesList: @ 81D28C8
push {r4-r7,lr}
lsls r1, 16
lsrs r4, r1, 16
ldr r3, =gMultiuseListMenuTemplate
adds r2, r3, 0
ldr r1, =gMoveRelearnerMovesListTemplate
ldm r1!, {r5-r7}
stm r2!, {r5-r7}
ldm r1!, {r5-r7}
stm r2!, {r5-r7}
strh r4, [r3, 0xC]
str r0, [r3]
cmp r4, 0x5
bhi _081D28F0
strh r4, [r3, 0xE]
b _081D28F4
.pool
_081D28F0:
movs r0, 0x6
strh r0, [r3, 0xE]
_081D28F4:
ldrb r0, [r3, 0xE]
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end LoadMoveRelearnerMovesList
thumb_func_start MoveRelearnerLoadBattleMoveDescription
MoveRelearnerLoadBattleMoveDescription: @ 81D28FC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x2C
mov r9, r0
movs r0, 0
movs r1, 0x11
bl FillWindowPixelBuffer
ldr r5, =gText_BattleMoves2
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x80
bl GetStringCenterAlignXOffset
adds r4, r0, 0
lsls r3, r4, 24
lsrs r3, 24
movs r0, 0x1
str r0, [sp]
movs r0, 0xFF
mov r8, r0
str r0, [sp, 0x4]
movs r7, 0
str r7, [sp, 0x8]
movs r0, 0
movs r1, 0x1
adds r2, r5, 0
bl AddTextPrinterParameterized
ldr r5, =gText_PPSlash
movs r1, 0x29
mov r10, r1
str r1, [sp]
mov r0, r8
str r0, [sp, 0x4]
str r7, [sp, 0x8]
movs r0, 0
movs r1, 0x1
adds r2, r5, 0
movs r3, 0x4
bl AddTextPrinterParameterized
ldr r5, =gText_PowerSlash
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x6A
bl GetStringRightAlignXOffset
adds r4, r0, 0
lsls r3, r4, 24
lsrs r3, 24
movs r1, 0x19
str r1, [sp]
mov r0, r8
str r0, [sp, 0x4]
str r7, [sp, 0x8]
movs r0, 0
movs r1, 0x1
adds r2, r5, 0
bl AddTextPrinterParameterized
ldr r5, =gText_AccuracySlash
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x6A
bl GetStringRightAlignXOffset
adds r4, r0, 0
lsls r3, r4, 24
lsrs r3, 24
mov r1, r10
str r1, [sp]
mov r0, r8
str r0, [sp, 0x4]
str r7, [sp, 0x8]
movs r0, 0
movs r1, 0x1
adds r2, r5, 0
bl AddTextPrinterParameterized
movs r0, 0x2
negs r0, r0
cmp r9, r0
bne _081D29C4
movs r0, 0
movs r1, 0x2
bl CopyWindowToVram
b _081D2AB6
.pool
_081D29C4:
mov r1, r9
lsls r0, r1, 1
add r0, r9
lsls r0, 2
ldr r1, =gBattleMoves
adds r6, r0, r1
ldrb r1, [r6, 0x2]
lsls r0, r1, 3
subs r0, r1
ldr r1, =gTypeNames
adds r5, r0, r1
movs r0, 0x19
str r0, [sp]
mov r1, r8
str r1, [sp, 0x4]
str r7, [sp, 0x8]
movs r0, 0
movs r1, 0x1
adds r2, r5, 0
movs r3, 0x4
bl AddTextPrinterParameterized
ldr r1, =gText_PPSlash
movs r0, 0x1
movs r2, 0
bl GetStringWidth
adds r4, r0, 0x4
ldrb r1, [r6, 0x4]
add r0, sp, 0xC
movs r2, 0
movs r3, 0x2
bl ConvertIntToDecimalStringN
lsls r3, r4, 24
lsrs r3, 24
mov r0, r10
str r0, [sp]
mov r1, r8
str r1, [sp, 0x4]
str r7, [sp, 0x8]
movs r0, 0
movs r1, 0x1
add r2, sp, 0xC
bl AddTextPrinterParameterized
ldrb r0, [r6, 0x1]
cmp r0, 0x1
bhi _081D2A3C
ldr r5, =gText_ThreeDashes
b _081D2A4A
.pool
_081D2A3C:
ldrb r1, [r6, 0x1]
add r0, sp, 0xC
movs r2, 0
movs r3, 0x3
bl ConvertIntToDecimalStringN
add r5, sp, 0xC
_081D2A4A:
movs r0, 0x19
str r0, [sp]
movs r0, 0xFF
str r0, [sp, 0x4]
movs r0, 0
str r0, [sp, 0x8]
movs r1, 0x1
adds r2, r5, 0
movs r3, 0x6A
bl AddTextPrinterParameterized
ldrb r0, [r6, 0x3]
cmp r0, 0
bne _081D2A70
ldr r5, =gText_ThreeDashes
b _081D2A7E
.pool
_081D2A70:
ldrb r1, [r6, 0x3]
add r0, sp, 0xC
movs r2, 0
movs r3, 0x3
bl ConvertIntToDecimalStringN
add r5, sp, 0xC
_081D2A7E:
movs r0, 0x29
str r0, [sp]
movs r0, 0xFF
str r0, [sp, 0x4]
movs r4, 0
str r4, [sp, 0x8]
movs r0, 0
movs r1, 0x1
adds r2, r5, 0
movs r3, 0x6A
bl AddTextPrinterParameterized
ldr r1, =gMoveDescriptionPointers
mov r0, r9
subs r0, 0x1
lsls r0, 2
adds r0, r1
ldr r5, [r0]
movs r0, 0x41
str r0, [sp]
str r4, [sp, 0x4]
str r4, [sp, 0x8]
movs r0, 0
movs r1, 0x7
adds r2, r5, 0
movs r3, 0
bl AddTextPrinterParameterized
_081D2AB6:
add sp, 0x2C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end MoveRelearnerLoadBattleMoveDescription
thumb_func_start MoveRelearnerMenuLoadContestMoveDescription
MoveRelearnerMenuLoadContestMoveDescription: @ 81D2ACC
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0xC
adds r4, r0, 0
bl MoveRelearnerShowHideHearts
movs r0, 0x1
movs r1, 0x11
bl FillWindowPixelBuffer
ldr r5, =gText_ContestMoves2
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x80
bl GetStringCenterAlignXOffset
lsls r3, r0, 24
lsrs r3, 24
movs r0, 0x1
str r0, [sp]
movs r7, 0xFF
str r7, [sp, 0x4]
movs r6, 0
str r6, [sp, 0x8]
movs r1, 0x1
adds r2, r5, 0
bl AddTextPrinterParameterized
ldr r5, =gText_Appeal2
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x5C
bl GetStringRightAlignXOffset
lsls r3, r0, 24
lsrs r3, 24
movs r0, 0x19
mov r8, r0
str r0, [sp]
str r7, [sp, 0x4]
str r6, [sp, 0x8]
movs r0, 0x1
movs r1, 0x1
adds r2, r5, 0
bl AddTextPrinterParameterized
ldr r5, =gText_Jam2
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x5C
bl GetStringRightAlignXOffset
lsls r3, r0, 24
lsrs r3, 24
movs r0, 0x29
str r0, [sp]
str r7, [sp, 0x4]
str r6, [sp, 0x8]
movs r0, 0x1
movs r1, 0x1
adds r2, r5, 0
bl AddTextPrinterParameterized
movs r0, 0x2
negs r0, r0
cmp r4, r0
bne _081D2B6C
movs r0, 0x1
movs r1, 0x2
bl CopyWindowToVram
b _081D2BB8
.pool
_081D2B6C:
lsls r4, 3
ldr r0, =gContestMoves
adds r4, r0
ldr r1, =gContestMoveTypeTextPointers
ldrb r0, [r4, 0x1]
lsls r0, 29
lsrs r0, 27
adds r0, r1
ldr r5, [r0]
mov r0, r8
str r0, [sp]
str r7, [sp, 0x4]
str r6, [sp, 0x8]
movs r0, 0x1
movs r1, 0x1
adds r2, r5, 0
movs r3, 0x4
bl AddTextPrinterParameterized
ldr r1, =gContestEffectDescriptionPointers
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
ldr r5, [r0]
movs r0, 0x41
str r0, [sp]
str r7, [sp, 0x4]
str r6, [sp, 0x8]
movs r0, 0x1
movs r1, 0x7
adds r2, r5, 0
movs r3, 0
bl AddTextPrinterParameterized
movs r0, 0x1
movs r1, 0x2
bl CopyWindowToVram
_081D2BB8:
add sp, 0xC
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end MoveRelearnerMenuLoadContestMoveDescription
thumb_func_start MoveRelearnerCursorCallback
MoveRelearnerCursorCallback: @ 81D2BD0
push {r4,lr}
adds r4, r0, 0
lsls r1, 24
lsrs r1, 24
cmp r1, 0x1
beq _081D2BE2
movs r0, 0x5
bl PlaySE
_081D2BE2:
adds r0, r4, 0
bl MoveRelearnerLoadBattleMoveDescription
adds r0, r4, 0
bl MoveRelearnerMenuLoadContestMoveDescription
pop {r4}
pop {r0}
bx r0
thumb_func_end MoveRelearnerCursorCallback
thumb_func_start MoveRelearnerPrintText
MoveRelearnerPrintText: @ 81D2BF4
push {r4,lr}
sub sp, 0x10
adds r4, r0, 0
movs r0, 0x3
movs r1, 0x11
bl FillWindowPixelBuffer
ldr r2, =gTextFlags
ldrb r0, [r2]
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl GetPlayerTextSpeedDelay
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
movs r0, 0
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r0, 0x1
str r0, [sp, 0x8]
movs r0, 0x3
str r0, [sp, 0xC]
movs r1, 0x1
adds r2, r4, 0
bl AddTextPrinterParameterized2
add sp, 0x10
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end MoveRelearnerPrintText
thumb_func_start MoveRelearnerRunTextPrinters
MoveRelearnerRunTextPrinters: @ 81D2C3C
push {lr}
bl RunTextPrinters
movs r0, 0x3
bl IsTextPrinterActive
lsls r0, 16
lsrs r0, 16
pop {r1}
bx r1
thumb_func_end MoveRelearnerRunTextPrinters
thumb_func_start MoveRelearnerCreateYesNoMenu
MoveRelearnerCreateYesNoMenu: @ 81D2C50
push {lr}
ldr r0, =gMoveRelearnerYesNoMenuTemplate
movs r1, 0x1
movs r2, 0xE
movs r3, 0
bl CreateYesNoMenu
pop {r0}
bx r0
.pool
thumb_func_end MoveRelearnerCreateYesNoMenu
thumb_func_start sub_81D2C68 thumb_func_start sub_81D2C68
sub_81D2C68: @ 81D2C68 sub_81D2C68: @ 81D2C68
push {lr} push {lr}

View File

@ -19,6 +19,7 @@ struct ContestEffect
extern const struct ContestMove gContestMoves[]; extern const struct ContestMove gContestMoves[];
extern const struct ContestEffect gContestEffects[]; extern const struct ContestEffect gContestEffects[];
extern const u8 *const gContestEffectDescriptionPointers[]; extern const u8 *const gContestEffectDescriptionPointers[];
extern const u8 *const gContestMoveTypeTextPointers[];
bool8 AreMovesContestCombo(u16 lastMove, u16 nextMove); bool8 AreMovesContestCombo(u16 lastMove, u16 nextMove);

View File

@ -2,6 +2,7 @@
#define GUARD_MENU_UNKNOWN_H #define GUARD_MENU_UNKNOWN_H
#include "player_pc.h" #include "player_pc.h"
#include "list_menu.h"
struct UnknownSubStruct_81D1ED4 struct UnknownSubStruct_81D1ED4
{ {
@ -41,5 +42,10 @@ void sub_81D3464(void *arg0);
void sub_81D3480(void *arg0, u8 arg1); void sub_81D3480(void *arg0, u8 arg1);
void sub_81D2754(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1); void sub_81D2754(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1);
void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 arg1[4][5], struct UnknownSubStruct_81D1ED4 arg2[4][5]); void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 arg1[4][5], struct UnknownSubStruct_81D1ED4 arg2[4][5]);
void MoveRelearnerPrintText(u8 *text);
bool16 MoveRelearnerRunTextPrinters(void);
void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow);
#endif // GUARD_MENU_UNKNOWN_H #endif // GUARD_MENU_UNKNOWN_H

View File

@ -1,7 +1,10 @@
#ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H
#define GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H
#include "main.h"
extern u8 gLastViewedMonIndex; extern u8 gLastViewedMonIndex;
extern const u8 *const gMoveDescriptionPointers[];
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
void sub_81C4F98(u8, void(*)(void)); void sub_81C4F98(u8, void(*)(void));

View File

@ -4,11 +4,6 @@
bool8 sub_81D312C(void *arg0); bool8 sub_81D312C(void *arg0);
bool8 sub_81D4A58(struct EventObject*); bool8 sub_81D4A58(struct EventObject*);
void MoveRelearnerPrintText(u8 *);
u16 MoveRelearnerRunTextPrinters(void);
void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow);
bool8 EventObjectIsFarawayIslandMew(struct EventObject *); bool8 EventObjectIsFarawayIslandMew(struct EventObject *);
u32 sub_81D427C(void); u32 sub_81D427C(void);
void sub_81D4998(void); void sub_81D4998(void);

View File

@ -868,6 +868,13 @@ extern const u8 gText_MoveRelearnerPkmnForgotMoveAndLearnedNew[];
extern const u8 gText_TeachWhichMoveToPkmn[]; extern const u8 gText_TeachWhichMoveToPkmn[];
extern const u8 gText_MoveRelearnerGiveUp[]; extern const u8 gText_MoveRelearnerGiveUp[];
extern const u8 gText_MoveRelearnerTeachMoveConfirm[]; extern const u8 gText_MoveRelearnerTeachMoveConfirm[];
extern const u8 gText_MoveRelearnerBattleMoves[];
extern const u8 gText_MoveRelearnerPP[];
extern const u8 gText_MoveRelearnerPower[];
extern const u8 gText_MoveRelearnerAccuracy[];
extern const u8 gText_MoveRelearnerContestMovesTitle[];
extern const u8 gText_MoveRelearnerAppeal[];
extern const u8 gText_MoveRelearnerJam[];
extern const u8 gText_Kira[]; extern const u8 gText_Kira[];
extern const u8 gText_Amy[]; extern const u8 gText_Amy[];

View File

@ -1,14 +1,21 @@
#include "global.h" #include "global.h"
#include "alloc.h" #include "alloc.h"
#include "battle_main.h"
#include "contest_effect.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "menu.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "menu.h" #include "menu.h"
#include "menu_unknown.h" #include "menu_unknown.h"
#include "move_relearner.h"
#include "palette.h"
#include "player_pc.h" #include "player_pc.h"
#include "pokemon_summary_screen.h"
#include "scanline_effect.h" #include "scanline_effect.h"
#include "sound.h" #include "sound.h"
#include "strings.h" #include "strings.h"
#include "string_util.h" #include "string_util.h"
#include "text_window.h"
#include "trig.h" #include "trig.h"
#include "window.h" #include "window.h"
#include "constants/songs.h" #include "constants/songs.h"
@ -25,6 +32,7 @@ void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list);
void sub_81D24A4(struct UnknownStruct_81D1ED4 *a0); void sub_81D24A4(struct UnknownStruct_81D1ED4 *a0);
void sub_81D2634(struct UnknownStruct_81D1ED4 *a0); void sub_81D2634(struct UnknownStruct_81D1ED4 *a0);
void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list); void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list);
extern void nullsub_79(void);
static const struct WindowTemplate sUnknown_086253E8[] = static const struct WindowTemplate sUnknown_086253E8[] =
{ {
@ -1585,4 +1593,527 @@ _081D2800:\n\
.pool\n\ .pool\n\
.syntax divided"); .syntax divided");
#endif #endif
}
void InitMoveRelearnerWindows(bool8 useContextWindow)
{
u8 i;
InitWindows(gMoveRelearnerWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < 5; i++)
{
FillWindowPixelBuffer(i, 0x11);
}
if (!useContextWindow)
{
PutWindowTilemap(0);
SetWindowBorderStyle(0, 0, 0x1, 0xE);
}
else
{
PutWindowTilemap(1);
SetWindowBorderStyle(1, 0, 1, 0xE);
}
PutWindowTilemap(2);
PutWindowTilemap(3);
SetWindowBorderStyle(2, 0, 1, 0xE);
SetWindowBorderStyle(3, 0, 1, 0xE);
nullsub_79();
schedule_bg_copy_tilemap_to_vram(1);
}
void nullsub_79(void)
{
}
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices)
{
gMultiuseListMenuTemplate = gMoveRelearnerMovesListTemplate;
gMultiuseListMenuTemplate.totalItems = numChoices;
gMultiuseListMenuTemplate.items = items;
if (numChoices < 6)
{
gMultiuseListMenuTemplate.maxShowed = numChoices;
}
else
{
gMultiuseListMenuTemplate.maxShowed = 6;
}
return gMultiuseListMenuTemplate.maxShowed;
}
NAKED
void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
{
// Two small issues, and a few renamed registers.
#ifdef NONMATCHING
u8 offset;
s32 width;
const struct BattleMove *move;
u8 buffer[0x20];
const u8 *labelStr;
FillWindowPixelBuffer(0, 0x11);
labelStr = gText_MoveRelearnerBattleMoves;
offset = GetStringCenterAlignXOffset(1, labelStr, 0x80);
AddTextPrinterParameterized(0, 1, labelStr, offset, 1, TEXT_SPEED_FF, NULL);
labelStr = gText_MoveRelearnerPP;
AddTextPrinterParameterized(0, 1, labelStr, 4, 0x29, TEXT_SPEED_FF, NULL);
labelStr = gText_MoveRelearnerPower;
offset = GetStringRightAlignXOffset(1, labelStr, 0x6A);
AddTextPrinterParameterized(0, 1, labelStr, offset, 0x19, TEXT_SPEED_FF, NULL);
labelStr = gText_MoveRelearnerAccuracy;
offset = GetStringRightAlignXOffset(1, labelStr, 0x6A);
AddTextPrinterParameterized(0, 1, labelStr, offset, 0x29, TEXT_SPEED_FF, NULL);
if (chosenMove == LIST_CANCEL)
{
CopyWindowToVram(0, 2);
return;
}
move = &gBattleMoves[chosenMove];
labelStr = gTypeNames[move->type];
// GCC tries to be smart, and preserves the same 0x19 from above for this.
// The original asm just loads the constant 0x19 twice.
AddTextPrinterParameterized(0, 1, labelStr, 4, 0x19, TEXT_SPEED_FF, NULL);
// GCC tries to generate this as:
// add r4, r0, 0
// add r4, r4, 4
// But the original asm is:
// add r4, r0, 4
width = 4 + GetStringWidth(1, gText_MoveRelearnerPP, 0);
ConvertIntToDecimalStringN(buffer, move->pp, 0, 2);
AddTextPrinterParameterized(0, 1, buffer, width, 0x29, TEXT_SPEED_FF, NULL);
if (move->power < 2)
{
labelStr = gText_ThreeDashes;
}
else
{
ConvertIntToDecimalStringN(buffer, move->power, 0, 3);
labelStr = buffer;
}
AddTextPrinterParameterized(0, 1, labelStr, 0x6A, 0x19, TEXT_SPEED_FF, NULL);
if (move->accuracy == 0)
{
labelStr = gText_ThreeDashes;
}
else
{
ConvertIntToDecimalStringN(buffer, move->accuracy, 0, 3);
labelStr = buffer;
}
AddTextPrinterParameterized(0, 1, labelStr, 0x6A, 0x29, TEXT_SPEED_FF, NULL);
labelStr = gMoveDescriptionPointers[chosenMove - 1];
AddTextPrinterParameterized(0, 7, labelStr, 0, 0x41, 0, NULL);
#else
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x2C\n\
mov r9, r0\n\
movs r0, 0\n\
movs r1, 0x11\n\
bl FillWindowPixelBuffer\n\
ldr r5, =gText_MoveRelearnerBattleMoves\n\
movs r0, 0x1\n\
adds r1, r5, 0\n\
movs r2, 0x80\n\
bl GetStringCenterAlignXOffset\n\
adds r4, r0, 0\n\
lsls r3, r4, 24\n\
lsrs r3, 24\n\
movs r0, 0x1\n\
str r0, [sp]\n\
movs r0, 0xFF\n\
mov r8, r0\n\
str r0, [sp, 0x4]\n\
movs r7, 0\n\
str r7, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
bl AddTextPrinterParameterized\n\
ldr r5, =gText_MoveRelearnerPP\n\
movs r1, 0x29\n\
mov r10, r1\n\
str r1, [sp]\n\
mov r0, r8\n\
str r0, [sp, 0x4]\n\
str r7, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
movs r3, 0x4\n\
bl AddTextPrinterParameterized\n\
ldr r5, =gText_MoveRelearnerPower\n\
movs r0, 0x1\n\
adds r1, r5, 0\n\
movs r2, 0x6A\n\
bl GetStringRightAlignXOffset\n\
adds r4, r0, 0\n\
lsls r3, r4, 24\n\
lsrs r3, 24\n\
movs r1, 0x19\n\
str r1, [sp]\n\
mov r0, r8\n\
str r0, [sp, 0x4]\n\
str r7, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
bl AddTextPrinterParameterized\n\
ldr r5, =gText_MoveRelearnerAccuracy\n\
movs r0, 0x1\n\
adds r1, r5, 0\n\
movs r2, 0x6A\n\
bl GetStringRightAlignXOffset\n\
adds r4, r0, 0\n\
lsls r3, r4, 24\n\
lsrs r3, 24\n\
mov r1, r10\n\
str r1, [sp]\n\
mov r0, r8\n\
str r0, [sp, 0x4]\n\
str r7, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
bl AddTextPrinterParameterized\n\
movs r0, 0x2\n\
negs r0, r0\n\
cmp r9, r0\n\
bne _081D29C4\n\
movs r0, 0\n\
movs r1, 0x2\n\
bl CopyWindowToVram\n\
b _081D2AB6\n\
.pool\n\
_081D29C4:\n\
mov r1, r9\n\
lsls r0, r1, 1\n\
add r0, r9\n\
lsls r0, 2\n\
ldr r1, =gBattleMoves\n\
adds r6, r0, r1\n\
ldrb r1, [r6, 0x2]\n\
lsls r0, r1, 3\n\
subs r0, r1\n\
ldr r1, =gTypeNames\n\
adds r5, r0, r1\n\
movs r0, 0x19\n\
str r0, [sp]\n\
mov r1, r8\n\
str r1, [sp, 0x4]\n\
str r7, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
movs r3, 0x4\n\
bl AddTextPrinterParameterized\n\
ldr r1, =gText_MoveRelearnerPP\n\
movs r0, 0x1\n\
movs r2, 0\n\
bl GetStringWidth\n\
adds r4, r0, 0x4\n\
ldrb r1, [r6, 0x4]\n\
add r0, sp, 0xC\n\
movs r2, 0\n\
movs r3, 0x2\n\
bl ConvertIntToDecimalStringN\n\
lsls r3, r4, 24\n\
lsrs r3, 24\n\
mov r0, r10\n\
str r0, [sp]\n\
mov r1, r8\n\
str r1, [sp, 0x4]\n\
str r7, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
add r2, sp, 0xC\n\
bl AddTextPrinterParameterized\n\
ldrb r0, [r6, 0x1]\n\
cmp r0, 0x1\n\
bhi _081D2A3C\n\
ldr r5, =gText_ThreeDashes\n\
b _081D2A4A\n\
.pool\n\
_081D2A3C:\n\
ldrb r1, [r6, 0x1]\n\
add r0, sp, 0xC\n\
movs r2, 0\n\
movs r3, 0x3\n\
bl ConvertIntToDecimalStringN\n\
add r5, sp, 0xC\n\
_081D2A4A:\n\
movs r0, 0x19\n\
str r0, [sp]\n\
movs r0, 0xFF\n\
str r0, [sp, 0x4]\n\
movs r0, 0\n\
str r0, [sp, 0x8]\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
movs r3, 0x6A\n\
bl AddTextPrinterParameterized\n\
ldrb r0, [r6, 0x3]\n\
cmp r0, 0\n\
bne _081D2A70\n\
ldr r5, =gText_ThreeDashes\n\
b _081D2A7E\n\
.pool\n\
_081D2A70:\n\
ldrb r1, [r6, 0x3]\n\
add r0, sp, 0xC\n\
movs r2, 0\n\
movs r3, 0x3\n\
bl ConvertIntToDecimalStringN\n\
add r5, sp, 0xC\n\
_081D2A7E:\n\
movs r0, 0x29\n\
str r0, [sp]\n\
movs r0, 0xFF\n\
str r0, [sp, 0x4]\n\
movs r4, 0\n\
str r4, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
movs r3, 0x6A\n\
bl AddTextPrinterParameterized\n\
ldr r1, =gMoveDescriptionPointers\n\
mov r0, r9\n\
subs r0, 0x1\n\
lsls r0, 2\n\
adds r0, r1\n\
ldr r5, [r0]\n\
movs r0, 0x41\n\
str r0, [sp]\n\
str r4, [sp, 0x4]\n\
str r4, [sp, 0x8]\n\
movs r0, 0\n\
movs r1, 0x7\n\
adds r2, r5, 0\n\
movs r3, 0\n\
bl AddTextPrinterParameterized\n\
_081D2AB6:\n\
add sp, 0x2C\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
#endif
}
NAKED
void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
{
#ifdef NONMATCHING
//u8 offset;
const u8 *labelStr;
const struct ContestMove *move;
u8 category;
const u8 **temp;
MoveRelearnerShowHideHearts(chosenMove);
FillWindowPixelBuffer(1, 0x11);
labelStr = gText_MoveRelearnerContestMovesTitle;
// GCC compiles these as:
// add r3, r0, 0
// lsls r3, r3, 24
// lsrs r3, r3, 24
// But in the original asm:
// lsls r3, r0, 24
// lsrs r3, r3, 24
//offset = GetStringCenterAlignXOffset(1, labelStr, 0x80);
AddTextPrinterParameterized(1, 1, labelStr, GetStringCenterAlignXOffset(1, labelStr, 0x80), 1, TEXT_SPEED_FF, NULL);
labelStr = gText_MoveRelearnerAppeal;
//offset = GetStringRightAlignXOffset(1, labelStr, 0x5C);
AddTextPrinterParameterized(1, 1, labelStr, GetStringCenterAlignXOffset(1, labelStr, 0x5C), 0x19, TEXT_SPEED_FF, NULL);
labelStr = gText_MoveRelearnerJam;
//offset = GetStringRightAlignXOffset(1, labelStr, 0x5C);
AddTextPrinterParameterized(1, 1, labelStr, GetStringCenterAlignXOffset(1, labelStr, 0x5C), 0x29, TEXT_SPEED_FF, NULL);
if (chosenMove == MENU_NOTHING_CHOSEN)
{
CopyWindowToVram(1, 2);
return;
}
move = &gContestMoves[chosenMove];
temp = (const u8**)gContestMoveTypeTextPointers;
category = move->contestCategory;
labelStr = temp[category];
AddTextPrinterParameterized(1, 1, labelStr, 4, 0x19, TEXT_SPEED_FF, NULL);
labelStr = gContestEffectDescriptionPointers[move->effect];
AddTextPrinterParameterized(1, 1, labelStr, 0, 0x41, TEXT_SPEED_FF, NULL);
CopyWindowToVram(1, 2);
#else
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r8\n\
push {r7}\n\
sub sp, 0xC\n\
adds r4, r0, 0\n\
bl MoveRelearnerShowHideHearts\n\
movs r0, 0x1\n\
movs r1, 0x11\n\
bl FillWindowPixelBuffer\n\
ldr r5, =gText_MoveRelearnerContestMovesTitle\n\
movs r0, 0x1\n\
adds r1, r5, 0\n\
movs r2, 0x80\n\
bl GetStringCenterAlignXOffset\n\
lsls r3, r0, 24\n\
lsrs r3, 24\n\
movs r0, 0x1\n\
str r0, [sp]\n\
movs r7, 0xFF\n\
str r7, [sp, 0x4]\n\
movs r6, 0\n\
str r6, [sp, 0x8]\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
bl AddTextPrinterParameterized\n\
ldr r5, =gText_MoveRelearnerAppeal\n\
movs r0, 0x1\n\
adds r1, r5, 0\n\
movs r2, 0x5C\n\
bl GetStringRightAlignXOffset\n\
lsls r3, r0, 24\n\
lsrs r3, 24\n\
movs r0, 0x19\n\
mov r8, r0\n\
str r0, [sp]\n\
str r7, [sp, 0x4]\n\
str r6, [sp, 0x8]\n\
movs r0, 0x1\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
bl AddTextPrinterParameterized\n\
ldr r5, =gText_MoveRelearnerJam\n\
movs r0, 0x1\n\
adds r1, r5, 0\n\
movs r2, 0x5C\n\
bl GetStringRightAlignXOffset\n\
lsls r3, r0, 24\n\
lsrs r3, 24\n\
movs r0, 0x29\n\
str r0, [sp]\n\
str r7, [sp, 0x4]\n\
str r6, [sp, 0x8]\n\
movs r0, 0x1\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
bl AddTextPrinterParameterized\n\
movs r0, 0x2\n\
negs r0, r0\n\
cmp r4, r0\n\
bne _081D2B6C\n\
movs r0, 0x1\n\
movs r1, 0x2\n\
bl CopyWindowToVram\n\
b _081D2BB8\n\
.pool\n\
_081D2B6C:\n\
lsls r4, 3\n\
ldr r0, =gContestMoves\n\
adds r4, r0\n\
ldr r1, =gContestMoveTypeTextPointers\n\
ldrb r0, [r4, 0x1]\n\
lsls r0, 29\n\
lsrs r0, 27\n\
adds r0, r1\n\
ldr r5, [r0]\n\
mov r0, r8\n\
str r0, [sp]\n\
str r7, [sp, 0x4]\n\
str r6, [sp, 0x8]\n\
movs r0, 0x1\n\
movs r1, 0x1\n\
adds r2, r5, 0\n\
movs r3, 0x4\n\
bl AddTextPrinterParameterized\n\
ldr r1, =gContestEffectDescriptionPointers\n\
ldrb r0, [r4]\n\
lsls r0, 2\n\
adds r0, r1\n\
ldr r5, [r0]\n\
movs r0, 0x41\n\
str r0, [sp]\n\
str r7, [sp, 0x4]\n\
str r6, [sp, 0x8]\n\
movs r0, 0x1\n\
movs r1, 0x7\n\
adds r2, r5, 0\n\
movs r3, 0\n\
bl AddTextPrinterParameterized\n\
movs r0, 0x1\n\
movs r1, 0x2\n\
bl CopyWindowToVram\n\
_081D2BB8:\n\
add sp, 0xC\n\
pop {r3}\n\
mov r8, r3\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
#endif
}
void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list)
{
if (onInit != TRUE)
PlaySE(SE_SELECT);
MoveRelearnerLoadBattleMoveDescription(itemIndex);
MoveRelearnerMenuLoadContestMoveDescription(itemIndex);
}
void MoveRelearnerPrintText(u8 *text)
{
u8 speed;
FillWindowPixelBuffer(3, 0x11);
gTextFlags.canABSpeedUpPrint = TRUE;
speed = GetPlayerTextSpeedDelay();
AddTextPrinterParameterized2(3, 1, text, speed, NULL, TEXT_COLOR_DARK_GREY, TEXT_COLOR_WHITE, 3);
}
bool16 MoveRelearnerRunTextPrinters(void)
{
RunTextPrinters();
return IsTextPrinterActive(3);
}
void MoveRelearnerCreateYesNoMenu(void)
{
CreateYesNoMenu(&gMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0);
} }

View File

@ -12,10 +12,10 @@
#include "alloc.h" #include "alloc.h"
#include "menu.h" #include "menu.h"
#include "menu_helpers.h" #include "menu_helpers.h"
#include "menu_unknown.h"
#include "overworld.h" #include "overworld.h"
#include "palette.h" #include "palette.h"
#include "pokemon_summary_screen.h" #include "pokemon_summary_screen.h"
#include "pokenav.h"
#include "script.h" #include "script.h"
#include "sound.h" #include "sound.h"
#include "sprite.h" #include "sprite.h"

View File

@ -1751,14 +1751,14 @@ const u8 gText_MoveRelearnerPkmnForgotMoveAndLearnedNew[] = _("{STR_VAR_1} forgo
const u8 gUnknown_085EF9C8[] = _("{STR_VAR_1} did not learn the\nmove {STR_VAR_2}."); const u8 gUnknown_085EF9C8[] = _("{STR_VAR_1} did not learn the\nmove {STR_VAR_2}.");
const u8 gText_MoveRelearnerGiveUp[] = _("Give up trying to teach a new\nmove to {STR_VAR_1}?"); const u8 gText_MoveRelearnerGiveUp[] = _("Give up trying to teach a new\nmove to {STR_VAR_1}?");
const u8 gText_MoveRelearnerWhichMoveToForget[] = _("Which move should be\nforgotten?\p"); const u8 gText_MoveRelearnerWhichMoveToForget[] = _("Which move should be\nforgotten?\p");
const u8 gText_BattleMoves2[] = _("BATTLE MOVES"); const u8 gText_MoveRelearnerBattleMoves[] = _("BATTLE MOVES");
const u8 gText_ContestMoves2[] = _("CONTEST MOVES"); const u8 gText_MoveRelearnerContestMovesTitle[] = _("CONTEST MOVES");
const u8 gUnknown_085EFA4C[] = _("TYPE/"); const u8 gUnknown_085EFA4C[] = _("TYPE/");
const u8 gText_PPSlash[] = _("PP/"); const u8 gText_MoveRelearnerPP[] = _("PP/");
const u8 gText_PowerSlash[] = _("POWER/"); const u8 gText_MoveRelearnerPower[] = _("POWER/");
const u8 gText_AccuracySlash[] = _("ACCURACY/"); const u8 gText_MoveRelearnerAccuracy[] = _("ACCURACY/");
const u8 gText_Appeal2[] = _("APPEAL"); const u8 gText_MoveRelearnerAppeal[] = _("APPEAL");
const u8 gText_Jam2[] = _("JAM"); const u8 gText_MoveRelearnerJam[] = _("JAM");
const u8 gText_Kira[] = _("KIRA"); const u8 gText_Kira[] = _("KIRA");
const u8 gText_Amy[] = _("AMY"); const u8 gText_Amy[] = _("AMY");
const u8 gText_John[] = _("JOHN"); const u8 gText_John[] = _("JOHN");