Merge branch 'master' into porymap-5

This commit is contained in:
GriffinR
2022-10-27 14:16:25 -04:00
committed by GitHub
100 changed files with 620 additions and 600 deletions
@@ -167,12 +167,12 @@ OneIsland_PokemonCenter_1F_Movement_BillWalkToCelio::
step_end step_end
@ Unused @ Unused
Movement_170E8F:: OneIsland_PokemonCenter_1F_Movement_WalkUp:
walk_up walk_up
step_end step_end
@ Unused @ Unused
Movement_170E91:: OneIsland_PokemonCenter_1F_Movement_StepAsideLeft::
walk_left walk_left
walk_in_place_faster_right walk_in_place_faster_right
step_end step_end
@@ -535,7 +535,7 @@ OneIsland_PokemonCenter_1F_Movement_PlayerWalkToBillBottom::
step_end step_end
@ Unused @ Unused
Movement_17131F:: OneIsland_PokemonCenter_1F_Movement_DelayWalkInPlaceLeft::
delay_16 delay_16
delay_16 delay_16
delay_4 delay_4
@@ -543,7 +543,7 @@ Movement_17131F::
step_end step_end
@ Unused @ Unused
Movement_171324:: OneIsland_PokemonCenter_1F_Movement_WalkInPlaceDown::
walk_in_place_fast_down walk_in_place_fast_down
step_end step_end
@@ -870,7 +870,7 @@ PalletTown_ProfessorOaksLab_Movement_OakExcitedWest::
step_end step_end
@ Unused @ Unused
Movement_1699AC:: PalletTown_ProfessorOaksLab_Movement_Search:
walk_left walk_left
walk_in_place_faster_down walk_in_place_faster_down
delay_8 delay_8
@@ -898,7 +898,7 @@ Movement_1699AC::
step_end step_end
@ Unused @ Unused
Movement_1699C5: PalletTown_ProfessorOaksLab_Movement_VerticalPacing:
walk_up walk_up
walk_down walk_down
walk_down walk_down
+2 -2
View File
@@ -72,7 +72,7 @@ TrainerTower_Lobby_EventScript_Enter::
ttower_getchallengestatus ttower_getchallengestatus
switch VAR_RESULT switch VAR_RESULT
case CHALLENGE_STATUS_LOST, TrainerTower_Lobby_EventScript_LostChallenge case CHALLENGE_STATUS_LOST, TrainerTower_Lobby_EventScript_LostChallenge
case CHALLENGE_STATUS_UNK, TrainerTower_Lobby_EventScript_164938 case CHALLENGE_STATUS_UNK, TrainerTower_Lobby_EventScript_ExitChallengeSpeakToReceptionist
case CHALLENGE_STATUS_NORMAL, TrainerTower_Lobby_EventScript_EnterEnd case CHALLENGE_STATUS_NORMAL, TrainerTower_Lobby_EventScript_EnterEnd
TrainerTower_Lobby_EventScript_LostChallenge:: TrainerTower_Lobby_EventScript_LostChallenge::
@@ -84,7 +84,7 @@ TrainerTower_Lobby_EventScript_LostChallenge::
goto TrainerTower_Lobby_EventScript_ExitChallenge goto TrainerTower_Lobby_EventScript_ExitChallenge
@ Presumably E-Reader related @ Presumably E-Reader related
TrainerTower_Lobby_EventScript_164938:: TrainerTower_Lobby_EventScript_ExitChallengeSpeakToReceptionist::
lock lock
faceplayer faceplayer
applymovement OBJ_EVENT_ID_PLAYER, TrainerTower_Lobby_Movement_FaceReceptionist applymovement OBJ_EVENT_ID_PLAYER, TrainerTower_Lobby_Movement_FaceReceptionist
@@ -52,7 +52,7 @@ TwoIsland_JoyfulGameCorner_EventScript_FoundLostelleScene::
TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene:: TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene::
lockall lockall
textcolor NPC_TEXT_COLOR_MALE textcolor NPC_TEXT_COLOR_MALE
applymovement LOCALID_DADDY, Movement_171520 applymovement LOCALID_DADDY, TwoIsland_JoyfulGameCorner_Movement_DaddyPacing
waitmovement 0 waitmovement 0
msgbox TwoIsland_JoyfulGameCorner_Text_WhereHasLostelleGottenTo msgbox TwoIsland_JoyfulGameCorner_Text_WhereHasLostelleGottenTo
closemessage closemessage
@@ -63,7 +63,7 @@ TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene::
waitmovement 0 waitmovement 0
applymovement LOCALID_DADDY, Common_Movement_Delay48 applymovement LOCALID_DADDY, Common_Movement_Delay48
waitmovement 0 waitmovement 0
applymovement LOCALID_DADDY, Movement_171527 applymovement LOCALID_DADDY, TwoIsland_JoyfulGameCorner_Movement_DaddyApproachPlayer
waitmovement 0 waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFasterRight applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFasterRight
waitmovement 0 waitmovement 0
@@ -71,7 +71,7 @@ TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene::
closemessage closemessage
playse SE_RS_DOOR playse SE_RS_DOOR
waitse waitse
applymovement OBJ_EVENT_ID_PLAYER, Movement_17152C applymovement OBJ_EVENT_ID_PLAYER, TwoIsland_JoyfulGameCorner_Movement_PlayerFaceDaddy
waitmovement 0 waitmovement 0
playbgm MUS_ENCOUNTER_BOY, 0 playbgm MUS_ENCOUNTER_BOY, 0
addobject LOCALID_BIKER addobject LOCALID_BIKER
@@ -96,7 +96,7 @@ TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene::
releaseall releaseall
end end
Movement_171520:: TwoIsland_JoyfulGameCorner_Movement_DaddyPacing::
walk_left walk_left
walk_right walk_right
walk_right walk_right
@@ -105,14 +105,14 @@ Movement_171520::
delay_16 delay_16
step_end step_end
Movement_171527:: TwoIsland_JoyfulGameCorner_Movement_DaddyApproachPlayer::
walk_down walk_down
walk_down walk_down
walk_down walk_down
walk_in_place_faster_left walk_in_place_faster_left
step_end step_end
Movement_17152C:: TwoIsland_JoyfulGameCorner_Movement_PlayerFaceDaddy::
walk_left walk_left
walk_in_place_faster_right walk_in_place_faster_right
step_end step_end
+2 -2
View File
@@ -19,8 +19,8 @@ EventScript_FallDownHole::
waitstate waitstate
end end
@ TODO: EventScript_FallDownHoleMtPyre in pokeemerald, needs generic name @ Differs from the script above by assuming the warp destination has already been set
EventScript_1C1361:: EventScript_DoFallWarp::
lockall lockall
delay 20 delay 20
applymovement OBJ_EVENT_ID_PLAYER, Movement_SetInvisible applymovement OBJ_EVENT_ID_PLAYER, Movement_SetInvisible
Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

Before

Width:  |  Height:  |  Size: 183 B

After

Width:  |  Height:  |  Size: 183 B

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 231 B

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 231 B

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 215 B

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.
+1 -1
View File
@@ -487,7 +487,7 @@ graphics/seagallop/water.4bpp: %.4bpp: %.png
graphics/link/321start.4bpp: %.4bpp: %.png graphics/link/321start.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 4 -mheight 4 $(GFX) $< $@ -mwidth 4 -mheight 4
$(TEXTWINDOWGFXDIR)/unk_8470B0C.4bpp: %.4bpp: %.png $(TEXTWINDOWGFXDIR)/signpost.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 19 $(GFX) $< $@ -num_tiles 19
$(SLOTMACHINEGFXDIR)/unk_8466620.4bpp: %.4bpp: %.png $(SLOTMACHINEGFXDIR)/unk_8466620.4bpp: %.4bpp: %.png
+4 -4
View File
@@ -70,10 +70,10 @@
#define MOVEMENT_TYPE_WALK_IN_PLACE_UP 0x41 #define MOVEMENT_TYPE_WALK_IN_PLACE_UP 0x41
#define MOVEMENT_TYPE_WALK_IN_PLACE_LEFT 0x42 #define MOVEMENT_TYPE_WALK_IN_PLACE_LEFT 0x42
#define MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT 0x43 #define MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT 0x43
#define MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_DOWN 0x44 #define MOVEMENT_TYPE_WALK_IN_PLACE_FAST_DOWN 0x44
#define MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_UP 0x45 #define MOVEMENT_TYPE_WALK_IN_PLACE_FAST_UP 0x45
#define MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_LEFT 0x46 #define MOVEMENT_TYPE_WALK_IN_PLACE_FAST_LEFT 0x46
#define MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_RIGHT 0x47 #define MOVEMENT_TYPE_WALK_IN_PLACE_FAST_RIGHT 0x47
#define MOVEMENT_TYPE_JOG_IN_PLACE_DOWN 0x48 #define MOVEMENT_TYPE_JOG_IN_PLACE_DOWN 0x48
#define MOVEMENT_TYPE_JOG_IN_PLACE_UP 0x49 #define MOVEMENT_TYPE_JOG_IN_PLACE_UP 0x49
#define MOVEMENT_TYPE_JOG_IN_PLACE_LEFT 0x4A #define MOVEMENT_TYPE_JOG_IN_PLACE_LEFT 0x4A
+15 -16
View File
@@ -99,16 +99,16 @@ void TryOverrideObjectEventTemplateCoords(u8, u8, u8);
void UpdateObjectEventCurrentMovement(struct ObjectEvent *, struct Sprite *, bool8(struct ObjectEvent *, struct Sprite *)); void UpdateObjectEventCurrentMovement(struct ObjectEvent *, struct Sprite *, bool8(struct ObjectEvent *, struct Sprite *));
u8 ObjectEventFaceOppositeDirection(struct ObjectEvent *, u8); u8 ObjectEventFaceOppositeDirection(struct ObjectEvent *, u8);
u8 GetOppositeDirection(u8); u8 GetOppositeDirection(u8);
u8 GetWalkInPlaceFastMovementAction(u32); u8 GetWalkInPlaceFasterMovementAction(u32);
u8 GetStepInPlaceDelay8AnimId(u32); u8 GetStepInPlaceDelay8AnimId(u32);
u8 GetWalkInPlaceNormalMovementAction(u32); u8 GetWalkInPlaceNormalMovementAction(u32);
u8 GetWalkInPlaceSlowMovementAction(u32); u8 GetWalkInPlaceSlowMovementAction(u32);
u8 GetStepInPlaceDelay32AnimId(u32); u8 GetWalkInPlaceFastMovementAction(u32);
u8 GetCollisionAtCoords(struct ObjectEvent *, s16, s16, u32); u8 GetCollisionAtCoords(struct ObjectEvent *, s16, s16, u32);
void MoveCoords(u8, s16 *, s16 *); void MoveCoords(u8, s16 *, s16 *);
bool8 ObjectEventIsHeldMovementActive(struct ObjectEvent *); bool8 ObjectEventIsHeldMovementActive(struct ObjectEvent *);
u8 ObjectEventClearHeldMovementIfFinished(struct ObjectEvent *); u8 ObjectEventClearHeldMovementIfFinished(struct ObjectEvent *);
u8 GetObjectEventIdByXYZ(u16 x, u16 y, u8 z); u8 GetObjectEventIdByPosition(u16 x, u16 y, u8 elevation);
void sub_8063E28(struct ObjectEvent *, struct Sprite *); void sub_8063E28(struct ObjectEvent *, struct Sprite *);
bool8 ObjectEventSetHeldMovement(struct ObjectEvent *, u8); bool8 ObjectEventSetHeldMovement(struct ObjectEvent *, u8);
void ShiftStillObjectEventCoords(struct ObjectEvent *); void ShiftStillObjectEventCoords(struct ObjectEvent *);
@@ -123,7 +123,7 @@ bool8 ObjectEventIsMovementOverridden(struct ObjectEvent *objectEvent);
u8 ObjectEventCheckHeldMovementStatus(struct ObjectEvent *objectEvent); u8 ObjectEventCheckHeldMovementStatus(struct ObjectEvent *objectEvent);
u8 GetWalkNormalMovementAction(u32); u8 GetWalkNormalMovementAction(u32);
u8 GetWalkFastMovementAction(u32); u8 GetWalkFastMovementAction(u32);
u8 GetWalkFastestMovementAction(u32); u8 GetWalkFasterMovementAction(u32);
u8 GetWalkSlowerMovementAction(u32 direction); u8 GetWalkSlowerMovementAction(u32 direction);
u8 GetTrainerFacingDirectionMovementType(u8 direction); u8 GetTrainerFacingDirectionMovementType(u8 direction);
u8 GetFaceDirectionMovementAction(u32); u8 GetFaceDirectionMovementAction(u32);
@@ -160,11 +160,9 @@ u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority);
u16 GetObjectPaletteTag(u8 paletteIndex); u16 GetObjectPaletteTag(u8 paletteIndex);
void SetSpritePosToMapCoords(s16 x, s16 y, s16 *x2, s16 *y2); void SetSpritePosToMapCoords(s16 x, s16 y, s16 *x2, s16 *y2);
void UpdateObjectEventSpriteVisibility(struct Sprite *sprite, bool8 invisible); void UpdateObjectEventSpriteVisibility(struct Sprite *sprite, bool8 invisible);
bool8 AreZCoordsCompatible(u8, u8); u8 ElevationToPriority(u8 elevation);
u8 ZCoordToPriority(u8 z); void ObjectEventUpdateElevation(struct ObjectEvent *pObject);
void ObjectEventUpdateZCoord(struct ObjectEvent *pObject); void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *sprite, u8 offset);
void SetObjectSubpriorityByZCoord(u8 z, struct Sprite *sprite, u8 offset);
bool8 IsZCoordMismatchAt(u8, s16, s16);
void MakeObjectTemplateFromObjectEventGraphicsInfo(u16 graphicsId, void (*callback)(struct Sprite *), struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables); void MakeObjectTemplateFromObjectEventGraphicsInfo(u16 graphicsId, void (*callback)(struct Sprite *), struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables);
u8 AddCameraObject(u8 trackedSpriteId); u8 AddCameraObject(u8 trackedSpriteId);
void UpdateObjectEventsForCameraUpdate(s16 x, s16 y); void UpdateObjectEventsForCameraUpdate(s16 x, s16 y);
@@ -195,8 +193,8 @@ extern const struct OamData gObjectEventBaseOam_32x32;
extern const u16 gFieldEffectObjectPic_CutGrass[]; extern const u16 gFieldEffectObjectPic_CutGrass[];
extern const u16 gFieldEffectPal_CutGrass[]; extern const u16 gFieldEffectPal_CutGrass[];
extern const u8 gReflectionEffectPaletteMap[]; extern const u8 gReflectionEffectPaletteMap[];
u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z); u8 GetLedgeJumpDirection(s16 x, s16 y, u8 direction);
u8 sub_8063FDC(u32 direction); u8 GetGlideMovementAction(u32 direction);
u8 GetRideWaterCurrentMovementAction(u32 direction); u8 GetRideWaterCurrentMovementAction(u32 direction);
u8 GetPlayerRunMovementAction(u32 direction); u8 GetPlayerRunMovementAction(u32 direction);
u8 GetPlayerRunSlowMovementAction(u32 direction); u8 GetPlayerRunSlowMovementAction(u32 direction);
@@ -206,12 +204,13 @@ u8 GetAcroWheelieFaceDirectionMovementAction(u32 direction);
u8 GetAcroPopWheelieFaceDirectionMovementAction(u32 direction); u8 GetAcroPopWheelieFaceDirectionMovementAction(u32 direction);
u8 GetAcroEndWheelieFaceDirectionMovementAction(u32 direction); u8 GetAcroEndWheelieFaceDirectionMovementAction(u32 direction);
u8 GetAcroWheelieHopFaceDirectionMovementAction(u32 direction); u8 GetAcroWheelieHopFaceDirectionMovementAction(u32 direction);
u8 GetAcroWheelieHopDirectionMovementAction(u32 direction); u8 GetAcroWheelieHopMovementAction(u32 direction);
u8 GetAcroWheelieJumpDirectionMovementAction(u32 direction); u8 GetAcroPopWheelieMoveMovementAction(u32 direction);
u8 GetAcroWheelieJumpMovementAction(u32 direction);
u8 GetJumpInPlaceTurnAroundMovementAction(u32 direction); u8 GetJumpInPlaceTurnAroundMovementAction(u32 direction);
u8 GetAcroWheelieInPlaceDirectionMovementAction(u32 direction); u8 GetAcroWheelieInPlaceMovementAction(u32 direction);
u8 GetAcroPopWheelieMoveDirectionMovementAction(u32 direction); u8 GetAcroPopWheelieMoveMovementAction(u32 direction);
u8 GetAcroWheelieMoveDirectionMovementAction(u32 direction); u8 GetAcroWheelieMoveMovementAction(u32 direction);
u8 GetJumpSpecialWithEffectMovementAction(u32 direction); u8 GetJumpSpecialWithEffectMovementAction(u32 direction);
u8 GetFishingBiteDirectionAnimNum(u8 direction); u8 GetFishingBiteDirectionAnimNum(u8 direction);
void TrySpawnObjectEvents(s16 cameraX, s16 cameraY); void TrySpawnObjectEvents(s16 cameraX, s16 cameraY);
+1 -1
View File
@@ -1257,7 +1257,7 @@ extern const u8 EventScript_CantUseWaterfall[];
extern const u8 EventScript_VsSeekerChargingDone[]; extern const u8 EventScript_VsSeekerChargingDone[];
extern const u8 EventScript_FieldPoison[]; extern const u8 EventScript_FieldPoison[];
extern const u8 EventScript_EggHatch[]; extern const u8 EventScript_EggHatch[];
extern const u8 EventScript_1C1361[]; extern const u8 EventScript_DoFallWarp[];
// overworld // overworld
+7 -7
View File
@@ -26,7 +26,7 @@ void SetPlayerAvatarTransitionFlags(u16 flags);
bool8 IsPlayerFacingSurfableFishableWater(void); bool8 IsPlayerFacingSurfableFishableWater(void);
void StartFishing(u8 secondaryId); void StartFishing(u8 secondaryId);
u8 GetPlayerAvatarObjectId(void); u8 GetPlayerAvatarObjectId(void);
u8 PlayerGetZCoord(void); u8 PlayerGetElevation(void);
u8 GetPlayerAvatarGraphicsIdByCurrentState(void); u8 GetPlayerAvatarGraphicsIdByCurrentState(void);
void StartPlayerAvatarSummonMonForFieldMoveAnim(void); void StartPlayerAvatarSummonMonForFieldMoveAnim(void);
void SetPlayerInvisibility(bool8); void SetPlayerInvisibility(bool8);
@@ -41,13 +41,13 @@ void StartPlayerAvatarVsSeekerAnim(void);
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender); u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender);
u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender); u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender);
u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior); u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior);
void PlayerGoSlowest(u8 direction); void PlayerWalkSlower(u8 direction);
void PlayerGoSlow(u8 direction); void PlayerWalkSlow(u8 direction);
void PlayerGoSpeed1(u8 direction); void PlayerWalkNormal(u8 direction);
void PlayerGoSpeed2(u8 direction); void PlayerWalkFast(u8 direction);
void sub_805C134(u8 direction); void PlayerGlide(u8 direction);
void PlayerRideWaterCurrent(u8 direction); void PlayerRideWaterCurrent(u8 direction);
void PlayerGoSpeed4(u8 direction); void PlayerWalkFaster(u8 direction);
void PlayerRun(u8 direction); void PlayerRun(u8 direction);
void PlayerRunSlow(u8 direction); void PlayerRunSlow(u8 direction);
void PlayerOnBikeCollide(u8 direction); void PlayerOnBikeCollide(u8 direction);
+1 -1
View File
@@ -814,7 +814,7 @@ struct MapPosition
{ {
s16 x; s16 x;
s16 y; s16 y;
s8 height; s8 elevation;
}; };
extern struct SaveBlock1* gSaveBlock1Ptr; extern struct SaveBlock1* gSaveBlock1Ptr;
+1 -1
View File
@@ -2875,7 +2875,7 @@ extern const u32 gTMCase_TMSpriteGfx[];
extern const u32 gUnknown_8E84F20[]; extern const u32 gUnknown_8E84F20[];
extern const u32 gUnknown_8E85068[]; extern const u32 gUnknown_8E85068[];
extern const u8 gUnknown_8E99118[]; extern const u8 gUnknown_8E99118[];
extern const u16 gTMCaseMainWindowPalette[]; extern const u16 gStandardMenuPalette[];
// egg_hatch // egg_hatch
extern const u32 gBattleTextboxTiles[]; extern const u32 gBattleTextboxTiles[];
+2
View File
@@ -1,6 +1,8 @@
#ifndef GUARD_HELP_MESSAGE_H #ifndef GUARD_HELP_MESSAGE_H
#define GUARD_HELP_MESSAGE_H #define GUARD_HELP_MESSAGE_H
extern const u8 gHelpMessageWindow_Gfx[];
void DestroyHelpMessageWindow(u8 a0); void DestroyHelpMessageWindow(u8 a0);
u8 CreateHelpMessageWindow(void); u8 CreateHelpMessageWindow(void);
void PrintTextOnHelpMessageWindow(const u8 * text, u8 mode); void PrintTextOnHelpMessageWindow(const u8 * text, u8 mode);
+3 -1
View File
@@ -5,6 +5,8 @@
#include "text.h" #include "text.h"
#include "task.h" #include "task.h"
extern const u16 gMenuMessageWindow_Gfx[];
void ClearScheduledBgCopiesToVram(void); void ClearScheduledBgCopiesToVram(void);
void ScheduleBgCopyTilemapToVram(u8 bgId); void ScheduleBgCopyTilemapToVram(u8 bgId);
void DoScheduledBgTilemapCopiesToVram(void); void DoScheduledBgTilemapCopiesToVram(void);
@@ -46,7 +48,7 @@ void RemoveStartMenuWindow(void);
u16 GetStdWindowBaseTileNum(void); u16 GetStdWindowBaseTileNum(void);
void DrawHelpMessageWindowWithText(const u8 * text); void DrawHelpMessageWindowWithText(const u8 * text);
void DestroyHelpMessageWindow_(void); void DestroyHelpMessageWindow_(void);
void LoadSignPostWindowFrameGfx(void); void LoadSignpostWindowFrameGfx(void);
void SetDefaultFontsPointer(void); void SetDefaultFontsPointer(void);
#endif // GUARD_NEW_MENU_HELPERS_H #endif // GUARD_NEW_MENU_HELPERS_H
-1
View File
@@ -30,7 +30,6 @@ struct UnkStruct_203B044
extern u8 gQuestLogState; extern u8 gQuestLogState;
extern u8 gQuestLogPlaybackState; extern u8 gQuestLogPlaybackState;
extern const u8 gUnknown_84566A8[];
extern struct FieldInput gQuestLogFieldInput; extern struct FieldInput gQuestLogFieldInput;
extern struct UnkStruct_203B044 gUnknown_203B044; extern struct UnkStruct_203B044 gUnknown_203B044;
extern u16 *gUnknown_203AE04; extern u16 *gUnknown_203AE04;
+4 -4
View File
@@ -62,12 +62,12 @@ void ClearMsgBoxCancelableState(void);
void SetQuestLogInputIsDpadFlag(void); void SetQuestLogInputIsDpadFlag(void);
void ClearQuestLogInput(void); void ClearQuestLogInput(void);
void ClearQuestLogInputIsDpadFlag(void); void ClearQuestLogInputIsDpadFlag(void);
void MsgSetSignPost(void); void MsgSetSignpost(void);
void MsgSetNotSignPost(void); void MsgSetNotSignpost(void);
bool8 IsMsgSignPost(void); bool8 IsMsgSignpost(void);
bool8 IsQuestLogInputDpad(void); bool8 IsQuestLogInputDpad(void);
u8 GetRegisteredQuestLogInput(void); u8 GetRegisteredQuestLogInput(void);
void ResetFacingNpcOrSignPostVars(void); void ResetFacingNpcOrSignpostVars(void);
bool8 CanWalkAwayToCancelMsgBox(void); bool8 CanWalkAwayToCancelMsgBox(void);
void SetWalkingIntoSignVars(void); void SetWalkingIntoSignVars(void);
bool8 IsMsgBoxWalkawayDisabled(void); bool8 IsMsgBoxWalkawayDisabled(void);
+10 -10
View File
@@ -10,18 +10,18 @@ struct TilesPal
}; };
void rbox_fill_rectangle(u8 windowId); void rbox_fill_rectangle(u8 windowId);
const u16 *stdpal_get(u8 id); const u16 *GetTextWindowPalette(u8 id);
const u16 *GetOverworldTextboxPalettePtr(void); const u16 *GetOverworldTextboxPalettePtr(void);
void TextWindow_LoadResourcesStdFrame0(u8 windowId, u16 tileStart, u8 palette); void LoadMenuMessageWindowGfx(u8 windowId, u16 tileStart, u8 palette);
void TextWindow_SetStdFrame0_WithPal(u8 windowId, u16 tileStart, u8 palette); void LoadStdWindowGfx(u8 windowId, u16 tileStart, u8 palette);
void TextWindow_SetUserSelectedFrame(u8 windowId, u16 tileStart, u8 palette); void LoadUserWindowGfx(u8 windowId, u16 tileStart, u8 palette);
void LoadUserWindowBorderGfx(u8 windowId, u16 tileStart, u8 palette); void LoadUserWindowGfx2(u8 windowId, u16 tileStart, u8 palette);
void DrawWindowBorderWithStdpal3(u8 bgId, u16 tileStart, u8 palette); void LoadStdWindowGfxOnBg(u8 bgId, u16 tileStart, u8 palette);
void DrawTextBorderOuter(u8 windowId, u16 tileStart, u8 palette); void DrawTextBorderOuter(u8 windowId, u16 tileStart, u8 palette);
void DrawTextBorderInner(u8 windowId, u16 tileNum, u8 palNum); void DrawTextBorderInner(u8 windowId, u16 tileNum, u8 palNum);
void TextWindow_LoadTilesStdFrame1(u8 windowId, u16 destOffset); void LoadHelpMessageWindowGfx(u8 windowId, u16 destOffset, u8 palIdx);
void sub_814FE6C(u8 windowId, u16 destOffset, u8 palIdx); void LoadSignpostWindowGfx(u8 windowId, u16 destOffset, u8 palIdx);
void sub_814FEEC(u8 windowId, u16 destOffset, u8 palIdx); void LoadStdWindowTiles(u8 windowId, u16 destOffset);
void sub_814FF6C(u8 windowId, u16 destOffset); void LoadQuestLogWindowTiles(u8 windowId, u16 destOffset);
#endif // GUARD_TEXT_WINDOW_H #endif // GUARD_TEXT_WINDOW_H
+5 -5
View File
@@ -7,13 +7,13 @@ struct TextWindowGraphics
const void *palette; const void *palette;
}; };
extern const u16 gUnknown_8470B0C[]; extern const u16 gSignpostWindow_Gfx[];
extern const u16 gStdFrame0[]; extern const u16 gStdTextWindow_Gfx[];
extern const u16 gStdFrame1[]; extern const u16 gQuestLogWindow_Gfx[];
extern const u16 gUnknown_8471DEC[][16]; extern const u16 gTextWindowPalettes[][16];
extern const struct TextWindowGraphics gUserFrames[]; extern const struct TextWindowGraphics gUserFrames[];
const struct TextWindowGraphics *GetWindowFrameTilesPal(u8 idx); const struct TextWindowGraphics *GetUserWindowGraphics(u8 idx);
#endif //GUARD_TEXT_WINDOW_GRAPHICS_H #endif //GUARD_TEXT_WINDOW_GRAPHICS_H
+3 -3
View File
@@ -202,9 +202,9 @@ void InitBagWindows(void)
else else
InitWindows(sDefaultBagWindowsDeposit); InitWindows(sDefaultBagWindowsDeposit);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
TextWindow_SetUserSelectedFrame(0, 0x64, 0xE0); LoadUserWindowGfx(0, 0x64, 0xE0);
TextWindow_LoadResourcesStdFrame0(0, 0x6D, 0xD0); LoadMenuMessageWindowGfx(0, 0x6D, 0xD0);
TextWindow_SetStdFrame0_WithPal(0, 0x81, 0xC0); LoadStdWindowGfx(0, 0x81, 0xC0);
LoadPalette(sBagWindowPalF, 0xF0, 0x20); LoadPalette(sBagWindowPalF, 0xF0, 0x20);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
+3 -3
View File
@@ -665,8 +665,8 @@ void InitBattleBgsVideo(void)
void LoadBattleMenuWindowGfx(void) void LoadBattleMenuWindowGfx(void)
{ {
TextWindow_SetUserSelectedFrame(2, 0x012, 0x10); LoadUserWindowGfx(2, 0x012, 0x10);
TextWindow_SetUserSelectedFrame(2, 0x022, 0x10); LoadUserWindowGfx(2, 0x022, 0x10);
gPlttBufferUnfaded[0x5C] = RGB( 9, 9, 9); gPlttBufferUnfaded[0x5C] = RGB( 9, 9, 9);
gPlttBufferUnfaded[0x5D] = RGB( 9, 9, 9); gPlttBufferUnfaded[0x5D] = RGB( 9, 9, 9);
gPlttBufferUnfaded[0x5E] = RGB(31, 31, 31); gPlttBufferUnfaded[0x5E] = RGB(31, 31, 31);
@@ -675,7 +675,7 @@ void LoadBattleMenuWindowGfx(void)
if (gBattleTypeFlags & (BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_POKEDUDE)) if (gBattleTypeFlags & (BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_POKEDUDE))
{ {
Menu_LoadStdPalAt(0x70); Menu_LoadStdPalAt(0x70);
TextWindow_LoadResourcesStdFrame0(0, 0x030, 0x70); LoadMenuMessageWindowGfx(0, 0x030, 0x70);
gPlttBufferUnfaded[0x76] = RGB( 0, 0, 0); gPlttBufferUnfaded[0x76] = RGB( 0, 0, 0);
CpuCopy16(&gPlttBufferUnfaded[0x76], &gPlttBufferFaded[0x76], 2); CpuCopy16(&gPlttBufferUnfaded[0x76], &gPlttBufferFaded[0x76], 2);
} }
+1 -1
View File
@@ -109,7 +109,7 @@ static void MainCB2_SetUp(void)
break; break;
case 3: case 3:
LoadFrameGfxOnBg(3); LoadFrameGfxOnBg(3);
LoadPalette(stdpal_get(0), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
gMain.state++; gMain.state++;
break; break;
case 4: case 4:
+2 -2
View File
@@ -3046,7 +3046,7 @@ static bool32 OpenResultsWindow(struct BerryCrushGame * game, struct BerryCrushG
FillWindowPixelBuffer(spriteManager->resultsWindowId, PIXEL_FILL(0)); FillWindowPixelBuffer(spriteManager->resultsWindowId, PIXEL_FILL(0));
break; break;
case 2: case 2:
TextWindow_SetStdFrame0_WithPal(spriteManager->resultsWindowId, 0x21D, 0xD0); LoadStdWindowGfx(spriteManager->resultsWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(spriteManager->resultsWindowId, FALSE, 541, 13); DrawStdFrameWithCustomTileAndPalette(spriteManager->resultsWindowId, FALSE, 541, 13);
break; break;
case 3: case 3:
@@ -3105,7 +3105,7 @@ static void Task_ShowBerryCrushRankings(u8 taskId)
tWindowId = AddWindow(&sWindowTemplate_BerryCrushRankings); tWindowId = AddWindow(&sWindowTemplate_BerryCrushRankings);
PutWindowTilemap(tWindowId); PutWindowTilemap(tWindowId);
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(0)); FillWindowPixelBuffer(tWindowId, PIXEL_FILL(0));
TextWindow_SetStdFrame0_WithPal(tWindowId, 0x21D, 0xD0); LoadStdWindowGfx(tWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(tWindowId, 0, 0x21D, 0xD); DrawStdFrameWithCustomTileAndPalette(tWindowId, 0, 0x21D, 0xD);
break; break;
case 1: case 1:
+4 -4
View File
@@ -1411,10 +1411,10 @@ static void BerryPouchInitWindows(void)
u8 i; u8 i;
InitWindows(sWindowTemplates_Main); InitWindows(sWindowTemplates_Main);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
TextWindow_SetUserSelectedFrame(0, 0x001, 0xE0); LoadUserWindowGfx(0, 0x001, 0xE0);
TextWindow_LoadResourcesStdFrame0(0, 0x013, 0xD0); LoadMenuMessageWindowGfx(0, 0x013, 0xD0);
TextWindow_SetStdFrame0_WithPal(0, 0x00A, 0xC0); LoadStdWindowGfx(0, 0x00A, 0xC0);
LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x20); LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0)); FillWindowPixelBuffer(i, PIXEL_FILL(0));
PutWindowTilemap(0); PutWindowTilemap(0);
+1 -1
View File
@@ -119,7 +119,7 @@ void DisplayBerryPowderVendorMenu(void)
sBerryPowderVendorWindowId = AddWindow(&template); sBerryPowderVendorWindowId = AddWindow(&template);
FillWindowPixelBuffer(sBerryPowderVendorWindowId, 0); FillWindowPixelBuffer(sBerryPowderVendorWindowId, 0);
PutWindowTilemap(sBerryPowderVendorWindowId); PutWindowTilemap(sBerryPowderVendorWindowId);
TextWindow_SetStdFrame0_WithPal(sBerryPowderVendorWindowId, 0x21D, 0xD0); LoadStdWindowGfx(sBerryPowderVendorWindowId, 0x21D, 0xD0);
DrawPlayerPowderAmount(sBerryPowderVendorWindowId, 0x21D, 0xD, GetBerryPowder()); DrawPlayerPowderAmount(sBerryPowderVendorWindowId, 0x21D, 0xD, GetBerryPowder());
} }
} }
+5 -5
View File
@@ -187,9 +187,9 @@ static void BikeTransition_MoveDirection(u8 direction)
{ {
if (collision == COLLISION_COUNT) if (collision == COLLISION_COUNT)
PlayerGoSpeed2(direction); PlayerWalkFast(direction);
else if (PlayerIsMovingOnRockStairs(direction)) else if (PlayerIsMovingOnRockStairs(direction))
PlayerGoSpeed2(direction); PlayerWalkFast(direction);
else else
PlayerRideWaterCurrent(direction); PlayerRideWaterCurrent(direction);
} }
@@ -201,7 +201,7 @@ static void BikeTransition_Downhill(u8 v)
u8 collision = GetBikeCollision(DIR_SOUTH); u8 collision = GetBikeCollision(DIR_SOUTH);
if (collision == COLLISION_NONE) if (collision == COLLISION_NONE)
PlayerGoSpeed4(DIR_SOUTH); PlayerWalkFaster(DIR_SOUTH);
else if (collision == COLLISION_LEDGE_JUMP) else if (collision == COLLISION_LEDGE_JUMP)
PlayerJumpLedge(DIR_SOUTH); PlayerJumpLedge(DIR_SOUTH);
} }
@@ -209,7 +209,7 @@ static void BikeTransition_Downhill(u8 v)
static void BikeTransition_Uphill(u8 direction) static void BikeTransition_Uphill(u8 direction)
{ {
if (GetBikeCollision(direction) == COLLISION_NONE) if (GetBikeCollision(direction) == COLLISION_NONE)
PlayerGoSpeed1(direction); PlayerWalkNormal(direction);
} }
static u8 GetBikeCollision(u8 direction) static u8 GetBikeCollision(u8 direction)
@@ -266,7 +266,7 @@ static bool8 MetatileBehaviorForbidsBiking(u8 metatileBehavior)
return TRUE; return TRUE;
if (!MetatileBehavior_IsFortreeBridge(metatileBehavior)) if (!MetatileBehavior_IsFortreeBridge(metatileBehavior))
return FALSE; return FALSE;
if (PlayerGetZCoord() & 1) if (PlayerGetElevation() & 1)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
+3 -3
View File
@@ -162,9 +162,9 @@ void BuyMenuInitWindows(bool32 isSellingTM)
else else
InitWindows(sShopBuyMenuWindowTemplatesTM); InitWindows(sShopBuyMenuWindowTemplatesTM);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
TextWindow_SetUserSelectedFrame(0, 0x1, 0xD0); LoadUserWindowGfx(0, 0x1, 0xD0);
TextWindow_LoadResourcesStdFrame0(0, 0x13, 0xE0); LoadMenuMessageWindowGfx(0, 0x13, 0xE0);
TextWindow_SetStdFrame0_WithPal(0, 0xA, 0xF0); LoadStdWindowGfx(0, 0xA, 0xF0);
PutWindowTilemap(0); PutWindowTilemap(0);
PutWindowTilemap(4); PutWindowTilemap(4);
PutWindowTilemap(5); PutWindowTilemap(5);
+2 -2
View File
@@ -101,8 +101,8 @@ static void Task_DrawClearSaveDataScreen(u8 taskId)
SaveClearScreen_GpuInit(); SaveClearScreen_GpuInit();
break; break;
case 3: case 3:
TextWindow_SetStdFrame0_WithPal(0, 0x001, 0xF0); LoadStdWindowGfx(0, 0x001, 0xF0);
TextWindow_SetStdFrame0_WithPal(1, 0x001, 0xF0); LoadStdWindowGfx(1, 0x001, 0xF0);
break; break;
case 4: case 4:
DrawStdFrameWithCustomTileAndPalette(1, TRUE, 0x001, 0xF); DrawStdFrameWithCustomTileAndPalette(1, TRUE, 0x001, 0xF);
+1 -1
View File
@@ -83,7 +83,7 @@ void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y)
sCoinsWindowId = AddWindow(&template); sCoinsWindowId = AddWindow(&template);
FillWindowPixelBuffer(sCoinsWindowId, 0); FillWindowPixelBuffer(sCoinsWindowId, 0);
PutWindowTilemap(sCoinsWindowId); PutWindowTilemap(sCoinsWindowId);
TextWindow_SetStdFrame0_WithPal(sCoinsWindowId, 0x21D, 0xD0); LoadStdWindowGfx(sCoinsWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(sCoinsWindowId, FALSE, 0x21D, 0xD); DrawStdFrameWithCustomTileAndPalette(sCoinsWindowId, FALSE, 0x21D, 0xD);
AddTextPrinterParameterized(sCoinsWindowId, FONT_2, gText_Coins_2, 0, 0, 0xFF, 0); AddTextPrinterParameterized(sCoinsWindowId, FONT_2, gText_Coins_2, 0, 0, 0xFF, 0);
PrintCoinsString(coinAmount); PrintCoinsString(coinAmount);
@@ -134,7 +134,7 @@ static bool8 MovementType_CopyPlayer_Step2(struct ObjectEvent *objectEvent, stru
static bool8 MovementType_Buried_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_Buried_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite);
static bool8 MovementType_WalkInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_WalkInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite);
static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite);
static bool8 MovementType_WalkSlowlyInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_WalkInPlaceFast_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite);
static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite);
static bool8 MovementType_JogInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_JogInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite);
static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite);
@@ -580,8 +580,8 @@ u8 (*const gMovementTypeFuncs_WalkInPlace[])(struct ObjectEvent *, struct Sprite
MovementType_MoveInPlace_Step1, MovementType_MoveInPlace_Step1,
}; };
u8 (*const gMovementTypeFuncs_WalkSlowlyInPlace[])(struct ObjectEvent *, struct Sprite *) = { u8 (*const gMovementTypeFuncs_WalkInPlaceFast[])(struct ObjectEvent *, struct Sprite *) = {
MovementType_WalkSlowlyInPlace_Step0, MovementType_WalkInPlaceFast_Step0,
MovementType_MoveInPlace_Step1, MovementType_MoveInPlace_Step1,
}; };
+1 -1
View File
@@ -1956,7 +1956,7 @@ static void CB2_EggHatch_1(void)
case 9: case 9:
if (!IsTextPrinterActive(sEggHatchData->windowId)) if (!IsTextPrinterActive(sEggHatchData->windowId))
{ {
LoadUserWindowBorderGfx(sEggHatchData->windowId, 0x140, 0xE0); LoadUserWindowGfx2(sEggHatchData->windowId, 0x140, 0xE0);
CreateYesNoMenu(&sYesNoWinTemplate, FONT_3, 0, 2, 0x140, 0xE, 0); CreateYesNoMenu(&sYesNoWinTemplate, FONT_3, 0, 2, 0x140, 0xE, 0);
sEggHatchData->CB2_state++; sEggHatchData->CB2_state++;
} }
+7 -7
View File
@@ -3002,7 +3002,7 @@ static void PrintRecordsText(u8 windowId)
recordNums[1] = gSaveBlock2Ptr->berryPick.bestScore; recordNums[1] = gSaveBlock2Ptr->berryPick.bestScore;
recordNums[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; recordNums[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow;
TextWindow_SetStdFrame0_WithPal(windowId, 0x21D, 0xD0); LoadStdWindowGfx(windowId, 0x21D, 0xD0);
DrawTextBorderOuter(windowId, 0x21D, 0xD); DrawTextBorderOuter(windowId, 0x21D, 0xD);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized(windowId, FONT_2, sRecordsTexts[0], 1, 1, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(windowId, FONT_2, sRecordsTexts[0], 1, 1, TEXT_SKIP_DRAW, NULL);
@@ -4160,13 +4160,13 @@ static void ResetBerryAndStatusBarSprites(void)
static void LoadWindowFrameGfx(u8 frameId) static void LoadWindowFrameGfx(u8 frameId)
{ {
LoadBgTiles(BG_INTERFACE, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); LoadBgTiles(BG_INTERFACE, GetUserWindowGraphics(frameId)->tiles, 0x120, 1);
LoadPalette(GetWindowFrameTilesPal(frameId)->palette, 0xA0, 0x20); LoadPalette(GetUserWindowGraphics(frameId)->palette, 0xA0, 0x20);
} }
static void LoadUserWindowFrameGfx(void) static void DBP_LoadStdWindowGfx(void)
{ {
TextWindow_SetStdFrame0_WithPal(0, 0xA, 0xB0); LoadStdWindowGfx(0, 0xA, 0xB0);
} }
static void ResetGfxState(void) static void ResetGfxState(void)
@@ -4341,7 +4341,7 @@ static void LoadGfx(void)
break; break;
case 4: case 4:
LoadWindowFrameGfx(gSaveBlock2Ptr->optionsWindowFrameType); LoadWindowFrameGfx(gSaveBlock2Ptr->optionsWindowFrameType);
LoadUserWindowFrameGfx(); DBP_LoadStdWindowGfx();
sGfx->state++; sGfx->state++;
break; break;
default: default:
@@ -4942,7 +4942,7 @@ static bool32 LoadBgGfx(void)
return FALSE; return FALSE;
break; break;
case 5: case 5:
LoadPalette(stdpal_get(3), 0xD0, 0x20); LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
break; break;
default: default:
sGfx->loadState = 0; sGfx->loadState = 0;
+1 -1
View File
@@ -1347,7 +1347,7 @@ static void EC_AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *st
static void PrintECInstructionsText(void) static void PrintECInstructionsText(void)
{ {
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
TextWindow_SetUserSelectedFrame(1, 1, 0xE0); LoadUserWindowGfx(1, 1, 0xE0);
DrawTextBorderOuter(1, 1, 14); DrawTextBorderOuter(1, 1, 14);
PrintECInterfaceTextById(0); PrintECInterfaceTextById(0);
PutWindowTilemap(1); PutWindowTilemap(1);
+157 -163
View File
@@ -49,7 +49,7 @@ static void GetGroundEffectFlags_Seaweed(struct ObjectEvent *, u32 *);
static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent *, u32 *); static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent *, u32 *);
static u8 ObjectEventCheckForReflectiveSurface(struct ObjectEvent *); static u8 ObjectEventCheckForReflectiveSurface(struct ObjectEvent *);
static u8 GetReflectionTypeByMetatileBehavior(u32); static u8 GetReflectionTypeByMetatileBehavior(u32);
static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z); static void InitObjectPriorityByElevation(struct Sprite *sprite, u8 elevation);
static void ObjectEventUpdateSubpriority(struct ObjectEvent *, struct Sprite *); static void ObjectEventUpdateSubpriority(struct ObjectEvent *, struct Sprite *);
static void DoTracksGroundEffect_None(struct ObjectEvent *, struct Sprite *, u8); static void DoTracksGroundEffect_None(struct ObjectEvent *, struct Sprite *, u8);
static void DoTracksGroundEffect_Footprints(struct ObjectEvent *, struct Sprite *, u8); static void DoTracksGroundEffect_Footprints(struct ObjectEvent *, struct Sprite *, u8);
@@ -76,7 +76,9 @@ static void SetPlayerAvatarObjectEventIdAndObjectId(u8, u8);
static void ResetObjectEventFldEffData(struct ObjectEvent *); static void ResetObjectEventFldEffData(struct ObjectEvent *);
static u8 TryLoadObjectPalette(const struct SpritePalette *spritePalette); static u8 TryLoadObjectPalette(const struct SpritePalette *spritePalette);
static u8 FindObjectEventPaletteIndexByTag(u16); static u8 FindObjectEventPaletteIndexByTag(u16);
static bool8 ObjectEventDoesZCoordMatch(struct ObjectEvent *, u8); static bool8 ObjectEventDoesElevationMatch(struct ObjectEvent *, u8);
static bool8 IsElevationMismatchAt(u8 elevation, s16 x, s16 y);
static bool8 AreElevationsCompatible(u8 a, u8 b);
static void ObjectCB_CameraObject(struct Sprite *); static void ObjectCB_CameraObject(struct Sprite *);
static void CameraObject_0(struct Sprite *); static void CameraObject_0(struct Sprite *);
static void CameraObject_1(struct Sprite *); static void CameraObject_1(struct Sprite *);
@@ -144,7 +146,7 @@ static void MovementType_MountainDisguise(struct Sprite *);
static void MovementType_CopyPlayerInGrass(struct Sprite *); static void MovementType_CopyPlayerInGrass(struct Sprite *);
static void MovementType_Buried(struct Sprite *); static void MovementType_Buried(struct Sprite *);
static void MovementType_WalkInPlace(struct Sprite *); static void MovementType_WalkInPlace(struct Sprite *);
static void MovementType_WalkSlowlyInPlace(struct Sprite *); static void MovementType_WalkInPlaceFast(struct Sprite *);
static void MovementType_JogInPlace(struct Sprite *); static void MovementType_JogInPlace(struct Sprite *);
static void MovementType_Invisible(struct Sprite *); static void MovementType_Invisible(struct Sprite *);
static void MovementType_RaiseHandAndStop(struct Sprite *); static void MovementType_RaiseHandAndStop(struct Sprite *);
@@ -280,10 +282,10 @@ static void (*const sMovementTypeCallbacks[MOVEMENT_TYPES_COUNT])(struct Sprite
[MOVEMENT_TYPE_WALK_IN_PLACE_UP] = MovementType_WalkInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_UP] = MovementType_WalkInPlace,
[MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = MovementType_WalkInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = MovementType_WalkInPlace,
[MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT] = MovementType_WalkInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT] = MovementType_WalkInPlace,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_DOWN] = MovementType_WalkSlowlyInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_DOWN] = MovementType_WalkInPlaceFast,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_UP] = MovementType_WalkSlowlyInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_UP] = MovementType_WalkInPlaceFast,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_LEFT] = MovementType_WalkSlowlyInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_LEFT] = MovementType_WalkInPlaceFast,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_RIGHT] = MovementType_WalkSlowlyInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_RIGHT] = MovementType_WalkInPlaceFast,
[MOVEMENT_TYPE_JOG_IN_PLACE_DOWN] = MovementType_JogInPlace, [MOVEMENT_TYPE_JOG_IN_PLACE_DOWN] = MovementType_JogInPlace,
[MOVEMENT_TYPE_JOG_IN_PLACE_UP] = MovementType_JogInPlace, [MOVEMENT_TYPE_JOG_IN_PLACE_UP] = MovementType_JogInPlace,
[MOVEMENT_TYPE_JOG_IN_PLACE_LEFT] = MovementType_JogInPlace, [MOVEMENT_TYPE_JOG_IN_PLACE_LEFT] = MovementType_JogInPlace,
@@ -409,10 +411,10 @@ static const u8 gInitialMovementTypeFacingDirections[MOVEMENT_TYPES_COUNT] = {
[MOVEMENT_TYPE_WALK_IN_PLACE_UP] = DIR_NORTH, [MOVEMENT_TYPE_WALK_IN_PLACE_UP] = DIR_NORTH,
[MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = DIR_WEST, [MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = DIR_WEST,
[MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT] = DIR_EAST, [MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT] = DIR_EAST,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_DOWN] = DIR_SOUTH, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_DOWN] = DIR_SOUTH,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_UP] = DIR_NORTH, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_UP] = DIR_NORTH,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_LEFT] = DIR_WEST, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_LEFT] = DIR_WEST,
[MOVEMENT_TYPE_WALK_SLOWLY_IN_PLACE_RIGHT] = DIR_EAST, [MOVEMENT_TYPE_WALK_IN_PLACE_FAST_RIGHT] = DIR_EAST,
[MOVEMENT_TYPE_JOG_IN_PLACE_DOWN] = DIR_SOUTH, [MOVEMENT_TYPE_JOG_IN_PLACE_DOWN] = DIR_SOUTH,
[MOVEMENT_TYPE_JOG_IN_PLACE_UP] = DIR_NORTH, [MOVEMENT_TYPE_JOG_IN_PLACE_UP] = DIR_NORTH,
[MOVEMENT_TYPE_JOG_IN_PLACE_LEFT] = DIR_WEST, [MOVEMENT_TYPE_JOG_IN_PLACE_LEFT] = DIR_WEST,
@@ -896,7 +898,7 @@ static const struct Coords16 sDirectionToVectors[] = {
[DIR_NORTHEAST] = { 1, -1}, [DIR_NORTHEAST] = { 1, -1},
}; };
static const u8 gFaceDirectionMovementActions[] = { static const u8 sFaceDirectionMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_FACE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_FACE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_FACE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_FACE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_FACE_UP, [DIR_NORTH] = MOVEMENT_ACTION_FACE_UP,
@@ -904,7 +906,7 @@ static const u8 gFaceDirectionMovementActions[] = {
[DIR_EAST] = MOVEMENT_ACTION_FACE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_FACE_RIGHT,
}; };
static const u8 gFaceDirectionFastMovementActions[] = { static const u8 sFaceDirectionFastMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_FACE_DOWN_FAST, [DIR_NONE] = MOVEMENT_ACTION_FACE_DOWN_FAST,
[DIR_SOUTH] = MOVEMENT_ACTION_FACE_DOWN_FAST, [DIR_SOUTH] = MOVEMENT_ACTION_FACE_DOWN_FAST,
[DIR_NORTH] = MOVEMENT_ACTION_FACE_UP_FAST, [DIR_NORTH] = MOVEMENT_ACTION_FACE_UP_FAST,
@@ -912,7 +914,7 @@ static const u8 gFaceDirectionFastMovementActions[] = {
[DIR_EAST] = MOVEMENT_ACTION_FACE_RIGHT_FAST, [DIR_EAST] = MOVEMENT_ACTION_FACE_RIGHT_FAST,
}; };
static const u8 gWalkSlowestMovementActions[] = { static const u8 sWalkSlowestMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_SLOWEST_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_SLOWEST_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOWEST_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOWEST_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_SLOWEST_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_SLOWEST_UP,
@@ -920,7 +922,7 @@ static const u8 gWalkSlowestMovementActions[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_SLOWEST_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_SLOWEST_RIGHT,
}; };
static const u8 gUnknown_83A64FB[] = { static const u8 sWalkSlowerMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_SLOWER_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_SLOWER_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOWER_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOWER_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_SLOWER_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_SLOWER_UP,
@@ -928,7 +930,7 @@ static const u8 gUnknown_83A64FB[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_SLOWER_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_SLOWER_RIGHT,
}; };
static const u8 gUnknown_83A6500[] = { static const u8 sWalkSlowMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_SLOW_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_SLOW_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOW_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOW_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_SLOW_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_SLOW_UP,
@@ -936,7 +938,7 @@ static const u8 gUnknown_83A6500[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_SLOW_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_SLOW_RIGHT,
}; };
static const u8 gUnknown_83A6505[] = { static const u8 sWalkNormalMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_NORMAL_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_NORMAL_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_NORMAL_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_NORMAL_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_NORMAL_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_NORMAL_UP,
@@ -944,7 +946,7 @@ static const u8 gUnknown_83A6505[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_NORMAL_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_NORMAL_RIGHT,
}; };
static const u8 gUnknown_83A650A[] = { static const u8 sWalkFastMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_FAST_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_FAST_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_FAST_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_FAST_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_FAST_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_FAST_UP,
@@ -952,7 +954,7 @@ static const u8 gUnknown_83A650A[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_FAST_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_FAST_RIGHT,
}; };
static const u8 gUnknown_83A650F[] = { static const u8 sGlideMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_GLIDE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_GLIDE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_GLIDE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_GLIDE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_GLIDE_UP, [DIR_NORTH] = MOVEMENT_ACTION_GLIDE_UP,
@@ -960,7 +962,7 @@ static const u8 gUnknown_83A650F[] = {
[DIR_EAST] = MOVEMENT_ACTION_GLIDE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_GLIDE_RIGHT,
}; };
static const u8 gUnknown_83A6514[] = { static const u8 sRideWaterCurrentMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN, [DIR_NONE] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP, [DIR_NORTH] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP,
@@ -968,7 +970,7 @@ static const u8 gUnknown_83A6514[] = {
[DIR_EAST] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT,
}; };
static const u8 gUnknown_83A6519[] = { static const u8 sWalkFasterMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_FASTER_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_FASTER_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_FASTER_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_FASTER_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_FASTER_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_FASTER_UP,
@@ -976,7 +978,7 @@ static const u8 gUnknown_83A6519[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_FASTER_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_FASTER_RIGHT,
}; };
static const u8 gUnknown_83A651E[] = { static const u8 sSlideMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_SLIDE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_SLIDE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_SLIDE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_SLIDE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_SLIDE_UP, [DIR_NORTH] = MOVEMENT_ACTION_SLIDE_UP,
@@ -984,7 +986,7 @@ static const u8 gUnknown_83A651E[] = {
[DIR_EAST] = MOVEMENT_ACTION_SLIDE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_SLIDE_RIGHT,
}; };
static const u8 gUnknown_83A6523[] = { static const u8 sPlayerRunMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_PLAYER_RUN_DOWN, [DIR_NONE] = MOVEMENT_ACTION_PLAYER_RUN_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_PLAYER_RUN_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_PLAYER_RUN_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_PLAYER_RUN_UP, [DIR_NORTH] = MOVEMENT_ACTION_PLAYER_RUN_UP,
@@ -992,7 +994,7 @@ static const u8 gUnknown_83A6523[] = {
[DIR_EAST] = MOVEMENT_ACTION_PLAYER_RUN_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_PLAYER_RUN_RIGHT,
}; };
static const u8 gUnknown_83A6528[] = { static const u8 sPlayerRunSlowMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW, [DIR_NONE] = MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW,
[DIR_SOUTH] = MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW, [DIR_SOUTH] = MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW,
[DIR_NORTH] = MOVEMENT_ACTION_PLAYER_RUN_UP_SLOW, [DIR_NORTH] = MOVEMENT_ACTION_PLAYER_RUN_UP_SLOW,
@@ -1000,7 +1002,7 @@ static const u8 gUnknown_83A6528[] = {
[DIR_EAST] = MOVEMENT_ACTION_PLAYER_RUN_RIGHT_SLOW, [DIR_EAST] = MOVEMENT_ACTION_PLAYER_RUN_RIGHT_SLOW,
}; };
static const u8 gUnknown_83A652D[] = { static const u8 sSpinMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_SPIN_DOWN, [DIR_NONE] = MOVEMENT_ACTION_SPIN_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_SPIN_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_SPIN_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_SPIN_UP, [DIR_NORTH] = MOVEMENT_ACTION_SPIN_UP,
@@ -1008,7 +1010,7 @@ static const u8 gUnknown_83A652D[] = {
[DIR_EAST] = MOVEMENT_ACTION_SPIN_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_SPIN_RIGHT,
}; };
static const u8 gUnknown_83A6532[] = { static const u8 sJump2MovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_JUMP_2_DOWN, [DIR_NONE] = MOVEMENT_ACTION_JUMP_2_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_2_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_JUMP_2_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_2_UP, [DIR_NORTH] = MOVEMENT_ACTION_JUMP_2_UP,
@@ -1016,7 +1018,7 @@ static const u8 gUnknown_83A6532[] = {
[DIR_EAST] = MOVEMENT_ACTION_JUMP_2_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_JUMP_2_RIGHT,
}; };
static const u8 gUnknown_83A6537[] = { static const u8 sJumpInPlaceMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_UP, [DIR_NORTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_UP,
@@ -1024,7 +1026,7 @@ static const u8 gUnknown_83A6537[] = {
[DIR_EAST] = MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT,
}; };
static const u8 gUnknown_83A653C[] = { static const u8 sJumpInPlaceTurnAroundMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN, [DIR_NONE] = MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN_UP, [DIR_NORTH] = MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN_UP,
@@ -1032,7 +1034,7 @@ static const u8 gUnknown_83A653C[] = {
[DIR_EAST] = MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT_RIGHT,
}; };
static const u8 gUnknown_83A6541[] = { static const u8 sJumpMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_JUMP_DOWN, [DIR_NONE] = MOVEMENT_ACTION_JUMP_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_JUMP_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_UP, [DIR_NORTH] = MOVEMENT_ACTION_JUMP_UP,
@@ -1040,7 +1042,7 @@ static const u8 gUnknown_83A6541[] = {
[DIR_EAST] = MOVEMENT_ACTION_JUMP_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_JUMP_RIGHT,
}; };
static const u8 gUnknown_83A6546[] = { static const u8 sJumpSpecialMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_JUMP_SPECIAL_DOWN, [DIR_NONE] = MOVEMENT_ACTION_JUMP_SPECIAL_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_SPECIAL_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_JUMP_SPECIAL_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_SPECIAL_UP, [DIR_NORTH] = MOVEMENT_ACTION_JUMP_SPECIAL_UP,
@@ -1048,7 +1050,7 @@ static const u8 gUnknown_83A6546[] = {
[DIR_EAST] = MOVEMENT_ACTION_JUMP_SPECIAL_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_JUMP_SPECIAL_RIGHT,
}; };
static const u8 gUnknown_83A654B[] = { static const u8 sJumpSpecialWithEffectMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN, [DIR_NONE] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_UP, [DIR_NORTH] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_UP,
@@ -1056,7 +1058,7 @@ static const u8 gUnknown_83A654B[] = {
[DIR_EAST] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_RIGHT,
}; };
static const u8 gUnknown_83A6550[] = { static const u8 sWalkInPlaceSlowMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_UP,
@@ -1064,7 +1066,7 @@ static const u8 gUnknown_83A6550[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_RIGHT,
}; };
static const u8 gUnknown_83A6555[] = { static const u8 sWalkInPlaceNormalMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_UP,
@@ -1072,7 +1074,7 @@ static const u8 gUnknown_83A6555[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_RIGHT,
}; };
static const u8 gUnknown_83A655A[] = { static const u8 sWalkInPlaceFastMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP,
@@ -1080,7 +1082,7 @@ static const u8 gUnknown_83A655A[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT,
}; };
static const u8 gUnknown_83A655F[] = { static const u8 sWalkInPlaceFasterMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN, [DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP, [DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP,
@@ -1088,7 +1090,7 @@ static const u8 gUnknown_83A655F[] = {
[DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT,
}; };
static const u8 gUnknown_83A6564[] = { static const u8 sAcroWheelieFaceDirectionMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_UP,
@@ -1096,7 +1098,7 @@ static const u8 gUnknown_83A6564[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_FACE_RIGHT,
}; };
static const u8 gUnknown_83A6569[] = { static const u8 sAcroPopWheelieFaceDirectionMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_UP,
@@ -1104,7 +1106,7 @@ static const u8 gUnknown_83A6569[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_RIGHT,
}; };
static const u8 gUnknown_83A656E[] = { static const u8 sAcroEndWheelieFaceDirectionMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_UP,
@@ -1112,7 +1114,7 @@ static const u8 gUnknown_83A656E[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT,
}; };
static const u8 gUnknown_83A6573[] = { static const u8 sAcroWheelieHopFaceDirectionMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_UP,
@@ -1120,7 +1122,7 @@ static const u8 gUnknown_83A6573[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_RIGHT,
}; };
static const u8 gUnknown_83A6578[] = { static const u8 sAcroWheelieHopMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_UP,
@@ -1128,7 +1130,7 @@ static const u8 gUnknown_83A6578[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_HOP_RIGHT,
}; };
static const u8 gUnknown_83A657D[] = { static const u8 sAcroWheelieJumpMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_UP,
@@ -1136,7 +1138,7 @@ static const u8 gUnknown_83A657D[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_RIGHT,
}; };
static const u8 gUnknown_83A6582[] = { static const u8 sAcroWheelieInPlaceMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_UP,
@@ -1144,7 +1146,7 @@ static const u8 gUnknown_83A6582[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT,
}; };
static const u8 gUnknown_83A6587[] = { static const u8 sAcroPopWheelieMoveMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_UP,
@@ -1152,7 +1154,7 @@ static const u8 gUnknown_83A6587[] = {
[DIR_EAST] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_RIGHT, [DIR_EAST] = MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_RIGHT,
}; };
static const u8 gUnknown_83A658C[] = { static const u8 sAcroWheelieMoveMovementActions[] = {
[DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN, [DIR_NONE] = MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN,
[DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN, [DIR_SOUTH] = MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN,
[DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_UP, [DIR_NORTH] = MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_UP,
@@ -1607,7 +1609,7 @@ static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTempl
if (!objectEvent->inanimate) if (!objectEvent->inanimate)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objectEvent->facingDirection)); StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objectEvent->facingDirection));
SetObjectSubpriorityByZCoord(objectEvent->previousElevation, sprite, 1); SetObjectSubpriorityByElevation(objectEvent->previousElevation, sprite, 1);
UpdateObjectEventVisibility(objectEvent, sprite); UpdateObjectEventVisibility(objectEvent, sprite);
return objectEventId; return objectEventId;
} }
@@ -1644,7 +1646,7 @@ u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *objectEventTemplate)
return TrySpawnObjectEventTemplate(objectEventTemplate, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY); return TrySpawnObjectEventTemplate(objectEventTemplate, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY);
} }
int SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z) int SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation)
{ {
struct ObjectEventTemplate objectEventTemplate; struct ObjectEventTemplate objectEventTemplate;
@@ -1655,7 +1657,7 @@ int SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8
objectEventTemplate.kind = OBJ_KIND_NORMAL; objectEventTemplate.kind = OBJ_KIND_NORMAL;
objectEventTemplate.x = x; objectEventTemplate.x = x;
objectEventTemplate.y = y; objectEventTemplate.y = y;
objectEventTemplate.objUnion.normal.elevation = z; objectEventTemplate.objUnion.normal.elevation = elevation;
objectEventTemplate.objUnion.normal.movementType = movementBehavior; objectEventTemplate.objUnion.normal.movementType = movementBehavior;
objectEventTemplate.objUnion.normal.movementRangeX = 0; objectEventTemplate.objUnion.normal.movementRangeX = 0;
objectEventTemplate.objUnion.normal.movementRangeY = 0; objectEventTemplate.objUnion.normal.movementRangeY = 0;
@@ -1729,7 +1731,7 @@ u8 AddPseudoObjectEvent(u16 graphicsId, SpriteCallback callback, s16 x, s16 y, u
return spriteId; return spriteId;
} }
u8 CreateVirtualObject(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction) u8 CreateVirtualObject(u8 graphicsId, u8 a1, s16 x, s16 y, u8 elevation, u8 direction)
{ {
u8 spriteId; u8 spriteId;
struct Sprite *sprite; struct Sprite *sprite;
@@ -1753,7 +1755,7 @@ u8 CreateVirtualObject(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
sprite->oam.paletteNum = graphicsInfo->paletteSlot; sprite->oam.paletteNum = graphicsInfo->paletteSlot;
sprite->coordOffsetEnabled = TRUE; sprite->coordOffsetEnabled = TRUE;
sprite->data[0] = a1; sprite->data[0] = a1;
sprite->data[1] = z; sprite->data[1] = elevation;
if (graphicsInfo->paletteSlot == 10) if (graphicsInfo->paletteSlot == 10)
{ {
LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag, graphicsInfo->paletteSlot); LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag, graphicsInfo->paletteSlot);
@@ -1764,8 +1766,8 @@ u8 CreateVirtualObject(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
SetSubspriteTables(sprite, subspriteTables); SetSubspriteTables(sprite, subspriteTables);
sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY;
} }
InitObjectPriorityByZCoord(sprite, z); InitObjectPriorityByElevation(sprite, elevation);
SetObjectSubpriorityByZCoord(z, sprite, 1); SetObjectSubpriorityByElevation(elevation, sprite, 1);
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(direction)); StartSpriteAnim(sprite, GetFaceDirectionAnimNum(direction));
} }
return spriteId; return spriteId;
@@ -1951,7 +1953,7 @@ static void ReloadMapObjectWithOffset(u8 objectEventId, s16 x, s16 y)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objectEvent->facingDirection)); StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objectEvent->facingDirection));
} }
ResetObjectEventFldEffData(objectEvent); ResetObjectEventFldEffData(objectEvent);
SetObjectSubpriorityByZCoord(objectEvent->previousElevation, sprite, 1); SetObjectSubpriorityByElevation(objectEvent->previousElevation, sprite, 1);
} }
} }
@@ -2347,7 +2349,7 @@ void UpdateObjectEventCoordsForCameraUpdate(void)
} }
} }
u8 GetObjectEventIdByXYZ(u16 x, u16 y, u8 z) u8 GetObjectEventIdByPosition(u16 x, u16 y, u8 elevation)
{ {
u8 i; u8 i;
@@ -2355,21 +2357,20 @@ u8 GetObjectEventIdByXYZ(u16 x, u16 y, u8 z)
{ {
if (gObjectEvents[i].active) if (gObjectEvents[i].active)
{ {
if (gObjectEvents[i].currentCoords.x == x && gObjectEvents[i].currentCoords.y == y && ObjectEventDoesZCoordMatch(&gObjectEvents[i], z)) if (gObjectEvents[i].currentCoords.x == x
{ && gObjectEvents[i].currentCoords.y == y
&& ObjectEventDoesElevationMatch(&gObjectEvents[i], elevation))
return i; return i;
}
} }
} }
return OBJECT_EVENTS_COUNT; return OBJECT_EVENTS_COUNT;
} }
static bool8 ObjectEventDoesZCoordMatch(struct ObjectEvent *objectEvent, u8 z) static bool8 ObjectEventDoesElevationMatch(struct ObjectEvent *objectEvent, u8 elevation)
{ {
if (objectEvent->currentElevation != 0 && z != 0 && objectEvent->currentElevation != z) if (objectEvent->currentElevation != 0 && elevation != 0 && objectEvent->currentElevation != elevation)
{
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }
@@ -4370,7 +4371,7 @@ static bool8 CopyablePlayerMovement_GoSpeed2(struct ObjectEvent *objectEvent, st
direction = playerDirection; direction = playerDirection;
direction = GetCopyDirection(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, direction); direction = GetCopyDirection(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, direction);
ObjectEventMoveDestCoords(objectEvent, direction, &x, &y); ObjectEventMoveDestCoords(objectEvent, direction, &x, &y);
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkFastestMovementAction(direction)); ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkFasterMovementAction(direction));
if (GetCollisionAtCoords(objectEvent, x, y, direction) || (tileCallback != NULL && !tileCallback(MapGridGetMetatileBehaviorAt(x, y)))) if (GetCollisionAtCoords(objectEvent, x, y, direction) || (tileCallback != NULL && !tileCallback(MapGridGetMetatileBehaviorAt(x, y))))
{ {
ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction)); ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction));
@@ -4540,12 +4541,12 @@ static bool8 MovementType_WalkInPlace_Step0(struct ObjectEvent *objectEvent, str
return TRUE; return TRUE;
} }
movement_type_def(MovementType_WalkSlowlyInPlace, gMovementTypeFuncs_WalkSlowlyInPlace) movement_type_def(MovementType_WalkInPlaceFast, gMovementTypeFuncs_WalkInPlaceFast)
static bool8 MovementType_WalkSlowlyInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) static bool8 MovementType_WalkInPlaceFast_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{ {
ClearObjectEventMovement(objectEvent, sprite); ClearObjectEventMovement(objectEvent, sprite);
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkInPlaceSlowMovementAction(objectEvent->facingDirection)); ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkInPlaceFastMovementAction(objectEvent->facingDirection));
sprite->data[1] = 1; sprite->data[1] = 1;
return TRUE; return TRUE;
} }
@@ -4555,7 +4556,7 @@ movement_type_def(MovementType_JogInPlace, gMovementTypeFuncs_JogInPlace)
static bool8 MovementType_JogInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) static bool8 MovementType_JogInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{ {
ClearObjectEventMovement(objectEvent, sprite); ClearObjectEventMovement(objectEvent, sprite);
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkInPlaceFastMovementAction(objectEvent->facingDirection)); ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkInPlaceFasterMovementAction(objectEvent->facingDirection));
sprite->data[1] = 1; sprite->data[1] = 1;
return TRUE; return TRUE;
} }
@@ -4858,7 +4859,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir)
return COLLISION_IMPASSABLE; return COLLISION_IMPASSABLE;
else if (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction)) else if (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction))
return COLLISION_IMPASSABLE; return COLLISION_IMPASSABLE;
else if (IsZCoordMismatchAt(objectEvent->currentElevation, x, y)) else if (IsElevationMismatchAt(objectEvent->currentElevation, x, y))
return COLLISION_ELEVATION_MISMATCH; return COLLISION_ELEVATION_MISMATCH;
else if (DoesObjectCollideWithObjectAt(objectEvent, x, y)) else if (DoesObjectCollideWithObjectAt(objectEvent, x, y))
return COLLISION_OBJECT_EVENT; return COLLISION_OBJECT_EVENT;
@@ -4873,7 +4874,7 @@ u8 GetCollisionFlagsAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 d
flags |= 1; flags |= 1;
if (MapGridGetCollisionAt(x, y) || GetMapBorderIdAt(x, y) == CONNECTION_INVALID || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction) || (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction))) if (MapGridGetCollisionAt(x, y) || GetMapBorderIdAt(x, y) == CONNECTION_INVALID || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction) || (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction)))
flags |= 2; flags |= 2;
if (IsZCoordMismatchAt(objectEvent->currentElevation, x, y)) if (IsElevationMismatchAt(objectEvent->currentElevation, x, y))
flags |= 4; flags |= 4;
if (DoesObjectCollideWithObjectAt(objectEvent, x, y)) if (DoesObjectCollideWithObjectAt(objectEvent, x, y))
flags |= 8; flags |= 8;
@@ -4930,10 +4931,8 @@ static bool8 DoesObjectCollideWithObjectAt(struct ObjectEvent *objectEvent, s16
{ {
if ((curObject->currentCoords.x == x && curObject->currentCoords.y == y) || (curObject->previousCoords.x == x && curObject->previousCoords.y == y)) if ((curObject->currentCoords.x == x && curObject->currentCoords.y == y) || (curObject->previousCoords.x == x && curObject->previousCoords.y == y))
{ {
if (AreZCoordsCompatible(objectEvent->currentElevation, curObject->currentElevation)) if (AreElevationsCompatible(objectEvent->currentElevation, curObject->currentElevation))
{
return TRUE; return TRUE;
}
} }
} }
} }
@@ -4953,14 +4952,12 @@ bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup)
return FALSE; return FALSE;
} }
void sub_80639D4(u8 localId, u8 mapNum, u8 mapGroup) static void SetBerryTreeJustPicked(u8 localId, u8 mapNum, u8 mapGroup)
{ {
u8 objectEventId; u8 objectEventId;
if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId)) if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId))
{
gSprites[gObjectEvents[objectEventId].spriteId].data[7] |= 0x04; gSprites[gObjectEvents[objectEventId].spriteId].data[7] |= 0x04;
}
} }
void MoveCoords(u8 direction, s16 *x, s16 *y) void MoveCoords(u8 direction, s16 *x, s16 *y)
@@ -4969,7 +4966,8 @@ void MoveCoords(u8 direction, s16 *x, s16 *y)
*y += sDirectionToVectors[direction].y; *y += sDirectionToVectors[direction].y;
} }
void sub_8063A44(u8 direction, s16 *x, s16 *y) // Unused
static void MoveCoordsInMapCoordIncrement(u8 direction, s16 *x, s16 *y)
{ {
*x += sDirectionToVectors[direction].x << 4; *x += sDirectionToVectors[direction].x << 4;
*y += sDirectionToVectors[direction].y << 4; *y += sDirectionToVectors[direction].y << 4;
@@ -5184,8 +5182,8 @@ u8 name(u32 idx) \
return animIds[direction]; \ return animIds[direction]; \
} }
dirn_to_anim(GetFaceDirectionMovementAction, gFaceDirectionMovementActions); dirn_to_anim(GetFaceDirectionMovementAction, sFaceDirectionMovementActions);
dirn_to_anim(GetFaceDirectionFastMovementAction, gFaceDirectionFastMovementActions); dirn_to_anim(GetFaceDirectionFastMovementAction, sFaceDirectionFastMovementActions);
u8 GetWalkSlowestMovementAction(u32 idx) u8 GetWalkSlowestMovementAction(u32 idx)
{ {
@@ -5193,45 +5191,45 @@ u8 GetWalkSlowestMovementAction(u32 idx)
if (direction > DIR_EAST) if (direction > DIR_EAST)
direction = DIR_NONE; direction = DIR_NONE;
return gWalkSlowestMovementActions[direction]; return sWalkSlowestMovementActions[direction];
} }
dirn_to_anim(GetWalkSlowerMovementAction, gUnknown_83A64FB); dirn_to_anim(GetWalkSlowerMovementAction, sWalkSlowerMovementActions);
dirn_to_anim(GetWalkSlowMovementAction, gUnknown_83A6500); dirn_to_anim(GetWalkSlowMovementAction, sWalkSlowMovementActions);
dirn_to_anim(GetWalkNormalMovementAction, gUnknown_83A6505); dirn_to_anim(GetWalkNormalMovementAction, sWalkNormalMovementActions);
dirn_to_anim(GetWalkFastMovementAction, gUnknown_83A650A); dirn_to_anim(GetWalkFastMovementAction, sWalkFastMovementActions);
dirn_to_anim(sub_8063FDC, gUnknown_83A650F); dirn_to_anim(GetGlideMovementAction, sGlideMovementActions);
dirn_to_anim(GetRideWaterCurrentMovementAction, gUnknown_83A6514); dirn_to_anim(GetRideWaterCurrentMovementAction, sRideWaterCurrentMovementActions);
dirn_to_anim(GetWalkFastestMovementAction, gUnknown_83A6519); dirn_to_anim(GetWalkFasterMovementAction, sWalkFasterMovementActions);
dirn_to_anim(GetSlideMovementAction, gUnknown_83A651E); dirn_to_anim(GetSlideMovementAction, sSlideMovementActions);
dirn_to_anim(GetPlayerRunMovementAction, gUnknown_83A6523); dirn_to_anim(GetPlayerRunMovementAction, sPlayerRunMovementActions);
dirn_to_anim(GetPlayerRunSlowMovementAction, gUnknown_83A6528); dirn_to_anim(GetPlayerRunSlowMovementAction, sPlayerRunSlowMovementActions);
dirn_to_anim(GetSpinMovementAction, gUnknown_83A652D); dirn_to_anim(GetSpinMovementAction, sSpinMovementActions);
dirn_to_anim(GetJump2MovementAction, gUnknown_83A6532); dirn_to_anim(GetJump2MovementAction, sJump2MovementActions);
dirn_to_anim(GetJumpInPlaceMovementAction, gUnknown_83A6537); dirn_to_anim(GetJumpInPlaceMovementAction, sJumpInPlaceMovementActions);
dirn_to_anim(GetJumpInPlaceTurnAroundMovementAction, gUnknown_83A653C); dirn_to_anim(GetJumpInPlaceTurnAroundMovementAction, sJumpInPlaceTurnAroundMovementActions);
dirn_to_anim(GetJumpMovementAction, gUnknown_83A6541); dirn_to_anim(GetJumpMovementAction, sJumpMovementActions);
dirn_to_anim(GetJumpSpecialMovementAction, gUnknown_83A6546); dirn_to_anim(GetJumpSpecialMovementAction, sJumpSpecialMovementActions);
dirn_to_anim(GetJumpSpecialWithEffectMovementAction, gUnknown_83A654B); dirn_to_anim(GetJumpSpecialWithEffectMovementAction, sJumpSpecialWithEffectMovementActions);
dirn_to_anim(GetStepInPlaceDelay32AnimId, gUnknown_83A6550); dirn_to_anim(GetWalkInPlaceSlowMovementAction, sWalkInPlaceSlowMovementActions);
dirn_to_anim(GetWalkInPlaceNormalMovementAction, gUnknown_83A6555); dirn_to_anim(GetWalkInPlaceNormalMovementAction, sWalkInPlaceNormalMovementActions);
dirn_to_anim(GetWalkInPlaceSlowMovementAction, gUnknown_83A655A); dirn_to_anim(GetWalkInPlaceFastMovementAction, sWalkInPlaceFastMovementActions);
dirn_to_anim(GetWalkInPlaceFastMovementAction, gUnknown_83A655F); dirn_to_anim(GetWalkInPlaceFasterMovementAction, sWalkInPlaceFasterMovementActions);
bool8 ObjectEventFaceOppositeDirection(struct ObjectEvent *objectEvent, u8 direction) bool8 ObjectEventFaceOppositeDirection(struct ObjectEvent *objectEvent, u8 direction)
{ {
return ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(GetOppositeDirection(direction))); return ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(GetOppositeDirection(direction)));
} }
dirn_to_anim(GetAcroWheelieFaceDirectionMovementAction, gUnknown_83A6564); dirn_to_anim(GetAcroWheelieFaceDirectionMovementAction, sAcroWheelieFaceDirectionMovementActions);
dirn_to_anim(GetAcroPopWheelieFaceDirectionMovementAction, gUnknown_83A6569); dirn_to_anim(GetAcroPopWheelieFaceDirectionMovementAction, sAcroPopWheelieFaceDirectionMovementActions);
dirn_to_anim(GetAcroEndWheelieFaceDirectionMovementAction, gUnknown_83A656E); dirn_to_anim(GetAcroEndWheelieFaceDirectionMovementAction, sAcroEndWheelieFaceDirectionMovementActions);
dirn_to_anim(GetAcroWheelieHopFaceDirectionMovementAction, gUnknown_83A6573); dirn_to_anim(GetAcroWheelieHopFaceDirectionMovementAction, sAcroWheelieHopFaceDirectionMovementActions);
dirn_to_anim(GetAcroWheelieHopDirectionMovementAction, gUnknown_83A6578); dirn_to_anim(GetAcroWheelieHopMovementAction, sAcroWheelieHopMovementActions);
dirn_to_anim(GetAcroWheelieJumpDirectionMovementAction, gUnknown_83A657D); dirn_to_anim(GetAcroWheelieJumpMovementAction, sAcroWheelieJumpMovementActions);
dirn_to_anim(GetAcroWheelieInPlaceDirectionMovementAction, gUnknown_83A6582); dirn_to_anim(GetAcroWheelieInPlaceMovementAction, sAcroWheelieInPlaceMovementActions);
dirn_to_anim(GetAcroPopWheelieMoveDirectionMovementAction, gUnknown_83A6587); dirn_to_anim(GetAcroPopWheelieMoveMovementAction, sAcroPopWheelieMoveMovementActions);
dirn_to_anim(GetAcroWheelieMoveDirectionMovementAction, gUnknown_83A658C); dirn_to_anim(GetAcroWheelieMoveMovementAction, sAcroWheelieMoveMovementActions);
u8 GetOppositeDirection(u8 direction) u8 GetOppositeDirection(u8 direction)
{ {
@@ -8330,30 +8328,30 @@ static u8 GetReflectionTypeByMetatileBehavior(u32 behavior)
return 0; return 0;
} }
u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z) u8 GetLedgeJumpDirection(s16 x, s16 y, u8 direction)
{ {
static bool8 (*const gUnknown_83A705C[])(u8) = { static bool8 (*const ledgeBehaviorFuncs[])(u8) = {
MetatileBehavior_IsJumpSouth, [DIR_SOUTH - 1] = MetatileBehavior_IsJumpSouth,
MetatileBehavior_IsJumpNorth, [DIR_NORTH - 1] = MetatileBehavior_IsJumpNorth,
MetatileBehavior_IsJumpWest, [DIR_WEST - 1] = MetatileBehavior_IsJumpWest,
MetatileBehavior_IsJumpEast, [DIR_EAST - 1] = MetatileBehavior_IsJumpEast,
}; };
u8 b; u8 behavior;
u8 index = z; u8 index = direction;
if (index == 0) if (index == DIR_NONE)
return 0; return DIR_NONE;
else if (index > 4) else if (index > DIR_EAST)
index -= 4; index -= DIR_EAST;
index--; index--;
b = MapGridGetMetatileBehaviorAt(x, y); behavior = MapGridGetMetatileBehaviorAt(x, y);
if (gUnknown_83A705C[index](b) == 1) if (ledgeBehaviorFuncs[index](behavior) == TRUE)
return index + 1; return index + 1;
return 0; return DIR_NONE;
} }
static void SetObjectEventSpriteOamTableForLongGrass(struct ObjectEvent *objEvent, struct Sprite *sprite) static void SetObjectEventSpriteOamTableForLongGrass(struct ObjectEvent *objEvent, struct Sprite *sprite)
@@ -8369,90 +8367,86 @@ static void SetObjectEventSpriteOamTableForLongGrass(struct ObjectEvent *objEven
sprite->subspriteTableNum = 4; sprite->subspriteTableNum = 4;
if (ZCoordToPriority(objEvent->previousElevation) == 1) if (ElevationToPriority(objEvent->previousElevation) == 1)
sprite->subspriteTableNum = 5; sprite->subspriteTableNum = 5;
} }
bool8 IsZCoordMismatchAt(u8 z, s16 x, s16 y) static bool8 IsElevationMismatchAt(u8 elevation, s16 x, s16 y)
{ {
u8 mapZ; u8 mapElevation;
if (z == 0) if (elevation == 0)
return FALSE; return FALSE;
mapZ = MapGridGetElevationAt(x, y); mapElevation = MapGridGetElevationAt(x, y);
if (mapZ == 0 || mapZ == 0xF) if (mapElevation == 0 || mapElevation == 15)
return FALSE; return FALSE;
if (mapZ != z) if (mapElevation != elevation)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
static const u8 sUnknown_083A706C[] = { static const u8 sElevationToSubpriority[] = {
0x73, 0x73, 0x53, 0x73, 0x53, 0x73, 0x53, 0x73, 0x53, 0x73, 0x53, 0x73, 0x53, 0x00, 0x00, 0x73 115, 115, 83, 115, 83, 115, 83, 115, 83, 115, 83, 115, 83, 0, 0, 115
}; };
// Each byte corresponds to a sprite priority for an object event. static const u8 sElevationToPriority[] = {
// This is directly the inverse of sObjectEventPriorities_083A708C.
static const u8 sObjectEventPriorities_083A707C[] = {
2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0, 2 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 0, 2
}; };
// Each byte corresponds to a sprite priority for an object event.
// This is the inverse of sObjectEventPriorities_083A707C.
// 1 = Above player sprite // 1 = Above player sprite
// 2 = Below player sprite // 2 = Below player sprite
static const u8 sObjectEventPriorities_083A708C[] = { static const u8 sElevationToSubspriteTableNum[] = {
1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 1,
}; };
void UpdateObjectEventZCoordAndPriority(struct ObjectEvent *objEvent, struct Sprite *sprite) static void UpdateObjectEventElevationAndPriority(struct ObjectEvent *objEvent, struct Sprite *sprite)
{ {
if (objEvent->fixedPriority) if (objEvent->fixedPriority)
return; return;
ObjectEventUpdateZCoord(objEvent); ObjectEventUpdateElevation(objEvent);
sprite->subspriteTableNum = sObjectEventPriorities_083A708C[objEvent->previousElevation]; sprite->subspriteTableNum = sElevationToSubspriteTableNum[objEvent->previousElevation];
sprite->oam.priority = sObjectEventPriorities_083A707C[objEvent->previousElevation]; sprite->oam.priority = sElevationToPriority[objEvent->previousElevation];
} }
static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z) static void InitObjectPriorityByElevation(struct Sprite *sprite, u8 elevation)
{ {
sprite->subspriteTableNum = sObjectEventPriorities_083A708C[z]; sprite->subspriteTableNum = sElevationToSubspriteTableNum[elevation];
sprite->oam.priority = sObjectEventPriorities_083A707C[z]; sprite->oam.priority = sElevationToPriority[elevation];
} }
u8 ZCoordToPriority(u8 z) u8 ElevationToPriority(u8 elevation)
{ {
return sObjectEventPriorities_083A707C[z]; return sElevationToPriority[elevation];
} }
void ObjectEventUpdateZCoord(struct ObjectEvent *objEvent) void ObjectEventUpdateElevation(struct ObjectEvent *objEvent)
{ {
u8 z = MapGridGetElevationAt(objEvent->currentCoords.x, objEvent->currentCoords.y); u8 curElevation = MapGridGetElevationAt(objEvent->currentCoords.x, objEvent->currentCoords.y);
u8 z2 = MapGridGetElevationAt(objEvent->previousCoords.x, objEvent->previousCoords.y); u8 prevElevation = MapGridGetElevationAt(objEvent->previousCoords.x, objEvent->previousCoords.y);
if (z == 0xF || z2 == 0xF) if (curElevation == 15 || prevElevation == 15)
return; return;
objEvent->currentElevation = z; objEvent->currentElevation = curElevation;
if (z != 0 && z != 0xF) if (curElevation != 0 && curElevation != 15)
objEvent->previousElevation = z; objEvent->previousElevation = curElevation;
} }
void SetObjectSubpriorityByZCoord(u8 a, struct Sprite *sprite, u8 b) void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *sprite, u8 subpriority)
{ {
s32 tmp = sprite->centerToCornerVecY; s32 tmp = sprite->centerToCornerVecY;
u32 tmpa = *(u16 *)&sprite->y; u32 tmpa = *(u16 *)&sprite->y;
u32 tmpb = *(u16 *)&gSpriteCoordOffsetY; u32 tmpb = *(u16 *)&gSpriteCoordOffsetY;
s32 tmp2 = (tmpa - tmp) + tmpb; s32 tmp2 = (tmpa - tmp) + tmpb;
u16 tmp3 = (0x10 - ((((u32)tmp2 + 8) & 0xFF) >> 4)) * 2; u16 tmp3 = (0x10 - ((((u32)tmp2 + 8) & 0xFF) >> 4)) * 2;
sprite->subpriority = tmp3 + sUnknown_083A706C[a] + b; sprite->subpriority = tmp3 + sElevationToSubpriority[elevation] + subpriority;
} }
static void ObjectEventUpdateSubpriority(struct ObjectEvent *objEvent, struct Sprite *sprite) static void ObjectEventUpdateSubpriority(struct ObjectEvent *objEvent, struct Sprite *sprite)
@@ -8460,10 +8454,10 @@ static void ObjectEventUpdateSubpriority(struct ObjectEvent *objEvent, struct Sp
if (objEvent->fixedPriority) if (objEvent->fixedPriority)
return; return;
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1); SetObjectSubpriorityByElevation(objEvent->previousElevation, sprite, 1);
} }
bool8 AreZCoordsCompatible(u8 a, u8 b) static bool8 AreElevationsCompatible(u8 a, u8 b)
{ {
if (a == 0 || b == 0) if (a == 0 || b == 0)
return TRUE; return TRUE;
@@ -8759,7 +8753,7 @@ static void DoGroundEffects_OnSpawn(struct ObjectEvent *objEvent, struct Sprite
if (objEvent->triggerGroundEffectsOnMove) if (objEvent->triggerGroundEffectsOnMove)
{ {
flags = 0; flags = 0;
UpdateObjectEventZCoordAndPriority(objEvent, sprite); UpdateObjectEventElevationAndPriority(objEvent, sprite);
GetAllGroundEffectFlags_OnSpawn(objEvent, &flags); GetAllGroundEffectFlags_OnSpawn(objEvent, &flags);
SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
DoFlaggedGroundEffects(objEvent, sprite, flags); DoFlaggedGroundEffects(objEvent, sprite, flags);
@@ -8775,7 +8769,7 @@ static void DoGroundEffects_OnBeginStep(struct ObjectEvent *objEvent, struct Spr
if (objEvent->triggerGroundEffectsOnMove) if (objEvent->triggerGroundEffectsOnMove)
{ {
flags = 0; flags = 0;
UpdateObjectEventZCoordAndPriority(objEvent, sprite); UpdateObjectEventElevationAndPriority(objEvent, sprite);
GetAllGroundEffectFlags_OnBeginStep(objEvent, &flags); GetAllGroundEffectFlags_OnBeginStep(objEvent, &flags);
SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
filters_out_some_ground_effects(objEvent, &flags); filters_out_some_ground_effects(objEvent, &flags);
@@ -8792,7 +8786,7 @@ static void DoGroundEffects_OnFinishStep(struct ObjectEvent *objEvent, struct Sp
if (objEvent->triggerGroundEffectsOnStop) if (objEvent->triggerGroundEffectsOnStop)
{ {
flags = 0; flags = 0;
UpdateObjectEventZCoordAndPriority(objEvent, sprite); UpdateObjectEventElevationAndPriority(objEvent, sprite);
GetAllGroundEffectFlags_OnFinishStep(objEvent, &flags); GetAllGroundEffectFlags_OnFinishStep(objEvent, &flags);
SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite);
FilterOutStepOnPuddleGroundEffectIfJumping(objEvent, &flags); FilterOutStepOnPuddleGroundEffectIfJumping(objEvent, &flags);
@@ -8855,7 +8849,7 @@ void UnfreezeObjectEvents(void)
} }
#define tObjectEventId data[0] #define tObjectEventId data[0]
#define tZCoord data[1] #define tElevation data[1]
#define tInvisible data[2] #define tInvisible data[2]
#define tDirection data[3] #define tDirection data[3]
@@ -9251,7 +9245,7 @@ void UpdateObjectEventSpriteVisibility(struct Sprite *sprite, bool8 invisible)
void UpdateObjectEventSpriteSubpriorityAndVisibility(struct Sprite *sprite) void UpdateObjectEventSpriteSubpriorityAndVisibility(struct Sprite *sprite)
{ {
DoObjectUnionRoomWarpYDisplacement(sprite); DoObjectUnionRoomWarpYDisplacement(sprite);
SetObjectSubpriorityByZCoord(sprite->tZCoord, sprite, 1); SetObjectSubpriorityByElevation(sprite->tElevation, sprite, 1);
UpdateObjectEventSpriteVisibility(sprite, sprite->tInvisible); UpdateObjectEventSpriteVisibility(sprite, sprite->tInvisible);
} }
@@ -9425,7 +9419,7 @@ bool32 RfuUnionObjectIsWarping(u8 objectEventId)
#undef tUnionRoomWarpAnimState #undef tUnionRoomWarpAnimState
#undef tUnionRoomWarpAnimNo #undef tUnionRoomWarpAnimNo
#undef tInvisible #undef tInvisible
#undef tZCoord #undef tElevation
#undef tObjectEventId #undef tObjectEventId
u32 StartFieldEffectForObjectEvent(u8 fieldEffectId, struct ObjectEvent * objectEvent) u32 StartFieldEffectForObjectEvent(u8 fieldEffectId, struct ObjectEvent * objectEvent)
+1 -1
View File
@@ -1331,7 +1331,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
case T_MVSTATE_PRINT_YES_NO: case T_MVSTATE_PRINT_YES_NO:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
LoadUserWindowBorderGfx(0, 0xA8, 0xE0); LoadUserWindowGfx2(0, 0xA8, 0xE0);
CreateYesNoMenu(&gTradeEvolutionSceneYesNoWindowTemplate, FONT_3, 0, 2, 0xA8, 0xE, 0); CreateYesNoMenu(&gTradeEvolutionSceneYesNoWindowTemplate, FONT_3, 0, 2, 0xA8, 0xE, 0);
sEvoCursorPos = 0; sEvoCursorPos = 0;
gTasks[taskId].tLearnMoveState++; gTasks[taskId].tLearnMoveState++;
+1 -1
View File
@@ -667,7 +667,7 @@ static void MainCB2_LoadFameChecker(void)
LoadPalette(gFameCheckerBgPals + 0x10, 0x10, 0x20); LoadPalette(gFameCheckerBgPals + 0x10, 0x10, 0x20);
CopyToBgTilemapBufferRect(2, gFameCheckerBg2Tilemap, 0, 0, 32, 32); CopyToBgTilemapBufferRect(2, gFameCheckerBg2Tilemap, 0, 0, 32, 32);
CopyToBgTilemapBufferRect_ChangePalette(1, sFameCheckerTilemap, 30, 0, 32, 32, 0x11); CopyToBgTilemapBufferRect_ChangePalette(1, sFameCheckerTilemap, 30, 0, 32, 32, 0x11);
LoadPalette(stdpal_get(2), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xF0, 0x20);
gMain.state++; gMain.state++;
break; break;
case 4: case 4:
+25 -25
View File
@@ -197,7 +197,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
u16 metatileBehavior; u16 metatileBehavior;
u32 metatileAttributes; u32 metatileAttributes;
ResetFacingNpcOrSignPostVars(); ResetFacingNpcOrSignpostVars();
playerDirection = GetPlayerFacingDirection(); playerDirection = GetPlayerFacingDirection();
GetPlayerPosition(&position); GetPlayerPosition(&position);
metatileAttributes = MapGridGetMetatileAttributeAt(position.x, position.y, METATILE_ATTRIBUTES_ALL); metatileAttributes = MapGridGetMetatileAttributeAt(position.x, position.y, METATILE_ATTRIBUTES_ALL);
@@ -345,7 +345,7 @@ static void Task_QuestLogPlayback_OpenStartMenu(u8 taskId)
static void GetPlayerPosition(struct MapPosition *position) static void GetPlayerPosition(struct MapPosition *position)
{ {
PlayerGetDestCoords(&position->x, &position->y); PlayerGetDestCoords(&position->x, &position->y);
position->height = PlayerGetZCoord(); position->elevation = PlayerGetElevation();
} }
static void GetInFrontOfPlayerPosition(struct MapPosition *position) static void GetInFrontOfPlayerPosition(struct MapPosition *position)
@@ -355,9 +355,9 @@ static void GetInFrontOfPlayerPosition(struct MapPosition *position)
GetXYCoordsOneStepInFrontOfPlayer(&position->x, &position->y); GetXYCoordsOneStepInFrontOfPlayer(&position->x, &position->y);
PlayerGetDestCoords(&x, &y); PlayerGetDestCoords(&x, &y);
if (MapGridGetElevationAt(x, y) != 0) if (MapGridGetElevationAt(x, y) != 0)
position->height = PlayerGetZCoord(); position->elevation = PlayerGetElevation();
else else
position->height = 0; position->elevation = 0;
} }
static u16 GetPlayerCurMetatileBehavior(void) static u16 GetPlayerCurMetatileBehavior(void)
@@ -410,9 +410,9 @@ const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatil
s32 i; s32 i;
if (!MetatileBehavior_IsCounter(MapGridGetMetatileBehaviorAt(position->x, position->y))) if (!MetatileBehavior_IsCounter(MapGridGetMetatileBehaviorAt(position->x, position->y)))
objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height); objectEventId = GetObjectEventIdByPosition(position->x, position->y, position->elevation);
else else
objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); objectEventId = GetObjectEventIdByPosition(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->elevation);
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER) if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
return NULL; return NULL;
@@ -434,14 +434,14 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
u8 objectEventId; u8 objectEventId;
const u8 *script; const u8 *script;
objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height); objectEventId = GetObjectEventIdByPosition(position->x, position->y, position->elevation);
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER) if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
{ {
if (MetatileBehavior_IsCounter(metatileBehavior) != TRUE) if (MetatileBehavior_IsCounter(metatileBehavior) != TRUE)
return NULL; return NULL;
// Look for an object event on the other side of the counter. // Look for an object event on the other side of the counter.
objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); objectEventId = GetObjectEventIdByPosition(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->elevation);
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER) if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
return NULL; return NULL;
} }
@@ -462,7 +462,7 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
{ {
u8 signpostType; u8 signpostType;
const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
if (bgEvent == NULL) if (bgEvent == NULL)
return NULL; return NULL;
@@ -507,7 +507,7 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
} }
if (signpostType != SIGNPOST_NA) if (signpostType != SIGNPOST_NA)
MsgSetSignPost(); MsgSetSignpost();
gSpecialVar_Facing = direction; gSpecialVar_Facing = direction;
return bgEvent->bgUnion.script; return bgEvent->bgUnion.script;
} }
@@ -577,22 +577,22 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me
return CableClub_EventScript_ShowBattleRecords; return CableClub_EventScript_ShowBattleRecords;
if (MetatileBehavior_IsIndigoPlateauSign1(metatileBehavior) == TRUE) if (MetatileBehavior_IsIndigoPlateauSign1(metatileBehavior) == TRUE)
{ {
MsgSetSignPost(); MsgSetSignpost();
return EventScript_Indigo_UltimateGoal; return EventScript_Indigo_UltimateGoal;
} }
if (MetatileBehavior_IsIndigoPlateauSign2(metatileBehavior) == TRUE) if (MetatileBehavior_IsIndigoPlateauSign2(metatileBehavior) == TRUE)
{ {
MsgSetSignPost(); MsgSetSignpost();
return EventScript_Indigo_HighestAuthority; return EventScript_Indigo_HighestAuthority;
} }
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, direction) == TRUE) if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, direction) == TRUE)
{ {
MsgSetSignPost(); MsgSetSignpost();
return EventScript_PokemartSign; return EventScript_PokemartSign;
} }
if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, direction) == TRUE) if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, direction) == TRUE)
{ {
MsgSetSignPost(); MsgSetSignpost();
return EventScript_PokecenterSign; return EventScript_PokecenterSign;
} }
return NULL; return NULL;
@@ -632,7 +632,7 @@ static bool8 TryStartStepBasedScript(struct MapPosition *position, u16 metatileB
static bool8 TryStartCoordEventScript(struct MapPosition *position) static bool8 TryStartCoordEventScript(struct MapPosition *position)
{ {
const u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); const u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
if (script == NULL) if (script == NULL)
return FALSE; return FALSE;
@@ -809,12 +809,12 @@ static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection)
gSpecialVar_Facing = playerDirection; gSpecialVar_Facing = playerDirection;
ScriptContext_SetupScript(script); ScriptContext_SetupScript(script);
SetWalkingIntoSignVars(); SetWalkingIntoSignVars();
MsgSetSignPost(); MsgSetSignpost();
} }
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position) static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position)
{ {
const struct BgEvent * event = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); const struct BgEvent * event = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
if (event == NULL) if (event == NULL)
return NULL; return NULL;
if (event->bgUnion.script != NULL) if (event->bgUnion.script != NULL)
@@ -889,7 +889,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
if (MetatileBehavior_IsFallWarp(metatileBehavior) == TRUE) if (MetatileBehavior_IsFallWarp(metatileBehavior) == TRUE)
{ {
ResetInitialPlayerAvatarState(); ResetInitialPlayerAvatarState();
ScriptContext_SetupScript(EventScript_1C1361); ScriptContext_SetupScript(EventScript_DoFallWarp);
return TRUE; return TRUE;
} }
DoWarp(); DoWarp();
@@ -959,7 +959,7 @@ static bool8 IsArrowWarpMetatileBehavior(u16 metatileBehavior, u8 direction)
static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position) static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position)
{ {
return GetWarpEventAtPosition(mapHeader, position->x - 7, position->y - 7, position->height); return GetWarpEventAtPosition(mapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
} }
static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position) static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position)
@@ -1083,7 +1083,7 @@ void HandleBoulderActivateVictoryRoadSwitch(u16 x, u16 y)
{ {
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
if (events[i].x + 7 == x && events[i].y + 7 == y) if (events[i].x + MAP_OFFSET == x && events[i].y + MAP_OFFSET == y)
{ {
QuestLog_CutRecording(); QuestLog_CutRecording();
ScriptContext_SetupScript(events[i].script); ScriptContext_SetupScript(events[i].script);
@@ -1095,7 +1095,7 @@ void HandleBoulderActivateVictoryRoadSwitch(u16 x, u16 y)
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position) const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
{ {
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); return GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
} }
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
@@ -1119,7 +1119,7 @@ bool8 dive_warp(struct MapPosition *position, u16 metatileBehavior)
{ {
if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior)) if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior))
{ {
if (SetDiveWarpEmerge(position->x - 7, position->y - 7)) if (SetDiveWarpEmerge(position->x - MAP_OFFSET, position->y - MAP_OFFSET))
{ {
StoreInitialPlayerAvatarState(); StoreInitialPlayerAvatarState();
DoDiveWarp(); DoDiveWarp();
@@ -1129,7 +1129,7 @@ bool8 dive_warp(struct MapPosition *position, u16 metatileBehavior)
} }
else if (MetatileBehavior_IsDiveable(metatileBehavior) == TRUE) else if (MetatileBehavior_IsDiveable(metatileBehavior) == TRUE)
{ {
if (SetDiveWarpDive(position->x - 7, position->y - 7)) if (SetDiveWarpDive(position->x - MAP_OFFSET, position->y - MAP_OFFSET))
{ {
StoreInitialPlayerAvatarState(); StoreInitialPlayerAvatarState();
DoDiveWarp(); DoDiveWarp();
@@ -1149,12 +1149,12 @@ static u8 TrySetDiveWarp(void)
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y); metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior)) if (gMapHeader.mapType == MAP_TYPE_UNDERWATER && !MetatileBehavior_IsUnableToEmerge(metatileBehavior))
{ {
if (SetDiveWarpEmerge(x - 7, y - 7) == TRUE) if (SetDiveWarpEmerge(x - MAP_OFFSET, y - MAP_OFFSET) == TRUE)
return 1; return 1;
} }
else if (MetatileBehavior_IsDiveable(metatileBehavior) == TRUE) else if (MetatileBehavior_IsDiveable(metatileBehavior) == TRUE)
{ {
if (SetDiveWarpDive(x - 7, y - 7) == TRUE) if (SetDiveWarpDive(x - MAP_OFFSET, y - MAP_OFFSET) == TRUE)
return 2; return 2;
} }
return 0; return 0;
+1 -1
View File
@@ -1998,7 +1998,7 @@ static bool8 LavaridgeGym1FWarpEffect_2(struct Task *task, struct ObjectEvent *
} else } else
{ {
task->data[1]++; task->data[1]++;
ObjectEventSetHeldMovement(objectEvent, GetWalkInPlaceFastMovementAction(objectEvent->facingDirection)); ObjectEventSetHeldMovement(objectEvent, GetWalkInPlaceFasterMovementAction(objectEvent->facingDirection));
PlaySE(SE_LAVARIDGE_FALL_WARP); PlaySE(SE_LAVARIDGE_FALL_WARP);
} }
} }
+3 -3
View File
@@ -387,7 +387,7 @@ u32 FldEff_LongGrass(void)
{ {
sprite = &gSprites[spriteId]; sprite = &gSprites[spriteId];
sprite->coordOffsetEnabled = TRUE; sprite->coordOffsetEnabled = TRUE;
sprite->oam.priority = ZCoordToPriority(gFieldEffectArguments[2]); sprite->oam.priority = ElevationToPriority(gFieldEffectArguments[2]);
sprite->data[0] = gFieldEffectArguments[2]; sprite->data[0] = gFieldEffectArguments[2];
sprite->data[1] = gFieldEffectArguments[0]; sprite->data[1] = gFieldEffectArguments[0];
sprite->data[2] = gFieldEffectArguments[1]; sprite->data[2] = gFieldEffectArguments[1];
@@ -1381,7 +1381,7 @@ void UpdateJumpImpactEffect(struct Sprite *sprite)
else else
{ {
UpdateObjectEventSpriteVisibility(sprite, FALSE); UpdateObjectEventSpriteVisibility(sprite, FALSE);
SetObjectSubpriorityByZCoord(sprite->data[0], sprite, 0); SetObjectSubpriorityByElevation(sprite->data[0], sprite, 0);
} }
} }
@@ -1400,7 +1400,7 @@ static void UpdateGrassFieldEffectSubpriority(struct Sprite *sprite, u8 z, u8 of
const struct ObjectEventGraphicsInfo * graphicsInfo; // Unused Variable const struct ObjectEventGraphicsInfo * graphicsInfo; // Unused Variable
struct Sprite *linkedSprite; struct Sprite *linkedSprite;
SetObjectSubpriorityByZCoord(z, sprite, offset); SetObjectSubpriorityByElevation(z, sprite, offset);
for (i = 0; i < OBJECT_EVENTS_COUNT; i++) for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
{ {
struct ObjectEvent * objectEvent = &gObjectEvents[i]; struct ObjectEvent * objectEvent = &gObjectEvents[i];
+1 -1
View File
@@ -928,7 +928,7 @@ static void ExitStairsMovement(s16 *speedX, s16 *speedY, s16 *offsetX, s16 *offs
direction = DIR_WEST; direction = DIR_WEST;
else else
direction = DIR_EAST; direction = DIR_EAST;
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceSlowMovementAction(direction)); ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceFastMovementAction(direction));
GetStairsMovementDirection(metatileBehavior, speedX, speedY); GetStairsMovementDirection(metatileBehavior, speedX, speedY);
*offsetX = *speedX * 16; *offsetX = *speedX * 16;
*offsetY = *speedY * 16; *offsetY = *speedY * 16;
+3 -3
View File
@@ -28,12 +28,12 @@ static void Task_DrawFieldMessageBox(u8 taskId)
if (gQuestLogState == QL_STATE_PLAYBACK) if (gQuestLogState == QL_STATE_PLAYBACK)
{ {
gTextFlags.autoScroll = TRUE; gTextFlags.autoScroll = TRUE;
TextWindow_LoadTilesStdFrame1(0, 0x200); LoadQuestLogWindowTiles(0, 0x200);
} }
else if (!IsMsgSignPost()) else if (!IsMsgSignpost())
LoadStdWindowFrameGfx(); LoadStdWindowFrameGfx();
else else
LoadSignPostWindowFrameGfx(); LoadSignpostWindowFrameGfx();
task->data[0]++; task->data[0]++;
break; break;
case 1: case 1:
+33 -34
View File
@@ -329,27 +329,27 @@ static u8 DoForcedMovementInCurrentDirection(MovementAction movementAction)
static bool8 ForcedMovement_Slip(void) static bool8 ForcedMovement_Slip(void)
{ {
return DoForcedMovementInCurrentDirection(PlayerGoSpeed2); return DoForcedMovementInCurrentDirection(PlayerWalkFast);
} }
static bool8 ForcedMovement_WalkSouth(void) static bool8 ForcedMovement_WalkSouth(void)
{ {
return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1); return DoForcedMovement(DIR_SOUTH, PlayerWalkNormal);
} }
static bool8 ForcedMovement_WalkNorth(void) static bool8 ForcedMovement_WalkNorth(void)
{ {
return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1); return DoForcedMovement(DIR_NORTH, PlayerWalkNormal);
} }
static bool8 ForcedMovement_WalkWest(void) static bool8 ForcedMovement_WalkWest(void)
{ {
return DoForcedMovement(DIR_WEST, PlayerGoSpeed1); return DoForcedMovement(DIR_WEST, PlayerWalkNormal);
} }
static bool8 ForcedMovement_WalkEast(void) static bool8 ForcedMovement_WalkEast(void)
{ {
return DoForcedMovement(DIR_EAST, PlayerGoSpeed1); return DoForcedMovement(DIR_EAST, PlayerWalkNormal);
} }
static bool8 ForcedMovement_SpinRight(void) static bool8 ForcedMovement_SpinRight(void)
@@ -412,22 +412,22 @@ static u8 ForcedMovement_Slide(u8 direction, MovementAction movementAction)
static bool8 ForcedMovement_SlideSouth(void) static bool8 ForcedMovement_SlideSouth(void)
{ {
return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2); return ForcedMovement_Slide(DIR_SOUTH, PlayerWalkFast);
} }
static bool8 ForcedMovement_SlideNorth(void) static bool8 ForcedMovement_SlideNorth(void)
{ {
return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2); return ForcedMovement_Slide(DIR_NORTH, PlayerWalkFast);
} }
static bool8 ForcedMovement_SlideWest(void) static bool8 ForcedMovement_SlideWest(void)
{ {
return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2); return ForcedMovement_Slide(DIR_WEST, PlayerWalkFast);
} }
static bool8 ForcedMovement_SlideEast(void) static bool8 ForcedMovement_SlideEast(void)
{ {
return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2); return ForcedMovement_Slide(DIR_EAST, PlayerWalkFast);
} }
static bool8 ForcedMovement_MatJump(void) static bool8 ForcedMovement_MatJump(void)
@@ -508,8 +508,8 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
{ {
// speed 2 is fast, same speed as running // Same speed as running
PlayerGoSpeed2(direction); PlayerWalkFast(direction);
return; return;
} }
@@ -526,9 +526,9 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
else else
{ {
if (PlayerIsMovingOnRockStairs(direction)) if (PlayerIsMovingOnRockStairs(direction))
PlayerGoSlow(direction); PlayerWalkSlow(direction);
else else
PlayerGoSpeed1(direction); PlayerWalkNormal(direction);
} }
} }
@@ -598,7 +598,7 @@ static bool8 CanStopSurfing(s16 x, s16 y, u8 direction)
{ {
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
&& MapGridGetElevationAt(x, y) == 3 && MapGridGetElevationAt(x, y) == 3
&& GetObjectEventIdByXYZ(x, y, 3) == OBJECT_EVENTS_COUNT) && GetObjectEventIdByPosition(x, y, 3) == OBJECT_EVENTS_COUNT)
{ {
QuestLogRecordPlayerAvatarGfxTransitionWithDuration(sQuestLogSurfDismountActionIds[direction], 16); QuestLogRecordPlayerAvatarGfxTransitionWithDuration(sQuestLogSurfDismountActionIds[direction], 16);
CreateStopSurfingTask(direction); CreateStopSurfingTask(direction);
@@ -610,9 +610,9 @@ static bool8 CanStopSurfing(s16 x, s16 y, u8 direction)
} }
} }
static bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) static bool8 ShouldJumpLedge(s16 x, s16 y, u8 direction)
{ {
if (GetLedgeJumpDirection(x, y, z) != 0) if (GetLedgeJumpDirection(x, y, direction) != DIR_NONE)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@@ -830,29 +830,29 @@ static void QL_TryRecordNPCStepWithDuration32(struct ObjectEvent * objectEvent,
QuestLogRecordNPCStepWithDuration(objectEvent->localId, objectEvent->mapNum, objectEvent->mapGroup, movementAction, 32); QuestLogRecordNPCStepWithDuration(objectEvent->localId, objectEvent->mapNum, objectEvent->mapGroup, movementAction, 32);
} }
void PlayerGoSlowest(u8 direction) void PlayerWalkSlower(u8 direction)
{ {
PlayerSetAnimId(GetWalkSlowerMovementAction(direction), 2); PlayerSetAnimId(GetWalkSlowerMovementAction(direction), 2);
} }
void PlayerGoSlow(u8 direction) void PlayerWalkSlow(u8 direction)
{ {
PlayerSetAnimId(GetWalkSlowMovementAction(direction), 2); PlayerSetAnimId(GetWalkSlowMovementAction(direction), 2);
} }
void PlayerGoSpeed1(u8 direction) void PlayerWalkNormal(u8 direction)
{ {
PlayerSetAnimId(GetWalkNormalMovementAction(direction), 2); PlayerSetAnimId(GetWalkNormalMovementAction(direction), 2);
} }
void PlayerGoSpeed2(u8 direction) void PlayerWalkFast(u8 direction)
{ {
PlayerSetAnimId(GetWalkFastMovementAction(direction), 2); PlayerSetAnimId(GetWalkFastMovementAction(direction), 2);
} }
void sub_805C134(u8 direction) void PlayerGlide(u8 direction)
{ {
PlayerSetAnimId(sub_8063FDC(direction), 2); PlayerSetAnimId(GetGlideMovementAction(direction), 2);
} }
void PlayerRideWaterCurrent(u8 direction) void PlayerRideWaterCurrent(u8 direction)
@@ -860,10 +860,9 @@ void PlayerRideWaterCurrent(u8 direction)
PlayerSetAnimId(GetRideWaterCurrentMovementAction(direction), 2); PlayerSetAnimId(GetRideWaterCurrentMovementAction(direction), 2);
} }
// fastest speed (4 speed) void PlayerWalkFaster(u8 direction)
void PlayerGoSpeed4(u8 direction)
{ {
PlayerSetAnimId(GetWalkFastestMovementAction(direction), 2); PlayerSetAnimId(GetWalkFasterMovementAction(direction), 2);
} }
void PlayerRun(u8 direction) void PlayerRun(u8 direction)
@@ -885,7 +884,7 @@ void PlayerOnBikeCollide(u8 direction)
void PlayerNotOnBikeCollide(u8 direction) void PlayerNotOnBikeCollide(u8 direction)
{ {
PlayCollisionSoundIfNotFacingWarp(direction); PlayCollisionSoundIfNotFacingWarp(direction);
PlayerSetAnimId(GetStepInPlaceDelay32AnimId(direction), 2); PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(direction), 2);
} }
void PlayerFaceDirection(u8 direction) void PlayerFaceDirection(u8 direction)
@@ -900,7 +899,7 @@ void PlayerFaceDirectionFast(u8 direction)
void PlayerTurnInPlace(u8 direction) void PlayerTurnInPlace(u8 direction)
{ {
PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(direction), 1); PlayerSetAnimId(GetWalkInPlaceFastMovementAction(direction), 1);
} }
void PlayerJumpLedge(u8 direction) void PlayerJumpLedge(u8 direction)
@@ -965,13 +964,13 @@ static void PlayerStandingHoppingWheelie(u8 direction)
static void PlayerMovingHoppingWheelie(u8 direction) static void PlayerMovingHoppingWheelie(u8 direction)
{ {
PlaySE(SE_BIKE_HOP); PlaySE(SE_BIKE_HOP);
PlayerSetAnimId(GetAcroWheelieHopDirectionMovementAction(direction), 2); PlayerSetAnimId(GetAcroWheelieHopMovementAction(direction), 2);
} }
static void PlayerLedgeHoppingWheelie(u8 direction) static void PlayerLedgeHoppingWheelie(u8 direction)
{ {
PlaySE(SE_BIKE_HOP); PlaySE(SE_BIKE_HOP);
PlayerSetAnimId(GetAcroWheelieJumpDirectionMovementAction(direction), 8); PlayerSetAnimId(GetAcroWheelieJumpMovementAction(direction), 8);
} }
static void PlayerAcroTurnJump(u8 direction) static void PlayerAcroTurnJump(u8 direction)
@@ -983,17 +982,17 @@ static void PlayerAcroTurnJump(u8 direction)
static void PlayerAcroWheelieCollide(u8 direction) static void PlayerAcroWheelieCollide(u8 direction)
{ {
PlaySE(SE_WALL_HIT); PlaySE(SE_WALL_HIT);
PlayerSetAnimId(GetAcroWheelieInPlaceDirectionMovementAction(direction), 2); PlayerSetAnimId(GetAcroWheelieInPlaceMovementAction(direction), 2);
} }
static void PlayerAcroPopWheelie(u8 direction) static void PlayerAcroPopWheelie(u8 direction)
{ {
PlayerSetAnimId(GetAcroPopWheelieMoveDirectionMovementAction(direction), 2); PlayerSetAnimId(GetAcroPopWheelieMoveMovementAction(direction), 2);
} }
static void PlayerAcroWheelieMove(u8 direction) static void PlayerAcroWheelieMove(u8 direction)
{ {
PlayerSetAnimId(GetAcroWheelieMoveDirectionMovementAction(direction), 2); PlayerSetAnimId(GetAcroWheelieMoveMovementAction(direction), 2);
} }
static bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) = { static bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) = {
@@ -1090,7 +1089,7 @@ u8 GetPlayerMovementDirection(void)
return gObjectEvents[gPlayerAvatar.objectEventId].movementDirection; return gObjectEvents[gPlayerAvatar.objectEventId].movementDirection;
} }
u8 PlayerGetZCoord(void) u8 PlayerGetElevation(void)
{ {
return gObjectEvents[gPlayerAvatar.objectEventId].previousElevation; return gObjectEvents[gPlayerAvatar.objectEventId].previousElevation;
} }
@@ -1215,7 +1214,7 @@ bool8 IsPlayerFacingSurfableFishableWater(void)
MoveCoords(playerObjEvent->facingDirection, &x, &y); MoveCoords(playerObjEvent->facingDirection, &x, &y);
if (GetCollisionAtCoords(playerObjEvent, x, y, playerObjEvent->facingDirection) == COLLISION_ELEVATION_MISMATCH if (GetCollisionAtCoords(playerObjEvent, x, y, playerObjEvent->facingDirection) == COLLISION_ELEVATION_MISMATCH
&& PlayerGetZCoord() == 3 && PlayerGetElevation() == 3
&& MetatileAtCoordsIsWaterTile(x, y) == TRUE) && MetatileAtCoordsIsWaterTile(x, y) == TRUE)
return TRUE; return TRUE;
else else
+54 -51
View File
@@ -12,14 +12,14 @@
#include "event_object_movement.h" #include "event_object_movement.h"
#include "field_fadetransition.h" #include "field_fadetransition.h"
#include "event_scripts.h" #include "event_scripts.h"
#include "constants/heal_locations.h"
#include "constants/maps.h"
static const u16 sFlashLevelPixelRadii[] = { static const u16 sFlashLevelToRadius[] = { 200, 72, 56, 40, 24 };
0x00c8, 0x0048, 0x0038, 0x0028, 0x0018 const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelToRadius) - 1;
};
const s32 gMaxFlashLevel = NELEMS(sFlashLevelPixelRadii) - 1; static const struct WindowTemplate sWindowTemplate_WhiteoutText =
{
static const struct WindowTemplate gUnknown_83C68E4 = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 5, .tilemapTop = 5,
@@ -29,7 +29,7 @@ static const struct WindowTemplate gUnknown_83C68E4 = {
.baseBlock = 1, .baseBlock = 1,
}; };
static const u8 gUnknown_83C68EC[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; static const u8 sWhiteoutTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
static void Task_EnableScriptAfterMusicFade(u8 taskId); static void Task_EnableScriptAfterMusicFade(u8 taskId);
static void Task_BarnDoorWipeChild(u8 taskId); static void Task_BarnDoorWipeChild(u8 taskId);
@@ -150,7 +150,7 @@ static void UpdateFlashLevelEffect(u8 taskId)
} }
} }
static void sub_807EF7C(u8 taskId) static void Task_WaitForFlashUpdate(u8 taskId)
{ {
if (!FuncIsActiveTask(UpdateFlashLevelEffect)) if (!FuncIsActiveTask(UpdateFlashLevelEffect))
{ {
@@ -159,13 +159,13 @@ static void sub_807EF7C(u8 taskId)
} }
} }
static void sub_807EFA4(void) static void StartWaitForFlashUpdate(void)
{ {
if (!FuncIsActiveTask(sub_807EF7C)) if (!FuncIsActiveTask(Task_WaitForFlashUpdate))
CreateTask(sub_807EF7C, 80); CreateTask(Task_WaitForFlashUpdate, 80);
} }
static u8 sub_807EFC8(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 destFlashRadius, bool32 clearScanlineEffect, u8 delta) static u8 StartUpdateFlashLevelEffect(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 destFlashRadius, bool32 clearScanlineEffect, u8 delta)
{ {
u8 taskId = CreateTask(UpdateFlashLevelEffect, 80); u8 taskId = CreateTask(UpdateFlashLevelEffect, 80);
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
@@ -190,14 +190,15 @@ static u8 sub_807EFC8(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 dest
#undef tFlashRadiusDelta #undef tFlashRadiusDelta
#undef tClearScanlineEffect #undef tClearScanlineEffect
void AnimateFlash(u8 flashLevel) // A higher flash level is a smaller flash radius (more darkness). 0 is full brightness
void AnimateFlash(u8 newFlashLevel)
{ {
u8 curFlashLevel = Overworld_GetFlashLevel(); u8 curFlashLevel = Overworld_GetFlashLevel();
bool32 value = FALSE; bool32 fullBrightness = FALSE;
if (!flashLevel) if (newFlashLevel == 0)
value = TRUE; fullBrightness = TRUE;
sub_807EFC8(120, 80, sFlashLevelPixelRadii[curFlashLevel], sFlashLevelPixelRadii[flashLevel], value, 2); StartUpdateFlashLevelEffect(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sFlashLevelToRadius[curFlashLevel], sFlashLevelToRadius[newFlashLevel], fullBrightness, 2);
sub_807EFA4(); StartWaitForFlashUpdate();
LockPlayerFieldControls(); LockPlayerFieldControls();
} }
@@ -205,7 +206,7 @@ void WriteFlashScanlineEffectBuffer(u8 flashLevel)
{ {
if (flashLevel) if (flashLevel)
{ {
SetFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], 120, 80, sFlashLevelPixelRadii[flashLevel]); SetFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], 120, 80, sFlashLevelToRadius[flashLevel]);
CpuFastCopy(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 240 * 8); CpuFastCopy(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 240 * 8);
} }
} }
@@ -283,15 +284,15 @@ void Task_BarnDoorWipe(u8 taskId)
if (data[10] == 0) if (data[10] == 0)
{ {
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 0)); SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 0));
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(240, 255)); SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(DISPLAY_WIDTH, 255));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 255)); SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 255));
SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0, 255)); SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0, 255));
} }
else else
{ {
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 120)); SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, DISPLAY_WIDTH / 2));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 255)); SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 255));
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(120, 255)); SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(DISPLAY_WIDTH / 2, 255));
SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0, 255)); SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0, 255));
} }
SetGpuReg(REG_OFFSET_WININ, 0); SetGpuReg(REG_OFFSET_WININ, 0);
@@ -323,8 +324,8 @@ static void Task_BarnDoorWipeChild(u8 taskId)
if (gTasks[parentTaskId].tDirection == DIR_WIPE_IN) if (gTasks[parentTaskId].tDirection == DIR_WIPE_IN)
{ {
lhs = tChildOffset; lhs = tChildOffset;
rhs = 240 - tChildOffset; rhs = DISPLAY_WIDTH - tChildOffset;
if (lhs > 120) if (lhs > DISPLAY_WIDTH / 2)
{ {
DestroyTask(taskId); DestroyTask(taskId);
return; return;
@@ -332,8 +333,8 @@ static void Task_BarnDoorWipeChild(u8 taskId)
} }
else else
{ {
lhs = 120 - tChildOffset; lhs = DISPLAY_WIDTH / 2 - tChildOffset;
rhs = 120 + tChildOffset; rhs = DISPLAY_WIDTH / 2 + tChildOffset;
if (lhs < 0) if (lhs < 0)
{ {
DestroyTask(taskId); DestroyTask(taskId);
@@ -341,15 +342,11 @@ static void Task_BarnDoorWipeChild(u8 taskId)
} }
} }
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, lhs)); SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, lhs));
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(rhs, 240)); SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(rhs, DISPLAY_WIDTH));
if (lhs <= 89) if (lhs < 90)
{
tChildOffset += 4; tChildOffset += 4;
}
else else
{
tChildOffset += 2; tChildOffset += 2;
}
} }
#undef tState #undef tState
@@ -358,24 +355,28 @@ static void Task_BarnDoorWipeChild(u8 taskId)
#undef DIR_WIPE_OUT #undef DIR_WIPE_OUT
#undef tChildOffset #undef tChildOffset
#define tState data[0]
#define tWindowId data[1]
#define tPrintState data[2]
static bool8 PrintWhiteOutRecoveryMessage(u8 taskId, const u8 *text, u8 x, u8 y) static bool8 PrintWhiteOutRecoveryMessage(u8 taskId, const u8 *text, u8 x, u8 y)
{ {
u8 windowId = gTasks[taskId].data[1]; u8 windowId = gTasks[taskId].tWindowId;
switch (gTasks[taskId].data[2]) switch (gTasks[taskId].tPrintState)
{ {
case 0: case 0:
FillWindowPixelBuffer(windowId, PIXEL_FILL(0)); FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
StringExpandPlaceholders(gStringVar4, text); StringExpandPlaceholders(gStringVar4, text);
AddTextPrinterParameterized4(windowId, FONT_2, x, y, 1, 0, gUnknown_83C68EC, 1, gStringVar4); AddTextPrinterParameterized4(windowId, FONT_2, x, y, 1, 0, sWhiteoutTextColors, 1, gStringVar4);
gTextFlags.canABSpeedUpPrint = FALSE; gTextFlags.canABSpeedUpPrint = FALSE;
gTasks[taskId].data[2] = 1; gTasks[taskId].tPrintState = 1;
break; break;
case 1: case 1:
RunTextPrinters(); RunTextPrinters();
if (!IsTextPrinterActive(windowId)) if (!IsTextPrinterActive(windowId))
{ {
gTasks[taskId].data[2] = 0; gTasks[taskId].tPrintState = 0;
return TRUE; return TRUE;
} }
break; break;
@@ -388,48 +389,50 @@ static void Task_RushInjuredPokemonToCenter(u8 taskId)
u8 windowId; u8 windowId;
const struct HealLocation *loc; const struct HealLocation *loc;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
windowId = AddWindow(&gUnknown_83C68E4); windowId = AddWindow(&sWindowTemplate_WhiteoutText);
gTasks[taskId].data[1] = windowId; gTasks[taskId].tWindowId = windowId;
Menu_LoadStdPalAt(0xF0); Menu_LoadStdPalAt(0xF0);
FillWindowPixelBuffer(windowId, PIXEL_FILL(0)); FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
PutWindowTilemap(windowId); PutWindowTilemap(windowId);
CopyWindowToVram(windowId, COPYWIN_FULL); CopyWindowToVram(windowId, COPYWIN_FULL);
loc = GetHealLocation(1);
// Scene changes if last heal location was the player's house
loc = GetHealLocation(SPAWN_PALLET_TOWN);
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == loc->group if (gSaveBlock1Ptr->lastHealLocation.mapGroup == loc->group
&& gSaveBlock1Ptr->lastHealLocation.mapNum == loc->map && gSaveBlock1Ptr->lastHealLocation.mapNum == loc->map
&& gSaveBlock1Ptr->lastHealLocation.warpId == -1 && gSaveBlock1Ptr->lastHealLocation.warpId == WARP_ID_NONE
&& gSaveBlock1Ptr->lastHealLocation.x == loc->x && gSaveBlock1Ptr->lastHealLocation.x == loc->x
&& gSaveBlock1Ptr->lastHealLocation.y == loc->y) && gSaveBlock1Ptr->lastHealLocation.y == loc->y)
gTasks[taskId].data[0] = 4; gTasks[taskId].tState = 4;
else else
gTasks[taskId].data[0] = 1; gTasks[taskId].tState = 1;
break; break;
case 1: case 1:
if (PrintWhiteOutRecoveryMessage(taskId, gText_PlayerScurriedToCenter, 2, 8)) if (PrintWhiteOutRecoveryMessage(taskId, gText_PlayerScurriedToCenter, 2, 8))
{ {
ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], 2); ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], DIR_NORTH);
++gTasks[taskId].data[0]; gTasks[taskId].tState++;
} }
break; break;
case 4: case 4:
if (PrintWhiteOutRecoveryMessage(taskId, gText_PlayerScurriedBackHome, 2, 8)) if (PrintWhiteOutRecoveryMessage(taskId, gText_PlayerScurriedBackHome, 2, 8))
{ {
ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], 2); ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], DIR_NORTH);
++gTasks[taskId].data[0]; gTasks[taskId].tState++;
} }
break; break;
case 2: case 2:
case 5: case 5:
windowId = gTasks[taskId].data[1]; windowId = gTasks[taskId].tWindowId;
ClearWindowTilemap(windowId); ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, COPYWIN_MAP); CopyWindowToVram(windowId, COPYWIN_MAP);
RemoveWindow(windowId); RemoveWindow(windowId);
palette_bg_faded_fill_black(); palette_bg_faded_fill_black();
FadeInFromBlack(); FadeInFromBlack();
++gTasks[taskId].data[0]; gTasks[taskId].tState++;
break; break;
case 3: case 3:
if (FieldFadeTransitionBackgroundEffectIsFinished() == TRUE) if (FieldFadeTransitionBackgroundEffectIsFinished() == TRUE)
@@ -455,5 +458,5 @@ void FieldCB_RushInjuredPokemonToCenter(void)
LockPlayerFieldControls(); LockPlayerFieldControls();
palette_bg_faded_fill_black(); palette_bg_faded_fill_black();
taskId = CreateTask(Task_RushInjuredPokemonToCenter, 10); taskId = CreateTask(Task_RushInjuredPokemonToCenter, 10);
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
} }
+1 -1
View File
@@ -1096,7 +1096,7 @@ void DrawElevatorCurrentFloorWindow(void)
if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE) if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
{ {
sElevatorCurrentFloorWindowId = AddWindow(&sElevatorCurrentFloorWindowTemplate); sElevatorCurrentFloorWindowId = AddWindow(&sElevatorCurrentFloorWindowTemplate);
TextWindow_SetStdFrame0_WithPal(sElevatorCurrentFloorWindowId, 0x21D, 0xD0); LoadStdWindowGfx(sElevatorCurrentFloorWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(sElevatorCurrentFloorWindowId, FALSE, 0x21D, 0xD); DrawStdFrameWithCustomTileAndPalette(sElevatorCurrentFloorWindowId, FALSE, 0x21D, 0xD);
AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, FONT_2, gText_NowOn, 0, 2, 0xFF, NULL); AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, FONT_2, gText_NowOn, 0, 2, 0xFF, NULL);
floorname = sFloorNamePointers[gSpecialVar_0x8005]; floorname = sFloorNamePointers[gSpecialVar_0x8005];
+2 -2
View File
@@ -145,7 +145,7 @@ bool8 SetUpFieldMove_Cut(void)
for (j = 0; j < CUT_SIDE; j++) for (j = 0; j < CUT_SIDE; j++)
{ {
x = gPlayerFacingPosition.x - 1 + j; x = gPlayerFacingPosition.x - 1 + j;
if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.height) if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.elevation)
{ {
if (MetatileAtCoordsIsGrassTile(x, y) == TRUE) if (MetatileAtCoordsIsGrassTile(x, y) == TRUE)
{ {
@@ -214,7 +214,7 @@ bool8 FldEff_CutGrass(void)
for (j = 0; j < CUT_SIDE; j++) for (j = 0; j < CUT_SIDE; j++)
{ {
x = gPlayerFacingPosition.x - 1 + j; x = gPlayerFacingPosition.x - 1 + j;
if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.height) if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.elevation)
{ {
if (MetatileAtCoordsIsGrassTile(x, y) == TRUE) if (MetatileAtCoordsIsGrassTile(x, y) == TRUE)
{ {
+2 -2
View File
@@ -28,8 +28,8 @@ bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId)
u8 mapObjId; u8 mapObjId;
GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
gPlayerFacingPosition.height = PlayerGetZCoord(); gPlayerFacingPosition.elevation = PlayerGetElevation();
mapObjId = GetObjectEventIdByXYZ(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.height); mapObjId = GetObjectEventIdByPosition(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.elevation);
if (gObjectEvents[mapObjId].graphicsId != graphicsId) if (gObjectEvents[mapObjId].graphicsId != graphicsId)
return FALSE; return FALSE;
gSpecialVar_LastTalked = gObjectEvents[mapObjId].localId; gSpecialVar_LastTalked = gObjectEvents[mapObjId].localId;
+1 -1
View File
@@ -620,7 +620,7 @@ static void Task_Hof_SpawnPlayerPic(u8 taskId)
ShowBg(3); ShowBg(3);
gTasks[taskId].data[4] = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId_Debug(gSaveBlock2Ptr->playerGender, TRUE), TRUE, 0x78, 0x48, 6, 0xFFFF); gTasks[taskId].data[4] = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId_Debug(gSaveBlock2Ptr->playerGender, TRUE), TRUE, 0x78, 0x48, 6, 0xFFFF);
AddWindow(&sWindowTemplate); AddWindow(&sWindowTemplate);
TextWindow_SetStdFrame0_WithPal(1, 0x21D, 0xD0); LoadStdWindowGfx(1, 0x21D, 0xD0);
gTasks[taskId].data[3] = 120; gTasks[taskId].data[3] = 120;
gTasks[taskId].func = Task_Hof_WaitAndPrintPlayerInfo; gTasks[taskId].func = Task_Hof_WaitAndPrintPlayerInfo;
} }
+6 -6
View File
@@ -5,7 +5,7 @@
static EWRAM_DATA u8 sHelpMessageWindowId = 0; static EWRAM_DATA u8 sHelpMessageWindowId = 0;
const u8 gUnknown_84566A8[] = INCBIN_U8("graphics/unknown/unknown_84566a8.bin"); const u8 gHelpMessageWindow_Gfx[] = INCBIN_U8("graphics/help_system/msg_window.4bpp");
static const struct WindowTemplate sHelpMessageWindowTemplate = { static const struct WindowTemplate sHelpMessageWindowTemplate = {
.bg = 0, .bg = 0,
@@ -19,12 +19,12 @@ static const struct WindowTemplate sHelpMessageWindowTemplate = {
void MapNamePopupWindowIdSetDummy(void) void MapNamePopupWindowIdSetDummy(void)
{ {
sHelpMessageWindowId = 0xFF; sHelpMessageWindowId = WINDOW_NONE;
} }
u8 CreateHelpMessageWindow(void) u8 CreateHelpMessageWindow(void)
{ {
if (sHelpMessageWindowId == 0xFF) if (sHelpMessageWindowId == WINDOW_NONE)
{ {
sHelpMessageWindowId = AddWindow(&sHelpMessageWindowTemplate); sHelpMessageWindowId = AddWindow(&sHelpMessageWindowTemplate);
PutWindowTilemap(sHelpMessageWindowId); PutWindowTilemap(sHelpMessageWindowId);
@@ -34,7 +34,7 @@ u8 CreateHelpMessageWindow(void)
void DestroyHelpMessageWindow(u8 a0) void DestroyHelpMessageWindow(u8 a0)
{ {
if (sHelpMessageWindowId != 0xFF) if (sHelpMessageWindowId != WINDOW_NONE)
{ {
FillWindowPixelBuffer(sHelpMessageWindowId, PIXEL_FILL(0)); FillWindowPixelBuffer(sHelpMessageWindowId, PIXEL_FILL(0));
ClearWindowTilemap(sHelpMessageWindowId); ClearWindowTilemap(sHelpMessageWindowId);
@@ -43,13 +43,13 @@ void DestroyHelpMessageWindow(u8 a0)
CopyWindowToVram(sHelpMessageWindowId, a0); CopyWindowToVram(sHelpMessageWindowId, a0);
RemoveWindow(sHelpMessageWindowId); RemoveWindow(sHelpMessageWindowId);
sHelpMessageWindowId = 0xFF; sHelpMessageWindowId = WINDOW_NONE;
} }
} }
void sub_8112F18(u8 windowId) void sub_8112F18(u8 windowId)
{ {
const u8 *ptr = gUnknown_84566A8; const u8 *ptr = gHelpMessageWindow_Gfx;
u8 *buffer; u8 *buffer;
u8 i, j; u8 i, j;
u8 width, height; u8 width, height;
+5 -5
View File
@@ -1069,11 +1069,11 @@ static void ItemPc_InitWindows(void)
InitWindows(sWindowTemplates); InitWindows(sWindowTemplates);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
TextWindow_SetUserSelectedFrame(0, 0x3C0, 0xE0); LoadUserWindowGfx(0, 0x3C0, 0xE0);
TextWindow_SetStdFrame0_WithPal(0, 0x3A3, 0xC0); LoadStdWindowGfx(0, 0x3A3, 0xC0);
TextWindow_LoadResourcesStdFrame0(0, 0x3AC, 0xB0); LoadMenuMessageWindowGfx(0, 0x3AC, 0xB0);
LoadPalette(stdpal_get(2), 0xD0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xD0, 0x20);
LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x20); LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
FillWindowPixelBuffer(i, 0x00); FillWindowPixelBuffer(i, 0x00);
+1 -1
View File
@@ -398,7 +398,7 @@ static void MoveRelearnerLoadBgGfx(void)
FillWindowPixelBuffer(7, PIXEL_FILL(1)); FillWindowPixelBuffer(7, PIXEL_FILL(1));
FillBgTilemapBufferRect(0, 0x000, 0, 0, 30, 20, 0xF); FillBgTilemapBufferRect(0, 0x000, 0, 0, 30, 20, 0xF);
SetBgTilemapBuffer(1, sMoveRelearner->bg1TilemapBuffer); SetBgTilemapBuffer(1, sMoveRelearner->bg1TilemapBuffer);
TextWindow_SetUserSelectedFrame(0, 1, 0xE0); LoadUserWindowGfx(0, 1, 0xE0);
ListMenuLoadStdPalAt(0xD0, 1); ListMenuLoadStdPalAt(0xD0, 1);
LoadPalette(gUnknown_8E97DDC, 0x00, 0x20); LoadPalette(gUnknown_8E97DDC, 0x00, 0x20);
DecompressAndLoadBgGfxUsingHeap(1, gUnknown_8E97DFC, 0, 0, 0); DecompressAndLoadBgGfxUsingHeap(1, gUnknown_8E97DFC, 0, 0, 0);
+1 -1
View File
@@ -1487,7 +1487,7 @@ void CB2_LinkError(void)
SetGpuReg(REG_OFFSET_BG1HOFS, 0); SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0); SetGpuReg(REG_OFFSET_BG1VOFS, 0);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON);
LoadPalette(gTMCaseMainWindowPalette, 0xf0, 0x20); LoadPalette(gStandardMenuPalette, 0xf0, 0x20);
gSoftResetDisabled = FALSE; gSoftResetDisabled = FALSE;
CreateTask(Task_DestroySelf, 0); CreateTask(Task_DestroySelf, 0);
StopMapMusic(); StopMapMusic();
+1 -1
View File
@@ -91,7 +91,7 @@ u32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str
switch (arg2) switch (arg2)
{ {
case 2: case 2:
TextWindow_SetUserSelectedFrame(sMysteryGiftLinkMenu.windowId, tileNum, palNum); LoadUserWindowGfx(sMysteryGiftLinkMenu.windowId, tileNum, palNum);
case 1: case 1:
DrawTextBorderOuter(sMysteryGiftLinkMenu.windowId, tileNum, palNum / 16); DrawTextBorderOuter(sMysteryGiftLinkMenu.windowId, tileNum, palNum / 16);
break; break;
+1 -1
View File
@@ -560,7 +560,7 @@ static bool8 DoInitMailView(void)
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
break; break;
case 12: case 12:
LoadPalette(stdpal_get(0), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
gPlttBufferUnfaded[15 * 16 + 10] = sGfxHeaders[sMailViewResources->mailType].textpals[0]; gPlttBufferUnfaded[15 * 16 + 10] = sGfxHeaders[sMailViewResources->mailType].textpals[0];
gPlttBufferFaded[15 * 16 + 10] = sGfxHeaders[sMailViewResources->mailType].textpals[0]; gPlttBufferFaded[15 * 16 + 10] = sGfxHeaders[sMailViewResources->mailType].textpals[0];
gPlttBufferUnfaded[15 * 16 + 11] = sGfxHeaders[sMailViewResources->mailType].textpals[1]; gPlttBufferUnfaded[15 * 16 + 11] = sGfxHeaders[sMailViewResources->mailType].textpals[1];
+3 -3
View File
@@ -677,14 +677,14 @@ static void PrintBadgeCount(void)
static void LoadUserFrameToBg(u8 bgId) static void LoadUserFrameToBg(u8 bgId)
{ {
LoadBgTiles(bgId, GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->tiles, 0x120, 0x1B1); LoadBgTiles(bgId, GetUserWindowGraphics(gSaveBlock2Ptr->optionsWindowFrameType)->tiles, 0x120, 0x1B1);
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->palette, 0x20, 0x20); LoadPalette(GetUserWindowGraphics(gSaveBlock2Ptr->optionsWindowFrameType)->palette, 0x20, 0x20);
MainMenu_EraseWindow(&sWindowTemplate[MAIN_MENU_WINDOW_ERROR]); MainMenu_EraseWindow(&sWindowTemplate[MAIN_MENU_WINDOW_ERROR]);
} }
static void SetStdFrame0OnBg(u8 bgId) static void SetStdFrame0OnBg(u8 bgId)
{ {
TextWindow_SetStdFrame0_WithPal(MAIN_MENU_WINDOW_NEWGAME_ONLY, 0x1B1, 0x20); LoadStdWindowGfx(MAIN_MENU_WINDOW_NEWGAME_ONLY, 0x1B1, 0x20);
MainMenu_EraseWindow(&sWindowTemplate[MAIN_MENU_WINDOW_ERROR]); MainMenu_EraseWindow(&sWindowTemplate[MAIN_MENU_WINDOW_ERROR]);
} }
+3 -3
View File
@@ -172,13 +172,13 @@ static u16 MapNamePopupCreateWindow(bool32 palintoFadedBuffer)
windowId = AddWindow(&windowTemplate); windowId = AddWindow(&windowTemplate);
if (palintoFadedBuffer) if (palintoFadedBuffer)
{ {
LoadPalette(stdpal_get(3), 0xd0, 0x20); LoadPalette(GetTextWindowPalette(3), 0xd0, 0x20);
} }
else else
{ {
CpuCopy16(stdpal_get(3), &gPlttBufferUnfaded[0xd0], 0x20); CpuCopy16(GetTextWindowPalette(3), &gPlttBufferUnfaded[0xd0], 0x20);
} }
sub_814FF6C(windowId, r6); LoadStdWindowTiles(windowId, r6);
DrawTextBorderOuter(windowId, r6, 0xD); DrawTextBorderOuter(windowId, r6, 0xD);
PutWindowTilemap(windowId); PutWindowTilemap(windowId);
MapNamePopupPrintMapNameOnWindow(windowId); MapNamePopupPrintMapNameOnWindow(windowId);
+1 -1
View File
@@ -180,7 +180,7 @@ u8 CreateTopBarWindowLoadPalette(u8 bg, u8 width, u8 yPos, u8 palette, u16 baseT
palette = 15 * 16; palette = 15 * 16;
else else
palette *= 16; palette *= 16;
LoadPalette(stdpal_get(2), palette, 0x20); LoadPalette(GetTextWindowPalette(2), palette, 0x20);
return sTopBarWindowId; return sTopBarWindowId;
} }
+1 -1
View File
@@ -290,7 +290,7 @@ void InitMonMarkingsMenu(struct MonMarkingsMenu *ptr)
static void BufferMenuWindowTiles(void) static void BufferMenuWindowTiles(void)
{ {
const struct TextWindowGraphics *frame = GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType); const struct TextWindowGraphics *frame = GetUserWindowGraphics(gSaveBlock2Ptr->optionsWindowFrameType);
sMenu->frameTiles = frame->tiles; sMenu->frameTiles = frame->tiles;
sMenu->framePalette = frame->palette; sMenu->framePalette = frame->palette;
sMenu->tileLoadState = 0; sMenu->tileLoadState = 0;
+1 -1
View File
@@ -124,7 +124,7 @@ void DrawMoneyBox(int amount, u8 x, u8 y)
sMoneyBoxWindowId = AddWindow(&template); sMoneyBoxWindowId = AddWindow(&template);
FillWindowPixelBuffer(sMoneyBoxWindowId, 0); FillWindowPixelBuffer(sMoneyBoxWindowId, 0);
PutWindowTilemap(sMoneyBoxWindowId); PutWindowTilemap(sMoneyBoxWindowId);
TextWindow_SetStdFrame0_WithPal(sMoneyBoxWindowId, 0x21D, 0xD0); LoadStdWindowGfx(sMoneyBoxWindowId, 0x21D, 0xD0);
PrintMoneyAmountInMoneyBoxWithBorder(sMoneyBoxWindowId, 0x21D, 13, amount); PrintMoneyAmountInMoneyBoxWithBorder(sMoneyBoxWindowId, 0x21D, 13, amount);
} }
+3 -3
View File
@@ -390,8 +390,8 @@ bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader)
SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(1, Alloc(0x800));
SetBgTilemapBuffer(0, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(0x800));
LoadUserWindowBorderGfx(0, 10, 0xE0); LoadUserWindowGfx2(0, 10, 0xE0);
DrawWindowBorderWithStdpal3(0, 1, 0xF0); LoadStdWindowGfxOnBg(0, 1, 0xF0);
DecompressAndLoadBgGfxUsingHeap(3, gUnkTextboxBorderGfx, 0x100, 0, 0); DecompressAndLoadBgGfxUsingHeap(3, gUnkTextboxBorderGfx, 0x100, 0, 0);
InitWindows(sMainWindows); InitWindows(sMainWindows);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
@@ -403,7 +403,7 @@ bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader)
break; break;
case 1: case 1:
LoadPalette(gUnkTextboxBorderPal, 0, 0x20); LoadPalette(gUnkTextboxBorderPal, 0, 0x20);
LoadPalette(stdpal_get(2), 0xd0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xd0, 0x20);
FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11);
+1 -1
View File
@@ -1874,7 +1874,7 @@ static void LoadPalettes(void)
{ {
LoadPalette(gNamingScreenMenu_Pal, 0, sizeof(gNamingScreenMenu_Pal)); LoadPalette(gNamingScreenMenu_Pal, 0, sizeof(gNamingScreenMenu_Pal));
LoadPalette(gNamingScreenKeyboard_Pal, 0xA0, 0x20); LoadPalette(gNamingScreenKeyboard_Pal, 0xA0, 0x20);
LoadPalette(stdpal_get(2), 0xB0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xB0, 0x20);
} }
static void DecompressToBgTilemapBuffer(u8 bg, const u32 *src) static void DecompressToBgTilemapBuffer(u8 bg, const u32 *src)
+34 -28
View File
@@ -19,21 +19,26 @@ static EWRAM_DATA u16 sTempTileDataBufferCursor = {0};
static EWRAM_DATA void *sTempTileDataBuffers[0x20] = {NULL}; static EWRAM_DATA void *sTempTileDataBuffers[0x20] = {NULL};
static EWRAM_DATA u8 sStartMenuWindowId = {0}; static EWRAM_DATA u8 sStartMenuWindowId = {0};
static const u16 gUnknown_841EF48[] = INCBIN_U16("graphics/unknown/unk_841EF48.4bpp"); static const u16 sUnusedWindow_Gfx[] = INCBIN_U16("graphics/text_window/unused.4bpp");
const u16 gMenuMessageWindow_Gfx[] = INCBIN_U16("graphics/text_window/menu_message.4bpp");
const u16 gUnknown_841F1C8[] = INCBIN_U16("graphics/text_window/unk_841F1C8.4bpp"); const u16 gStandardMenuPalette[] = INCBIN_U16("graphics/interface/std_menu.gbapal");
const u16 gTMCaseMainWindowPalette[] = INCBIN_U16("graphics/tm_case/unk_841F408.gbapal");
static const u8 gUnknown_841F428[] = { 8, 4, 1 }; static const u8 sTextSpeedFrameDelays[] =
{
[OPTIONS_TEXT_SPEED_SLOW] = 8,
[OPTIONS_TEXT_SPEED_MID] = 4,
[OPTIONS_TEXT_SPEED_FAST] = 1
};
static const struct WindowTemplate sStandardTextBox_WindowTemplates[] = static const struct WindowTemplate sStandardTextBox_WindowTemplates[] =
{ {
{ {
.bg = 0, .bg = 0,
.tilemapLeft = 0x2, .tilemapLeft = 2,
.tilemapTop = 0xF, .tilemapTop = 15,
.width = 0x1A, .width = 26,
.height = 0x4, .height = 4,
.paletteNum = DLG_WINDOW_PALETTE_NUM, .paletteNum = DLG_WINDOW_PALETTE_NUM,
.baseBlock = 0x198, .baseBlock = 0x198,
}, },
@@ -43,10 +48,10 @@ static const struct WindowTemplate sStandardTextBox_WindowTemplates[] =
static const struct WindowTemplate sYesNo_WindowTemplate = static const struct WindowTemplate sYesNo_WindowTemplate =
{ {
.bg = 0, .bg = 0,
.tilemapLeft = 0x15, .tilemapLeft = 21,
.tilemapTop = 0x9, .tilemapTop = 9,
.width = 0x6, .width = 6,
.height = 0x4, .height = 4,
.paletteNum = DLG_WINDOW_PALETTE_NUM, .paletteNum = DLG_WINDOW_PALETTE_NUM,
.baseBlock = 0x125, .baseBlock = 0x125,
}; };
@@ -455,14 +460,14 @@ void LoadStdWindowFrameGfx(void)
if (gQuestLogState == QL_STATE_PLAYBACK) if (gQuestLogState == QL_STATE_PLAYBACK)
{ {
gTextFlags.autoScroll = 1; gTextFlags.autoScroll = 1;
TextWindow_LoadTilesStdFrame1(0, DLG_WINDOW_BASE_TILE_NUM); LoadQuestLogWindowTiles(0, DLG_WINDOW_BASE_TILE_NUM);
} }
else else
{ {
Menu_LoadStdPal(); Menu_LoadStdPal();
TextWindow_LoadResourcesStdFrame0(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10); LoadMenuMessageWindowGfx(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
} }
TextWindow_SetUserSelectedFrame(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10); LoadUserWindowGfx(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10);
} }
void DrawDialogueFrame(u8 windowId, bool8 copyToVram) void DrawDialogueFrame(u8 windowId, bool8 copyToVram)
@@ -522,7 +527,7 @@ static void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u
static void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) static void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{ {
if (!IsMsgSignPost() || gQuestLogState == QL_STATE_PLAYBACK) if (!IsMsgSignpost() || gQuestLogState == QL_STATE_PLAYBACK)
{ {
FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 0, tilemapLeft - 2, tilemapTop - 1, 1, 1, DLG_WINDOW_PALETTE_NUM); FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 0, tilemapLeft - 2, tilemapTop - 1, 1, 1, DLG_WINDOW_PALETTE_NUM);
FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 1, tilemapLeft - 1, tilemapTop - 1, 1, 1, DLG_WINDOW_PALETTE_NUM); FillBgTilemapBufferRect(bg, DLG_WINDOW_BASE_TILE_NUM + 1, tilemapLeft - 1, tilemapTop - 1, 1, 1, DLG_WINDOW_PALETTE_NUM);
@@ -609,35 +614,36 @@ void sub_80F7768(u8 windowId, bool8 copyToVram)
if (gQuestLogState == QL_STATE_PLAYBACK) if (gQuestLogState == QL_STATE_PLAYBACK)
{ {
gTextFlags.autoScroll = 1; gTextFlags.autoScroll = 1;
TextWindow_LoadTilesStdFrame1(0, DLG_WINDOW_BASE_TILE_NUM); LoadQuestLogWindowTiles(0, DLG_WINDOW_BASE_TILE_NUM);
} }
else else
{ {
TextWindow_LoadResourcesStdFrame0(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10); LoadMenuMessageWindowGfx(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
} }
DrawDialogFrameWithCustomTileAndPalette(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM); DrawDialogFrameWithCustomTileAndPalette(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM);
} }
void Menu_LoadStdPal(void) void Menu_LoadStdPal(void)
{ {
LoadPalette(gTMCaseMainWindowPalette, STD_WINDOW_PALETTE_NUM * 0x10, 0x14); LoadPalette(gStandardMenuPalette, STD_WINDOW_PALETTE_NUM * 0x10, 0x14);
} }
void Menu_LoadStdPalAt(u16 offset) void Menu_LoadStdPalAt(u16 offset)
{ {
LoadPalette(gTMCaseMainWindowPalette, offset, 0x14); LoadPalette(gStandardMenuPalette, offset, 0x14);
} }
static const u16 *GetTmCaseMainWindowPalette(void) // Unused
static const u16 *GetStdMenuPalette(void)
{ {
return gTMCaseMainWindowPalette; return gStandardMenuPalette;
} }
static u16 GetStdPalColor(u8 colorNum) static u16 GetStdPalColor(u8 colorNum)
{ {
if (colorNum > 0xF) if (colorNum > 0xF)
colorNum = 0; colorNum = 0;
return gTMCaseMainWindowPalette[colorNum]; return gStandardMenuPalette[colorNum];
} }
void DisplayItemMessageOnField(u8 taskId, u8 fontId, const u8 *string, TaskFunc callback) void DisplayItemMessageOnField(u8 taskId, u8 fontId, const u8 *string, TaskFunc callback)
@@ -662,7 +668,7 @@ u8 GetTextSpeedSetting(void)
u32 speed; u32 speed;
if (gSaveBlock2Ptr->optionsTextSpeed > OPTIONS_TEXT_SPEED_FAST) if (gSaveBlock2Ptr->optionsTextSpeed > OPTIONS_TEXT_SPEED_FAST)
gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID; gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID;
return gUnknown_841F428[gSaveBlock2Ptr->optionsTextSpeed]; return sTextSpeedFrameDelays[gSaveBlock2Ptr->optionsTextSpeed];
} }
u8 CreateStartMenuWindow(u8 height) u8 CreateStartMenuWindow(u8 height)
@@ -702,7 +708,7 @@ u16 GetStdWindowBaseTileNum(void)
void DrawHelpMessageWindowWithText(const u8 * text) void DrawHelpMessageWindowWithText(const u8 * text)
{ {
sub_814FE6C(CreateHelpMessageWindow(), DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM); LoadHelpMessageWindowGfx(CreateHelpMessageWindow(), DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM);
PrintTextOnHelpMessageWindow(text, 2); PrintTextOnHelpMessageWindow(text, 2);
} }
@@ -711,11 +717,11 @@ void DestroyHelpMessageWindow_(void)
DestroyHelpMessageWindow(2); DestroyHelpMessageWindow(2);
} }
void LoadSignPostWindowFrameGfx(void) void LoadSignpostWindowFrameGfx(void)
{ {
Menu_LoadStdPal(); Menu_LoadStdPal();
sub_814FEEC(0, DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM); LoadSignpostWindowGfx(0, DLG_WINDOW_BASE_TILE_NUM, 0x10 * DLG_WINDOW_PALETTE_NUM);
TextWindow_SetUserSelectedFrame(0, STD_WINDOW_BASE_TILE_NUM, 0x10 * STD_WINDOW_PALETTE_NUM); LoadUserWindowGfx(0, STD_WINDOW_BASE_TILE_NUM, 0x10 * STD_WINDOW_PALETTE_NUM);
} }
void SetDefaultFontsPointer(void) void SetDefaultFontsPointer(void)
+4 -4
View File
@@ -548,7 +548,7 @@ static void Task_OaksSpeech1(u8 taskId)
InitTextBoxGfxAndPrinters(); InitTextBoxGfxAndPrinters();
Menu_LoadStdPalAt(0xD0); Menu_LoadStdPalAt(0xD0);
LoadPalette(sHelpDocsPalette, 0x000, 0x080); LoadPalette(sHelpDocsPalette, 0x000, 0x080);
LoadPalette(stdpal_get(2) + 15, 0x000, 0x002); LoadPalette(GetTextWindowPalette(2) + 15, 0x000, 0x002);
break; break;
case 5: case 5:
sOakSpeechResources->textSpeed = GetTextSpeedSetting(); sOakSpeechResources->textSpeed = GetTextSpeedSetting();
@@ -629,7 +629,7 @@ static void Task_OakSpeech4(u8 taskId)
} }
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
} }
BeginNormalPaletteFade(0xFFFFDFFF, -1, 16, 0, stdpal_get(2)[15]); BeginNormalPaletteFade(0xFFFFDFFF, -1, 16, 0, GetTextWindowPalette(2)[15]);
gTasks[taskId].func = Task_OaksSpeech2; gTasks[taskId].func = Task_OaksSpeech2;
} }
@@ -642,7 +642,7 @@ static void Task_OaksSpeech2(u8 taskId)
gTasks[taskId].data[15] = 1; gTasks[taskId].data[15] = 1;
if (sOakSpeechResources->unk_0012 < 2) if (sOakSpeechResources->unk_0012 < 2)
{ {
BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, stdpal_get(2)[15]); BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, GetTextWindowPalette(2)[15]);
} }
} }
else else
@@ -650,7 +650,7 @@ static void Task_OaksSpeech2(u8 taskId)
if (sOakSpeechResources->unk_0012 != 0) if (sOakSpeechResources->unk_0012 != 0)
{ {
gTasks[taskId].data[15] = -1; gTasks[taskId].data[15] = -1;
BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, stdpal_get(2)[15]); BeginNormalPaletteFade(0xFFFFDFFF, -1, 0, 16, GetTextWindowPalette(2)[15]);
} }
else else
return; return;
+6 -6
View File
@@ -337,17 +337,17 @@ static bool8 LoadOptionMenuPalette(void)
switch (sOptionMenuPtr->loadPaletteState) switch (sOptionMenuPtr->loadPaletteState)
{ {
case 0: case 0:
LoadBgTiles(1, GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA); LoadBgTiles(1, GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA);
break; break;
case 1: case 1:
LoadPalette(GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20); LoadPalette(GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20);
break; break;
case 2: case 2:
LoadPalette(sOptionMenuPalette, 0x10, 0x20); LoadPalette(sOptionMenuPalette, 0x10, 0x20);
LoadPalette(stdpal_get(2), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xF0, 0x20);
break; break;
case 3: case 3:
DrawWindowBorderWithStdpal3(1, 0x1B3, 0x30); LoadStdWindowGfxOnBg(1, 0x1B3, 0x30);
break; break;
default: default:
return TRUE; return TRUE;
@@ -381,8 +381,8 @@ static void Task_OptionMenu(u8 taskId)
sOptionMenuPtr->loadState++; sOptionMenuPtr->loadState++;
break; break;
case 2: case 2:
LoadBgTiles(1, GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA); LoadBgTiles(1, GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA);
LoadPalette(GetWindowFrameTilesPal(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20); LoadPalette(GetUserWindowGraphics(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20);
BufferOptionMenuString(sOptionMenuPtr->cursorPos); BufferOptionMenuString(sOptionMenuPtr->cursorPos);
break; break;
case 3: case 3:
+6 -6
View File
@@ -3033,7 +3033,7 @@ static void LoadCableClubPlayer(s32 linkPlayerId, s32 myPlayerId, struct CableCl
GetLinkPlayerCoords(linkPlayerId, &x, &y); GetLinkPlayerCoords(linkPlayerId, &x, &y);
player->pos.x = x; player->pos.x = x;
player->pos.y = y; player->pos.y = y;
player->pos.height = GetLinkPlayerElevation(linkPlayerId); player->pos.elevation = GetLinkPlayerElevation(linkPlayerId);
player->metatileBehavior = MapGridGetMetatileBehaviorAt(x, y); player->metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
} }
@@ -3086,7 +3086,7 @@ static const u8 *TryInteractWithPlayer(struct CableClubPlayer *player)
otherPlayerPos = player->pos; otherPlayerPos = player->pos;
otherPlayerPos.x += gDirectionToVectors[player->facing].x; otherPlayerPos.x += gDirectionToVectors[player->facing].x;
otherPlayerPos.y += gDirectionToVectors[player->facing].y; otherPlayerPos.y += gDirectionToVectors[player->facing].y;
otherPlayerPos.height = 0; otherPlayerPos.elevation = 0;
linkPlayerId = GetLinkPlayerIdAt(otherPlayerPos.x, otherPlayerPos.y); linkPlayerId = GetLinkPlayerIdAt(otherPlayerPos.x, otherPlayerPos.y);
if (linkPlayerId != 4) if (linkPlayerId != 4)
@@ -3296,7 +3296,7 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1
objEvent->previousCoords.y = y; objEvent->previousCoords.y = y;
SetSpritePosToMapCoords(x, y, &objEvent->initialCoords.x, &objEvent->initialCoords.y); SetSpritePosToMapCoords(x, y, &objEvent->initialCoords.x, &objEvent->initialCoords.y);
objEvent->initialCoords.x += 8; objEvent->initialCoords.x += 8;
ObjectEventUpdateZCoord(objEvent); ObjectEventUpdateElevation(objEvent);
} }
static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 dir) static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 dir)
@@ -3435,7 +3435,7 @@ static bool8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *linkPlayer
{ {
objEvent->directionSequenceIndex = 16; objEvent->directionSequenceIndex = 16;
ShiftObjectEventCoords(objEvent, x, y); ShiftObjectEventCoords(objEvent, x, y);
ObjectEventUpdateZCoord(objEvent); ObjectEventUpdateElevation(objEvent);
return TRUE; return TRUE;
} }
} }
@@ -3537,8 +3537,8 @@ static void SpriteCB_LinkPlayer(struct Sprite *sprite)
struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerObjEvent->objEventId]; struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerObjEvent->objEventId];
sprite->x = objEvent->initialCoords.x; sprite->x = objEvent->initialCoords.x;
sprite->y = objEvent->initialCoords.y; sprite->y = objEvent->initialCoords.y;
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1); SetObjectSubpriorityByElevation(objEvent->previousElevation, sprite, 1);
sprite->oam.priority = ZCoordToPriority(objEvent->previousElevation); sprite->oam.priority = ElevationToPriority(objEvent->previousElevation);
if (!linkPlayerObjEvent->movementMode != MOVEMENT_MODE_FREE) if (!linkPlayerObjEvent->movementMode != MOVEMENT_MODE_FREE)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(linkDirection(objEvent))); StartSpriteAnim(sprite, GetFaceDirectionAnimNum(linkDirection(objEvent)));
+7 -7
View File
@@ -2006,8 +2006,8 @@ static void Task_FirstBattleEnterParty_WaitFadeNormal(u8 taskId)
{ {
if (!gPaletteFade.active) if (!gPaletteFade.active)
{ {
TextWindow_SetUserSelectedFrame(0, 0x4F, 0xD0); LoadUserWindowGfx(0, 0x4F, 0xD0);
TextWindow_SetStdFrame0_WithPal(0, 0x58, 0xF0); LoadStdWindowGfx(0, 0x58, 0xF0);
if (gPartyMenu.action == PARTY_ACTION_USE_ITEM) if (gPartyMenu.action == PARTY_ACTION_USE_ITEM)
DisplayPartyMenuStdMessage(PARTY_MSG_USE_ON_WHICH_MON); DisplayPartyMenuStdMessage(PARTY_MSG_USE_ON_WHICH_MON);
else else
@@ -2117,10 +2117,10 @@ static void InitPartyMenuWindows(u8 layout)
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
for (i = 0; i < PARTY_SIZE; ++i) for (i = 0; i < PARTY_SIZE; ++i)
FillWindowPixelBuffer(i, PIXEL_FILL(0)); FillWindowPixelBuffer(i, PIXEL_FILL(0));
TextWindow_SetUserSelectedFrame(0, 0x4F, 0xD0); LoadUserWindowGfx(0, 0x4F, 0xD0);
TextWindow_SetStdFrame0_WithPal(0, 0x58, 0xF0); LoadStdWindowGfx(0, 0x58, 0xF0);
LoadPalette(stdpal_get(2), 0xC0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xC0, 0x20);
LoadPalette(stdpal_get(0), 0xE0, 0x20); LoadPalette(GetTextWindowPalette(0), 0xE0, 0x20);
} }
static void CreateCancelConfirmWindows(bool8 chooseMultiple) static void CreateCancelConfirmWindows(bool8 chooseMultiple)
@@ -2603,7 +2603,7 @@ static bool8 FirstBattleEnterParty_CreateWindowAndMsg1Printer(void)
{ {
u8 windowId = AddWindow(&sWindowTemplate_FirstBattleOakVoiceover); u8 windowId = AddWindow(&sWindowTemplate_FirstBattleOakVoiceover);
TextWindow_LoadResourcesStdFrame0(windowId, 0x4F, 0xE0); LoadMenuMessageWindowGfx(windowId, 0x4F, 0xE0);
DrawDialogFrameWithCustomTileAndPalette(windowId, 1, 0x4F, 0xE); DrawDialogFrameWithCustomTileAndPalette(windowId, 1, 0x4F, 0xE);
PartyMenu_Oak_PrintText(windowId, gText_OakImportantToGetToKnowPokemonThroughly); PartyMenu_Oak_PrintText(windowId, gText_OakImportantToGetToKnowPokemonThroughly);
return windowId; return windowId;
+3 -3
View File
@@ -3053,8 +3053,8 @@ static void LoadPokeJumpGfx(void)
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 0x20, 0x20); FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 0x20, 0x20);
PrintScoreSuffixes(); PrintScoreSuffixes();
PrintScore(0); PrintScore(0);
DrawWindowBorderWithStdpal3(0, 1, 0xE0); LoadStdWindowGfxOnBg(0, 1, 0xE0);
LoadUserWindowBorderGfx(0, 0x00A, 0xD0); LoadUserWindowGfx2(0, 0x00A, 0xD0);
CopyBgTilemapBufferToVram(BG_INTERFACE); CopyBgTilemapBufferToVram(BG_INTERFACE);
CopyBgTilemapBufferToVram(BG_VENUSAUR); CopyBgTilemapBufferToVram(BG_VENUSAUR);
CopyBgTilemapBufferToVram(BG_BONUSES); CopyBgTilemapBufferToVram(BG_BONUSES);
@@ -4554,7 +4554,7 @@ static void PrintRecordsText(u16 windowId)
recordNums[1] = records->bestJumpScore; recordNums[1] = records->bestJumpScore;
recordNums[2] = records->excellentsInRow; recordNums[2] = records->excellentsInRow;
TextWindow_SetStdFrame0_WithPal(windowId, 0x21D, 0xD0); LoadStdWindowGfx(windowId, 0x21D, 0xD0);
DrawTextBorderOuter(windowId, 0x21D, 0xD); DrawTextBorderOuter(windowId, 0x21D, 0xD);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized5(windowId, FONT_2, gText_PkmnJumpRecords, 0, 0, TEXT_SKIP_DRAW, NULL, 1, 0); AddTextPrinterParameterized5(windowId, FONT_2, gText_PkmnJumpRecords, 0, 0, TEXT_SKIP_DRAW, NULL, 1, 0);
+1 -1
View File
@@ -341,7 +341,7 @@ void InitPokemonSpecialAnimScene(struct PokemonSpecialAnimScene * buffer, u16 an
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 32, 32); FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 32, 32);
LoadBgGfxByAnimType(animType); LoadBgGfxByAnimType(animType);
FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(0, PIXEL_FILL(0));
TextWindow_SetUserSelectedFrame(0, 0x000, 0xe0); LoadUserWindowGfx(0, 0x000, 0xe0);
CopyWindowToVram(0, COPYWIN_FULL); CopyWindowToVram(0, COPYWIN_FULL);
ShowBg(0); ShowBg(0);
ShowBg(3); ShowBg(3);
+2 -2
View File
@@ -167,7 +167,7 @@ static bool8 MultiMove_Function_Single(void)
if (!IsDma3ManagerBusyWithBgCopy()) if (!IsDma3ManagerBusyWithBgCopy())
{ {
SetCursorPriorityTo1(); SetCursorPriorityTo1();
LoadPalette(stdpal_get(3), 0xD0, 0x20); LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
ShowBg(0); ShowBg(0);
return FALSE; return FALSE;
} }
@@ -273,7 +273,7 @@ static bool8 MultiMove_Function_PlaceMons(void)
case 3: case 3:
if (!IsDma3ManagerBusyWithBgCopy()) if (!IsDma3ManagerBusyWithBgCopy())
{ {
LoadPalette(stdpal_get(3), 0xD0, 0x20); LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
SetCursorPriorityTo1(); SetCursorPriorityTo1();
ShowBg(0); ShowBg(0);
return FALSE; return FALSE;
+2 -2
View File
@@ -534,7 +534,7 @@ static void Task_InitPokeStorage(u8 taskId)
PutWindowTilemap(0); PutWindowTilemap(0);
ClearWindowTilemap(1); ClearWindowTilemap(1);
CpuFill32(0, (void *)VRAM, 0x200); CpuFill32(0, (void *)VRAM, 0x200);
TextWindow_SetUserSelectedFrame(1, 0xB, 0xE0); LoadUserWindowGfx(1, 0xB, 0xE0);
break; break;
case 3: case 3:
ResetAllBgCoords(); ResetAllBgCoords();
@@ -2545,7 +2545,7 @@ static bool8 DoShowPartyMenu(void)
static void InitPokeStorageBg0(void) static void InitPokeStorageBg0(void)
{ {
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29));
TextWindow_SetStdFrame0_WithPal(1, 2, 0xD0); LoadStdWindowGfx(1, 2, 0xD0);
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
} }
+3 -3
View File
@@ -459,7 +459,7 @@ void sub_8110FCC(void)
static bool8 FieldCB2_QuestLogStartPlaybackWithWarpExit(void) static bool8 FieldCB2_QuestLogStartPlaybackWithWarpExit(void)
{ {
LoadPalette(stdpal_get(4), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(4), 0xF0, 0x20);
SetQuestLogState(QL_STATE_PLAYBACK); SetQuestLogState(QL_STATE_PLAYBACK);
FieldCB_DefaultWarpExit(); FieldCB_DefaultWarpExit();
sQuestLogCurrentScene = (struct UnkStruct_203AE94){}; sQuestLogCurrentScene = (struct UnkStruct_203AE94){};
@@ -469,7 +469,7 @@ static bool8 FieldCB2_QuestLogStartPlaybackWithWarpExit(void)
static bool8 FieldCB2_QuestLogStartPlaybackStandingInPlace(void) static bool8 FieldCB2_QuestLogStartPlaybackStandingInPlace(void)
{ {
LoadPalette(stdpal_get(4), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(4), 0xF0, 0x20);
SetQuestLogState(QL_STATE_PLAYBACK); SetQuestLogState(QL_STATE_PLAYBACK);
FieldCB_WarpExitFadeFromBlack(); FieldCB_WarpExitFadeFromBlack();
sQuestLogCurrentScene = (struct UnkStruct_203AE94){}; sQuestLogCurrentScene = (struct UnkStruct_203AE94){};
@@ -1076,7 +1076,7 @@ void QuestLog_BackUpPalette(u16 offset, u16 size)
static bool8 FieldCB2_FinalScene(void) static bool8 FieldCB2_FinalScene(void)
{ {
LoadPalette(stdpal_get(4), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(4), 0xF0, 0x20);
DrawPreviouslyOnQuestHeader(0); DrawPreviouslyOnQuestHeader(0);
FieldCB_WarpExitFadeFromBlack(); FieldCB_WarpExitFadeFromBlack();
CreateTask(Task_FinalScene_WaitFade, 0xFF); CreateTask(Task_FinalScene_WaitFade, 0xFF);
+2 -2
View File
@@ -2212,13 +2212,13 @@ bool8 ScrCmd_removecoins(struct ScriptContext * ctx)
bool8 ScrCmd_signmsg(struct ScriptContext * ctx) bool8 ScrCmd_signmsg(struct ScriptContext * ctx)
{ {
MsgSetSignPost(); MsgSetSignpost();
return FALSE; return FALSE;
} }
bool8 ScrCmd_normalmsg(struct ScriptContext * ctx) bool8 ScrCmd_normalmsg(struct ScriptContext * ctx)
{ {
MsgSetNotSignPost(); MsgSetNotSignpost();
return FALSE; return FALSE;
} }
+9 -9
View File
@@ -36,7 +36,7 @@ static u8 sMsgBoxWalkawayDisabled;
static u8 sMsgBoxIsCancelable; static u8 sMsgBoxIsCancelable;
static u8 sQuestLogInput; static u8 sQuestLogInput;
static u8 sQuestLogInputIsDpad; static u8 sQuestLogInputIsDpad;
static u8 sMsgIsSignPost; static u8 sMsgIsSignpost;
extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTable[];
extern ScrCmdFunc gScriptCmdTableEnd[]; extern ScrCmdFunc gScriptCmdTableEnd[];
@@ -276,28 +276,28 @@ bool8 CanWalkAwayToCancelMsgBox(void)
return FALSE; return FALSE;
} }
void MsgSetSignPost(void) void MsgSetSignpost(void)
{ {
sMsgIsSignPost = TRUE; sMsgIsSignpost = TRUE;
} }
void MsgSetNotSignPost(void) void MsgSetNotSignpost(void)
{ {
sMsgIsSignPost = FALSE; sMsgIsSignpost = FALSE;
} }
bool8 IsMsgSignPost(void) bool8 IsMsgSignpost(void)
{ {
if(sMsgIsSignPost == TRUE) if(sMsgIsSignpost == TRUE)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
void ResetFacingNpcOrSignPostVars(void) void ResetFacingNpcOrSignpostVars(void)
{ {
ResetContextNpcTextColor(); ResetContextNpcTextColor();
MsgSetNotSignPost(); MsgSetNotSignpost();
} }
// The ScriptContext_* functions work with the primary script context, // The ScriptContext_* functions work with the primary script context,
+1 -1
View File
@@ -212,7 +212,7 @@ static void CB2_SetUpSeagallopScene(void)
CopyToBgTilemapBufferRect(3, sWaterTilemap_WB, 0, 0, 32, 32); CopyToBgTilemapBufferRect(3, sWaterTilemap_WB, 0, 0, 32, 32);
} }
LoadPalette(sWaterPal, 0x40, 0x20); LoadPalette(sWaterPal, 0x40, 0x20);
LoadPalette(stdpal_get(2), 0xF0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xF0, 0x20);
gMain.state++; gMain.state++;
break; break;
case 4: case 4:
+3 -3
View File
@@ -791,11 +791,11 @@ static void BuyMenuDrawMapMetatileLayer(u16 *dest, s16 offset1, s16 offset2, con
static void BuyMenuCollectObjectEventData(void) static void BuyMenuCollectObjectEventData(void)
{ {
s16 facingX, facingY; s16 facingX, facingY;
u8 x, y, z; u8 x, y, elevation;
u8 num = 0; u8 num = 0;
GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY); GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY);
z = PlayerGetZCoord(); elevation = PlayerGetElevation();
for (y = 0; y < OBJECT_EVENTS_COUNT; y++) for (y = 0; y < OBJECT_EVENTS_COUNT; y++)
sViewportObjectEvents[y][OBJECT_EVENT_ID] = OBJECT_EVENTS_COUNT; sViewportObjectEvents[y][OBJECT_EVENT_ID] = OBJECT_EVENTS_COUNT;
@@ -804,7 +804,7 @@ static void BuyMenuCollectObjectEventData(void)
{ {
for (x = 0; x < 7; x++) for (x = 0; x < 7; x++)
{ {
u8 eventObjId = GetObjectEventIdByXYZ(facingX - 3 + x, facingY - 2 + y, z); u8 eventObjId = GetObjectEventIdByPosition(facingX - 3 + x, facingY - 2 + y, elevation);
if (eventObjId != OBJECT_EVENTS_COUNT) if (eventObjId != OBJECT_EVENTS_COUNT)
{ {
sViewportObjectEvents[num][OBJECT_EVENT_ID] = eventObjId; sViewportObjectEvents[num][OBJECT_EVENT_ID] = eventObjId;
+3 -3
View File
@@ -1975,8 +1975,8 @@ static bool8 SlotsTask_GraphicsInit(u8 * state, struct SlotMachineSetupTaskData
LoadPalette(sBgPal_50, 0x50, 0x20); LoadPalette(sBgPal_50, 0x50, 0x20);
LoadPalette(sBgPal_70, 0x70, 0x60); LoadPalette(sBgPal_70, 0x70, 0x60);
LoadColor(RGB(30, 30, 31), pal); LoadColor(RGB(30, 30, 31), pal);
LoadUserWindowBorderGfx(0, 0x00A, 0xD0); LoadUserWindowGfx2(0, 0x00A, 0xD0);
DrawWindowBorderWithStdpal3(0, 0x001, 0xF0); LoadStdWindowGfxOnBg(0, 0x001, 0xF0);
SetBgTilemapBuffer(0, ptr->bg0TilemapBuffer); SetBgTilemapBuffer(0, ptr->bg0TilemapBuffer);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 2, 32, 30); FillBgTilemapBufferRect_Palette0(0, 0, 0, 2, 32, 30);
@@ -1984,7 +1984,7 @@ static bool8 SlotsTask_GraphicsInit(u8 * state, struct SlotMachineSetupTaskData
DecompressAndCopyTileDataToVram(1, sBg1Map, 0, 0, 1); DecompressAndCopyTileDataToVram(1, sBg1Map, 0, 0, 1);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
LoadPalette(stdpal_get(2), 0xE0, 0x20); LoadPalette(GetTextWindowPalette(2), 0xE0, 0x20);
FillWindowPixelBuffer(1, 0xFF); FillWindowPixelBuffer(1, 0xFF);
PutWindowTilemap(1); PutWindowTilemap(1);
+2 -2
View File
@@ -870,7 +870,7 @@ bool32 DoSetUpSaveAfterLinkBattle(u8 *state)
ResetBgsAndClearDma3BusyFlags(FALSE); ResetBgsAndClearDma3BusyFlags(FALSE);
InitBgsFromTemplates(0, sBGTemplates_AfterLinkSaveMessage, NELEMS(sBGTemplates_AfterLinkSaveMessage)); InitBgsFromTemplates(0, sBGTemplates_AfterLinkSaveMessage, NELEMS(sBGTemplates_AfterLinkSaveMessage));
InitWindows(sWindowTemplates_AfterLinkSaveMessage); InitWindows(sWindowTemplates_AfterLinkSaveMessage);
TextWindow_SetStdFrame0_WithPal(0, 0x008, 0xF0); LoadStdWindowGfx(0, 0x008, 0xF0);
break; break;
case 3: case 3:
ShowBg(0); ShowBg(0);
@@ -957,7 +957,7 @@ static void PrintSaveStats(void)
u8 y; u8 y;
u8 x; u8 x;
sSaveStatsWindowId = AddWindow(&sSaveStatsWindowTemplate); sSaveStatsWindowId = AddWindow(&sSaveStatsWindowTemplate);
TextWindow_SetStdFrame0_WithPal(sSaveStatsWindowId, 0x21D, 0xD0); LoadStdWindowGfx(sSaveStatsWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(sSaveStatsWindowId, FALSE, 0x21D, 0x0D); DrawStdFrameWithCustomTileAndPalette(sSaveStatsWindowId, FALSE, 0x21D, 0x0D);
SaveStatToString(SAVE_STAT_LOCATION, gStringVar4, 8); SaveStatToString(SAVE_STAT_LOCATION, gStringVar4, 8);
x = (u32)(112 - GetStringWidth(FONT_2, gStringVar4, -1)) / 2; x = (u32)(112 - GetStringWidth(FONT_2, gStringVar4, -1)) / 2;
+1 -1
View File
@@ -42,7 +42,7 @@ static const struct SpriteSheet sUnknown_81EA68C[] =
static const struct SpritePalette sUnknown_81EA6A4[] = static const struct SpritePalette sUnknown_81EA6A4[] =
{ {
{gTMCaseMainWindowPalette, 0x8000}, {gStandardMenuPalette, 0x8000},
{NULL} {NULL}
}; };
+53 -42
View File
@@ -2,95 +2,106 @@
#include "gflib.h" #include "gflib.h"
#include "text_window.h" #include "text_window.h"
#include "text_window_graphics.h" #include "text_window_graphics.h"
#include "quest_log.h" #include "help_message.h"
#include "new_menu_helpers.h"
extern const u16 gUnknown_841F1C8[]; static void LoadUserWindowGfxByFrame(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx);
void LoadWindowGfx(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx); // Unused
// Equivalent to LoadHelpMessageWindowGfx, but takes a bg id directly
void sub_814FD04(u8 bgId, u16 destOffset, u8 palIdx) static void LoadHelpMessageWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(bgId, gUnknown_84566A8, 0x280, destOffset); LoadBgTiles(bgId, gHelpMessageWindow_Gfx, 0x280, destOffset);
LoadPalette(stdpal_get(2), palIdx, 32); LoadPalette(GetTextWindowPalette(2), palIdx, 32);
} }
void sub_814FD38(u8 bgId, u16 destOffset, u8 palIdx) // Unused
// Equivalent to LoadMenuMessageWindowGfx, but takes a bg id directly
static void LoadMenuMessageWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(bgId, gUnknown_841F1C8, 0x280, destOffset); LoadBgTiles(bgId, gMenuMessageWindow_Gfx, 0x280, destOffset);
LoadPalette(stdpal_get(0), palIdx, 32); LoadPalette(GetTextWindowPalette(0), palIdx, 32);
} }
void sub_814FD6C(u8 bgId, u16 destOffset, u8 palIdx) // Unused
// Equivalent to LoadSignpostWindowGfx, but takes a bg id directly
static void LoadSignpostWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(bgId, gUnknown_8470B0C, 0x260, destOffset); LoadBgTiles(bgId, gSignpostWindow_Gfx, 0x260, destOffset);
LoadPalette(stdpal_get(1), palIdx, 32); LoadPalette(GetTextWindowPalette(1), palIdx, 32);
} }
void DrawWindowBorderWithStdpal3(u8 bgId, u16 destOffset, u8 palIdx) // Equivalent to LoadStdWindowGfx, but takes a bg id directly
void LoadStdWindowGfxOnBg(u8 bgId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(bgId, gStdFrame0, 0x120, destOffset); LoadBgTiles(bgId, gStdTextWindow_Gfx, 0x120, destOffset);
LoadPalette(stdpal_get(3), palIdx, 32); LoadPalette(GetTextWindowPalette(3), palIdx, 32);
} }
void sub_814FDD4(u8 bgId, u16 destOffset) // Unused
// Equivalent to LoadQuestLogWindowTiles, but takes a bg id directly
static void LoadQuestLogWindowTilesOnBg(u8 bgId, u16 destOffset)
{ {
LoadBgTiles(bgId, gStdFrame1, 0x280, destOffset); LoadBgTiles(bgId, gQuestLogWindow_Gfx, 0x280, destOffset);
} }
void sub_814FDF4(u8 bgId, u8 frameType, u16 destOffset, u8 palIdx) // Unused
// Equivalent to LoadUserWindowGfxByFrame, but takes a bg id directly
static void LoadUserWindowGfxByFrameOnBg(u8 bgId, u8 frameType, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(bgId, gUserFrames[frameType].tiles, 0x120, destOffset); LoadBgTiles(bgId, gUserFrames[frameType].tiles, 0x120, destOffset);
LoadPalette(gUserFrames[frameType].palette, palIdx, 32); LoadPalette(gUserFrames[frameType].palette, palIdx, 32);
} }
void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palIdx) // Identical to LoadUserWindowGfx
void LoadUserWindowGfx2(u8 windowId, u16 destOffset, u8 palIdx)
{ {
LoadWindowGfx(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx); LoadUserWindowGfxByFrame(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx);
} }
void sub_814FE6C(u8 windowId, u16 destOffset, u8 palIdx) void LoadHelpMessageWindowGfx(u8 windowId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_84566A8, 0x280, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gHelpMessageWindow_Gfx, 0x280, destOffset);
LoadPalette(stdpal_get(2), palIdx, 32); LoadPalette(GetTextWindowPalette(2), palIdx, 32);
} }
void TextWindow_LoadResourcesStdFrame0(u8 windowId, u16 destOffset, u8 palIdx) void LoadMenuMessageWindowGfx(u8 windowId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_841F1C8, 0x280, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gMenuMessageWindow_Gfx, 0x280, destOffset);
LoadPalette(stdpal_get(0), palIdx, 32); LoadPalette(GetTextWindowPalette(0), palIdx, 32);
} }
void sub_814FEEC(u8 windowId, u16 destOffset, u8 palIdx) void LoadSignpostWindowGfx(u8 windowId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUnknown_8470B0C, 0x260, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gSignpostWindow_Gfx, 0x260, destOffset);
LoadPalette(stdpal_get(1), palIdx, 32); LoadPalette(GetTextWindowPalette(1), palIdx, 32);
} }
void TextWindow_SetStdFrame0_WithPal(u8 windowId, u16 destOffset, u8 palIdx) void LoadStdWindowGfx(u8 windowId, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdFrame0, 0x120, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdTextWindow_Gfx, 0x120, destOffset);
LoadPalette(stdpal_get(3), palIdx, 32); LoadPalette(GetTextWindowPalette(3), palIdx, 32);
} }
void sub_814FF6C(u8 windowId, u16 destOffset) void LoadStdWindowTiles(u8 windowId, u16 destOffset)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdFrame0, 0x120, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdTextWindow_Gfx, 0x120, destOffset);
} }
void TextWindow_LoadTilesStdFrame1(u8 windowId, u16 destOffset) void LoadQuestLogWindowTiles(u8 windowId, u16 destOffset)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gStdFrame1, 0x280, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gQuestLogWindow_Gfx, 0x280, destOffset);
} }
void LoadWindowGfx(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx) static void LoadUserWindowGfxByFrame(u8 windowId, u8 frameType, u16 destOffset, u8 palIdx)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUserFrames[frameType].tiles, 0x120, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gUserFrames[frameType].tiles, 0x120, destOffset);
LoadPalette(gUserFrames[frameType].palette, palIdx, 32); LoadPalette(gUserFrames[frameType].palette, palIdx, 32);
} }
void TextWindow_SetUserSelectedFrame(u8 windowId, u16 destOffset, u8 palIdx) void LoadUserWindowGfx(u8 windowId, u16 destOffset, u8 palIdx)
{ {
LoadWindowGfx(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx); LoadUserWindowGfxByFrame(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palIdx);
} }
void DrawTextBorderOuter(u8 windowId, u16 tileNum, u8 palNum) void DrawTextBorderOuter(u8 windowId, u16 tileNum, u8 palNum)
@@ -140,7 +151,7 @@ void rbox_fill_rectangle(u8 windowId)
FillBgTilemapBufferRect(bgLayer, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0x11); FillBgTilemapBufferRect(bgLayer, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0x11);
} }
const u16 *stdpal_get(u8 id) const u16 *GetTextWindowPalette(u8 id)
{ {
switch (id) switch (id)
{ {
@@ -162,5 +173,5 @@ const u16 *stdpal_get(u8 id)
break; break;
} }
return (const u16 *)(gUnknown_8471DEC) + id; return (const u16 *)(gTextWindowPalettes) + id;
} }
+45 -40
View File
@@ -1,36 +1,37 @@
#include "global.h" #include "global.h"
#include "text_window_graphics.h" #include "text_window_graphics.h"
const u16 gUnknown_8470B0C[] = INCBIN_U16("graphics/text_window/unk_8470B0C.4bpp"); const u16 gSignpostWindow_Gfx[] = INCBIN_U16("graphics/text_window/signpost.4bpp");
static const u16 gUnknown_8470D6C[] = INCBIN_U16("graphics/text_window/unk_8470D6C.4bpp"); static const u16 sUserFrame_Type1_Gfx[] = INCBIN_U16("graphics/text_window/type1.4bpp");
static const u16 gUnknown_8470E8C[] = INCBIN_U16("graphics/text_window/unk_8470E8C.4bpp"); static const u16 sUserFrame_Type2_Gfx[] = INCBIN_U16("graphics/text_window/type2.4bpp");
static const u16 gUnk_Empty_Space_8470FAC[16] = {0}; static const u16 sUserFrame_Empty1[16] = {0};
static const u16 gUnknown_8470FCC[] = INCBIN_U16("graphics/text_window/unk_8470FCC.4bpp"); static const u16 sUserFrame_Type3_Gfx[] = INCBIN_U16("graphics/text_window/type3.4bpp");
static const u16 gUnknown_84710EC[] = INCBIN_U16("graphics/text_window/unk_84710EC.4bpp"); static const u16 sUserFrame_Type4_Gfx[] = INCBIN_U16("graphics/text_window/type4.4bpp");
static const u16 gUnknown_847120C[] = INCBIN_U16("graphics/text_window/unk_847120C.4bpp"); static const u16 sUserFrame_Type5_Gfx[] = INCBIN_U16("graphics/text_window/type5.4bpp");
static const u16 gUnknown_847132C[] = INCBIN_U16("graphics/text_window/unk_847132C.4bpp"); static const u16 sUserFrame_Type6_Gfx[] = INCBIN_U16("graphics/text_window/type6.4bpp");
static const u16 gUnknown_847144C[] = INCBIN_U16("graphics/text_window/unk_847144C.4bpp"); static const u16 sUserFrame_Type7_Gfx[] = INCBIN_U16("graphics/text_window/type7.4bpp");
static const u16 gUnknown_847156C[] = INCBIN_U16("graphics/text_window/unk_847156C.4bpp"); static const u16 sUserFrame_Type8_Gfx[] = INCBIN_U16("graphics/text_window/type8.4bpp");
static const u16 gUnk_Empty_Space_847168C[16] = {0}; static const u16 sUserFrame_Empty2[16] = {0};
static const u16 gUnknown_84716AC[] = INCBIN_U16("graphics/text_window/unk_84716AC.4bpp"); static const u16 sUserFrame_Type9_Gfx[] = INCBIN_U16("graphics/text_window/type9.4bpp");
static const u16 gUnknown_84717CC[] = INCBIN_U16("graphics/text_window/unk_84717CC.4bpp"); static const u16 sUserFrame_Type10_Gfx[] = INCBIN_U16("graphics/text_window/type10.4bpp");
static const u16 gUnk_Empty_Space_84718EC[16] = {0}; static const u16 sUserFrame_Empty3[16] = {0};
static const u16 gUnknown_847190C[] = INCBIN_U16("graphics/text_window/unk_8470D6C.gbapal");
static const u16 gUnknown_847192C[] = INCBIN_U16("graphics/text_window/unk_8470E8C.gbapal");
static const u16 gUnknown_847194C[] = INCBIN_U16("graphics/text_window/unk_8470FCC.gbapal");
static const u16 gUnknown_847196C[] = INCBIN_U16("graphics/text_window/unk_84710EC.gbapal");
static const u16 gUnknown_847198C[] = INCBIN_U16("graphics/text_window/unk_847120C.gbapal");
static const u16 gUnknown_84719AC[] = INCBIN_U16("graphics/text_window/unk_847132C.gbapal");
static const u16 gUnknown_84719CC[] = INCBIN_U16("graphics/text_window/unk_847144C.gbapal");
static const u16 gUnknown_84719EC[] = INCBIN_U16("graphics/text_window/unk_847156C.gbapal");
static const u16 gUnknown_8471A0C[] = INCBIN_U16("graphics/text_window/unk_84716AC.gbapal");
static const u16 gUnknown_8471A2C[] = INCBIN_U16("graphics/text_window/unk_84717CC.gbapal");
const u16 gStdFrame0[] = INCBIN_U16("graphics/text_window/unk_8471A4C.4bpp"); static const u16 sUserFrame_Type1_Pal[] = INCBIN_U16("graphics/text_window/type1.gbapal");
const u16 gStdFrame1[] = INCBIN_U16("graphics/text_window/unk_8471B6C.4bpp"); static const u16 sUserFrame_Type2_Pal[] = INCBIN_U16("graphics/text_window/type2.gbapal");
static const u16 sUserFrame_Type3_Pal[] = INCBIN_U16("graphics/text_window/type3.gbapal");
static const u16 sUserFrame_Type4_Pal[] = INCBIN_U16("graphics/text_window/type4.gbapal");
static const u16 sUserFrame_Type5_Pal[] = INCBIN_U16("graphics/text_window/type5.gbapal");
static const u16 sUserFrame_Type6_Pal[] = INCBIN_U16("graphics/text_window/type6.gbapal");
static const u16 sUserFrame_Type7_Pal[] = INCBIN_U16("graphics/text_window/type7.gbapal");
static const u16 sUserFrame_Type8_Pal[] = INCBIN_U16("graphics/text_window/type8.gbapal");
static const u16 sUserFrame_Type9_Pal[] = INCBIN_U16("graphics/text_window/type9.gbapal");
static const u16 sUserFrame_Type10_Pal[] = INCBIN_U16("graphics/text_window/type10.gbapal");
const u16 gUnknown_8471DEC[][16] = { const u16 gStdTextWindow_Gfx[] = INCBIN_U16("graphics/text_window/std.4bpp");
const u16 gQuestLogWindow_Gfx[] = INCBIN_U16("graphics/text_window/quest_log.4bpp");
const u16 gTextWindowPalettes[][16] = {
INCBIN_U16("graphics/text_window/stdpal_0.gbapal"), INCBIN_U16("graphics/text_window/stdpal_0.gbapal"),
INCBIN_U16("graphics/text_window/stdpal_1.gbapal"), INCBIN_U16("graphics/text_window/stdpal_1.gbapal"),
INCBIN_U16("graphics/text_window/stdpal_2.gbapal"), INCBIN_U16("graphics/text_window/stdpal_2.gbapal"),
@@ -39,21 +40,25 @@ const u16 gUnknown_8471DEC[][16] = {
}; };
const struct TextWindowGraphics gUserFrames[] = { const struct TextWindowGraphics gUserFrames[] = {
{gUnknown_8470D6C, gUnknown_847190C}, {sUserFrame_Type1_Gfx, sUserFrame_Type1_Pal},
{gUnknown_8470E8C, gUnknown_847192C}, {sUserFrame_Type2_Gfx, sUserFrame_Type2_Pal},
{gUnknown_8470FCC, gUnknown_847194C}, {sUserFrame_Type3_Gfx, sUserFrame_Type3_Pal},
{gUnknown_84710EC, gUnknown_847196C}, {sUserFrame_Type4_Gfx, sUserFrame_Type4_Pal},
{gUnknown_847120C, gUnknown_847198C}, {sUserFrame_Type5_Gfx, sUserFrame_Type5_Pal},
{gUnknown_847132C, gUnknown_84719AC}, {sUserFrame_Type6_Gfx, sUserFrame_Type6_Pal},
{gUnknown_847144C, gUnknown_84719CC}, {sUserFrame_Type7_Gfx, sUserFrame_Type7_Pal},
{gUnknown_847156C, gUnknown_84719EC}, {sUserFrame_Type8_Gfx, sUserFrame_Type8_Pal},
{gUnknown_84716AC, gUnknown_8471A0C}, {sUserFrame_Type9_Gfx, sUserFrame_Type9_Pal},
{gUnknown_84717CC, gUnknown_8471A2C} {sUserFrame_Type10_Gfx, sUserFrame_Type10_Pal},
}; // NELEMS = 10 };
const struct TextWindowGraphics *GetWindowFrameTilesPal(u8 idx) const struct TextWindowGraphics *GetUserWindowGraphics(u8 idx)
{ {
if (idx >= 20) // if (idx >= NELEMS(gUserFrames)) #ifdef BUGFIX
if (idx >= ARRAY_COUNT(gUserFrames))
#else
if (idx >= 20) // Using the RSE number of elements
#endif
return &gUserFrames[0]; return &gUserFrames[0];
else else
return &gUserFrames[idx]; return &gUserFrames[idx];
+5 -5
View File
@@ -1290,11 +1290,11 @@ static void InitWindowTemplatesAndPals(void)
InitWindows(sWindowTemplates); InitWindows(sWindowTemplates);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
TextWindow_SetUserSelectedFrame(0, 0x5B, 0xE0); LoadUserWindowGfx(0, 0x5B, 0xE0);
TextWindow_LoadResourcesStdFrame0(0, 0x64, 0xB0); LoadMenuMessageWindowGfx(0, 0x64, 0xB0);
TextWindow_SetStdFrame0_WithPal(0, 0x78, 0xD0); LoadStdWindowGfx(0, 0x78, 0xD0);
LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x20); LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadPalette(gTMCaseMainWindowPalette, 0xA0, 0x20); LoadPalette(gStandardMenuPalette, 0xA0, 0x20);
LoadPalette(sPal3Override, 0xF6, 0x04); LoadPalette(sPal3Override, 0xF6, 0x04);
LoadPalette(sPal3Override, 0xD6, 0x04); LoadPalette(sPal3Override, 0xD6, 0x04);
ListMenuLoadStdPalAt(0xc0, 0x01); ListMenuLoadStdPalAt(0xc0, 0x01);
+4 -4
View File
@@ -682,8 +682,8 @@ static void InitTradeMenuResources(void)
ResetPaletteFade(); ResetPaletteFade();
gPaletteFade.bufferTransferDisabled = TRUE; gPaletteFade.bufferTransferDisabled = TRUE;
SetVBlankCallback(VblankCB_Trade); SetVBlankCallback(VblankCB_Trade);
LoadPalette(gTMCaseMainWindowPalette, 0xF0, 0x14); LoadPalette(gStandardMenuPalette, 0xF0, 0x14);
LoadPalette(gTMCaseMainWindowPalette, 0xD0, 0x14); LoadPalette(gStandardMenuPalette, 0xD0, 0x14);
ResetBgsAndClearDma3BusyFlags(FALSE); ResetBgsAndClearDma3BusyFlags(FALSE);
InitBgsFromTemplates(0, sBgTemplates, NELEMS(sBgTemplates)); InitBgsFromTemplates(0, sBgTemplates, NELEMS(sBgTemplates));
SetBgTilemapBuffer(1, sTradeMenuResourcesPtr->tilemapBuffer); SetBgTilemapBuffer(1, sTradeMenuResourcesPtr->tilemapBuffer);
@@ -697,8 +697,8 @@ static void InitTradeMenuResources(void)
FillWindowPixelBuffer(i, PIXEL_FILL(0)); FillWindowPixelBuffer(i, PIXEL_FILL(0));
} }
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF); FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF);
TextWindow_SetStdFrame0_WithPal(0, 0x014, 0xC0); LoadStdWindowGfx(0, 0x014, 0xC0);
TextWindow_SetUserSelectedFrame(2, 0x001, 0xE0); LoadUserWindowGfx(2, 0x001, 0xE0);
LoadMonIconPalettes(); LoadMonIconPalettes();
sTradeMenuResourcesPtr->state = 0; sTradeMenuResourcesPtr->state = 0;
sTradeMenuResourcesPtr->tradeMenuCBnum = 0; sTradeMenuResourcesPtr->tradeMenuCBnum = 0;
+1 -1
View File
@@ -121,7 +121,7 @@ void CB2_UnionRoomBattle(void)
FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF); FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF);
TextWindow_SetStdFrame0_WithPal(0, 1, 0xD0); LoadStdWindowGfx(0, 1, 0xD0);
Menu_LoadStdPal(); Menu_LoadStdPal();
SetVBlankCallback(VBlankCB_UnionRoomBattle); SetVBlankCallback(VBlankCB_UnionRoomBattle);
gMain.state++; gMain.state++;
+3 -3
View File
@@ -1307,9 +1307,9 @@ static void LoadWin1(void)
static void LoadWin3(void) static void LoadWin3(void)
{ {
FillWindowPixelBuffer(3, PIXEL_FILL(1)); FillWindowPixelBuffer(3, PIXEL_FILL(1));
TextWindow_SetUserSelectedFrame(3, 1, 0xD0); LoadUserWindowGfx(3, 1, 0xD0);
TextWindow_SetStdFrame0_WithPal(3, 0xA, 0x20); LoadStdWindowGfx(3, 0xA, 0x20);
LoadPalette(gTMCaseMainWindowPalette, 0xE0, 0x20); LoadPalette(gStandardMenuPalette, 0xE0, 0x20);
} }
static void InitScanlineEffect(void) static void InitScanlineEffect(void)