Begin synchronising with pokeruby

This commit is contained in:
Slawter666 2018-10-16 14:55:16 +01:00
parent a9abb930aa
commit 3aff112127
15 changed files with 286 additions and 278 deletions

View File

@ -954,7 +954,7 @@ PlayCollisionSoundIfNotFacingWarp: @ 808B9EC
lsls r0, 2
adds r0, r2
ldrb r0, [r0, 0x1E]
ldr r2, =gUnknown_084974D8
ldr r2, =sArrowWarpMetatileBehaviorChecks
subs r1, r4, 0x1
lsls r1, 2
adds r1, r2
@ -1334,7 +1334,7 @@ GetRivalAvatarGraphicsIdByStateIdAndGender: @ 808BD3C
lsls r0, 24
lsls r1, 24
lsrs r1, 24
ldr r2, =gUnknown_084974E8
ldr r2, =sRivalAvatarGfxIds
lsrs r0, 23
adds r1, r0
adds r1, r2
@ -1349,7 +1349,7 @@ GetPlayerAvatarGraphicsIdByStateIdAndGender: @ 808BD54
lsls r0, 24
lsls r1, 24
lsrs r1, 24
ldr r2, =gUnknown_084974F8
ldr r2, =sPlayerAvatarGfxIds
lsrs r0, 23
adds r1, r0
adds r1, r2
@ -2046,7 +2046,7 @@ sub_808C280: @ 808C280
mov r0, sp
strh r1, [r0]
movs r6, 0x1
ldr r1, =gUnknown_08497520
ldr r1, =sArrowWarpMetatileBehaviorChecks2
mov r9, r1
mov r4, sp
mov r7, sp
@ -2783,7 +2783,7 @@ Task_Fish: @ 808C8C0
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0849755C
ldr r5, =sFishingStateFuncs
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
@ -2958,7 +2958,7 @@ fish4: @ 808CA20
push {r4,r5,lr}
sub sp, 0x10
adds r4, r0, 0
ldr r1, =gUnknown_084975A8
ldr r1, =gText_Dot
add r0, sp, 0xC
movs r2, 0x2
bl memcpy
@ -3151,7 +3151,7 @@ fish7: @ 808CBA4
push {r4,lr}
sub sp, 0x8
adds r4, r0, 0
ldr r1, =gUnknown_084975AA
ldr r1, =sReelTimeouts
mov r0, sp
movs r2, 0x6
bl memcpy
@ -3851,7 +3851,7 @@ _0808D14A:
strh r0, [r7, 0x22]
movs r2, 0x22
ldrsh r1, [r7, r2]
ldr r0, =gUnknown_03005DE8
ldr r0, =gTotalCameraPixelOffsetY
movs r2, 0
ldrsh r0, [r0, r2]
adds r1, r0

View File

@ -1,3 +1,3 @@
gUnknown_03005DD0
gUnknown_03005DE8
gUnknown_03005DEC
gFieldCamera
gTotalCameraPixelOffsetY
gTotalCameraPixelOffsetX

View File

@ -7,16 +7,16 @@ struct CameraObject
{
void (*callback)(struct CameraObject *);
u32 spriteId;
s32 unk8;
s32 unkC;
s32 movementSpeedX;
s32 movementSpeedY;
s32 x;
s32 y;
};
// Exported RAM declarations
extern struct CameraObject gUnknown_03005DD0;
extern u16 gUnknown_03005DEC;
extern u16 gUnknown_03005DE8;
extern struct CameraObject gFieldCamera;
extern u16 gTotalCameraPixelOffsetX;
extern u16 gTotalCameraPixelOffsetY;
// Exported ROM declarations
void DrawWholeMapView(void);

View File

@ -17,7 +17,7 @@ u8 FindTallGrassFieldEffectSpriteId(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s
void sub_8155F80(struct Sprite*);
void UpdateShadowFieldEffect(struct Sprite*);
void UpdateTallGrassFieldEffect(struct Sprite*);
void sub_81561D0(struct Sprite*);
void WaitFieldEffectSpriteAnim(struct Sprite*);
void UpdateAshFieldEffect(struct Sprite*);
void UpdateSurfBlobFieldEffect(struct Sprite*);
void sub_8156194(struct Sprite*);

View File

@ -77,7 +77,7 @@ bool8 MetatileBehavior_IsBerryTreeSoil(u8);
bool8 MetatileBehavior_IsAshGrass(u8);
bool8 MetatileBehavior_IsFootprints(u8);
bool8 MetatileBehavior_IsBridge(u8);
u8 MetatileBehavior_GetBridgeSth(u8);
u8 MetatileBehavior_GetBridgeType(u8);
u8 MetatileBehavior_8089510(u8);
bool8 MetatileBehavior_IsLandWildEncounter(u8);
bool8 MetatileBehavior_IsWaterWildEncounter(u8);

View File

@ -665,7 +665,7 @@ u8 BattleSetup_GetTerrainId(void)
return BATTLE_TERRAIN_MOUNTAIN;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
{
if (MetatileBehavior_GetBridgeSth(tileBehavior))
if (MetatileBehavior_GetBridgeType(tileBehavior))
return BATTLE_TERRAIN_POND;
if (MetatileBehavior_IsBridge(tileBehavior) == TRUE)
return BATTLE_TERRAIN_WATER;

View File

@ -91,7 +91,7 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Ripple[] =
gFieldEffectObjectImageAnim_850CAE0,
};
const struct SpriteTemplate gFieldEffectObjectTemplate_Ripple = {0xFFFF, 0x1005, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Ripple, gFieldEffectObjectPicTable_Ripple, gDummySpriteAffineAnimTable, sub_81561D0};
const struct SpriteTemplate gFieldEffectObjectTemplate_Ripple = {0xFFFF, 0x1005, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Ripple, gFieldEffectObjectPicTable_Ripple, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim};
const struct SpriteFrameImage gFieldEffectObjectPicTable_Ash[] = {
overworld_frame(gFieldEffectObjectPic_Ash, 2, 2, 0),
@ -562,7 +562,7 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown17[] =
gFieldEffectObjectImageAnim_850D05C,
};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown17 = {0xFFFF, 0x1005, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown17, gFieldEffectObjectPicTable_Unknown17, gDummySpriteAffineAnimTable, sub_81561D0};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown17 = {0xFFFF, 0x1005, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown17, gFieldEffectObjectPicTable_Unknown17, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim};
const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown18[] = {
overworld_frame(gFieldEffectObjectPic_Unknown18, 2, 2, 0),
@ -587,7 +587,7 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown18[] =
gFieldEffectObjectImageAnim_850D0C0,
};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown18 = {0xFFFF, 0x1005, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown18, gFieldEffectObjectPicTable_Unknown18, gDummySpriteAffineAnimTable, sub_81561D0};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown18 = {0xFFFF, 0x1005, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown18, gFieldEffectObjectPicTable_Unknown18, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim};
const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown19[] = {
overworld_frame(gFieldEffectObjectPic_Unknown19, 2, 2, 0),
@ -610,7 +610,7 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown19[] =
gFieldEffectObjectImageAnim_850D118,
};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown19 = {0xFFFF, 0x1004, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown19, gFieldEffectObjectPicTable_Unknown19, gDummySpriteAffineAnimTable, sub_81561D0};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown19 = {0xFFFF, 0x1004, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown19, gFieldEffectObjectPicTable_Unknown19, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim};
const struct SpriteFrameImage gFieldEffectObjectPicTable_Unknown29[] = {
overworld_frame(gFieldEffectObjectPic_Unknown29, 2, 1, 0),
@ -656,7 +656,7 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_Unknown20[] =
gFieldEffectObjectImageAnim_850D1AC,
};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown20 = {0xFFFF, 0x1004, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown20, gFieldEffectObjectPicTable_Unknown20, gDummySpriteAffineAnimTable, sub_81561D0};
const struct SpriteTemplate gFieldEffectObjectTemplate_Unknown20 = {0xFFFF, 0x1004, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_Unknown20, gFieldEffectObjectPicTable_Unknown20, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim};
const union AffineAnimCmd gFieldEffectObjectRotScalAnim_850D1E4[] =
{
@ -733,7 +733,7 @@ const union AnimCmd *const gFieldEffectObjectImageAnimTable_BerryTreeGrowthSpark
gFieldEffectObjectImageAnim_850D2D4,
};
const struct SpriteTemplate gFieldEffectObjectTemplate_BerryTreeGrowthSparkle = {0xFFFF, 0xFFFF, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_BerryTreeGrowthSparkle, gFieldEffectObjectPicTable_BerryTreeGrowthSparkle, gDummySpriteAffineAnimTable, sub_81561D0};
const struct SpriteTemplate gFieldEffectObjectTemplate_BerryTreeGrowthSparkle = {0xFFFF, 0xFFFF, &gEventObjectBaseOam_16x16, gFieldEffectObjectImageAnimTable_BerryTreeGrowthSparkle, gFieldEffectObjectPicTable_BerryTreeGrowthSparkle, gDummySpriteAffineAnimTable, WaitFieldEffectSpriteAnim};
const struct SpriteFrameImage gFieldEffectObjectPicTable_TreeDisguise[] = {
overworld_frame(gFieldEffectObjectPic_TreeDisguise, 2, 4, 0),

View File

@ -1347,12 +1347,12 @@ void sub_8128060(u8 taskId)
void ConfigureCameraObjectForPlacingDecoration(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor)
{
sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.spriteId].data[0];
gUnknown_03005DD0.spriteId = gpu_pal_decompress_alloc_tag_and_upload(data, decor);
gSprites[gUnknown_03005DD0.spriteId].oam.priority = 1;
gSprites[gUnknown_03005DD0.spriteId].callback = sub_81292D0;
gSprites[gUnknown_03005DD0.spriteId].pos1.x = gUnknown_085A7250[data->decoration->shape].x;
gSprites[gUnknown_03005DD0.spriteId].pos1.y = gUnknown_085A7250[data->decoration->shape].y;
sDecor_CameraSpriteObjectIdx1 = gSprites[gFieldCamera.spriteId].data[0];
gFieldCamera.spriteId = gpu_pal_decompress_alloc_tag_and_upload(data, decor);
gSprites[gFieldCamera.spriteId].oam.priority = 1;
gSprites[gFieldCamera.spriteId].callback = sub_81292D0;
gSprites[gFieldCamera.spriteId].pos1.x = gUnknown_085A7250[data->decoration->shape].x;
gSprites[gFieldCamera.spriteId].pos1.y = gUnknown_085A7250[data->decoration->shape].y;
}
void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphicsDataBuffer *data)
@ -1374,7 +1374,7 @@ void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphic
}
gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1;
DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]);
sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.spriteId;
sDecor_CameraSpriteObjectIdx1 = gFieldCamera.spriteId;
}
void sub_812826C(u8 taskId)
@ -2293,9 +2293,9 @@ bool8 sub_81299AC(u8 taskId)
void SetUpPuttingAwayDecorationPlayerAvatar(void)
{
GetPlayerFacingDirection();
sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.spriteId].data[0];
sDecor_CameraSpriteObjectIdx1 = gSprites[gFieldCamera.spriteId].data[0];
sub_812A39C();
gUnknown_03005DD0.spriteId = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0);
gFieldCamera.spriteId = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0);
if (gSaveBlock2Ptr->playerGender == MALE)
{
sDecor_CameraSpriteObjectIdx2 = AddPseudoEventObject(0xC1, SpriteCallbackDummy, 0x88, 0x48, 0);
@ -2306,7 +2306,7 @@ void SetUpPuttingAwayDecorationPlayerAvatar(void)
}
gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1;
DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]);
sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.spriteId;
sDecor_CameraSpriteObjectIdx1 = gFieldCamera.spriteId;
gSprites[sDecor_CameraSpriteObjectIdx1].oam.priority = 1;
}

View File

@ -5023,8 +5023,8 @@ void sub_8092FF0(s16 x, s16 y, s16 *dest_x, s16 *dest_y)
{
*dest_x = (x - gSaveBlock1Ptr->pos.x) << 4;
*dest_y = (y - gSaveBlock1Ptr->pos.y) << 4;
*dest_x -= gUnknown_03005DEC;
*dest_y -= gUnknown_03005DE8;
*dest_x -= gTotalCameraPixelOffsetX;
*dest_y -= gTotalCameraPixelOffsetY;
}
void sub_8093038(s16 x, s16 y, s16 *dest_x, s16 *dest_y)
@ -5032,21 +5032,21 @@ void sub_8093038(s16 x, s16 y, s16 *dest_x, s16 *dest_y)
s16 dx;
s16 dy;
dx = -gUnknown_03005DEC - gUnknown_03005DD0.x;
dy = -gUnknown_03005DE8 - gUnknown_03005DD0.y;
if (gUnknown_03005DD0.x > 0)
dx = -gTotalCameraPixelOffsetX - gFieldCamera.x;
dy = -gTotalCameraPixelOffsetY - gFieldCamera.y;
if (gFieldCamera.x > 0)
{
dx += 0x10;
}
if (gUnknown_03005DD0.x < 0)
if (gFieldCamera.x < 0)
{
dx -= 0x10;
}
if (gUnknown_03005DD0.y > 0)
if (gFieldCamera.y > 0)
{
dy += 0x10;
}
if (gUnknown_03005DD0.y < 0)
if (gFieldCamera.y < 0)
{
dy -= 0x10;
}
@ -5065,19 +5065,19 @@ static void GetEventObjectMovingCameraOffset(s16 *x, s16 *y)
{
*x = 0;
*y = 0;
if (gUnknown_03005DD0.x > 0)
if (gFieldCamera.x > 0)
{
(*x)++;
}
if (gUnknown_03005DD0.x < 0)
if (gFieldCamera.x < 0)
{
(*x) --;
}
if (gUnknown_03005DD0.y > 0)
if (gFieldCamera.y > 0)
{
(*y)++;
}
if (gUnknown_03005DD0.y < 0)
if (gFieldCamera.y < 0)
{
(*y) --;
}

View File

@ -15,71 +15,71 @@
EWRAM_DATA bool8 gUnusedBikeCameraAheadPanback = FALSE;
// Static type declarations
struct FieldCameraUnknownStruct
struct FieldCameraOffset
{
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
bool8 unk4;
u8 xPixelOffset;
u8 yPixelOffset;
u8 xTileOffset;
u8 yTileOffset;
bool8 copyBGToVRAM;
};
// static functions
static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout);
static s32 MapPosToBgTilemapOffset(struct FieldCameraUnknownStruct *a, s32 x, s32 y);
static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout);
static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset *a, s32 x, s32 y);
static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLayout);
static void DrawMetatileAt(const struct MapLayout *mapLayout, u16, int, int);
static void DrawMetatile(s32 a, u16 *b, u16 c);
static void CameraPanningCB_PanAhead(void);
// IWRAM bss vars
static IWRAM_DATA struct FieldCameraUnknownStruct gUnknown_03000E20;
static IWRAM_DATA s16 gUnknown_03000E28;
static IWRAM_DATA s16 gUnknown_03000E2A;
static IWRAM_DATA struct FieldCameraOffset sFieldCameraOffset;
static IWRAM_DATA s16 sHorizontalCameraPan;
static IWRAM_DATA s16 sVerticalCameraPan;
static IWRAM_DATA u8 gUnknown_03000E2C;
static IWRAM_DATA void (*gUnknown_03000E30)(void);
static IWRAM_DATA void (*sFieldCameraPanningCallback)(void);
struct CameraObject gUnknown_03005DD0;
u16 gUnknown_03005DE8;
u16 gUnknown_03005DEC;
struct CameraObject gFieldCamera;
u16 gTotalCameraPixelOffsetY;
u16 gTotalCameraPixelOffsetX;
// text
static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraUnknownStruct *a)
static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraOffset *cameraOffset)
{
a->unk2 = 0;
a->unk3 = 0;
a->unk0 = 0;
a->unk1 = 0;
a->unk4 = TRUE;
cameraOffset->xTileOffset = 0;
cameraOffset->yTileOffset = 0;
cameraOffset->xPixelOffset = 0;
cameraOffset->yPixelOffset = 0;
cameraOffset->copyBGToVRAM = TRUE;
}
static void tilemap_move_something(struct FieldCameraUnknownStruct *a, u32 b, u32 c)
static void tilemap_move_something(struct FieldCameraOffset *cameraOffset, u32 b, u32 c)
{
a->unk2 += b;
a->unk2 %= 32;
a->unk3 += c;
a->unk3 %= 32;
cameraOffset->xTileOffset += b;
cameraOffset->xTileOffset %= 32;
cameraOffset->yTileOffset += c;
cameraOffset->yTileOffset %= 32;
}
static void coords8_add(struct FieldCameraUnknownStruct *a, u32 b, u32 c)
static void coords8_add(struct FieldCameraOffset *cameraOffset, u32 b, u32 c)
{
a->unk0 += b;
a->unk1 += c;
cameraOffset->xPixelOffset += b;
cameraOffset->yPixelOffset += c;
}
void move_tilemap_camera_to_upper_left_corner(void)
{
move_tilemap_camera_to_upper_left_corner_(&gUnknown_03000E20);
move_tilemap_camera_to_upper_left_corner_(&sFieldCameraOffset);
}
void FieldUpdateBgTilemapScroll(void)
{
u32 r4, r5;
r5 = gUnknown_03000E20.unk0 + gUnknown_03000E28;
r4 = gUnknown_03000E2A + gUnknown_03000E20.unk1 + 8;
r5 = sFieldCameraOffset.xPixelOffset + sHorizontalCameraPan;
r4 = sVerticalCameraPan + sFieldCameraOffset.yPixelOffset + 8;
SetGpuReg(REG_OFFSET_BG1HOFS, r5);
SetGpuReg(REG_OFFSET_BG1VOFS, r4);
@ -91,14 +91,14 @@ void FieldUpdateBgTilemapScroll(void)
void sub_8089C08(s16 *a, s16 *b)
{
*a = gUnknown_03000E20.unk0 + gUnknown_03000E28;
*b = gUnknown_03000E20.unk1 + gUnknown_03000E2A + 8;
*a = sFieldCameraOffset.xPixelOffset + sHorizontalCameraPan;
*b = sFieldCameraOffset.yPixelOffset + sVerticalCameraPan + 8;
}
void DrawWholeMapView(void)
{
DrawWholeMapViewInternal(gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y, gMapHeader.mapLayout);
gUnknown_03000E20.unk4 = TRUE;
sFieldCameraOffset.copyBGToVRAM = TRUE;
}
static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLayout)
@ -110,13 +110,13 @@ static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLa
for (i = 0; i < 32; i += 2)
{
temp = gUnknown_03000E20.unk3 + i;
temp = sFieldCameraOffset.yTileOffset + i;
if (temp >= 32)
temp -= 32;
r6 = temp * 32;
for (j = 0; j < 32; j += 2)
{
temp = gUnknown_03000E20.unk2 + j;
temp = sFieldCameraOffset.xTileOffset + j;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapLayout, r6 + temp, x + j / 2, y + i / 2);
@ -124,112 +124,112 @@ static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLa
}
}
static void RedrawMapSlicesForCameraUpdate(struct FieldCameraUnknownStruct *a, int x, int y)
static void RedrawMapSlicesForCameraUpdate(struct FieldCameraOffset *cameraOffset, int x, int y)
{
const struct MapLayout *mapLayout = gMapHeader.mapLayout;
if (x > 0)
RedrawMapSliceWest(a, mapLayout);
RedrawMapSliceWest(cameraOffset, mapLayout);
if (x < 0)
RedrawMapSliceEast(a, mapLayout);
RedrawMapSliceEast(cameraOffset, mapLayout);
if (y > 0)
RedrawMapSliceNorth(a, mapLayout);
RedrawMapSliceNorth(cameraOffset, mapLayout);
if (y < 0)
RedrawMapSliceSouth(a, mapLayout);
a->unk4 = TRUE;
RedrawMapSliceSouth(cameraOffset, mapLayout);
cameraOffset->copyBGToVRAM = TRUE;
}
static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
u32 r7;
temp = a->unk3 + 28;
temp = cameraOffset->yTileOffset + 28;
if (temp >= 32)
temp -= 32;
r7 = temp * 32;
for (i = 0; i < 32; i += 2)
{
temp = a->unk2 + i;
temp = cameraOffset->xTileOffset + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapLayout, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y + 14);
}
}
static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
u32 r7 = a->unk3 * 32;
u32 r7 = cameraOffset->yTileOffset * 32;
for (i = 0; i < 32; i += 2)
{
temp = a->unk2 + i;
temp = cameraOffset->xTileOffset + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapLayout, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y);
}
}
static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
u32 r6 = a->unk2;
u32 r6 = cameraOffset->xTileOffset;
for (i = 0; i < 32; i += 2)
{
temp = a->unk3 + i;
temp = cameraOffset->yTileOffset + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapLayout, temp * 32 + r6, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y + i / 2);
}
}
static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapLayout *mapLayout)
static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
u8 r5 = a->unk2 + 28;
u8 r5 = cameraOffset->xTileOffset + 28;
if (r5 >= 32)
r5 -= 32;
for (i = 0; i < 32; i += 2)
{
temp = a->unk3 + i;
temp = cameraOffset->yTileOffset + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapLayout, temp * 32 + r5, gSaveBlock1Ptr->pos.x + 14, gSaveBlock1Ptr->pos.y + i / 2);
}
}
void CurrentMapDrawMetatileAt(int a, int b)
void CurrentMapDrawMetatileAt(int x, int y)
{
int offset = MapPosToBgTilemapOffset(&gUnknown_03000E20, a, b);
int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y);
if (offset >= 0)
{
DrawMetatileAt(gMapHeader.mapLayout, offset, a, b);
gUnknown_03000E20.unk4 = TRUE;
DrawMetatileAt(gMapHeader.mapLayout, offset, x, y);
sFieldCameraOffset.copyBGToVRAM = TRUE;
}
}
void DrawDoorMetatileAt(int x, int y, u16 *arr)
{
int offset = MapPosToBgTilemapOffset(&gUnknown_03000E20, x, y);
int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y);
if (offset >= 0)
{
DrawMetatile(1, arr, offset);
gUnknown_03000E20.unk4 = TRUE;
sFieldCameraOffset.copyBGToVRAM = TRUE;
}
}
static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 b, int c, int d)
static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x, int y)
{
u16 metatileId = MapGridGetMetatileIdAt(c, d);
u16 metatileId = MapGridGetMetatileIdAt(x, y);
u16 *metatiles;
if (metatileId > NUM_METATILES_TOTAL)
@ -241,60 +241,69 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 b, int c, int
metatiles = mapLayout->secondaryTileset->metatiles;
metatileId -= NUM_METATILES_IN_PRIMARY;
}
DrawMetatile(MapGridGetMetatileLayerTypeAt(c, d), metatiles + metatileId * 8, b);
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset);
}
static void DrawMetatile(s32 a, u16 *b, u16 c)
static void DrawMetatile(s32 metatileLayerType, u16 *metatiles, u16 offset)
{
switch (a)
switch (metatileLayerType)
{
case 2:
gBGTilemapBuffers3[c] = b[0];
gBGTilemapBuffers3[c + 1] = b[1];
gBGTilemapBuffers3[c + 0x20] = b[2];
gBGTilemapBuffers3[c + 0x21] = b[3];
case 2: // LAYER_TYPE_
// Draw metatile's bottom layer to the bottom background layer.
gBGTilemapBuffers3[offset] = metatiles[0];
gBGTilemapBuffers3[offset + 1] = metatiles[1];
gBGTilemapBuffers3[offset + 0x20] = metatiles[2];
gBGTilemapBuffers3[offset + 0x21] = metatiles[3];
gBGTilemapBuffers1[c] = 0;
gBGTilemapBuffers1[c + 1] = 0;
gBGTilemapBuffers1[c + 0x20] = 0;
gBGTilemapBuffers1[c + 0x21] = 0;
// Draw transparent tiles to the middle background layer.
gBGTilemapBuffers1[offset] = 0;
gBGTilemapBuffers1[offset + 1] = 0;
gBGTilemapBuffers1[offset + 0x20] = 0;
gBGTilemapBuffers1[offset + 0x21] = 0;
gBGTilemapBuffers2[c] = b[4];
gBGTilemapBuffers2[c + 1] = b[5];
gBGTilemapBuffers2[c + 0x20] = b[6];
gBGTilemapBuffers2[c + 0x21] = b[7];
// Draw metatile's top layer to the top background layer.
gBGTilemapBuffers2[offset] = metatiles[4];
gBGTilemapBuffers2[offset + 1] = metatiles[5];
gBGTilemapBuffers2[offset + 0x20] = metatiles[6];
gBGTilemapBuffers2[offset + 0x21] = metatiles[7];
break;
case 1:
gBGTilemapBuffers3[c] = b[0];
gBGTilemapBuffers3[c + 1] = b[1];
gBGTilemapBuffers3[c + 0x20] = b[2];
gBGTilemapBuffers3[c + 0x21] = b[3];
case 1: // LAYER_TYPE_COVERED_BY_OBJECTS
// Draw metatile's bottom layer to the bottom background layer.
gBGTilemapBuffers3[offset] = metatiles[0];
gBGTilemapBuffers3[offset + 1] = metatiles[1];
gBGTilemapBuffers3[offset + 0x20] = metatiles[2];
gBGTilemapBuffers3[offset + 0x21] = metatiles[3];
gBGTilemapBuffers1[c] = b[4];
gBGTilemapBuffers1[c + 1] = b[5];
gBGTilemapBuffers1[c + 0x20] = b[6];
gBGTilemapBuffers1[c + 0x21] = b[7];
// Draw metatile's top layer to the middle background layer.
gBGTilemapBuffers1[offset] = metatiles[4];
gBGTilemapBuffers1[offset + 1] = metatiles[5];
gBGTilemapBuffers1[offset + 0x20] = metatiles[6];
gBGTilemapBuffers1[offset + 0x21] = metatiles[7];
gBGTilemapBuffers2[c] = 0;
gBGTilemapBuffers2[c + 1] = 0;
gBGTilemapBuffers2[c + 0x20] = 0;
gBGTilemapBuffers2[c + 0x21] = 0;
// Draw transparent tiles to the top background layer.
gBGTilemapBuffers2[offset] = 0;
gBGTilemapBuffers2[offset + 1] = 0;
gBGTilemapBuffers2[offset + 0x20] = 0;
gBGTilemapBuffers2[offset + 0x21] = 0;
break;
case 0:
gBGTilemapBuffers3[c] = 0x3014;
gBGTilemapBuffers3[c + 1] = 0x3014;
gBGTilemapBuffers3[c + 0x20] = 0x3014;
gBGTilemapBuffers3[c + 0x21] = 0x3014;
case 0: // LAYER_TYPE_NORMAL
// Draw garbage to the bottom background layer.
gBGTilemapBuffers3[offset] = 0x3014;
gBGTilemapBuffers3[offset + 1] = 0x3014;
gBGTilemapBuffers3[offset + 0x20] = 0x3014;
gBGTilemapBuffers3[offset + 0x21] = 0x3014;
gBGTilemapBuffers1[c] = b[0];
gBGTilemapBuffers1[c + 1] = b[1];
gBGTilemapBuffers1[c + 0x20] = b[2];
gBGTilemapBuffers1[c + 0x21] = b[3];
// Draw metatile's bottom layer to the middle background layer.
gBGTilemapBuffers1[offset] = metatiles[0];
gBGTilemapBuffers1[offset + 1] = metatiles[1];
gBGTilemapBuffers1[offset + 0x20] = metatiles[2];
gBGTilemapBuffers1[offset + 0x21] = metatiles[3];
gBGTilemapBuffers2[c] = b[4];
gBGTilemapBuffers2[c + 1] = b[5];
gBGTilemapBuffers2[c + 0x20] = b[6];
gBGTilemapBuffers2[c + 0x21] = b[7];
// Draw metatile's top layer to the top background layer, which covers event object sprites.
gBGTilemapBuffers2[offset] = metatiles[4];
gBGTilemapBuffers2[offset + 1] = metatiles[5];
gBGTilemapBuffers2[offset + 0x20] = metatiles[6];
gBGTilemapBuffers2[offset + 0x21] = metatiles[7];
break;
}
schedule_bg_copy_tilemap_to_vram(1);
@ -302,51 +311,51 @@ static void DrawMetatile(s32 a, u16 *b, u16 c)
schedule_bg_copy_tilemap_to_vram(3);
}
static s32 MapPosToBgTilemapOffset(struct FieldCameraUnknownStruct *a, s32 x, s32 y)
static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset *cameraOffset, s32 x, s32 y)
{
x -= gSaveBlock1Ptr->pos.x;
x *= 2;
if (x >= 32 || x < 0)
return -1;
x = x + a->unk2;
x = x + cameraOffset->xTileOffset;
if (x >= 32)
x -= 32;
y = (y - gSaveBlock1Ptr->pos.y) * 2;
if (y >= 32 || y < 0)
return -1;
y = y + a->unk3;
y = y + cameraOffset->yTileOffset;
if (y >= 32)
y -= 32;
return y * 32 + x;
}
static void CameraUpdateCallback(struct CameraObject *a)
static void CameraUpdateCallback(struct CameraObject *fieldCamera)
{
if (a->spriteId != 0)
if (fieldCamera->spriteId != 0)
{
a->unk8 = gSprites[a->spriteId].data[2];
a->unkC = gSprites[a->spriteId].data[3];
fieldCamera->movementSpeedX = gSprites[fieldCamera->spriteId].data[2];
fieldCamera->movementSpeedY = gSprites[fieldCamera->spriteId].data[3];
}
}
void ResetCameraUpdateInfo(void)
{
gUnknown_03005DD0.unk8 = 0;
gUnknown_03005DD0.unkC = 0;
gUnknown_03005DD0.x = 0;
gUnknown_03005DD0.y = 0;
gUnknown_03005DD0.spriteId = 0;
gUnknown_03005DD0.callback = NULL;
gFieldCamera.movementSpeedX = 0;
gFieldCamera.movementSpeedY = 0;
gFieldCamera.x = 0;
gFieldCamera.y = 0;
gFieldCamera.spriteId = 0;
gFieldCamera.callback = NULL;
}
u32 InitCameraUpdateCallback(u8 a)
u32 InitCameraUpdateCallback(u8 trackedSpriteId)
{
if (gUnknown_03005DD0.spriteId != 0)
DestroySprite(&gSprites[gUnknown_03005DD0.spriteId]);
gUnknown_03005DD0.spriteId = AddCameraObject(a);
gUnknown_03005DD0.callback = CameraUpdateCallback;
if (gFieldCamera.spriteId != 0)
DestroySprite(&gSprites[gFieldCamera.spriteId]);
gFieldCamera.spriteId = AddCameraObject(trackedSpriteId);
gFieldCamera.callback = CameraUpdateCallback;
return 0;
}
@ -354,54 +363,54 @@ void CameraUpdate(void)
{
int deltaX;
int deltaY;
int r0;
int r1;
int r7;
int r8;
int curMovementOffsetY;
int curMovementOffsetX;
int movementSpeedX;
int movementSpeedY;
if (gUnknown_03005DD0.callback != NULL)
gUnknown_03005DD0.callback(&gUnknown_03005DD0);
r7 = gUnknown_03005DD0.unk8;
r8 = gUnknown_03005DD0.unkC;
if (gFieldCamera.callback != NULL)
gFieldCamera.callback(&gFieldCamera);
movementSpeedX = gFieldCamera.movementSpeedX;
movementSpeedY = gFieldCamera.movementSpeedY;
deltaX = 0;
deltaY = 0;
r1 = gUnknown_03005DD0.x;
r0 = gUnknown_03005DD0.y;
curMovementOffsetX = gFieldCamera.x;
curMovementOffsetY = gFieldCamera.y;
if (r1 == 0 && r7 != 0)
if (curMovementOffsetX == 0 && movementSpeedX != 0)
{
if (r7 > 0)
if (movementSpeedX > 0)
deltaX = 1;
else
deltaX = -1;
}
if (r0 == 0 && r8 != 0)
if (curMovementOffsetY == 0 && movementSpeedY != 0)
{
if (r8 > 0)
if (movementSpeedY > 0)
deltaY = 1;
else
deltaY = -1;
}
if (r1 != 0 && r1 == -r7)
if (curMovementOffsetX != 0 && curMovementOffsetX == -movementSpeedX)
{
if (r7 > 0)
if (movementSpeedX > 0)
deltaX = 1;
else
deltaX = -1;
}
if (r0 != 0 && r0 == -r8)
if (curMovementOffsetY != 0 && curMovementOffsetY == -movementSpeedY)
{
if (r8 > 0)
if (movementSpeedY > 0)
deltaX = 1;
else
deltaX = -1;
}
gUnknown_03005DD0.x += r7;
gUnknown_03005DD0.x = gUnknown_03005DD0.x - 16 * (gUnknown_03005DD0.x / 16);
gUnknown_03005DD0.y += r8;
gUnknown_03005DD0.y = gUnknown_03005DD0.y - 16 * (gUnknown_03005DD0.y / 16);
gFieldCamera.x += movementSpeedX;
gFieldCamera.x = gFieldCamera.x - 16 * (gFieldCamera.x / 16);
gFieldCamera.y += movementSpeedY;
gFieldCamera.y = gFieldCamera.y - 16 * (gFieldCamera.y / 16);
if (deltaX != 0 || deltaY != 0)
{
@ -409,50 +418,50 @@ void CameraUpdate(void)
UpdateEventObjectsForCameraUpdate(deltaX, deltaY);
RotatingGatePuzzleCameraUpdate(deltaX, deltaY);
ResetBerryTreeSparkleFlags();
tilemap_move_something(&gUnknown_03000E20, deltaX * 2, deltaY * 2);
RedrawMapSlicesForCameraUpdate(&gUnknown_03000E20, deltaX * 2, deltaY * 2);
tilemap_move_something(&sFieldCameraOffset, deltaX * 2, deltaY * 2);
RedrawMapSlicesForCameraUpdate(&sFieldCameraOffset, deltaX * 2, deltaY * 2);
}
coords8_add(&gUnknown_03000E20, r7, r8);
gUnknown_03005DEC -= r7;
gUnknown_03005DE8 -= r8;
coords8_add(&sFieldCameraOffset, movementSpeedX, movementSpeedY);
gTotalCameraPixelOffsetX -= movementSpeedX;
gTotalCameraPixelOffsetY -= movementSpeedY;
}
void camera_move_and_redraw(int a, int b) //unused
void MoveCameraAndRedrawMap(int deltaX, int deltaY) //unused
{
CameraMove(a, b);
UpdateEventObjectsForCameraUpdate(a, b);
CameraMove(deltaX, deltaY);
UpdateEventObjectsForCameraUpdate(deltaX, deltaY);
DrawWholeMapView();
gUnknown_03005DEC -= a * 16;
gUnknown_03005DE8 -= b * 16;
gTotalCameraPixelOffsetX -= deltaX * 16;
gTotalCameraPixelOffsetY -= deltaY * 16;
}
void SetCameraPanningCallback(void (*a)(void))
{
gUnknown_03000E30 = a;
sFieldCameraPanningCallback = a;
}
void SetCameraPanning(s16 a, s16 b)
{
gUnknown_03000E28 = a;
gUnknown_03000E2A = b + 32;
sHorizontalCameraPan = a;
sVerticalCameraPan = b + 32;
}
void InstallCameraPanAheadCallback(void)
{
gUnknown_03000E30 = CameraPanningCB_PanAhead;
sFieldCameraPanningCallback = CameraPanningCB_PanAhead;
gUnknown_03000E2C = 0;
gUnknown_03000E28 = 0;
gUnknown_03000E2A = 32;
sHorizontalCameraPan = 0;
sVerticalCameraPan = 32;
}
void UpdateCameraPanning(void)
{
if (gUnknown_03000E30 != NULL)
gUnknown_03000E30();
if (sFieldCameraPanningCallback != NULL)
sFieldCameraPanningCallback();
//Update sprite offset of overworld objects
gSpriteCoordOffsetX = gUnknown_03005DEC - gUnknown_03000E28;
gSpriteCoordOffsetY = gUnknown_03005DE8 - gUnknown_03000E2A - 8;
gSpriteCoordOffsetX = gTotalCameraPixelOffsetX - sHorizontalCameraPan;
gSpriteCoordOffsetY = gTotalCameraPixelOffsetY - sVerticalCameraPan - 8;
}
static void CameraPanningCB_PanAhead(void)
@ -480,22 +489,21 @@ static void CameraPanningCB_PanAhead(void)
var = GetPlayerMovementDirection();
if (var == 2)
{
if (gUnknown_03000E2A > -8)
gUnknown_03000E2A -= 2;
if (sVerticalCameraPan > -8)
sVerticalCameraPan -= 2;
}
else if (var == 1)
{
if (gUnknown_03000E2A < 72)
gUnknown_03000E2A += 2;
if (sVerticalCameraPan < 72)
sVerticalCameraPan += 2;
}
else if (gUnknown_03000E2A < 32)
else if (sVerticalCameraPan < 32)
{
gUnknown_03000E2A += 2;
sVerticalCameraPan += 2;
}
else if (gUnknown_03000E2A > 32)
else if (sVerticalCameraPan > 32)
{
gUnknown_03000E2A -= 2;
sVerticalCameraPan -= 2;
}
}
}

View File

@ -3791,8 +3791,8 @@ const struct SpriteTemplate gUnknown_0855C5EC = {
void sub_80B9D24(struct Sprite* sprite)
{
int i;
int xPos = (s16)gUnknown_03005DEC + sprite->pos1.x + sprite->pos2.x;
int yPos = (s16)gUnknown_03005DE8 + sprite->pos1.y + sprite->pos2.y - 4;
int xPos = (s16)gTotalCameraPixelOffsetX + sprite->pos1.x + sprite->pos2.x;
int yPos = (s16)gTotalCameraPixelOffsetY + sprite->pos1.y + sprite->pos2.y - 4;
for (i = 0; i < 4; i++)
{

View File

@ -14,22 +14,22 @@
#define EVENT_OBJ_PAL_TAG_NONE 0x11FF // duplicate of define in event_object_movement.c
void UpdateObjectReflectionSprite(struct Sprite *);
void LoadObjectReflectionPalette(struct EventObject *eventObject, struct Sprite *sprite);
void LoadObjectHighBridgeReflectionPalette(struct EventObject *, u8);
void LoadObjectRegularReflectionPalette(struct EventObject *, u8);
void sub_81561FC(struct Sprite *, u8, u8);
void FadeFootprintsTireTracks_Step0(struct Sprite *);
void FadeFootprintsTireTracks_Step1(struct Sprite *);
void UpdateFeetInFlowingWaterFieldEffect(struct Sprite *);
void UpdateAshFieldEffect_Step0(struct Sprite *);
void UpdateAshFieldEffect_Step1(struct Sprite *);
void UpdateAshFieldEffect_Step2(struct Sprite *);
void sub_81556B0(struct EventObject *, struct Sprite *);
void sub_81556E8(struct EventObject *, struct Sprite *);
void sub_815577C(struct EventObject *, struct Sprite *, struct Sprite *);
void sub_8155850(struct Sprite *);
u32 ShowDisguiseFieldEffect(u8, u8, u8);
static void UpdateObjectReflectionSprite(struct Sprite *);
static void LoadObjectReflectionPalette(struct EventObject *eventObject, struct Sprite *sprite);
static void LoadObjectHighBridgeReflectionPalette(struct EventObject *, u8);
static void LoadObjectRegularReflectionPalette(struct EventObject *, u8);
static void sub_81561FC(struct Sprite *, u8, u8);
static void FadeFootprintsTireTracks_Step0(struct Sprite *);
static void FadeFootprintsTireTracks_Step1(struct Sprite *);
static void UpdateFeetInFlowingWaterFieldEffect(struct Sprite *);
static void UpdateAshFieldEffect_Step0(struct Sprite *);
static void UpdateAshFieldEffect_Step1(struct Sprite *);
static void UpdateAshFieldEffect_Step2(struct Sprite *);
static void sub_81556B0(struct EventObject *, struct Sprite *);
static void sub_81556E8(struct EventObject *, struct Sprite *);
static void sub_815577C(struct EventObject *, struct Sprite *, struct Sprite *);
static void sub_8155850(struct Sprite *);
static u32 ShowDisguiseFieldEffect(u8, u8, u8);
void SetUpReflection(struct EventObject *eventObject, struct Sprite *sprite, bool8 stillReflection)
{
@ -59,12 +59,12 @@ static s16 GetReflectionVerticalOffset(struct EventObject *eventObject)
return GetEventObjectGraphicsInfo(eventObject->graphicsId)->height - 2;
}
void LoadObjectReflectionPalette(struct EventObject *eventObject, struct Sprite *sprite)
static void LoadObjectReflectionPalette(struct EventObject *eventObject, struct Sprite *sprite)
{
u8 bridgeType;
u16 bridgeReflectionVerticalOffsets[] = { 12, 28, 44 };
sprite->data[2] = 0;
if (!GetEventObjectGraphicsInfo(eventObject->graphicsId)->disableReflectionPaletteLoad && ((bridgeType = MetatileBehavior_GetBridgeSth(eventObject->previousMetatileBehavior)) || (bridgeType = MetatileBehavior_GetBridgeSth(eventObject->currentMetatileBehavior))))
if (!GetEventObjectGraphicsInfo(eventObject->graphicsId)->disableReflectionPaletteLoad && ((bridgeType = MetatileBehavior_GetBridgeType(eventObject->previousMetatileBehavior)) || (bridgeType = MetatileBehavior_GetBridgeType(eventObject->currentMetatileBehavior))))
{
sprite->data[2] = bridgeReflectionVerticalOffsets[bridgeType - 1];
LoadObjectHighBridgeReflectionPalette(eventObject, sprite->oam.paletteNum);
@ -75,7 +75,7 @@ void LoadObjectReflectionPalette(struct EventObject *eventObject, struct Sprite
}
}
void LoadObjectRegularReflectionPalette(struct EventObject *eventObject, u8 paletteIndex)
static void LoadObjectRegularReflectionPalette(struct EventObject *eventObject, u8 paletteIndex)
{
const struct EventObjectGraphicsInfo *graphicsInfo;
@ -100,7 +100,7 @@ void LoadObjectRegularReflectionPalette(struct EventObject *eventObject, u8 pale
// When walking on a bridge high above water (Route 120), the reflection is a solid dark blue color.
// This is so the sprite blends in with the dark water metatile underneath the bridge.
void LoadObjectHighBridgeReflectionPalette(struct EventObject *eventObject, u8 paletteNum)
static void LoadObjectHighBridgeReflectionPalette(struct EventObject *eventObject, u8 paletteNum)
{
const struct EventObjectGraphicsInfo *graphicsInfo;
@ -112,7 +112,7 @@ void LoadObjectHighBridgeReflectionPalette(struct EventObject *eventObject, u8 p
}
}
void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite)
static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite)
{
struct EventObject *eventObject;
struct Sprite *mainSprite;
@ -579,7 +579,7 @@ void UpdateFootprintsTireTracksFieldEffect(struct Sprite *sprite)
gFadeFootprintsTireTracksFuncs[sprite->data[0]](sprite);
}
void FadeFootprintsTireTracks_Step0(struct Sprite *sprite)
static void FadeFootprintsTireTracks_Step0(struct Sprite *sprite)
{
// Wait 40 frames before the flickering starts.
if (++sprite->data[1] > 40)
@ -588,7 +588,7 @@ void FadeFootprintsTireTracks_Step0(struct Sprite *sprite)
UpdateEventObjectSpriteVisibility(sprite, FALSE);
}
void FadeFootprintsTireTracks_Step1(struct Sprite *sprite)
static void FadeFootprintsTireTracks_Step1(struct Sprite *sprite)
{
sprite->invisible ^= 1;
sprite->data[1]++;
@ -708,7 +708,7 @@ u32 FldEff_FeetInFlowingWater(void)
return 0;
}
void UpdateFeetInFlowingWaterFieldEffect(struct Sprite *sprite)
static void UpdateFeetInFlowingWaterFieldEffect(struct Sprite *sprite)
{
u8 eventObjectId;
struct Sprite *linkedSprite;
@ -913,7 +913,7 @@ void UpdateAshFieldEffect(struct Sprite *sprite)
gAshFieldEffectFuncs[sprite->data[0]](sprite);
}
void UpdateAshFieldEffect_Step0(struct Sprite *sprite)
static void UpdateAshFieldEffect_Step0(struct Sprite *sprite)
{
sprite->invisible = TRUE;
sprite->animPaused = TRUE;
@ -921,7 +921,7 @@ void UpdateAshFieldEffect_Step0(struct Sprite *sprite)
sprite->data[0] = 1;
}
void UpdateAshFieldEffect_Step1(struct Sprite *sprite)
static void UpdateAshFieldEffect_Step1(struct Sprite *sprite)
{
sprite->invisible = FALSE;
sprite->animPaused = FALSE;
@ -931,7 +931,7 @@ void UpdateAshFieldEffect_Step1(struct Sprite *sprite)
sprite->data[0] = 2;
}
void UpdateAshFieldEffect_Step2(struct Sprite *sprite)
static void UpdateAshFieldEffect_Step2(struct Sprite *sprite)
{
UpdateEventObjectSpriteVisibility(sprite, FALSE);
if (sprite->animEnded)
@ -975,17 +975,17 @@ void sub_8155604(u8 spriteId, u8 value, s16 data1)
gSprites[spriteId].data[1] = data1;
}
u8 sub_8155638(struct Sprite *sprite)
static u8 sub_8155638(struct Sprite *sprite)
{
return sprite->data[0] & 0xF;
}
u8 sub_8155640(struct Sprite *sprite)
static u8 sub_8155640(struct Sprite *sprite)
{
return (sprite->data[0] & 0xF0) >> 4;
}
u8 sub_815564C(struct Sprite *sprite)
static u8 sub_815564C(struct Sprite *sprite)
{
return (sprite->data[0] & 0xF00) >> 8;
}
@ -1003,7 +1003,7 @@ void UpdateSurfBlobFieldEffect(struct Sprite *sprite)
sprite->oam.priority = linkedSprite->oam.priority;
}
void sub_81556B0(struct EventObject *eventObject, struct Sprite *sprite)
static void sub_81556B0(struct EventObject *eventObject, struct Sprite *sprite)
{
u8 surfBlobDirectionAnims[] = {
0, // DIR_NONE
@ -1126,7 +1126,7 @@ _08155770:\n\
}
#endif
void sub_815577C(struct EventObject *eventObject, struct Sprite *linkedSprite, struct Sprite *sprite)
static void sub_815577C(struct EventObject *eventObject, struct Sprite *linkedSprite, struct Sprite *sprite)
{
u16 unk_085CDC6A[] = {3, 7};
u8 v0 = sub_8155638(sprite);
@ -1166,7 +1166,7 @@ u8 sub_8155800(u8 oldSpriteId)
return spriteId;
}
void sub_8155850(struct Sprite *sprite)
static void sub_8155850(struct Sprite *sprite)
{
struct Sprite *oldSprite;
@ -1320,7 +1320,7 @@ u32 ShowSandDisguiseFieldEffect(void)
return ShowDisguiseFieldEffect(FLDEFF_SAND_DISGUISE, 28, 2);
}
u32 ShowDisguiseFieldEffect(u8 fldEff, u8 templateIdx, u8 paletteNum)
static u32 ShowDisguiseFieldEffect(u8 fldEff, u8 templateIdx, u8 paletteNum)
{
u8 spriteId;
struct Sprite *sprite;
@ -1619,7 +1619,7 @@ void sub_8156194(struct Sprite *sprite)
}
}
void sub_81561D0(struct Sprite *sprite)
void WaitFieldEffectSpriteAnim(struct Sprite *sprite)
{
if (sprite->animEnded)
FieldEffectStop(sprite, sprite->data[0]);
@ -1628,7 +1628,7 @@ void sub_81561D0(struct Sprite *sprite)
}
#ifdef NONMATCHING
void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset)
static void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset)
{
u8 i;
s16 xlo;

View File

@ -79,7 +79,7 @@ extern u8 fishD(struct Task *task);
extern u8 fishE(struct Task *task);
extern u8 fishF(struct Task *task);
static bool8 (*const gUnknown_084973FC[])(u8) =
static bool8 (*const sForcedMovementTestFuncs[])(u8) =
{
MetatileBehavior_IsTrickHouseSlipperyFloor,
MetatileBehavior_IsIce_2,
@ -101,7 +101,7 @@ static bool8 (*const gUnknown_084973FC[])(u8) =
MetatileBehavior_IsMuddySlope,
};
static bool8 (*const gUnknown_08497444[])(void) =
static bool8 (*const sForcedMovementFuncs[])(void) =
{
ForcedMovement_None,
ForcedMovement_Slip,
@ -154,7 +154,7 @@ void (*const gUnknown_084974B8[])(struct EventObject *) =
PlayerAvatarTransition_Dummy,
};
bool8 (*const gUnknown_084974D8[])(u8) =
bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) =
{
MetatileBehavior_IsSouthArrowWarp,
MetatileBehavior_IsNorthArrowWarp,
@ -162,7 +162,7 @@ bool8 (*const gUnknown_084974D8[])(u8) =
MetatileBehavior_IsEastArrowWarp,
};
const u8 gUnknown_084974E8[][2] =
const u8 sRivalAvatarGfxIds[][2] =
{
{EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL, EVENT_OBJ_GFX_RIVAL_MAY_NORMAL},
{EVENT_OBJ_GFX_RIVAL_BRENDAN_MACH_BIKE, EVENT_OBJ_GFX_RIVAL_MAY_MACH_BIKE},
@ -174,7 +174,7 @@ const u8 gUnknown_084974E8[][2] =
{EVENT_OBJ_GFX_BRENDAN_WATERING, EVENT_OBJ_GFX_MAY_WATERING}
};
const u8 gUnknown_084974F8[][2] =
const u8 sPlayerAvatarGfxIds[][2] =
{
{EVENT_OBJ_GFX_BRENDAN_NORMAL, EVENT_OBJ_GFX_MAY_NORMAL},
{EVENT_OBJ_GFX_BRENDAN_MACH_BIKE, EVENT_OBJ_GFX_MAY_MACH_BIKE},
@ -210,7 +210,7 @@ const u8 gUnknown_0849750C[2][5][2] =
}
};
bool8 (*const gUnknown_08497520[])(u8) = //Duplicate of sArrowWarpMetatileBehaviorChecks
bool8 (*const sArrowWarpMetatileBehaviorChecks2[])(u8) = //Duplicate of sArrowWarpMetatileBehaviorChecks
{
MetatileBehavior_IsSouthArrowWarp,
MetatileBehavior_IsNorthArrowWarp,
@ -242,7 +242,7 @@ const u8 gUnknown_08497550[] = {3, 4, 2, 1};
const u8 gUnknown_08497554[] = {16, 16, 17, 18, 19};
u8 (*const gUnknown_0849755C[])(struct Task *) =
u8 (*const sFishingStateFuncs[])(struct Task *) =
{
fish0,
fish1,
@ -266,9 +266,9 @@ const u16 gUnknown_0849759C[] = {1, 1, 1};
const u16 gUnknown_084975A2[] = {1, 3, 6};
const u8 gUnknown_084975A8[] = _("·");
const u8 gText_Dot[] = _("·");
const u16 gUnknown_084975AA[] = {36, 33, 30};
const u16 sReelTimeouts[] = {36, 33, 30};
const u16 gUnknown_084975B0[] =
{
@ -377,7 +377,7 @@ static void PlayerAllowForcedMovementIfMovingSameDirection(void)
static bool8 TryDoMetatileBehaviorForcedMovement(void)
{
return gUnknown_08497444[GetForcedMovementByMetatileBehavior()]();
return sForcedMovementFuncs[GetForcedMovementByMetatileBehavior()]();
}
static u8 GetForcedMovementByMetatileBehavior(void)
@ -390,7 +390,7 @@ static u8 GetForcedMovementByMetatileBehavior(void)
for (i = 0; i < 18; i++)
{
if (gUnknown_084973FC[i](metatileBehavior))
if (sForcedMovementTestFuncs[i](metatileBehavior))
return i + 1;
}
}

View File

@ -897,7 +897,7 @@ bool8 MetatileBehavior_IsBridge(u8 metatileBehavior)
return FALSE;
}
u8 MetatileBehavior_GetBridgeSth(u8 metatileBehavior)
u8 MetatileBehavior_GetBridgeType(u8 metatileBehavior)
{
u8 result = metatileBehavior - MB_WARP_OR_BRIDGE;
if (result < 4)

View File

@ -2166,8 +2166,8 @@ static void sub_8086988(u32 a1)
static void sub_80869DC(void)
{
gUnknown_03005DEC = 0;
gUnknown_03005DE8 = 0;
gTotalCameraPixelOffsetX = 0;
gTotalCameraPixelOffsetY = 0;
sub_808D438();
TrySpawnEventObjects(0, 0);
mapheader_run_first_tag4_script_list_match();
@ -2178,8 +2178,8 @@ static void mli4_mapscripts_and_other(void)
s16 x, y;
struct InitialPlayerAvatarState *player;
gUnknown_03005DEC = 0;
gUnknown_03005DE8 = 0;
gTotalCameraPixelOffsetX = 0;
gTotalCameraPixelOffsetY = 0;
sub_808D438();
sav1_camera_get_focus_coords(&x, &y);
player = GetInitialPlayerAvatarState();