Document Battle Dome scripts and some battle_dome.c
This commit is contained in:
@@ -2676,8 +2676,9 @@ static void PlayerHandleHealthBarUpdate(void)
|
||||
LoadBattleBarGfx(0);
|
||||
hpVal = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
|
||||
|
||||
// gPlayerPartyLostHP used by Battle Dome, but never read
|
||||
if (hpVal > 0)
|
||||
gUnknown_0203CD70 += hpVal;
|
||||
gPlayerPartyLostHP += hpVal;
|
||||
|
||||
if (hpVal != INSTANT_HP_BAR_DROP)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1104,6 +1104,7 @@ static const u8 sBattleTowerPartySizes2[] =
|
||||
[FRONTIER_MODE_LINK_MULTIS] = FRONTIER_MULTI_PARTY_SIZE,
|
||||
};
|
||||
|
||||
// min/max trainer id
|
||||
static const u16 gUnknown_085DF9FA[][2] =
|
||||
{
|
||||
{0x0000, 0x0063},
|
||||
@@ -1116,6 +1117,7 @@ static const u16 gUnknown_085DF9FA[][2] =
|
||||
{0x00c8, 0x012b},
|
||||
};
|
||||
|
||||
// min/max trainer id
|
||||
static const u16 gUnknown_085DFA1A[][2] =
|
||||
{
|
||||
{0x0064, 0x0077},
|
||||
@@ -1878,7 +1880,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
{
|
||||
s32 i, j;
|
||||
u16 chosenMonIndices[4];
|
||||
u8 friendship = 0xFF;
|
||||
u8 friendship = MAX_FRIENDSHIP;
|
||||
u8 level = SetFacilityPtrsGetLevel();
|
||||
u8 fixedIV = 0;
|
||||
u8 bfMonCount;
|
||||
@@ -1977,7 +1979,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
otID);
|
||||
|
||||
friendship = 255;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
// Give the chosen pokemon its specified moves.
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
@@ -1999,7 +2001,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
{
|
||||
s32 i, j;
|
||||
u8 friendship = 0xFF;
|
||||
u8 friendship = MAX_FRIENDSHIP;
|
||||
u8 level = 0;
|
||||
u8 fixedIV = 0;
|
||||
struct Apprentice *apprentice = &gSaveBlock2Ptr->apprentices[0];
|
||||
@@ -2017,7 +2019,7 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
for (i = 0; i != 3; i++)
|
||||
{
|
||||
CreateMonWithEVSpread(&gEnemyParty[firstMonId + i], apprentice->party[i].species, level, fixedIV, 8);
|
||||
friendship = 0xFF;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (apprentice->party[i].moves[j] == MOVE_FRUSTRATION)
|
||||
@@ -3227,7 +3229,7 @@ static void FillPartnerParty(u16 trainerId)
|
||||
ivs,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
otID);
|
||||
friendship = 0xFF;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gPlayerParty[3 + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
@@ -3532,19 +3534,19 @@ static u16 sub_8165D40(void)
|
||||
static u8 SetTentPtrsGetLevel(void)
|
||||
{
|
||||
u8 level = 30;
|
||||
u32 tentFacility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
u32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
|
||||
if (tentFacility == TENT_SLATEPORT)
|
||||
if (facility == FRONTIER_FACILITY_FACTORY)
|
||||
{
|
||||
gFacilityTrainers = gSlateportBattleTentTrainers;
|
||||
gFacilityTrainerMons = gSlateportBattleTentMons;
|
||||
}
|
||||
else if (tentFacility == TENT_VERDANTURF)
|
||||
else if (facility == FRONTIER_FACILITY_PALACE)
|
||||
{
|
||||
gFacilityTrainers = gVerdanturfBattleTentTrainers;
|
||||
gFacilityTrainerMons = gVerdanturfBattleTentMons;
|
||||
}
|
||||
else if (tentFacility == TENT_FALLARBOR)
|
||||
else if (facility == FRONTIER_FACILITY_ARENA)
|
||||
{
|
||||
gFacilityTrainers = gFallarborBattleTentTrainers;
|
||||
gFacilityTrainerMons = gFallarborBattleTentMons;
|
||||
@@ -3653,7 +3655,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
otID);
|
||||
|
||||
friendship = 255;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
// Give the chosen pokemon its specified moves.
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
|
||||
@@ -5093,7 +5093,7 @@ static void sub_80DE864(u8 a)
|
||||
gContestResources->field_18->unk4_0 = 1;
|
||||
break;
|
||||
case MOVE_RETURN:
|
||||
gAnimFriendship = 0xFF;
|
||||
gAnimFriendship = MAX_FRIENDSHIP;
|
||||
break;
|
||||
case MOVE_FRUSTRATION:
|
||||
gAnimFriendship = 0;
|
||||
|
||||
@@ -994,7 +994,7 @@ u16 GetWeekCount(void)
|
||||
u8 GetLeadMonFriendshipScore(void)
|
||||
{
|
||||
struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()];
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == 255)
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
@@ -2490,7 +2490,7 @@ void SetFrontierBrainEventObjGfx_2(void)
|
||||
void CreateFrontierBrainPokemon(void)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 monCountInBits;
|
||||
s32 selectedMonBits;
|
||||
s32 monPartyId;
|
||||
s32 monLevel = 0;
|
||||
u8 friendship;
|
||||
@@ -2498,16 +2498,16 @@ void CreateFrontierBrainPokemon(void)
|
||||
s32 symbol = GetFronterBrainSymbol();
|
||||
|
||||
if (facility == FRONTIER_FACILITY_DOME)
|
||||
monCountInBits = GetDomeTrainerMonCountInBits(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
|
||||
selectedMonBits = GetDomeTrainerSelectedMons(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
|
||||
else
|
||||
monCountInBits = 7;
|
||||
selectedMonBits = (1 << FRONTIER_PARTY_SIZE) - 1; // all 3 mons selected
|
||||
|
||||
ZeroEnemyPartyMons();
|
||||
monPartyId = 0;
|
||||
monLevel = SetFacilityPtrsGetLevel();
|
||||
for (i = 0; i < 3; monCountInBits >>= 1, i++)
|
||||
for (i = 0; i < FRONTIER_PARTY_SIZE; selectedMonBits >>= 1, i++)
|
||||
{
|
||||
if (!(monCountInBits & 1))
|
||||
if (!(selectedMonBits & 1))
|
||||
continue;
|
||||
|
||||
do
|
||||
@@ -2523,7 +2523,7 @@ void CreateFrontierBrainPokemon(void)
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HELD_ITEM, &sFrontierBrainsMons[facility][symbol][i].heldItem);
|
||||
for (j = 0; j < NUM_STATS; j++)
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HP_EV + j, &sFrontierBrainsMons[facility][symbol][i].evs[j]);
|
||||
friendship = 0xFF;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[monPartyId], sFrontierBrainsMons[facility][symbol][i].moves[j], j);
|
||||
@@ -2560,7 +2560,7 @@ void CreateFrontierBrainPokemon(void)
|
||||
bl TrainerIdToDomeTournamentId\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
bl GetDomeTrainerMonCountInBits\n\
|
||||
bl GetDomeTrainerSelectedMons\n\
|
||||
adds r4, r0, 0\n\
|
||||
b _081A4E46\n\
|
||||
.pool\n\
|
||||
|
||||
@@ -967,17 +967,17 @@ const u32 gVsLettersGfx[] = INCBIN_U32("graphics/battle_transitions/vs.4bpp.lz")
|
||||
const u32 gUnknown_08D82F10[] = INCBIN_U32("graphics/battle_frontier/tourney_bg.4bpp.lz");
|
||||
const u32 gUnknown_08D834FC[] = INCBIN_U32("graphics/battle_frontier/tourney_line.4bpp.lz"); // the red glow mask for the tourney advancement lines
|
||||
|
||||
const u32 gUnknown_08D83900[] = INCBIN_U32("graphics/unknown/unknown_D83900.bin.lz"); // tilemaps likely
|
||||
const u32 gUnknown_08D83900[] = INCBIN_U32("graphics/battle_frontier/unknown_D83900.bin.lz"); // tilemaps likely
|
||||
|
||||
const u32 gUnknown_08D83B2C[] = INCBIN_U32("graphics/unknown/unknown_D83B2C.bin.lz");
|
||||
const u32 gUnknown_08D83B2C[] = INCBIN_U32("graphics/battle_frontier/unknown_D83B2C.bin.lz");
|
||||
|
||||
const u32 gUnknown_08D83C3C[] = INCBIN_U32("graphics/unknown/unknown_D83C3C.bin.lz");
|
||||
const u32 gUnknown_08D83C3C[] = INCBIN_U32("graphics/battle_frontier/unknown_D83C3C.bin.lz");
|
||||
|
||||
const u32 gUnknown_08D83D50[] = INCBIN_U32("graphics/battle_frontier/misc1.4bpp.lz");
|
||||
|
||||
const u32 gUnknown_08D84970[] = INCBIN_U32("graphics/unknown/unknown_D84970.bin.lz");
|
||||
const u32 gUnknown_08D84970[] = INCBIN_U32("graphics/battle_frontier/unknown_D84970.bin.lz");
|
||||
|
||||
const u32 gUnknown_08D84F00[] = INCBIN_U32("graphics/unknown/unknown_D84F00.bin.lz");
|
||||
const u32 gUnknown_08D84F00[] = INCBIN_U32("graphics/battle_frontier/unknown_D84F00.bin.lz");
|
||||
|
||||
const u32 gBattleFrontierGfx_DomeOptions[] = INCBIN_U32("graphics/battle_frontier/options.4bpp.lz");
|
||||
const u32 gUnknown_08D85358[] = INCBIN_U32("graphics/battle_frontier/options_pal1.gbapal.lz");
|
||||
|
||||
@@ -101,7 +101,7 @@ static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite);
|
||||
static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2);
|
||||
static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2);
|
||||
static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2);
|
||||
static void sub_8175364(u8 taskId);
|
||||
static void Task_DoConfettiEffect(u8 taskId);
|
||||
static void sub_81751A4(struct Sprite* sprite);
|
||||
|
||||
// const rom data
|
||||
@@ -1387,12 +1387,13 @@ static bool8 sub_81751FC(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8175280(void)
|
||||
// Used when a Battle Dome tourney is won
|
||||
void DoConfettiEffect(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
gSpecialVar_0x8004 = 180;
|
||||
taskId = CreateTask(sub_8175364, 0);
|
||||
taskId = CreateTask(Task_DoConfettiEffect, 0);
|
||||
if (taskId != 0xFF)
|
||||
{
|
||||
gTasks[taskId].data[1] = gSpecialVar_0x8004;
|
||||
@@ -1400,11 +1401,11 @@ void sub_8175280(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81752C0(void)
|
||||
static void StopConfettiEffect(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
if ((taskId = FindTaskIdByFunc(sub_8175364)) != 0xFF)
|
||||
if ((taskId = FindTaskIdByFunc(Task_DoConfettiEffect)) != 0xFF)
|
||||
DestroyTask(taskId);
|
||||
|
||||
sub_8152254();
|
||||
@@ -1437,7 +1438,7 @@ static void sub_81752F4(struct UnkStruct_81520A8 *structPtr)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8175364(u8 taskId)
|
||||
static void Task_DoConfettiEffect(u8 taskId)
|
||||
{
|
||||
u32 var = 0;
|
||||
u16 *data = gTasks[taskId].data;
|
||||
@@ -1475,7 +1476,7 @@ static void sub_8175364(u8 taskId)
|
||||
data[0] = 0xFF;
|
||||
break;
|
||||
case 0xFF:
|
||||
sub_81752C0();
|
||||
StopConfettiEffect();
|
||||
gSpecialVar_0x8004 = var;
|
||||
gSpecialVar_0x8005 = 0xFFFF;
|
||||
break;
|
||||
|
||||
@@ -5085,8 +5085,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
retVal = FALSE;
|
||||
}
|
||||
@@ -5111,8 +5111,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
retVal = FALSE;
|
||||
}
|
||||
@@ -5136,8 +5136,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
retVal = FALSE;
|
||||
}
|
||||
@@ -5786,8 +5786,8 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,20 +704,20 @@ static void CB2_ReturnFromChooseBattleFrontierParty(void)
|
||||
|
||||
void ReducePlayerPartyToSelectedMons(void)
|
||||
{
|
||||
struct Pokemon party[4];
|
||||
struct Pokemon party[MAX_FRONTIER_PARTY_SIZE];
|
||||
int i;
|
||||
|
||||
CpuFill32(0, party, sizeof party);
|
||||
|
||||
// copy the selected pokemon according to the order.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
||||
if (gSelectedOrderFromParty[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop
|
||||
party[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; // index is 0 based, not literal
|
||||
|
||||
CpuFill32(0, gPlayerParty, sizeof gPlayerParty);
|
||||
|
||||
// overwrite the first 4 with the order copied to.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
||||
gPlayerParty[i] = party[i];
|
||||
|
||||
CalculatePlayerPartyCount();
|
||||
|
||||
Reference in New Issue
Block a user