Merge branch 'master' into doc-inc2

This commit is contained in:
GriffinR
2019-10-14 19:25:10 -04:00
committed by GitHub
144 changed files with 1290 additions and 1106 deletions

View File

@@ -22,20 +22,7 @@
#include "constants/trainers.h"
#include "constants/species.h"
#include "constants/moves.h"
#define PIKE_ROOM_SINGLE_BATTLE 0
#define PIKE_ROOM_HEAL_FULL 1
#define PIKE_ROOM_NPC 2
#define PIKE_ROOM_STATUS 3
#define PIKE_ROOM_HEAL_PART 4
#define PIKE_ROOM_WILD_MONS 5
#define PIKE_ROOM_HARD_BATTLE 6
#define PIKE_ROOM_DOUBLE_BATTLE 7
#define PIKE_ROOM_BRAIN 8
// For the room with a status effect.
#define PIKE_STATUS_KIRLIA 0
#define PIKE_STATUS_DUSCLOPS 1
#include "constants/battle_pike.h"
struct PikeRoomNPC
{

View File

@@ -27,6 +27,7 @@
#include "overworld.h"
#include "event_scripts.h"
#include "constants/battle_frontier.h"
#include "constants/battle_pyramid.h"
#include "constants/event_objects.h"
#include "constants/event_object_movement_constants.h"
#include "constants/items.h"
@@ -39,38 +40,7 @@
extern const struct MapLayout *const gMapLayouts[];
extern const u16 gUnknown_08D856C8[][16];
#define TOTAL_ROUNDS 20
#define PICKUP_ITEMS_PER_ROUND 10
#define FLOOR_WALKABLE_METATILE 0x28D
#define FLOOR_EXIT_METATILE 0x28E
enum
{
HINT_EXIT_DIRECTION,
HINT_REMAINING_ITEMS,
HINT_REMAINING_TRAINERS,
HINT_EXIT_SHORT_REMAINING_TRAINERS,
HINT_EXIT_SHORT_REMAINING_ITEMS,
HINT_EXIT_MEDIUM_REMAINING_TRAINERS,
HINT_EXIT_MEDIUM_REMAINING_ITEMS,
HINT_EXIT_FAR_REMAINING_TRAINERS,
HINT_EXIT_FAR_REMAINING_ITEMS,
};
enum
{
OBJ_TRAINERS,
OBJ_ITEMS,
};
enum
{
OBJ_POSITIONS_UNIFORM,
OBJ_POSITIONS_IN_AND_NEAR_ENTRANCE,
OBJ_POSITIONS_IN_AND_NEAR_EXIT,
OBJ_POSITIONS_NEAR_ENTRANCE,
OBJ_POSITIONS_NEAR_EXIT,
};
struct PyramidWildMon
{

View File

@@ -1273,7 +1273,7 @@ void BattleSetup_StartTrainerBattle(void)
MarkApproachingPyramidTrainersAsBattled();
}
else if (sub_81D5C18())
else if (InTrainerHillChallenge())
{
gBattleTypeFlags |= BATTLE_TYPE_TRAINER_HILL;
@@ -1291,7 +1291,7 @@ void BattleSetup_StartTrainerBattle(void)
gUnknown_03006080 = 0;
gMain.savedCallback = CB2_EndTrainerBattle;
if (InBattlePyramid() || sub_81D5C18())
if (InBattlePyramid() || InTrainerHillChallenge())
sub_80B0828();
else
DoTrainerBattle();
@@ -1307,7 +1307,7 @@ static void CB2_EndTrainerBattle(void)
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{
if (InBattlePyramid() || sub_81D5C18())
if (InBattlePyramid() || InTrainerHillChallenge())
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
else
SetMainCallback2(CB2_WhiteOut);
@@ -1315,7 +1315,7 @@ static void CB2_EndTrainerBattle(void)
else
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
if (!InBattlePyramid() && !sub_81D5C18())
if (!InBattlePyramid() && !InTrainerHillChallenge())
{
RegisterTrainerInMatchCall();
SetBattledTrainersFlags();
@@ -1361,7 +1361,7 @@ void ShowTrainerIntroSpeech(void)
sub_80982B8();
}
else if (sub_81D5C18())
else if (InTrainerHillChallenge())
{
if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1)
CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gSpecialVar_LastTalked));

View File

@@ -26,7 +26,12 @@
"type": "fishing_mons",
"encounter_rates": [
70, 30, 60, 20, 20, 40, 40, 15, 4, 1
]
],
"groups": {
"old_rod": [0, 1],
"good_rod": [2, 3, 4],
"super_rod": [5, 6, 7, 8, 9]
}
}
],
"encounters": [

View File

@@ -3,13 +3,25 @@
## for wild_encounter_group in wild_encounter_groups
{% if wild_encounter_group.for_maps %}
## for wild_encounter_field in wild_encounter_group.fields
{% if not existsIn(wild_encounter_field, "groups") %}
## for encounter_rate in wild_encounter_field.encounter_rates
{% if trackVar(encounter_rate, 100) %}
{% if loop.index == 0 %}
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ loop.index }} {{ encounter_rate }} {% else %}#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ loop.index }} ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ subtract(loop.index, 1) }} + {{ encounter_rate }}{% endif %} {{ setVarInt(wild_encounter_field.type, loop.index) }}
## endfor
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_TOTAL (ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ getVar(wild_encounter_field.type) }})
{% else %}
## for field_subgroup_key, field_subgroup_subarray in wild_encounter_field.groups
## for field_subgroup_index in field_subgroup_subarray
{% if loop.index == 0 %}
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_{{ upper(field_subgroup_key) }}_SLOT_{{ field_subgroup_index }} {{ at(wild_encounter_field.encounter_rates, field_subgroup_index) }} {% else %}#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_{{ upper(field_subgroup_key) }}_SLOT_{{ field_subgroup_index }} ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_{{ upper(field_subgroup_key) }}_SLOT_{{ getVar("previous_slot") }} + {{ at(wild_encounter_field.encounter_rates, field_subgroup_index) }}{% endif %}{{ setVarInt(concat(wild_encounter_field.type, field_subgroup_key), field_subgroup_index) }}{{ setVarInt("previous_slot", field_subgroup_index) }}
## endfor
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_{{ upper(field_subgroup_key) }}_TOTAL (ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_{{ upper(field_subgroup_key) }}_SLOT_{{ getVar(concat(wild_encounter_field.type, field_subgroup_key)) }})
## endfor
{% endif %}
## endfor
{% endif %}
## for encounter in wild_encounter_group.encounters
{% if existsIn(encounter, "land_mons") %}

View File

@@ -547,7 +547,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
{
if (UpdatePoisonStepCounter() == TRUE)
{
ScriptContext1_SetupScript(EventScript_Poison);
ScriptContext1_SetupScript(EventScript_FieldPoison);
return TRUE;
}
if (ShouldEggHatch())
@@ -733,7 +733,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
}
if (MetatileBehavior_IsMtPyreHole(metatileBehavior) == TRUE)
{
ScriptContext1_SetupScript(gUnknown_082A8350);
ScriptContext1_SetupScript(EventScript_FallDownHoleMtPyre);
return TRUE;
}
if (MetatileBehavior_IsMossdeepGymWarp(metatileBehavior) == TRUE)

View File

@@ -14,6 +14,7 @@
#include "strings.h"
#include "task.h"
#include "trainer_hill.h"
#include "constants/field_poison.h"
#include "constants/species.h"
static bool32 IsMonValidSpecies(struct Pokemon *pokemon)
@@ -62,7 +63,7 @@ static bool32 MonFaintedFromPoison(u8 partyIdx)
return FALSE;
}
static void Task_WhiteOut(u8 taskId)
static void Task_TryFieldPoisonWhiteOut(u8 taskId)
{
s16 *data = gTasks[taskId].data;
switch (data[0])
@@ -89,18 +90,18 @@ static void Task_WhiteOut(u8 taskId)
case 2:
if (AllMonsFainted())
{
if (InBattlePyramid() | InBattlePike() || sub_81D5C18())
if (InBattlePyramid() | InBattlePike() || InTrainerHillChallenge())
{
gSpecialVar_Result = 2;
gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT;
}
else
{
gSpecialVar_Result = 1;
gSpecialVar_Result = FLDPSN_WHITEOUT;
}
}
else
{
gSpecialVar_Result = 0;
gSpecialVar_Result = FLDPSN_NO_WHITEOUT;
}
EnableBothScriptContexts();
DestroyTask(taskId);
@@ -108,9 +109,9 @@ static void Task_WhiteOut(u8 taskId)
}
}
void ExecuteWhiteOut(void)
void TryFieldPoisonWhiteOut(void)
{
CreateTask(Task_WhiteOut, 80);
CreateTask(Task_TryFieldPoisonWhiteOut, 80);
ScriptContext1_Stop();
}

View File

@@ -48,7 +48,7 @@ static bool32 WaitForWeatherFadeIn(void);
static void task0A_mpl_807E31C(u8 taskId);
static void sub_80AFA0C(u8 taskId);
static void sub_80AFA88(u8 taskId);
static void task50_0807F0C8(u8);
static void Task_EnableScriptAfterMusicFade(u8 taskId);
// const
const u16 sFlashLevelPixelRadii[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 };
@@ -1231,13 +1231,13 @@ void sub_80B058C(void)
gTasks[taskId].data[0] = 6;
}
void sub_80B05B4(void)
void Script_FadeOutMapMusic(void)
{
Overworld_FadeOutMapMusic();
CreateTask(task50_0807F0C8, 80);
CreateTask(Task_EnableScriptAfterMusicFade, 80);
}
static void task50_0807F0C8(u8 taskId)
static void Task_EnableScriptAfterMusicFade(u8 taskId)
{
if (BGMusicStopped() == TRUE)
{

View File

@@ -6757,7 +6757,7 @@ void sub_81B8904(u8 initArg, MainCallback callback)
InitPartyMenu(initArg, 0, 0, 0, 0, sub_81B1370, callback);
}
void sub_81B892C(void)
void OpenPartyMenuForMoveTutor(void)
{
InitPartyMenu(0, 0, 12, 0, 4, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic);
}

View File

@@ -5704,7 +5704,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
{
if (InBattlePyramid())
return GetBattlePyramindTrainerEncounterMusicId(trainerOpponentId);
else if (sub_81D5C18())
else if (InTrainerHillChallenge())
return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId);
else
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);

View File

@@ -86,7 +86,7 @@ int GameClear(void)
return 0;
}
bool8 sp0C8_whiteout_maybe(void)
bool8 SetCB2WhiteOut(void)
{
SetMainCallback2(CB2_WhiteOut);
return FALSE;

View File

@@ -63,7 +63,7 @@ static void TrainerHillGetChallengeStatus(void);
static void sub_81D5B2C(void);
static void sub_81D5BBC(void);
static void sub_81D5C00(void);
static void sub_81D5C5C(void);
static void GetInTrainerHill(void);
static void sub_81D62B4(void);
static void sub_81D64AC(void);
static void sub_81D64DC(void);
@@ -231,7 +231,7 @@ static void (* const sHillFunctions[])(void) =
sub_81D5B2C,
sub_81D5BBC,
sub_81D5C00,
sub_81D5C5C,
GetInTrainerHill,
sub_81D62B4,
sub_81D64AC,
sub_81D64DC,
@@ -534,7 +534,7 @@ static void sub_81D5C00(void)
FreeDataStruct();
}
bool8 sub_81D5C18(void)
bool8 InTrainerHillChallenge(void)
{
if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0)
return FALSE;
@@ -546,9 +546,9 @@ bool8 sub_81D5C18(void)
return FALSE;
}
static void sub_81D5C5C(void)
static void GetInTrainerHill(void)
{
if (!sub_81D5C18())
if (!InTrainerHillChallenge())
gSpecialVar_Result = 0;
else
gSpecialVar_Result = 1;
@@ -997,7 +997,7 @@ static void sub_81D6518(void)
bool32 sub_81D6534(void)
{
if (!sub_81D5C18() || GetCurrentTrainerHillMapId() == 6)
if (!InTrainerHillChallenge() || GetCurrentTrainerHillMapId() == 6)
return FALSE;
sub_81D5C00();

View File

@@ -197,34 +197,35 @@ enum
static u8 ChooseWildMonIndex_Fishing(u8 rod)
{
u8 wildMonIndex = 0;
u8 rand = Random() % ENCOUNTER_CHANCE_FISHING_MONS_TOTAL;
u8 rand = Random() % max(max(ENCOUNTER_CHANCE_FISHING_MONS_OLD_ROD_TOTAL, ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_TOTAL),
ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_TOTAL);
switch (rod)
{
case OLD_ROD:
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_0)
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_OLD_ROD_SLOT_0)
wildMonIndex = 0;
else
wildMonIndex = 1;
break;
case GOOD_ROD:
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_2)
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_2)
wildMonIndex = 2;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SLOT_2 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_3)
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_2 && rand < ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_3)
wildMonIndex = 3;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SLOT_3 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_4)
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_3 && rand < ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_4)
wildMonIndex = 4;
break;
case SUPER_ROD:
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_5)
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_5)
wildMonIndex = 5;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SLOT_5 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_6)
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_5 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_6)
wildMonIndex = 6;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SLOT_6 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_7)
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_6 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_7)
wildMonIndex = 7;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SLOT_7 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SLOT_8)
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_7 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_8)
wildMonIndex = 8;
if (rand == ENCOUNTER_CHANCE_FISHING_MONS_SLOT_8)
if (rand == ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_8)
wildMonIndex = 9;
break;
}