mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
through sub_80DAE0C
This commit is contained in:
parent
dfc83cf28f
commit
7fdebe0d15
254
asm/contest.s
254
asm/contest.s
@ -5,260 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80DACBC
|
||||
sub_80DACBC: @ 80DACBC
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
sub sp, 0x64
|
||||
mov r8, r2
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r2, r1, 24
|
||||
movs r7, 0
|
||||
ldr r0, =gUnknown_02039F30
|
||||
ldrb r1, [r0]
|
||||
mov r9, r0
|
||||
cmp r1, 0x4
|
||||
bne _080DACDE
|
||||
b _080DADF6
|
||||
_080DACDE:
|
||||
movs r5, 0
|
||||
ldr r3, =gContestOpponents
|
||||
ldr r6, =gUnknown_085898A4
|
||||
_080DACE4:
|
||||
ldrb r0, [r3, 0x1C]
|
||||
lsls r0, 30
|
||||
lsrs r0, 30
|
||||
cmp r2, r0
|
||||
bne _080DAD56
|
||||
mov r0, r8
|
||||
cmp r0, 0x1
|
||||
bne _080DAD08
|
||||
ldrb r0, [r6]
|
||||
cmp r0, 0x1
|
||||
beq _080DAD56
|
||||
b _080DAD0E
|
||||
.pool
|
||||
_080DAD08:
|
||||
ldrb r0, [r6]
|
||||
cmp r0, 0x2
|
||||
beq _080DAD56
|
||||
_080DAD0E:
|
||||
cmp r4, 0
|
||||
bne _080DAD1A
|
||||
ldrb r0, [r3, 0x1C]
|
||||
lsls r0, 29
|
||||
cmp r0, 0
|
||||
blt _080DAD4A
|
||||
_080DAD1A:
|
||||
cmp r4, 0x1
|
||||
bne _080DAD26
|
||||
ldrb r0, [r3, 0x1C]
|
||||
lsls r0, 28
|
||||
cmp r0, 0
|
||||
blt _080DAD4A
|
||||
_080DAD26:
|
||||
cmp r4, 0x2
|
||||
bne _080DAD32
|
||||
ldrb r0, [r3, 0x1C]
|
||||
lsls r0, 27
|
||||
cmp r0, 0
|
||||
blt _080DAD4A
|
||||
_080DAD32:
|
||||
cmp r4, 0x3
|
||||
bne _080DAD3E
|
||||
ldrb r0, [r3, 0x1C]
|
||||
lsls r0, 26
|
||||
cmp r0, 0
|
||||
blt _080DAD4A
|
||||
_080DAD3E:
|
||||
cmp r4, 0x4
|
||||
bne _080DAD56
|
||||
ldrb r0, [r3, 0x1C]
|
||||
lsls r0, 25
|
||||
cmp r0, 0
|
||||
bge _080DAD56
|
||||
_080DAD4A:
|
||||
adds r0, r7, 0
|
||||
adds r1, r0, 0x1
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
add r0, sp
|
||||
strb r5, [r0]
|
||||
_080DAD56:
|
||||
adds r3, 0x40
|
||||
adds r6, 0x1
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x5F
|
||||
bls _080DACE4
|
||||
mov r3, sp
|
||||
adds r1, r3, r7
|
||||
movs r0, 0xFF
|
||||
strb r0, [r1]
|
||||
movs r5, 0
|
||||
mov r0, r9
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x4
|
||||
subs r0, r1
|
||||
cmp r5, r0
|
||||
bge _080DADF6
|
||||
ldr r3, =gContestMons
|
||||
mov r8, r3
|
||||
mov r6, r9
|
||||
movs r0, 0x2
|
||||
add r0, r8
|
||||
mov r9, r0
|
||||
_080DAD82:
|
||||
bl sub_80F903C
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
adds r1, r7, 0
|
||||
bl __modsi3
|
||||
adds r1, r0, 0
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
ldrb r0, [r6]
|
||||
adds r0, r5
|
||||
lsls r0, 6
|
||||
add r0, r8
|
||||
ldr r2, =gContestOpponents
|
||||
mov r3, sp
|
||||
adds r4, r3, r1
|
||||
ldrb r1, [r4]
|
||||
lsls r1, 6
|
||||
adds r1, r2
|
||||
movs r2, 0x40
|
||||
bl memcpy
|
||||
ldrb r0, [r6]
|
||||
adds r0, r5
|
||||
lsls r0, 6
|
||||
mov r1, r8
|
||||
adds r1, 0xD
|
||||
adds r0, r1
|
||||
bl sub_80DF9D4
|
||||
ldrb r0, [r6]
|
||||
adds r0, r5
|
||||
lsls r0, 6
|
||||
add r0, r9
|
||||
movs r1, 0x2
|
||||
bl sub_80DF9E0
|
||||
ldrb r0, [r4]
|
||||
adds r3, r5, 0x1
|
||||
subs r1, r7, 0x1
|
||||
cmp r0, 0xFF
|
||||
beq _080DADE6
|
||||
adds r2, r4, 0
|
||||
_080DADDA:
|
||||
ldrb r0, [r2, 0x1]
|
||||
strb r0, [r2]
|
||||
adds r2, 0x1
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0xFF
|
||||
bne _080DADDA
|
||||
_080DADE6:
|
||||
lsls r0, r1, 24
|
||||
lsrs r7, r0, 24
|
||||
adds r5, r3, 0
|
||||
ldrb r1, [r6]
|
||||
movs r0, 0x4
|
||||
subs r0, r1
|
||||
cmp r5, r0
|
||||
blt _080DAD82
|
||||
_080DADF6:
|
||||
add sp, 0x64
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80DACBC
|
||||
|
||||
thumb_func_start sub_80DAE0C
|
||||
sub_80DAE0C: @ 80DAE0C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r1, 0x2D
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
beq _080DAE1E
|
||||
movs r0, 0x3
|
||||
b _080DAE9A
|
||||
_080DAE1E:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x39
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
bne _080DAE2E
|
||||
movs r0, 0x4
|
||||
b _080DAE9A
|
||||
_080DAE2E:
|
||||
ldr r0, =gSpecialVar_ContestCategory
|
||||
ldrh r0, [r0]
|
||||
cmp r0, 0x4
|
||||
bhi _080DAE82
|
||||
lsls r0, 2
|
||||
ldr r1, =_080DAE48
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_080DAE48:
|
||||
.4byte _080DAE5C
|
||||
.4byte _080DAE62
|
||||
.4byte _080DAE68
|
||||
.4byte _080DAE6E
|
||||
.4byte _080DAE74
|
||||
_080DAE5C:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x32
|
||||
b _080DAE78
|
||||
_080DAE62:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x33
|
||||
b _080DAE78
|
||||
_080DAE68:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x34
|
||||
b _080DAE78
|
||||
_080DAE6E:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x35
|
||||
b _080DAE78
|
||||
_080DAE74:
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x36
|
||||
_080DAE78:
|
||||
bl GetMonData
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
b _080DAE86
|
||||
_080DAE82:
|
||||
movs r0, 0
|
||||
b _080DAE9A
|
||||
_080DAE86:
|
||||
ldr r0, =gSpecialVar_ContestRank
|
||||
adds r2, r1, 0
|
||||
ldrh r1, [r0]
|
||||
movs r0, 0x2
|
||||
cmp r2, r1
|
||||
bhi _080DAE9A
|
||||
movs r0, 0
|
||||
cmp r2, r1
|
||||
bcc _080DAE9A
|
||||
movs r0, 0x1
|
||||
_080DAE9A:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_80DAE0C
|
||||
|
||||
thumb_func_start sub_80DAEA4
|
||||
sub_80DAEA4: @ 80DAEA4
|
||||
push {r4,r5,lr}
|
||||
|
@ -11,7 +11,7 @@
|
||||
// to help in decompiling
|
||||
#define asm_comment(x) asm volatile("@ -- " x " -- ")
|
||||
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
|
||||
#define ASM_DIRECT __attribute__((naked))
|
||||
#define NAKED __attribute__((naked))
|
||||
|
||||
// IDE support
|
||||
#if defined (__APPLE__) || defined (__CYGWIN__)
|
||||
|
7
include/script_pokemon_util_80F87D8.h
Normal file
7
include/script_pokemon_util_80F87D8.h
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
#ifndef GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H
|
||||
#define GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H
|
||||
|
||||
u16 sub_80F903C(void);
|
||||
|
||||
#endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H
|
@ -386,7 +386,7 @@ void sub_8159308(u8 taskId)
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_8159308(u8 taskId)
|
||||
{
|
||||
asm_unified(" push {r4,r5,lr}\n\
|
||||
|
@ -648,7 +648,7 @@ static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -3591,7 +3591,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
gBattleMainFunc = BattleIntroRecordMonsToDex;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -3608,7 +3608,7 @@ static void atk24(void)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void atk24(void)
|
||||
{
|
||||
asm("\n\
|
||||
|
@ -812,7 +812,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void TryPutLinkBattleTvShowOnAir(void)
|
||||
{
|
||||
asm_unified(
|
||||
|
6
src/bg.c
6
src/bg.c
@ -463,7 +463,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -1048,7 +1048,7 @@ void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8
|
||||
}
|
||||
}
|
||||
}*/
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -1495,7 +1495,7 @@ void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 pal
|
||||
*dest = test;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2)
|
||||
{
|
||||
asm("push {r4-r6,lr}\n\
|
||||
|
280
src/contest.c
280
src/contest.c
@ -39,6 +39,7 @@
|
||||
#include "strings.h"
|
||||
#include "contest_effect.h"
|
||||
#include "contest_link_80FC4F4.h"
|
||||
#include "script_pokemon_util_80F87D8.h"
|
||||
|
||||
#define DESTROY_POINTER(ptr) \
|
||||
free(ptr); \
|
||||
@ -2087,15 +2088,15 @@ void sub_80DAB8C(u8 contestType, u8 rank)
|
||||
if (r3[i] == 2)
|
||||
continue;
|
||||
}
|
||||
if (contestType == 0 && gContestOpponents[i].aiPool_Cool)
|
||||
if (contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == 1 && gContestOpponents[i].aiPool_Beauty)
|
||||
else if (contestType == CONTEST_CATEGORY_BEAUTY && gContestOpponents[i].aiPool_Beauty)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == 2 && gContestOpponents[i].aiPool_Cute)
|
||||
else if (contestType == CONTEST_CATEGORY_CUTE && gContestOpponents[i].aiPool_Cute)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == 3 && gContestOpponents[i].aiPool_Smart)
|
||||
else if (contestType == CONTEST_CATEGORY_SMART && gContestOpponents[i].aiPool_Smart)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == 4 && gContestOpponents[i].aiPool_Tough)
|
||||
else if (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough)
|
||||
opponents[opponentsCount++] = i;
|
||||
}
|
||||
}
|
||||
@ -2115,3 +2116,272 @@ void sub_80DAB8C(u8 contestType, u8 rank)
|
||||
|
||||
sub_80DA8C8(gUnknown_02039F24);
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame)
|
||||
{
|
||||
s32 i;
|
||||
u8 opponentsCount = 0;
|
||||
u8 opponents[100];
|
||||
const u8 * r6;
|
||||
|
||||
if (gUnknown_02039F30 == 4)
|
||||
return;
|
||||
|
||||
r6 = gUnknown_085898A4;
|
||||
for (i = 0; i < ARRAY_COUNT(gContestOpponents); i++)
|
||||
{
|
||||
if (rank != gContestOpponents[i].whichRank)
|
||||
continue;
|
||||
if (isPostgame == TRUE)
|
||||
{
|
||||
if (r6[i] == 1)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r6[i] == 2)
|
||||
continue;
|
||||
}
|
||||
if (contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == CONTEST_CATEGORY_BEAUTY && gContestOpponents[i].aiPool_Beauty)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == CONTEST_CATEGORY_CUTE && gContestOpponents[i].aiPool_Cute)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == CONTEST_CATEGORY_SMART && gContestOpponents[i].aiPool_Smart)
|
||||
opponents[opponentsCount++] = i;
|
||||
else if (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough)
|
||||
opponents[opponentsCount++] = i;
|
||||
}
|
||||
opponents[opponentsCount] = 0xFF;
|
||||
for (i = 0; i < 4 - gUnknown_02039F30; i++)
|
||||
{
|
||||
u16 rnd = sub_80F903C() % opponentsCount;
|
||||
s32 j;
|
||||
|
||||
gContestMons[gUnknown_02039F30 + i] = gContestOpponents[opponents[rnd]];
|
||||
sub_80DF9D4(gContestMons[gUnknown_02039F30 + i].trainerName);
|
||||
sub_80DF9E0(gContestMons[gUnknown_02039F30 + i].nickname, GAME_LANGUAGE);
|
||||
for (j = rnd; opponents[j] != 0xFF; j++)
|
||||
opponents[j] = opponents[j + 1];
|
||||
opponentsCount--;
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r9\n"
|
||||
"\tmov r6, r8\n"
|
||||
"\tpush {r6,r7}\n"
|
||||
"\tsub sp, 0x64\n"
|
||||
"\tmov r8, r2\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r4, r0, 24\n"
|
||||
"\tlsls r1, 24\n"
|
||||
"\tlsrs r2, r1, 24\n"
|
||||
"\tmovs r7, 0\n"
|
||||
"\tldr r0, =gUnknown_02039F30\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tmov r9, r0\n"
|
||||
"\tcmp r1, 0x4\n"
|
||||
"\tbne _080DACDE\n"
|
||||
"\tb _080DADF6\n"
|
||||
"_080DACDE:\n"
|
||||
"\tmovs r5, 0\n"
|
||||
"\tldr r3, =gContestOpponents\n"
|
||||
"\tldr r6, =gUnknown_085898A4\n"
|
||||
"_080DACE4:\n"
|
||||
"\tldrb r0, [r3, 0x1C]\n"
|
||||
"\tlsls r0, 30\n"
|
||||
"\tlsrs r0, 30\n"
|
||||
"\tcmp r2, r0\n"
|
||||
"\tbne _080DAD56\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbne _080DAD08\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbeq _080DAD56\n"
|
||||
"\tb _080DAD0E\n"
|
||||
"\t.pool\n"
|
||||
"_080DAD08:\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tbeq _080DAD56\n"
|
||||
"_080DAD0E:\n"
|
||||
"\tcmp r4, 0\n"
|
||||
"\tbne _080DAD1A\n"
|
||||
"\tldrb r0, [r3, 0x1C]\n"
|
||||
"\tlsls r0, 29\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tblt _080DAD4A\n"
|
||||
"_080DAD1A:\n"
|
||||
"\tcmp r4, 0x1\n"
|
||||
"\tbne _080DAD26\n"
|
||||
"\tldrb r0, [r3, 0x1C]\n"
|
||||
"\tlsls r0, 28\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tblt _080DAD4A\n"
|
||||
"_080DAD26:\n"
|
||||
"\tcmp r4, 0x2\n"
|
||||
"\tbne _080DAD32\n"
|
||||
"\tldrb r0, [r3, 0x1C]\n"
|
||||
"\tlsls r0, 27\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tblt _080DAD4A\n"
|
||||
"_080DAD32:\n"
|
||||
"\tcmp r4, 0x3\n"
|
||||
"\tbne _080DAD3E\n"
|
||||
"\tldrb r0, [r3, 0x1C]\n"
|
||||
"\tlsls r0, 26\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tblt _080DAD4A\n"
|
||||
"_080DAD3E:\n"
|
||||
"\tcmp r4, 0x4\n"
|
||||
"\tbne _080DAD56\n"
|
||||
"\tldrb r0, [r3, 0x1C]\n"
|
||||
"\tlsls r0, 25\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbge _080DAD56\n"
|
||||
"_080DAD4A:\n"
|
||||
"\tadds r0, r7, 0\n"
|
||||
"\tadds r1, r0, 0x1\n"
|
||||
"\tlsls r1, 24\n"
|
||||
"\tlsrs r7, r1, 24\n"
|
||||
"\tadd r0, sp\n"
|
||||
"\tstrb r5, [r0]\n"
|
||||
"_080DAD56:\n"
|
||||
"\tadds r3, 0x40\n"
|
||||
"\tadds r6, 0x1\n"
|
||||
"\tadds r5, 0x1\n"
|
||||
"\tcmp r5, 0x5F\n"
|
||||
"\tbls _080DACE4\n"
|
||||
"\tmov r3, sp\n"
|
||||
"\tadds r1, r3, r7\n"
|
||||
"\tmovs r0, 0xFF\n"
|
||||
"\tstrb r0, [r1]\n"
|
||||
"\tmovs r5, 0\n"
|
||||
"\tmov r0, r9\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tmovs r0, 0x4\n"
|
||||
"\tsubs r0, r1\n"
|
||||
"\tcmp r5, r0\n"
|
||||
"\tbge _080DADF6\n"
|
||||
"\tldr r3, =gContestMons\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r6, r9\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tadd r0, r8\n"
|
||||
"\tmov r9, r0\n"
|
||||
"_080DAD82:\n"
|
||||
"\tbl sub_80F903C\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tlsrs r0, 16\n"
|
||||
"\tadds r1, r7, 0\n"
|
||||
"\tbl __modsi3\n"
|
||||
"\tadds r1, r0, 0\n"
|
||||
"\tlsls r1, 16\n"
|
||||
"\tlsrs r1, 16\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tlsls r0, 6\n"
|
||||
"\tadd r0, r8\n"
|
||||
"\tldr r2, =gContestOpponents\n"
|
||||
"\tmov r3, sp\n"
|
||||
"\tadds r4, r3, r1\n"
|
||||
"\tldrb r1, [r4]\n"
|
||||
"\tlsls r1, 6\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tmovs r2, 0x40\n"
|
||||
"\tbl memcpy\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tlsls r0, 6\n"
|
||||
"\tmov r1, r8\n"
|
||||
"\tadds r1, 0xD\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tbl sub_80DF9D4\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tlsls r0, 6\n"
|
||||
"\tadd r0, r9\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tbl sub_80DF9E0\n"
|
||||
"\tldrb r0, [r4]\n"
|
||||
"\tadds r3, r5, 0x1\n"
|
||||
"\tsubs r1, r7, 0x1\n"
|
||||
"\tcmp r0, 0xFF\n"
|
||||
"\tbeq _080DADE6\n"
|
||||
"\tadds r2, r4, 0\n"
|
||||
"_080DADDA:\n"
|
||||
"\tldrb r0, [r2, 0x1]\n"
|
||||
"\tstrb r0, [r2]\n"
|
||||
"\tadds r2, 0x1\n"
|
||||
"\tldrb r0, [r2]\n"
|
||||
"\tcmp r0, 0xFF\n"
|
||||
"\tbne _080DADDA\n"
|
||||
"_080DADE6:\n"
|
||||
"\tlsls r0, r1, 24\n"
|
||||
"\tlsrs r7, r0, 24\n"
|
||||
"\tadds r5, r3, 0\n"
|
||||
"\tldrb r1, [r6]\n"
|
||||
"\tmovs r0, 0x4\n"
|
||||
"\tsubs r0, r1\n"
|
||||
"\tcmp r5, r0\n"
|
||||
"\tblt _080DAD82\n"
|
||||
"_080DADF6:\n"
|
||||
"\tadd sp, 0x64\n"
|
||||
"\tpop {r3,r4}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r9, r4\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.pool");
|
||||
}
|
||||
#endif
|
||||
|
||||
// GetContestAvailability?
|
||||
u8 sub_80DAE0C(struct Pokemon *pkmn)
|
||||
{
|
||||
u8 ribbon;
|
||||
u8 retVal;
|
||||
|
||||
if (GetMonData(pkmn, MON_DATA_IS_EGG))
|
||||
return 3;
|
||||
if (GetMonData(pkmn, MON_DATA_HP) == 0)
|
||||
return 4;
|
||||
switch (gSpecialVar_ContestCategory)
|
||||
{
|
||||
case CONTEST_CATEGORY_COOL:
|
||||
ribbon = GetMonData(pkmn, MON_DATA_COOL_RIBBON);
|
||||
break;
|
||||
case CONTEST_CATEGORY_BEAUTY:
|
||||
ribbon = GetMonData(pkmn, MON_DATA_BEAUTY_RIBBON);
|
||||
break;
|
||||
case CONTEST_CATEGORY_CUTE:
|
||||
ribbon = GetMonData(pkmn, MON_DATA_CUTE_RIBBON);
|
||||
break;
|
||||
case CONTEST_CATEGORY_SMART:
|
||||
ribbon = GetMonData(pkmn, MON_DATA_SMART_RIBBON);
|
||||
break;
|
||||
case CONTEST_CATEGORY_TOUGH:
|
||||
ribbon = GetMonData(pkmn, MON_DATA_TOUGH_RIBBON);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Couldn't get this to match any other way.
|
||||
// Returns 2, 1, or 0 respectively if ribbon's rank is above, equal, or below
|
||||
// the current contest rank.
|
||||
if (ribbon > gSpecialVar_ContestRank)
|
||||
retVal = 2;
|
||||
else if (ribbon >= gSpecialVar_ContestRank)
|
||||
retVal = 1;
|
||||
else
|
||||
retVal = 0;
|
||||
return retVal;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void Unused_LZDecompressWramIndirect(const void **src, void *dest)
|
||||
}
|
||||
|
||||
// This one (unused) function is really challenging, won't even try to decompile it.
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_803471C()
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -335,7 +335,7 @@ static void sub_81BED50(u8 taskId)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void sub_81BED50(u8 taskId)
|
||||
{
|
||||
asm("\n\
|
||||
|
@ -234,7 +234,7 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
{
|
||||
asm_unified("push {r4-r7,lr}\n\
|
||||
|
@ -2051,7 +2051,7 @@ u8 sub_800DD1C(u8 maxFlags)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT u8 sub_800DD1C(u8 maxFlags)
|
||||
NAKED u8 sub_800DD1C(u8 maxFlags)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tlsls r0, 24\n"
|
||||
@ -2897,7 +2897,7 @@ void sub_800EFB0(void)
|
||||
CpuFill16(0, gRecvCmds, sizeof gRecvCmds);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_800EFB0(void)
|
||||
NAKED void sub_800EFB0(void)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tsub sp, 0x4\n"
|
||||
@ -3233,7 +3233,7 @@ void sub_800F638(u8 unused, u32 flags)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_800F638(u8 unused, u32 flags)
|
||||
NAKED void sub_800F638(u8 unused, u32 flags)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
@ -3601,7 +3601,7 @@ void sub_800FD14(u16 command)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_800FD14(u16 command)
|
||||
NAKED void sub_800FD14(u16 command)
|
||||
{
|
||||
asm_unified("\tpush {r4,r5,lr}\n"
|
||||
"\tlsls r0, 16\n"
|
||||
@ -4699,7 +4699,7 @@ void sub_801120C(u8 a0)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_801120C(u8 a0)
|
||||
NAKED void sub_801120C(u8 a0)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
|
@ -276,7 +276,7 @@ static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
|
||||
{
|
||||
asm("\n\
|
||||
|
@ -980,7 +980,7 @@ static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
}
|
||||
}
|
||||
#else
|
||||
static ASM_DIRECT void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
static NAKED void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
@ -1163,7 +1163,7 @@ const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
NAKED const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r9\n"
|
||||
|
@ -1417,7 +1417,7 @@ void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
*ppBonusesPtr = localPpBonuses;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -1628,7 +1628,7 @@ void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
*ppBonusesPtr = localPpBonuses;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -2039,7 +2039,7 @@ void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
|
||||
Free(alloced);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -2341,7 +2341,7 @@ void sub_81C2194(u16 *a, u16 b, u8 c)
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C2194(u16 *a, u16 b, u8 c)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -3026,7 +3026,7 @@ void sub_81C335C()
|
||||
sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C335C()
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
@ -3369,7 +3369,7 @@ void sub_81C3B08(u8 a)
|
||||
sub_81C25A4(sp, text, offset, (a<<4), 0, r5);
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void sub_81C3B08(u8 a)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -475,7 +475,7 @@ u32 MoveRecordedBattleToSaveData(void)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
u32 MoveRecordedBattleToSaveData(void)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -925,7 +925,7 @@ static s32 RotatingGate_CanRotate(u8 gateId, s16 rotationDirection)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
static s32 RotatingGate_CanRotate(u8 a, s16 rotationDirection)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
|
@ -375,7 +375,7 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
|
||||
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -871,7 +871,7 @@ void DecompressGlyphTile(const u16 *src, u16 *dest)
|
||||
*(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]];
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void DecompressGlyphTile(const u16 *src, u16 *dest)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
@ -1052,7 +1052,7 @@ u8 GetLastTextColor(u8 colorType)
|
||||
}
|
||||
}
|
||||
|
||||
ASM_DIRECT
|
||||
NAKED
|
||||
void CopyGlyphToWindow(struct TextPrinter *x)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
|
2
src/tv.c
2
src/tv.c
@ -3931,7 +3931,7 @@ static void sub_80F0708(void) // FIXME: register allocation shenanigans
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT static void sub_80F0708(void)
|
||||
NAKED static void sub_80F0708(void)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r9\n"
|
||||
|
@ -230,7 +230,7 @@ void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
|
||||
NAKED void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
|
||||
{
|
||||
asm("\n\
|
||||
.syntax unified\n\
|
||||
|
Loading…
Reference in New Issue
Block a user