Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
34
35#ifndef __JO_TYPES_H__
36# define __JO_TYPES_H__
37
39# define __jo_force_inline __attribute__((always_inline)) inline
40
42typedef unsigned short jo_color;
43
48typedef int jo_fixed;
49
54typedef short jo_angle;
55
57typedef struct
58{
59 int x;
60 int y;
61} jo_pos2D;
62
64typedef struct
65{
69
73typedef struct
74{
75 int x;
76 int y;
77 int z;
78} jo_pos3D;
79
82typedef struct
83{
84 float x;
85 float y;
86 float z;
87} jo_pos3Df;
88
97
100typedef struct
101{
102 int rx;
103 int ry;
104 int rz;
105} jo_rot3D;
106
109typedef struct
110{
111 float rx;
112 float ry;
113 float rz;
114} jo_rot3Df;
115
119typedef struct
120{
122 short rz;
124
128typedef struct
129{
131 short rx;
132 short ry;
134
136typedef struct
137{
138 float x;
139 float y;
140 float z;
141} jo_vectorf;
142
146typedef struct
147{
149} jo_vector;
150
154typedef struct
155{
158
160typedef struct
161{
165
174
176typedef union
177{
178 float m[4][4];
179 float table[16];
180 struct
181 {
182 float m00, m01, m02, m03;
183 float m10, m11, m12, m13;
184 float m20, m21, m22, m23;
185 float m30, m31, m32, m33;
186 };
187} jo_matrixf;
188
190typedef union
191{
192 jo_fixed m[4][4];
194 struct
195 {
200 };
201} jo_matrix;
202
204typedef struct __jo_size
205{
206 unsigned short width;
207 unsigned short height;
209
213typedef struct
214{
215 unsigned short width;
216 unsigned short height;
217 unsigned short adr;
218 unsigned short size;
220
222typedef struct
223{
224 unsigned short index;
225 unsigned short color_mode;
226 void *data;
228
230typedef struct
231{
232 unsigned short width;
233 unsigned short height;
235} jo_img;
236
238typedef struct
239{
240 unsigned short width;
241 unsigned short height;
242 unsigned char *data;
244
246typedef struct
247{
248 unsigned short width;
249 unsigned short height;
250 void *data;
251} jo_raw_img;
252
254typedef struct
255{
257 int id;
258} jo_palette;
259
261typedef struct
262{
263 int x;
264 int y;
265 unsigned short width;
266 unsigned short height;
267} jo_tile;
268
270typedef struct
271{
272 unsigned short effect;
273 unsigned short direction;
274 unsigned int color_table_index;
278 unsigned int clipping;
280
282typedef union
283{
284 float f;
285 struct
286 {
287 unsigned int sign : 1;
288 unsigned int exponent : 8;
289 unsigned int mantissa : 23;
290
291 } field;
292} jo_IEEE754;
293
295typedef struct
296{
297 int id;
298 int size;
299 int read;
300 void *handle;
304} jo_file;
305
319
337
338#endif /* !__JO_TYPES_H__ */
339
340/*
341** END OF FILE
342*/
float y
Definition types.h:139
unsigned short height
Definition types.h:249
jo_fixed w
Definition types.h:172
void * handle
Definition types.h:300
unsigned short height
Definition types.h:241
int ry
Definition types.h:103
char * read_buffer
Definition types.h:301
unsigned short width
Definition types.h:206
void * data
Definition types.h:226
jo_fixed z
Definition types.h:95
int y
Definition types.h:60
short jo_angle
Angle.
Definition types.h:54
float f
Definition types.h:284
int y
Definition types.h:76
unsigned short width
Definition types.h:265
float rz
Definition types.h:113
unsigned int color_table_index
Definition types.h:274
jo_fixed y
Definition types.h:67
float y
Definition types.h:85
unsigned short height
Definition types.h:233
int rx
Definition types.h:102
int y
Definition types.h:264
void * data
Definition types.h:250
unsigned short jo_color
15 bits color type
Definition types.h:42
unsigned short height
Definition types.h:216
int read_index
Definition types.h:302
short rz
Definition types.h:122
int read_buffer_size
Definition types.h:303
jo_pos3D
Definition types.h:148
unsigned short effect
Definition types.h:272
jo_fixed x
Definition types.h:162
float z
Definition types.h:86
unsigned short index
Definition types.h:224
unsigned short height
Definition types.h:207
jo_pos3D_fixed
Definition types.h:156
unsigned int clipping
Definition types.h:278
float x
Definition types.h:138
jo_fixed x
Definition types.h:93
int x
Definition types.h:59
jo_fixed y
Definition types.h:94
unsigned short size
Definition types.h:218
jo_pos3D
Definition types.h:121
int size
Definition types.h:298
unsigned short width
Definition types.h:215
jo_color * data
Definition types.h:234
int id
Definition types.h:257
unsigned short width
Definition types.h:232
float z
Definition types.h:140
short rx
Definition types.h:131
jo_fixed fixed_scale_y
Definition types.h:277
jo_fixed y
Definition types.h:163
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:48
int x
Definition types.h:263
unsigned char * data
Definition types.h:242
jo_pos3D_fixed
Definition types.h:171
struct __jo_size jo_size
Size struct.
jo_2d_object_attributes
Definition types.h:130
unsigned short width
Definition types.h:248
jo_color * data
Definition types.h:256
int read
Definition types.h:299
unsigned short width
Definition types.h:240
unsigned short adr
Definition types.h:217
int id
Definition types.h:297
int x
Definition types.h:75
unsigned short height
Definition types.h:266
float rx
Definition types.h:111
int z
Definition types.h:77
float x
Definition types.h:84
jo_8_directions
8 directions definition
Definition types.h:308
@ DOWN_LEFT
Definition types.h:316
@ DOWN_RIGHT
Definition types.h:317
@ UP_RIGHT
Definition types.h:315
@ DOWN
Definition types.h:313
@ UP_LEFT
Definition types.h:314
@ UP
Definition types.h:312
@ NONE
Definition types.h:309
@ LEFT
Definition types.h:310
@ RIGHT
Definition types.h:311
unsigned int gouraud_shading_index
Definition types.h:275
jo_fixed x
Definition types.h:66
unsigned short direction
Definition types.h:273
short ry
Definition types.h:132
unsigned short color_mode
Definition types.h:225
jo_scroll_screen
Sega Saturn Scroll Screen Ids.
Definition types.h:322
@ JO_NBG3_SCREEN
Definition types.h:327
@ JO_ALL_SCROLL_SCREEN
Definition types.h:335
@ JO_NBG2_SCREEN
Definition types.h:326
@ JO_NBG0_SCREEN
Definition types.h:324
@ JO_RBG0_SCREEN
Definition types.h:328
@ JO_BACK_SCREEN
Definition types.h:329
@ JO_LNCL_SCREEN
Definition types.h:333
@ JO_SPRITE_SCREEN
Definition types.h:330
@ JO_VDP2_3D_PLANE_SCREEN
Definition types.h:332
@ JO_NBG1_SCREEN
Definition types.h:325
jo_fixed fixed_scale_x
Definition types.h:276
int rz
Definition types.h:104
float ry
Definition types.h:112
Size struct.
Definition types.h:205
Object for 2D manipulation (storyboard) using fixed number.
Definition types.h:120
Object for 3D manipulation (storyboard) using fixed number.
Definition types.h:129
File definition.
Definition types.h:296
15 bits image struct
Definition types.h:231
8 bits image struct
Definition types.h:239
Palette contents struct.
Definition types.h:255
Picture definition.
Definition types.h:223
2D position
Definition types.h:58
2D position using fixed number
Definition types.h:65
3D position
Definition types.h:74
3D position using fixed numbers
Definition types.h:92
3D position using floating numbers
Definition types.h:83
Raw image struct.
Definition types.h:247
3D rotation angles
Definition types.h:101
3D rotation angles
Definition types.h:110
Sprite attributes.
Definition types.h:271
Texture definition.
Definition types.h:214
Struct of one tile (pos and size).
Definition types.h:262
Vector for 3D computation using integer.
Definition types.h:147
Vector for 2D computation using fixed number.
Definition types.h:161
Vector4 for 3D computation using fixed number.
Definition types.h:170
Vector for 3D computation using fixed number.
Definition types.h:155
Vector for 3D computation using floating numbers.
Definition types.h:137
Float IEEE 754 format.
Definition types.h:283
4x4 MATRIX for 3D computation using fixed number
Definition types.h:191
jo_fixed table[16]
Definition types.h:193
jo_fixed m[4][4]
Definition types.h:192
4x4 MATRIX for 3D computation using floating numbers
Definition types.h:177
float table[16]
Definition types.h:179
float m[4][4]
Definition types.h:178