mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
through sub_80D8490
This commit is contained in:
parent
f9230e80aa
commit
7d446a9ef7
298
asm/contest.s
298
asm/contest.s
@ -5,304 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80D833C
|
||||
sub_80D833C: @ 80D833C
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldr r1, =gTasks
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
adds r4, r0, r1
|
||||
movs r0, 0x8
|
||||
ldrsh r1, [r4, r0]
|
||||
cmp r1, 0
|
||||
bne _080D840C
|
||||
ldr r0, =gBattle_BG0_Y
|
||||
strh r1, [r0]
|
||||
ldr r0, =gBattle_BG2_Y
|
||||
strh r1, [r0]
|
||||
bl sub_80DCD48
|
||||
ldr r1, =gPlttBufferUnfaded
|
||||
ldr r2, =0x0201a204
|
||||
ldr r0, =0x040000d4
|
||||
str r1, [r0]
|
||||
str r2, [r0, 0x4]
|
||||
ldr r1, =0x84000100
|
||||
str r1, [r0, 0x8]
|
||||
ldr r0, [r0, 0x8]
|
||||
ldr r0, =gStringVar1
|
||||
ldr r1, =gContestResources
|
||||
ldr r1, [r1]
|
||||
ldr r1, [r1]
|
||||
ldrb r1, [r1, 0x1]
|
||||
adds r1, 0x1
|
||||
movs r2, 0
|
||||
movs r3, 0x1
|
||||
bl ConvertIntToDecimalStringN
|
||||
ldr r0, =gContestPlayerMonIndex
|
||||
ldrb r0, [r0]
|
||||
bl sub_80DBCA8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080D83CC
|
||||
ldr r0, =gDisplayedStringBattle
|
||||
ldr r1, =gText_0827D507
|
||||
bl StringCopy
|
||||
b _080D83D4
|
||||
.pool
|
||||
_080D83CC:
|
||||
ldr r0, =gDisplayedStringBattle
|
||||
ldr r1, =gText_0827D531
|
||||
bl StringCopy
|
||||
_080D83D4:
|
||||
bl sub_80DB89C
|
||||
ldr r4, =gStringVar4
|
||||
ldr r1, =gDisplayedStringBattle
|
||||
adds r0, r4, 0
|
||||
bl StringExpandPlaceholders
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl sub_80DEC30
|
||||
ldr r1, =gTasks
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
adds r0, r1
|
||||
ldrh r1, [r0, 0x8]
|
||||
adds r1, 0x1
|
||||
strh r1, [r0, 0x8]
|
||||
b _080D841A
|
||||
.pool
|
||||
_080D840C:
|
||||
bl sub_80DED4C
|
||||
cmp r0, 0
|
||||
bne _080D841A
|
||||
strh r0, [r4, 0x8]
|
||||
ldr r0, =sub_80D8424
|
||||
str r0, [r4]
|
||||
_080D841A:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D833C
|
||||
|
||||
thumb_func_start sub_80D8424
|
||||
sub_80D8424: @ 80D8424
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
adds r5, r4, 0
|
||||
ldr r0, =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080D843C
|
||||
cmp r1, 0x2
|
||||
bne _080D8482
|
||||
_080D843C:
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r0, =gContestPlayerMonIndex
|
||||
ldrb r0, [r0]
|
||||
bl sub_80DBCA8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080D8474
|
||||
movs r0, 0x1
|
||||
bl sub_80DC490
|
||||
ldr r0, =gTasks
|
||||
lsls r1, r4, 2
|
||||
adds r1, r4
|
||||
lsls r1, 3
|
||||
adds r1, r0
|
||||
ldr r0, =sub_80D8490
|
||||
b _080D8480
|
||||
.pool
|
||||
_080D8474:
|
||||
ldr r0, =gTasks
|
||||
lsls r1, r5, 2
|
||||
adds r1, r5
|
||||
lsls r1, 3
|
||||
adds r1, r0
|
||||
ldr r0, =sub_80D8894
|
||||
_080D8480:
|
||||
str r0, [r1]
|
||||
_080D8482:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D8424
|
||||
|
||||
thumb_func_start sub_80D8490
|
||||
sub_80D8490: @ 80D8490
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x24
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r9, r0
|
||||
ldr r0, =gBattle_BG0_Y
|
||||
movs r1, 0xA0
|
||||
strh r1, [r0]
|
||||
ldr r0, =gBattle_BG2_Y
|
||||
strh r1, [r0]
|
||||
movs r6, 0
|
||||
ldr r0, =gContestPlayerMonIndex
|
||||
mov r8, r0
|
||||
ldr r2, =gContestMons + 30
|
||||
mov r10, r2
|
||||
ldr r7, =gContestResources
|
||||
_080D84B8:
|
||||
lsls r1, r6, 1
|
||||
mov r0, r8
|
||||
ldrb r2, [r0]
|
||||
lsls r0, r2, 6
|
||||
adds r1, r0
|
||||
add r1, r10
|
||||
ldrh r4, [r1]
|
||||
add r5, sp, 0x4
|
||||
ldr r0, [r7]
|
||||
ldr r1, [r0, 0x4]
|
||||
lsls r0, r2, 3
|
||||
subs r0, r2
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldrh r0, [r0, 0x8]
|
||||
cmp r0, 0
|
||||
beq _080D853C
|
||||
adds r0, r2, 0
|
||||
bl sub_80DE1E8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080D853C
|
||||
ldr r0, [r7]
|
||||
mov r2, r8
|
||||
ldrb r1, [r2]
|
||||
ldr r2, [r0, 0x4]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldrh r0, [r0, 0x8]
|
||||
adds r1, r4, 0
|
||||
bl AreMovesContestCombo
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080D853C
|
||||
ldr r0, [r7]
|
||||
mov r2, r8
|
||||
ldrb r1, [r2]
|
||||
ldr r2, [r0, 0x4]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldrb r1, [r0, 0x15]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080D853C
|
||||
add r0, sp, 0x4
|
||||
ldr r1, =gText_ColorLightShadowDarkGrey
|
||||
b _080D8566
|
||||
.pool
|
||||
_080D853C:
|
||||
cmp r4, 0
|
||||
beq _080D856C
|
||||
ldr r0, [r7]
|
||||
mov r2, r8
|
||||
ldrb r1, [r2]
|
||||
ldr r2, [r0, 0x4]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldrh r0, [r0, 0x8]
|
||||
cmp r0, r4
|
||||
bne _080D856C
|
||||
ldr r0, =gContestMoves
|
||||
lsls r1, r4, 3
|
||||
adds r1, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0x3
|
||||
beq _080D856C
|
||||
add r0, sp, 0x4
|
||||
ldr r1, =gText_ColorBlue
|
||||
_080D8566:
|
||||
bl StringCopy
|
||||
adds r5, r0, 0
|
||||
_080D856C:
|
||||
movs r0, 0xD
|
||||
adds r1, r4, 0
|
||||
muls r1, r0
|
||||
ldr r0, =gMoveNames
|
||||
adds r1, r0
|
||||
adds r0, r5, 0
|
||||
bl StringCopy
|
||||
adds r4, r6, 0x5
|
||||
lsls r0, r4, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0
|
||||
bl FillWindowPixelBuffer
|
||||
movs r0, 0x7
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
add r1, sp, 0x4
|
||||
movs r2, 0x5
|
||||
movs r3, 0x1
|
||||
bl sub_80DEBD0
|
||||
adds r0, r6, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
cmp r6, 0x3
|
||||
bls _080D84B8
|
||||
ldr r4, =gContestResources
|
||||
ldr r0, [r4]
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
bl sub_80D880C
|
||||
ldr r2, =gContestMons
|
||||
ldr r0, [r4]
|
||||
ldr r0, [r0]
|
||||
ldrb r1, [r0]
|
||||
lsls r1, 1
|
||||
ldr r0, =gContestPlayerMonIndex
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 6
|
||||
adds r1, r0
|
||||
adds r2, 0x1E
|
||||
adds r1, r2
|
||||
ldrh r0, [r1]
|
||||
bl prints_contest_move_description
|
||||
ldr r1, =gTasks
|
||||
mov r2, r9
|
||||
lsls r0, r2, 2
|
||||
add r0, r9
|
||||
lsls r0, 3
|
||||
adds r0, r1
|
||||
ldr r1, =sub_80D8610
|
||||
str r1, [r0]
|
||||
add sp, 0x24
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D8490
|
||||
|
||||
thumb_func_start sub_80D8610
|
||||
sub_80D8610: @ 80D8610
|
||||
push {r4-r7,lr}
|
||||
|
14
include/contest_effect.h
Normal file
14
include/contest_effect.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef GUARD_CONTEST_EFFECT_H
|
||||
#define GUARD_CONTEST_EFFECT_H
|
||||
|
||||
struct ContestMove
|
||||
{
|
||||
u8 effect;
|
||||
u8 contestCategory:3;
|
||||
u8 comboStarterId;
|
||||
u8 comboMoves[4];
|
||||
};
|
||||
|
||||
extern const struct ContestMove gContestMoves[];
|
||||
|
||||
#endif //GUARD_CONTEST_EFFECT_H
|
@ -394,4 +394,8 @@ extern const u8 Route111_EventScript_2907F0[];
|
||||
extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_1F863F[];
|
||||
extern const u8 LittlerootTown_MaysHouse_2F_EventScript_1F958F[];
|
||||
|
||||
//contest_strings
|
||||
extern const u8 gText_0827D507[];
|
||||
extern const u8 gText_0827D531[];
|
||||
|
||||
#endif //GUARD_EVENT_SCRIPTS_H
|
||||
|
@ -429,5 +429,7 @@ extern const u8 gText_TooImportantToToss[];
|
||||
extern const u8 gText_ConfirmTossItems[];
|
||||
extern const u8 gText_MoveVar1Where[];
|
||||
|
||||
extern const u8 gText_ColorLightShadowDarkGrey[];
|
||||
extern const u8 gText_ColorBlue[];
|
||||
|
||||
#endif //GUARD_STRINGS_H
|
||||
|
111
src/contest.c
111
src/contest.c
@ -32,6 +32,10 @@
|
||||
#include "util.h"
|
||||
#include "contest_link_80F57C4.h"
|
||||
#include "dma3.h"
|
||||
#include "battle_message.h"
|
||||
#include "event_scripts.h"
|
||||
#include "strings.h"
|
||||
#include "contest_effect.h"
|
||||
|
||||
#define DESTROY_POINTER(ptr) \
|
||||
free(ptr); \
|
||||
@ -46,26 +50,42 @@ void sub_80D7DE8(u8 taskId);
|
||||
bool8 sub_80D7E44(u8 *);
|
||||
void sub_80D80C8(u8 taskId);
|
||||
void sub_80D8108(u8 taskId);
|
||||
void sub_80DE350(void);
|
||||
void sub_80DDB0C(void);
|
||||
void sub_80D833C(u8 taskId);
|
||||
void vblank_cb_battle(void);
|
||||
void sub_80D823C(void);
|
||||
void sub_80D833C(u8 taskId);
|
||||
void sub_80D8424(u8);
|
||||
bool8 AreMovesContestCombo(u16, u16);
|
||||
void sub_80D8610(u8);
|
||||
void sub_80D880C(s8);
|
||||
void prints_contest_move_description(u16);
|
||||
void sub_80D8490(u8);
|
||||
void sub_80D8894(u8);
|
||||
u8 sub_80DB0C4(void);
|
||||
u8 sub_80DB120(void);
|
||||
void sub_80DB2BC(void);
|
||||
void sub_80DB89C(void);
|
||||
bool8 sub_80DBCA8(u8);
|
||||
void sub_80DBF68(void);
|
||||
void sub_80DBF90(void);
|
||||
void sub_80DC2BC(void);
|
||||
void sub_80DC490(bool8);
|
||||
void sub_80DC4F0(void);
|
||||
void sub_80DC594(void);
|
||||
void sub_80DC5E8(void);
|
||||
void sub_80DC7EC(void);
|
||||
void sub_80DCD48(void);
|
||||
void sub_80DCE58(u8);
|
||||
void sub_80DD04C(void);
|
||||
void sub_80DD590(void);
|
||||
void sub_80DDB0C(void);
|
||||
bool8 sub_80DE1E8(u8);
|
||||
void sub_80DE224(void);
|
||||
void vblank_cb_battle(void);
|
||||
void sub_80DE350(void);
|
||||
void sub_80DEA20(void);
|
||||
void sub_80DEBD0(u32, u8 *, u8, u8, u8);
|
||||
void sub_80DEC30(u8 *, u8);
|
||||
bool32 sub_80DED4C(void);
|
||||
|
||||
|
||||
EWRAM_DATA struct ContestPokemon gContestMons[4] = {0};
|
||||
EWRAM_DATA s16 gUnknown_02039F00[4] = {0};
|
||||
@ -578,3 +598,86 @@ void vblank_cb_battle(void)
|
||||
ProcessSpriteCopyRequests();
|
||||
ScanlineEffect_InitHBlankDmaTransfer();
|
||||
}
|
||||
|
||||
void sub_80D833C(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[0] == 0)
|
||||
{
|
||||
gBattle_BG0_Y = 0;
|
||||
gBattle_BG2_Y = 0;
|
||||
sub_80DCD48();
|
||||
DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18204, 0x400);
|
||||
ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
|
||||
if (!sub_80DBCA8(gContestPlayerMonIndex))
|
||||
StringCopy(gDisplayedStringBattle, gText_0827D507);
|
||||
else
|
||||
StringCopy(gDisplayedStringBattle, gText_0827D531);
|
||||
sub_80DB89C();
|
||||
StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle);
|
||||
sub_80DEC30(gStringVar4, 1);
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sub_80DED4C())
|
||||
{
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].func = sub_80D8424;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80D8424(u8 taskId)
|
||||
{
|
||||
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
if (!sub_80DBCA8(gContestPlayerMonIndex))
|
||||
{
|
||||
sub_80DC490(TRUE);
|
||||
gTasks[taskId].func = sub_80D8490;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].func = sub_80D8894;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80D8490(u8 taskId)
|
||||
{
|
||||
u8 i;
|
||||
u8 sp8[32];
|
||||
|
||||
gBattle_BG0_Y = 0xA0;
|
||||
gBattle_BG2_Y = 0xA0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
u16 move = gContestMons[gContestPlayerMonIndex].moves[i];
|
||||
u8 *r5 = sp8;
|
||||
|
||||
if (gContestResources->field_4[gContestPlayerMonIndex].prevMove != MOVE_NONE
|
||||
&& sub_80DE1E8(gContestPlayerMonIndex)
|
||||
&& AreMovesContestCombo(gContestResources->field_4[gContestPlayerMonIndex].prevMove, move) != 0
|
||||
&& gContestResources->field_4[gContestPlayerMonIndex].hasJudgesAttention)
|
||||
{
|
||||
r5 = StringCopy(sp8, gText_ColorLightShadowDarkGrey);
|
||||
}
|
||||
else if (move != 0
|
||||
&& gContestResources->field_4[gContestPlayerMonIndex].prevMove == move
|
||||
&& gContestMoves[move].effect != CONTEST_EFFECT_REPETITION_NOT_BORING)
|
||||
{
|
||||
// Gray the text because it is a repeated move
|
||||
r5 = StringCopy(sp8, gText_ColorBlue);
|
||||
}
|
||||
r5 = StringCopy(r5, gMoveNames[move]);
|
||||
|
||||
FillWindowPixelBuffer(i + 5, 0);
|
||||
sub_80DEBD0(i + 5, sp8, 5, 1, 7);
|
||||
}
|
||||
|
||||
sub_80D880C(gContestResources->field_0->playerMoveChoice);
|
||||
prints_contest_move_description(gContestMons[gContestPlayerMonIndex].moves[gContestResources->field_0->playerMoveChoice]);
|
||||
gTasks[taskId].func = sub_80D8610;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user