mirror of
https://github.com/pret/pokepinballrs.git
synced 2026-04-25 15:49:08 -05:00
document selection of species for catchEm and eggs
This commit is contained in:
parent
fe9052db37
commit
0e3b478353
|
|
@ -33120,7 +33120,7 @@ _08023B22:
|
|||
asrs r0, r0, #0x18
|
||||
cmp r0, #0x12
|
||||
bne _08023B36
|
||||
bl sub_32484
|
||||
bl BuildSpeciesWeightsForEggHatching
|
||||
_08023B36:
|
||||
ldr r1, _08023C94 @ =gCurrentPinballGame
|
||||
ldr r0, [r1]
|
||||
|
|
@ -33130,7 +33130,7 @@ _08023B36:
|
|||
asrs r0, r0, #0x18
|
||||
cmp r0, #0x13
|
||||
bne _08023B66
|
||||
bl sub_325E0
|
||||
bl PickSpeciesForEggHatching
|
||||
ldr r0, _08023C98 @ =gMain
|
||||
ldrb r0, [r0, #2]
|
||||
cmp r0, #3
|
||||
|
|
@ -41601,7 +41601,7 @@ _08027FF8: @ jump table
|
|||
.4byte _080283A0 @ case 11
|
||||
.4byte _080283B4 @ case 12
|
||||
_0802802C:
|
||||
bl sub_31F6C
|
||||
bl BuildSpeciesWeightsForCatchEmMode
|
||||
ldr r0, _0802803C @ =gCurrentPinballGame
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r1, #0x17]
|
||||
|
|
@ -41610,7 +41610,7 @@ _0802802C:
|
|||
.align 2, 0
|
||||
_0802803C: .4byte gCurrentPinballGame
|
||||
_08028040:
|
||||
bl sub_3219C
|
||||
bl PickSpeciesForCatchEmMode
|
||||
ldr r0, _0802806C @ =gMain
|
||||
ldrb r0, [r0, #2]
|
||||
cmp r0, #3
|
||||
|
|
@ -58052,7 +58052,7 @@ _0803061A:
|
|||
asrs r0, r0, #0x18
|
||||
cmp r0, #0x12
|
||||
bne _0803062E
|
||||
bl sub_32484
|
||||
bl BuildSpeciesWeightsForEggHatching
|
||||
_0803062E:
|
||||
mov r3, sb
|
||||
ldr r0, [r3]
|
||||
|
|
@ -58062,7 +58062,7 @@ _0803062E:
|
|||
asrs r0, r0, #0x18
|
||||
cmp r0, #0x13
|
||||
bne _0803065E
|
||||
bl sub_325E0
|
||||
bl PickSpeciesForEggHatching
|
||||
ldr r0, _08030780 @ =gMain
|
||||
ldrb r0, [r0, #2]
|
||||
cmp r0, #3
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ void DefaultMainCallback(void);
|
|||
|
||||
// src/rom_3219C.c
|
||||
|
||||
void sub_3219C(void);
|
||||
void sub_3219C(void);
|
||||
void PickSpeciesForCatchEmMode(void);
|
||||
void PickSpeciesForCatchEmMode(void);
|
||||
|
||||
// src/rom_850.c
|
||||
|
||||
|
|
@ -555,12 +555,12 @@ extern void sub_31498();
|
|||
extern void sub_31B30();
|
||||
extern void sub_31BE8(s8);
|
||||
//extern ? sub_31CF8();
|
||||
//extern ? sub_31F6C();
|
||||
//extern ? BuildSpeciesWeightsForCatchEmMode();
|
||||
|
||||
// asm/rom_3219C.s
|
||||
|
||||
//extern ? sub_32484();
|
||||
//extern ? sub_325E0();
|
||||
//extern ? BuildSpeciesWeightsForEggHatching();
|
||||
//extern ? PickSpeciesForEggHatching();
|
||||
//extern ? sub_326F4();
|
||||
//extern ? sub_3276C();
|
||||
extern void sub_327C0();
|
||||
|
|
|
|||
|
|
@ -164,11 +164,11 @@ struct PinballGame
|
|||
/*0x0F3*/ u8 fillerF3[0x2E];
|
||||
/*0x121*/ s8 unk121;
|
||||
/*0x122*/ u8 filler122[0x9];
|
||||
/*0x12B*/ s8 forceSpecialMons; // When on, force next catch mode species to be special mons
|
||||
/*0x12C*/ s8 forcePichuEgg; // When on, force next egg mode species to be Pichu
|
||||
/*0x12B*/ s8 forceSpecialMons; // When on, force next catch mode species to be special mons
|
||||
/*0x12C*/ s8 forcePichuEgg; // When on, force next egg mode species to be Pichu
|
||||
/*0x12D*/ u8 filler12D;
|
||||
/*0x12E*/ s16 unk12E;
|
||||
/*0x130*/ s16 unk130[8];
|
||||
/*0x12E*/ s16 totalWeight; // Added weight of all possible mons in area
|
||||
/*0x130*/ s16 speciesWeights[8]; // Weight of each species
|
||||
/*0x140*/ u8 filler140[0x26];
|
||||
/*0x166*/ u16 unk166;
|
||||
/*0x168*/ u8 filler168[0x4];
|
||||
|
|
|
|||
|
|
@ -20,7 +20,25 @@ static inline u32 GetTimeAdjustedRandom()
|
|||
return Random() + (gMain.systemFrameCount + gMain.fieldFrameCount);
|
||||
}
|
||||
|
||||
void sub_31F6C(void)
|
||||
/*
|
||||
BuildSpeciesWeightsForX constructs two key objects:
|
||||
|
||||
speciesWeights[] - A cumulative weight array where each entry represents the total weight of all species up to that index.
|
||||
Species weights are influenced by factors such as whether the Pokémon has already been caught and if it has
|
||||
an evolution needed for the Pokédex. This ensures rarer or more desirable species have appropriate weighting.
|
||||
|
||||
totalWeight - The final cumulative weight value, equal to the last value in speciesWeights[]. This is used as the upper bound
|
||||
for random selection.
|
||||
|
||||
PickSpeciesForX determines a species as follows:
|
||||
|
||||
1. Applies special conditions (e.g., forced rare selection if applicable).
|
||||
2. Rolls a random number % totalWeight.
|
||||
3. Iterates through speciesWeights[] and selects the first species whose cumulative weight meets or exceeds the rolled number.
|
||||
|
||||
*/
|
||||
|
||||
void BuildSpeciesWeightsForCatchEmMode(void)
|
||||
{
|
||||
s16 threeArrows;
|
||||
s16 i;
|
||||
|
|
@ -29,7 +47,7 @@ void sub_31F6C(void)
|
|||
s16 currentSpecies;
|
||||
s16 evolutionWeight;
|
||||
|
||||
gCurrentPinballGame->unk12E = 0;
|
||||
gCurrentPinballGame->totalWeight = 0;
|
||||
if (gCurrentPinballGame->catchModeArrows == 3)
|
||||
threeArrows = 1;
|
||||
else
|
||||
|
|
@ -111,12 +129,12 @@ void sub_31F6C(void)
|
|||
{
|
||||
weight = 0;
|
||||
}
|
||||
gCurrentPinballGame->unk12E += weight;
|
||||
gCurrentPinballGame->unk130[i] = gCurrentPinballGame->unk12E;
|
||||
gCurrentPinballGame->totalWeight += weight;
|
||||
gCurrentPinballGame->speciesWeights[i] = gCurrentPinballGame->totalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_3219C(void)
|
||||
void PickSpeciesForCatchEmMode(void)
|
||||
{
|
||||
s16 i;
|
||||
u32 rand;
|
||||
|
|
@ -207,8 +225,8 @@ void sub_3219C(void)
|
|||
threeArrows = 0;
|
||||
|
||||
rand = GetTimeAdjustedRandom();
|
||||
rand %= gCurrentPinballGame->unk12E;
|
||||
for (i = 0; i < WILD_MON_LOCATION_COUNT && gCurrentPinballGame->unk130[i] <= rand; i++);
|
||||
rand %= gCurrentPinballGame->totalWeight;
|
||||
for (i = 0; i < WILD_MON_LOCATION_COUNT && gCurrentPinballGame->speciesWeights[i] <= rand; i++);
|
||||
|
||||
gCurrentPinballGame->currentSpecies = gWildMonLocations[gCurrentPinballGame->area][threeArrows][i];
|
||||
}
|
||||
|
|
@ -217,7 +235,7 @@ void sub_3219C(void)
|
|||
gCurrentPinballGame->lastCatchSpecies = gCurrentPinballGame->currentSpecies;
|
||||
}
|
||||
|
||||
void sub_32484(void)
|
||||
void BuildSpeciesWeightsForEggHatching(void)
|
||||
{
|
||||
s16 i;
|
||||
s16 currentSpecies;
|
||||
|
|
@ -225,7 +243,7 @@ void sub_32484(void)
|
|||
s16 j;
|
||||
s16 evolutionWeight;
|
||||
|
||||
gCurrentPinballGame->unk12E = 0;
|
||||
gCurrentPinballGame->totalWeight = 0;
|
||||
|
||||
for (i = 0; i < 25; i++)
|
||||
{
|
||||
|
|
@ -272,12 +290,12 @@ void sub_32484(void)
|
|||
weight = 0;
|
||||
}
|
||||
|
||||
gCurrentPinballGame->unk12E += weight;
|
||||
gCurrentPinballGame->unk130[i] = gCurrentPinballGame->unk12E;
|
||||
gCurrentPinballGame->totalWeight += weight;
|
||||
gCurrentPinballGame->speciesWeights[i] = gCurrentPinballGame->totalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_325E0(void)
|
||||
void PickSpeciesForEggHatching(void)
|
||||
{
|
||||
s16 i;
|
||||
u32 rand;
|
||||
|
|
@ -298,9 +316,9 @@ void sub_325E0(void)
|
|||
else
|
||||
{
|
||||
rand = GetTimeAdjustedRandom();
|
||||
rand %= gCurrentPinballGame->unk12E;
|
||||
rand %= gCurrentPinballGame->totalWeight;
|
||||
|
||||
for (i = 0; i < 25 && gCurrentPinballGame->unk130[i] <= rand; i++);
|
||||
for (i = 0; i < 25 && gCurrentPinballGame->speciesWeights[i] <= rand; i++);
|
||||
|
||||
gCurrentPinballGame->currentSpecies = gEggLocations[gMain.selectedField][i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user