From ef4db3887fd9c0e2d00dfb4d3c4e011e8c412116 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Thu, 6 Oct 2022 20:49:46 -0700 Subject: [PATCH] Picto defines --- include/variables.h | 2 +- include/z64save.h | 11 ++++++++++- include/z64snap.h | 10 +++++----- src/code/z_play.c | 4 +++- src/code/z_snap.c | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/variables.h b/include/variables.h index 008b20a715..27d29b4d67 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3479,7 +3479,7 @@ extern GfxPool gGfxPools[2]; extern u8 gAudioHeap[0x138000]; extern u8 gSystemHeap[UNK_SIZE]; -extern u8 gPictoPhotoI8[0x4600]; +extern u8 gPictoPhotoI8[PICTO_SIZE]; extern u8 D_80784600[0x56200]; extern u16 gFramebuffer0[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/include/z64save.h b/include/z64save.h index 5a29e32b05..4847e17c84 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -133,6 +133,15 @@ typedef enum { /* 52 */ HUD_VISIBILITY_NONE_INSTANT = 52 } HudVisibility; +#define PICTO_RESOLUTION_WIDTH 160 +#define PICTO_RESOLUTION_HEIGHT 112 + +#define PICTO_TOPLEFT_X ((void)0, ((SCREEN_WIDTH - PICTO_RESOLUTION_WIDTH) / 2)) +#define PICTO_TOPLEFT_Y ((void)0, ((SCREEN_HEIGHT - PICTO_RESOLUTION_HEIGHT) / 2)) + +#define PICTO_SIZE (PICTO_RESOLUTION_WIDTH * PICTO_RESOLUTION_HEIGHT) +#define PICTO_COMPRESSED_SIZE (PICTO_SIZE * 5 / 8) + typedef struct SramContext { /* 0x00 */ u8* readBuff; /* 0x04 */ u8 *saveBuf; @@ -298,7 +307,7 @@ typedef struct SaveContext { /* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub" /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time" /* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time" - /* 0x10E0 */ u8 pictoPhotoI5[0x2BC0]; // buffer containing the pictograph photo, compressed to I5 from I8 + /* 0x10E0 */ u8 pictoPhotoI5[PICTO_COMPRESSED_SIZE]; // buffer containing the pictograph photo, compressed to I5 from I8 /* 0x3CA0 */ s32 fileNum; // "file_no" /* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer" /* 0x3CA6 */ u8 unk_3CA6; diff --git a/include/z64snap.h b/include/z64snap.h index fb3f861861..26a1201a07 100644 --- a/include/z64snap.h +++ b/include/z64snap.h @@ -36,11 +36,11 @@ typedef enum { /* 0x3F */ PICTOGRAPH_BAD_DISTANCE } PictographFlag; -// The following macros are subject to renaming once the capture system is better understood -#define PICTO_RESOLUTION_HORIZONTAL 150 -#define PICTO_RESOLUTION_VERTICAL 105 -#define PICTO_CAPTURE_REGION_TOPLEFT_X ((SCREEN_WIDTH - PICTO_RESOLUTION_HORIZONTAL) / 2) -#define PICTO_CAPTURE_REGION_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_RESOLUTION_VERTICAL) / 2) +// The subregion of the picto photo that will set the flag for an actor being in the photo +#define PICTO_CAPTURE_REGION_WIDTH 150 +#define PICTO_CAPTURE_REGION_HEIGHT 105 +#define PICTO_CAPTURE_REGION_TOPLEFT_X ((SCREEN_WIDTH - PICTO_CAPTURE_REGION_WIDTH) / 2) +#define PICTO_CAPTURE_REGION_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_CAPTURE_REGION_HEIGHT) / 2) s32 Snap_RecordPictographedActors(PlayState* play); void Snap_SetFlag(s32 flag); diff --git a/src/code/z_play.c b/src/code/z_play.c index 6c54634a09..9299d824b5 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -211,7 +211,9 @@ void Play_TriggerPictographPhoto(void) { void Play_TakePictographPhoto(PreRender* prerender) { PreRender_ApplyFilters(prerender); - Play_ConvertRgba16ToIntensityImage(gPictoPhotoI8, prerender->fbufSave, 320, 80, 64, 240 - 1, 176 - 1, 8); + Play_ConvertRgba16ToIntensityImage(gPictoPhotoI8, prerender->fbufSave, SCREEN_WIDTH, PICTO_TOPLEFT_X, + PICTO_TOPLEFT_Y, (PICTO_TOPLEFT_X + PICTO_RESOLUTION_WIDTH) - 1, + (PICTO_TOPLEFT_Y + PICTO_RESOLUTION_HEIGHT) - 1, 8); } s32 Play_ChooseDynamicTransition(PlayState* this, s32 transitionType) { diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 5d37e3eac7..cb8c5b5c9a 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -174,7 +174,7 @@ s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, y = (s16)PROJECTED_TO_SCREEN_Y(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_Y; // checks if the coordinates are within the capture region - if ((x < 0) || (x > PICTO_RESOLUTION_HORIZONTAL) || (y < 0) || (y > PICTO_RESOLUTION_VERTICAL)) { + if ((x < 0) || (x > PICTO_CAPTURE_REGION_WIDTH) || (y < 0) || (y > PICTO_CAPTURE_REGION_HEIGHT)) { Snap_SetFlag(PICTOGRAPH_NOT_IN_VIEW); ret |= PICTOGRAPH_NOT_IN_VIEW; }