appendGfx_message (#520)

* work on appendGfx_message

* :OK:

* indentation

* message window states

* PR comments

* ran formatter

* change some types

* debuggin

* undebuggin

Co-authored-by: Alex Bates <hi@imalex.xyz>
This commit is contained in:
Ethan Roseman 2021-11-12 07:23:43 -05:00 committed by GitHub
parent 81d3abc7a4
commit 34254d102e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1452 additions and 5175 deletions

View File

@ -996,7 +996,7 @@ typedef struct MessagePrintState {
/* 0x468 */ s8 lineCount;
/* 0x469 */ char unk_469[0x3];
/* 0x46C */ s32 unk_46C;
/* 0x470 */ s8 currentAnimFrame[4];
/* 0x470 */ u8 currentAnimFrame[4];
/* 0x474 */ s16 animTimers[4];
/* 0x47C */ s8 rewindArrowAnimState;
/* 0x47D */ char unk_47D[0x1];
@ -1005,11 +1005,11 @@ typedef struct MessagePrintState {
/* 0x482 */ Vec2s rewindArrowPos;
/* 0x486 */ s8 currentLine;
/* 0x487 */ u8 unkArraySize;
/* 0x488 */ s16 lineEndPos[4];
/* 0x488 */ u16 lineEndPos[4];
/* 0x490 */ char unk_490[0x38];
/* 0x4C8 */ s16 unk_4C8;
/* 0x4C8 */ u16 unk_4C8;
/* 0x4CA */ s16 unk_4CA;
/* 0x4CC */ s16 unk_4CC;
/* 0x4CC */ u16 unk_4CC;
/* 0x4CE */ s8 maxOption;
/* 0x4CF */ char unk_4CF[0x1];
/* 0x4D0 */ s16 cursorPosX[6];
@ -1028,10 +1028,10 @@ typedef struct MessagePrintState {
/* 0x500 */ s16 delayFlags; // ?
/* 0x502 */ char unk_502[0x2];
/* 0x504 */ s32* closedWritebackBool; // if not null, writes 1 here when message closes
/* 0x508 */ s8 style;
/* 0x508 */ u8 style;
/* 0x509 */ u8 fadeInCounter;
/* 0x50A */ Vec2s initOpenPos; // where the message originates from, in screen-space coords
/* 0x50E */ Vec2s openStartPos;
/* 0x50E */ Vec2su openStartPos;
/* 0x512 */ u8 fadeOutCounter;
/* 0x513 */ char unk_513[0x1];
/* 0x514 */ Vec2su windowSize;
@ -1046,17 +1046,17 @@ typedef struct MessagePrintState {
/* 0x528 */ s16 varBufferReadPos;
/* 0x52A */ s8 unk_52A;
/* 0x52B */ u8 currentImageIndex;
/* 0x52C */ Vec2s varImageScreenPos; // in addition, posX=0 is taken as 'dont draw'
/* 0x530 */ s8 varImgHasBorder;
/* 0x52C */ Vec2su varImageScreenPos; // in addition, posX=0 is taken as 'dont draw'
/* 0x530 */ u8 varImgHasBorder;
/* 0x531 */ u8 varImgFinalAlpha;
/* 0x532 */ s8 varImgAlphaFadeStep; // how much to fade in per frame
/* 0x533 */ s8 varImageDisplayState; // 0 = fade in, 1 = fully visible, 2 = fade out
/* 0x532 */ u8 varImgAlphaFadeStep; // how much to fade in per frame
/* 0x533 */ u8 varImageDisplayState; // 0 = fade in, 1 = fully visible, 2 = fade out
/* 0x534 */ s16 varImageFadeTimer; // frames faded in
/* 0x536 */ s16 msgHeight;
/* 0x538 */ s16 msgWidth;
/* 0x538 */ u16 msgWidth;
/* 0x53A */ s8 maxLineChars;
/* 0x53B */ s8 numLines;
/* 0x53C */ s8 maxLinesPerPage;
/* 0x53C */ u8 maxLinesPerPage;
/* 0x53D */ char unk_53D[0x3];
/* 0x540 */ f32 sizeScale;
/* 0x544 */ s32* letterBackgroundImg;
@ -1073,26 +1073,27 @@ typedef struct MessageDrawState {
/* 0x18 */ Vec2f charScale;
/* 0x20 */ s32 drawBufferPos; // msg gets printed here and read for display
/* 0x24 */ s16 savedPos[2];
/* 0x28 */ s8 savedColor;
/* 0x28 */ u8 savedColor;
/* 0x29 */ u8 unk_29;
/* 0x2A */ char unk_2A[0x1];
/* 0x2B */ s8 framePalette;
/* 0x2B */ u8 framePalette;
/* 0x2C */ s8 unk_2C;
/* 0x2D */ char unk_2D[0x1];
/* 0x2E */ s8 centerPos;
/* 0x2D */ u8 unk_2D;
/* 0x2E */ u8 centerPos;
/* 0x2F */ char unk_2F[0x1];
/* 0x30 */ s32 visiblePrintedCount;
/* 0x34 */ s16 printModeFlags; // C0 = center, 10 = drawing image
/* 0x34 */ u16 printModeFlags; // C0 = center, 10 = drawing image
/* 0x36 */ char unk_36[0x2];
/* 0x38 */ s32 effectFlags;
/* 0x3C */ s16 font; // 0 or 1
/* 0x3E */ s16 fontVariant;
/* 0x40 */ s16 currentPosX;
/* 0x42 */ s16 nextPos[2];
/* 0x38 */ u32 effectFlags;
/* 0x3C */ u16 font; // 0 or 1
/* 0x3E */ u16 fontVariant;
/* 0x40 */ u8 currentPosX;
/* 0x41 */ char unk_41;
/* 0x42 */ u16 nextPos[2];
/* 0x46 */ s16 textStartPos[2]; // relative to textbox
/* 0x4A */ s16 textColor;
/* 0x4C */ s8* printBuffer;
/* 0x50 */ s8 nextCounter; // related to closing mssages and cmd FA
/* 0x4C */ u8* printBuffer;
/* 0x50 */ u8 nextCounter; // related to closing mssages and cmd FA
/* 0x51 */ char unk_51[0x3];
} MessageDrawState; // size = 0x54
@ -1100,14 +1101,14 @@ typedef struct MessageCharData {
/* 0x0 */ s8* raster;
/* 0x4 */ u8* charWidthTable;
/* 0x8 */ u8 monospaceWidth;
/* 0x9 */ s8 baseHeightOffset;
/* 0x9 */ u8 baseHeightOffset;
/* 0xA */ char unk_0A[0x2];
} MessageCharData; // size = 0xC
typedef struct MessageCharset {
/* 0x0 */ Vec2b texSize;
/* 0x2 */ s8 unk_02;
/* 0x3 */ s8 newLineY;
/* 0x3 */ u8 newLineY;
/* 0x4 */ s16 charRasterSize; // in bytes
/* 0x6 */ char unk_06[0x2];
/* 0x8 */ MessageCharData* rasters;

View File

@ -2905,5 +2905,23 @@ enum ElementImmunityFlags {
ELEMENT_IMMUNITY_FLAGS_40000000 = 0x40000000,
ELEMENT_IMMUNITY_FLAGS_80000000 = 0x80000000,
};
enum MsgWindowStates {
MSG_WINDOW_STATE_DONE = 0x0,
MSG_WINDOW_STATE_INIT = 0x1,
MSG_WINDOW_STATE_OPENING = 0x2,
MSG_WINDOW_STATE_CLOSING = 0x3,
MSG_WINDOW_STATE_PRINTING = 0x4,
MSG_WINDOW_STATE_WAITING = 0x5,
MSG_WINDOW_STATE_SCROLLING = 0x6,
MSG_WINDOW_STATE_WAITING_FOR_CHOICE = 0x7,
MSG_WINDOW_STATE_SCROLLING_BACK = 0x8,
MSG_WINDOW_STATE_VIEWING_PREV = 0x9,
MSG_WINDOW_STATE_A = 0xA,
MSG_WINDOW_STATE_B = 0xB,
MSG_WINDOW_STATE_C = 0xC,
MSG_WINDOW_STATE_D = 0xD,
MSG_WINDOW_STATE_E = 0xE,
};
#endif

View File

@ -74,6 +74,9 @@ RenderTask* queue_render_task(RenderTask* task);
void setup_pause_menu_tab(MenuWindowBP* bpArray, s32 arraySize);
s32 draw_ci_image_with_clipping(s32* raster, s32 width, s32 height, s32 fmt, s32 bitDepth, s32* palette, s16 posX,
s16 posY, u16 clipULx, u16 clipULy, u16 clipLRx, u16 clipRLy, u8 opacity);
// append gfx funcs
void func_80257B28(s32);
void func_8025595C(Actor*);
@ -143,9 +146,9 @@ s32 player_test_lateral_overlap(s32, PlayerStatus*, f32*, f32*, f32*, f32, f32);
Npc* peach_make_disguise_npc(s32 peachDisguise);
void peach_set_disguise_anim(s32);
void draw_box(s32 flags, s32 windowStyle, s32 posX, s32 posY, s32 posZ, s32 width, s32 height, s32 opacity,
void draw_box(s32 flags, s32 windowStyle, s32 posX, s32 posY, s32 posZ, s32 width, s32 height, u8 opacity,
s32 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ, void (*fpDrawContents)(s32),
s32 drawContentsArg0, Matrix4f rotScaleMtx, s32 translateX, s32 translateY, Matrix4f* outMtx);
void* drawContentsArg0, Matrix4f rotScaleMtx, s32 translateX, s32 translateY, Matrix4f* outMtx);
s32 get_msg_width(s32 msgID, u16 charset);
s32 partner_player_can_pause(void);
@ -373,6 +376,7 @@ void remove_part_shadow(s32 actorID, s32 partIndex);
void create_part_shadow_by_ref(s32 arg0, ActorPart* part);
s32 func_80266D6C(ActorPart*, s32);
char* int_to_string(s32, char*, s32);
Evt* get_script_by_index(s32 index);

View File

@ -339,7 +339,7 @@ typedef struct ActorSounds {
/* 0x10 */ s32 jump;
/* 0x14 */ s32 hurt;
/* 0x18 */ s16 delay[2]; ///< Number of frames to wait between walk/fly sounds. Negative values are in distance.
} ActorSounds; // size = 0x20
} ActorSounds; // size = 0x1C
typedef struct ActorOffsets {
/* 0x00 */ Vec3b tattleCam;

1770
src/msg.c

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
#! /usr/bin/python3
import json
import glob
import os
@ -53,4 +54,4 @@ for thing in sorted(sizes.keys(), key=lambda x: sizes[x][4]):
print(thing.ljust(25) + str(val))
if print_funcs:
print(dict(sorted(funcs.items(), key=lambda f: f[1])))
print(json.dumps(dict(sorted(funcs.items(), key=lambda f: f[1])), indent=4))

File diff suppressed because it is too large Load Diff

View File

@ -338,8 +338,8 @@ glabel msg_draw_speech_bubble
/* C381C 8012D11C ACA30004 */ sw $v1, 4($a1)
/* C3820 8012D120 24430008 */ addiu $v1, $v0, 8
/* C3824 8012D124 AC830000 */ sw $v1, ($a0)
/* C3828 8012D128 3C058015 */ lui $a1, %hi(gMessageDrawStatePtr)
/* C382C 8012D12C 8CA55D74 */ lw $a1, %lo(gMessageDrawStatePtr)($a1)
/* C3828 8012D128 3C058015 */ lui $a1, %hi(msg_drawState)
/* C382C 8012D12C 8CA55D74 */ lw $a1, %lo(msg_drawState)($a1)
/* C3830 8012D130 3C03FD10 */ lui $v1, 0xfd10
/* C3834 8012D134 AC430000 */ sw $v1, ($v0)
/* C3838 8012D138 90A5002B */ lbu $a1, 0x2b($a1)

View File

@ -19061,7 +19061,7 @@ gMessageMsgVars = 0x80155C38; // type:data
D_80155C98 = 0x80155C98; // type:data
gMessageWindowProjMatrix = 0x80155CA0; // type:data
D_80155D20 = 0x80155D20; // type:data
gMessageDrawStatePtr = 0x80155D74; // type:data
msg_drawState = 0x80155D74; // type:data
D_80155D80 = 0x80155D80; // type:data
D_80155D84 = 0x80155D84; // type:data
D_80155D88 = 0x80155D88; // type:data

View File

@ -228,7 +228,7 @@ gMessageMsgVars = 0x80155C38;
D_80155C98 = 0x80155C98;
gMessageWindowProjMatrix = 0x80155CA0;
D_80155D20 = 0x80155D20;
gMessageDrawStatePtr = 0x80155D74;
msg_drawState = 0x80155D74;
D_80155D80 = 0x80155D80;
D_80155D84 = 0x80155D84;
D_80155D88 = 0x80155D88;