drawmark.c
4.03 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/********************************************************************************
NINTENDO64 Disk Drive IPL4
mark drawing module
February 26, 1997
********************************************************************************/
#include <ultra64.h>
#include "ipl4.h"
#include "static.h"
#include "graphics.h"
#define MARK_RED 219,16,28
#define MARK_BLUE 82,75,152
#define gDPSetMaterial(g,c,a) gDPSetEnvColor(g,c,a)
static int mesgTimming = 0;
/********************************************************************************/
/* */
/* Display "NINTENDO64". */
/* */
/********************************************************************************/
extern void
DisplayNintendoLogo(int alpha)
{
gDPPipeSync (graphicp++);
gDPSetTexturePersp (graphicp++,G_TP_NONE);
gSPTexture (graphicp++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
gDPSetCombineMode (graphicp++, G_CC_ENVMODULATEIA, G_CC_ENVMODULATEIA);
gDPSetRenderMode (graphicp++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPLoadTextureBlock_4b(graphicp++, TexNintendo64a, G_IM_FMT_I, 112, 28, 0,
G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD
);
gDPSetMaterial(graphicp++, MARK_BLUE, alpha);
gSPTextureRectangle(graphicp++, 36*4, 32*4, 140*4, 60*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);
gDPLoadTextureBlock_4b(graphicp++, TexNintendo64b, G_IM_FMT_I, 112, 28, 0,
G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD
);
gSPTextureRectangle(graphicp++, 140*4, 32*4, 244*4, 60*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);
gDPLoadTextureBlock_4b(graphicp++, TexNintendo64d, G_IM_FMT_I, 16, 8, 0,
G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD
);
gSPTextureRectangle(graphicp++, 244*4, 52*4, 260*4, 60*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);
gDPLoadTextureBlock_4b(graphicp++, TexNintendo64c, G_IM_FMT_I, 48, 22, 0,
G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD
);
gDPSetMaterial(graphicp++, MARK_RED, alpha);
gSPTextureRectangle(graphicp++, 244*4, 25*4, 292*4, 47*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);
gDPPipeSync (graphicp++);
gDPSetTexturePersp (graphicp++, G_TP_PERSP);
gSPTexture (graphicp++, 0xffff, 0xffff, 0, 0, G_OFF);
}
/********************************************************************************/
/* */
/* Draw "Please insert disk". */
/* */
/********************************************************************************/
#define DISPLAY_WIDTH 160
static void
DrawInsertDisk(int posx, int posy, int alpha)
{
gDPPipeSync (graphicp++);
gDPSetTexturePersp (graphicp++,G_TP_NONE);
gSPTexture (graphicp++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
gDPSetCombineMode (graphicp++, G_CC_ENVMODULATEIA, G_CC_ENVMODULATEIA);
gDPSetRenderMode (graphicp++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPLoadTextureBlock_4b(graphicp++, TexInsertMessage, G_IM_FMT_I, DISPLAY_WIDTH, 16, 0,
G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD
);
gDPSetEnvColor(graphicp++, 49,157,71, alpha);
gSPTextureRectangle(graphicp++, posx*4, posy*4, (posx+DISPLAY_WIDTH)*4, (posy+16)*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);
gDPPipeSync (graphicp++);
gDPSetTexturePersp (graphicp++, G_TP_PERSP);
gSPTexture (graphicp++, 0xffff, 0xffff, 0, 0, G_OFF);
}
/********************************************************************************/
/* */
/* Display "Insert disk". */
/* */
/********************************************************************************/
#define DISPLAY_POSH 80
extern void
DisplayInsertDisk(int active)
{
int alpha = 255;
if (active && diskStatus == DISK_STAT_NODISK) {
if (mesgTimming < 6 ) alpha = mesgTimming * 48;
else if (mesgTimming < 36) alpha = 255;
else if (mesgTimming < 42) alpha = (41-mesgTimming) * 48;
else alpha = 0;
DrawInsertDisk(DISPLAY_POSH, 190, alpha);
if (++mesgTimming >= 50) mesgTimming = 0;
} else {
mesgTimming = 0;
}
}