mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
Port contest ai from pokeruby
This commit is contained in:
parent
6dac87abfd
commit
c806992cfc
@ -43,7 +43,7 @@ sub_80DB8B8: @ 80DB8B8
|
|||||||
lsrs r4, r0, 24
|
lsrs r4, r0, 24
|
||||||
adds r5, r4, 0
|
adds r5, r4, 0
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
bl sub_80DBCA8
|
bl Contest_IsMonsTurnDisabled
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
beq _080DB8D0
|
beq _080DB8D0
|
||||||
@ -55,8 +55,8 @@ _080DB8D0:
|
|||||||
cmp r4, r0
|
cmp r4, r0
|
||||||
beq _080DB8F4
|
beq _080DB8F4
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
bl sub_81562C4
|
bl ContestAI_ResetAI
|
||||||
bl sub_8156324
|
bl ContestAI_GetActionToUse
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
ldr r2, =gContestMons
|
ldr r2, =gContestMons
|
||||||
lsrs r0, 23
|
lsrs r0, 23
|
||||||
@ -533,7 +533,7 @@ _080DBC3C:
|
|||||||
ldr r0, [r3, 0x4]
|
ldr r0, [r3, 0x4]
|
||||||
adds r0, r4, r0
|
adds r0, r4, r0
|
||||||
ldrh r0, [r0, 0x6]
|
ldrh r0, [r0, 0x6]
|
||||||
bl sub_80DD9F0
|
bl Contest_GetMoveExcitement
|
||||||
ldr r1, [r5]
|
ldr r1, [r5]
|
||||||
ldr r2, [r1]
|
ldr r2, [r1]
|
||||||
ldrb r1, [r2, 0x1]
|
ldrb r1, [r2, 0x1]
|
||||||
@ -568,8 +568,8 @@ _080DBC3C:
|
|||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80DBAA0
|
thumb_func_end sub_80DBAA0
|
||||||
|
|
||||||
thumb_func_start sub_80DBCA8
|
thumb_func_start Contest_IsMonsTurnDisabled
|
||||||
sub_80DBCA8: @ 80DBCA8
|
Contest_IsMonsTurnDisabled: @ 80DBCA8
|
||||||
push {lr}
|
push {lr}
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
@ -599,7 +599,7 @@ _080DBCD8:
|
|||||||
_080DBCDA:
|
_080DBCDA:
|
||||||
pop {r1}
|
pop {r1}
|
||||||
bx r1
|
bx r1
|
||||||
thumb_func_end sub_80DBCA8
|
thumb_func_end Contest_IsMonsTurnDisabled
|
||||||
|
|
||||||
thumb_func_start sub_80DBCE0
|
thumb_func_start sub_80DBCE0
|
||||||
sub_80DBCE0: @ 80DBCE0
|
sub_80DBCE0: @ 80DBCE0
|
||||||
@ -3425,7 +3425,7 @@ _080DD334:
|
|||||||
ldr r0, [r0, 0x4]
|
ldr r0, [r0, 0x4]
|
||||||
adds r0, r4, r0
|
adds r0, r4, r0
|
||||||
ldrh r0, [r0, 0x6]
|
ldrh r0, [r0, 0x6]
|
||||||
bl sub_80DD9F0
|
bl Contest_GetMoveExcitement
|
||||||
ldr r1, [r5]
|
ldr r1, [r5]
|
||||||
ldr r1, [r1, 0x10]
|
ldr r1, [r1, 0x10]
|
||||||
strb r0, [r1]
|
strb r0, [r1]
|
||||||
@ -4213,8 +4213,8 @@ _080DD9C8:
|
|||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80DD940
|
thumb_func_end sub_80DD940
|
||||||
|
|
||||||
thumb_func_start sub_80DD9F0
|
thumb_func_start Contest_GetMoveExcitement
|
||||||
sub_80DD9F0: @ 80DD9F0
|
Contest_GetMoveExcitement: @ 80DD9F0
|
||||||
lsls r0, 16
|
lsls r0, 16
|
||||||
ldr r3, =gUnknown_085899EC
|
ldr r3, =gUnknown_085899EC
|
||||||
ldr r1, =gContestMoves
|
ldr r1, =gContestMoves
|
||||||
@ -4233,7 +4233,7 @@ sub_80DD9F0: @ 80DD9F0
|
|||||||
ldrsb r0, [r1, r0]
|
ldrsb r0, [r1, r0]
|
||||||
bx lr
|
bx lr
|
||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80DD9F0
|
thumb_func_end Contest_GetMoveExcitement
|
||||||
|
|
||||||
thumb_func_start sub_80DDA20
|
thumb_func_start sub_80DDA20
|
||||||
sub_80DDA20: @ 80DDA20
|
sub_80DDA20: @ 80DDA20
|
||||||
@ -5136,7 +5136,7 @@ _080DE146:
|
|||||||
beq _080DE1CA
|
beq _080DE1CA
|
||||||
lsls r0, r7, 24
|
lsls r0, r7, 24
|
||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
bl sub_80DBCA8
|
bl Contest_IsMonsTurnDisabled
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
bne _080DE1CA
|
bne _080DE1CA
|
||||||
|
5278
asm/contest_ai.s
5278
asm/contest_ai.s
File diff suppressed because it is too large
Load Diff
@ -951,7 +951,7 @@ _080E5B00:
|
|||||||
bne _080E5B38
|
bne _080E5B38
|
||||||
lsls r0, r5, 24
|
lsls r0, r5, 24
|
||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
bl sub_80DBCA8
|
bl Contest_IsMonsTurnDisabled
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
bne _080E5B38
|
bne _080E5B38
|
||||||
|
@ -406,7 +406,7 @@ extern struct ContestResources *gContestResources;
|
|||||||
#define sContest (*gContestResources->field_0)
|
#define sContest (*gContestResources->field_0)
|
||||||
#define sContestantStatus (gContestResources->field_4)
|
#define sContestantStatus (gContestResources->field_4)
|
||||||
#define shared192D0 (*gContestResources->field_8)
|
#define shared192D0 (*gContestResources->field_8)
|
||||||
#define eContestAI (*gContestResources->field_C)
|
#define eContestAI (gContestResources->field_C)
|
||||||
#define shared19328 (*gContestResources->field_10)
|
#define shared19328 (*gContestResources->field_10)
|
||||||
#define shared19338 (*gContestResources->field_14)
|
#define shared19338 (*gContestResources->field_14)
|
||||||
|
|
||||||
@ -417,5 +417,12 @@ extern u32 gContestRngValue;
|
|||||||
|
|
||||||
bool8 IsSpeciesNotUnown(u16 species);
|
bool8 IsSpeciesNotUnown(u16 species);
|
||||||
void LoadContestBgAfterMoveAnim(void);
|
void LoadContestBgAfterMoveAnim(void);
|
||||||
|
void SetContestantEffectStringID(u8 a, u8 b);
|
||||||
|
void SetContestantEffectStringID2(u8 a, u8 b);
|
||||||
|
void MakeContestantNervous(u8 p);
|
||||||
|
bool8 Contest_IsMonsTurnDisabled(u8 a);
|
||||||
|
bool8 sub_80DE1E8(u8 a);
|
||||||
|
void SetStartledString(u8 a, u8 b);
|
||||||
|
s8 Contest_GetMoveExcitement(u16);
|
||||||
|
|
||||||
#endif //GUARD_CONTEST_H
|
#endif //GUARD_CONTEST_H
|
||||||
|
16
include/contest_ai.h
Normal file
16
include/contest_ai.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef GUARD_CONTESTAI_H
|
||||||
|
#define GUARD_CONTESTAI_H
|
||||||
|
|
||||||
|
// AI states
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CONTESTAI_SETTING_UP,
|
||||||
|
CONTESTAI_PROCESSING,
|
||||||
|
CONTESTAI_FINISHED,
|
||||||
|
CONTESTAI_DO_NOT_PROCESS
|
||||||
|
};
|
||||||
|
|
||||||
|
void ContestAI_ResetAI(u8);
|
||||||
|
u8 ContestAI_GetActionToUse(void);
|
||||||
|
|
||||||
|
#endif // GUARD_CONTESTAI_H
|
@ -17,6 +17,8 @@ struct ContestEffect
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern const struct ContestMove gContestMoves[];
|
extern const struct ContestMove gContestMoves[];
|
||||||
extern struct ContestEffect gContestEffects[];
|
extern const struct ContestEffect gContestEffects[];
|
||||||
|
|
||||||
|
bool8 AreMovesContestCombo(u16 lastMove, u16 nextMove);
|
||||||
|
|
||||||
#endif //GUARD_CONTEST_EFFECT_H
|
#endif //GUARD_CONTEST_EFFECT_H
|
||||||
|
@ -107,7 +107,7 @@ u16 sub_80DE84C(u16);
|
|||||||
void sub_80DB89C(void);
|
void sub_80DB89C(void);
|
||||||
u16 sub_80DB8B8(u8);
|
u16 sub_80DB8B8(u8);
|
||||||
void sub_80DB918(void);
|
void sub_80DB918(void);
|
||||||
bool8 sub_80DBCA8(u8);
|
bool8 Contest_IsMonsTurnDisabled(u8);
|
||||||
void sub_80DBF68(void);
|
void sub_80DBF68(void);
|
||||||
void sub_80DBF90(void);
|
void sub_80DBF90(void);
|
||||||
void sub_80DC2BC(void);
|
void sub_80DC2BC(void);
|
||||||
@ -721,7 +721,7 @@ void sub_80D833C(u8 taskId)
|
|||||||
sub_80DCD48();
|
sub_80DCD48();
|
||||||
DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18204, 0x400);
|
DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18204, 0x400);
|
||||||
ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
|
ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
|
||||||
if (!sub_80DBCA8(gContestPlayerMonIndex))
|
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
||||||
StringCopy(gDisplayedStringBattle, gText_0827D507);
|
StringCopy(gDisplayedStringBattle, gText_0827D507);
|
||||||
else
|
else
|
||||||
StringCopy(gDisplayedStringBattle, gText_0827D531);
|
StringCopy(gDisplayedStringBattle, gText_0827D531);
|
||||||
@ -745,7 +745,7 @@ void sub_80D8424(u8 taskId)
|
|||||||
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON))
|
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (!sub_80DBCA8(gContestPlayerMonIndex))
|
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
||||||
{
|
{
|
||||||
sub_80DC490(TRUE);
|
sub_80DC490(TRUE);
|
||||||
gTasks[taskId].func = sub_80D8490;
|
gTasks[taskId].func = sub_80D8490;
|
||||||
@ -819,7 +819,7 @@ void sub_80D8610(u8 taskId)
|
|||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_80DC490(FALSE);
|
sub_80DC490(FALSE);
|
||||||
ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
|
ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
|
||||||
if (!sub_80DBCA8(gContestPlayerMonIndex))
|
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
||||||
StringCopy(gDisplayedStringBattle, gText_0827D507);
|
StringCopy(gDisplayedStringBattle, gText_0827D507);
|
||||||
else
|
else
|
||||||
StringCopy(gDisplayedStringBattle, gText_0827D531);
|
StringCopy(gDisplayedStringBattle, gText_0827D531);
|
||||||
@ -2636,7 +2636,7 @@ void sub_80DB4E0(u16 move, u8 b)
|
|||||||
{
|
{
|
||||||
u8 r7 = gUnknown_02039F26[b] * 5 + 2;
|
u8 r7 = gUnknown_02039F26[b] * 5 + 2;
|
||||||
|
|
||||||
if (!sub_80DBCA8(b) && move != MOVE_NONE)
|
if (!Contest_IsMonsTurnDisabled(b) && move != MOVE_NONE)
|
||||||
{
|
{
|
||||||
u16 tile = sub_80DB2EC(move, b);
|
u16 tile = sub_80DB2EC(move, b);
|
||||||
|
|
||||||
|
1758
src/contest_ai.c
Normal file
1758
src/contest_ai.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user