mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-04-25 15:49:02 -05:00
Document accessory related functions
This commit is contained in:
parent
9b83baf1dc
commit
9485e2aca7
|
|
@ -2974,10 +2974,10 @@
|
|||
.short \destVarID
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_217 arg0, arg1
|
||||
.macro CalcAmitySquareFoundAccessory destFoundAccessoryID, followerSpecies
|
||||
.short 535
|
||||
.short \arg0
|
||||
.short \arg1
|
||||
.short \destFoundAccessoryID
|
||||
.short \followerSpecies
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_218 arg0
|
||||
|
|
@ -3455,9 +3455,9 @@
|
|||
.short \arg0
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_26C arg0
|
||||
.macro TryGetRandomMassageGirlAccessory destAccessoryID
|
||||
.short 620
|
||||
.short \arg0
|
||||
.short \destAccessoryID
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_26D arg0
|
||||
|
|
@ -4095,9 +4095,9 @@
|
|||
.short \arg4
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_2DF arg0
|
||||
.macro CalcAmitySquareBerryAndAccessoryManOptionID destBerryAndAccessoryManOptionID
|
||||
.short 735
|
||||
.short \arg0
|
||||
.short \destBerryAndAccessoryManOptionID
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_2E0 arg0, arg1
|
||||
|
|
@ -4106,10 +4106,10 @@
|
|||
.short \arg1
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_2E1 arg0, arg1
|
||||
.macro GetAmitySquareBerryOrAccessoryIDFromMan berryAndAccessoryManOptionID, destBerryOrAccessoryID
|
||||
.short 737
|
||||
.short \arg0
|
||||
.short \arg1
|
||||
.short \berryAndAccessoryManOptionID
|
||||
.short \destBerryOrAccessoryID
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_2E2
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ metang_exe = find_program('metang', native: true)
|
|||
|
||||
metang_generators = {
|
||||
'abilities': { 'type': 'enum', 'tag': 'Ability' },
|
||||
'accessories': {'type': 'enum', 'tag': 'Accessories'},
|
||||
'accessories': {'type': 'enum', 'tag': 'Accessory'},
|
||||
'ai_action_choices': { 'type': 'enum', 'tag': 'AIActionChoice' },
|
||||
'ai_flags': { 'type': 'mask', 'tag': 'AIFlag', 'extra': ['--no-auto'] },
|
||||
'ai_load_type_targets': { 'type': 'enum', 'tag': 'AILoadTypeTarget' },
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef POKEPLATINUM_CONSTANTS_SCRCMD_H
|
||||
#define POKEPLATINUM_CONSTANTS_SCRCMD_H
|
||||
|
||||
#include "generated/accessories.h"
|
||||
|
||||
#define MENU_YES 0
|
||||
#define MENU_NO 1
|
||||
|
||||
|
|
@ -12,4 +14,6 @@
|
|||
|
||||
#define NO_EXIT_ON_B FALSE
|
||||
|
||||
#define NUM_MASSAGE_GIRL_ACCESSORIES (ACCESSORY_GLITTER_POWDER - ACCESSORY_PRETTY_DEWDROP + 1)
|
||||
|
||||
#endif // POKEPLATINUM_CONSTANTS_SCRCMD_H
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
|
||||
#include "field_script_context.h"
|
||||
|
||||
#define NUM_FINDABLE_ACCESSORY_POOLS 6
|
||||
#define NUM_ACCESSORIES_FINDABLE_BY_MON 10
|
||||
|
||||
BOOL ScrCmd_ClearAmitySquareStepCount(ScriptContext *ctx);
|
||||
BOOL ScrCmd_GetAmitySquareStepCount(ScriptContext *ctx);
|
||||
BOOL ScrCmd_217(ScriptContext *param0);
|
||||
BOOL ScrCmd_2DF(ScriptContext *param0);
|
||||
BOOL ScrCmd_CalcAmitySquareFoundAccessory(ScriptContext *ctx);
|
||||
BOOL ScrCmd_CalcAmitySquareBerryAndAccessoryManOptionID(ScriptContext *ctx);
|
||||
BOOL ScrCmd_2E0(ScriptContext *param0);
|
||||
BOOL ScrCmd_2E1(ScriptContext *param0);
|
||||
BOOL ScrCmd_GetAmitySquareBerryOrAccessoryIDFromMan(ScriptContext *ctx);
|
||||
|
||||
#endif // POKEPLATINUM_UNK_0204CDDC_H
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
_00B6:
|
||||
SetFlag FLAG_UNK_0x09CC
|
||||
SetFlag FLAG_UNK_0x02A1
|
||||
ScrCmd_2DF 0x40AB
|
||||
CalcAmitySquareBerryAndAccessoryManOptionID 0x40AB
|
||||
GetRandom 0x4002, 5
|
||||
GoToIfEq 0x4002, 0, _00FE
|
||||
GoToIfEq 0x4002, 1, _0108
|
||||
|
|
@ -305,7 +305,7 @@ _03DC:
|
|||
GetRandom 0x800C, 5
|
||||
CallIfEq 0x800C, 0, _040A
|
||||
CallIfNe 0x800C, 0, _0412
|
||||
ScrCmd_217 0x409C, 0x409A
|
||||
CalcAmitySquareFoundAccessory 0x409C, 0x409A
|
||||
GoTo _041A
|
||||
End
|
||||
|
||||
|
|
@ -999,7 +999,7 @@ _10AA:
|
|||
FacePlayer
|
||||
GoToIfSet FLAG_UNK_0x0AB5, _117C
|
||||
Message 36
|
||||
ScrCmd_2E1 0x40AB, 0x8004
|
||||
GetAmitySquareBerryOrAccessoryIDFromMan 0x40AB, 0x8004
|
||||
ScrCmd_2E0 0x40AB, 0x800C
|
||||
GoToIfEq 0x800C, 0, _10E1
|
||||
GoTo _1136
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ _000E:
|
|||
Message 4
|
||||
SetFlag FLAG_UNK_0x0AAC
|
||||
ScrCmd_1BA 3, 0x4000
|
||||
ScrCmd_26C 0x8004
|
||||
TryGetRandomMassageGirlAccessory 0x8004
|
||||
GoToIfEq 0x8004, -1, _00F6
|
||||
Message 7
|
||||
SetVar 0x8005, 1
|
||||
|
|
|
|||
51
src/scrcmd.c
51
src/scrcmd.c
|
|
@ -648,7 +648,7 @@ static BOOL ScrCmd_268(ScriptContext *ctx);
|
|||
static BOOL ScrCmd_269(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_26A(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_26B(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_26C(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_TryGetRandomMassageGirlAccessory(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_GetGBACartridgeVersion(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_SetHiddenLocation(ScriptContext *ctx);
|
||||
static BOOL ScrCmd_273(ScriptContext *ctx);
|
||||
|
|
@ -1301,7 +1301,7 @@ const ScrCmdFunc Unk_020EAC58[] = {
|
|||
ScrCmd_GetSpiritombCounter,
|
||||
ScrCmd_ClearAmitySquareStepCount,
|
||||
ScrCmd_GetAmitySquareStepCount,
|
||||
ScrCmd_217,
|
||||
ScrCmd_CalcAmitySquareFoundAccessory,
|
||||
ScrCmd_218,
|
||||
ScrCmd_SetNewsPressDeadline,
|
||||
ScrCmd_GetNewsPressDeadline,
|
||||
|
|
@ -1386,7 +1386,7 @@ const ScrCmdFunc Unk_020EAC58[] = {
|
|||
ScrCmd_269,
|
||||
ScrCmd_26A,
|
||||
ScrCmd_26B,
|
||||
ScrCmd_26C,
|
||||
ScrCmd_TryGetRandomMassageGirlAccessory,
|
||||
ScrCmd_26D,
|
||||
ScrCmd_GetGBACartridgeVersion,
|
||||
ScrCmd_ClearSpiritombCounter,
|
||||
|
|
@ -1501,9 +1501,9 @@ const ScrCmdFunc Unk_020EAC58[] = {
|
|||
ScrCmd_2DC,
|
||||
ScrCmd_FindPartySlotWithSpecies,
|
||||
ScrCmd_2DE,
|
||||
ScrCmd_2DF,
|
||||
ScrCmd_CalcAmitySquareBerryAndAccessoryManOptionID,
|
||||
ScrCmd_2E0,
|
||||
ScrCmd_2E1,
|
||||
ScrCmd_GetAmitySquareBerryOrAccessoryIDFromMan,
|
||||
ScrCmd_2E2,
|
||||
ScrCmd_2E3,
|
||||
ScrCmd_2E4,
|
||||
|
|
@ -6937,49 +6937,48 @@ static BOOL ScrCmd_26B(ScriptContext *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static BOOL ScrCmd_26C(ScriptContext *ctx)
|
||||
static BOOL ScrCmd_TryGetRandomMassageGirlAccessory(ScriptContext *ctx)
|
||||
{
|
||||
UnkStruct_0202A750 *v0;
|
||||
UnkStruct_02029D04 *v1;
|
||||
u16 v2[16];
|
||||
int v3, v4, v5, v6;
|
||||
u16 *accessoryID = ScriptContext_GetVarPointer(ctx);
|
||||
u16 hasAccessory[NUM_MASSAGE_GIRL_ACCESSORIES];
|
||||
int i;
|
||||
u16 *destAccessoryID = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
v0 = sub_0202A750(ctx->fieldSystem->saveData);
|
||||
v1 = sub_02029D04(v0);
|
||||
|
||||
v4 = 0;
|
||||
int unobtainedAccessoryCount = 0;
|
||||
|
||||
for (v3 = 0; v3 < (ACCESSORY_GLITTER_POWDER - ACCESSORY_PRETTY_DEWDROP + 1); v3++) {
|
||||
if (sub_02029D50(v1, ACCESSORY_PRETTY_DEWDROP + v3, 1) == 1) {
|
||||
v2[v3] = 1;
|
||||
v4++;
|
||||
for (i = 0; i < NUM_MASSAGE_GIRL_ACCESSORIES; i++) {
|
||||
if (sub_02029D50(v1, ACCESSORY_PRETTY_DEWDROP + i, 1) == 1) {
|
||||
hasAccessory[i] = TRUE;
|
||||
unobtainedAccessoryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (v4 == 0) {
|
||||
*accessoryID = -1;
|
||||
return 0;
|
||||
if (unobtainedAccessoryCount == 0) {
|
||||
*destAccessoryID = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
v5 = LCRNG_Next() % v4;
|
||||
int rand = LCRNG_Next() % unobtainedAccessoryCount;
|
||||
|
||||
for (v3 = 0; v3 < (ACCESSORY_GLITTER_POWDER - ACCESSORY_PRETTY_DEWDROP + 1); v3++) {
|
||||
if (v2[v3] == 1) {
|
||||
if (v5 == 0) {
|
||||
for (i = 0; i < NUM_MASSAGE_GIRL_ACCESSORIES; i++) {
|
||||
if (hasAccessory[i] == TRUE) {
|
||||
if (rand == 0) {
|
||||
break;
|
||||
} else {
|
||||
v5--;
|
||||
rand--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GF_ASSERT(v3 < (ACCESSORY_GLITTER_POWDER - ACCESSORY_PRETTY_DEWDROP + 1));
|
||||
GF_ASSERT(i < NUM_MASSAGE_GIRL_ACCESSORIES);
|
||||
|
||||
v6 = ACCESSORY_PRETTY_DEWDROP + v3;
|
||||
*accessoryID = v6;
|
||||
*destAccessoryID = ACCESSORY_PRETTY_DEWDROP + i;
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL ScrCmd_GetGBACartridgeVersion(ScriptContext *ctx)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ BOOL ScrCmd_GetAmitySquareStepCount(ScriptContext *ctx)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static const u16 Unk_020EBF84[6][10] = {
|
||||
static const u16 sMonFindableAccessories[NUM_FINDABLE_ACCESSORY_POOLS][NUM_ACCESSORIES_FINDABLE_BY_MON] = {
|
||||
{ ACCESSORY_WHITE_FLUFF, ACCESSORY_ORANGE_FLUFF, ACCESSORY_WHITE_FEATHER, ACCESSORY_ROUND_PEBBLE, ACCESSORY_SMALL_LEAF, ACCESSORY_BLUE_SCALE, ACCESSORY_WHITE_BEARD, ACCESSORY_THIN_MUSHROOM, ACCESSORY_BIG_SCALE, ACCESSORY_STUMP }, // Chimchar, Monferno, Infernape
|
||||
{ ACCESSORY_PINK_FLUFF, ACCESSORY_RED_FEATHER, ACCESSORY_YELLOW_FEATHER, ACCESSORY_BLACK_BEARD, ACCESSORY_NARROW_SCALE, ACCESSORY_WHITE_FLUFF, ACCESSORY_WHITE_MOUSTACHE, ACCESSORY_SHED_CLAW, ACCESSORY_NARROW_LEAF, ACCESSORY_PURPLE_SCALE }, // Piplup, Prinplup, Empoleon
|
||||
{ ACCESSORY_JAGGED_BOULDER, ACCESSORY_SNAGGY_PEBBLE, ACCESSORY_BROWN_FLUFF, ACCESSORY_ROUND_PEBBLE, ACCESSORY_BLACK_MOUSTACHE, ACCESSORY_SHED_HOWN, ACCESSORY_NARROW_SCALE, ACCESSORY_GLITTER_BOULDER, ACCESSORY_GREEN_SCALE, ACCESSORY_THICK_MUSHROOM }, // Turtwig, Grotle, Torterra
|
||||
|
|
@ -34,81 +34,80 @@ static const u16 Unk_020EBF84[6][10] = {
|
|||
{ ACCESSORY_PINK_SCALE, ACCESSORY_SHED_HOWN, ACCESSORY_PINK_FLUFF, ACCESSORY_YELLOW_FEATHER, ACCESSORY_SHED_CLAW, ACCESSORY_BLACK_FLUFF, ACCESSORY_JAGGED_BOULDER, ACCESSORY_BIG_LEAF, ACCESSORY_GREEN_SCALE, ACCESSORY_BLACK_PEBBLE } // Jigglypuff, Torchic, Skitty, Shroomish
|
||||
};
|
||||
|
||||
BOOL ScrCmd_217(ScriptContext *ctx)
|
||||
BOOL ScrCmd_CalcAmitySquareFoundAccessory(ScriptContext *ctx)
|
||||
{
|
||||
u8 i, j;
|
||||
u16 rand;
|
||||
u16 *result = ScriptContext_GetVarPointer(ctx);
|
||||
u16 species = ScriptContext_GetVar(ctx);
|
||||
u8 findableAccessoryPool, findableAccessoryIndex;
|
||||
u16 *destFoundAccessoryID = ScriptContext_GetVarPointer(ctx);
|
||||
u16 followerSpecies = ScriptContext_GetVar(ctx);
|
||||
|
||||
rand = LCRNG_Next() % 100;
|
||||
u16 rand = LCRNG_Next() % 100;
|
||||
|
||||
if (rand < 15) {
|
||||
j = 0;
|
||||
} else if (rand < (15 + 15)) {
|
||||
j = 1;
|
||||
} else if (rand < (15 + 15 + 15)) {
|
||||
j = 2;
|
||||
} else if (rand < (15 + 15 + 15 + 15)) {
|
||||
j = 3;
|
||||
} else if (rand < (15 + 15 + 15 + 15 + 10)) {
|
||||
j = 4;
|
||||
} else if (rand < (15 + 15 + 15 + 15 + 10 + 10)) {
|
||||
j = 5;
|
||||
} else if (rand < (15 + 15 + 15 + 15 + 10 + 10 + 8)) {
|
||||
j = 6;
|
||||
} else if (rand < (15 + 15 + 15 + 15 + 10 + 10 + 8 + 5)) {
|
||||
j = 7;
|
||||
} else if (rand < (15 + 15 + 15 + 15 + 10 + 10 + 8 + 5 + 5)) {
|
||||
j = 8;
|
||||
findableAccessoryIndex = 0;
|
||||
} else if (rand < 30) {
|
||||
findableAccessoryIndex = 1;
|
||||
} else if (rand < 45) {
|
||||
findableAccessoryIndex = 2;
|
||||
} else if (rand < 60) {
|
||||
findableAccessoryIndex = 3;
|
||||
} else if (rand < 70) {
|
||||
findableAccessoryIndex = 4;
|
||||
} else if (rand < 80) {
|
||||
findableAccessoryIndex = 5;
|
||||
} else if (rand < 88) {
|
||||
findableAccessoryIndex = 6;
|
||||
} else if (rand < 93) {
|
||||
findableAccessoryIndex = 7;
|
||||
} else if (rand < 98) {
|
||||
findableAccessoryIndex = 8;
|
||||
} else {
|
||||
j = 9;
|
||||
findableAccessoryIndex = 9;
|
||||
}
|
||||
|
||||
switch (species) {
|
||||
switch (followerSpecies) {
|
||||
case SPECIES_CHIMCHAR:
|
||||
case SPECIES_MONFERNO:
|
||||
case SPECIES_INFERNAPE:
|
||||
i = 0;
|
||||
findableAccessoryPool = 0;
|
||||
break;
|
||||
case SPECIES_PIPLUP:
|
||||
case SPECIES_PRINPLUP:
|
||||
case SPECIES_EMPOLEON:
|
||||
i = 1;
|
||||
findableAccessoryPool = 1;
|
||||
break;
|
||||
case SPECIES_TURTWIG:
|
||||
case SPECIES_GROTLE:
|
||||
case SPECIES_TORTERRA:
|
||||
i = 2;
|
||||
findableAccessoryPool = 2;
|
||||
break;
|
||||
case SPECIES_PSYDUCK:
|
||||
case SPECIES_BUNEARY:
|
||||
case SPECIES_DRIFLOON:
|
||||
i = 3;
|
||||
findableAccessoryPool = 3;
|
||||
break;
|
||||
case SPECIES_PIKACHU:
|
||||
case SPECIES_CLEFAIRY:
|
||||
case SPECIES_PACHIRISU:
|
||||
case SPECIES_HAPPINY:
|
||||
i = 4;
|
||||
findableAccessoryPool = 4;
|
||||
break;
|
||||
case SPECIES_JIGGLYPUFF:
|
||||
case SPECIES_TORCHIC:
|
||||
case SPECIES_SKITTY:
|
||||
case SPECIES_SHROOMISH:
|
||||
i = 5;
|
||||
findableAccessoryPool = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
i = 0;
|
||||
findableAccessoryPool = 0;
|
||||
}
|
||||
|
||||
*result = Unk_020EBF84[i][j];
|
||||
*destFoundAccessoryID = sMonFindableAccessories[findableAccessoryPool][findableAccessoryIndex];
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const u16 Unk_020EBF64[] = {
|
||||
static const u16 sBerryAndAccesoryManOptions[] = {
|
||||
ITEM_MAGOST_BERRY,
|
||||
ITEM_CORNN_BERRY,
|
||||
ITEM_RABUTA_BERRY,
|
||||
|
|
@ -127,12 +126,12 @@ static const u16 Unk_020EBF64[] = {
|
|||
ACCESSORY_STUMP
|
||||
};
|
||||
|
||||
BOOL ScrCmd_2DF(ScriptContext *param0)
|
||||
BOOL ScrCmd_CalcAmitySquareBerryAndAccessoryManOptionID(ScriptContext *ctx)
|
||||
{
|
||||
u16 *v0 = ScriptContext_GetVarPointer(param0);
|
||||
u16 *destBerryAndAccessoryManOptionID = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
*v0 = (LCRNG_Next() % (NELEMS(Unk_020EBF64)));
|
||||
return 0;
|
||||
*destBerryAndAccessoryManOptionID = LCRNG_Next() % (NELEMS(sBerryAndAccesoryManOptions));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_2E0(ScriptContext *param0)
|
||||
|
|
@ -149,11 +148,11 @@ BOOL ScrCmd_2E0(ScriptContext *param0)
|
|||
return 0;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_2E1(ScriptContext *param0)
|
||||
BOOL ScrCmd_GetAmitySquareBerryOrAccessoryIDFromMan(ScriptContext *ctx)
|
||||
{
|
||||
u16 v0 = ScriptContext_GetVar(param0);
|
||||
u16 *v1 = ScriptContext_GetVarPointer(param0);
|
||||
u16 berryAndAccessoryManOptionID = ScriptContext_GetVar(ctx);
|
||||
u16 *destBerryOrAccessoryID = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
*v1 = Unk_020EBF64[v0];
|
||||
return 0;
|
||||
*destBerryOrAccessoryID = sBerryAndAccesoryManOptions[berryAndAccessoryManOptionID];
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user