Document secret base

This commit is contained in:
Marcus Huderle 2019-04-05 16:11:24 -05:00 committed by huderlem
parent 9a11764b52
commit 033580da96
38 changed files with 1139 additions and 1262 deletions

View File

@ -454,7 +454,7 @@ EventScript_SecretBasePC:: @ 823B4BB
EventScript_SecretBasePCShowMainMenu:: @ 823B4D3 EventScript_SecretBasePCShowMainMenu:: @ 823B4D3
message Text_SecretBasePCStartMenu message Text_SecretBasePCStartMenu
waitmessage waitmessage
goto_if_set FLAG_DECORATION_16, EventScript_SecretBasePCMainMenuChoice goto_if_set FLAG_SECRET_BASE_REGISTRY_ENABLED, EventScript_SecretBasePCMainMenuChoice
goto EventScript_23B531 goto EventScript_23B531
end end
@ -487,16 +487,16 @@ EventScript_23B568:: @ 823B568
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq EventScript_SecretBasePCShowMainMenu goto_if_eq EventScript_SecretBasePCShowMainMenu
closemessage closemessage
special sub_80E9AC0 special MoveOutOfSecretBase
releaseall releaseall
end end
EventScript_23B581:: @ 823B581 EventScript_23B581:: @ 823B581
special sub_80E9C74 special ShowSecretBaseDecorationMenu
end end
EventScript_23B585:: @ 823B585 EventScript_23B585:: @ 823B585
special sub_80E9C88 special ShowSecretBaseRegistryMenu
end end
EventScript_RecordMixingSecretBasePC:: @ 823B589 EventScript_RecordMixingSecretBasePC:: @ 823B589
@ -529,17 +529,17 @@ gUnknown_0823B5E9:: @ 823B5E9
end end
EventScript_23B5F0:: @ 823B5F0 EventScript_23B5F0:: @ 823B5F0
special sub_80E9BDC special GetCurSecretBaseRegistrationValidity
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq EventScript_23B62F goto_if_eq EventScript_23B62F
compare VAR_RESULT, 2 compare VAR_RESULT, 2
goto_if_eq EventScript_CantRegisterTooManyBases goto_if_eq EventScript_CantRegisterTooManyBases
special sub_80E980C special CopyCurSecretBaseOwnerName_StrVar1
msgbox Text_276707, MSGBOX_YESNO msgbox Text_WantToRegisterSecretBase, MSGBOX_YESNO
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq EventScript_23B5A1 goto_if_eq EventScript_23B5A1
msgbox Text_2767D1, MSGBOX_SIGN msgbox Text_2767D1, MSGBOX_SIGN
special sub_80E9C2C special ToggleCurSecretBaseRegistry
special DoSecretBasePCTurnOffEffect special DoSecretBasePCTurnOffEffect
releaseall releaseall
end end
@ -549,7 +549,7 @@ EventScript_23B62F:: @ 823B62F
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq EventScript_23B5A1 goto_if_eq EventScript_23B5A1
msgbox Text_2767E9, MSGBOX_SIGN msgbox Text_2767E9, MSGBOX_SIGN
special sub_80E9C2C special ToggleCurSecretBaseRegistry
special DoSecretBasePCTurnOffEffect special DoSecretBasePCTurnOffEffect
releaseall releaseall
end end
@ -573,23 +573,23 @@ EventScript_23B66E:: @ 823B66E
end end
EventScript_23B674:: @ 823B674 EventScript_23B674:: @ 823B674
special sub_80EB498 special SetSecretBaseSecretsTvFlags_Poster
end end
EventScript_23B678:: @ 823B678 EventScript_23B678:: @ 823B678
special sub_80EB56C special SetSecretBaseSecretsTvFlags_MiscFurnature
end end
EventScript_23B67C:: @ 823B67C EventScript_23B67C:: @ 823B67C
special sub_80EB9E0 special SetSecretBaseSecretsTvFlags_LargeDecorationSpot
end end
EventScript_23B680:: @ 823B680 EventScript_23B680:: @ 823B680
special sub_80EBB28 special SetSecretBaseSecretsTvFlags_SmallDecorationSpot
end end
EventScript_SecretBaseSandOrnament:: @ 823B684 EventScript_SecretBaseSandOrnament:: @ 823B684
special sub_80EBE7C special SetSecretBaseSecretsTvFlags_SandOrnament
dofieldeffect FLDEFF_SAND_PILLAR dofieldeffect FLDEFF_SAND_PILLAR
waitstate waitstate
end end

View File

@ -17,7 +17,7 @@ MossdeepCity_House4_EventScript_222DED:: @ 8222DED
MossdeepCity_House4_EventScript_222DF7:: @ 8222DF7 MossdeepCity_House4_EventScript_222DF7:: @ 8222DF7
lock lock
faceplayer faceplayer
special sub_80E8BC8 special CheckPlayerHasSecretBase
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq MossdeepCity_House4_EventScript_222E14 goto_if_eq MossdeepCity_House4_EventScript_222E14
special GetSecretBaseNearbyMapName special GetSecretBaseNearbyMapName

View File

@ -11,7 +11,7 @@ SecretBase_RedCave1_MapScript2_23B498: @ 823B498
SecretBase_RedCave1_MapScript1_23B4A2: @ 823B4A2 SecretBase_RedCave1_MapScript1_23B4A2: @ 823B4A2
call SecretBase_RedCave1_EventScript_275CE1 call SecretBase_RedCave1_EventScript_275CE1
special sub_80E95D4 special SetSecretBaseOwnerGfxId
special sub_80EB1AC special sub_80EB1AC
end end

View File

@ -310,8 +310,8 @@ SecretBase_RedCave1_Text_275944: @ 8275944
.string "Are you speechless?$" .string "Are you speechless?$"
EventScript_2759F1:: @ 82759F1 EventScript_2759F1:: @ 82759F1
special sub_80E8C98 special GetSecretBaseTypeInFrontOfPlayer
special sub_80E8BC8 special CheckPlayerHasSecretBase
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq EventScript_275BE8 goto_if_eq EventScript_275BE8
checkpartymove MOVE_SECRET_POWER checkpartymove MOVE_SECRET_POWER
@ -432,11 +432,11 @@ EventScript_275B5B:: @ 8275B5B
playse SE_KAIDAN playse SE_KAIDAN
setvar VAR_INIT_SECRET_BASE, 0 setvar VAR_INIT_SECRET_BASE, 0
setflag FLAG_DECORATION_0 setflag FLAG_DECORATION_0
special sub_80E8E18 special SetPlayerSecretBase
special sub_80E9068 special EnterSecretBase
setvar VAR_0x8004, 0 setvar VAR_0x8004, 0
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special sub_80E933C special InitSecretBaseDecorationSprites
setvar VAR_SECRET_BASE_INITIALIZED, 1 setvar VAR_SECRET_BASE_INITIALIZED, 1
waitstate waitstate
end end
@ -450,13 +450,13 @@ SecretBase_RedCave1_EventScript_275B81:: @ 8275B81
goto_if_eq SecretBase_RedCave1_EventScript_275BAB goto_if_eq SecretBase_RedCave1_EventScript_275BAB
closemessage closemessage
playse SE_KAIDAN playse SE_KAIDAN
special sub_80E9A90 special ClearAndLeaveSecretBase
end end
SecretBase_RedCave1_EventScript_275BAB:: @ 8275BAB SecretBase_RedCave1_EventScript_275BAB:: @ 8275BAB
closemessage closemessage
setflag FLAG_RECEIVED_SECRET_POWER setflag FLAG_RECEIVED_SECRET_POWER
special sub_80E91F8 special EnterNewlyCreatedSecretBase
waitstate waitstate
end end
@ -469,18 +469,18 @@ EventScript_275BB7:: @ 8275BB7
lockall lockall
setvar VAR_INIT_SECRET_BASE, 1 setvar VAR_INIT_SECRET_BASE, 1
playse SE_KAIDAN playse SE_KAIDAN
special sub_80E9744 special IsCurSecretBaseOwnedByAnotherPlayer
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq EventScript_275BDB goto_if_eq EventScript_275BDB
clearflag FLAG_DECORATION_0 clearflag FLAG_DECORATION_0
special sub_80E9068 special EnterSecretBase
setvar VAR_SECRET_BASE_INITIALIZED, 0 setvar VAR_SECRET_BASE_INITIALIZED, 0
waitstate waitstate
end end
EventScript_275BDB:: @ 8275BDB EventScript_275BDB:: @ 8275BDB
setflag FLAG_DECORATION_0 setflag FLAG_DECORATION_0
special sub_80E9068 special EnterSecretBase
setvar VAR_SECRET_BASE_INITIALIZED, 0 setvar VAR_SECRET_BASE_INITIALIZED, 0
waitstate waitstate
end end
@ -500,7 +500,7 @@ EventScript_275BE8:: @ 8275BE8
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq EventScript_275CDE goto_if_eq EventScript_275CDE
fadescreenswapbuffers 1 fadescreenswapbuffers 1
special sub_80E9B70 special MoveOutOfSecretBaseFromOutside
closemessage closemessage
fadescreenswapbuffers 0 fadescreenswapbuffers 0
msgbox Text_276A95, MSGBOX_YESNO msgbox Text_276A95, MSGBOX_YESNO
@ -569,7 +569,7 @@ SecretBase_RedCave1_EventScript_275CE1:: @ 8275CE1
EventScript_275D0C:: @ 8275D0C EventScript_275D0C:: @ 8275D0C
setvar VAR_0x8004, 0 setvar VAR_0x8004, 0
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special sub_80E933C special InitSecretBaseDecorationSprites
setvar VAR_SECRET_BASE_INITIALIZED, 1 setvar VAR_SECRET_BASE_INITIALIZED, 1
end end
@ -626,7 +626,7 @@ SecretBase_YellowCave1_EventScript_275D64:: @ 8275D64
SecretBase_YellowCave2_EventScript_275D64:: @ 8275D64 SecretBase_YellowCave2_EventScript_275D64:: @ 8275D64
SecretBase_YellowCave3_EventScript_275D64:: @ 8275D64 SecretBase_YellowCave3_EventScript_275D64:: @ 8275D64
SecretBase_YellowCave4_EventScript_275D64:: @ 8275D64 SecretBase_YellowCave4_EventScript_275D64:: @ 8275D64
special sub_80EA354 special GetSecretBaseOwnerInteractionState
compare VAR_0x8004, 0 compare VAR_0x8004, 0
goto_if_eq SecretBase_RedCave1_EventScript_275DD6 goto_if_eq SecretBase_RedCave1_EventScript_275DD6
compare VAR_0x8004, 1 compare VAR_0x8004, 1
@ -1010,7 +1010,7 @@ SecretBase_RedCave1_EventScript_27627C:: @ 827627C
end end
SecretBase_RedCave1_EventScript_276286:: @ 8276286 SecretBase_RedCave1_EventScript_276286:: @ 8276286
special sub_80EA2E4 special PrepSecretBaseBattleFlags
setvar VAR_0x8004, SPECIAL_BATTLE_SECRET_BASE setvar VAR_0x8004, SPECIAL_BATTLE_SECRET_BASE
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special DoSpecialTrainerBattle special DoSpecialTrainerBattle
@ -1039,12 +1039,20 @@ SecretBase_RedCave1_EventScript_2762C5:: @ 82762C5
.include "data/scripts/secret_power_tm.inc" .include "data/scripts/secret_power_tm.inc"
SecretBase_EventScript_DollInteract:: @ 82766A2
special sub_80EB290
end
SecretBase_EventScript_CushionInteract:: @ 82766A6
special sub_80EB2C8
end
Text_2766AA: @ 82766AA Text_2766AA: @ 82766AA
.string "All decorations and furniture in your\n" .string "All decorations and furniture in your\n"
.string "SECRET BASE will be returned to your PC.\p" .string "SECRET BASE will be returned to your PC.\p"
.string "Is that okay?$" .string "Is that okay?$"
Text_276707: @ 8276707 Text_WantToRegisterSecretBase: @ 8276707
.string "Do you want to register\n" .string "Do you want to register\n"
.string "{STR_VAR_1}'s SECRET BASE?$" .string "{STR_VAR_1}'s SECRET BASE?$"

View File

@ -103,11 +103,3 @@ Route111_Movement_276696: @ 8276696
walk_down walk_down
walk_down walk_down
step_end step_end
EventScript_SecretPower1:: @ 82766A2
special sub_80EB290
end
EventScript_SecretPower2:: @ 82766A6
special sub_80EB2C8
end

View File

@ -14,25 +14,25 @@ gSpecials:: @ 81DBA64
def_special sub_80AF9F8 def_special sub_80AF9F8
def_special CleanupLinkRoomState def_special CleanupLinkRoomState
def_special ExitLinkRoom def_special ExitLinkRoom
def_special sub_80E8E18 def_special SetPlayerSecretBase
def_special sub_80E8BC8 def_special CheckPlayerHasSecretBase
def_special sub_80E9068 def_special EnterSecretBase
def_special sub_80E9A90 def_special ClearAndLeaveSecretBase
def_special sub_80E9AC0 def_special MoveOutOfSecretBase
def_special sub_80E9744 def_special IsCurSecretBaseOwnedByAnotherPlayer
def_special sub_80E9BDC def_special GetCurSecretBaseRegistrationValidity
def_special sub_80E9C2C def_special ToggleCurSecretBaseRegistry
def_special sub_80E9C74 def_special ShowSecretBaseDecorationMenu
def_special sub_80E9C88 def_special ShowSecretBaseRegistryMenu
def_special sub_80EA2E4 def_special PrepSecretBaseBattleFlags
def_special sub_80EA354 def_special GetSecretBaseOwnerInteractionState
def_special sub_80E933C def_special InitSecretBaseDecorationSprites
def_special sub_8127E18 def_special sub_8127E18
def_special sub_81297AC def_special sub_81297AC
def_special sub_80E8C98 def_special GetSecretBaseTypeInFrontOfPlayer
def_special sub_80E95D4 def_special SetSecretBaseOwnerGfxId
def_special sub_8129708 def_special sub_8129708
def_special sub_80E91F8 def_special EnterNewlyCreatedSecretBase
def_special sub_80EA30C def_special sub_80EA30C
def_special DoSecretBasePCTurnOffEffect def_special DoSecretBasePCTurnOffEffect
def_special RecordMixingPlayerSpotTriggered def_special RecordMixingPlayerSpotTriggered
@ -313,7 +313,7 @@ gSpecials:: @ 81DBA64
def_special sub_80AFC60 def_special sub_80AFC60
def_special PutZigzagoonInPlayerParty def_special PutZigzagoonInPlayerParty
def_special IsStarterInParty def_special IsStarterInParty
def_special sub_80E980C def_special CopyCurSecretBaseOwnerName_StrVar1
def_special ScriptCheckFreePokemonStorageSpace def_special ScriptCheckFreePokemonStorageSpace
def_special DoSealedChamberShakingEffect1 def_special DoSealedChamberShakingEffect1
def_special sub_8139B60 def_special sub_8139B60
@ -340,7 +340,7 @@ gSpecials:: @ 81DBA64
def_special ScriptGetPartyMonSpecies def_special ScriptGetPartyMonSpecies
def_special sub_81B98DC def_special sub_81B98DC
def_special nullsub_54 def_special nullsub_54
def_special sub_80E9B70 def_special MoveOutOfSecretBaseFromOutside
def_special LoadPlayerBag def_special LoadPlayerBag
def_special sub_80B05B4 def_special sub_80B05B4
def_special SetPacifidlogTMReceivedDay def_special SetPacifidlogTMReceivedDay
@ -361,17 +361,17 @@ gSpecials:: @ 81DBA64
def_special sub_80EED10 def_special sub_80EED10
def_special sub_80EED34 def_special sub_80EED34
def_special sub_80EB1AC def_special sub_80EB1AC
def_special sub_80EBE7C def_special SetSecretBaseSecretsTvFlags_SandOrnament
def_special sub_80EB300 def_special sub_80EB300
def_special sub_80EB438 def_special sub_80EB438
def_special sub_80EB368 def_special sub_80EB368
def_special sub_80EB3D0 def_special sub_80EB3D0
def_special sub_80EB290 def_special sub_80EB290
def_special sub_80EB2C8 def_special sub_80EB2C8
def_special sub_80EB56C def_special SetSecretBaseSecretsTvFlags_MiscFurnature
def_special sub_80EB9E0 def_special SetSecretBaseSecretsTvFlags_LargeDecorationSpot
def_special sub_80EBB28 def_special SetSecretBaseSecretsTvFlags_SmallDecorationSpot
def_special sub_80EB498 def_special SetSecretBaseSecretsTvFlags_Poster
def_special sub_818D9C0 def_special sub_818D9C0
def_special sub_818DAEC def_special sub_818DAEC
def_special sub_818DBE8 def_special sub_818DBE8

View File

@ -223,7 +223,7 @@ struct StatsArray
struct BattleResources struct BattleResources
{ {
struct SecretBaseRecord* secretBase; struct SecretBase* secretBase;
struct ResourceFlags *flags; struct ResourceFlags *flags;
struct BattleScriptsStack* battleScriptsStack; struct BattleScriptsStack* battleScriptsStack;
struct BattleCallbacksStack* battleCallbackStack; struct BattleCallbacksStack* battleCallbackStack;

View File

@ -274,6 +274,8 @@
#define TRACKS_FOOT 1 #define TRACKS_FOOT 1
#define TRACKS_BIKE_TIRE 2 #define TRACKS_BIKE_TIRE 2
#define FIRST_DECORATION_SPRITE_GFX EVENT_OBJ_GFX_PICHU_DOLL
#define EVENT_OBJ_ID_PLAYER 0xFF #define EVENT_OBJ_ID_PLAYER 0xFF
#define EVENT_OBJ_ID_CAMERA 0x7F #define EVENT_OBJ_ID_CAMERA 0x7F

View File

@ -287,7 +287,7 @@
#define FLAG_RECEIVED_TM41 0x109 #define FLAG_RECEIVED_TM41 0x109
#define FLAG_RECEIVED_LAVARIDGE_EGG 0x10A #define FLAG_RECEIVED_LAVARIDGE_EGG 0x10A
#define FLAG_RECEIVED_REVIVED_FOSSIL_MON 0x10B #define FLAG_RECEIVED_REVIVED_FOSSIL_MON 0x10B
#define FLAG_DECORATION_16 0x10C #define FLAG_SECRET_BASE_REGISTRY_ENABLED 0x10C
#define FLAG_RECEIVED_TM46 0x10D #define FLAG_RECEIVED_TM46 0x10D
#define FLAG_CONTEST_SKETCH_CREATED 0x10E #define FLAG_CONTEST_SKETCH_CREATED 0x10E
#define FLAG_EVIL_TEAM_ESCAPED_STERN_SPOKE 0x10F #define FLAG_EVIL_TEAM_ESCAPED_STERN_SPOKE 0x10F

View File

@ -182,7 +182,7 @@
#define MB_SECRET_BASE_UNUSED 0xB2 #define MB_SECRET_BASE_UNUSED 0xB2
#define MB_BLOCK_DECORATION 0xB3 #define MB_BLOCK_DECORATION 0xB3
#define MB_SECRET_BASE_DECORATION 0xB4 #define MB_SECRET_BASE_DECORATION 0xB4
#define MB_SECRET_BASE_LARGE_MAT_EDGE 0xB5 #define MB_HOLDS_SMALL_DECORATION 0xB5
#define MB_UNUSED_B6 0xB6 #define MB_UNUSED_B6 0xB6
#define MB_SECRET_BASE_NORTH_WALL 0xB7 #define MB_SECRET_BASE_NORTH_WALL 0xB7
#define MB_SECRET_BASE_BALLOON 0xB8 #define MB_SECRET_BASE_BALLOON 0xB8
@ -196,7 +196,7 @@
#define MB_IMPASSABLE_SOUTH_AND_NORTH 0xC0 #define MB_IMPASSABLE_SOUTH_AND_NORTH 0xC0
#define MB_IMPASSABLE_WEST_AND_EAST 0xC1 #define MB_IMPASSABLE_WEST_AND_EAST 0xC1
#define MB_SECRET_BASE_HOLE 0xC2 #define MB_SECRET_BASE_HOLE 0xC2
#define MB_LARGE_MAT_CENTER 0xC3 #define MB_HOLDS_LARGE_DECORATION 0xC3
#define MB_SECRET_BASE_TV_SHIELD 0xC4 #define MB_SECRET_BASE_TV_SHIELD 0xC4
#define MB_PLAYER_ROOM_PC_ON 0xC5 #define MB_PLAYER_ROOM_PC_ON 0xC5
#define MB_C6 0xC6 #define MB_C6 0xC6

View File

@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_VARS_H #ifndef GUARD_CONSTANTS_VARS_H
#define GUARD_CONSTANTS_VARS_H #define GUARD_CONSTANTS_VARS_H
#define UNKNOWN_VAR_OFFSET_3F20 0x3F20
#define VARS_START 0x4000 #define VARS_START 0x4000
// temporary vars // temporary vars

View File

@ -9,7 +9,7 @@ enum DecorPerm {
DECORPERM_PASS_FLOOR, DECORPERM_PASS_FLOOR,
DECORPERM_BEHIND_FLOOR, DECORPERM_BEHIND_FLOOR,
DECORPERM_NA_WALL, DECORPERM_NA_WALL,
DECORPERM_SOLID_MAT DECORPERM_SPRITE
}; };
enum DecorShape { enum DecorShape {
@ -68,7 +68,7 @@ extern EWRAM_DATA u8 gCurDecorationIndex;
void sub_8126968(void); void sub_8126968(void);
void sub_8126AD8(u8 taskId); void sub_8126AD8(u8 taskId);
void sub_8127D38(u16 mapX, u16 mapY, u16 decor); void ShowDecorationOnMap(u16 mapX, u16 mapY, u16 decor);
void sub_8126B2C(u8 taskId); void sub_8126B2C(u8 taskId);
void sub_8127208(u8 taskId); void sub_8127208(u8 taskId);
void sub_8127250(u8 *dest, u8 decorCat); void sub_8127250(u8 *dest, u8 decorCat);

View File

@ -74,10 +74,10 @@ u8 GetFirstInactiveEventObjectId(void);
void RemoveEventObjectByLocalIdAndMap(u8, u8, u8); void RemoveEventObjectByLocalIdAndMap(u8, u8, u8);
void LoadPlayerObjectReflectionPalette(u16, u8); void LoadPlayerObjectReflectionPalette(u16, u8);
void LoadSpecialObjectReflectionPalette(u16, u8); void LoadSpecialObjectReflectionPalette(u16, u8);
void sub_808EBA8(u8, u8, u8, s16, s16); void TryMoveEventObjectToMapCoords(u8, u8, u8, s16, s16);
void PatchObjectPalette(u16, u8); void PatchObjectPalette(u16, u8);
void sub_808E16C(s16, s16); void sub_808E16C(s16, s16);
void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat); void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat);
void sub_8092FF0(s16, s16, s16 *, s16 *); void sub_8092FF0(s16, s16, s16 *, s16 *);
u8 GetFaceDirectionAnimNum(u8); u8 GetFaceDirectionAnimNum(u8);
void sub_80930E0(s16 *, s16 *, s16, s16); void sub_80930E0(s16 *, s16 *, s16, s16);
@ -86,7 +86,7 @@ void EventObjectClearHeldMovementIfActive(struct EventObject *);
void TrySpawnEventObjects(s16, s16); void TrySpawnEventObjects(s16, s16);
u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction); u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction);
u8 AddPseudoEventObject(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority); u8 AddPseudoEventObject(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 show_sprite(u8, u8, u8); u8 TrySpawnEventObject(u8, u8, u8);
u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z); u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z);
u8 SpawnSpecialEventObject(struct EventObjectTemplate *); u8 SpawnSpecialEventObject(struct EventObjectTemplate *);
void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *); void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *);
@ -103,8 +103,8 @@ void sub_808E78C(u8, u8, u8, u8);
void sub_808E75C(s16, s16); void sub_808E75C(s16, s16);
void EventObjectGetLocalIdAndMap(struct EventObject *eventObject, void *localId, void *mapNum, void *mapGroup); void EventObjectGetLocalIdAndMap(struct EventObject *eventObject, void *localId, void *mapNum, void *mapGroup);
void ShiftEventObjectCoords(struct EventObject *, s16, s16); void ShiftEventObjectCoords(struct EventObject *, s16, s16);
void sub_808EB08(struct EventObject *, s16, s16); void MoveEventObjectToMapCoords(struct EventObject *, s16, s16);
void sub_808F254(u8, u8, u8); void TryOverrideEventObjectTemplateCoords(u8, u8, u8);
void InitEventObjectPalettes(u8 palSlot); void InitEventObjectPalettes(u8 palSlot);
void UpdateEventObjectCurrentMovement(struct EventObject *, struct Sprite *, bool8(struct EventObject *, struct Sprite *)); void UpdateEventObjectCurrentMovement(struct EventObject *, struct Sprite *, bool8(struct EventObject *, struct Sprite *));
u8 EventObjectFaceOppositeDirection(struct EventObject *, u8); u8 EventObjectFaceOppositeDirection(struct EventObject *, u8);

View File

@ -15,8 +15,8 @@ extern const u8 EventScript_TryDoDoubleTrainerBattle[];
extern const u8 EventScript_TryDoNormalTrainerBattle[]; extern const u8 EventScript_TryDoNormalTrainerBattle[];
extern const u8 EventScript_TryDoDoubleRematchBattle[]; extern const u8 EventScript_TryDoDoubleRematchBattle[];
extern const u8 EventScript_TryDoRematchBattle[]; extern const u8 EventScript_TryDoRematchBattle[];
extern const u8 EventScript_SecretPower1[]; extern const u8 SecretBase_EventScript_DollInteract[];
extern const u8 EventScript_SecretPower2[]; extern const u8 SecretBase_EventScript_CushionInteract[];
extern const u8 gTVBravoTrainerText00[]; extern const u8 gTVBravoTrainerText00[];
@ -528,8 +528,6 @@ extern const u8 EventScript_PlayerPCMale[];
extern const u8 EventScript_PlayerPCFemale[]; extern const u8 EventScript_PlayerPCFemale[];
extern const u8 EventScript_SecretBasePC[]; extern const u8 EventScript_SecretBasePC[];
extern const u8 EventScript_RecordMixingSecretBasePC[]; extern const u8 EventScript_RecordMixingSecretBasePC[];
extern const u8 EventScript_SecretPower1[];
extern const u8 EventScript_SecretPower2[];
extern const u8 EventScript_PC[]; extern const u8 EventScript_PC[];
extern const u8 EventScript_TestSignpostMsg[]; extern const u8 EventScript_TestSignpostMsg[];
extern const u8 EventScript_HiddenItemScript[]; extern const u8 EventScript_HiddenItemScript[];

View File

@ -471,21 +471,21 @@ struct SecretBaseParty
u8 EVs[PARTY_SIZE]; u8 EVs[PARTY_SIZE];
}; };
struct SecretBaseRecord struct SecretBase
{ {
/*0x1A9C*/ u8 secretBaseId; /*0x1A9C*/ u8 secretBaseId;
/*0x1A9D*/ u8 sbr_field_1_0:4; /*0x1A9D*/ u8 sbr_field_1_0:4;
/*0x1A9D*/ u8 gender:1; /*0x1A9D*/ u8 gender:1;
/*0x1A9D*/ u8 sbr_field_1_5:1; /*0x1A9D*/ u8 battledOwnerToday:1;
/*0x1A9D*/ u8 sbr_field_1_6:2; /*0x1A9D*/ u8 registryStatus:2;
/*0x1A9E*/ u8 trainerName[PLAYER_NAME_LENGTH]; /*0x1A9E*/ u8 trainerName[PLAYER_NAME_LENGTH];
/*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class /*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class
/*0x1AA9*/ u8 language; /*0x1AA9*/ u8 language;
/*0x1AAA*/ u16 sbr_field_e; /*0x1AAA*/ u16 numSecretBasesReceived;
/*0x1AAC*/ u8 sbr_field_10; /*0x1AAC*/ u8 numTimesEntered;
/*0x1AAD*/ u8 sbr_field_11; /*0x1AAD*/ u8 sbr_field_11;
/*0x1AAE*/ u8 decorations[16]; /*0x1AAE*/ u8 decorations[16];
/*0x1ABE*/ u8 decorationPos[16]; /*0x1ABE*/ u8 decorationPositions[16];
/*0x1AD0*/ struct SecretBaseParty party; /*0x1AD0*/ struct SecretBaseParty party;
}; };
@ -915,7 +915,7 @@ struct SaveBlock1
/*0x139C*/ u16 vars[VARS_COUNT]; /*0x139C*/ u16 vars[VARS_COUNT];
/*0x159C*/ u32 gameStats[NUM_GAME_STATS]; /*0x159C*/ u32 gameStats[NUM_GAME_STATS];
/*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT]; /*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];
/*0x1A9C*/ struct SecretBaseRecord secretBases[SECRET_BASES_COUNT]; /*0x1A9C*/ struct SecretBase secretBases[SECRET_BASES_COUNT];
/*0x271C*/ u8 playerRoomDecor[12]; /*0x271C*/ u8 playerRoomDecor[12];
/*0x2728*/ u8 playerRoomDecorPos[12]; /*0x2728*/ u8 playerRoomDecorPos[12];
/*0x2734*/ u8 decorDesk[10]; /*0x2734*/ u8 decorDesk[10];

View File

@ -59,8 +59,8 @@ bool8 MetatileBehavior_IsSecretBasePoster(u8);
bool8 MetatileBehavior_IsNormal(u8); bool8 MetatileBehavior_IsNormal(u8);
bool8 MetatileBehavior_IsSecretBaseNorthWall(u8); bool8 MetatileBehavior_IsSecretBaseNorthWall(u8);
bool8 MetatileBehavior_IsMB_B2_Duplicate(u8); bool8 MetatileBehavior_IsMB_B2_Duplicate(u8);
bool8 MetatileBehavior_IsSecretBaseLargeMatEdge(u8); bool8 MetatileBehavior_HoldsSmallDecoration(u8);
bool8 MetatileBehavior_IsLargeMatCenter(u8); bool8 MetatileBehavior_HoldsLargeDecoration(u8);
bool8 MetatileBehavior_IsSecretBaseHole(u8); bool8 MetatileBehavior_IsSecretBaseHole(u8);
bool8 MetatileBehavior_IsSecretBaseBalloon(u8); bool8 MetatileBehavior_IsSecretBaseBalloon(u8);
bool8 MetatileBehavior_IsSecretBaseBreakableDoor(u8); bool8 MetatileBehavior_IsSecretBaseBreakableDoor(u8);

View File

@ -509,7 +509,7 @@ u8 GetMonsStateToDoubles(void);
u8 GetMonsStateToDoubles_2(void); u8 GetMonsStateToDoubles_2(void);
u8 GetAbilityBySpecies(u16 species, bool8 altAbility); u8 GetAbilityBySpecies(u16 species, bool8 altAbility);
u8 GetMonAbility(struct Pokemon *mon); u8 GetMonAbility(struct Pokemon *mon);
void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord); void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord);
u8 GetSecretBaseTrainerPicIndex(void); u8 GetSecretBaseTrainerPicIndex(void);
u8 GetSecretBaseTrainerClass(void); u8 GetSecretBaseTrainerClass(void);
bool8 IsPlayerPartyAndPokemonStorageFull(void); bool8 IsPlayerPartyAndPokemonStorageFull(void);

View File

@ -1,40 +1,30 @@
#ifndef GUARD_SECRET_BASE_H #ifndef GUARD_SECRET_BASE_H
#define GUARD_SECRET_BASE_H #define GUARD_SECRET_BASE_H
// Exported type declarations void HideSecretBaseDecorationSprites(void);
void CopyCurSecretBaseOwnerName_StrVar1(void);
// Exported RAM declarations void ClearJapaneseSecretBases(struct SecretBase *dest);
void SetPlayerSecretBaseParty(void);
// Exported ROM declarations
void sub_80E9578(void);
void sub_80E980C(void);
void sub_80EB18C(struct SecretBaseRecord *dest);
void sub_80E9914(void);
u8 *GetSecretBaseMapName(u8 *dest); u8 *GetSecretBaseMapName(u8 *dest);
const u8 *GetSecretBaseTrainerLoseText(void); const u8 *GetSecretBaseTrainerLoseText(void);
void sub_80E8EE0(struct MapEvents const *events); void SetOccupiedSecretBaseEntranceMetatiles(struct MapEvents const *events);
void sub_80E9238(u8 flagIn); void InitSecretBaseAppearance(bool8 hidePC);
bool8 CurrentMapIsSecretBase(void); bool8 CurMapIsSecretBase(void);
void SecretBasePerStepCallback(u8 taskId); void SecretBasePerStepCallback(u8 taskId);
bool8 sub_80E9680(void); bool8 TrySetCurSecretBase(void);
void sub_80EB498(void); void SetSecretBaseSecretsTvFlags_Poster(void);
void sub_80EB56C(void); void SetSecretBaseSecretsTvFlags_MiscFurnature(void);
void sub_80EB9E0(void); void SetSecretBaseSecretsTvFlags_LargeDecorationSpot(void);
void sub_80EBB28(void); void SetSecretBaseSecretsTvFlags_SmallDecorationSpot(void);
void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEvents *events); void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEvents *events);
bool8 sub_80E909C(void); bool8 SecretBaseMapPopupEnabled(void);
void sub_80EB218(void); void sub_80EB218(void);
void ResetSecretBases(void); void ClearSecretBases(void);
void SetCurSecretBaseIdFromPosition(const struct MapPosition *position, const struct MapEvents *events);
// SetCurrentSecretBaseFromPosition void TrySetCurSecretBaseIndex(void);
void sub_80E9608(const struct MapPosition *position, const struct MapEvents *events); void CheckPlayerHasSecretBase(void);
// SetCurrentSecretBaseVar void ToggleSecretBaseEntranceMetatile(void);
void sub_80E8B6C(void);
void sub_80E8BC8(void);
void sub_80E8D4C(void);
void EnableBothScriptContexts(void); void EnableBothScriptContexts(void);
void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx); void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx);
#endif //GUARD_SECRET_BASE_H #endif //GUARD_SECRET_BASE_H

View File

@ -132,7 +132,7 @@ extern const u8 gText_ApostropheSBase[];
extern const u8 gText_NoRegistry[]; extern const u8 gText_NoRegistry[];
extern const u8 gText_OkayToDeleteFromRegistry[]; extern const u8 gText_OkayToDeleteFromRegistry[];
extern const u8 gText_RegisteredDataDeleted[]; extern const u8 gText_RegisteredDataDeleted[];
extern const u8 gUnknown_085EA79D[]; extern const u8 gText_DelRegist[];
extern const u8 gText_CommErrorEllipsis[]; extern const u8 gText_CommErrorEllipsis[];
extern const u8 gText_MoveCloserToLinkPartner[]; extern const u8 gText_MoveCloserToLinkPartner[];
extern const u8 gText_CommErrorCheckConnections[]; extern const u8 gText_CommErrorCheckConnections[];

View File

@ -686,7 +686,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_PICHU_DOLL, DECOR_PICHU_DOLL,
_("PICHU DOLL"), _("PICHU DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -695,7 +695,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_PIKACHU_DOLL, DECOR_PIKACHU_DOLL,
_("PIKACHU DOLL"), _("PIKACHU DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -704,7 +704,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_MARILL_DOLL, DECOR_MARILL_DOLL,
_("MARILL DOLL"), _("MARILL DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -713,7 +713,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_TOGEPI_DOLL, DECOR_TOGEPI_DOLL,
_("TOGEPI DOLL"), _("TOGEPI DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -722,7 +722,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_CYNDAQUIL_DOLL, DECOR_CYNDAQUIL_DOLL,
_("CYNDAQUIL DOLL"), _("CYNDAQUIL DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -731,7 +731,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_CHIKORITA_DOLL, DECOR_CHIKORITA_DOLL,
_("CHIKORITA DOLL"), _("CHIKORITA DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -740,7 +740,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_TOTODILE_DOLL, DECOR_TOTODILE_DOLL,
_("TOTODILE DOLL"), _("TOTODILE DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -749,7 +749,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_JIGGLYPUFF_DOLL, DECOR_JIGGLYPUFF_DOLL,
_("JIGGLYPUFF DOLL"), _("JIGGLYPUFF DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -758,7 +758,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_MEOWTH_DOLL, DECOR_MEOWTH_DOLL,
_("MEOWTH DOLL"), _("MEOWTH DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -767,7 +767,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_CLEFAIRY_DOLL, DECOR_CLEFAIRY_DOLL,
_("CLEFAIRY DOLL"), _("CLEFAIRY DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -776,7 +776,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_DITTO_DOLL, DECOR_DITTO_DOLL,
_("DITTO DOLL"), _("DITTO DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -785,7 +785,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_SMOOCHUM_DOLL, DECOR_SMOOCHUM_DOLL,
_("SMOOCHUM DOLL"), _("SMOOCHUM DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -794,7 +794,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_TREECKO_DOLL, DECOR_TREECKO_DOLL,
_("TREECKO DOLL"), _("TREECKO DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -803,7 +803,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_TORCHIC_DOLL, DECOR_TORCHIC_DOLL,
_("TORCHIC DOLL"), _("TORCHIC DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -812,7 +812,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_MUDKIP_DOLL, DECOR_MUDKIP_DOLL,
_("MUDKIP DOLL"), _("MUDKIP DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -821,7 +821,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_DUSKULL_DOLL, DECOR_DUSKULL_DOLL,
_("DUSKULL DOLL"), _("DUSKULL DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -830,7 +830,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_WYNAUT_DOLL, DECOR_WYNAUT_DOLL,
_("WYNAUT DOLL"), _("WYNAUT DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -839,7 +839,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_BALTOY_DOLL, DECOR_BALTOY_DOLL,
_("BALTOY DOLL"), _("BALTOY DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -848,7 +848,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_KECLEON_DOLL, DECOR_KECLEON_DOLL,
_("KECLEON DOLL"), _("KECLEON DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -857,7 +857,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_AZURILL_DOLL, DECOR_AZURILL_DOLL,
_("AZURILL DOLL"), _("AZURILL DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -866,7 +866,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_SKITTY_DOLL, DECOR_SKITTY_DOLL,
_("SKITTY DOLL"), _("SKITTY DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -875,7 +875,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_SWABLU_DOLL, DECOR_SWABLU_DOLL,
_("SWABLU DOLL"), _("SWABLU DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -884,7 +884,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_GULPIN_DOLL, DECOR_GULPIN_DOLL,
_("GULPIN DOLL"), _("GULPIN DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -893,7 +893,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_LOTAD_DOLL, DECOR_LOTAD_DOLL,
_("LOTAD DOLL"), _("LOTAD DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -902,7 +902,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_SEEDOT_DOLL, DECOR_SEEDOT_DOLL,
_("SEEDOT DOLL"), _("SEEDOT DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_DOLL, DECORCAT_DOLL,
3000, 3000,
@ -911,7 +911,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_PIKA_CUSHION, DECOR_PIKA_CUSHION,
_("PIKA CUSHION"), _("PIKA CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -920,7 +920,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_ROUND_CUSHION, DECOR_ROUND_CUSHION,
_("ROUND CUSHION"), _("ROUND CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -929,7 +929,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_KISS_CUSHION, DECOR_KISS_CUSHION,
_("KISS CUSHION"), _("KISS CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -938,7 +938,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_ZIGZAG_CUSHION, DECOR_ZIGZAG_CUSHION,
_("ZIGZAG CUSHION"), _("ZIGZAG CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -947,7 +947,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_SPIN_CUSHION, DECOR_SPIN_CUSHION,
_("SPIN CUSHION"), _("SPIN CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -956,7 +956,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_DIAMOND_CUSHION, DECOR_DIAMOND_CUSHION,
_("DIAMOND CUSHION"), _("DIAMOND CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -965,7 +965,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_BALL_CUSHION, DECOR_BALL_CUSHION,
_("BALL CUSHION"), _("BALL CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -974,7 +974,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_GRASS_CUSHION, DECOR_GRASS_CUSHION,
_("GRASS CUSHION"), _("GRASS CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -983,7 +983,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_FIRE_CUSHION, DECOR_FIRE_CUSHION,
_("FIRE CUSHION"), _("FIRE CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -992,7 +992,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_WATER_CUSHION, DECOR_WATER_CUSHION,
_("WATER CUSHION"), _("WATER CUSHION"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x1, DECORSHAPE_1x1,
DECORCAT_CUSHION, DECORCAT_CUSHION,
2000, 2000,
@ -1001,7 +1001,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_SNORLAX_DOLL, DECOR_SNORLAX_DOLL,
_("SNORLAX DOLL"), _("SNORLAX DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1010,7 +1010,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_RHYDON_DOLL, DECOR_RHYDON_DOLL,
_("RHYDON DOLL"), _("RHYDON DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1019,7 +1019,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_LAPRAS_DOLL, DECOR_LAPRAS_DOLL,
_("LAPRAS DOLL"), _("LAPRAS DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1028,7 +1028,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_VENUSAUR_DOLL, DECOR_VENUSAUR_DOLL,
_("VENUSAUR DOLL"), _("VENUSAUR DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1037,7 +1037,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_CHARIZARD_DOLL, DECOR_CHARIZARD_DOLL,
_("CHARIZARD DOLL"), _("CHARIZARD DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1046,7 +1046,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_BLASTOISE_DOLL, DECOR_BLASTOISE_DOLL,
_("BLASTOISE DOLL"), _("BLASTOISE DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1055,7 +1055,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_WAILMER_DOLL, DECOR_WAILMER_DOLL,
_("WAILMER DOLL"), _("WAILMER DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1064,7 +1064,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_REGIROCK_DOLL, DECOR_REGIROCK_DOLL,
_("REGIROCK DOLL"), _("REGIROCK DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1073,7 +1073,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_REGICE_DOLL, DECOR_REGICE_DOLL,
_("REGICE DOLL"), _("REGICE DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,
@ -1082,7 +1082,7 @@ const struct Decoration gDecorations[] = {
}, { }, {
DECOR_REGISTEEL_DOLL, DECOR_REGISTEEL_DOLL,
_("REGISTEEL DOLL"), _("REGISTEEL DOLL"),
DECORPERM_SOLID_MAT, DECORPERM_SPRITE,
DECORSHAPE_1x2, DECORSHAPE_1x2,
DECORCAT_DOLL, DECORCAT_DOLL,
10000, 10000,

View File

@ -444,7 +444,7 @@ void sub_8126968(void)
if (gUnknown_0203A17C.isPlayerRoom == FALSE) if (gUnknown_0203A17C.isPlayerRoom == FALSE)
{ {
gUnknown_0203A17C.items = gSaveBlock1Ptr->secretBases[0].decorations; gUnknown_0203A17C.items = gSaveBlock1Ptr->secretBases[0].decorations;
gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPos; gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPositions;
} }
if (gUnknown_0203A17C.isPlayerRoom == TRUE) if (gUnknown_0203A17C.isPlayerRoom == TRUE)
{ {
@ -507,7 +507,7 @@ void sub_8126AD8(u8 taskId)
{ {
sub_8126ABC(); sub_8126ABC();
gUnknown_0203A17C.items = gSaveBlock1Ptr->secretBases[0].decorations; gUnknown_0203A17C.items = gSaveBlock1Ptr->secretBases[0].decorations;
gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPos; gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPositions;
gUnknown_0203A17C.size = sizeof(gSaveBlock1Ptr->secretBases[0].decorations); gUnknown_0203A17C.size = sizeof(gSaveBlock1Ptr->secretBases[0].decorations);
gUnknown_0203A17C.isPlayerRoom = FALSE; gUnknown_0203A17C.isPlayerRoom = FALSE;
gTasks[taskId].func = sub_8126B80; gTasks[taskId].func = sub_8126B80;
@ -1165,52 +1165,40 @@ u16 sub_8127B54(u8 decor, u8 a1)
void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
{ {
u16 i; u16 i, j;
u16 j; s16 x, y;
u16 behavior; u16 behavior;
u16 impassableFlag; u16 impassableFlag;
u16 v0; u16 posterSide;
u16 v1; u16 elevation;
s16 decLeft;
s16 decBottom;
for (i = 0; i < decHeight; i ++) for (j = 0; j < decHeight; j++)
{ {
decBottom = mapY - decHeight + 1 + i; y = mapY - decHeight + 1 + j;
for (j = 0; j < decWidth; j ++) for (i = 0; i < decWidth; i++)
{ {
decLeft = mapX + j; x = mapX + i;
behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]); behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[j * decWidth + i]);
if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12))) if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12)))
{
impassableFlag = METATILE_COLLISION_MASK; impassableFlag = METATILE_COLLISION_MASK;
}
else else
{ impassableFlag = 0;
impassableFlag = 0x000;
} if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsSecretBaseNorthWall(MapGridGetMetatileBehaviorAt(x, y)) == TRUE)
if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsSecretBaseNorthWall(MapGridGetMetatileBehaviorAt(decLeft, decBottom)) == TRUE) posterSide = 1;
{
v0 = 1;
}
else else
{ posterSide = 0;
v0 = 0;
} elevation = sub_8127B54(gDecorations[decor].id, j * decWidth + i);
v1 = sub_8127B54(gDecorations[decor].id, i * decWidth + j); if (elevation != 0xFFFF)
if (v1 != 0xFFFF) MapGridSetMetatileEntryAt(x, y, (gDecorations[decor].tiles[j * decWidth + i] + (0x200 | posterSide)) | impassableFlag | elevation);
{
MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag | v1);
}
else else
{ MapGridSetMetatileIdAt(x, y, (gDecorations[decor].tiles[j * decWidth + i] + (0x200 | posterSide)) | impassableFlag);
MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag);
}
} }
} }
} }
void sub_8127D38(u16 mapX, u16 mapY, u16 decor) void ShowDecorationOnMap(u16 mapX, u16 mapY, u16 decor)
{ {
switch (gDecorations[decor].shape) switch (gDecorations[decor].shape)
{ {
@ -1264,13 +1252,15 @@ void sub_8127E18(void)
break; break;
} }
} }
VarSet(UNKNOWN_VAR_OFFSET_3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]); VarSet(
VAR_OBJ_GFX_ID_0 + (gMapHeader.events->eventObjects[j].graphicsId - EVENT_OBJ_GFX_VAR_0),
sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]);
gSpecialVar_0x8005 = gMapHeader.events->eventObjects[j].localId; gSpecialVar_0x8005 = gMapHeader.events->eventObjects[j].localId;
gSpecialVar_0x8006 = sCurDecorMapX; gSpecialVar_0x8006 = sCurDecorMapX;
gSpecialVar_0x8007 = sCurDecorMapY; gSpecialVar_0x8007 = sCurDecorMapY;
show_sprite(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); TrySpawnEventObject(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
sub_808EBA8(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); TryMoveEventObjectToMapCoords(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007);
sub_808F254(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); TryOverrideEventObjectTemplateCoords(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
break; break;
} }
} }
@ -1591,7 +1581,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
} }
} }
break; break;
case DECORPERM_SOLID_MAT: case DECORPERM_SPRITE:
curY = gTasks[taskId].data[1]; curY = gTasks[taskId].data[1];
for (j=0; j<mapX; j++) for (j=0; j<mapX; j++)
{ {
@ -1599,14 +1589,14 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
if (decoration->shape == DECORSHAPE_1x2) if (decoration->shape == DECORSHAPE_1x2)
{ {
if (!MetatileBehavior_IsLargeMatCenter(behaviorAt)) if (!MetatileBehavior_HoldsLargeDecoration(behaviorAt))
{ {
return FALSE; return FALSE;
} }
} }
else if (!MetatileBehavior_IsSecretBaseLargeMatEdge(behaviorAt)) else if (!MetatileBehavior_HoldsSmallDecoration(behaviorAt))
{ {
if (!MetatileBehavior_IsLargeMatCenter(behaviorAt)) if (!MetatileBehavior_HoldsLargeDecoration(behaviorAt))
{ {
return FALSE; return FALSE;
} }
@ -1646,9 +1636,9 @@ void sub_81289F0(u8 taskId)
{ {
ClearDialogWindowAndFrame(0, 0); ClearDialogWindowAndFrame(0, 0);
sub_8128AAC(taskId); sub_8128AAC(taskId);
if (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].permission != DECORPERM_SOLID_MAT) if (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].permission != DECORPERM_SPRITE)
{ {
sub_8127D38(gTasks[taskId].data[0], gTasks[taskId].data[1], gCurDecorInventoryItems[gCurDecorationIndex]); ShowDecorationOnMap(gTasks[taskId].data[0], gTasks[taskId].data[1], gCurDecorInventoryItems[gCurDecorationIndex]);
} }
else else
{ {
@ -1750,7 +1740,7 @@ void sub_8128C64(u8 taskId)
switch (data[2]) switch (data[2])
{ {
case 0: case 0:
sub_80E9578(); HideSecretBaseDecorationSprites();
data[2] ++; data[2] ++;
break; break;
case 1: case 1:
@ -2043,7 +2033,7 @@ u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphicsDataBuf
{ {
sub_8129048(data); sub_8129048(data);
data->decoration = &gDecorations[decor]; data->decoration = &gDecorations[decor];
if (data->decoration->permission == DECORPERM_SOLID_MAT) if (data->decoration->permission == DECORPERM_SPRITE)
{ {
return AddPseudoEventObject(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); return AddPseudoEventObject(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1);
} }
@ -2104,7 +2094,7 @@ u8 AddDecorationIconObjectFromEventObject(u16 tilesTag, u16 paletteTag, u8 decor
sub_8129048(&sPlaceDecorationGraphicsDataBuffer); sub_8129048(&sPlaceDecorationGraphicsDataBuffer);
sPlaceDecorationGraphicsDataBuffer.decoration = &gDecorations[decor]; sPlaceDecorationGraphicsDataBuffer.decoration = &gDecorations[decor];
if (sPlaceDecorationGraphicsDataBuffer.decoration->permission != DECORPERM_SOLID_MAT) if (sPlaceDecorationGraphicsDataBuffer.decoration->permission != DECORPERM_SPRITE)
{ {
sub_81291E8(&sPlaceDecorationGraphicsDataBuffer); sub_81291E8(&sPlaceDecorationGraphicsDataBuffer);
SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape); SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape);
@ -2192,7 +2182,7 @@ void sub_8129708(void)
{ {
gSpecialVar_Result = 1; gSpecialVar_Result = 1;
} }
else if (gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx]].permission == DECORPERM_SOLID_MAT) else if (gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx]].permission == DECORPERM_SPRITE)
{ {
gSpecialVar_0x8005 = sDecorRearrangementDataBuffer[gSpecialVar_0x8004].flagId; gSpecialVar_0x8005 = sDecorRearrangementDataBuffer[gSpecialVar_0x8004].flagId;
sub_81296EC(sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx); sub_81296EC(sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx);
@ -2235,7 +2225,7 @@ void sub_81297F8(void)
perm = gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[i].idx]].permission; perm = gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[i].idx]].permission;
posX = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] >> 4; posX = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] >> 4;
posY = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] & 0x0F; posY = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] & 0x0F;
if (perm != DECORPERM_SOLID_MAT) if (perm != DECORPERM_SPRITE)
{ {
for (y = 0; y < sDecorRearrangementDataBuffer[i].height; y ++) for (y = 0; y < sDecorRearrangementDataBuffer[i].height; y ++)
{ {
@ -2522,7 +2512,7 @@ bool8 sub_8129FC8(u8 taskId)
{ {
if (gUnknown_0203A17C.items[i] != 0) if (gUnknown_0203A17C.items[i] != 0)
{ {
if (gDecorations[gUnknown_0203A17C.items[i]].permission == DECORPERM_SOLID_MAT) if (gDecorations[gUnknown_0203A17C.items[i]].permission == DECORPERM_SPRITE)
{ {
sub_8129D8C(gUnknown_0203A17C.items[i], sDecorRearrangementDataBuffer); sub_8129D8C(gUnknown_0203A17C.items[i], sDecorRearrangementDataBuffer);
if (sub_8129E74(taskId, i, sDecorRearrangementDataBuffer) == TRUE) if (sub_8129E74(taskId, i, sDecorRearrangementDataBuffer) == TRUE)
@ -2550,7 +2540,7 @@ void sub_812A040(u8 left, u8 top, u8 right, u8 bottom)
decorIdx = gUnknown_0203A17C.items[i]; decorIdx = gUnknown_0203A17C.items[i];
xOff = gUnknown_0203A17C.pos[i] >> 4; xOff = gUnknown_0203A17C.pos[i] >> 4;
yOff = gUnknown_0203A17C.pos[i] & 0x0F; yOff = gUnknown_0203A17C.pos[i] & 0x0F;
if (decorIdx != 0 && gDecorations[decorIdx].permission == DECORPERM_SOLID_MAT && left <= xOff && top <= yOff && right >= xOff && bottom >= yOff) if (decorIdx != 0 && gDecorations[decorIdx].permission == DECORPERM_SPRITE && left <= xOff && top <= yOff && right >= xOff && bottom >= yOff)
{ {
sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx = i; sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx = i;
sub_8129F20(); sub_8129F20();
@ -2656,7 +2646,7 @@ void sub_812A2C4(u8 taskId)
switch (data[2]) switch (data[2])
{ {
case 0: case 0:
sub_80E9578(); HideSecretBaseDecorationSprites();
data[2] ++; data[2] ++;
break; break;
case 1: case 1:

View File

@ -1534,10 +1534,10 @@ static u8 TrySetupEventObjectSprite(struct EventObjectTemplate *eventObjectTempl
paletteSlot -= 16; paletteSlot -= 16;
sub_808EAB0(graphicsInfo->paletteTag1, paletteSlot); sub_808EAB0(graphicsInfo->paletteTag1, paletteSlot);
} }
if (eventObject->movementType == MOVEMENT_TYPE_INVISIBLE) if (eventObject->movementType == MOVEMENT_TYPE_INVISIBLE)
{
eventObject->invisible = TRUE; eventObject->invisible = TRUE;
}
*(u16 *)&spriteTemplate->paletteTag = 0xFFFF; *(u16 *)&spriteTemplate->paletteTag = 0xFFFF;
spriteId = CreateSprite(spriteTemplate, 0, 0, 0); spriteId = CreateSprite(spriteTemplate, 0, 0, 0);
if (spriteId == MAX_SPRITES) if (spriteId == MAX_SPRITES)
@ -1545,6 +1545,7 @@ static u8 TrySetupEventObjectSprite(struct EventObjectTemplate *eventObjectTempl
gEventObjects[eventObjectId].active = FALSE; gEventObjects[eventObjectId].active = FALSE;
return EVENT_OBJECTS_COUNT; return EVENT_OBJECTS_COUNT;
} }
sprite = &gSprites[spriteId]; sprite = &gSprites[spriteId];
sub_8092FF0(eventObject->currentCoords.x + cameraX, eventObject->currentCoords.y + cameraY, &sprite->pos1.x, &sprite->pos1.y); sub_8092FF0(eventObject->currentCoords.x + cameraX, eventObject->currentCoords.y + cameraY, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1); sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
@ -1557,15 +1558,14 @@ static u8 TrySetupEventObjectSprite(struct EventObjectTemplate *eventObjectTempl
eventObject->spriteId = spriteId; eventObject->spriteId = spriteId;
eventObject->inanimate = graphicsInfo->inanimate; eventObject->inanimate = graphicsInfo->inanimate;
if (!eventObject->inanimate) if (!eventObject->inanimate)
{
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(eventObject->facingDirection)); StartSpriteAnim(sprite, GetFaceDirectionAnimNum(eventObject->facingDirection));
}
SetObjectSubpriorityByZCoord(eventObject->previousElevation, sprite, 1); SetObjectSubpriorityByZCoord(eventObject->previousElevation, sprite, 1);
UpdateEventObjectVisibility(eventObject, sprite); UpdateEventObjectVisibility(eventObject, sprite);
return eventObjectId; return eventObjectId;
} }
static u8 TrySpawnEventObject(struct EventObjectTemplate *eventObjectTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY) static u8 TrySpawnEventObjectTemplate(struct EventObjectTemplate *eventObjectTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
{ {
u8 eventObjectId; u8 eventObjectId;
struct SpriteTemplate spriteTemplate; struct SpriteTemplate spriteTemplate;
@ -1579,14 +1579,12 @@ static u8 TrySpawnEventObject(struct EventObjectTemplate *eventObjectTemplate, u
spriteTemplate.images = &spriteFrameImage; spriteTemplate.images = &spriteFrameImage;
eventObjectId = TrySetupEventObjectSprite(eventObjectTemplate, &spriteTemplate, mapNum, mapGroup, cameraX, cameraY); eventObjectId = TrySetupEventObjectSprite(eventObjectTemplate, &spriteTemplate, mapNum, mapGroup, cameraX, cameraY);
if (eventObjectId == EVENT_OBJECTS_COUNT) if (eventObjectId == EVENT_OBJECTS_COUNT)
{
return EVENT_OBJECTS_COUNT; return EVENT_OBJECTS_COUNT;
}
gSprites[gEventObjects[eventObjectId].spriteId].images = graphicsInfo->images; gSprites[gEventObjects[eventObjectId].spriteId].images = graphicsInfo->images;
if (subspriteTables != NULL) if (subspriteTables)
{
SetSubspriteTables(&gSprites[gEventObjects[eventObjectId].spriteId], subspriteTables); SetSubspriteTables(&gSprites[gEventObjects[eventObjectId].spriteId], subspriteTables);
}
return eventObjectId; return eventObjectId;
} }
@ -1596,7 +1594,7 @@ u8 SpawnSpecialEventObject(struct EventObjectTemplate *eventObjectTemplate)
s16 cameraY; s16 cameraY;
GetEventObjectMovingCameraOffset(&cameraX, &cameraY); GetEventObjectMovingCameraOffset(&cameraX, &cameraY);
return TrySpawnEventObject(eventObjectTemplate, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY); return TrySpawnEventObjectTemplate(eventObjectTemplate, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY);
} }
u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z) u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z)
@ -1619,19 +1617,17 @@ u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 l
return SpawnSpecialEventObject(&eventObjectTemplate); return SpawnSpecialEventObject(&eventObjectTemplate);
} }
u8 show_sprite(u8 localId, u8 mapNum, u8 mapGroup) u8 TrySpawnEventObject(u8 localId, u8 mapNum, u8 mapGroup)
{ {
struct EventObjectTemplate *eventObjectTemplate; struct EventObjectTemplate *eventObjectTemplate;
s16 cameraX; s16 cameraX, cameraY;
s16 cameraY;
eventObjectTemplate = GetEventObjectTemplateByLocalIdAndMap(localId, mapNum, mapGroup); eventObjectTemplate = GetEventObjectTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
if (eventObjectTemplate == NULL) if (!eventObjectTemplate)
{
return EVENT_OBJECTS_COUNT; return EVENT_OBJECTS_COUNT;
}
GetEventObjectMovingCameraOffset(&cameraX, &cameraY); GetEventObjectMovingCameraOffset(&cameraX, &cameraY);
return TrySpawnEventObject(eventObjectTemplate, mapNum, mapGroup, cameraX, cameraY); return TrySpawnEventObjectTemplate(eventObjectTemplate, mapNum, mapGroup, cameraX, cameraY);
} }
static void MakeObjectTemplateFromEventObjectGraphicsInfo(u16 graphicsId, void (*callback)(struct Sprite *), struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables) static void MakeObjectTemplateFromEventObjectGraphicsInfo(u16 graphicsId, void (*callback)(struct Sprite *), struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
@ -1765,7 +1761,7 @@ void TrySpawnEventObjects(s16 cameraX, s16 cameraY)
if (top <= npcY && bottom >= npcY && left <= npcX && right >= npcX if (top <= npcY && bottom >= npcY && left <= npcX && right >= npcX
&& !FlagGet(template->flagId)) && !FlagGet(template->flagId))
TrySpawnEventObject(template, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY); TrySpawnEventObjectTemplate(template, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY);
} }
} }
} }
@ -2245,7 +2241,7 @@ static void SetEventObjectCoords(struct EventObject *eventObject, s16 x, s16 y)
eventObject->currentCoords.y = y; eventObject->currentCoords.y = y;
} }
void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y) void MoveEventObjectToMapCoords(struct EventObject *eventObject, s16 x, s16 y)
{ {
struct Sprite *sprite; struct Sprite *sprite;
const struct EventObjectGraphicsInfo *graphicsInfo; const struct EventObjectGraphicsInfo *graphicsInfo;
@ -2260,20 +2256,17 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y)
sprite->pos1.y += 16 + sprite->centerToCornerVecY; sprite->pos1.y += 16 + sprite->centerToCornerVecY;
sub_808E38C(eventObject); sub_808E38C(eventObject);
if (eventObject->trackedByCamera) if (eventObject->trackedByCamera)
{
CameraObjectReset1(); CameraObjectReset1();
}
} }
void sub_808EBA8(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y) void TryMoveEventObjectToMapCoords(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y)
{ {
u8 eventObjectId; u8 eventObjectId;
if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId)) if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId))
{ {
x += 7; x += 7;
y += 7; y += 7;
sub_808EB08(&gEventObjects[eventObjectId], x, y); MoveEventObjectToMapCoords(&gEventObjects[eventObjectId], x, y);
} }
} }
@ -2604,15 +2597,13 @@ void OverrideTemplateCoordsForEventObject(const struct EventObject *eventObject)
} }
} }
void OverrideMovementTypeForEventObject(const struct EventObject *eventObject, const u8 *script) static void OverrideEventObjectTemplateScript(const struct EventObject *eventObject, const u8 *script)
{ {
struct EventObjectTemplate *eventObjectTemplate; struct EventObjectTemplate *eventObjectTemplate;
eventObjectTemplate = GetBaseTemplateForEventObject(eventObject); eventObjectTemplate = GetBaseTemplateForEventObject(eventObject);
if (eventObjectTemplate != NULL) if (eventObjectTemplate)
{
eventObjectTemplate->script = script; eventObjectTemplate->script = script;
}
} }
void TryOverrideTemplateCoordsForEventObject(const struct EventObject *eventObject, u8 movementType) void TryOverrideTemplateCoordsForEventObject(const struct EventObject *eventObject, u8 movementType)
@ -2626,30 +2617,26 @@ void TryOverrideTemplateCoordsForEventObject(const struct EventObject *eventObje
} }
} }
void sub_808F254(u8 localId, u8 mapNum, u8 mapGroup) void TryOverrideEventObjectTemplateCoords(u8 localId, u8 mapNum, u8 mapGroup)
{ {
u8 eventObjectId; u8 eventObjectId;
if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId)) if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId))
{
OverrideTemplateCoordsForEventObject(&gEventObjects[eventObjectId]); OverrideTemplateCoordsForEventObject(&gEventObjects[eventObjectId]);
}
} }
void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat) void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup, u8 decorationCategory)
{ {
u8 eventObjectId; u8 eventObjectId;
if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId)) if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId))
{ {
switch (decorCat) switch (decorationCategory)
{ {
case DECORCAT_DOLL: case DECORCAT_DOLL:
OverrideMovementTypeForEventObject(&gEventObjects[eventObjectId], EventScript_SecretPower1); OverrideEventObjectTemplateScript(&gEventObjects[eventObjectId], SecretBase_EventScript_DollInteract);
break; break;
case DECORCAT_CUSHION: case DECORCAT_CUSHION:
OverrideMovementTypeForEventObject(&gEventObjects[eventObjectId], EventScript_SecretPower2); OverrideEventObjectTemplateScript(&gEventObjects[eventObjectId], SecretBase_EventScript_CushionInteract);
break; break;
} }
} }
} }

View File

@ -16,6 +16,7 @@
#include "fldeff_misc.h" #include "fldeff_misc.h"
#include "item_menu.h" #include "item_menu.h"
#include "link.h" #include "link.h"
#include "match_call.h"
#include "metatile_behavior.h" #include "metatile_behavior.h"
#include "overworld.h" #include "overworld.h"
#include "pokemon.h" #include "pokemon.h"
@ -32,7 +33,6 @@
#include "constants/map_types.h" #include "constants/map_types.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "match_call.h"
static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0; static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0;
static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0; static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0;
@ -227,8 +227,8 @@ static bool8 TryStartInteractionScript(struct MapPosition *position, u16 metatil
&& script != EventScript_PlayerPCFemale && script != EventScript_PlayerPCFemale
&& script != EventScript_SecretBasePC && script != EventScript_SecretBasePC
&& script != EventScript_RecordMixingSecretBasePC && script != EventScript_RecordMixingSecretBasePC
&& script != EventScript_SecretPower1 && script != SecretBase_EventScript_DollInteract
&& script != EventScript_SecretPower2 && script != SecretBase_EventScript_CushionInteract
&& script != EventScript_PC) && script != EventScript_PC)
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
@ -354,7 +354,7 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
if (direction == DIR_NORTH) if (direction == DIR_NORTH)
{ {
gSpecialVar_0x8004 = bgEvent->bgUnion.secretBaseId; gSpecialVar_0x8004 = bgEvent->bgUnion.secretBaseId;
if (sub_80E9680()) if (TrySetCurSecretBase())
return EventScript_2759F1; return EventScript_2759F1;
} }
return NULL; return NULL;
@ -421,23 +421,23 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me
return EventScript_SecretBaseShieldOrToyTV; return EventScript_SecretBaseShieldOrToyTV;
if (MetatileBehavior_IsMB_C6(metatileBehavior) == TRUE) if (MetatileBehavior_IsMB_C6(metatileBehavior) == TRUE)
{ {
sub_80EB56C(); SetSecretBaseSecretsTvFlags_MiscFurnature();
return NULL; return NULL;
} }
if (MetatileBehavior_IsLargeMatCenter(metatileBehavior) == TRUE) if (MetatileBehavior_HoldsLargeDecoration(metatileBehavior) == TRUE)
{ {
sub_80EB9E0(); SetSecretBaseSecretsTvFlags_LargeDecorationSpot();
return NULL; return NULL;
} }
if (MetatileBehavior_IsSecretBaseLargeMatEdge(metatileBehavior) == TRUE) if (MetatileBehavior_HoldsSmallDecoration(metatileBehavior) == TRUE)
{ {
sub_80EBB28(); SetSecretBaseSecretsTvFlags_SmallDecorationSpot();
return NULL; return NULL;
} }
} }
else if (MetatileBehavior_IsSecretBasePoster(metatileBehavior) == TRUE) else if (MetatileBehavior_IsSecretBasePoster(metatileBehavior) == TRUE)
{ {
sub_80EB498(); SetSecretBaseSecretsTvFlags_Poster();
return NULL; return NULL;
} }

View File

@ -3485,7 +3485,7 @@ static void sub_80B9978(struct Task *task)
eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId];
sprite = &gSprites[eventObject->spriteId]; sprite = &gSprites[eventObject->spriteId];
eventObject->inanimate = 0; eventObject->inanimate = 0;
sub_808EB08(eventObject, eventObject->currentCoords.x, eventObject->currentCoords.y); MoveEventObjectToMapCoords(eventObject, eventObject->currentCoords.x, eventObject->currentCoords.y);
sprite->pos2.x = 0; sprite->pos2.x = 0;
sprite->pos2.y = 0; sprite->pos2.y = 0;
sprite->coordOffsetEnabled = 1; sprite->coordOffsetEnabled = 1;

View File

@ -1188,9 +1188,9 @@ u8 PlayerGetZCoord(void)
return gEventObjects[gPlayerAvatar.eventObjectId].previousElevation; return gEventObjects[gPlayerAvatar.eventObjectId].previousElevation;
} }
void sub_808BC90(s16 a, s16 b) void sub_808BC90(s16 x, s16 y)
{ {
sub_808EB08(&gEventObjects[gPlayerAvatar.eventObjectId], a, b); MoveEventObjectToMapCoords(&gEventObjects[gPlayerAvatar.eventObjectId], x, y);
} }
u8 TestPlayerAvatarFlags(u8 a) u8 TestPlayerAvatarFlags(u8 a)

View File

@ -52,15 +52,15 @@ struct MapHeader const *const mapconnection_get_mapheader(struct MapConnection *
void InitMap(void) void InitMap(void)
{ {
InitMapLayoutData(&gMapHeader); InitMapLayoutData(&gMapHeader);
sub_80E8EE0(gMapHeader.events); SetOccupiedSecretBaseEntranceMetatiles(gMapHeader.events);
RunOnLoadMapScript(); RunOnLoadMapScript();
} }
void InitMapFromSavedGame(void) void InitMapFromSavedGame(void)
{ {
InitMapLayoutData(&gMapHeader); InitMapLayoutData(&gMapHeader);
sub_80E9238(0); InitSecretBaseAppearance(FALSE);
sub_80E8EE0(gMapHeader.events); SetOccupiedSecretBaseEntranceMetatiles(gMapHeader.events);
LoadSavedMapView(); LoadSavedMapView();
RunOnLoadMapScript(); RunOnLoadMapScript();
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height); UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);

View File

@ -488,8 +488,8 @@ static void sub_80F9DFC(u8 taskId)
static void SetCurrentSecretBase(void) static void SetCurrentSecretBase(void)
{ {
sub_80E9608(&gPlayerFacingPosition, gMapHeader.events); SetCurSecretBaseIdFromPosition(&gPlayerFacingPosition, gMapHeader.events);
sub_80E8B6C(); TrySetCurSecretBaseIndex();
} }
static void AdjustSecretPowerSpritePixelOffsets(void) static void AdjustSecretPowerSpritePixelOffsets(void)
@ -544,7 +544,7 @@ bool8 SetUpFieldMove_SecretPower(void)
{ {
u8 mb; u8 mb;
sub_80E8BC8(); CheckPlayerHasSecretBase();
if (gSpecialVar_Result == 1 || GetPlayerFacingDirection() != DIR_NORTH) if (gSpecialVar_Result == 1 || GetPlayerFacingDirection() != DIR_NORTH)
return FALSE; return FALSE;
@ -623,10 +623,8 @@ static void CaveEntranceSpriteCallback2(struct Sprite *sprite)
{ {
if (sprite->data[0] < 40) if (sprite->data[0] < 40)
{ {
sprite->data[0]++; if (++sprite->data[0] == 20)
ToggleSecretBaseEntranceMetatile();
if (sprite->data[0] == 20)
sub_80E8D4C();
} }
else else
{ {
@ -681,7 +679,7 @@ bool8 FldEff_SecretPowerTree(void)
148); 148);
if (gFieldEffectArguments[7] == 1 || gFieldEffectArguments[7] == 3) if (gFieldEffectArguments[7] == 1 || gFieldEffectArguments[7] == 3)
sub_80E8D4C(); ToggleSecretBaseEntranceMetatile();
return FALSE; return FALSE;
} }
@ -702,7 +700,7 @@ static void TreeEntranceSpriteCallback2(struct Sprite *sprite)
if (sprite->data[0] >= 40) if (sprite->data[0] >= 40)
{ {
if (gFieldEffectArguments[7] == 0 || gFieldEffectArguments[7] == 2) if (gFieldEffectArguments[7] == 0 || gFieldEffectArguments[7] == 2)
sub_80E8D4C(); ToggleSecretBaseEntranceMetatile();
sprite->data[0] = 0; sprite->data[0] = 0;
sprite->callback = TreeEntranceSpriteCallbackEnd; sprite->callback = TreeEntranceSpriteCallbackEnd;
@ -764,7 +762,7 @@ static void ShrubEntranceSpriteCallback2(struct Sprite *sprite)
sprite->data[0]++; sprite->data[0]++;
if (sprite->data[0] == 20) if (sprite->data[0] == 20)
sub_80E8D4C(); ToggleSecretBaseEntranceMetatile();
} }
else else
{ {
@ -1168,7 +1166,7 @@ void GetShieldToyTVDecorationInfo(void)
bool8 sub_80FADE4(u16 metatileId, u8 arg1) bool8 sub_80FADE4(u16 metatileId, u8 arg1)
{ {
if (!CurrentMapIsSecretBase()) if (!CurMapIsSecretBase())
return FALSE; return FALSE;
if (!arg1) if (!arg1)

View File

@ -537,7 +537,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count)
if (totalQuantity < count) if (totalQuantity < count)
return FALSE; // We don't have enough of the item return FALSE; // We don't have enough of the item
if (CurrentMapIsSecretBase() == TRUE) if (CurMapIsSecretBase() == TRUE)
{ {
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x200); VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x200);
VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, itemId); VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, itemId);

View File

@ -191,7 +191,7 @@ static const u8 sTileBitAttributes[] =
[MB_SECRET_BASE_UNUSED] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_SECRET_BASE_UNUSED] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BLOCK_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_BLOCK_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_SECRET_BASE_DECORATION] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_SECRET_BASE_DECORATION] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_SECRET_BASE_LARGE_MAT_EDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_HOLDS_SMALL_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_B6] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_UNUSED_B6] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_SECRET_BASE_NORTH_WALL] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_SECRET_BASE_NORTH_WALL] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_SECRET_BASE_BALLOON] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_SECRET_BASE_BALLOON] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
@ -205,7 +205,7 @@ static const u8 sTileBitAttributes[] =
[MB_IMPASSABLE_SOUTH_AND_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_IMPASSABLE_SOUTH_AND_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_IMPASSABLE_WEST_AND_EAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_IMPASSABLE_WEST_AND_EAST] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_SECRET_BASE_HOLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_SECRET_BASE_HOLE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_LARGE_MAT_CENTER] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_HOLDS_LARGE_DECORATION] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_SECRET_BASE_TV_SHIELD] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_SECRET_BASE_TV_SHIELD] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PLAYER_ROOM_PC_ON] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE), [MB_PLAYER_ROOM_PC_ON] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_C6] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE), [MB_C6] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
@ -751,17 +751,17 @@ bool8 Unref_MetatileBehavior_IsSecretBaseUnused_B2_2(u8 metatileBehavior)
return FALSE; return FALSE;
} }
bool8 MetatileBehavior_IsSecretBaseLargeMatEdge(u8 metatileBehavior) bool8 MetatileBehavior_HoldsSmallDecoration(u8 metatileBehavior)
{ {
if (metatileBehavior == MB_SECRET_BASE_LARGE_MAT_EDGE) if (metatileBehavior == MB_HOLDS_SMALL_DECORATION)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
bool8 MetatileBehavior_IsLargeMatCenter(u8 metatileBehavior) bool8 MetatileBehavior_HoldsLargeDecoration(u8 metatileBehavior)
{ {
if (metatileBehavior == MB_LARGE_MAT_CENTER) if (metatileBehavior == MB_HOLDS_LARGE_DECORATION)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;

View File

@ -170,7 +170,7 @@ void NewGameInitData(void)
InitEventData(); InitEventData();
ClearTVShowData(); ClearTVShowData();
ResetGabbyAndTy(); ResetGabbyAndTy();
ResetSecretBases(); ClearSecretBases();
ClearBerryTrees(); ClearBerryTrees();
SetMoney(&gSaveBlock1Ptr->money, 3000); SetMoney(&gSaveBlock1Ptr->money, 3000);
SetCoins(0); SetCoins(0);

View File

@ -889,7 +889,7 @@ static void mli0_load_map(u32 a1)
if (a1 != 1 && isIndoors) if (a1 != 1 && isIndoors)
{ {
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height); UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
sub_80E9238(1); InitSecretBaseAppearance(TRUE);
} }
} }
@ -1508,7 +1508,7 @@ void SetUnusedCallback(void *func)
static bool8 map_post_load_hook_exec(void) static bool8 map_post_load_hook_exec(void)
{ {
if (gFieldCallback2 != NULL) if (gFieldCallback2)
{ {
if (!gFieldCallback2()) if (!gFieldCallback2())
{ {
@ -1522,7 +1522,7 @@ static bool8 map_post_load_hook_exec(void)
} }
else else
{ {
if (gFieldCallback != NULL) if (gFieldCallback)
gFieldCallback(); gFieldCallback();
else else
mapldr_default(); mapldr_default();
@ -1701,7 +1701,7 @@ void sub_80861E8(void)
static void sub_8086204(void) static void sub_8086204(void)
{ {
if ((gMapHeader.flags & 0xF8) == 8 && sub_80E909C() == TRUE) if ((gMapHeader.flags & 0xF8) == 8 && SecretBaseMapPopupEnabled() == TRUE)
ShowMapNamePopup(); ShowMapNamePopup();
sub_80AF3C8(); sub_80AF3C8();
} }
@ -1947,7 +1947,7 @@ static bool32 load_map_stuff(u8 *state, u32 a2)
(*state)++; (*state)++;
break; break;
case 11: case 11:
if ((gMapHeader.flags & 0xF8) == 8 && sub_80E909C() == 1) if ((gMapHeader.flags & 0xF8) == 8 && SecretBaseMapPopupEnabled() == TRUE)
ShowMapNamePopup(); ShowMapNamePopup();
(*state)++; (*state)++;
break; break;

View File

@ -4444,7 +4444,7 @@ u8 GetMonAbility(struct Pokemon *mon)
return GetAbilityBySpecies(species, altAbility); return GetAbilityBySpecies(species, altAbility);
} }
void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord)
{ {
s32 i, j; s32 i, j;

View File

@ -47,7 +47,7 @@ struct RecordMixingHallRecords
struct PlayerRecordsRS struct PlayerRecordsRS
{ {
struct SecretBaseRecord secretBases[SECRET_BASES_COUNT]; struct SecretBase secretBases[SECRET_BASES_COUNT];
TVShow tvShows[TV_SHOWS_COUNT]; TVShow tvShows[TV_SHOWS_COUNT];
PokeNews pokeNews[POKE_NEWS_COUNT]; PokeNews pokeNews[POKE_NEWS_COUNT];
OldMan oldMan; OldMan oldMan;
@ -60,7 +60,7 @@ struct PlayerRecordsRS
struct PlayerRecordsEmerald struct PlayerRecordsEmerald
{ {
/* 0x0000 */ struct SecretBaseRecord secretBases[SECRET_BASES_COUNT]; /* 0x0000 */ struct SecretBase secretBases[SECRET_BASES_COUNT];
/* 0x0c80 */ TVShow tvShows[TV_SHOWS_COUNT]; /* 0x0c80 */ TVShow tvShows[TV_SHOWS_COUNT];
/* 0x1004 */ PokeNews pokeNews[POKE_NEWS_COUNT]; /* 0x1004 */ PokeNews pokeNews[POKE_NEWS_COUNT];
/* 0x1044 */ OldMan oldMan; /* 0x1044 */ OldMan oldMan;
@ -83,7 +83,7 @@ union PlayerRecords
// Static RAM declarations // Static RAM declarations
static IWRAM_DATA bool8 gUnknown_03001130; static IWRAM_DATA bool8 gUnknown_03001130;
static IWRAM_DATA struct SecretBaseRecord *sSecretBasesSave; static IWRAM_DATA struct SecretBase *sSecretBasesSave;
static IWRAM_DATA TVShow *sTvShowsSave; static IWRAM_DATA TVShow *sTvShowsSave;
static IWRAM_DATA PokeNews *sPokeNewsSave; static IWRAM_DATA PokeNews *sPokeNewsSave;
static IWRAM_DATA OldMan *sOldManSave; static IWRAM_DATA OldMan *sOldManSave;
@ -208,7 +208,7 @@ static void PrepareUnknownExchangePacket(struct PlayerRecordsRS *dest)
static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest) static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest)
{ {
memcpy(dest->secretBases, sSecretBasesSave, sizeof(dest->secretBases)); memcpy(dest->secretBases, sSecretBasesSave, sizeof(dest->secretBases));
sub_80EB18C(dest->secretBases); ClearJapaneseSecretBases(dest->secretBases);
memcpy(dest->tvShows, sTvShowsSave, sizeof(dest->tvShows)); memcpy(dest->tvShows, sTvShowsSave, sizeof(dest->tvShows));
sub_80F1208(dest->tvShows); sub_80F1208(dest->tvShows);
memcpy(dest->pokeNews, sPokeNewsSave, sizeof(dest->pokeNews)); memcpy(dest->pokeNews, sPokeNewsSave, sizeof(dest->pokeNews));
@ -226,7 +226,7 @@ static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest)
static void PrepareExchangePacket(void) static void PrepareExchangePacket(void)
{ {
sub_80E9914(); SetPlayerSecretBaseParty();
sub_80F0BB8(); sub_80F0BB8();
SetSrcLookupPointers(); SetSrcLookupPointers();

View File

@ -1068,7 +1068,7 @@ bool8 ScrCmd_addobject(struct ScriptContext *ctx)
{ {
u16 objectId = VarGet(ScriptReadHalfword(ctx)); u16 objectId = VarGet(ScriptReadHalfword(ctx));
show_sprite(objectId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); TrySpawnEventObject(objectId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
return FALSE; return FALSE;
} }
@ -1078,7 +1078,7 @@ bool8 ScrCmd_addobject_at(struct ScriptContext *ctx)
u8 mapGroup = ScriptReadByte(ctx); u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx);
show_sprite(objectId, mapNum, mapGroup); TrySpawnEventObject(objectId, mapNum, mapGroup);
return FALSE; return FALSE;
} }
@ -1088,7 +1088,7 @@ bool8 ScrCmd_setobjectxy(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx)); u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx));
sub_808EBA8(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, x, y); TryMoveEventObjectToMapCoords(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, x, y);
return FALSE; return FALSE;
} }
@ -1106,7 +1106,7 @@ bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext *ctx)
{ {
u16 localId = VarGet(ScriptReadHalfword(ctx)); u16 localId = VarGet(ScriptReadHalfword(ctx));
sub_808F254(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); TryOverrideEventObjectTemplateCoords(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
return FALSE; return FALSE;
} }

File diff suppressed because it is too large Load Diff

View File

@ -529,7 +529,7 @@ const u8 gText_ApostropheSBase[] = _("'s BASE");
const u8 gText_OkayToDeleteFromRegistry[] = _("Is it okay to delete {STR_VAR_1}\nfrom the REGISTRY?"); const u8 gText_OkayToDeleteFromRegistry[] = _("Is it okay to delete {STR_VAR_1}\nfrom the REGISTRY?");
const u8 gText_RegisteredDataDeleted[] = _("The registered data was deleted.{PAUSE_UNTIL_PRESS}"); const u8 gText_RegisteredDataDeleted[] = _("The registered data was deleted.{PAUSE_UNTIL_PRESS}");
const u8 gText_NoRegistry[] = _("There is no REGISTRY.{PAUSE_UNTIL_PRESS}"); const u8 gText_NoRegistry[] = _("There is no REGISTRY.{PAUSE_UNTIL_PRESS}");
const u8 gUnknown_085EA79D[] = _("DEL REGIST."); const u8 gText_DelRegist[] = _("DEL REGIST.");
const u8 gUnknown_085EA7A9[] = _("{STR_VAR_3}{STR_VAR_1}/{STR_VAR_2}"); const u8 gUnknown_085EA7A9[] = _("{STR_VAR_3}{STR_VAR_1}/{STR_VAR_2}");
const u8 gText_Decorate[] = _("DECORATE"); const u8 gText_Decorate[] = _("DECORATE");
const u8 gText_PutAway[] = _("PUT AWAY"); const u8 gText_PutAway[] = _("PUT AWAY");

View File

@ -2567,7 +2567,7 @@ void sub_80EEA70(void)
show->secretBaseSecrets.active = FALSE; show->secretBaseSecrets.active = FALSE;
StringCopy(show->secretBaseSecrets.playerName, gSaveBlock2Ptr->playerName); StringCopy(show->secretBaseSecrets.playerName, gSaveBlock2Ptr->playerName);
show->secretBaseSecrets.stepsInBase = VarGet(VAR_SECRET_BASE_STEP_COUNTER); show->secretBaseSecrets.stepsInBase = VarGet(VAR_SECRET_BASE_STEP_COUNTER);
sub_80E980C(); CopyCurSecretBaseOwnerName_StrVar1();
StringCopy(strbuf, gStringVar1); StringCopy(strbuf, gStringVar1);
StripExtCtrlCodes(strbuf); StripExtCtrlCodes(strbuf);
StringCopy(show->secretBaseSecrets.baseOwnersName, strbuf); StringCopy(show->secretBaseSecrets.baseOwnersName, strbuf);
@ -7366,7 +7366,7 @@ u8 TVShowGetFlagCount(TVShow *show)
return tot; return tot;
} }
u8 TVShowGetStateForFlagNumber(TVShow *show, u8 a1) static u8 SecretBaseSecrets_GetStateForFlagNumber(TVShow *show, u8 a1)
{ {
u8 i; u8 i;
u8 tot; u8 tot;
@ -7409,7 +7409,7 @@ static void DoTVShowSecretBaseSecrets(void)
{ {
show->secretBaseSecrets.savedState = 1; show->secretBaseSecrets.savedState = 1;
sTVSecretBaseSecretsRandomValues[0] = Random() % bitCount; sTVSecretBaseSecretsRandomValues[0] = Random() % bitCount;
sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[0]); sTVShowState = SecretBaseSecrets_GetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[0]);
} }
break; break;
case 1: case 1:
@ -7424,11 +7424,11 @@ static void DoTVShowSecretBaseSecrets(void)
show->secretBaseSecrets.savedState = 2; show->secretBaseSecrets.savedState = 2;
if (sTVSecretBaseSecretsRandomValues[0] == 0) if (sTVSecretBaseSecretsRandomValues[0] == 0)
{ {
sTVShowState = TVShowGetStateForFlagNumber(show, 1); sTVShowState = SecretBaseSecrets_GetStateForFlagNumber(show, 1);
} }
else else
{ {
sTVShowState = TVShowGetStateForFlagNumber(show, 0); sTVShowState = SecretBaseSecrets_GetStateForFlagNumber(show, 0);
} }
break; break;
default: default:
@ -7441,7 +7441,7 @@ static void DoTVShowSecretBaseSecrets(void)
} }
} }
show->secretBaseSecrets.savedState = 2; show->secretBaseSecrets.savedState = 2;
sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[1]); sTVShowState = SecretBaseSecrets_GetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[1]);
break; break;
} }
break; break;
@ -7463,7 +7463,7 @@ static void DoTVShowSecretBaseSecrets(void)
} }
} }
show->secretBaseSecrets.savedState = 3; show->secretBaseSecrets.savedState = 3;
sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[2]); sTVShowState = SecretBaseSecrets_GetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[2]);
} }
break; break;
case 3: case 3:

View File

@ -125,7 +125,7 @@ static void SetUnionRoomPlayerGfx(u32 playerIdx, u32 gfxId)
static void CreateUnionRoomPlayerEventObject(u32 playerIdx) static void CreateUnionRoomPlayerEventObject(u32 playerIdx)
{ {
show_sprite(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); TrySpawnEventObject(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
} }
static void RemoveUnionRoomPlayerEventObject(u32 playerIdx) static void RemoveUnionRoomPlayerEventObject(u32 playerIdx)