diff --git a/include/variables.h b/include/variables.h index 805a14ea2..c4c8334e1 100644 --- a/include/variables.h +++ b/include/variables.h @@ -2919,7 +2919,7 @@ extern GfxPool gGfxPools[2]; extern u8 gAudioHeap[0x138000]; extern u8 gSystemHeap[UNK_SIZE]; -extern u8 gPictoPhotoI8[]; // PICTO_RESOLUTION_X * PICTO_RESOLUTION_Y +extern u8 gPictoPhotoI8[PICTO_PHOTO_SIZE]; extern u8 D_80784600[0x56200]; extern u16 gFramebuffer0[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/include/z64.h b/include/z64.h index 34c7c4627..f2cfc7d0f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -988,7 +988,7 @@ struct PlayState { /* 0x18B9C */ char unk_18B9C[0x2B8]; /* 0x18E54 */ SceneTableEntry* loadedScene; /* 0x18E58 */ char unk_18E58[0x4]; - /* 0x18E5C */ u8* pictoPhotoI8; + /* 0x18E5C */ TexturePtr pictoPhotoI8; /* 0x18E60 */ char unk_18E60[0x8]; /* 0x18E68 */ void* unk_18E68; /* 0x18E6C */ char unk_18E6C[0x3EC]; diff --git a/include/z64save.h b/include/z64save.h index 521d70d89..ff56e9d64 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -145,12 +145,14 @@ typedef enum { /* 52 */ HUD_VISIBILITY_NONE_INSTANT = 52 } HudVisibility; -#define PICTO_RESOLUTION_X 160 -#define PICTO_RESOLUTION_Y 112 +#define PICTO_PHOTO_WIDTH 160 +#define PICTO_PHOTO_HEIGHT 112 -#define PICTO_TOPLEFT_X ((SCREEN_WIDTH - PICTO_RESOLUTION_X) / 2) -// Picture is offset up by 33 pixels to give room for the message box at the bottom -#define PICTO_TOPLEFT_Y (((SCREEN_HEIGHT - PICTO_RESOLUTION_Y) / 2) - 33) +#define PICTO_PHOTO_TOPLEFT_X ((SCREEN_WIDTH - PICTO_PHOTO_WIDTH) / 2) +#define PICTO_PHOTO_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_PHOTO_HEIGHT) / 2) + +#define PICTO_PHOTO_SIZE (PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT) +#define PICTO_PHOTO_COMPRESSED_SIZE (PICTO_PHOTO_SIZE * 5 / 8) typedef struct SramContext { /* 0x00 */ u8* readBuff; @@ -317,7 +319,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[PICTO_RESOLUTION_X * PICTO_RESOLUTION_Y * 5 / 8]; // buffer containing the pictograph photo + /* 0x10E0 */ u8 pictoPhotoI5[PICTO_PHOTO_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 237245470..fb3f86186 100644 --- a/include/z64snap.h +++ b/include/z64snap.h @@ -36,11 +36,11 @@ typedef enum { /* 0x3F */ PICTOGRAPH_BAD_DISTANCE } PictographFlag; -// The subregion of the picto photo that will set the flag for an actor being in the photo -#define PICTO_CAPTURE_REGION_HORIZONTAL 150 -#define PICTO_CAPTURE_REGION_VERTICAL 105 -#define PICTO_CAPTURE_REGION_TOPLEFT_X ((SCREEN_WIDTH - PICTO_CAPTURE_REGION_HORIZONTAL) / 2) -#define PICTO_CAPTURE_REGION_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_CAPTURE_REGION_VERTICAL) / 2) +// 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) s32 Snap_RecordPictographedActors(PlayState* play); void Snap_SetFlag(s32 flag); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 3cfc9b3ef..9ac439817 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2386,7 +2386,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_PICTOGRAPH_ON)) { Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, (u8*)((void)0, gSaveContext.pictoPhotoI5), - PICTO_RESOLUTION_X * PICTO_RESOLUTION_Y); + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; restoreHudVisibility = true; sPictographState = PICTOGRAPH_STATE_OFF; @@ -2425,7 +2425,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { if (sPictographPhotoBeingTaken) { Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, (u8*)((void)0, gSaveContext.pictoPhotoI5), - PICTO_RESOLUTION_X * PICTO_RESOLUTION_Y); + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); Snap_RecordPictographedActors(play); } play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTOGRAPH_ON; @@ -2457,7 +2457,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { } else { Play_DecompressI5ToI8((u8*)((void)0, gSaveContext.pictoPhotoI5), (play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, - PICTO_RESOLUTION_X * PICTO_RESOLUTION_Y); + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); play->haltAllActors = true; sPictographState = PICTOGRAPH_STATE_SETUP_PHOTO; } @@ -6676,7 +6676,7 @@ void Interface_Draw(PlayState* play) { if (sPictographState >= PICTOGRAPH_STATE_SETUP_PHOTO) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_PICTOGRAPH_ON)) { Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, - (u8*)gSaveContext.pictoPhotoI5, PICTO_RESOLUTION_X * PICTO_RESOLUTION_Y); + (u8*)gSaveContext.pictoPhotoI5, PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; @@ -6706,17 +6706,18 @@ void Interface_Draw(PlayState* play) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEI_PRIM, G_CC_MODULATEI_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 250, 160, 160, 255); - pictoRectTop = PICTO_TOPLEFT_Y; - for (sp2CC = 0; sp2CC < (PICTO_RESOLUTION_Y / 8); sp2CC++, pictoRectTop += 8) { - pictoRectLeft = PICTO_TOPLEFT_X; + // Picture is offset up by 33 pixels to give room for the message box at the bottom + pictoRectTop = PICTO_PHOTO_TOPLEFT_Y - 33; + for (sp2CC = 0; sp2CC < (PICTO_PHOTO_HEIGHT / 8); sp2CC++, pictoRectTop += 8) { + pictoRectLeft = PICTO_PHOTO_TOPLEFT_X; gDPLoadTextureBlock(OVERLAY_DISP++, (u8*)((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90) + (0x500 * sp2CC), - G_IM_FMT_I, G_IM_SIZ_8b, PICTO_RESOLUTION_X, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_IM_FMT_I, G_IM_SIZ_8b, PICTO_PHOTO_WIDTH, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(OVERLAY_DISP++, pictoRectLeft << 2, pictoRectTop << 2, - (pictoRectLeft + PICTO_RESOLUTION_X) << 2, (pictoRectTop << 2) + (8 << 2), + (pictoRectLeft + PICTO_PHOTO_WIDTH) << 2, (pictoRectTop << 2) + (8 << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 5e9ced024..5d37e3eac 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_CAPTURE_REGION_HORIZONTAL) || (y < 0) || (y > PICTO_CAPTURE_REGION_VERTICAL)) { + if ((x < 0) || (x > PICTO_RESOLUTION_HORIZONTAL) || (y < 0) || (y > PICTO_RESOLUTION_VERTICAL)) { Snap_SetFlag(PICTOGRAPH_NOT_IN_VIEW); ret |= PICTOGRAPH_NOT_IN_VIEW; }