cleanup picto, sync with play

This commit is contained in:
engineer124
2022-11-23 11:57:49 -05:00
parent e6d93a7155
commit 43e9eb2c4e
6 changed files with 26 additions and 23 deletions
+1 -1
View File
@@ -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];
+1 -1
View File
@@ -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];
+8 -6
View File
@@ -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;
+5 -5
View File
@@ -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);
+10 -9
View File
@@ -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);
}
}
+1 -1
View File
@@ -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;
}