mirror of
https://github.com/pret/pokeruby.git
synced 2024-12-03 10:40:55 +00:00
lots more relabeling
This commit is contained in:
parent
3b3d159652
commit
a185f8a26d
@ -815,7 +815,7 @@ SetUpFieldMove_SecretPower: @ 80C62C4
|
||||
bne _080C6330
|
||||
bl sub_80C6264
|
||||
ldr r1, _080C6320 @ =gFieldCallback
|
||||
ldr r0, _080C6324 @ =sub_808AB90
|
||||
ldr r0, _080C6324 @ =FieldCallback_Teleport
|
||||
str r0, [r1]
|
||||
ldr r1, _080C6328 @ =gUnknown_03005CE4
|
||||
ldr r0, _080C632C @ =sub_80C639C
|
||||
@ -824,7 +824,7 @@ SetUpFieldMove_SecretPower: @ 80C62C4
|
||||
_080C6318: .4byte gScriptResult
|
||||
_080C631C: .4byte gUnknown_0203923C
|
||||
_080C6320: .4byte gFieldCallback
|
||||
_080C6324: .4byte sub_808AB90
|
||||
_080C6324: .4byte FieldCallback_Teleport
|
||||
_080C6328: .4byte gUnknown_03005CE4
|
||||
_080C632C: .4byte sub_80C639C
|
||||
_080C6330:
|
||||
@ -836,14 +836,14 @@ _080C6330:
|
||||
bne _080C6360
|
||||
bl sub_80C6264
|
||||
ldr r1, _080C6350 @ =gFieldCallback
|
||||
ldr r0, _080C6354 @ =sub_808AB90
|
||||
ldr r0, _080C6354 @ =FieldCallback_Teleport
|
||||
str r0, [r1]
|
||||
ldr r1, _080C6358 @ =gUnknown_03005CE4
|
||||
ldr r0, _080C635C @ =sub_80C64A8
|
||||
b _080C6380
|
||||
.align 2, 0
|
||||
_080C6350: .4byte gFieldCallback
|
||||
_080C6354: .4byte sub_808AB90
|
||||
_080C6354: .4byte FieldCallback_Teleport
|
||||
_080C6358: .4byte gUnknown_03005CE4
|
||||
_080C635C: .4byte sub_80C64A8
|
||||
_080C6360:
|
||||
@ -859,7 +859,7 @@ _080C636E:
|
||||
_080C6372:
|
||||
bl sub_80C6264
|
||||
ldr r1, _080C638C @ =gFieldCallback
|
||||
ldr r0, _080C6390 @ =sub_808AB90
|
||||
ldr r0, _080C6390 @ =FieldCallback_Teleport
|
||||
str r0, [r1]
|
||||
ldr r1, _080C6394 @ =gUnknown_03005CE4
|
||||
ldr r0, _080C6398 @ =sub_80C660C
|
||||
@ -872,7 +872,7 @@ _080C6384:
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_080C638C: .4byte gFieldCallback
|
||||
_080C6390: .4byte sub_808AB90
|
||||
_080C6390: .4byte FieldCallback_Teleport
|
||||
_080C6394: .4byte gUnknown_03005CE4
|
||||
_080C6398: .4byte sub_80C660C
|
||||
thumb_func_end SetUpFieldMove_SecretPower
|
||||
|
@ -518,7 +518,7 @@ _08110A44:
|
||||
bl GetRoamerLocation
|
||||
ldrb r0, [r4, 0x10]
|
||||
ldrb r1, [r4, 0x11]
|
||||
bl get_mapheader_by_bank_and_number
|
||||
bl Overworld_GetMapHeaderByGroupAndId
|
||||
ldrb r0, [r0, 0x14]
|
||||
strh r0, [r4, 0x12]
|
||||
movs r3, 0x88
|
||||
@ -566,7 +566,7 @@ SetAreaHasMon: @ 8110A98
|
||||
adds r0, r5
|
||||
strb r1, [r0, 0x11]
|
||||
adds r0, r2, 0
|
||||
bl get_mapheader_by_bank_and_number
|
||||
bl Overworld_GetMapHeaderByGroupAndId
|
||||
ldrb r0, [r0, 0x14]
|
||||
bl sub_80FBA04
|
||||
ldrh r1, [r4]
|
||||
@ -599,7 +599,7 @@ SetSpecialMapHasMon: @ 8110AE4
|
||||
cmp r0, 0x1F
|
||||
bhi _08110B96
|
||||
adds r0, r2, 0
|
||||
bl get_mapheader_by_bank_and_number
|
||||
bl Overworld_GetMapHeaderByGroupAndId
|
||||
adds r6, r0, 0
|
||||
ldrb r0, [r6, 0x14]
|
||||
cmp r0, 0x57
|
||||
|
@ -22402,7 +22402,7 @@ _080F6C3A:
|
||||
strb r1, [r0]
|
||||
ldrh r0, [r6, 0xA]
|
||||
ldrh r1, [r6, 0xC]
|
||||
bl get_mapheader_by_bank_and_number
|
||||
bl Overworld_GetMapHeaderByGroupAndId
|
||||
ldrh r1, [r5]
|
||||
lsls r1, 3
|
||||
adds r4, r1
|
||||
|
@ -1324,7 +1324,7 @@ EverGrandeCity_HallOfFame_EventScript_19FC70:: @ 819FC70
|
||||
setflag 2141
|
||||
return
|
||||
|
||||
EventScript_LeagueWhiteOut:: @ 819FC74
|
||||
S_WhiteOut:: @ 819FC74
|
||||
call EverGrandeCity_HallOfFame_EventScript_19FD09
|
||||
call EventScript_19FC84
|
||||
jump gUnknown_0819FC9F
|
||||
|
@ -173,6 +173,20 @@
|
||||
#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
|
||||
#define WEATHER_HAIL (1 << 7)
|
||||
|
||||
enum
|
||||
{
|
||||
BATTLE_TERRAIN_GRASS,
|
||||
BATTLE_TERRAIN_LONG_GRASS,
|
||||
BATTLE_TERRAIN_SAND,
|
||||
BATTLE_TERRAIN_UNDERWATER,
|
||||
BATTLE_TERRAIN_WATER,
|
||||
BATTLE_TERRAIN_POND,
|
||||
BATTLE_TERRAIN_MOUNTAIN,
|
||||
BATTLE_TERRAIN_CAVE,
|
||||
BATTLE_TERRAIN_BUILDING,
|
||||
BATTLE_TERRAIN_PLAIN,
|
||||
};
|
||||
|
||||
// needed to match the hack that is get_item, thanks cam, someone else clean this up later.
|
||||
extern u8 unk_2000000[];
|
||||
|
||||
|
@ -14,16 +14,16 @@ enum
|
||||
// map types
|
||||
enum
|
||||
{
|
||||
MAP_TYPE_0,
|
||||
MAP_TYPE_TOWN,
|
||||
MAP_TYPE_CITY,
|
||||
MAP_TYPE_ROUTE,
|
||||
MAP_TYPE_UNDERGROUND,
|
||||
MAP_TYPE_UNDERWATER,
|
||||
MAP_TYPE_6,
|
||||
MAP_TYPE_7,
|
||||
MAP_TYPE_INDOOR,
|
||||
MAP_TYPE_SECRET_BASE
|
||||
MAP_TYPE_0, // 0
|
||||
MAP_TYPE_TOWN, // 1
|
||||
MAP_TYPE_CITY, // 2
|
||||
MAP_TYPE_ROUTE, // 3
|
||||
MAP_TYPE_UNDERGROUND, // 4
|
||||
MAP_TYPE_UNDERWATER, // 5
|
||||
MAP_TYPE_6, // 6
|
||||
MAP_TYPE_7, // 7
|
||||
MAP_TYPE_INDOOR, // 8
|
||||
MAP_TYPE_SECRET_BASE // 9
|
||||
};
|
||||
|
||||
// map battle scenes
|
||||
|
@ -608,7 +608,7 @@ struct SaveBlock1 /* 0x02025734 */
|
||||
/*0x2C*/ u16 battleMusic;
|
||||
/*0x2E*/ u8 weather;
|
||||
/*0x2F*/ u8 filler_2F;
|
||||
/*0x30*/ u8 flashUsed;
|
||||
/*0x30*/ u8 flashLevel; // flash level on current map, 0 being normal and 4 being the darkest
|
||||
/*0x32*/ u16 mapDataId;
|
||||
/*0x34*/ u16 mapView[0x100];
|
||||
/*0x234*/ u8 playerPartyCount;
|
||||
|
@ -37,7 +37,7 @@ extern void (*gUnknown_03005CE4)(void);
|
||||
void sub_808B5B4(u32 taskID);
|
||||
void sub_8089A70(void);
|
||||
void sub_808A004(u8 taskID);
|
||||
void sub_808AB90(void);
|
||||
void FieldCallback_Teleport(void);
|
||||
void sub_808AD58(void);
|
||||
void sub_808B020(void);
|
||||
void sub_808B0C0(u8 taskID);
|
||||
|
@ -27,7 +27,7 @@ extern void (*gFieldCallback)(void);
|
||||
|
||||
// sub_8052F5C
|
||||
void flag_var_implications_of_teleport_(void);
|
||||
void new_game(void);
|
||||
void Overworld_ResetStateAfterTeleport(void);
|
||||
void sub_8053014(void);
|
||||
void sub_8053050(void);
|
||||
// sub_805308C
|
||||
@ -36,18 +36,18 @@ void IncrementGameStat(u8 index);
|
||||
u32 GetGameStat(u8 index);
|
||||
void SetGameStat(u8, u32);
|
||||
// sub_8053154
|
||||
// sub_8053198
|
||||
void update_saveblock1_field_object_coords(u8, s16, s16);
|
||||
void update_saveblock1_field_object_movement_behavior(u8, u8);
|
||||
// LoadSaveblockMapObjScripts
|
||||
void Overworld_SaveMapObjCoords(u8, s16, s16);
|
||||
void Overworld_SaveMapObjMovementType(u8, u8);
|
||||
// mapdata_load_assets_to_gpu_and_full_redraw
|
||||
// get_mapdata_header
|
||||
// warp_shift
|
||||
// warp_set
|
||||
// warp_data_is_not_neg_1
|
||||
struct MapHeader * const get_mapheader_by_bank_and_number(u16 mapGroup, u16 mapNum);
|
||||
struct MapHeader * const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
|
||||
struct MapHeader * const warp1_get_mapheader(void);
|
||||
// set_current_map_header_from_sav1_save_old_name
|
||||
// sub_805338C
|
||||
// LoadSaveblockMapHeader
|
||||
// sub_80533CC
|
||||
void warp_in(void);
|
||||
void warp1_set(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||
@ -81,14 +81,14 @@ void walkrun_find_lowest_active_bit_in_bitfield(void);
|
||||
u8 sub_8053B00(struct UnkPlayerStruct *playerStruct, u16 a2, u8 a3);
|
||||
u8 sub_8053B60(struct UnkPlayerStruct *playerStruct, u8, u16, u8);
|
||||
u16 cur_mapdata_block_role_at_screen_center_acc_to_sav1(void);
|
||||
bool32 IsBikingAllowedByMap(void);
|
||||
void sub_8053C98(void);
|
||||
void sub_8053CE4(s32 a1);
|
||||
u8 sav1_get_flash_used_on_map(void);
|
||||
bool32 Overworld_IsBikeAllowedOnCurrentMap(void);
|
||||
void SetDefaultFlashLevel(void);
|
||||
void Overworld_SetFlashLevel(s32 a1);
|
||||
u8 Overworld_GetFlashLevel(void);
|
||||
void sub_8053D14(u16);
|
||||
// sub_8053D30
|
||||
// sub_8053D6C
|
||||
// sub_8053D9C
|
||||
// GetLocationMusic
|
||||
// sav1_map_get_music
|
||||
// warp1_target_get_music
|
||||
// call_map_music_set_to_zero
|
||||
@ -97,21 +97,21 @@ void sav1_set_battle_music_maybe(u16);
|
||||
void sav1_reset_battle_music_maybe(void);
|
||||
void sub_8053F0C(void);
|
||||
void sub_8053F84(void);
|
||||
void ChangeMapMusic(u16);
|
||||
// is_warp1_light_level_8_or_9
|
||||
void Overworld_ChangeMusicTo(u16);
|
||||
// GetMapMusicFadeoutSpeed
|
||||
void sub_8053FF8(void);
|
||||
bool8 sub_8054034(void);
|
||||
void sub_8054044(void);
|
||||
// PlayAmbientCry
|
||||
void UpdateAmbientCry(s16 *, u16 *);
|
||||
void ChooseAmbientCrySpecies(void);
|
||||
u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum);
|
||||
// get_map_light_level_from_warp
|
||||
u8 sav1_map_get_light_level(void);
|
||||
u8 get_map_light_from_warp0(void);
|
||||
bool8 is_light_level_1_2_3_5_or_6(u8 a1);
|
||||
bool8 is_light_level_1_2_3_or_6(u8 a1);
|
||||
u8 is_light_level_8_or_9(u8);
|
||||
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
|
||||
// GetMapTypeByWarpData
|
||||
u8 Overworld_GetMapTypeOfSaveblockLocation(void);
|
||||
u8 get_map_type_from_warp0(void);
|
||||
bool8 is_map_type_1_2_3_5_or_6(u8 a1);
|
||||
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 a1);
|
||||
u8 Overworld_MapTypeIsIndoors(u8);
|
||||
// unref_sub_8054260
|
||||
u8 sav1_map_get_name();
|
||||
// sav1_map_get_battletype
|
||||
|
@ -42,16 +42,12 @@ void ScriptContext1_SetupScript(const u8 *ptr);
|
||||
void ScriptContext1_Stop(void);
|
||||
void EnableBothScriptContexts(void);
|
||||
void ScriptContext2_RunNewScript(const u8 *ptr);
|
||||
u8 *mapheader_get_tagged_pointer(u8 tag);
|
||||
void mapheader_run_script_by_tag(u8 tag);
|
||||
u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag);
|
||||
void mapheader_run_script_with_tag_x1(void);
|
||||
void mapheader_run_script_with_tag_x3(void);
|
||||
void mapheader_run_script_with_tag_x5(void);
|
||||
void mapheader_run_script_with_tag_x6(void);
|
||||
bool8 mapheader_run_first_tag2_script_list_match(void);
|
||||
void mapheader_run_first_tag4_script_list_match(void);
|
||||
u32 CalculateRamScriptChecksum(void);
|
||||
void ClearRamScript(void);
|
||||
bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId);
|
||||
u8 *GetRamScript(u8 objectId, u8 *script);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#define VAR_0x4095 0x4095
|
||||
#define VAR_0x4097 0x4097
|
||||
#define VAR_0x409a 0x409a
|
||||
#define VAR_WEATHER_INSTITUTE_CLEARED 0x040B3
|
||||
#define VAR_PORTHOLE 0x40B4
|
||||
|
||||
#define VAR_0x40BC 0x40BC
|
||||
|
@ -33,7 +33,7 @@ bool8 SweetScentWildEncounter(void);
|
||||
bool8 GetFishingWildMonListHeader(void);
|
||||
void FishingWildEncounter(u8 rod);
|
||||
u16 GetLocalWildMon(bool8 *isWaterMon);
|
||||
u16 GetMirageIslandMon(void);
|
||||
u16 GetLocalWaterMon(void);
|
||||
bool8 UpdateRepelCounter(void);
|
||||
|
||||
#endif // GUARD_WILD_ENCOUNTER_H
|
||||
|
@ -154,7 +154,7 @@ u8 GetMoveTarget(u16 move, u8 targetbyte); //get target of move
|
||||
void sub_80153D0(u8 atk); //pressure perish song pp decrement
|
||||
u8 CastformDataTypeChange(u8 bank);
|
||||
void b_push_move_exec(u8* bs_ptr);
|
||||
u8 sav1_map_get_light_level(void);
|
||||
u8 Overworld_GetMapTypeOfSaveblockLocation(void);
|
||||
u8 CalculatePlayerPartyCount(void);
|
||||
u16 Sqrt(u32 num);
|
||||
u8 sub_809070C(u16 nationalNum, u32 TiD, u32 PiD); //task prepare poke dex display
|
||||
@ -17570,28 +17570,28 @@ static void atkE4_getsecretpowereffect(void)
|
||||
{
|
||||
switch (gBattleTerrain)
|
||||
{
|
||||
case 0:
|
||||
case BATTLE_TERRAIN_GRASS:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 2;
|
||||
break;
|
||||
case 1:
|
||||
case BATTLE_TERRAIN_LONG_GRASS:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 1;
|
||||
break;
|
||||
case 2:
|
||||
case BATTLE_TERRAIN_SAND:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 27;
|
||||
break;
|
||||
case 3:
|
||||
case BATTLE_TERRAIN_UNDERWATER:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 23;
|
||||
break;
|
||||
case 4:
|
||||
case BATTLE_TERRAIN_WATER:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 22;
|
||||
break;
|
||||
case 5:
|
||||
case BATTLE_TERRAIN_POND:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 24;
|
||||
break;
|
||||
case 6:
|
||||
case BATTLE_TERRAIN_MOUNTAIN:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 7;
|
||||
break;
|
||||
case 7:
|
||||
case BATTLE_TERRAIN_CAVE:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 8;
|
||||
break;
|
||||
default:
|
||||
@ -17818,7 +17818,7 @@ void atkEF_pokeball_catch_calculation(void)
|
||||
ball_multiplier = 10;
|
||||
break;
|
||||
case ITEM_DIVE_BALL:
|
||||
if (sav1_map_get_light_level() == 5)
|
||||
if (Overworld_GetMapTypeOfSaveblockLocation() == 5)
|
||||
ball_multiplier = 35;
|
||||
else
|
||||
ball_multiplier = 10;
|
||||
|
@ -642,11 +642,11 @@ s8 BattleSetup_GetTerrain(void)
|
||||
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
|
||||
if (MetatileBehavior_IsTallGrass(tileBehavior))
|
||||
return 0;
|
||||
return BATTLE_TERRAIN_GRASS;
|
||||
if (MetatileBehavior_IsLongGrass(tileBehavior))
|
||||
return 1;
|
||||
return BATTLE_TERRAIN_LONG_GRASS;
|
||||
if (MetatileBehavior_IsSandOrDeepSand(tileBehavior))
|
||||
return 2;
|
||||
return BATTLE_TERRAIN_SAND;
|
||||
switch (gMapHeader.mapType)
|
||||
{
|
||||
case MAP_TYPE_TOWN:
|
||||
@ -655,38 +655,38 @@ s8 BattleSetup_GetTerrain(void)
|
||||
break;
|
||||
case MAP_TYPE_UNDERGROUND:
|
||||
if (sub_80574C4(tileBehavior))
|
||||
return 8;
|
||||
return BATTLE_TERRAIN_BUILDING;
|
||||
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
|
||||
return 5;
|
||||
return 7;
|
||||
return BATTLE_TERRAIN_POND;
|
||||
return BATTLE_TERRAIN_CAVE;
|
||||
case MAP_TYPE_INDOOR:
|
||||
case MAP_TYPE_SECRET_BASE:
|
||||
return 8;
|
||||
return BATTLE_TERRAIN_BUILDING;
|
||||
case MAP_TYPE_UNDERWATER:
|
||||
return 3;
|
||||
return BATTLE_TERRAIN_UNDERWATER;
|
||||
case MAP_TYPE_6:
|
||||
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
|
||||
return 4;
|
||||
return 9;
|
||||
return BATTLE_TERRAIN_WATER;
|
||||
return BATTLE_TERRAIN_PLAIN;
|
||||
}
|
||||
if (sub_8057568(tileBehavior))
|
||||
return 4;
|
||||
return BATTLE_TERRAIN_WATER;
|
||||
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
|
||||
return 5;
|
||||
return BATTLE_TERRAIN_POND;
|
||||
if (sub_80574D8(tileBehavior))
|
||||
return 6;
|
||||
return BATTLE_TERRAIN_MOUNTAIN;
|
||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||
{
|
||||
if (sub_8057450(tileBehavior))
|
||||
return 5;
|
||||
return BATTLE_TERRAIN_POND;
|
||||
if (MetatileBehavior_IsBridge(tileBehavior) == TRUE)
|
||||
return 4;
|
||||
return BATTLE_TERRAIN_WATER;
|
||||
}
|
||||
if (gSaveBlock1.location.mapGroup == 0 && gSaveBlock1.location.mapNum == 28)
|
||||
return 2;
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_ROUTE113 && gSaveBlock1.location.mapNum == MAP_ID_ROUTE113)
|
||||
return BATTLE_TERRAIN_SAND;
|
||||
if (GetSav1Weather() == 8)
|
||||
return 2;
|
||||
return 9;
|
||||
return BATTLE_TERRAIN_SAND;
|
||||
return BATTLE_TERRAIN_PLAIN;
|
||||
}
|
||||
|
||||
static s8 GetBattleTransitionTypeByMap(void)
|
||||
@ -696,7 +696,7 @@ static s8 GetBattleTransitionTypeByMap(void)
|
||||
|
||||
PlayerGetDestCoords(&x, &y);
|
||||
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (sav1_get_flash_used_on_map())
|
||||
if (Overworld_GetFlashLevel())
|
||||
return 2;
|
||||
if (!MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
|
||||
{
|
||||
|
@ -944,7 +944,7 @@ void GetOnOffBike(u8 var)
|
||||
{
|
||||
SetPlayerAvatarTransitionFlags(var);
|
||||
sav1_set_battle_music_maybe(BGM_CYCLING);
|
||||
ChangeMapMusic(BGM_CYCLING);
|
||||
Overworld_ChangeMusicTo(BGM_CYCLING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
|
||||
gUnknown_030041B8 = 0;
|
||||
|
||||
InitWindowFromConfig(&gUnknown_03004210, &gWindowConfig_81E6C58);
|
||||
gBattleTerrain = 9;
|
||||
gBattleTerrain = BATTLE_TERRAIN_PLAIN;
|
||||
|
||||
sub_800D6D4();
|
||||
sub_800DAB8();
|
||||
@ -320,7 +320,7 @@ static void CB2_EvolutionSceneLoadGraphics(void)
|
||||
gUnknown_030041B8 = 0;
|
||||
|
||||
InitWindowFromConfig(&gUnknown_03004210, &gWindowConfig_81E6C58);
|
||||
gBattleTerrain = 9;
|
||||
gBattleTerrain = BATTLE_TERRAIN_PLAIN;
|
||||
|
||||
sub_800D6D4();
|
||||
sub_800DAB8();
|
||||
|
@ -698,7 +698,7 @@ static void sub_8068C30(struct MapHeader *unused, s8 b, struct MapPosition *posi
|
||||
|
||||
warp1_set_2(warpEvent->unk7, warpEvent->mapNum, warpEvent->mapGroup);
|
||||
sub_80535C4(position->x, position->y);
|
||||
mapHeader = get_mapheader_by_bank_and_number(warpEvent->unk7, warpEvent->mapNum);
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->unk7, warpEvent->mapNum);
|
||||
if (mapHeader->events->warps[warpEvent->mapGroup].mapNum == 0x7F)
|
||||
saved_warp2_set(mapHeader->events->warps[b].mapGroup, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, b);
|
||||
}
|
||||
|
@ -2385,7 +2385,7 @@ void sub_8088890(struct Sprite *);
|
||||
bool8 FldEff_FieldMoveShowMon(void)
|
||||
{
|
||||
u8 taskId;
|
||||
if (is_light_level_1_2_3_5_or_6(sav1_map_get_light_level()) == TRUE)
|
||||
if (is_map_type_1_2_3_5_or_6(Overworld_GetMapTypeOfSaveblockLocation()) == TRUE)
|
||||
{
|
||||
taskId = CreateTask(sub_8088120, 0xff);
|
||||
} else
|
||||
@ -2881,7 +2881,7 @@ u8 FldEff_UseSurf(void)
|
||||
taskId = CreateTask(sub_8088954, 0xff);
|
||||
gTasks[taskId].data[15] = gFieldEffectArguments[0];
|
||||
sav1_reset_battle_music_maybe();
|
||||
ChangeMapMusic(0x016d);
|
||||
Overworld_ChangeMusicTo(0x016d);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ void palette_bg_fill_black(void)
|
||||
|
||||
void pal_fill_for_map_transition(void)
|
||||
{
|
||||
u8 map_light = get_map_light_from_warp0();
|
||||
switch (fade_type_for_given_maplight_pair(map_light, sav1_map_get_light_level()))
|
||||
u8 map_light = get_map_type_from_warp0();
|
||||
switch (fade_type_for_given_maplight_pair(map_light, Overworld_GetMapTypeOfSaveblockLocation()))
|
||||
{
|
||||
case 0:
|
||||
fade_screen(0, 0);
|
||||
@ -61,7 +61,7 @@ void pal_fill_black(void)
|
||||
|
||||
void fade_8080918(void)
|
||||
{
|
||||
u8 light_level = sav1_map_get_light_level();
|
||||
u8 light_level = Overworld_GetMapTypeOfSaveblockLocation();
|
||||
switch (sub_810CDB8(light_level, warp1_get_mapheader()->mapType))
|
||||
{
|
||||
case 0:
|
||||
|
@ -3244,7 +3244,7 @@ struct MapObjectTemplate *GetFieldObjectTemplateByLocalIdAndMap(u8 localId, u8 m
|
||||
return FindFieldObjectTemplateInArrayByLocalId(localId, gSaveBlock1.mapObjectTemplates, gMapHeader.events->mapObjectCount);
|
||||
else
|
||||
{
|
||||
struct MapHeader *mapHeader = get_mapheader_by_bank_and_number(mapGroup, mapNum);
|
||||
struct MapHeader *mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
|
||||
|
||||
return FindFieldObjectTemplateInArrayByLocalId(localId, mapHeader->events->mapObjects, mapHeader->events->mapObjectCount);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ extern u16 gUnknown_03004DE0[][0x3C0];
|
||||
|
||||
const static u16 gUnknown_0839ACDC[] = { 0xC8, 0x48, 0x38, 0x28, 0x18, 0x0 };
|
||||
|
||||
const s32 gUnknown_0839ACE8 = 4;
|
||||
const s32 gMaxFlashLevel = 4;
|
||||
|
||||
const static u32 gUnknown_0839ACEC[3] =
|
||||
{
|
||||
@ -137,11 +137,11 @@ static u8 sub_8081534(s32 a1, s32 a2, s32 a3, s32 a4, s32 a5, u8 a6)
|
||||
|
||||
void sub_8081594(u8 a1)
|
||||
{
|
||||
u8 index = sav1_get_flash_used_on_map();
|
||||
u8 flashLevel = Overworld_GetFlashLevel();
|
||||
u8 value = 0;
|
||||
if (!a1)
|
||||
value = 1;
|
||||
sub_8081534(120, 80, gUnknown_0839ACDC[index], gUnknown_0839ACDC[a1], value, 1);
|
||||
sub_8081534(120, 80, gUnknown_0839ACDC[flashLevel], gUnknown_0839ACDC[a1], value, 1);
|
||||
sub_8081510();
|
||||
ScriptContext2_Enable();
|
||||
}
|
||||
|
@ -2005,7 +2005,7 @@ bool8 sub_810F828(void)
|
||||
|
||||
void SetRoute119Weather(void)
|
||||
{
|
||||
if (is_light_level_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE)
|
||||
if (is_map_type_1_2_3_5_or_6(get_map_type_from_warp0()) != TRUE)
|
||||
{
|
||||
SetSav1Weather(0x14);
|
||||
}
|
||||
@ -2013,7 +2013,7 @@ void SetRoute119Weather(void)
|
||||
|
||||
void SetRoute123Weather(void)
|
||||
{
|
||||
if (is_light_level_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE)
|
||||
if (is_map_type_1_2_3_5_or_6(get_map_type_from_warp0()) != TRUE)
|
||||
{
|
||||
SetSav1Weather(0x15);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ static const struct ConnectionFlags sDummyConnectionFlags = {0};
|
||||
|
||||
struct MapHeader *mapconnection_get_mapheader(struct MapConnection *connection)
|
||||
{
|
||||
return get_mapheader_by_bank_and_number(connection->mapGroup, connection->mapNum);
|
||||
return Overworld_GetMapHeaderByGroupAndId(connection->mapGroup, connection->mapNum);
|
||||
}
|
||||
|
||||
void not_trainer_hill_battle_pyramid(void)
|
||||
|
@ -38,7 +38,7 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
|
||||
if(npc_before_player_of_type(0x52) == TRUE) // is in front of tree?
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_80A2634;
|
||||
return TRUE;
|
||||
}
|
||||
@ -57,7 +57,7 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
if(MetatileBehavior_IsPokeGrass(tileBehavior) == TRUE
|
||||
|| MetatileBehavior_IsAshGrass(tileBehavior) == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_80A25E8;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ bool8 SetUpFieldMove_Flash(void)
|
||||
{
|
||||
if (gMapHeader.cave == TRUE && !FlagGet(SYS_USE_FLASH))
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_810CBFC;
|
||||
return TRUE;
|
||||
}
|
||||
@ -123,8 +123,8 @@ void sub_810CC80(void)
|
||||
bool8 sub_810CD5C(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 v0 = get_map_light_from_warp0();
|
||||
u8 v1 = sav1_map_get_light_level();
|
||||
u8 v0 = get_map_type_from_warp0();
|
||||
u8 v1 = Overworld_GetMapTypeOfSaveblockLocation();
|
||||
|
||||
for (i = 0; gUnknown_083F7FC4[i].unk0; i++)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ bool8 SetUpFieldMove_Strength(void)
|
||||
if (ShouldDoBrailleStrengthEffect())
|
||||
{
|
||||
gScriptResult = gLastFieldPokeMenuOpened;
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_811AA38;
|
||||
}
|
||||
else
|
||||
@ -33,7 +33,7 @@ bool8 SetUpFieldMove_Strength(void)
|
||||
if (npc_before_player_of_type(87) != TRUE)
|
||||
return 0;
|
||||
gScriptResult = gLastFieldPokeMenuOpened;
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_811AA18;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ extern u8 SweetScentNothingHereScript[];
|
||||
|
||||
bool8 SetUpFieldMove_SweetScent(void)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_812BFD4;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ extern void (*gUnknown_03005CE4)(void);
|
||||
|
||||
bool8 SetUpFieldMove_Teleport(void)
|
||||
{
|
||||
if (is_light_level_1_2_3_or_6(gMapHeader.mapType) == TRUE)
|
||||
if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = hm_teleport_run_dp02scr;
|
||||
return TRUE;
|
||||
}
|
||||
@ -25,7 +25,7 @@ bool8 SetUpFieldMove_Teleport(void)
|
||||
|
||||
void hm_teleport_run_dp02scr(void)
|
||||
{
|
||||
new_game();
|
||||
Overworld_ResetStateAfterTeleport();
|
||||
FieldEffectStart(63);
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void ItemUseOutOfBattle_Bike(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsBikingAllowedByMap() == TRUE && IsBikingDisallowedByPlayer() == FALSE)
|
||||
if (Overworld_IsBikeAllowedOnCurrentMap() == TRUE && IsBikingDisallowedByPlayer() == FALSE)
|
||||
{
|
||||
gUnknown_03005D00 = (void *)ItemUseOnFieldCB_Bike;
|
||||
SetUpItemUseOnFieldCallback(taskId);
|
||||
|
404
src/main_menu.c
404
src/main_menu.c
@ -56,32 +56,14 @@ extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E79AC[];
|
||||
|
||||
extern u8 unk_2000000[];
|
||||
|
||||
//Task data
|
||||
enum {
|
||||
TD_MENULAYOUT,
|
||||
TD_SELECTEDMENUITEM,
|
||||
};
|
||||
|
||||
//Menu layouts
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
HAS_NO_SAVED_GAME, //NEW GAME, OPTION
|
||||
HAS_SAVED_GAME, //CONTINUE, NEW GAME, OPTION
|
||||
HAS_MYSTERY_GIFT, //CONTINUE, NEW GAME, MYSTERY EVENTS, OPTION
|
||||
};
|
||||
|
||||
//Task data
|
||||
enum {
|
||||
TD_TRAINER_SPRITE_ID = 2, //Trainer sprite being displayed during gender menu
|
||||
TD_BGHOFS = 4, //Used to set REG_BG1HOFS and slide the platform around
|
||||
TD_SUBTASK_DONE, //Set to true if the spawned task has finished
|
||||
TD_GENDER_SELECTION,
|
||||
TD_COUNTER,
|
||||
TD_BIRCH_SPRITE_ID,
|
||||
TD_AZURILL_SPRITE_ID,
|
||||
TD_BRENDAN_SPRITE_ID,
|
||||
TD_MAY_SPRITE_ID
|
||||
};
|
||||
|
||||
static void CB2_MainMenu(void);
|
||||
static void VBlankCB_MainMenu(void);
|
||||
static void CB2_InitMainMenuFromOptions(void);
|
||||
@ -180,6 +162,9 @@ static void CB2_InitMainMenuFromOptions(void)
|
||||
InitMainMenu(TRUE);
|
||||
}
|
||||
|
||||
#define tMenuLayout data[0]
|
||||
#define tMenuSelection data[1]
|
||||
|
||||
u32 InitMainMenu(u8 a1)
|
||||
{
|
||||
u16 savedIme;
|
||||
@ -239,7 +224,7 @@ u32 InitMainMenu(u8 a1)
|
||||
| DISPCNT_WIN0_ON;
|
||||
|
||||
taskId = CreateTask(Task_MainMenuCheckSave, 0);
|
||||
gTasks[taskId].data[TD_SELECTEDMENUITEM] = 0;
|
||||
gTasks[taskId].tMenuSelection = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -261,9 +246,9 @@ void Task_MainMenuCheckSave(u8 taskId)
|
||||
{
|
||||
case 1:
|
||||
if (IsMysteryGiftEnabled() == TRUE)
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_MYSTERY_GIFT;
|
||||
gTasks[taskId].tMenuLayout = HAS_MYSTERY_GIFT;
|
||||
else
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_SAVED_GAME;
|
||||
gTasks[taskId].tMenuLayout = HAS_SAVED_GAME;
|
||||
|
||||
gTasks[taskId].func = Task_MainMenuCheckRtc;
|
||||
break;
|
||||
@ -272,7 +257,7 @@ void Task_MainMenuCheckSave(u8 taskId)
|
||||
MenuPrintMessage(gSaveFileDeletedMessage, 3, 15);
|
||||
REG_WIN0H = WIN_RANGE(17, 223);
|
||||
REG_WIN0V = WIN_RANGE(113, 159);
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_NO_SAVED_GAME;
|
||||
gTasks[taskId].tMenuLayout = HAS_NO_SAVED_GAME;
|
||||
gTasks[taskId].func = Task_MainMenuWaitForSaveErrorAck;
|
||||
break;
|
||||
case 255:
|
||||
@ -280,17 +265,17 @@ void Task_MainMenuCheckSave(u8 taskId)
|
||||
MenuPrintMessage(gSaveFileCorruptMessage, 3, 15);
|
||||
REG_WIN0H = WIN_RANGE(17, 223);
|
||||
REG_WIN0V = WIN_RANGE(113, 159);
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_SAVED_GAME;
|
||||
gTasks[taskId].tMenuLayout = HAS_SAVED_GAME;
|
||||
gTasks[taskId].func = Task_MainMenuWaitForSaveErrorAck;
|
||||
|
||||
if (IsMysteryGiftEnabled() == TRUE)
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_MYSTERY_GIFT;
|
||||
gTasks[taskId].tMenuLayout = HAS_MYSTERY_GIFT;
|
||||
else
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_SAVED_GAME;
|
||||
gTasks[taskId].tMenuLayout = HAS_SAVED_GAME;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_NO_SAVED_GAME;
|
||||
gTasks[taskId].tMenuLayout = HAS_NO_SAVED_GAME;
|
||||
gTasks[taskId].func = Task_MainMenuCheckRtc;
|
||||
break;
|
||||
case 4:
|
||||
@ -298,7 +283,7 @@ void Task_MainMenuCheckSave(u8 taskId)
|
||||
MenuPrintMessage(gBoardNotInstalledMessage, 3, 15);
|
||||
REG_WIN0H = WIN_RANGE(17, 223);
|
||||
REG_WIN0V = WIN_RANGE(113, 159);
|
||||
gTasks[taskId].data[TD_MENULAYOUT] = HAS_NO_SAVED_GAME;
|
||||
gTasks[taskId].tMenuLayout = HAS_NO_SAVED_GAME;
|
||||
gTasks[taskId].func = Task_MainMenuWaitForSaveErrorAck;
|
||||
return;
|
||||
}
|
||||
@ -383,7 +368,7 @@ void Task_MainMenuDraw(u8 taskId)
|
||||
LoadPalette(&palette, 241, 2);
|
||||
}
|
||||
|
||||
switch (gTasks[taskId].data[TD_MENULAYOUT])
|
||||
switch (gTasks[taskId].tMenuLayout)
|
||||
{
|
||||
case HAS_NO_SAVED_GAME:
|
||||
default:
|
||||
@ -420,7 +405,7 @@ void Task_MainMenuDraw(u8 taskId)
|
||||
|
||||
void Task_MainMenuHighlight(u8 taskId)
|
||||
{
|
||||
HighlightCurrentMenuItem(gTasks[taskId].data[TD_MENULAYOUT], gTasks[taskId].data[TD_SELECTEDMENUITEM]);
|
||||
HighlightCurrentMenuItem(gTasks[taskId].tMenuLayout, gTasks[taskId].tMenuSelection);
|
||||
gTasks[taskId].func = Task_MainMenuProcessKeyInput;
|
||||
}
|
||||
|
||||
@ -444,7 +429,7 @@ bool8 MainMenuProcessKeyInput(u8 taskId)
|
||||
{
|
||||
s32 menuItemCount;
|
||||
|
||||
switch (gTasks[taskId].data[TD_MENULAYOUT])
|
||||
switch (gTasks[taskId].tMenuLayout)
|
||||
{
|
||||
case HAS_NO_SAVED_GAME:
|
||||
default:
|
||||
@ -460,17 +445,17 @@ bool8 MainMenuProcessKeyInput(u8 taskId)
|
||||
|
||||
if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SELECTEDMENUITEM] > 0)
|
||||
if (gTasks[taskId].tMenuSelection > 0)
|
||||
{
|
||||
gTasks[taskId].data[TD_SELECTEDMENUITEM]--;
|
||||
gTasks[taskId].tMenuSelection--;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (gMain.newKeys & DPAD_DOWN)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SELECTEDMENUITEM] < menuItemCount - 1)
|
||||
if (gTasks[taskId].tMenuSelection < menuItemCount - 1)
|
||||
{
|
||||
gTasks[taskId].data[TD_SELECTEDMENUITEM]++;
|
||||
gTasks[taskId].tMenuSelection++;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -499,11 +484,11 @@ void Task_MainMenuPressedA(u8 taskId)
|
||||
if (gPaletteFade.active)
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].data[TD_MENULAYOUT])
|
||||
switch (gTasks[taskId].tMenuLayout)
|
||||
{
|
||||
case HAS_NO_SAVED_GAME:
|
||||
default:
|
||||
switch (gTasks[taskId].data[TD_SELECTEDMENUITEM])
|
||||
switch (gTasks[taskId].tMenuSelection)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
@ -515,7 +500,7 @@ void Task_MainMenuPressedA(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case HAS_SAVED_GAME:
|
||||
switch (gTasks[taskId].data[TD_SELECTEDMENUITEM])
|
||||
switch (gTasks[taskId].tMenuSelection)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
@ -530,7 +515,7 @@ void Task_MainMenuPressedA(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case HAS_MYSTERY_GIFT:
|
||||
switch (gTasks[taskId].data[TD_SELECTEDMENUITEM])
|
||||
switch (gTasks[taskId].tMenuSelection)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
@ -584,6 +569,9 @@ void Task_MainMenuPressedB(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
#undef tMenuLayout
|
||||
#undef tMenuSelection
|
||||
|
||||
void HighlightCurrentMenuItem(u8 layout, u8 menuItem)
|
||||
{
|
||||
REG_WIN0H = WIN_RANGE(9, 231);
|
||||
@ -710,6 +698,16 @@ void PrintBadgeCount(void)
|
||||
MenuPrint_PixelCoords(buffer, 205, 40, 1);
|
||||
}
|
||||
|
||||
#define tTrainerSpriteId data[2]
|
||||
#define tBGhofs data[4]
|
||||
#define tSubtaskIsDone data[5]
|
||||
#define tGenderSelection data[6]
|
||||
#define tFrameCounter data[7]
|
||||
#define tBirchSpriteId data[8]
|
||||
#define tAzurillSpriteId data[9]
|
||||
#define tBrendanSpriteId data[10]
|
||||
#define tMaySpriteId data[11]
|
||||
|
||||
static void Task_NewGameSpeech1(u8 taskId)
|
||||
{
|
||||
SetUpWindowConfig(&gWindowConfig_81E6C3C);
|
||||
@ -732,25 +730,25 @@ static void Task_NewGameSpeech1(u8 taskId)
|
||||
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
|
||||
REG_BG1CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
|
||||
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP;
|
||||
gTasks[taskId].data[TD_BGHOFS] = 0;
|
||||
gTasks[taskId].tBGhofs = 0;
|
||||
gTasks[taskId].func = Task_NewGameSpeech2;
|
||||
gTasks[taskId].data[TD_TRAINER_SPRITE_ID] = 0xFF;
|
||||
gTasks[taskId].tTrainerSpriteId = 0xFF;
|
||||
gTasks[taskId].data[3] = 0xFF;
|
||||
gTasks[taskId].data[TD_COUNTER] = 216; //Wait 3.6 seconds (216 frames) before starting speech
|
||||
gTasks[taskId].tFrameCounter = 216; //Wait 3.6 seconds (216 frames) before starting speech
|
||||
|
||||
PlayBGM(BGM_DOORO_X4);
|
||||
}
|
||||
|
||||
static void Task_NewGameSpeech2(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_COUNTER] != 0)
|
||||
if (gTasks[taskId].tFrameCounter != 0)
|
||||
{
|
||||
gTasks[taskId].data[TD_COUNTER]--;
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Initialize Birch sprite
|
||||
u8 spriteId = gTasks[taskId].data[TD_BIRCH_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tBirchSpriteId;
|
||||
|
||||
gSprites[spriteId].pos1.x = 136;
|
||||
gSprites[spriteId].pos1.y = 60;
|
||||
@ -758,19 +756,19 @@ static void Task_NewGameSpeech2(u8 taskId)
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
StartSpriteFadeIn(taskId, 10);
|
||||
StartBackgroundFadeIn(taskId, 20);
|
||||
gTasks[taskId].data[TD_COUNTER] = 80;
|
||||
gTasks[taskId].tFrameCounter = 80;
|
||||
gTasks[taskId].func = Task_NewGameSpeech3;
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_NewGameSpeech3(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE] != FALSE)
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
gSprites[gTasks[taskId].data[TD_BIRCH_SPRITE_ID]].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
if (gTasks[taskId].data[TD_COUNTER])
|
||||
gSprites[gTasks[taskId].tBirchSpriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
if (gTasks[taskId].tFrameCounter)
|
||||
{
|
||||
gTasks[taskId].data[TD_COUNTER]--;
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -801,7 +799,7 @@ static void Task_NewGameSpeech5(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech6(u8 taskId)
|
||||
{
|
||||
u8 spriteId = gTasks[taskId].data[TD_AZURILL_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tAzurillSpriteId;
|
||||
|
||||
gSprites[spriteId].pos1.x = 104;
|
||||
gSprites[spriteId].pos1.y = 72;
|
||||
@ -809,7 +807,7 @@ static void Task_NewGameSpeech6(u8 taskId)
|
||||
gSprites[spriteId].data0 = 0;
|
||||
CreatePokeballSprite(spriteId, gSprites[spriteId].oam.paletteNum, 0x70, 0x3A, 0, 0, 0x20, 0x0000FFFF);
|
||||
gTasks[taskId].func = Task_NewGameSpeech7;
|
||||
gTasks[taskId].data[TD_COUNTER] = 0;
|
||||
gTasks[taskId].tFrameCounter = 0;
|
||||
}
|
||||
|
||||
static void Task_NewGameSpeech7(u8 taskId)
|
||||
@ -817,18 +815,18 @@ static void Task_NewGameSpeech7(u8 taskId)
|
||||
if (IsCryFinished())
|
||||
{
|
||||
//Go on to next sentence after frame 95
|
||||
if (gTasks[taskId].data[TD_COUNTER] > 95)
|
||||
if (gTasks[taskId].tFrameCounter > 95)
|
||||
{
|
||||
MenuSetText(gSystemText_NewPara);
|
||||
gTasks[taskId].func = Task_NewGameSpeech8;
|
||||
}
|
||||
}
|
||||
|
||||
if (gTasks[taskId].data[TD_COUNTER] < 16384)
|
||||
if (gTasks[taskId].tFrameCounter < 16384)
|
||||
{
|
||||
gTasks[taskId].data[TD_COUNTER]++;
|
||||
gTasks[taskId].tFrameCounter++;
|
||||
//Play Azurill cry at frame 32
|
||||
if (gTasks[taskId].data[TD_COUNTER] == 32)
|
||||
if (gTasks[taskId].tFrameCounter == 32)
|
||||
PlayCry1(SPECIES_AZURILL, 0);
|
||||
}
|
||||
}
|
||||
@ -859,11 +857,11 @@ static void Task_NewGameSpeech10(u8 taskId)
|
||||
{
|
||||
if (BirchSpeechUpdateWindowText())
|
||||
{
|
||||
gSprites[gTasks[taskId].data[TD_BIRCH_SPRITE_ID]].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gSprites[gTasks[taskId].data[TD_AZURILL_SPRITE_ID]].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gSprites[gTasks[taskId].tBirchSpriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gSprites[gTasks[taskId].tAzurillSpriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
StartSpriteFadeOut(taskId, 2);
|
||||
StartBackgroundFadeOut(taskId, 1);
|
||||
gTasks[taskId].data[TD_COUNTER] = 64;
|
||||
gTasks[taskId].tFrameCounter = 64;
|
||||
gTasks[taskId].func = Task_NewGameSpeech11;
|
||||
}
|
||||
}
|
||||
@ -871,41 +869,41 @@ static void Task_NewGameSpeech10(u8 taskId)
|
||||
//Slide platform away to the right
|
||||
static void Task_NewGameSpeech11(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_BGHOFS] != -60)
|
||||
if (gTasks[taskId].tBGhofs != -60)
|
||||
{
|
||||
gTasks[taskId].data[TD_BGHOFS] -= 2;
|
||||
REG_BG1HOFS = gTasks[taskId].data[TD_BGHOFS];
|
||||
gTasks[taskId].tBGhofs -= 2;
|
||||
REG_BG1HOFS = gTasks[taskId].tBGhofs;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[TD_BGHOFS] = -60;
|
||||
gTasks[taskId].tBGhofs = -60;
|
||||
gTasks[taskId].func = Task_NewGameSpeech12;
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_NewGameSpeech12(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
//Hide Birch and Azurill
|
||||
gSprites[gTasks[taskId].data[TD_BIRCH_SPRITE_ID]].invisible = TRUE;
|
||||
gSprites[gTasks[taskId].data[TD_AZURILL_SPRITE_ID]].invisible = TRUE;
|
||||
gSprites[gTasks[taskId].tBirchSpriteId].invisible = TRUE;
|
||||
gSprites[gTasks[taskId].tAzurillSpriteId].invisible = TRUE;
|
||||
|
||||
if (gTasks[taskId].data[TD_COUNTER])
|
||||
if (gTasks[taskId].tFrameCounter)
|
||||
{
|
||||
gTasks[taskId].data[TD_COUNTER]--;
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Initialize Brendan sprite
|
||||
u8 spriteId = gTasks[taskId].data[TD_BRENDAN_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tBrendanSpriteId;
|
||||
|
||||
gSprites[spriteId].pos1.x = 180;
|
||||
gSprites[spriteId].pos1.y = 60;
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gTasks[taskId].data[TD_TRAINER_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].data[TD_GENDER_SELECTION] = 0;
|
||||
gTasks[taskId].tTrainerSpriteId = spriteId;
|
||||
gTasks[taskId].tGenderSelection = 0;
|
||||
StartSpriteFadeIn(taskId, 2);
|
||||
StartBackgroundFadeIn(taskId, 1);
|
||||
gTasks[taskId].func = Task_NewGameSpeech13;
|
||||
@ -915,9 +913,9 @@ static void Task_NewGameSpeech12(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech13(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
gSprites[gTasks[taskId].data[TD_TRAINER_SPRITE_ID]].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
gSprites[gTasks[taskId].tTrainerSpriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
gTasks[taskId].func = Task_NewGameSpeech14;
|
||||
}
|
||||
}
|
||||
@ -964,11 +962,11 @@ static void Task_NewGameSpeech16(u8 taskId)
|
||||
|
||||
cursorPos = GetMenuCursorPos();
|
||||
|
||||
if (cursorPos != gTasks[taskId].data[TD_GENDER_SELECTION])
|
||||
if (cursorPos != gTasks[taskId].tGenderSelection)
|
||||
{
|
||||
//Menu selection changed. Slide Brendan or May out and slide the other in
|
||||
gTasks[taskId].data[TD_GENDER_SELECTION] = cursorPos;
|
||||
gSprites[gTasks[taskId].data[TD_TRAINER_SPRITE_ID]].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gTasks[taskId].tGenderSelection = cursorPos;
|
||||
gSprites[gTasks[taskId].tTrainerSpriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
StartSpriteFadeOut(taskId, 0);
|
||||
gTasks[taskId].func = Task_NewGameSpeech17;
|
||||
}
|
||||
@ -977,9 +975,9 @@ static void Task_NewGameSpeech16(u8 taskId)
|
||||
//Slide old trainer sprite off right of screen
|
||||
static void Task_NewGameSpeech17(u8 taskId)
|
||||
{
|
||||
u8 spriteId = gTasks[taskId].data[TD_TRAINER_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tTrainerSpriteId;
|
||||
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE] == FALSE)
|
||||
if (gTasks[taskId].tSubtaskIsDone == FALSE)
|
||||
{
|
||||
gSprites[spriteId].pos1.x += 4; //Move sprite right
|
||||
}
|
||||
@ -988,14 +986,14 @@ static void Task_NewGameSpeech17(u8 taskId)
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
|
||||
//Set up new trainer sprite
|
||||
if (gTasks[taskId].data[TD_GENDER_SELECTION])
|
||||
spriteId = gTasks[taskId].data[TD_MAY_SPRITE_ID];
|
||||
if (gTasks[taskId].tGenderSelection)
|
||||
spriteId = gTasks[taskId].tMaySpriteId;
|
||||
else
|
||||
spriteId = gTasks[taskId].data[TD_BRENDAN_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tBrendanSpriteId;
|
||||
gSprites[spriteId].pos1.x = 240;
|
||||
gSprites[spriteId].pos1.y = 60;
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
gTasks[taskId].data[TD_TRAINER_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tTrainerSpriteId = spriteId;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
StartSpriteFadeIn(taskId, 0);
|
||||
gTasks[taskId].func = Task_NewGameSpeech18;
|
||||
@ -1005,7 +1003,7 @@ static void Task_NewGameSpeech17(u8 taskId)
|
||||
//Slide new trainer sprite from right of screen
|
||||
static void Task_NewGameSpeech18(u8 taskId)
|
||||
{
|
||||
u8 spriteId = gTasks[taskId].data[TD_TRAINER_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tTrainerSpriteId;
|
||||
|
||||
if (gSprites[spriteId].pos1.x > 180)
|
||||
{
|
||||
@ -1014,7 +1012,7 @@ static void Task_NewGameSpeech18(u8 taskId)
|
||||
else
|
||||
{
|
||||
gSprites[spriteId].pos1.x = 180;
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
gTasks[taskId].func = Task_NewGameSpeech16; //Go back to gender menu
|
||||
@ -1106,7 +1104,7 @@ static void Task_NewGameSpeech25(u8 taskId)
|
||||
case 0: //YES
|
||||
PlaySE(SE_SELECT);
|
||||
MenuZeroFillWindowRect(2, 1, 8, 7);
|
||||
gSprites[gTasks[taskId].data[TD_TRAINER_SPRITE_ID]].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gSprites[gTasks[taskId].tTrainerSpriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
StartSpriteFadeOut(taskId, 2);
|
||||
StartBackgroundFadeOut(taskId, 1);
|
||||
gTasks[taskId].func = Task_NewGameSpeech26; //Continue
|
||||
@ -1122,10 +1120,10 @@ static void Task_NewGameSpeech25(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech26(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_BGHOFS])
|
||||
if (gTasks[taskId].tBGhofs)
|
||||
{
|
||||
gTasks[taskId].data[TD_BGHOFS] += 2;
|
||||
REG_BG1HOFS = gTasks[taskId].data[TD_BGHOFS];
|
||||
gTasks[taskId].tBGhofs += 2;
|
||||
REG_BG1HOFS = gTasks[taskId].tBGhofs;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1135,23 +1133,23 @@ static void Task_NewGameSpeech26(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech27(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
s16 spriteId;
|
||||
|
||||
//Hide Brendan and May sprites
|
||||
spriteId = gTasks[taskId].data[TD_BRENDAN_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tBrendanSpriteId;
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
spriteId = gTasks[taskId].data[TD_MAY_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tMaySpriteId;
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
|
||||
//Fade in Birch and Azurill
|
||||
spriteId = (u8)gTasks[taskId].data[TD_BIRCH_SPRITE_ID];
|
||||
spriteId = (u8)gTasks[taskId].tBirchSpriteId;
|
||||
gSprites[spriteId].pos1.x = 136;
|
||||
gSprites[spriteId].pos1.y = 64;
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
spriteId = (u8)gTasks[taskId].data[TD_AZURILL_SPRITE_ID];
|
||||
spriteId = (u8)gTasks[taskId].tAzurillSpriteId;
|
||||
gSprites[spriteId].pos1.x = 104;
|
||||
gSprites[spriteId].pos1.y = 72;
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
@ -1170,27 +1168,27 @@ static void Task_NewGameSpeech27(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech28(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
s16 spriteId;
|
||||
|
||||
spriteId = gTasks[taskId].data[TD_BIRCH_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tBirchSpriteId;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
|
||||
spriteId = gTasks[taskId].data[TD_AZURILL_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tAzurillSpriteId;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
|
||||
if (BirchSpeechUpdateWindowText())
|
||||
{
|
||||
//Fade out Birch and Azurill
|
||||
spriteId = gTasks[taskId].data[TD_BIRCH_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tBirchSpriteId;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
spriteId = gTasks[taskId].data[TD_AZURILL_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tAzurillSpriteId;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
|
||||
StartSpriteFadeOut(taskId, 2);
|
||||
StartBackgroundFadeOut(taskId, 1);
|
||||
gTasks[taskId].data[TD_COUNTER] = 64;
|
||||
gTasks[taskId].tFrameCounter = 64;
|
||||
gTasks[taskId].func = Task_NewGameSpeech29;
|
||||
}
|
||||
}
|
||||
@ -1198,19 +1196,19 @@ static void Task_NewGameSpeech28(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech29(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
s16 spriteId;
|
||||
|
||||
//Hide Birch and Azurill
|
||||
spriteId = gTasks[taskId].data[TD_BIRCH_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tBirchSpriteId;
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
spriteId = gTasks[taskId].data[TD_AZURILL_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tAzurillSpriteId;
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
|
||||
if (gTasks[taskId].data[TD_COUNTER])
|
||||
if (gTasks[taskId].tFrameCounter)
|
||||
{
|
||||
gTasks[taskId].data[TD_COUNTER]--;
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1218,14 +1216,14 @@ static void Task_NewGameSpeech29(u8 taskId)
|
||||
|
||||
//Fade in trainer and background
|
||||
if (gSaveBlock2.playerGender)
|
||||
spriteId = (u8)gTasks[taskId].data[TD_MAY_SPRITE_ID];
|
||||
spriteId = (u8)gTasks[taskId].tMaySpriteId;
|
||||
else
|
||||
spriteId = (u8)gTasks[taskId].data[TD_BRENDAN_SPRITE_ID];
|
||||
spriteId = (u8)gTasks[taskId].tBrendanSpriteId;
|
||||
gSprites[spriteId].pos1.x = 120;
|
||||
gSprites[spriteId].pos1.y = 60;
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
|
||||
gTasks[taskId].data[TD_TRAINER_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tTrainerSpriteId = spriteId;
|
||||
|
||||
StartSpriteFadeIn(taskId, 2);
|
||||
StartBackgroundFadeIn(taskId, 1);
|
||||
@ -1238,18 +1236,18 @@ static void Task_NewGameSpeech29(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech30(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_SUBTASK_DONE])
|
||||
if (gTasks[taskId].tSubtaskIsDone)
|
||||
{
|
||||
s16 spriteId;
|
||||
|
||||
spriteId = gTasks[taskId].data[TD_TRAINER_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tTrainerSpriteId;
|
||||
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
|
||||
|
||||
if (BirchSpeechUpdateWindowText())
|
||||
{
|
||||
u8 spriteId;
|
||||
|
||||
spriteId = gTasks[taskId].data[TD_TRAINER_SPRITE_ID];
|
||||
spriteId = gTasks[taskId].tTrainerSpriteId;
|
||||
gSprites[spriteId].oam.affineMode = 1;
|
||||
gSprites[spriteId].affineAnims = gSpriteAffineAnimTable_81E79AC;
|
||||
InitSpriteAffineAnim(&gSprites[spriteId]);
|
||||
@ -1264,7 +1262,7 @@ static void Task_NewGameSpeech30(u8 taskId)
|
||||
|
||||
static void Task_NewGameSpeech31(u8 taskId)
|
||||
{
|
||||
u8 spriteId = gTasks[taskId].data[TD_TRAINER_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tTrainerSpriteId;
|
||||
|
||||
if (gSprites[spriteId].affineAnimEnded)
|
||||
gTasks[taskId].func = Task_NewGameSpeech32;
|
||||
@ -1274,7 +1272,7 @@ static void Task_NewGameSpeech32(u8 taskId)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
u8 spriteId = gTasks[taskId].data[TD_TRAINER_SPRITE_ID];
|
||||
u8 spriteId = gTasks[taskId].tTrainerSpriteId;
|
||||
gSprites[spriteId].callback = nullsub_34;
|
||||
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON;
|
||||
BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0x10, 0xFFFF);
|
||||
@ -1328,7 +1326,7 @@ void CB_ContinueNewGameSpeechPart2()
|
||||
|
||||
taskId = CreateTask(Task_NewGameSpeech23, 0);
|
||||
|
||||
gTasks[taskId].data[TD_BGHOFS] = -60;
|
||||
gTasks[taskId].tBGhofs = -60;
|
||||
|
||||
remove_some_task();
|
||||
ResetSpriteData();
|
||||
@ -1340,20 +1338,20 @@ void CB_ContinueNewGameSpeechPart2()
|
||||
|
||||
if (gSaveBlock2.playerGender != MALE)
|
||||
{
|
||||
gTasks[taskId].data[TD_GENDER_SELECTION] = FEMALE;
|
||||
spriteId = gTasks[taskId].data[TD_MAY_SPRITE_ID];
|
||||
gTasks[taskId].tGenderSelection = FEMALE;
|
||||
spriteId = gTasks[taskId].tMaySpriteId;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[TD_GENDER_SELECTION] = MALE;
|
||||
spriteId = gTasks[taskId].data[TD_BRENDAN_SPRITE_ID];
|
||||
gTasks[taskId].tGenderSelection = MALE;
|
||||
spriteId = gTasks[taskId].tBrendanSpriteId;
|
||||
}
|
||||
|
||||
gSprites[spriteId].pos1.x = 180;
|
||||
gSprites[spriteId].pos1.y = 60;
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
|
||||
gTasks[taskId].data[TD_TRAINER_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tTrainerSpriteId = spriteId;
|
||||
|
||||
REG_BG1HOFS = -60;
|
||||
|
||||
@ -1412,56 +1410,67 @@ void AddBirchSpeechObjects(u8 taskId)
|
||||
gSprites[spriteId].callback = nullsub_34;
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
gSprites[spriteId].invisible = 1;
|
||||
gTasks[taskId].data[TD_BIRCH_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tBirchSpriteId = spriteId;
|
||||
|
||||
spriteId = CreateAzurillSprite(0x68, 0x48);
|
||||
gSprites[spriteId].callback = nullsub_34;
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
gSprites[spriteId].invisible = 1;
|
||||
gTasks[taskId].data[TD_AZURILL_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tAzurillSpriteId = spriteId;
|
||||
|
||||
//Create Brendan sprite
|
||||
spriteId = CreateTrainerSprite(0, 120, 60, 0, unk_2000000);
|
||||
gSprites[spriteId].callback = nullsub_34;
|
||||
gSprites[spriteId].invisible = 1;
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
gTasks[taskId].data[TD_BRENDAN_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tBrendanSpriteId = spriteId;
|
||||
|
||||
//Create May sprite
|
||||
spriteId = CreateTrainerSprite(1, 120, 60, 0, unk_2000000 + 0x800);
|
||||
gSprites[spriteId].callback = nullsub_34;
|
||||
gSprites[spriteId].invisible = 1;
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
gTasks[taskId].data[TD_MAY_SPRITE_ID] = spriteId;
|
||||
gTasks[taskId].tMaySpriteId = spriteId;
|
||||
}
|
||||
|
||||
enum {
|
||||
TD_PARENT_TASK_ID,
|
||||
TD_EVA, //EVA coefficient of REG_BLDALPHA
|
||||
TD_EVB, //EVB coefficient of REG_BLDALPHA
|
||||
TD_INTERVAL,
|
||||
TD_FRAMECOUNTER
|
||||
};
|
||||
#undef tTrainerSpriteId
|
||||
#undef tBGhofs
|
||||
//#undef tSubtaskIsDone
|
||||
#undef tGenderSelection
|
||||
#undef tFrameCounter
|
||||
#undef tBirchSpriteId
|
||||
#undef tAzurillSpriteId
|
||||
#undef tBrendanSpriteId
|
||||
#undef tMaySpriteId
|
||||
|
||||
|
||||
// Sprite Fade task
|
||||
|
||||
#define tMainTaskId data[0]
|
||||
#define tBlendEVA data[1]
|
||||
#define tBlendEVB data[2]
|
||||
#define tUpdateInterval data[3]
|
||||
#define tFrameCounter data[4]
|
||||
|
||||
static void Task_SpriteFadeOut(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_EVA] == 0)
|
||||
if (gTasks[taskId].tBlendEVA == 0)
|
||||
{
|
||||
gTasks[gTasks[taskId].data[TD_PARENT_TASK_ID]].data[TD_SUBTASK_DONE] = TRUE;
|
||||
gTasks[gTasks[taskId].tMainTaskId].tSubtaskIsDone = TRUE;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gTasks[taskId].data[TD_FRAMECOUNTER])
|
||||
if (gTasks[taskId].tFrameCounter)
|
||||
{
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER]--;
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER] = gTasks[taskId].data[TD_INTERVAL];
|
||||
gTasks[taskId].data[TD_EVA]--;
|
||||
gTasks[taskId].data[TD_EVB]++;
|
||||
REG_BLDALPHA = gTasks[taskId].data[TD_EVA] + (gTasks[taskId].data[TD_EVB] * 256);
|
||||
gTasks[taskId].tFrameCounter = gTasks[taskId].tUpdateInterval;
|
||||
gTasks[taskId].tBlendEVA--;
|
||||
gTasks[taskId].tBlendEVB++;
|
||||
REG_BLDALPHA = gTasks[taskId].tBlendEVA + (gTasks[taskId].tBlendEVB * 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1474,33 +1483,33 @@ static void StartSpriteFadeOut(u8 taskId, u8 interval)
|
||||
REG_BLDCNT = 592;
|
||||
REG_BLDALPHA = 16;
|
||||
REG_BLDY = 0;
|
||||
gTasks[taskId].data[TD_SUBTASK_DONE] = FALSE;
|
||||
gTasks[taskId].tSubtaskIsDone = FALSE;
|
||||
newTaskId = CreateTask(Task_SpriteFadeOut, 0);
|
||||
|
||||
gTasks[newTaskId].data[TD_PARENT_TASK_ID] = taskId;
|
||||
gTasks[newTaskId].data[TD_EVA] = 16;
|
||||
gTasks[newTaskId].data[TD_EVB] = 0;
|
||||
gTasks[newTaskId].data[TD_INTERVAL] = interval;
|
||||
gTasks[newTaskId].data[TD_FRAMECOUNTER] = interval;
|
||||
gTasks[newTaskId].tMainTaskId = taskId;
|
||||
gTasks[newTaskId].tBlendEVA = 16;
|
||||
gTasks[newTaskId].tBlendEVB = 0;
|
||||
gTasks[newTaskId].tUpdateInterval = interval;
|
||||
gTasks[newTaskId].tFrameCounter = interval;
|
||||
}
|
||||
|
||||
static void Task_SpriteFadeIn(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_EVA] == 16)
|
||||
if (gTasks[taskId].tBlendEVA == 16)
|
||||
{
|
||||
gTasks[gTasks[taskId].data[TD_PARENT_TASK_ID]].data[TD_SUBTASK_DONE] = TRUE;
|
||||
gTasks[gTasks[taskId].tMainTaskId].tSubtaskIsDone = TRUE;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else if (gTasks[taskId].data[TD_FRAMECOUNTER])
|
||||
else if (gTasks[taskId].tFrameCounter)
|
||||
{
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER]--;
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER] = gTasks[taskId].data[TD_INTERVAL];
|
||||
gTasks[taskId].data[TD_EVA]++;
|
||||
gTasks[taskId].data[TD_EVB]--;
|
||||
REG_BLDALPHA = gTasks[taskId].data[TD_EVA] + (gTasks[taskId].data[TD_EVB] * 256);
|
||||
gTasks[taskId].tFrameCounter = gTasks[taskId].tUpdateInterval;
|
||||
gTasks[taskId].tBlendEVA++;
|
||||
gTasks[taskId].tBlendEVB--;
|
||||
REG_BLDALPHA = gTasks[taskId].tBlendEVA + (gTasks[taskId].tBlendEVB * 256);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1512,36 +1521,49 @@ static void StartSpriteFadeIn(u8 taskId, u8 interval)
|
||||
REG_BLDCNT = 592;
|
||||
REG_BLDALPHA = 4096;
|
||||
REG_BLDY = 0;
|
||||
gTasks[taskId].data[TD_SUBTASK_DONE] = FALSE;
|
||||
gTasks[taskId].tSubtaskIsDone = FALSE;
|
||||
newTaskId = CreateTask(Task_SpriteFadeIn, 0);
|
||||
|
||||
gTasks[newTaskId].data[TD_PARENT_TASK_ID] = taskId;
|
||||
gTasks[newTaskId].data[TD_EVA] = 0;
|
||||
gTasks[newTaskId].data[TD_EVB] = 16;
|
||||
gTasks[newTaskId].data[TD_INTERVAL] = interval;
|
||||
gTasks[newTaskId].data[TD_FRAMECOUNTER] = interval;
|
||||
gTasks[newTaskId].tMainTaskId = taskId;
|
||||
gTasks[newTaskId].tBlendEVA = 0;
|
||||
gTasks[newTaskId].tBlendEVB = 16;
|
||||
gTasks[newTaskId].tUpdateInterval = interval;
|
||||
gTasks[newTaskId].tFrameCounter = interval;
|
||||
}
|
||||
|
||||
enum {
|
||||
TD_FADELEVEL = 1,
|
||||
TD_DELAY,
|
||||
};
|
||||
#undef tMainTaskId
|
||||
#undef tBlendEVA
|
||||
#undef tBlendEVB
|
||||
#undef tUpdateInterval
|
||||
#undef tFrameCounter
|
||||
|
||||
|
||||
// Background fade task
|
||||
|
||||
#define tMainTaskId data[0]
|
||||
#define tFadeLevel data[1]
|
||||
#define tDelay data[2]
|
||||
#define tUpdateInterval data[3]
|
||||
#define tFrameCounter data[4]
|
||||
|
||||
static void HandleFloorShadowFadeOut(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_DELAY])
|
||||
gTasks[taskId].data[TD_DELAY]--;
|
||||
if (gTasks[taskId].tDelay)
|
||||
gTasks[taskId].tDelay--;
|
||||
else
|
||||
{
|
||||
if (gTasks[taskId].data[TD_FADELEVEL] == 8)
|
||||
if (gTasks[taskId].tFadeLevel == 8)
|
||||
DestroyTask(taskId);
|
||||
else if (gTasks[taskId].data[TD_FRAMECOUNTER])
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER]--;
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER] = gTasks[taskId].data[TD_INTERVAL];
|
||||
gTasks[taskId].data[TD_FADELEVEL]++;
|
||||
LoadPalette(&gUnknown_081E795C[gTasks[taskId].data[TD_FADELEVEL]], 1, 0x10);
|
||||
if (gTasks[taskId].tFrameCounter)
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
else
|
||||
{
|
||||
gTasks[taskId].tFrameCounter = gTasks[taskId].tUpdateInterval;
|
||||
gTasks[taskId].tFadeLevel++;
|
||||
LoadPalette(&gUnknown_081E795C[gTasks[taskId].tFadeLevel], 1, 0x10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1550,30 +1572,30 @@ static void HandleFloorShadowFadeOut(u8 taskId)
|
||||
static void StartBackgroundFadeOut(u8 taskId, u8 interval)
|
||||
{
|
||||
u8 newTaskId = CreateTask(HandleFloorShadowFadeOut, 0);
|
||||
gTasks[newTaskId].data[TD_PARENT_TASK_ID] = taskId;
|
||||
gTasks[newTaskId].data[TD_FADELEVEL] = 0;
|
||||
gTasks[newTaskId].data[TD_DELAY] = 8;
|
||||
gTasks[newTaskId].data[TD_INTERVAL] = interval;
|
||||
gTasks[newTaskId].data[TD_FRAMECOUNTER] = interval;
|
||||
gTasks[newTaskId].tMainTaskId = taskId;
|
||||
gTasks[newTaskId].tFadeLevel = 0;
|
||||
gTasks[newTaskId].tDelay = 8;
|
||||
gTasks[newTaskId].tUpdateInterval = interval;
|
||||
gTasks[newTaskId].tFrameCounter = interval;
|
||||
}
|
||||
|
||||
static void HandleFloorShadowFadeIn(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[TD_DELAY])
|
||||
gTasks[taskId].data[TD_DELAY]--;
|
||||
if (gTasks[taskId].tDelay)
|
||||
gTasks[taskId].tDelay--;
|
||||
else
|
||||
{
|
||||
if (gTasks[taskId].data[TD_FADELEVEL] == 0)
|
||||
if (gTasks[taskId].tFadeLevel == 0)
|
||||
DestroyTask(taskId);
|
||||
else
|
||||
{
|
||||
if (gTasks[taskId].data[TD_FRAMECOUNTER])
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER]--;
|
||||
if (gTasks[taskId].tFrameCounter)
|
||||
gTasks[taskId].tFrameCounter--;
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[TD_FRAMECOUNTER] = gTasks[taskId].data[TD_INTERVAL];
|
||||
gTasks[taskId].data[TD_FADELEVEL]--;
|
||||
LoadPalette(&gUnknown_081E795C[gTasks[taskId].data[TD_FADELEVEL]], 1, 0x10);
|
||||
gTasks[taskId].tFrameCounter = gTasks[taskId].tUpdateInterval;
|
||||
gTasks[taskId].tFadeLevel--;
|
||||
LoadPalette(&gUnknown_081E795C[gTasks[taskId].tFadeLevel], 1, 0x10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1583,13 +1605,19 @@ static void HandleFloorShadowFadeIn(u8 taskId)
|
||||
static void StartBackgroundFadeIn(u8 taskId, u8 interval)
|
||||
{
|
||||
u8 newTaskId = CreateTask(HandleFloorShadowFadeIn, 0);
|
||||
gTasks[newTaskId].data[TD_PARENT_TASK_ID] = taskId;
|
||||
gTasks[newTaskId].data[TD_FADELEVEL] = 8;
|
||||
gTasks[newTaskId].data[TD_DELAY] = 8;
|
||||
gTasks[newTaskId].data[TD_INTERVAL] = interval;
|
||||
gTasks[newTaskId].data[TD_FRAMECOUNTER] = interval;
|
||||
gTasks[newTaskId].tMainTaskId = taskId;
|
||||
gTasks[newTaskId].tFadeLevel = 8;
|
||||
gTasks[newTaskId].tDelay = 8;
|
||||
gTasks[newTaskId].tUpdateInterval = interval;
|
||||
gTasks[newTaskId].tFrameCounter = interval;
|
||||
}
|
||||
|
||||
#undef tMainTaskId
|
||||
#undef tFadeLevel
|
||||
#undef tDelay
|
||||
#undef tUpdateInterval
|
||||
#undef tFrameCounter
|
||||
|
||||
static void CreateGenderMenu(u8 left, u8 top)
|
||||
{
|
||||
u8 menuLeft, menuTop;
|
||||
|
@ -779,7 +779,7 @@ static void sub_808AB34(u8 taskID)
|
||||
|
||||
#undef tFieldMoveId
|
||||
|
||||
void sub_808AB90(void)
|
||||
void FieldCallback_Teleport(void)
|
||||
{
|
||||
pal_fill_black();
|
||||
CreateTask(sub_808ABA8, 8);
|
||||
@ -814,7 +814,7 @@ static bool8 SetUpFieldMove_Surf(void)
|
||||
{
|
||||
if (PartyHasMonWithSurf() == TRUE && IsPlayerFacingSurfableFishableWater() == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_808AC2C;
|
||||
return TRUE;
|
||||
}
|
||||
@ -832,13 +832,13 @@ static bool8 SetUpFieldMove_Fly(void)
|
||||
{
|
||||
if (ShouldDoBrailleFlyEffect())
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = DoBrailleFlyEffect;
|
||||
return TRUE;
|
||||
}
|
||||
if (is_light_level_1_2_3_or_6(gMapHeader.mapType) == 1)
|
||||
if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_808AC8C;
|
||||
return TRUE;
|
||||
}
|
||||
@ -884,7 +884,7 @@ static bool8 SetUpFieldMove_Dive(void)
|
||||
gFieldEffectArguments[1] = sub_8068F18();
|
||||
if (gFieldEffectArguments[1])
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_808ADAC;
|
||||
return TRUE;
|
||||
}
|
||||
@ -905,7 +905,7 @@ static bool8 SetUpFieldMove_Waterfall(void)
|
||||
if (MetatileBehavior_IsWaterfall(MapGridGetMetatileBehaviorAt(x, y)) == TRUE
|
||||
&& IsPlayerSurfingNorth() == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_808AE08;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ static void InitializeCursorPosition(void)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (get_map_light_level_by_bank_and_number(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum) - 1)
|
||||
switch (GetMapTypeByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum) - 1)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
@ -733,7 +733,7 @@ static void InitializeCursorPosition(void)
|
||||
break;
|
||||
case 3:
|
||||
case 6:
|
||||
mapHeader = get_mapheader_by_bank_and_number(gSaveBlock1.warp4.mapGroup, gSaveBlock1.warp4.mapNum);
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.warp4.mapGroup, gSaveBlock1.warp4.mapNum);
|
||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||
gRegionMap->playerIsInCave = TRUE;
|
||||
mapWidth = mapHeader->mapData->width;
|
||||
@ -742,7 +742,7 @@ static void InitializeCursorPosition(void)
|
||||
y = gSaveBlock1.warp4.y;
|
||||
break;
|
||||
case 8:
|
||||
mapHeader = get_mapheader_by_bank_and_number(gSaveBlock1.warp2.mapGroup, gSaveBlock1.warp2.mapNum);
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.warp2.mapGroup, gSaveBlock1.warp2.mapNum);
|
||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||
gRegionMap->playerIsInCave = TRUE;
|
||||
mapWidth = mapHeader->mapData->width;
|
||||
@ -758,12 +758,12 @@ static void InitializeCursorPosition(void)
|
||||
if (gRegionMap->mapSecId != MAPSEC_UNK_0x57)
|
||||
{
|
||||
r4 = &gSaveBlock1.warp4;
|
||||
mapHeader = get_mapheader_by_bank_and_number(r4->mapGroup, r4->mapNum);
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(r4->mapGroup, r4->mapNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
r4 = &gSaveBlock1.warp2;
|
||||
mapHeader = get_mapheader_by_bank_and_number(r4->mapGroup, r4->mapNum);
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(r4->mapGroup, r4->mapNum);
|
||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||
}
|
||||
gRegionMap->playerIsInCave = FALSE;
|
||||
@ -850,7 +850,7 @@ static void sub_80FB600(void)
|
||||
default:
|
||||
case 0:
|
||||
{
|
||||
struct MapHeader *mapHeader = get_mapheader_by_bank_and_number(mapGroup, mapNum);
|
||||
struct MapHeader *mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
|
||||
u16 r1;
|
||||
|
||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||
|
@ -1081,10 +1081,10 @@ void EmitFaintingCry(u8 a)
|
||||
PrepareBufferDataTransfer(a, gBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void EmitIntroSlide(u8 a, u8 b)
|
||||
void EmitIntroSlide(u8 a, u8 battleTerrain)
|
||||
{
|
||||
gBattleBuffersTransferData[0] = 46;
|
||||
gBattleBuffersTransferData[1] = b;
|
||||
gBattleBuffersTransferData[1] = battleTerrain;
|
||||
PrepareBufferDataTransfer(a, gBattleBuffersTransferData, 2);
|
||||
}
|
||||
|
||||
|
240
src/rom4.c
240
src/rom4.c
@ -25,6 +25,7 @@
|
||||
#include "link.h"
|
||||
#include "load_save.h"
|
||||
#include "main.h"
|
||||
#include "map_constants.h"
|
||||
#include "map_name_popup.h"
|
||||
#include "menu.h"
|
||||
#include "metatile_behavior.h"
|
||||
@ -82,7 +83,7 @@ u8 gFieldLinkPlayerCount;
|
||||
extern u16 gUnknown_03004898;
|
||||
extern u16 gUnknown_0300489C;
|
||||
|
||||
extern u8 EventScript_LeagueWhiteOut[];
|
||||
extern u8 S_WhiteOut[];
|
||||
extern u8 gUnknown_0819FC9F[];
|
||||
extern u8 SingleBattleColosseum_EventScript_1A436F[];
|
||||
extern u8 SingleBattleColosseum_EventScript_1A4379[];
|
||||
@ -110,12 +111,12 @@ extern void (*gUnknown_082166D8[])(struct LinkPlayerMapObject *, struct MapObjec
|
||||
extern struct MapData * const gMapAttributes[];
|
||||
extern struct MapHeader * const * const gMapGroups[];
|
||||
extern const struct WarpData gDummyWarpData;
|
||||
extern s32 gUnknown_0839ACE8;
|
||||
extern s32 gMaxFlashLevel;
|
||||
extern u32 gUnknown_08216694[];
|
||||
|
||||
void DoWhiteOut(void)
|
||||
static void DoWhiteOut(void)
|
||||
{
|
||||
ScriptContext2_RunNewScript(EventScript_LeagueWhiteOut);
|
||||
ScriptContext2_RunNewScript(S_WhiteOut);
|
||||
gSaveBlock1.money /= 2;
|
||||
HealPlayerParty();
|
||||
sub_8053050();
|
||||
@ -133,8 +134,7 @@ void flag_var_implications_of_teleport_(void)
|
||||
FlagReset(SYS_USE_FLASH);
|
||||
}
|
||||
|
||||
// not new_game
|
||||
void new_game(void)
|
||||
void Overworld_ResetStateAfterTeleport(void)
|
||||
{
|
||||
player_avatar_init_params_reset();
|
||||
FlagReset(SYS_CYCLING_ROAD);
|
||||
@ -215,15 +215,16 @@ void sub_8053154(void)
|
||||
gMapHeader.events->mapObjectCount * sizeof(struct MapObjectTemplate));
|
||||
}
|
||||
|
||||
void sub_8053198(void)
|
||||
static void LoadSaveblockMapObjScripts(void)
|
||||
{
|
||||
struct MapObjectTemplate *mapObjectTemplates = gSaveBlock1.mapObjectTemplates;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
mapObjectTemplates[i].script = gMapHeader.events->mapObjects[i].script;
|
||||
}
|
||||
|
||||
void update_saveblock1_field_object_coords(u8 localId, s16 x, s16 y)
|
||||
void Overworld_SaveMapObjCoords(u8 localId, s16 x, s16 y)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 64; i++)
|
||||
@ -233,28 +234,26 @@ void update_saveblock1_field_object_coords(u8 localId, s16 x, s16 y)
|
||||
{
|
||||
mapObjectTemplate->x = x;
|
||||
mapObjectTemplate->y = y;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update_saveblock1_field_object_movement_behavior(u8 localId, u8 movementType)
|
||||
void Overworld_SaveMapObjMovementType(u8 localId, u8 movementType)
|
||||
{
|
||||
s32 i = 0;
|
||||
struct MapObjectTemplate *mapObjectTemplate = gSaveBlock1.mapObjectTemplates;
|
||||
do
|
||||
s32 i;
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
struct MapObjectTemplate *mapObjectTemplate = &gSaveBlock1.mapObjectTemplates[i];
|
||||
if (mapObjectTemplate->localId == localId)
|
||||
{
|
||||
mapObjectTemplate->movementType = movementType;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
mapObjectTemplate++;
|
||||
i++;
|
||||
} while (i < 64);
|
||||
}
|
||||
}
|
||||
|
||||
void mapdata_load_assets_to_gpu_and_full_redraw(void)
|
||||
static void mapdata_load_assets_to_gpu_and_full_redraw(void)
|
||||
{
|
||||
move_tilemap_camera_to_upper_left_corner();
|
||||
copy_map_tileset1_tileset2_to_vram(gMapHeader.mapData);
|
||||
@ -263,7 +262,7 @@ void mapdata_load_assets_to_gpu_and_full_redraw(void)
|
||||
cur_mapheader_run_tileset_funcs_after_some_cpuset();
|
||||
}
|
||||
|
||||
struct MapData *get_mapdata_header(void)
|
||||
static struct MapData *get_mapdata_header(void)
|
||||
{
|
||||
u16 mapDataId = gSaveBlock1.mapDataId;
|
||||
if (mapDataId)
|
||||
@ -271,7 +270,7 @@ struct MapData *get_mapdata_header(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void warp_shift(void)
|
||||
static void warp_shift(void)
|
||||
{
|
||||
gUnknown_020297F0 = gSaveBlock1.location;
|
||||
gSaveBlock1.location = gUnknown_020297F8;
|
||||
@ -279,7 +278,7 @@ void warp_shift(void)
|
||||
gUnknown_02029808 = gDummyWarpData;
|
||||
}
|
||||
|
||||
void warp_set(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||
static void warp_set(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||
{
|
||||
warp->mapGroup = mapGroup;
|
||||
warp->mapNum = mapNum;
|
||||
@ -288,7 +287,7 @@ void warp_set(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8
|
||||
warp->y = y;
|
||||
}
|
||||
|
||||
bool32 warp_data_is_not_neg_1(struct WarpData *warp)
|
||||
static bool32 warp_data_is_not_neg_1(struct WarpData *warp)
|
||||
{
|
||||
if (warp->mapGroup != -1)
|
||||
return FALSE;
|
||||
@ -303,26 +302,26 @@ bool32 warp_data_is_not_neg_1(struct WarpData *warp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct MapHeader *const get_mapheader_by_bank_and_number(u16 mapGroup, u16 mapNum)
|
||||
struct MapHeader *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
return gMapGroups[mapGroup][mapNum];
|
||||
}
|
||||
|
||||
struct MapHeader *const warp1_get_mapheader(void)
|
||||
{
|
||||
return get_mapheader_by_bank_and_number(gUnknown_020297F8.mapGroup, gUnknown_020297F8.mapNum);
|
||||
return Overworld_GetMapHeaderByGroupAndId(gUnknown_020297F8.mapGroup, gUnknown_020297F8.mapNum);
|
||||
}
|
||||
|
||||
void set_current_map_header_from_sav1_save_old_name(void)
|
||||
static void set_current_map_header_from_sav1_save_old_name(void)
|
||||
{
|
||||
gMapHeader = *get_mapheader_by_bank_and_number(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum);
|
||||
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum);
|
||||
gSaveBlock1.mapDataId = gMapHeader.mapDataId;
|
||||
gMapHeader.mapData = get_mapdata_header();
|
||||
}
|
||||
|
||||
void sub_805338C(void)
|
||||
static void LoadSaveblockMapHeader(void)
|
||||
{
|
||||
gMapHeader = *get_mapheader_by_bank_and_number(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum);
|
||||
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum);
|
||||
gMapHeader.mapData = get_mapdata_header();
|
||||
}
|
||||
|
||||
@ -398,9 +397,9 @@ void sub_8053588(u8 a1)
|
||||
|
||||
void sub_80535C4(s16 a1, s16 a2)
|
||||
{
|
||||
u8 v4 = sav1_map_get_light_level();
|
||||
u8 v5 = get_map_light_level_by_bank_and_number(gUnknown_020297F8.mapGroup, gUnknown_020297F8.mapNum);
|
||||
if (is_light_level_1_2_3_5_or_6(v4) && is_light_level_1_2_3_5_or_6(v5) != TRUE)
|
||||
u8 v4 = Overworld_GetMapTypeOfSaveblockLocation();
|
||||
u8 v5 = GetMapTypeByGroupAndId(gUnknown_020297F8.mapGroup, gUnknown_020297F8.mapNum);
|
||||
if (is_map_type_1_2_3_5_or_6(v4) && is_map_type_1_2_3_5_or_6(v5) != TRUE)
|
||||
sub_805363C(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, -1, a1 - 7, a2 - 6);
|
||||
}
|
||||
|
||||
@ -482,7 +481,7 @@ struct MapConnection *sub_8053818(u8 dir)
|
||||
bool8 sub_8053850(u8 dir, u16 x, u16 y)
|
||||
{
|
||||
struct MapConnection *connection = sub_8053818(dir);
|
||||
if (connection)
|
||||
if (connection != NULL)
|
||||
{
|
||||
warp1_set(connection->mapGroup, connection->mapNum, -1, x, y);
|
||||
}
|
||||
@ -522,7 +521,7 @@ void sub_80538F0(u8 mapGroup, u8 mapNum)
|
||||
DoTimeBasedEvents();
|
||||
sub_80806E4();
|
||||
ChooseAmbientCrySpecies();
|
||||
sub_8053C98();
|
||||
SetDefaultFlashLevel();
|
||||
sav1_reset_battle_music_maybe();
|
||||
mapheader_run_script_with_tag_x3();
|
||||
not_trainer_hill_battle_pyramid();
|
||||
@ -548,8 +547,8 @@ void sub_8053994(u32 a1)
|
||||
|
||||
set_current_map_header_from_sav1_save_old_name();
|
||||
sub_8053154();
|
||||
v2 = is_light_level_1_2_3_5_or_6(gMapHeader.mapType);
|
||||
v3 = is_light_level_8_or_9(gMapHeader.mapType);
|
||||
v2 = is_map_type_1_2_3_5_or_6(gMapHeader.mapType);
|
||||
v3 = Overworld_MapTypeIsIndoors(gMapHeader.mapType);
|
||||
ClearTempFieldEventData();
|
||||
ResetCyclingRoadChallengeData();
|
||||
prev_quest_postbuffer_cursor_backup_reset();
|
||||
@ -560,7 +559,7 @@ void sub_8053994(u32 a1)
|
||||
ChooseAmbientCrySpecies();
|
||||
if (v2)
|
||||
FlagReset(SYS_USE_FLASH);
|
||||
sub_8053C98();
|
||||
SetDefaultFlashLevel();
|
||||
sav1_reset_battle_music_maybe();
|
||||
mapheader_run_script_with_tag_x3();
|
||||
UpdateLocationHistoryForRoamer();
|
||||
@ -598,11 +597,11 @@ void walkrun_find_lowest_active_bit_in_bitfield(void)
|
||||
struct UnkPlayerStruct *sub_8053AA8(void)
|
||||
{
|
||||
struct UnkPlayerStruct playerStruct;
|
||||
u8 light = sav1_map_get_light_level();
|
||||
u8 mapType = Overworld_GetMapTypeOfSaveblockLocation();
|
||||
u16 v2 = cur_mapdata_block_role_at_screen_center_acc_to_sav1();
|
||||
u8 v4 = sub_8053B00(&gUnknown_02029810, v2, light);
|
||||
u8 v4 = sub_8053B00(&gUnknown_02029810, v2, mapType);
|
||||
playerStruct.player_field_0 = v4;
|
||||
playerStruct.player_field_1 = sub_8053B60(&gUnknown_02029810, v4, v2, light);
|
||||
playerStruct.player_field_1 = sub_8053B60(&gUnknown_02029810, v4, v2, mapType);
|
||||
gUnknown_02029810 = playerStruct;
|
||||
return &gUnknown_02029810;
|
||||
}
|
||||
@ -615,7 +614,7 @@ u8 sub_8053B00(struct UnkPlayerStruct *playerStruct, u16 a2, u8 a3)
|
||||
return 16;
|
||||
if (MetatileBehavior_IsSurfableWaterOrUnderwater(a2) == 1)
|
||||
return 8;
|
||||
if (IsBikingAllowedByMap() != TRUE)
|
||||
if (Overworld_IsBikeAllowedOnCurrentMap() != TRUE)
|
||||
return 1;
|
||||
if (playerStruct->player_field_0 == 2)
|
||||
return 2;
|
||||
@ -653,10 +652,12 @@ u16 cur_mapdata_block_role_at_screen_center_acc_to_sav1(void)
|
||||
return MapGridGetMetatileBehaviorAt(gSaveBlock1.pos.x + 7, gSaveBlock1.pos.y + 7);
|
||||
}
|
||||
|
||||
bool32 IsBikingAllowedByMap(void)
|
||||
bool32 Overworld_IsBikeAllowedOnCurrentMap(void)
|
||||
{
|
||||
// is player in cycling road entrance?
|
||||
if (gSaveBlock1.location.mapGroup == 29 && (gSaveBlock1.location.mapNum == 11 || gSaveBlock1.location.mapNum == 12))
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE
|
||||
&& (gSaveBlock1.location.mapNum == MAP_ID_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE
|
||||
|| gSaveBlock1.location.mapNum == MAP_ID_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE))
|
||||
return TRUE;
|
||||
|
||||
// is player indoor, in a secret base, or underwater?
|
||||
@ -667,37 +668,37 @@ bool32 IsBikingAllowedByMap(void)
|
||||
if (gMapHeader.mapType == MAP_TYPE_UNDERWATER)
|
||||
return FALSE;
|
||||
|
||||
// is player in SeafloorCavern_Room9?
|
||||
if (gSaveBlock1.location.mapGroup == 24 && gSaveBlock1.location.mapNum == 36)
|
||||
// Thou shalt not bike on the sacred resting grounds of Kyogre/Groudon.
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_SEAFLOOR_CAVERN_ROOM9
|
||||
&& gSaveBlock1.location.mapNum == MAP_ID_SEAFLOOR_CAVERN_ROOM9)
|
||||
return FALSE;
|
||||
|
||||
// is player in CaveOfOrigin_B4F?
|
||||
if (gSaveBlock1.location.mapGroup == 24 && gSaveBlock1.location.mapNum == 42)
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_CAVE_OF_ORIGIN_B4F
|
||||
&& gSaveBlock1.location.mapNum == MAP_ID_CAVE_OF_ORIGIN_B4F)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_8053C98(void)
|
||||
void SetDefaultFlashLevel(void)
|
||||
{
|
||||
if (!gMapHeader.cave)
|
||||
gSaveBlock1.flashUsed = 0;
|
||||
gSaveBlock1.flashLevel = 0;
|
||||
else if (FlagGet(SYS_USE_FLASH))
|
||||
gSaveBlock1.flashUsed = 1;
|
||||
gSaveBlock1.flashLevel = 1;
|
||||
else
|
||||
gSaveBlock1.flashUsed = gUnknown_0839ACE8;
|
||||
gSaveBlock1.flashLevel = gMaxFlashLevel;
|
||||
}
|
||||
|
||||
void sub_8053CE4(s32 a1)
|
||||
void Overworld_SetFlashLevel(s32 flashLevel)
|
||||
{
|
||||
if (a1 < 0 || a1 > gUnknown_0839ACE8)
|
||||
a1 = 0;
|
||||
gSaveBlock1.flashUsed = a1;
|
||||
if (flashLevel < 0 || flashLevel > gMaxFlashLevel)
|
||||
flashLevel = 0;
|
||||
gSaveBlock1.flashLevel = flashLevel;
|
||||
}
|
||||
|
||||
u8 sav1_get_flash_used_on_map(void)
|
||||
u8 Overworld_GetFlashLevel(void)
|
||||
{
|
||||
return gSaveBlock1.flashUsed;
|
||||
return gSaveBlock1.flashLevel;
|
||||
}
|
||||
|
||||
void sub_8053D14(u16 mapDataId)
|
||||
@ -706,60 +707,62 @@ void sub_8053D14(u16 mapDataId)
|
||||
gMapHeader.mapData = get_mapdata_header();
|
||||
}
|
||||
|
||||
bool16 sub_8053D30(struct WarpData *warp)
|
||||
static bool16 ShouldLegendaryMusicPlayAtLocation(struct WarpData *warp)
|
||||
{
|
||||
if (!FlagGet(SYS_WEATHER_CTRL))
|
||||
return FALSE;
|
||||
if (warp->mapGroup != 0)
|
||||
return FALSE;
|
||||
switch (warp->mapNum)
|
||||
if (warp->mapGroup == 0)
|
||||
{
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
return TRUE;
|
||||
case 39:
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
case 43:
|
||||
return TRUE;
|
||||
switch (warp->mapNum)
|
||||
{
|
||||
case MAP_ID_LILYCOVE_CITY:
|
||||
case MAP_ID_MOSSDEEP_CITY:
|
||||
case MAP_ID_SOOTOPOLIS_CITY:
|
||||
case MAP_ID_EVER_GRANDE_CITY:
|
||||
return TRUE;
|
||||
case MAP_ID_ROUTE124:
|
||||
case MAP_ID_ROUTE125:
|
||||
case MAP_ID_ROUTE126:
|
||||
case MAP_ID_ROUTE127:
|
||||
case MAP_ID_ROUTE128:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool16 sub_8053D6C(struct WarpData *warp)
|
||||
static bool16 IsInfiltratedWeatherInstitute(struct WarpData *warp)
|
||||
{
|
||||
if (VarGet(0x40B3))
|
||||
if (VarGet(VAR_WEATHER_INSTITUTE_CLEARED))
|
||||
return FALSE;
|
||||
if (warp->mapGroup != 32)
|
||||
if (warp->mapGroup != MAP_GROUP_ROUTE119_WEATHER_INSTITUTE_1F)
|
||||
return FALSE;
|
||||
if (warp->mapNum == 0 || warp->mapNum == 1)
|
||||
if (warp->mapNum == MAP_ID_ROUTE119_WEATHER_INSTITUTE_1F
|
||||
|| warp->mapNum == MAP_ID_ROUTE119_WEATHER_INSTITUTE_2F)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u16 sub_8053D9C(struct WarpData *warp)
|
||||
static u16 GetLocationMusic(struct WarpData *warp)
|
||||
{
|
||||
if (sub_8053D30(warp) == TRUE)
|
||||
if (ShouldLegendaryMusicPlayAtLocation(warp) == TRUE)
|
||||
return LEGENDARY_MUSIC;
|
||||
else if (sub_8053D6C(warp) == TRUE)
|
||||
else if (IsInfiltratedWeatherInstitute(warp) == TRUE)
|
||||
return BGM_TOZAN;
|
||||
else
|
||||
return get_mapheader_by_bank_and_number(warp->mapGroup, warp->mapNum)->music;
|
||||
return Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum)->music;
|
||||
}
|
||||
|
||||
u16 sav1_map_get_music(void)
|
||||
{
|
||||
u16 music;
|
||||
|
||||
if (gSaveBlock1.location.mapGroup == 0
|
||||
&& gSaveBlock1.location.mapNum == 26
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_ROUTE111
|
||||
&& gSaveBlock1.location.mapNum == MAP_ID_ROUTE111
|
||||
&& GetSav1Weather() == 8)
|
||||
return BGM_ASHROAD;
|
||||
|
||||
music = sub_8053D9C(&gSaveBlock1.location);
|
||||
music = GetLocationMusic(&gSaveBlock1.location);
|
||||
if (music != 0x7FFF)
|
||||
{
|
||||
return music;
|
||||
@ -775,14 +778,15 @@ u16 sav1_map_get_music(void)
|
||||
|
||||
u16 warp1_target_get_music(void)
|
||||
{
|
||||
u16 music = sub_8053D9C(&gUnknown_020297F8);
|
||||
u16 music = GetLocationMusic(&gUnknown_020297F8);
|
||||
if (music != 0x7FFF)
|
||||
{
|
||||
return music;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gSaveBlock1.location.mapGroup == 0 && gSaveBlock1.location.mapNum == 2)
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_MAUVILLE_CITY
|
||||
&& gSaveBlock1.location.mapNum == MAP_ID_MAUVILLE_CITY)
|
||||
return BGM_DOORO_X1;
|
||||
else
|
||||
return BGM_GRANROAD;
|
||||
@ -802,7 +806,7 @@ void sub_8053E90(void)
|
||||
{
|
||||
if (gSaveBlock1.battleMusic)
|
||||
music = gSaveBlock1.battleMusic;
|
||||
else if (sav1_map_get_light_level() == 5)
|
||||
else if (Overworld_GetMapTypeOfSaveblockLocation() == MAP_TYPE_UNDERWATER)
|
||||
music = BGM_DEEPDEEP;
|
||||
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||
music = BGM_NAMINORI;
|
||||
@ -852,17 +856,17 @@ void sub_8053F84(void)
|
||||
FadeOutAndPlayNewMapMusic(sav1_map_get_music(), 8);
|
||||
}
|
||||
|
||||
void ChangeMapMusic(u16 newMusic)
|
||||
void Overworld_ChangeMusicTo(u16 newMusic)
|
||||
{
|
||||
u16 currentMusic = GetCurrentMapMusic();
|
||||
if (currentMusic != newMusic && currentMusic != LEGENDARY_MUSIC)
|
||||
FadeOutAndPlayNewMapMusic(newMusic, 8);
|
||||
}
|
||||
|
||||
u8 is_warp1_light_level_8_or_9(void)
|
||||
u8 GetMapMusicFadeoutSpeed(void)
|
||||
{
|
||||
struct MapHeader *mapHeader = warp1_get_mapheader();
|
||||
if (is_light_level_8_or_9(mapHeader->mapType) == TRUE)
|
||||
if (Overworld_MapTypeIsIndoors(mapHeader->mapType) == TRUE)
|
||||
return 2;
|
||||
else
|
||||
return 4;
|
||||
@ -873,7 +877,7 @@ void sub_8053FF8(void)
|
||||
u16 music = warp1_target_get_music();
|
||||
if (FlagGet(SPECIAL_FLAG_1) != TRUE && music != GetCurrentMapMusic())
|
||||
{
|
||||
u8 speed = is_warp1_light_level_8_or_9();
|
||||
u8 speed = GetMapMusicFadeoutSpeed();
|
||||
FadeOutMapMusic(speed);
|
||||
}
|
||||
}
|
||||
@ -934,10 +938,14 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter)
|
||||
|
||||
void ChooseAmbientCrySpecies(void)
|
||||
{
|
||||
if ((gSaveBlock1.location.mapGroup == 0 && gSaveBlock1.location.mapNum == 45) && !IsMirageIslandPresent())
|
||||
if ((gSaveBlock1.location.mapGroup == MAP_GROUP_ROUTE130
|
||||
&& gSaveBlock1.location.mapNum == MAP_ID_ROUTE130)
|
||||
&& !IsMirageIslandPresent())
|
||||
{
|
||||
// Only play water pokemon cries on this route
|
||||
// when Mirage Island is not present
|
||||
sIsAmbientCryWaterMon = TRUE;
|
||||
sAmbientCrySpecies = GetMirageIslandMon();
|
||||
sAmbientCrySpecies = GetLocalWaterMon();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -945,45 +953,53 @@ void ChooseAmbientCrySpecies(void)
|
||||
}
|
||||
}
|
||||
|
||||
u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum)
|
||||
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum)
|
||||
{
|
||||
return get_mapheader_by_bank_and_number(mapGroup, mapNum)->mapType;
|
||||
return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->mapType;
|
||||
}
|
||||
|
||||
u8 get_map_light_level_from_warp(struct WarpData *warp)
|
||||
u8 GetMapTypeByWarpData(struct WarpData *warp)
|
||||
{
|
||||
return get_map_light_level_by_bank_and_number(warp->mapGroup, warp->mapNum);
|
||||
return GetMapTypeByGroupAndId(warp->mapGroup, warp->mapNum);
|
||||
}
|
||||
|
||||
u8 sav1_map_get_light_level(void)
|
||||
u8 Overworld_GetMapTypeOfSaveblockLocation(void)
|
||||
{
|
||||
return get_map_light_level_from_warp(&gSaveBlock1.location);
|
||||
return GetMapTypeByWarpData(&gSaveBlock1.location);
|
||||
}
|
||||
|
||||
u8 get_map_light_from_warp0(void)
|
||||
u8 get_map_type_from_warp0(void)
|
||||
{
|
||||
return get_map_light_level_from_warp(&gUnknown_020297F0);
|
||||
return GetMapTypeByWarpData(&gUnknown_020297F0);
|
||||
}
|
||||
|
||||
bool8 is_light_level_1_2_3_5_or_6(u8 a1)
|
||||
bool8 is_map_type_1_2_3_5_or_6(u8 mapType)
|
||||
{
|
||||
if (a1 == 3 || a1 == 1 || a1 == 5 || a1 == 2 || a1 == 6)
|
||||
if (mapType == MAP_TYPE_ROUTE
|
||||
|| mapType == MAP_TYPE_TOWN
|
||||
|| mapType == MAP_TYPE_UNDERWATER
|
||||
|| mapType == MAP_TYPE_CITY
|
||||
|| mapType == MAP_TYPE_6)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 is_light_level_1_2_3_or_6(u8 a1)
|
||||
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType)
|
||||
{
|
||||
if (a1 == 3 || a1 == 1 || a1 == 6 || a1 == 2)
|
||||
if (mapType == MAP_TYPE_ROUTE
|
||||
|| mapType == MAP_TYPE_TOWN
|
||||
|| mapType == MAP_TYPE_6
|
||||
|| mapType == MAP_TYPE_CITY)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 is_light_level_8_or_9(u8 a1)
|
||||
bool8 Overworld_MapTypeIsIndoors(u8 mapType)
|
||||
{
|
||||
if (a1 == 8 || a1 == 9)
|
||||
if (mapType == MAP_TYPE_INDOOR
|
||||
|| mapType == MAP_TYPE_SECRET_BASE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -991,17 +1007,17 @@ bool8 is_light_level_8_or_9(u8 a1)
|
||||
|
||||
u8 unref_sub_8054260(void)
|
||||
{
|
||||
return get_mapheader_by_bank_and_number(gSaveBlock1.warp2.mapGroup, gSaveBlock1.warp2.mapNum)->regionMapSectionId;
|
||||
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.warp2.mapGroup, gSaveBlock1.warp2.mapNum)->regionMapSectionId;
|
||||
}
|
||||
|
||||
u8 sav1_map_get_name(void)
|
||||
{
|
||||
return get_mapheader_by_bank_and_number(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum)->regionMapSectionId;
|
||||
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum)->regionMapSectionId;
|
||||
}
|
||||
|
||||
u8 sav1_map_get_battletype(void)
|
||||
{
|
||||
return get_mapheader_by_bank_and_number(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum)->battleType;
|
||||
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum)->battleType;
|
||||
}
|
||||
|
||||
void ResetSafariZoneFlag_(void)
|
||||
@ -1263,8 +1279,8 @@ void CB2_ContinueSavedGame(void)
|
||||
FieldClearVBlankHBlankCallbacks();
|
||||
StopMapMusic();
|
||||
ResetSafariZoneFlag_();
|
||||
sub_805338C();
|
||||
sub_8053198();
|
||||
LoadSaveblockMapHeader();
|
||||
LoadSaveblockMapObjScripts();
|
||||
UnfreezeMapObjects();
|
||||
DoTimeBasedEvents();
|
||||
sub_805308C();
|
||||
@ -1315,7 +1331,7 @@ void VBlankCB_Field(void)
|
||||
|
||||
void sub_8054814(void)
|
||||
{
|
||||
u8 val = sav1_get_flash_used_on_map();
|
||||
u8 val = Overworld_GetFlashLevel();
|
||||
if (val)
|
||||
{
|
||||
sub_80815E0(val);
|
||||
|
@ -120,7 +120,7 @@ bool8 SetUpFieldMove_RockSmash(void)
|
||||
{
|
||||
if (npc_before_player_of_type(0x56) == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_810B53C;
|
||||
return TRUE;
|
||||
}
|
||||
@ -157,7 +157,7 @@ int SetUpFieldMove_Dig(void)
|
||||
{
|
||||
if (sub_80CA1C8() == TRUE)
|
||||
{
|
||||
gFieldCallback = sub_808AB90;
|
||||
gFieldCallback = FieldCallback_Teleport;
|
||||
gUnknown_03005CE4 = sub_810B5D8;
|
||||
return TRUE;
|
||||
}
|
||||
|
10
src/scrcmd.c
10
src/scrcmd.c
@ -567,8 +567,8 @@ bool8 ScrCmd_lighten(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_darken(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 value = VarGet(ScriptReadHalfword(ctx));
|
||||
sub_8053CE4(value);
|
||||
u16 flashLevel = VarGet(ScriptReadHalfword(ctx));
|
||||
Overworld_SetFlashLevel(flashLevel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -870,7 +870,7 @@ bool8 ScrCmd_fadedefault(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_fademusic(struct ScriptContext *ctx)
|
||||
{
|
||||
ChangeMapMusic(ScriptReadHalfword(ctx));
|
||||
Overworld_ChangeMusicTo(ScriptReadHalfword(ctx));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -996,7 +996,7 @@ bool8 ScrCmd_movespriteperm(struct ScriptContext *ctx)
|
||||
u16 v1 = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 v2 = VarGet(ScriptReadHalfword(ctx));
|
||||
u32 v3 = VarGet(ScriptReadHalfword(ctx));
|
||||
update_saveblock1_field_object_coords(v1, v2, v3);
|
||||
Overworld_SaveMapObjCoords(v1, v2, v3);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ bool8 ScrCmd_spritebehave(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 v1 = VarGet(ScriptReadHalfword(ctx));
|
||||
u8 v2 = ScriptReadByte(ctx);
|
||||
update_saveblock1_field_object_movement_behavior(v1, v2);
|
||||
Overworld_SaveMapObjMovementType(v1, v2);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
12
src/script.c
12
src/script.c
@ -228,16 +228,16 @@ void ScriptContext2_RunNewScript(const u8 *ptr)
|
||||
;
|
||||
}
|
||||
|
||||
u8 *mapheader_get_tagged_pointer(u8 tag)
|
||||
static u8 *mapheader_get_tagged_pointer(u8 tag)
|
||||
{
|
||||
u8 *mapScripts = gMapHeader.mapScripts;
|
||||
|
||||
if (!mapScripts)
|
||||
if (mapScripts == NULL)
|
||||
return NULL;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (!*mapScripts)
|
||||
if (*mapScripts == 0)
|
||||
return NULL;
|
||||
if (*mapScripts == tag)
|
||||
{
|
||||
@ -248,14 +248,14 @@ u8 *mapheader_get_tagged_pointer(u8 tag)
|
||||
}
|
||||
}
|
||||
|
||||
void mapheader_run_script_by_tag(u8 tag)
|
||||
static void mapheader_run_script_by_tag(u8 tag)
|
||||
{
|
||||
u8 *ptr = mapheader_get_tagged_pointer(tag);
|
||||
if (ptr)
|
||||
ScriptContext2_RunNewScript(ptr);
|
||||
}
|
||||
|
||||
u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
|
||||
static u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
|
||||
{
|
||||
u8 *ptr = mapheader_get_tagged_pointer(tag);
|
||||
|
||||
@ -316,7 +316,7 @@ void mapheader_run_first_tag4_script_list_match(void)
|
||||
ScriptContext2_RunNewScript(ptr);
|
||||
}
|
||||
|
||||
u32 CalculateRamScriptChecksum(void)
|
||||
static u32 CalculateRamScriptChecksum(void)
|
||||
{
|
||||
u32 i;
|
||||
u32 sum = 0;
|
||||
|
@ -81,7 +81,7 @@ void UpdateShoalTideFlag(void)
|
||||
1,
|
||||
};
|
||||
|
||||
if (is_light_level_1_2_3_5_or_6(get_map_light_from_warp0()))
|
||||
if (is_map_type_1_2_3_5_or_6(get_map_type_from_warp0()))
|
||||
{
|
||||
RtcCalcLocalTime();
|
||||
if (tide[gLocalTime.hours])
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "event_data.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "fieldmap.h"
|
||||
#include "map_constants.h"
|
||||
#include "metatile_behavior.h"
|
||||
#include "pokeblock.h"
|
||||
#include "rng.h"
|
||||
@ -2952,7 +2953,8 @@ static bool8 CheckFeebas(void)
|
||||
u8 route119section = 0;
|
||||
u16 waterTileNum;
|
||||
|
||||
if (gSaveBlock1.location.mapGroup == 0 && gSaveBlock1.location.mapNum == 0x22)
|
||||
if (gSaveBlock1.location.mapGroup == MAP_GROUP_ROUTE119
|
||||
&& gSaveBlock1.location.mapNum == MAP_ID_ROUTE119)
|
||||
{
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
x -= 7;
|
||||
@ -3497,7 +3499,7 @@ u16 GetLocalWildMon(bool8 *isWaterMon)
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetMirageIslandMon(void)
|
||||
u16 GetLocalWaterMon(void)
|
||||
{
|
||||
u16 headerNum = GetCurrentMapWildMonHeader();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user