through sub_80DB174

This commit is contained in:
PikalaxALT 2018-05-10 19:28:52 -04:00
parent 508a8e5182
commit 9bee601b16
8 changed files with 133 additions and 344 deletions

View File

@ -5,330 +5,6 @@
.text
thumb_func_start sub_80DAFE0
sub_80DAFE0: @ 80DAFE0
push {r4,r5,lr}
lsls r0, 24
lsrs r2, r0, 24
lsls r1, 24
lsrs r0, r1, 24
cmp r0, 0x4
bhi _080DB06C
lsls r0, 2
ldr r1, =_080DAFFC
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080DAFFC:
.4byte _080DB010
.4byte _080DB028
.4byte _080DB040
.4byte _080DB050
.4byte _080DB06C
_080DB010:
ldr r0, =gContestMons
lsls r2, 6
adds r1, r2, r0
adds r3, r1, 0
adds r3, 0x26
ldrb r5, [r3]
adds r3, 0x4
ldrb r4, [r3]
adds r1, 0x27
b _080DB07E
.pool
_080DB028:
ldr r0, =gContestMons
lsls r2, 6
adds r1, r2, r0
adds r3, r1, 0
adds r3, 0x27
ldrb r5, [r3]
subs r3, 0x1
ldrb r4, [r3]
adds r1, 0x28
b _080DB07E
.pool
_080DB040:
ldr r1, =gContestMons
lsls r2, 6
adds r3, r2, r1
adds r0, r3, 0
adds r0, 0x28
b _080DB05A
.pool
_080DB050:
ldr r1, =gContestMons
lsls r2, 6
adds r3, r2, r1
adds r0, r3, 0
adds r0, 0x29
_080DB05A:
ldrb r5, [r0]
subs r0, 0x1
ldrb r4, [r0]
adds r0, 0x2
ldrb r3, [r0]
adds r0, r1, 0
b _080DB080
.pool
_080DB06C:
ldr r0, =gContestMons
lsls r2, 6
adds r1, r2, r0
adds r3, r1, 0
adds r3, 0x2A
ldrb r5, [r3]
subs r3, 0x1
ldrb r4, [r3]
adds r1, 0x26
_080DB07E:
ldrb r3, [r1]
_080DB080:
adds r1, r2, r0
adds r1, 0x2B
adds r0, r4, r3
ldrb r1, [r1]
adds r0, r1
asrs r0, 1
adds r0, r5, r0
lsls r0, 16
lsrs r0, 16
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_80DAFE0
thumb_func_start sub_80DB09C
sub_80DB09C: @ 80DB09C
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
movs r4, 0
ldr r5, =gUnknown_02039F00
_080DB0A6:
lsls r0, r4, 24
lsrs r0, 24
adds r1, r6, 0
bl sub_80DAFE0
strh r0, [r5]
adds r5, 0x2
adds r4, 0x1
cmp r4, 0x3
ble _080DB0A6
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DB09C
thumb_func_start sub_80DB0C4
sub_80DB0C4: @ 80DB0C4
push {r4,r5,lr}
ldr r0, =gUnknown_08587C00
bl LoadCompressedObjectPic
ldr r0, =gContest2Pal
movs r1, 0x88
lsls r1, 1
movs r2, 0x20
bl LoadCompressedPalette
ldr r0, =gSpriteTemplate_8587BE8
movs r1, 0x70
movs r2, 0x24
movs r3, 0x1E
bl CreateSprite
lsls r0, 24
lsrs r0, 24
ldr r4, =gSprites
lsls r2, r0, 4
adds r2, r0
lsls r2, 2
adds r5, r2, r4
ldrb r3, [r5, 0x5]
movs r1, 0xF
ands r1, r3
movs r3, 0x10
orrs r1, r3
strb r1, [r5, 0x5]
adds r4, 0x1C
adds r2, r4
ldr r1, =SpriteCallbackDummy
str r1, [r2]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_80DB0C4
thumb_func_start sub_80DB120
sub_80DB120: @ 80DB120
push {lr}
ldr r0, =gUnknown_08587C08
bl LoadCompressedObjectPic
ldr r0, =gUnknown_08587C10
bl LoadCompressedObjectPalette
ldr r0, =gSpriteTemplate_8587C18
movs r1, 0x60
movs r2, 0xA
movs r3, 0x1D
bl CreateSprite
lsls r0, 24
lsrs r0, 24
ldr r1, =gSprites
lsls r2, r0, 4
adds r2, r0
lsls r2, 2
adds r2, r1
movs r1, 0x3E
adds r1, r2
mov r12, r1
ldrb r1, [r1]
movs r3, 0x4
orrs r1, r3
mov r3, r12
strb r1, [r3]
ldrh r1, [r2, 0x4]
lsls r1, 22
lsrs r1, 22
strh r1, [r2, 0x2E]
pop {r1}
bx r1
.pool
thumb_func_end sub_80DB120
thumb_func_start sub_80DB174
sub_80DB174: @ 80DB174
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r7, r1, 0
adds r6, r2, 0
adds r4, r3, 0
lsls r0, 16
lsrs r5, r0, 16
adds r0, r5, 0
bl sub_80DE84C
adds r5, r0, 0
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
cmp r4, r0
bne _080DB1B8
lsls r0, r5, 3
ldr r1, =gMonBackPicTable
adds r0, r1
ldr r1, =gMonSpritesGfxPtr
ldr r1, [r1]
ldr r1, [r1, 0x4]
adds r2, r5, 0
adds r3, r6, 0
bl HandleLoadSpecialPokePic_2
b _080DB1CC
.pool
_080DB1B8:
lsls r0, r5, 3
ldr r1, =gMonBackPicTable
adds r0, r1
ldr r1, =gMonSpritesGfxPtr
ldr r1, [r1]
ldr r1, [r1, 0x4]
adds r2, r5, 0
adds r3, r6, 0
bl HandleLoadSpecialPokePic_DontHandleDeoxys
_080DB1CC:
adds r0, r5, 0
adds r1, r7, 0
adds r2, r6, 0
bl GetFrontSpritePalFromSpeciesAndPersonality
movs r1, 0x90
lsls r1, 1
movs r2, 0x20
bl LoadCompressedPalette
adds r0, r5, 0
movs r1, 0
bl sub_806A068
ldr r4, =gUnknown_0202499C
movs r0, 0x2
adds r1, r5, 0
movs r2, 0
bl sub_80A600C
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
adds r0, r4, 0
movs r1, 0x70
movs r3, 0x1E
bl CreateSprite
lsls r0, 24
lsrs r7, r0, 24
ldr r0, =gSprites
mov r8, r0
lsls r0, r7, 4
adds r0, r7
lsls r6, r0, 2
mov r0, r8
adds r4, r6, r0
ldrb r1, [r4, 0x5]
movs r0, 0xF
ands r0, r1
movs r1, 0x20
orrs r0, r1
movs r1, 0xD
negs r1, r1
ands r0, r1
movs r1, 0x8
orrs r0, r1
strb r0, [r4, 0x5]
movs r0, 0x2
bl sub_80A82E4
adds r1, r4, 0
adds r1, 0x43
strb r0, [r1]
mov r0, r8
adds r0, 0x1C
adds r0, r6, r0
ldr r1, =SpriteCallbackDummy
str r1, [r0]
ldrb r0, [r4, 0x5]
lsrs r0, 4
strh r0, [r4, 0x2E]
strh r5, [r4, 0x32]
adds r0, r5, 0
bl IsSpeciesNotUnown
lsls r0, 24
cmp r0, 0
beq _080DB278
mov r0, r8
adds r0, 0x10
adds r0, r6, r0
ldr r1, =gUnknown_082FF6C0
b _080DB280
.pool
_080DB278:
mov r0, r8
adds r0, 0x10
adds r0, r6, r0
ldr r1, =gUnknown_082FF694
_080DB280:
str r1, [r0]
lsls r0, r7, 4
adds r0, r7
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
movs r1, 0
bl StartSpriteAffineAnim
adds r0, r7, 0
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_80DB174
thumb_func_start IsSpeciesNotUnown
IsSpeciesNotUnown: @ 80DB2A8
push {lr}
@ -1675,7 +1351,7 @@ sub_80DBCE0: @ 80DBCE0
strh r0, [r1]
ldr r2, =gUnknown_02039F08
adds r2, r4, r2
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
adds r4, r1
ldrh r4, [r4]
adds r0, r4
@ -1785,7 +1461,7 @@ _080DBDB8:
mov r4, sp
ldr r6, =gUnknown_02039F08
ldr r2, [sp, 0x64]
ldr r5, =gUnknown_02039F00
ldr r5, =gContestMonConditions
ldr r3, [sp, 0x68]
_080DBDD2:
mov r7, r9
@ -3918,7 +3594,7 @@ _080DCECC:
movs r4, 0
cmp r4, r5
bge _080DCF48
ldr r7, =gUnknown_02039F00
ldr r7, =gContestMonConditions
mov r9, r7
lsls r0, r5, 1
adds r1, r0, 0
@ -8374,11 +8050,11 @@ _080DF2EE:
strb r0, [r2, 0xD]
_080DF30A:
movs r5, 0
ldr r2, =gUnknown_02039F00
ldr r2, =gContestMonConditions
add r2, r10
movs r6, 0
ldrsh r1, [r2, r6]
ldr r7, =gUnknown_02039F00
ldr r7, =gContestMonConditions
movs r3, 0
ldrsh r0, [r7, r3]
cmp r1, r0
@ -8417,12 +8093,12 @@ _080DF354:
mov r12, r3
mov r8, r3
movs r5, 0
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
add r0, r10
movs r7, 0
ldrsh r6, [r0, r7]
str r6, [sp, 0x34]
ldr r2, =gUnknown_02039F00
ldr r2, =gContestMonConditions
ldr r0, =gUnknown_02039F18
mov r1, r10
adds r6, r1, r0
@ -8665,7 +8341,7 @@ _080DF528:
lsls r2, r7, 1
lsls r4, r7, 4
mov r8, r4
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
adds r0, r2, r1
movs r6, 0
ldrsh r5, [r0, r6]

View File

@ -1167,7 +1167,7 @@ sub_8156B88: @ 8156B88
ldr r0, =gContestResources
ldr r0, [r0]
ldr r2, [r0, 0xC]
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
adds r0, r2, 0
adds r0, 0x41
ldrb r0, [r0]
@ -3729,7 +3729,7 @@ sub_8157F5C: @ 8157F5C
ldr r1, =gContestResources
ldr r1, [r1]
ldr r3, [r1, 0xC]
ldr r2, =gUnknown_02039F00
ldr r2, =gContestMonConditions
lsrs r0, 23
adds r0, r2
adds r1, r3, 0

View File

@ -3104,7 +3104,7 @@ sub_80F7310: @ 80F7310
lsls r0, 24
lsls r1, 24
lsrs r5, r1, 24
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
lsrs r0, 23
adds r0, r1
movs r1, 0
@ -3847,7 +3847,7 @@ _080F78E4:
mov r8, r5
mov r10, r5
_080F78EA:
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
mov r1, r8
lsls r7, r1, 1
adds r0, r7, r0
@ -5027,7 +5027,7 @@ sub_80F82B4: @ 80F82B4
movs r1, 0
movs r2, 0
ldr r5, =gSpecialVar_0x8004
ldr r4, =gUnknown_02039F00
ldr r4, =gContestMonConditions
ldr r0, =gSpecialVar_0x8006
ldrh r0, [r0]
lsls r0, 1
@ -5060,7 +5060,7 @@ _080F82DC:
thumb_func_start sub_80F82FC
sub_80F82FC: @ 80F82FC
ldr r2, =gSpecialVar_0x8004
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
ldr r0, =gSpecialVar_0x8006
ldrh r0, [r0]
lsls r0, 1

View File

@ -1262,7 +1262,7 @@ _080FCF80:
lsls r0, 24
cmp r0, 0
beq _080FCFBE
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
movs r1, 0x8
bl sub_80FC4F4
cmp r0, 0x1
@ -1274,7 +1274,7 @@ _080FCF9C:
lsls r0, 24
cmp r0, 0
beq _080FCFBE
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
ldr r1, =gUnknown_02039F2B
ldrb r1, [r1]
lsls r1, 8

View File

@ -218,7 +218,7 @@ sub_80F8970: @ 80F8970
mov r5, r8
push {r5-r7}
sub sp, 0x8
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
mov r12, r0
ldr r1, =gSpecialVar_0x8006
mov r9, r1

View File

@ -107,4 +107,6 @@ u8 ItemIdToBallId(u16 itemId);
u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId);
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId);
u8 sub_80A600C(u8, u16, u8);
#endif // GUARD_BATTLE_ANIM_H

View File

@ -1,6 +1,8 @@
#ifndef GUARD_DATA2_H
#define GUARD_DATA2_H
#include "constants/species.h"
struct MonCoords
{
// This would use a bitfield, but some function
@ -17,6 +19,6 @@ extern const u8 gMoveNames[][13];
extern struct CompressedSpriteSheet gUnknown_0831C620;
extern struct CompressedSpritePalette gUnknown_0831C628;
extern const struct SpriteTemplate gUnknown_0831C688;
extern const struct CompressedSpriteSheet gMonBackPicTable[NUM_SPECIES];
#endif // GUARD_DATA2_H

View File

@ -41,6 +41,7 @@
#include "contest_link_80FC4F4.h"
#include "script_pokemon_util_80F87D8.h"
#include "international_string_util.h"
#include "data2.h"
#define DESTROY_POINTER(ptr) \
free(ptr); \
@ -102,6 +103,8 @@ void sub_80DAF88(u8);
void sub_80DAFA0(u8, u8);
u8 sub_80DB0C4(void);
u8 sub_80DB120(void);
u8 sub_80DB174(u16, u32, u32, u32);
u16 sub_80DE84C(u16);
void sub_80DB2BC(void);
void sub_80DB89C(void);
u16 sub_80DB8B8(u8);
@ -142,7 +145,6 @@ void sub_80DD080(u8);
void sub_80DF080(u8);
void sub_80DF750(void);
void sub_80DE9DC(u8);
u8 sub_80DB174(u16, u32, u32, u32);
void sub_80DCBE8(u8, u8);
u8 sub_80DC9EC(u8);
u16 sub_80DE834(u16);
@ -171,7 +173,7 @@ void sub_80DF9D4(u8 *);
void sub_80DF9E0(u8 *, s32);
EWRAM_DATA struct ContestPokemon gContestMons[4] = {0};
EWRAM_DATA s16 gUnknown_02039F00[4] = {0};
EWRAM_DATA s16 gContestMonConditions[4] = {0};
EWRAM_DATA s16 gUnknown_02039F08[4] = {0};
EWRAM_DATA s16 gUnknown_02039F10[4] = {0};
EWRAM_DATA s16 gUnknown_02039F18[4] = {0};
@ -234,6 +236,14 @@ extern const u8 gText_0827D56F[];
extern const u8 gText_0827D597[];
extern const struct ContestPokemon gContestOpponents[96];
extern const u8 gUnknown_085898A4[96];
extern const struct CompressedSpriteSheet gUnknown_08587C00;
extern const u8 gContest2Pal[];
extern const struct SpriteTemplate gSpriteTemplate_8587BE8;
extern const struct CompressedSpriteSheet gUnknown_08587C08;
extern const struct CompressedSpritePalette gUnknown_08587C10;
extern const struct SpriteTemplate gSpriteTemplate_8587C18;
extern const union AffineAnimCmd *const gUnknown_082FF6C0[];
extern const union AffineAnimCmd *const gUnknown_082FF694[];
void TaskDummy1(u8 taskId)
{
@ -2441,3 +2451,102 @@ void sub_80DAFA0(u8 a0, u8 a1)
sub_80DAED4(gContestMons[a0].nickname, a1);
sub_80DEBD0(gUnknown_02039F26[a0], gDisplayedStringBattle, 5, 1, 7);
}
u16 sub_80DAFE0(u8 who, u8 contestCategory)
{
u8 statMain;
u8 statSub1;
u8 statSub2;
switch (contestCategory)
{
case CONTEST_CATEGORY_COOL:
statMain = gContestMons[who].cool;
statSub1 = gContestMons[who].tough;
statSub2 = gContestMons[who].beauty;
break;
case CONTEST_CATEGORY_BEAUTY:
statMain = gContestMons[who].beauty;
statSub1 = gContestMons[who].cool;
statSub2 = gContestMons[who].cute;
break;
case CONTEST_CATEGORY_CUTE:
statMain = gContestMons[who].cute;
statSub1 = gContestMons[who].beauty;
statSub2 = gContestMons[who].smart;
break;
case CONTEST_CATEGORY_SMART:
statMain = gContestMons[who].smart;
statSub1 = gContestMons[who].cute;
statSub2 = gContestMons[who].tough;
break;
case CONTEST_CATEGORY_TOUGH:
default:
statMain = gContestMons[who].tough;
statSub1 = gContestMons[who].smart;
statSub2 = gContestMons[who].cool;
break;
}
return statMain + (statSub1 + statSub2 + gContestMons[who].sheen) / 2;
}
void sub_80DB09C(u8 a0)
{
s32 i;
for (i = 0; i < 4; i++)
gContestMonConditions[i] = sub_80DAFE0(i, a0);
}
u8 sub_80DB0C4(void)
{
u8 spriteId;
LoadCompressedObjectPic(&gUnknown_08587C00);
LoadCompressedPalette(gContest2Pal, 0x110, 32);
spriteId = CreateSprite(&gSpriteTemplate_8587BE8, 112, 36, 30);
gSprites[spriteId].oam.paletteNum = 1;
gSprites[spriteId].callback = SpriteCallbackDummy;
return spriteId;
}
u8 sub_80DB120(void)
{
u8 spriteId;
LoadCompressedObjectPic(&gUnknown_08587C08);
LoadCompressedObjectPalette(&gUnknown_08587C10);
spriteId = CreateSprite(&gSpriteTemplate_8587C18, 96, 10, 29);
gSprites[spriteId].invisible = TRUE;
gSprites[spriteId].data[0] = gSprites[spriteId].oam.tileNum;
return spriteId;
}
u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index)
{
u8 spriteId;
species = sub_80DE84C(species);
if (index == gContestPlayerMonIndex)
HandleLoadSpecialPokePic_2(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality);
else
HandleLoadSpecialPokePic_DontHandleDeoxys(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality);
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
sub_806A068(species, 0);
spriteId = CreateSprite(&gUnknown_0202499C, 0x70, sub_80A600C(2, species, 0), 30);
gSprites[spriteId].oam.paletteNum = 2;
gSprites[spriteId].oam.priority = 2;
gSprites[spriteId].subpriority = sub_80A82E4(2);
gSprites[spriteId].callback = SpriteCallbackDummy;
gSprites[spriteId].data[0] = gSprites[spriteId].oam.paletteNum;
gSprites[spriteId].data[2] = species;
if (IsSpeciesNotUnown(species))
gSprites[spriteId].affineAnims = gUnknown_082FF6C0;
else
gSprites[spriteId].affineAnims = gUnknown_082FF694;
StartSpriteAffineAnim(gSprites + spriteId, 0);
return spriteId;
}