summaryrefslogtreecommitdiff
path: root/src/code/z_prenmi.c
blob: 6bf73b057722b31c2b3bf19644d78f3ab43a59a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "gfx.h"
#include "gfx_setupdl.h"
#include "prenmi_state.h"
#include "printf.h"
#include "regs.h"
#include "terminal.h"
#include "versions.h"
#include "vi_mode.h"

void func_80092320(PreNMIState* this) {
    this->state.running = false;
    this->state.init = NULL;
    this->state.size = 0;
}

void PreNMI_Update(PreNMIState* this) {
    PRINTF(VT_COL(YELLOW, BLACK) "prenmi_move\n" VT_RST);

    // Strings existing only in rodata
    if (0) {
        PRINTF("../z_prenmi.c");
        PRINTF("(int)volume = %d\n");
    }

    if (this->timer == 0) {
#if OOT_VERSION < PAL_1_0
        osViSetYScale(1.0f);
        osViBlack(true);
#else
        ViConfig_UpdateVi(true);
#endif
        func_80092320(this);
        return;
    }

    this->timer--;
}

void PreNMI_Draw(PreNMIState* this) {
    GraphicsContext* gfxCtx = this->state.gfxCtx;

    PRINTF(VT_COL(YELLOW, BLACK) "prenmi_draw\n" VT_RST);

    OPEN_DISPS(gfxCtx, "../z_prenmi.c", 96);

    gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
    Gfx_SetupFrame(gfxCtx, 0, 0, 0);
    Gfx_SetupDL_36Opa(gfxCtx);
    gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1));
    gDPFillRectangle(POLY_OPA_DISP++, 0, this->timer + 100, SCREEN_WIDTH - 1, this->timer + 100);

    CLOSE_DISPS(gfxCtx, "../z_prenmi.c", 112);
}

void PreNMI_Main(GameState* thisx) {
    PreNMIState* this = (PreNMIState*)thisx;

    PreNMI_Update(this);
    PreNMI_Draw(this);

    this->state.inPreNMIState = true;
}

void PreNMI_Destroy(GameState* thisx) {
}

void PreNMI_Init(GameState* thisx) {
    PreNMIState* this = (PreNMIState*)thisx;

    this->state.main = PreNMI_Main;
    this->state.destroy = PreNMI_Destroy;
    this->timer = 30;
    this->unk_A8 = 10;

    R_UPDATE_RATE = 1;
}