1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-22 21:35:27 +00:00
oot/src/code/z_sample.c

99 lines
2.6 KiB
C
Raw Normal View History

#include "global.h"
2020-03-17 04:31:30 +00:00
void Sample_HandleStateChange(SampleContext* this) {
if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) {
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
this->state.running = false;
}
}
2020-03-17 04:31:30 +00:00
2020-03-22 21:19:43 +00:00
void Sample_Draw(SampleContext* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
View* view = &this->view;
2020-03-17 04:31:30 +00:00
OPEN_DISPS(gfxCtx, "../z_sample.c", 62);
2020-03-17 04:31:30 +00:00
gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL);
gSPSegment(oGfxCtx->polyOpa.p++, 0x01, this->staticSegment);
2020-03-17 04:31:30 +00:00
func_80095248(gfxCtx, 0, 0, 0);
2020-03-17 04:31:30 +00:00
view->flags = 1 | 2 | 4;
func_800AAA50(view, 15);
2020-03-17 04:31:30 +00:00
{
Mtx* mtx = Graph_Alloc(gfxCtx, sizeof(Mtx));
guPosition(mtx, SREG(37), SREG(38), SREG(39), 1.0f, SREG(40), SREG(41), SREG(42));
gSPMatrix(oGfxCtx->polyOpa.p++, mtx, G_MTX_LOAD);
}
2020-03-17 04:31:30 +00:00
oGfxCtx->polyOpa.p = Gfx_SetFog2(oGfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0);
func_80093D18(gfxCtx);
2020-03-24 23:52:07 +00:00
gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_1CYCLE);
gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gDPSetCombineMode(oGfxCtx->polyOpa.p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 255, 255, 0, 0);
CLOSE_DISPS(gfxCtx, "../z_sample.c", 111);
}
void Sample_Main(SampleContext* this) {
Sample_Draw(this);
Sample_HandleStateChange(this);
}
2020-03-22 21:19:43 +00:00
void Sample_Destroy(SampleContext* this) {
}
2020-03-22 21:19:43 +00:00
void Sample_SetupView(SampleContext* this) {
View* view;
GraphicsContext* gfxCtx;
view = &this->view;
gfxCtx = this->state.gfxCtx;
View_Init(view, gfxCtx);
SET_FULLSCREEN_VIEWPORT(view);
func_800AA460(view, 60, 10, 12800);
{
Vec3f v1;
Vec3f v2;
Vec3f v3;
v1.x = 0;
v1.y = 0;
v2.x = 0;
v2.y = 0;
v2.z = 0;
v3.x = 0;
v3.z = 0;
v1.z = 3000;
v3.y = 1;
func_800AA358(view, &v1, &v2, &v3);
}
}
2020-03-22 21:19:43 +00:00
void Sample_LoadTitleStatic(SampleContext* this) {
2020-03-22 18:32:44 +00:00
u32 size = _title_staticSegmentRomEnd - _title_staticSegmentRomStart;
2020-03-22 21:19:43 +00:00
this->staticSegment = GameState_Alloc(&this->state, size, "../z_sample.c", 163);
DmaMgr_SendRequest1(this->staticSegment, _title_staticSegmentRomStart, size, "../z_sample.c", 164);
}
2020-03-22 21:19:43 +00:00
void Sample_Init(SampleContext* this) {
this->state.main = Sample_Main;
this->state.destroy = Sample_Destroy;
R_UPDATE_RATE = 1;
Sample_SetupView(this);
Sample_LoadTitleStatic(this);
SREG(37) = 0;
SREG(38) = 0;
SREG(39) = 0;
SREG(40) = 0;
SREG(41) = 0;
SREG(42) = 0;
}