Minor misc field doc

This commit is contained in:
GriffinR 2021-04-06 17:17:41 -04:00
parent 7d2a94282a
commit 0dc7ff8994
6 changed files with 39 additions and 48 deletions

View File

@ -1,8 +1,6 @@
#ifndef GUARD_FIELD_CAMERA_H #ifndef GUARD_FIELD_CAMERA_H
#define GUARD_FIELD_CAMERA_H #define GUARD_FIELD_CAMERA_H
// Exported type declarations
struct CameraObject struct CameraObject
{ {
void (*callback)(struct CameraObject *); void (*callback)(struct CameraObject *);
@ -13,18 +11,15 @@ struct CameraObject
s32 y; s32 y;
}; };
// Exported RAM declarations
extern struct CameraObject gFieldCamera; extern struct CameraObject gFieldCamera;
extern u16 gTotalCameraPixelOffsetX; extern u16 gTotalCameraPixelOffsetX;
extern u16 gTotalCameraPixelOffsetY; extern u16 gTotalCameraPixelOffsetY;
// Exported ROM declarations
void DrawWholeMapView(void); void DrawWholeMapView(void);
void CurrentMapDrawMetatileAt(int x, int y); void CurrentMapDrawMetatileAt(int x, int y);
void sub_8089C08(s16 *a0, s16 *a1); void GetCameraOffsetWithPan(s16 *a0, s16 *a1);
void DrawDoorMetatileAt(int x, int y, u16 *arr); void DrawDoorMetatileAt(int x, int y, u16 *arr);
void ResetFieldCamera(void); void ResetFieldCamera(void);
void sub_8057A58(void);
void ResetCameraUpdateInfo(void); void ResetCameraUpdateInfo(void);
u32 InitCameraUpdateCallback(u8 a); u32 InitCameraUpdateCallback(u8 a);
void CameraUpdate(void); void CameraUpdate(void);

View File

@ -3675,7 +3675,7 @@ static bool8 Phase1_TransitionAll_Func2(struct Task *task)
static void InitTransitionStructVars(void) static void InitTransitionStructVars(void)
{ {
memset(sTransitionStructPtr, 0, sizeof(*sTransitionStructPtr)); memset(sTransitionStructPtr, 0, sizeof(*sTransitionStructPtr));
sub_8089C08(&sTransitionStructPtr->field_14, &sTransitionStructPtr->field_16); GetCameraOffsetWithPan(&sTransitionStructPtr->field_14, &sTransitionStructPtr->field_16);
} }
static void VBlankCB_BattleTransition(void) static void VBlankCB_BattleTransition(void)

View File

@ -39,7 +39,7 @@ static void CameraPanningCB_PanAhead(void);
static struct FieldCameraOffset sFieldCameraOffset; static struct FieldCameraOffset sFieldCameraOffset;
static s16 sHorizontalCameraPan; static s16 sHorizontalCameraPan;
static s16 sVerticalCameraPan; static s16 sVerticalCameraPan;
static bool8 gUnknown_03000E2C; static bool8 sBikeCameraPanFlag;
static void (*sFieldCameraPanningCallback)(void); static void (*sFieldCameraPanningCallback)(void);
struct CameraObject gFieldCamera; struct CameraObject gFieldCamera;
@ -89,7 +89,7 @@ void FieldUpdateBgTilemapScroll(void)
SetGpuReg(REG_OFFSET_BG3VOFS, r4); SetGpuReg(REG_OFFSET_BG3VOFS, r4);
} }
void sub_8089C08(s16 *x, s16 *y) void GetCameraOffsetWithPan(s16 *x, s16 *y)
{ {
*x = sFieldCameraOffset.xPixelOffset + sHorizontalCameraPan; *x = sFieldCameraOffset.xPixelOffset + sHorizontalCameraPan;
*y = sFieldCameraOffset.yPixelOffset + sVerticalCameraPan + 8; *y = sFieldCameraOffset.yPixelOffset + sVerticalCameraPan + 8;
@ -450,7 +450,7 @@ void SetCameraPanning(s16 a, s16 b)
void InstallCameraPanAheadCallback(void) void InstallCameraPanAheadCallback(void)
{ {
sFieldCameraPanningCallback = CameraPanningCB_PanAhead; sFieldCameraPanningCallback = CameraPanningCB_PanAhead;
gUnknown_03000E2C = FALSE; sBikeCameraPanFlag = FALSE;
sHorizontalCameraPan = 0; sHorizontalCameraPan = 0;
sVerticalCameraPan = 32; sVerticalCameraPan = 32;
} }
@ -474,16 +474,16 @@ static void CameraPanningCB_PanAhead(void)
} }
else else
{ {
// this code is never reached. // this code is never reached
if (gPlayerAvatar.tileTransitionState == T_TILE_TRANSITION) if (gPlayerAvatar.tileTransitionState == T_TILE_TRANSITION)
{ {
gUnknown_03000E2C ^= 1; sBikeCameraPanFlag ^= 1;
if (gUnknown_03000E2C == FALSE) if (sBikeCameraPanFlag == FALSE)
return; return;
} }
else else
{ {
gUnknown_03000E2C = FALSE; sBikeCameraPanFlag = FALSE;
} }
var = GetPlayerMovementDirection(); var = GetPlayerMovementDirection();

View File

@ -1087,7 +1087,7 @@ static void LoadOrbEffectPalette(bool8 blueOrb)
} }
} }
static bool8 sub_80B02C8(u16 shakeDir) static bool8 UpdateOrbEffectBlend(u16 shakeDir)
{ {
u8 lo = REG_BLDALPHA & 0xFF; u8 lo = REG_BLDALPHA & 0xFF;
u8 hi = REG_BLDALPHA >> 8; u8 hi = REG_BLDALPHA >> 8;
@ -1095,21 +1095,17 @@ static bool8 sub_80B02C8(u16 shakeDir)
if (shakeDir != 0) if (shakeDir != 0)
{ {
if (lo) if (lo)
{
lo--; lo--;
}
} }
else else
{ {
if (hi < 0x10) if (hi < 16)
{
hi++; hi++;
}
} }
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(lo, hi)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(lo, hi));
if (lo == 0 && hi == 0x10) if (lo == 0 && hi == 16)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@ -1193,7 +1189,7 @@ static void Task_OrbEffect(u8 taskId)
{ {
tShakeDelay = 8; tShakeDelay = 8;
tShakeDir ^= 1; tShakeDir ^= 1;
if (sub_80B02C8(tShakeDir) == TRUE) if (UpdateOrbEffectBlend(tShakeDir) == TRUE)
{ {
tState = 5; tState = 5;
sub_8199DF0(0, PIXEL_FILL(0), 0, 1); sub_8199DF0(0, PIXEL_FILL(0), 0, 1);

View File

@ -36,37 +36,37 @@ static void LoadMapNamePopUpWindowBg(void);
static EWRAM_DATA u8 sPopupTaskId = 0; static EWRAM_DATA u8 sPopupTaskId = 0;
// .rodata // .rodata
static const u8 gMapPopUp_Table[][960] = static const u8 sMapPopUp_Table[][960] =
{ {
INCBIN_U8("graphics/interface/map_popup/wood.4bpp"), [MAPPOPUP_THEME_WOOD] = INCBIN_U8("graphics/interface/map_popup/wood.4bpp"),
INCBIN_U8("graphics/interface/map_popup/marble.4bpp"), [MAPPOPUP_THEME_MARBLE] = INCBIN_U8("graphics/interface/map_popup/marble.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone.4bpp"), [MAPPOPUP_THEME_STONE] = INCBIN_U8("graphics/interface/map_popup/stone.4bpp"),
INCBIN_U8("graphics/interface/map_popup/brick.4bpp"), [MAPPOPUP_THEME_BRICK] = INCBIN_U8("graphics/interface/map_popup/brick.4bpp"),
INCBIN_U8("graphics/interface/map_popup/underwater.4bpp"), [MAPPOPUP_THEME_UNDERWATER] = INCBIN_U8("graphics/interface/map_popup/underwater.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone2.4bpp"), [MAPPOPUP_THEME_STONE2] = INCBIN_U8("graphics/interface/map_popup/stone2.4bpp"),
}; };
static const u8 gMapPopUp_Outline_Table[][960] = static const u8 sMapPopUp_OutlineTable[][960] =
{ {
INCBIN_U8("graphics/interface/map_popup/wood_outline.4bpp"), [MAPPOPUP_THEME_WOOD] = INCBIN_U8("graphics/interface/map_popup/wood_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/marble_outline.4bpp"), [MAPPOPUP_THEME_MARBLE] = INCBIN_U8("graphics/interface/map_popup/marble_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone_outline.4bpp"), [MAPPOPUP_THEME_STONE] = INCBIN_U8("graphics/interface/map_popup/stone_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/brick_outline.4bpp"), [MAPPOPUP_THEME_BRICK] = INCBIN_U8("graphics/interface/map_popup/brick_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/underwater_outline.4bpp"), [MAPPOPUP_THEME_UNDERWATER] = INCBIN_U8("graphics/interface/map_popup/underwater_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone2_outline.4bpp"), [MAPPOPUP_THEME_STONE2] = INCBIN_U8("graphics/interface/map_popup/stone2_outline.4bpp"),
}; };
static const u16 gMapPopUp_Palette_Table[][16] = static const u16 sMapPopUp_PaletteTable[][16] =
{ {
INCBIN_U16("graphics/interface/map_popup/wood.gbapal"), [MAPPOPUP_THEME_WOOD] = INCBIN_U16("graphics/interface/map_popup/wood.gbapal"),
INCBIN_U16("graphics/interface/map_popup/marble_outline.gbapal"), [MAPPOPUP_THEME_MARBLE] = INCBIN_U16("graphics/interface/map_popup/marble_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/stone_outline.gbapal"), [MAPPOPUP_THEME_STONE] = INCBIN_U16("graphics/interface/map_popup/stone_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/brick_outline.gbapal"), [MAPPOPUP_THEME_BRICK] = INCBIN_U16("graphics/interface/map_popup/brick_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/underwater_outline.gbapal"), [MAPPOPUP_THEME_UNDERWATER] = INCBIN_U16("graphics/interface/map_popup/underwater_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/stone2_outline.gbapal"), [MAPPOPUP_THEME_STONE2] = INCBIN_U16("graphics/interface/map_popup/stone2_outline.gbapal"),
}; };
static const u16 gUnknown_0857F444[16] = INCBIN_U16("graphics/interface/map_popup/857F444.gbapal"); static const u16 sMapPopUp_Palette_Underwater[16] = INCBIN_U16("graphics/interface/map_popup/underwater.gbapal");
static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] = static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] =
{ {
@ -380,12 +380,12 @@ static void LoadMapNamePopUpWindowBg(void)
} }
popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId]; popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId];
LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), gMapPopUp_Outline_Table[popUpThemeId], 0x400, 0x21D); LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), sMapPopUp_OutlineTable[popUpThemeId], 0x400, 0x21D);
CallWindowFunction(popupWindowId, DrawMapNamePopUpFrame); CallWindowFunction(popupWindowId, DrawMapNamePopUpFrame);
PutWindowTilemap(popupWindowId); PutWindowTilemap(popupWindowId);
if (gMapHeader.weather == WEATHER_UNDERWATER_BUBBLES) if (gMapHeader.weather == WEATHER_UNDERWATER_BUBBLES)
LoadPalette(&gUnknown_0857F444, 0xE0, 0x20); LoadPalette(&sMapPopUp_Palette_Underwater, 0xE0, sizeof(sMapPopUp_Palette_Underwater));
else else
LoadPalette(gMapPopUp_Palette_Table[popUpThemeId], 0xE0, 0x20); LoadPalette(sMapPopUp_PaletteTable[popUpThemeId], 0xE0, sizeof(sMapPopUp_PaletteTable[0]));
BlitBitmapToWindow(popupWindowId, gMapPopUp_Table[popUpThemeId], 0, 0, 80, 24); BlitBitmapToWindow(popupWindowId, sMapPopUp_Table[popUpThemeId], 0, 0, 80, 24);
} }