graphics.h
9.13 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/********************************************************************************
graphics.h: NINTENDO64 DD Disk Drive IPL4 header.
December 25, 1986
********************************************************************************/
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include "mathfunc.h"
typedef char * MemPtr;
typedef Gfx * GfxPtr;
typedef Mtx * MtxPtr;
#define RGBA16(r,g,b,a) (((r)<<11) | ((g)<< 6) | ((b)<<1) | (a))
/********************************************************************************/
/* */
/* */
/* N-Cube control record */
/* */
/* */
/********************************************************************************/
typedef struct {
short type; /* drawing type */
short flag; /* flag */
ushort * texture1; /* number of texture 1 */
ushort * texture2; /* number of texture 2 */
FVector scaling; /* shape scale (x,y,z) */
FVector position; /* shape position (x,y,z) */
FVector velocity; /* shape moving velocity (x,y,z) */
SVector angle; /* shape angle (x,y,z) */
SVector angvelo; /* shape angle velocity (x,y,z) */
RGBAColor color; /* effect color (r,g,b,a) */
} CtrlNCube;
#define NCUBE_TYPE_COLOR 0
#define NCUBE_TYPE_COLCOMBINE 1
#define NCUBE_TYPE_TXTCOMBINE 2
#define NCUBE_TYPE_TXTOVERLAP 3
#define NCUBE_TYPE_BUMPMAP 4
#define NCUBE_FLAG_NORMAL (1<<0)
#define NCUBE_FLAG_MIRROR (1<<1)
#define NCUBE_DRAW_NORMAL 0
#define NCUBE_DRAW_MIRROR 1
extern void DisplayNCube(CtrlNCube *ncube);
/********************************************************************************/
/* */
/* */
/* Leaf control record */
/* */
/* */
/********************************************************************************/
typedef struct {
short flag; /* flag */
short shake; /* shake parameter */
SVector angle; /* leaf angle (x,y,z) */
SVector angvelo; /* leaf angle velocity */
FVector position; /* leaf position (x,y,z) */
FVector scaling; /* leaf scale (x,y,z) */
float moving; /* leaf moving speed */
float falling; /* leaf falling speed */
} CtrlLeaf;
#define LEAF_DRAW_NORMAL 0
#define LEAF_DRAW_MIRROR 1
extern void InitLeaf(void);
extern void DrawLeaf(void);
extern void MakeLeaf(FVector *position);
extern void BlowLeaf(FVector *center);
/********************************************************************************/
/* */
/* */
/* Skeleton shape control records */
/* */
/* */
/********************************************************************************/
#define HMS_ANIM_NORMAL (1<<0)
#define HMS_ANIM_ONETIME (1<<1)
typedef struct AnimeData {
short attr; /* attribute */
short waist; /* height base */
short start; /* start frame number */
short loop; /* loop frame number */
short nframes; /* number of frames */
short njoints; /* number of joiunts */
short * param; /* pointer to the parameters */
short * table; /* pointer to the animation */
} AnimeData;
typedef struct AnimeCtrl {
short code; /* animation ID */
ushort ctrl; /* animation control flags */
AnimeData * anime; /* pointer to the animation data */
long frame; /* frame counter */
long speed; /* animation speed */
} AnimeCtrl;
typedef struct AnimePlay {
short status; /* skeleton animation status */
short frame; /* skeleton animation frame */
float scale; /* animation scale */
short *table; /* pointer to the animation table */
short *param; /* pointer to the animation parameter */
} AnimePlay;
typedef struct HmsDynamic {
ulong flags; /* flags */
short angle; /* object rotation angle */
short angvelo; /* angle velocity */
float scale; /* scaling */
float speed; /* object speed */
float accele; /* accele */
float jumping; /* jumping speed */
float ground; /* ground height */
FVector position; /* object position */
AnimeCtrl animation; /* information for the skeleton anime */
} CtrlShape;
typedef void (*Skeleton)(short flags);
#define SHAPE_DRAW_NORMAL 0
#define SHAPE_DRAW_MIRROR 1
#define SHAPE_FLAG_OPENHAND 0x4000
#define SHAPE_FLAG_ENABLE 0x8000
extern void MarioSkeleton(short flags);
extern int SetAnimation(CtrlShape *shape, short id, AnimeData *anime, long speed);
extern void DrawSkeleton(CtrlShape *shape, Skeleton skeleton, int mirror);
/********************************************************************************/
/* */
/* */
/* Mario sequence records */
/* */
/* */
/********************************************************************************/
#define SEQ_FLAG_JUMPING 0x0001
#define SEQ_FLAG_SETHEIGHT 0x0002
#define SEQ_FLAG_MAKELEAF 0x0004
#define SEQ_FLAG_BLOWLEAF 0x0008
#define SEQ_FLAG_ROTATION 0x0010
#define SEQ_FLAG_OPENHAND SHAPE_FLAG_OPENHAND
#define SEQ_FLAG_ENABLE SHAPE_FLAG_ENABLE
typedef struct {
uchar counter;
uchar nframes;
short angle;
float posx1, posz1;
float posx2, posz2;
float posx3, posz3;
float posx4, posz4;
} Curve;
extern void InitializeMario(void);
extern int DisplayMario(int event);
/********************************************************************************/
/* */
/* */
/* Fader control record */
/* */
/* */
/********************************************************************************/
typedef struct {
ushort flag; /* fader flag */
uchar counter; /* fade counter */
uchar nframes; /* number of frames */
RGBAColor color; /* fade color (r,g,b) */
} CtrlFader;
#define FADER_FLAG_INACTIVE 0
#define FADER_FLAG_FADEIN 1
#define FADER_FLAG_FADEOUT 2
/********************************************************************************/
/* */
/* */
/* Wave record */
/* */
/* */
/********************************************************************************/
typedef struct Point {
short px;
short pz;
short py;
short ct;
float nx;
float ny;
float nz;
} WaveVertex;
extern void InitializeWater(void);
extern void DisplayWater(void);
/********************************************************************************/
/* */
/* */
/* Bump mapping routines */
/* */
/* */
/********************************************************************************/
extern void InitBumpNCube(void);
extern void *NewBumpMap(int tw, int th, float nx, float ny, float nz,
float a, float d, float s, float h, float sh, void *p);
extern void *UpdateBumpMap(void *p, float *l, float *m, float *vm);
extern void *malloc(long size);
/********************************************************************************/
/* */
/* */
/* Message drawing routines */
/* */
/* */
/********************************************************************************/
typedef struct {
char cursor; /* cursor position */
char blink; /* cursor blinking counter */
char year; /* year 96 - 120 */
char month; /* month 1 - 12 */
char day; /* day 1 - 31 */
char week; /* week 0 - 6 */
char hour; /* hour 0 - 23 */
char minute; /* minute 0 - 59 */
} ClockInfo;
extern void DrawClockSetting(ClockInfo *clock);
extern void DrawClock(int posx, int posy, short month, short day, short week, short hour, short minute, short second, short alpha);
/********************************************************************************/
/* */
/* */
/* Other function prototypes */
/* */
/* */
/********************************************************************************/
extern int LeoGetKAdr(int sjis);
extern int LeoGetAAdr(int code, int *dx, int *dy, int *cy);
extern void DisplayNintendoLogo(int alpha);
extern void DisplayInsertDisk(int active);
extern int SetClock(void);
extern void InitClock(void);
extern void DisplayClock(int alpha);
/********************************************************************************/
/* */
/* */
/* Global variables */
/* */
/* */
/********************************************************************************/
extern GfxPtr graphicp; /* graphics diskplay list pointer */
extern AffineMtx cameraMatrix;
extern OSContStatus contStatus[MAXCONTROLLERS]; /* controller status */
extern OSContPad contRdData[MAXCONTROLLERS]; /* controller data */
extern uchar contConnection; /* controller connection */
#endif