port pokemon size record

This commit is contained in:
DizzyEggg 2017-09-08 22:23:14 +02:00
parent 4d01d400a8
commit 44dbf4dea0
14 changed files with 1272 additions and 1513 deletions

View File

@ -28408,7 +28408,7 @@ _080556A0:
lsls r0, 16 lsls r0, 16
lsrs r0, 16 lsrs r0, 16
movs r1, 0x1 movs r1, 0x1
bl sub_80C0630 bl GetPokedexHeightWeight
ldrh r1, [r4] ldrh r1, [r4]
lsls r0, 16 lsls r0, 16
lsrs r0, 16 lsrs r0, 16

View File

@ -1,489 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_80F97C8
sub_80F97C8: @ 80F97C8
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
adds r5, r0, 0
movs r1, 0
bl GetMonData
lsls r0, 16
str r0, [sp, 0x4]
lsrs r0, 16
str r0, [sp]
adds r0, r5, 0
movs r1, 0x27
bl GetMonData
adds r7, r0, 0
movs r6, 0xF
ands r7, r6
adds r0, r5, 0
movs r1, 0x28
bl GetMonData
mov r8, r0
mov r1, r8
ands r1, r6
mov r8, r1
adds r0, r5, 0
movs r1, 0x29
bl GetMonData
mov r9, r0
mov r3, r9
ands r3, r6
mov r9, r3
adds r0, r5, 0
movs r1, 0x2A
bl GetMonData
mov r10, r0
ands r0, r6
mov r10, r0
adds r0, r5, 0
movs r1, 0x2B
bl GetMonData
adds r4, r0, 0
ands r4, r6
adds r0, r5, 0
movs r1, 0x2C
bl GetMonData
adds r2, r0, 0
ands r2, r6
mov r1, r8
mov r3, r9
eors r1, r3
mov r8, r1
mov r0, r8
muls r0, r7
movs r1, 0xFF
ldr r3, [sp]
ands r3, r1
eors r0, r3
eors r4, r2
mov r1, r10
muls r1, r4
ldr r3, [sp, 0x4]
lsrs r2, r3, 24
eors r1, r2
lsls r0, 8
adds r0, r1
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80F97C8
thumb_func_start sub_80F986C
sub_80F986C: @ 80F986C
push {lr}
lsls r0, 16
lsrs r2, r0, 16
movs r1, 0x1
ldr r3, =gUnknown_0858D8F0
_080F9876:
lsls r0, r1, 3
adds r0, r3
ldrh r0, [r0, 0x4]
cmp r2, r0
bcs _080F988C
subs r0, r1, 0x1
lsls r0, 24
lsrs r0, 24
b _080F9898
.pool
_080F988C:
adds r0, r1, 0x1
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0xE
bls _080F9876
adds r0, r1, 0
_080F9898:
pop {r1}
bx r1
thumb_func_end sub_80F986C
thumb_func_start sub_80F989C
sub_80F989C: @ 80F989C
push {r4-r7,lr}
sub sp, 0x8
adds r6, r1, 0
lsls r0, 16
lsrs r0, 16
lsls r6, 16
lsrs r6, 16
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl sub_80C0630
lsls r0, 16
lsrs r7, r0, 16
adds r0, r6, 0
bl sub_80F986C
lsls r0, 24
ldr r1, =gUnknown_0858D8F0
lsrs r0, 21
adds r0, r1
ldrh r1, [r0]
str r1, [sp]
movs r2, 0
str r2, [sp, 0x4]
ldrb r2, [r0, 0x2]
movs r3, 0
ldrh r4, [r0, 0x4]
movs r5, 0
adds r0, r6, 0
movs r1, 0
subs r0, r4
sbcs r1, r5
bl __udivdi3
ldr r2, [sp]
ldr r3, [sp, 0x4]
adds r2, r0
adcs r3, r1
str r2, [sp]
str r3, [sp, 0x4]
adds r0, r7, 0
movs r1, 0
bl __muldi3
movs r2, 0xA
movs r3, 0
bl __udivdi3
add sp, 0x8
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_80F989C
thumb_func_start sub_80F9910
sub_80F9910: @ 80F9910
push {r4,r5,lr}
adds r5, r0, 0
lsls r4, r1, 2
adds r4, r1
lsls r4, 1
adds r0, r4, 0
bl __floatsidf
cmp r4, 0
bge _080F992C
ldr r3, _080F9974
ldr r2, _080F9970
bl __adddf3
_080F992C:
ldr r2, _080F9978
ldr r3, _080F997C
bl __divdf3
bl __fixunsdfsi
adds r4, r0, 0
movs r1, 0xA
bl __udivsi3
adds r1, r0, 0
adds r0, r5, 0
movs r2, 0
movs r3, 0x8
bl ConvertIntToDecimalStringN
adds r5, r0, 0
ldr r1, _080F9980
bl StringAppend
adds r5, r0, 0
adds r0, r4, 0
movs r1, 0xA
bl __umodsi3
adds r1, r0, 0
adds r0, r5, 0
movs r2, 0
movs r3, 0x1
bl ConvertIntToDecimalStringN
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_080F9970: .4byte 0x41f00000
_080F9974: .4byte 0x00000000
_080F9978: .4byte 0x40396666
_080F997C: .4byte 0x66666666
_080F9980: .4byte gUnknown_085EED24
thumb_func_end sub_80F9910
thumb_func_start sub_80F9984
sub_80F9984: @ 80F9984
push {r4-r7,lr}
sub sp, 0x4
adds r7, r1, 0
lsls r0, 16
lsrs r6, r0, 16
ldr r1, =gScriptResult
ldrh r0, [r1]
cmp r0, 0xFF
bne _080F99A0
movs r0, 0
b _080F9A0A
.pool
_080F99A0:
ldrh r1, [r1]
movs r0, 0x64
muls r1, r0
ldr r0, =gPlayerParty
adds r5, r1, r0
adds r0, r5, 0
movs r1, 0x2D
bl GetMonData
cmp r0, 0x1
beq _080F99C2
adds r0, r5, 0
movs r1, 0xB
bl GetMonData
cmp r0, r6
beq _080F99CC
_080F99C2:
movs r0, 0x1
b _080F9A0A
.pool
_080F99CC:
mov r4, sp
adds r0, r5, 0
bl sub_80F97C8
strh r0, [r4]
mov r0, sp
ldrh r1, [r0]
adds r0, r6, 0
bl sub_80F989C
adds r5, r0, 0
ldrh r1, [r7]
adds r0, r6, 0
bl sub_80F989C
adds r4, r0, 0
ldr r0, =gStringVar2
adds r1, r5, 0
bl sub_80F9910
cmp r5, r4
bls _080F9A08
mov r0, sp
ldrh r0, [r0]
strh r0, [r7]
movs r0, 0x3
b _080F9A0A
.pool
_080F9A08:
movs r0, 0x2
_080F9A0A:
add sp, 0x4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80F9984
thumb_func_start sub_80F9A14
sub_80F9A14: @ 80F9A14
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
lsls r4, 16
lsrs r4, 16
ldrh r1, [r5]
adds r0, r4, 0
bl sub_80F989C
adds r1, r0, 0
ldr r0, =gStringVar3
bl sub_80F9910
ldr r0, =gStringVar1
movs r1, 0xB
muls r1, r4
ldr r2, =gSpeciesNames
adds r1, r2
bl StringCopy
ldrh r1, [r5]
movs r0, 0x80
lsls r0, 8
cmp r1, r0
bne _080F9A64
ldr r0, =gStringVar2
ldr r1, =gUnknown_085ECF6B
bl StringCopy
b _080F9A6E
.pool
_080F9A64:
ldr r0, =gStringVar2
ldr r1, =gSaveBlock2Ptr
ldr r1, [r1]
bl StringCopy
_080F9A6E:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80F9A14
thumb_func_start InitSeedotSizeRecord
InitSeedotSizeRecord: @ 80F9A7C
push {lr}
ldr r0, =0x00004047
movs r1, 0x80
lsls r1, 8
bl VarSet
pop {r0}
bx r0
.pool
thumb_func_end InitSeedotSizeRecord
thumb_func_start sub_80F9A90
sub_80F9A90: @ 80F9A90
push {lr}
ldr r0, =0x00004047
bl GetVarPointer
adds r1, r0, 0
movs r0, 0x95
lsls r0, 1
bl sub_80F9A14
pop {r0}
bx r0
.pool
thumb_func_end sub_80F9A90
thumb_func_start sub_80F9AAC
sub_80F9AAC: @ 80F9AAC
push {r4,lr}
ldr r0, =0x00004047
bl GetVarPointer
adds r1, r0, 0
ldr r4, =gScriptResult
movs r0, 0x95
lsls r0, 1
bl sub_80F9984
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80F9AAC
thumb_func_start InitLotadSizeRecord
InitLotadSizeRecord: @ 80F9AD4
push {lr}
ldr r0, =0x0000404f
movs r1, 0x80
lsls r1, 8
bl VarSet
pop {r0}
bx r0
.pool
thumb_func_end InitLotadSizeRecord
thumb_func_start sub_80F9AE8
sub_80F9AE8: @ 80F9AE8
push {lr}
ldr r0, =0x0000404f
bl GetVarPointer
adds r1, r0, 0
ldr r0, =0x00000127
bl sub_80F9A14
pop {r0}
bx r0
.pool
thumb_func_end sub_80F9AE8
thumb_func_start sub_80F9B04
sub_80F9B04: @ 80F9B04
push {r4,lr}
ldr r0, =0x0000404f
bl GetVarPointer
adds r1, r0, 0
ldr r4, =gScriptResult
ldr r0, =0x00000127
bl sub_80F9984
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80F9B04
thumb_func_start sub_80F9B30
sub_80F9B30: @ 80F9B30
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0xC
lsls r0, 24
lsrs r6, r0, 24
lsls r1, 24
lsrs r5, r1, 24
movs r7, 0
add r4, sp, 0x8
movs r0, 0x1
strb r0, [r4]
ldr r1, =gUnknown_0858D970
mov r0, sp
movs r2, 0x7
bl memcpy
mov r8, r4
cmp r6, 0xA
bhi _080F9BAC
cmp r5, 0x40
bhi _080F9BAC
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x000031a8
adds r0, r1
adds r0, r6
strb r5, [r0]
movs r5, 0
_080F9B6A:
movs r0, 0x64
adds r1, r5, 0
muls r1, r0
ldr r0, =gPlayerParty
adds r4, r1, r0
adds r0, r4, 0
movs r1, 0xB
bl GetMonData
cmp r0, 0
beq _080F9B9C
adds r0, r4, 0
movs r1, 0x6
bl GetMonData
cmp r0, 0
bne _080F9B9C
mov r1, sp
adds r0, r1, r6
ldrb r1, [r0]
adds r0, r4, 0
mov r2, r8
bl SetMonData
movs r7, 0x1
_080F9B9C:
adds r5, 0x1
cmp r5, 0x5
ble _080F9B6A
cmp r7, 0
beq _080F9BAC
ldr r0, =0x0000089b
bl FlagSet
_080F9BAC:
add sp, 0xC
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80F9B30
.align 2, 0 @ Don't pad with nop.

View File

@ -513,7 +513,7 @@ sub_8153BB0: @ 8153BB0
ldrb r1, [r2] ldrb r1, [r2]
adds r2, 0x1 adds r2, 0x1
str r2, [r4, 0x8] str r2, [r4, 0x8]
bl sub_80F9B30 bl GiveGiftRibbonToParty
ldr r0, =gStringVar4 ldr r0, =gStringVar4
ldr r1, =gUnknown_08674B6A ldr r1, =gUnknown_08674B6A
bl StringExpandPlaceholders bl StringExpandPlaceholders

View File

@ -9377,8 +9377,8 @@ sub_80C0620: @ 80C0620
.pool .pool
thumb_func_end sub_80C0620 thumb_func_end sub_80C0620
thumb_func_start sub_80C0630 thumb_func_start GetPokedexHeightWeight
sub_80C0630: @ 80C0630 GetPokedexHeightWeight: @ 80C0630
push {lr} push {lr}
lsls r0, 16 lsls r0, 16
lsrs r2, r0, 16 lsrs r2, r0, 16
@ -9406,7 +9406,7 @@ _080C065C:
pop {r1} pop {r1}
bx r1 bx r1
.pool .pool
thumb_func_end sub_80C0630 thumb_func_end GetPokedexHeightWeight
thumb_func_start pokedex_flag_operation thumb_func_start pokedex_flag_operation
@ u8 pokedex_flag_operation(u16 nationalPokedexNum, u8 op) @ u8 pokedex_flag_operation(u16 nationalPokedexNum, u8 op)

File diff suppressed because it is too large Load Diff

8
data/data3a.s Normal file
View File

@ -0,0 +1,8 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
@ unknown unreferenced data
.incbin "baserom.gba", 0x58d977, 0x2a1

1014
data/data3b.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2231,7 +2231,7 @@ gUnknown_085ECF5D:: @ 85ECF5D
.string "{STR_VAR_1} fainted\p\n$" .string "{STR_VAR_1} fainted\p\n$"
gUnknown_085ECF6B:: @ 85ECF6B gOtherText_Marco:: @ 85ECF6B
.string "MARCO$" .string "MARCO$"
@ -3302,7 +3302,7 @@ gUnknown_085EED0A:: @ 85EED0A
.string "Same {PKMN} in party already.$" .string "Same {PKMN} in party already.$"
gUnknown_085EED24:: @ 85EED24 gOtherText_DecimalPoint:: @ 85EED24
.string ".$" .string ".$"

12
include/config.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_CONFIG_H
#define GUARD_CONFIG_H
#define ENGLISH
#ifdef ENGLISH
#define UNITS_IMPERIAL
#else
#define UNITS_METRIC
#endif
#endif // GUARD_CONFIG_H

View File

@ -2,6 +2,7 @@
#define GUARD_GLOBAL_H #define GUARD_GLOBAL_H
#include "gba/gba.h" #include "gba/gba.h"
#include "config.h"
// Prevent cross-jump optimization. // Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm(""); #define BLOCK_CROSS_JUMP asm("");

View File

@ -9,4 +9,6 @@ void InitLotadSizeRecord(void);
void GetLotadSizeRecordInfo(void); void GetLotadSizeRecordInfo(void);
void CompareLotadSize(void); void CompareLotadSize(void);
void GiveGiftRibbonToParty(u8 index, u8 ribbonId);
#endif // GUARD_POKEMON_SIZE_RECORD_H #endif // GUARD_POKEMON_SIZE_RECORD_H

View File

@ -30,14 +30,14 @@
#define VAR_DEPT_STORE_FLOOR 0x4043 #define VAR_DEPT_STORE_FLOOR 0x4043
#define VAR_POKELOT_PRIZE 0x4045 #define VAR_POKELOT_PRIZE 0x4045
#define VAR_NATIONAL_DEX 0x4046 #define VAR_NATIONAL_DEX 0x4046
#define VAR_SHROOMISH_SIZE_RECORD 0x4047 #define VAR_SEEDOT_SIZE_RECORD 0x4047
#define VAR_ASH_GATHER_COUNT 0x4048 #define VAR_ASH_GATHER_COUNT 0x4048
#define VAR_BIRCH_STATE 0x4049 #define VAR_BIRCH_STATE 0x4049
#define VAR_CRUISE_STEP_COUNT 0x404A #define VAR_CRUISE_STEP_COUNT 0x404A
#define VAR_POKELOT_RND1 0x404B #define VAR_POKELOT_RND1 0x404B
#define VAR_POKELOT_RND2 0x404C #define VAR_POKELOT_RND2 0x404C
#define VAR_BARBOACH_SIZE_RECORD 0x404F #define VAR_LOTAD_SIZE_RECORD 0x404F
#define VAR_0x4054 0x4054 #define VAR_0x4054 0x4054

View File

@ -146,7 +146,7 @@ SECTIONS {
asm/contest_link_80F57C4.o(.text); asm/contest_link_80F57C4.o(.text);
asm/script_pokemon_util_80F87D8.o(.text); asm/script_pokemon_util_80F87D8.o(.text);
asm/field_poison.o(.text); asm/field_poison.o(.text);
asm/big_shroomish_barboach.o(.text); src/pokemon_size_record.o(.text);
asm/fldeff_80F9BCC.o(.text); asm/fldeff_80F9BCC.o(.text);
asm/truck_scene.o(.text); asm/truck_scene.o(.text);
asm/porthole.o(.text); asm/porthole.o(.text);
@ -302,6 +302,9 @@ SECTIONS {
data/data2c.o(.rodata); data/data2c.o(.rodata);
src/trig.o(.rodata); src/trig.o(.rodata);
data/data3.o(.rodata); data/data3.o(.rodata);
src/pokemon_size_record.o(.rodata)
data/data3a.o(.rodata)
data/data3b.o(.rodata);
src/battle_ai.o(.rodata); src/battle_ai.o(.rodata);
data/data4.o(.rodata); data/data4.o(.rodata);
data/battle_controller_link_partner.o(.rodata); data/battle_controller_link_partner.o(.rodata);

222
src/pokemon_size_record.c Normal file
View File

@ -0,0 +1,222 @@
#include "global.h"
#include "pokemon_size_record.h"
#include "event_data.h"
#include "species.h"
#include "string_util.h"
#include "text.h"
#include "pokemon.h"
#define DEFAULT_MAX_SIZE 0x8000 // was 0x8100 in Ruby/Sapphire
struct UnknownStruct
{
u16 unk0;
u8 unk2;
u16 unk4;
};
extern u16 GetPokedexHeightWeight(u16 dexNo, bool8 height);
extern u16 SpeciesToNationalPokedexNum(u16 species);
static const struct UnknownStruct sBigMonSizeTable[] =
{
{ 290, 1, 0 },
{ 300, 1, 10 },
{ 400, 2, 110 },
{ 500, 4, 310 },
{ 600, 20, 710 },
{ 700, 50, 2710 },
{ 800, 100, 7710 },
{ 900, 150, 17710 },
{ 1000, 150, 32710 },
{ 1100, 100, -17826 },
{ 1200, 50, -7826 },
{ 1300, 20, -2826 },
{ 1400, 5, -826 },
{ 1500, 2, -326 },
{ 1600, 1, -126 },
{ 1700, 1, -26 },
};
static const u8 sGiftRibbonsMonDataIds[] =
{
MON_DATA_GIFT_RIBBON_1, MON_DATA_GIFT_RIBBON_2, MON_DATA_GIFT_RIBBON_3,
MON_DATA_GIFT_RIBBON_4, MON_DATA_GIFT_RIBBON_5, MON_DATA_GIFT_RIBBON_6,
MON_DATA_GIFT_RIBBON_7
};
extern const u8 gOtherText_DecimalPoint[];
extern const u8 gOtherText_Marco[];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
#define CM_PER_INCH 2.54
static u32 GetMonSizeHash(struct Pokemon *pkmn)
{
u16 personality = GetMonData(pkmn, MON_DATA_PERSONALITY);
u16 hpIV = GetMonData(pkmn, MON_DATA_HP_IV) & 0xF;
u16 attackIV = GetMonData(pkmn, MON_DATA_ATK_IV) & 0xF;
u16 defenseIV = GetMonData(pkmn, MON_DATA_DEF_IV) & 0xF;
u16 speedIV = GetMonData(pkmn, MON_DATA_SPD_IV) & 0xF;
u16 spAtkIV = GetMonData(pkmn, MON_DATA_SPATK_IV) & 0xF;
u16 spDefIV = GetMonData(pkmn, MON_DATA_SPDEF_IV) & 0xF;
u32 hibyte = ((attackIV ^ defenseIV) * hpIV) ^ (personality & 0xFF);
u32 lobyte = ((spAtkIV ^ spDefIV) * speedIV) ^ (personality >> 8);
return (hibyte << 8) + lobyte;
}
static u8 TranslateBigMonSizeTableIndex(u16 a)
{
u8 i;
for (i = 1; i < 15; i++)
{
if (a < sBigMonSizeTable[i].unk4)
return i - 1;
}
return i;
}
static u32 GetMonSize(u16 species, u16 b)
{
u64 unk2;
u64 unk4;
u64 unk0;
u32 height;
u32 var;
height = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(species), 0);
var = TranslateBigMonSizeTableIndex(b);
unk0 = sBigMonSizeTable[var].unk0;
unk2 = sBigMonSizeTable[var].unk2;
unk4 = sBigMonSizeTable[var].unk4;
unk0 += (b - unk4) / unk2;
return height * unk0 / 10;
}
static void FormatMonSizeRecord(u8 *string, u32 size)
{
#ifdef UNITS_IMPERIAL
//Convert size from centimeters to inches
size = (double)(size * 10) / (CM_PER_INCH * 10);
#endif
string = ConvertIntToDecimalStringN(string, size / 10, 0, 8);
string = StringAppend(string, gOtherText_DecimalPoint);
ConvertIntToDecimalStringN(string, size % 10, 0, 1);
}
static u8 CompareMonSize(u16 species, u16 *sizeRecord)
{
if (gScriptResult == 0xFF)
{
return 0;
}
else
{
struct Pokemon *pkmn = &gPlayerParty[gScriptResult];
if (GetMonData(pkmn, MON_DATA_IS_EGG) == TRUE || GetMonData(pkmn, MON_DATA_SPECIES) != species)
{
return 1;
}
else
{
u32 oldSize;
u32 newSize;
u16 sizeParams;
*(&sizeParams) = GetMonSizeHash(pkmn);
newSize = GetMonSize(species, sizeParams);
oldSize = GetMonSize(species, *sizeRecord);
FormatMonSizeRecord(gStringVar2, newSize);
if (newSize <= oldSize)
{
return 2;
}
else
{
*sizeRecord = sizeParams;
return 3;
}
}
}
}
// Stores species name in gStringVar1, trainer's name in gStringVar2, and size in gStringVar3
static void GetMonSizeRecordInfo(u16 species, u16 *sizeRecord)
{
u32 size = GetMonSize(species, *sizeRecord);
FormatMonSizeRecord(gStringVar3, size);
StringCopy(gStringVar1, gSpeciesNames[species]);
if (*sizeRecord == DEFAULT_MAX_SIZE)
StringCopy(gStringVar2, gOtherText_Marco);
else
StringCopy(gStringVar2, gSaveBlock2Ptr->playerName);
}
void InitSeedotSizeRecord(void)
{
VarSet(VAR_SEEDOT_SIZE_RECORD, DEFAULT_MAX_SIZE);
}
void GetSeedotSizeRecordInfo(void)
{
u16 *sizeRecord = GetVarPointer(VAR_SEEDOT_SIZE_RECORD);
GetMonSizeRecordInfo(SPECIES_SEEDOT, sizeRecord);
}
void CompareSeedotSize(void)
{
u16 *sizeRecord = GetVarPointer(VAR_SEEDOT_SIZE_RECORD);
gScriptResult = CompareMonSize(SPECIES_SEEDOT, sizeRecord);
}
void InitLotadSizeRecord(void)
{
VarSet(VAR_LOTAD_SIZE_RECORD, DEFAULT_MAX_SIZE);
}
void GetLotadSizeRecordInfo(void)
{
u16 *sizeRecord = GetVarPointer(VAR_LOTAD_SIZE_RECORD);
GetMonSizeRecordInfo(SPECIES_LOTAD, sizeRecord);
}
void CompareLotadSize(void)
{
u16 *sizeRecord = GetVarPointer(VAR_LOTAD_SIZE_RECORD);
gScriptResult = CompareMonSize(SPECIES_LOTAD, sizeRecord);
}
void GiveGiftRibbonToParty(u8 index, u8 ribbonId)
{
s32 i;
bool32 gotRibbon = FALSE;
u8 data = 1;
u8 array[8];
memcpy(array, sGiftRibbonsMonDataIds, sizeof(sGiftRibbonsMonDataIds));
if (index < 11 && ribbonId < 65)
{
gSaveBlock1Ptr->giftRibbons[index] = ribbonId;
for (i = 0; i < 6; i++)
{
struct Pokemon *pkmn = &gPlayerParty[i];
if (GetMonData(pkmn, MON_DATA_SPECIES) != 0 && GetMonData(pkmn, MON_DATA_SANITY_BIT3) == 0)
{
SetMonData(pkmn, array[index], &data);
gotRibbon = TRUE;
}
}
if (gotRibbon)
FlagSet(SYS_RIBBON_GET);
}
}