sub_8018220

This commit is contained in:
PikalaxALT 2019-03-30 09:18:58 -04:00
parent 2e588fd4d7
commit 2f57d6bc0f
4 changed files with 73 additions and 206 deletions

View File

@ -5,211 +5,6 @@
.text
thumb_func_start sub_8018220
sub_8018220: @ 8018220
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
mov r9, r1
lsls r2, 24
lsrs r2, 24
str r2, [sp]
bl GetMultiplayerId
movs r1, 0x1
eors r0, r1
lsls r0, 24
lsrs r0, 24
movs r1, 0x64
muls r1, r0
ldr r0, =gTrainerCards
adds r1, r0
mov r8, r1
bl DynamicPlaceholderTextUtil_Reset
mov r6, r9
adds r6, 0xC0
bl sub_8068BB0
lsls r0, 16
lsrs r0, 16
movs r1, 0xD
muls r1, r0
ldr r0, =gTrainerClassNames
adds r1, r0
adds r0, r6, 0
bl StringCopy
movs r0, 0
adds r1, r6, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
mov r1, r8
adds r1, 0x30
movs r0, 0x1
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r4, 0xBA
lsls r4, 1
add r4, r9
ldr r1, =gUnknown_082EFF50
mov r2, r8
ldrb r0, [r2, 0x1]
lsls r0, 2
adds r0, r1
ldr r1, [r0]
adds r0, r4, 0
bl StringCopy
movs r0, 0x2
adds r1, r4, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
mov r5, r9
adds r5, 0xDE
mov r0, r8
ldrh r1, [r0, 0xC]
adds r0, r5, 0
movs r2, 0
movs r3, 0x3
bl ConvertIntToDecimalStringN
movs r0, 0x3
adds r1, r5, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r2, 0xED
add r2, r9
mov r10, r2
mov r0, r8
ldrh r1, [r0, 0x10]
mov r0, r10
movs r2, 0
movs r3, 0x3
bl ConvertIntToDecimalStringN
mov r4, r9
adds r4, 0xFC
mov r2, r8
ldrh r1, [r2, 0x12]
adds r0, r4, 0
movs r2, 0x2
movs r3, 0x2
bl ConvertIntToDecimalStringN
movs r0, 0x4
mov r1, r10
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r0, 0x5
adds r1, r4, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r4, 0xD2
lsls r4, 1
add r4, r9
ldr r1, =gUnknown_082EFF64
adds r0, r4, 0
bl DynamicPlaceholderTextUtil_ExpandPlaceholders
ldr r0, =gStringVar4
adds r1, r4, 0
bl StringCopy
mov r0, r8
ldrh r1, [r0, 0x14]
ldr r4, =0x0000270f
cmp r1, r4
ble _0801830C
adds r1, r4, 0
_0801830C:
adds r0, r6, 0
movs r2, 0
movs r3, 0x4
bl ConvertIntToDecimalStringN
movs r0, 0
adds r1, r6, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
mov r2, r8
ldrh r1, [r2, 0x16]
cmp r1, r4
ble _08018328
adds r1, r4, 0
_08018328:
mov r4, r9
adds r4, 0xCF
adds r0, r4, 0
movs r2, 0
movs r3, 0x4
bl ConvertIntToDecimalStringN
movs r0, 0x2
adds r1, r4, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
mov r0, r8
ldrh r1, [r0, 0x20]
adds r0, r5, 0
movs r2, 0
movs r3, 0x5
bl ConvertIntToDecimalStringN
movs r0, 0x3
adds r1, r5, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r7, 0
movs r6, 0x80
lsls r6, 19
mov r5, r8
adds r5, 0x28
mov r4, r10
_08018360:
ldrh r1, [r5]
adds r0, r4, 0
bl CopyEasyChatWord
lsrs r0, r6, 24
adds r1, r4, 0
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
movs r2, 0x80
lsls r2, 17
adds r6, r2
adds r5, 0x2
adds r4, 0xF
adds r7, 0x1
cmp r7, 0x3
ble _08018360
movs r4, 0xD2
lsls r4, 1
add r4, r9
ldr r1, =gUnknown_082EFFA4
adds r0, r4, 0
bl DynamicPlaceholderTextUtil_ExpandPlaceholders
ldr r5, =gStringVar4
adds r0, r5, 0
adds r1, r4, 0
bl StringAppend
ldr r0, [sp]
cmp r0, 0x1
bne _080183D0
ldr r1, =gUnknown_082F0020
adds r0, r4, 0
bl DynamicPlaceholderTextUtil_ExpandPlaceholders
adds r0, r5, 0
adds r1, r4, 0
bl StringAppend
b _080183F0
.pool
_080183D0:
ldr r2, [sp]
cmp r2, 0
bne _080183F0
ldr r0, =gUnknown_082F0018
mov r2, r8
ldrb r1, [r2]
lsls r1, 2
adds r1, r0
ldr r1, [r1]
adds r0, r4, 0
bl DynamicPlaceholderTextUtil_ExpandPlaceholders
adds r0, r5, 0
adds r1, r4, 0
bl StringAppend
_080183F0:
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8018220
thumb_func_start sub_8018404
sub_8018404: @ 8018404
push {r4,r5,lr}

View File

@ -776,5 +776,6 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gMultiUsePlayerCursor;
extern u8 gNumberOfMovesToChoose;
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
extern const u8 gTrainerClassNames[][13];
#endif // GUARD_BATTLE_H

View File

@ -123,6 +123,9 @@ struct UnkStruct_URoom
u16 field_98;
u16 field_9A[3];
struct UnkStruct_8019BA8 field_A0[8];
u8 field_C0[12][15];
u8 field_174[48];
u8 field_1A4[200];
};
union UnkUnion_Main

View File

@ -41,6 +41,7 @@
#include "mevent.h"
#include "dynamic_placeholder_text_util.h"
#include "rom_8011DC0.h"
#include "easy_chat.h"
#include "event_obj_lock.h"
EWRAM_DATA u8 gUnknown_02022C20[12] = {};
@ -3266,7 +3267,7 @@ void UnionRoomSpecial(void)
// dumb line needed to match
gUnknown_02022C30.uRoom = gUnknown_02022C30.uRoom;
dataPtr = AllocZeroed(0x26C);
dataPtr = AllocZeroed(sizeof(*gUnknown_02022C30.uRoom));
gUnknown_02022C30.uRoom = dataPtr;
gUnknown_03000DA8 = dataPtr;
@ -5315,3 +5316,70 @@ u8 sub_80181DC(struct UnkStruct_URoom *arg0)
return retVal;
}
void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2)
{
struct TrainerCard *trainerCard = &gTrainerCards[GetMultiplayerId() ^ 1];
s32 i;
s32 n;
DynamicPlaceholderTextUtil_Reset();
StringCopy(arg1->field_C0[0], gTrainerClassNames[sub_8068BB0()]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, arg1->field_C0[0]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, trainerCard->playerName);
StringCopy(arg1->field_174, gUnknown_082EFF50[trainerCard->stars]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, arg1->field_174);
ConvertIntToDecimalStringN(arg1->field_C0[2], trainerCard->caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, arg1->field_C0[2]);
ConvertIntToDecimalStringN(arg1->field_C0[3], trainerCard->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(arg1->field_C0[4], trainerCard->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, arg1->field_C0[3]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, arg1->field_C0[4]);
DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082EFF64);
StringCopy(gStringVar4, arg1->field_1A4);
n = trainerCard->linkBattleWins;
if (n > 9999)
{
n = 9999;
}
ConvertIntToDecimalStringN(arg1->field_C0[0], n, STR_CONV_MODE_LEFT_ALIGN, 4);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, arg1->field_C0[0]);
n = trainerCard->linkBattleLosses;
if (n > 9999)
{
n = 9999;
}
ConvertIntToDecimalStringN(arg1->field_C0[1], n, STR_CONV_MODE_LEFT_ALIGN, 4);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, arg1->field_C0[1]);
ConvertIntToDecimalStringN(arg1->field_C0[2], trainerCard->pokemonTrades, STR_CONV_MODE_LEFT_ALIGN, 5);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, arg1->field_C0[2]);
for (i = 0; i < 4; i++)
{
CopyEasyChatWord(arg1->field_C0[i + 3], trainerCard->var_28[i]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(i + 4, arg1->field_C0[i + 3]);
}
DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082EFFA4);
StringAppend(gStringVar4, arg1->field_1A4);
if (arg2 == TRUE)
{
DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082F0020);
StringAppend(gStringVar4, arg1->field_1A4);
}
else if (arg2 == FALSE)
{
DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, gUnknown_082F0018[trainerCard->gender]);
StringAppend(gStringVar4, arg1->field_1A4);
}
}