mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 11:24:40 +00:00
Decompile z_play.c and Match/Document some of z_view.c (#74)
* Decompile z_play.c and Match/Document some of z_view.c Also fix the last non matching in z_sample.c and update some game state functions. * Suggestions from PR #74 * Fix undefined reference to Gameplay_DrawOverlay * Suggestion from PR #74 (2) * Fix a fake argument in func_800BC450
This commit is contained in:
parent
9ac1f8130d
commit
262f6c507c
278 changed files with 5139 additions and 5939 deletions
|
@ -2,21 +2,17 @@
|
|||
#include <global.h>
|
||||
#include <PR/os_cont.h>
|
||||
|
||||
void Sample_Calc(SampleContext* this) {
|
||||
void Sample_HandleStateChange(SampleContext* this) {
|
||||
if (!~(this->state.input[0].press.in.button | ~START_BUTTON)) {
|
||||
SET_NEXT_GAMESTATE(&this->state, func_800BCA64, GlobalContext);
|
||||
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
|
||||
this->state.running = false;
|
||||
}
|
||||
}
|
||||
|
||||
// very close from matching, the only difference is the place of "mtx" in the stack
|
||||
#ifdef NON_MATCHING
|
||||
void Sample_Draw(SampleContext* this) {
|
||||
u32 pad;
|
||||
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
||||
View* view = &this->view;
|
||||
Gfx* dispRefs[4];
|
||||
Mtx* mtx;
|
||||
Gfx* dispRefs[5];
|
||||
|
||||
Graph_OpenDisps(dispRefs, gfxCtx, "../z_sample.c", 62);
|
||||
|
||||
|
@ -25,12 +21,14 @@ void Sample_Draw(SampleContext* this) {
|
|||
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
|
||||
view->unk_120 = 7;
|
||||
view->flags = 1 | 2 | 4;
|
||||
func_800AAA50(view, 15);
|
||||
|
||||
mtx = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
func_80103D58(mtx, SREG(37), SREG(38), SREG(39), 1.0f, SREG(40), SREG(41), SREG(42));
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, mtx, G_MTX_LOAD);
|
||||
if (1) {
|
||||
Mtx* mtx = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
func_80103D58(mtx, SREG(37), SREG(38), SREG(39), 1.0f, SREG(40), SREG(41), SREG(42));
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, mtx, G_MTX_LOAD);
|
||||
}
|
||||
|
||||
gfxCtx->polyOpa.p = Gfx_SetFog2(gfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0);
|
||||
func_80093D18(gfxCtx);
|
||||
|
@ -42,13 +40,10 @@ void Sample_Draw(SampleContext* this) {
|
|||
|
||||
Graph_CloseDisps(dispRefs, gfxCtx, "../z_sample.c", 111);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/Sample_Draw.s")
|
||||
#endif
|
||||
|
||||
void Sample_Update(SampleContext* this) {
|
||||
void Sample_Main(SampleContext* this) {
|
||||
Sample_Draw(this);
|
||||
Sample_Calc(this);
|
||||
Sample_HandleStateChange(this);
|
||||
}
|
||||
|
||||
void Sample_Destroy(SampleContext* this) {
|
||||
|
@ -57,21 +52,21 @@ void Sample_Destroy(SampleContext* this) {
|
|||
void Sample_SetupView(SampleContext* this) {
|
||||
View* view;
|
||||
GraphicsContext* gfxCtx;
|
||||
u32 v0[4];
|
||||
Viewport viewport;
|
||||
Vec3f v1;
|
||||
Vec3f v2;
|
||||
Vec3f v3;
|
||||
|
||||
view = &this->view;
|
||||
gfxCtx = this->state.gfxCtx;
|
||||
func_800AA278(view, gfxCtx);
|
||||
View_Init(view, gfxCtx);
|
||||
|
||||
// clang-format off
|
||||
v0[1] = SCREEN_HEIGHT; v0[3] = SCREEN_WIDTH;
|
||||
v0[0] = 0; v0[2] = 0;
|
||||
viewport.bottomY = SCREEN_HEIGHT; viewport.rightX = SCREEN_WIDTH;
|
||||
viewport.topY = 0; viewport.leftX = 0;
|
||||
// clang-format on
|
||||
|
||||
func_800AA4FC(view, &v0);
|
||||
View_SetViewport(view, &viewport);
|
||||
func_800AA460(view, 60, 10, 12800);
|
||||
|
||||
v1.x = 0;
|
||||
|
@ -95,7 +90,7 @@ void Sample_LoadTitleStatic(SampleContext* this) {
|
|||
}
|
||||
|
||||
void Sample_Init(SampleContext* this) {
|
||||
this->state.main = Sample_Update;
|
||||
this->state.main = Sample_Main;
|
||||
this->state.destroy = Sample_Destroy;
|
||||
R_UPDATE_RATE = 1;
|
||||
Sample_SetupView(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue