1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25  *
26  */
27 
28 #ifndef ICB_PSX_PCDEFINES_H
29 #define ICB_PSX_PCDEFINES_H
30 
31 #include "common/types.h"
32 
33 namespace ICB {
34 // make our own equivalents
35 typedef struct MATRIX {
36 	int16 m[3][3]; /* 3x3 rotation matrix */
37 	int16 pad;
38 	int32 t[3]; /* transfer vector */
MATRIXMATRIX39 	MATRIX() { pad = 0; }
40 } MATRIX;
41 
42 typedef struct MATRIXPC {
43 	int32 m[3][3]; /* 3x3 rotation matrix */
44 	int32 pad;
45 	int32 t[3]; /* transfer vector */
MATRIXPCMATRIXPC46 	MATRIXPC() { pad = 0; }
47 } MATRIXPC;
48 
49 /* int32 word type 3D vector */
50 typedef struct VECTOR {
51 	int32 vx, vy;
52 	int32 vz, pad;
VECTORVECTOR53 	VECTOR() { pad = 0; }
54 } VECTOR;
55 
56 /* short word type 3D vector */
57 typedef struct SVECTOR {
58 	int16 vx, vy;
59 	int16 vz, pad;
60 } SVECTOR;
61 
62 /* short word type 3D vector - PC version */
63 typedef struct SVECTORPC {
64 	int32 vx, vy;
65 	int32 vz, pad;
66 } SVECTORPC;
67 
68 typedef struct CVECTOR {
69 	/* color type vector */
70 	uint8 r, g, b, cd;
71 } CVECTOR;
72 
73 typedef struct {/* 2D short vector */
74 	short vx, vy;
75 } DVECTOR;
76 
77 typedef uint8 PACKET;
78 
79 //-=- Definitions -=-//
80 #ifndef ONE
81 #define ONE 4096
82 #endif
83 #define PSX_SCREEN_WIDTH 512
84 #define PSX_SCREEN_HEIGHT 240
85 
86 //-=- Macros -=-//
87 #define __nint__(x) (((x) > 0) ? int((x) + 0.5) : int((x)-0.5))
88 
89 #define getTPage(tp, abr, x, y) ((((tp)&0x3) << 7) | (((abr)&0x3) << 5) | (((y)&0x100) >> 4) | (((x)&0x3ff) >> 6) | (((y)&0x200) << 2))
90 
91 #define getClut(x, y) ((y << 6) | ((x >> 4) & 0x3f))
92 
93 } // End of namespace ICB
94 
95 #endif // __PSX_PcDefines_H__
96