2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-04-30 18:41:09 +00:00
|
|
|
|
2022-06-06 19:37:25 +00:00
|
|
|
#include "assets/code/fbdemo_wipe1/z_fbdemo_wipe1.c"
|
2020-04-30 18:41:09 +00:00
|
|
|
|
|
|
|
Gfx sWipeDList[] = {
|
|
|
|
gsDPPipeSync(),
|
|
|
|
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
|
|
|
|
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
|
|
|
|
gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH),
|
|
|
|
gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
|
|
|
G_TD_CLAMP | G_TP_PERSP | G_CYC_2CYCLE | G_PM_1PRIMITIVE,
|
|
|
|
G_AC_NONE | G_ZS_PRIM | G_RM_PASS | G_RM_AA_ZB_TEX_EDGE2),
|
|
|
|
gsDPSetCombineLERP(TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, COMBINED, 0,
|
|
|
|
PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0),
|
|
|
|
gsDPSetPrimDepth(0, 0),
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
gsDPLoadTextureBlock_4b(sWipe1Tex, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 6, 6,
|
|
|
|
11, G_TX_NOLOD),
|
2021-11-09 01:51:45 +00:00
|
|
|
gsDPLoadMultiBlock_4b(sWipe1Tex, 0x0100, 1, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
2020-04-30 18:41:09 +00:00
|
|
|
G_TX_MIRROR | G_TX_WRAP, 6, 6, 11, 1),
|
|
|
|
gsDPSetTextureLUT(G_TT_NONE),
|
|
|
|
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
|
|
|
gsSPDisplayList(0x08000000),
|
2021-11-09 01:51:45 +00:00
|
|
|
gsSPVertex(sWipe1Vtx, 25, 0),
|
2020-04-30 18:41:09 +00:00
|
|
|
gsSP2Triangles(0, 1, 2, 0, 1, 3, 4, 0),
|
|
|
|
gsSP2Triangles(5, 6, 7, 0, 6, 8, 9, 0),
|
|
|
|
gsSP2Triangles(8, 10, 11, 0, 10, 12, 13, 0),
|
|
|
|
gsSP2Triangles(12, 14, 15, 0, 14, 16, 17, 0),
|
|
|
|
gsSP2Triangles(16, 18, 19, 0, 18, 20, 21, 0),
|
|
|
|
gsSP2Triangles(20, 22, 23, 0, 22, 0, 24, 0),
|
|
|
|
gsSPEndDisplayList(),
|
|
|
|
};
|
|
|
|
|
|
|
|
// unused.
|
|
|
|
Gfx sWipeSyncDList[] = {
|
|
|
|
gsDPPipeSync(),
|
|
|
|
gsSPEndDisplayList(),
|
|
|
|
};
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_Start(void* thisx) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2022-05-07 14:10:06 +00:00
|
|
|
this->isDone = false;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
if (this->direction) {
|
|
|
|
this->texY = 0x14D;
|
|
|
|
} else {
|
|
|
|
this->texY = 0x264;
|
|
|
|
}
|
|
|
|
|
|
|
|
guPerspective(&this->projection, &this->normal, 60.0f, (4.0 / 3.0f), 10.0f, 12800.0f, 1.0f);
|
|
|
|
guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void* TransitionWipe_Init(void* thisx) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
bzero(this, sizeof(*this));
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_Destroy(void* thisx) {
|
2020-04-30 18:41:09 +00:00
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_Update(void* thisx, s32 updateRate) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2020-04-30 18:41:09 +00:00
|
|
|
|
|
|
|
if (this->direction != 0) {
|
2022-05-07 14:10:06 +00:00
|
|
|
this->texY += (((void)0, gSaveContext.transWipeSpeed) * 3) / updateRate;
|
2020-04-30 18:41:09 +00:00
|
|
|
if (this->texY >= 0x264) {
|
|
|
|
this->texY = 0x264;
|
2022-05-07 14:10:06 +00:00
|
|
|
this->isDone = true;
|
2020-04-30 18:41:09 +00:00
|
|
|
}
|
|
|
|
} else {
|
2022-05-07 14:10:06 +00:00
|
|
|
this->texY -= (((void)0, gSaveContext.transWipeSpeed) * 3) / updateRate;
|
|
|
|
if (this->texY <= 0x14D) {
|
2020-04-30 18:41:09 +00:00
|
|
|
this->texY = 0x14D;
|
2022-05-07 14:10:06 +00:00
|
|
|
this->isDone = true;
|
2020-04-30 18:41:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_Draw(void* thisx, Gfx** gfxP) {
|
2020-04-30 18:41:09 +00:00
|
|
|
Gfx* gfx = *gfxP;
|
|
|
|
Mtx* modelView;
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
s32 pad[4];
|
2020-04-30 18:41:09 +00:00
|
|
|
Gfx* tex;
|
|
|
|
|
|
|
|
modelView = this->modelView[this->frame];
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
this->frame ^= 1;
|
|
|
|
guScale(&modelView[0], 0.56f, 0.56f, 1.0f);
|
|
|
|
guRotate(&modelView[1], 0.0f, 0.0f, 0.0f, 1.0f);
|
|
|
|
guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f);
|
|
|
|
gDPPipeSync(gfx++);
|
|
|
|
tex = Gfx_BranchTexScroll(&gfx, this->texX, this->texY, 0, 0);
|
|
|
|
gSPSegment(gfx++, 8, tex);
|
2020-07-17 01:37:53 +00:00
|
|
|
gDPSetPrimColor(gfx++, 0, 0x80, this->color.r, this->color.g, this->color.b, 255);
|
2020-04-30 18:41:09 +00:00
|
|
|
gSPMatrix(gfx++, &this->projection, G_MTX_LOAD | G_MTX_PROJECTION);
|
|
|
|
gSPPerspNormalize(gfx++, this->normal);
|
|
|
|
gSPMatrix(gfx++, &this->lookAt, G_MTX_MUL | G_MTX_PROJECTION);
|
|
|
|
gSPMatrix(gfx++, &modelView[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
|
|
|
gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
|
|
|
gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
|
|
|
gSPDisplayList(gfx++, sWipeDList);
|
|
|
|
gDPPipeSync(gfx++);
|
|
|
|
*gfxP = gfx;
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
s32 TransitionWipe_IsDone(void* thisx) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
return this->isDone;
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_SetType(void* thisx, s32 type) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
if (type == 1) {
|
|
|
|
this->direction = 1;
|
|
|
|
} else {
|
|
|
|
this->direction = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->direction != 0) {
|
|
|
|
this->texY = 0x14D;
|
|
|
|
} else {
|
|
|
|
this->texY = 0x264;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_SetColor(void* thisx, u32 color) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
this->color.rgba = color;
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void TransitionWipe_SetEnvColor(void* thisx, u32 color) {
|
2021-12-04 16:33:00 +00:00
|
|
|
TransitionWipe* this = (TransitionWipe*)thisx;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
this->envColor.rgba = color;
|
|
|
|
}
|