forked from exult/exult
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exult_constants.h
142 lines (127 loc) · 4.39 KB
/
exult_constants.h
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
/*
* exult_constants.h - Some constants/macros that are used all over the code.
*
* Copyright (C) 2000-2022 The Exult Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef EXULT_CONSTANTS_H
#define EXULT_CONSTANTS_H
/*
* Sizes:
*/
constexpr const int c_basetilesize = 8; // A tile (shape) is 8x8 pixels.
constexpr const int c_tilesize = 8; // A tile (shape) is 8x8 pixels.
constexpr const int c_num_tile_bytes
= c_tilesize * c_tilesize; // Total pixels per tile.
constexpr const int c_screen_tile_size
= 320 / c_basetilesize; // Number of tiles in a 'screen'.
constexpr const int c_tiles_per_chunk = 16; // A chunk is 16x16 tiles.
constexpr const int c_chunksize = 16 * 8; // A chunk has 16 8x8 shapes.
constexpr const int c_num_schunks = 12;
constexpr const int c_num_chunks = 12 * 16; // Total # of chunks in each dir.
constexpr const int c_chunks_per_schunk = 16; // # chunks in each superchunk.
constexpr const int c_tiles_per_schunk
= 16 * 16; // # tiles in each superchunk.
// Total # tiles in each dir.:
constexpr const int c_num_tiles = c_tiles_per_chunk * c_num_chunks;
constexpr const int c_fade_in_time = 30; // Time for fade in
constexpr const int c_fade_out_time = 30; // Time for fade out
constexpr const int c_std_delay
= 200; // Standard animation delay. May want to
// make this settable!
constexpr const int c_any_shapenum = -359;
constexpr const int c_any_qual = -359;
constexpr const int c_any_framenum = -359;
constexpr const int c_any_quantity = -359;
// Maximum number of shapes:
constexpr const int c_max_shapes = 2048;
constexpr const int c_occsize
= c_max_shapes / 8 + ((c_max_shapes % 8) != 0 ? 1 : 0);
// Maximum number of global flags:
constexpr const int c_last_gflag = 2047;
constexpr const int MOVE_NODROP = (1 << 3);
constexpr const int MOVE_FLY = (1 << 4);
constexpr const int MOVE_LEVITATE = (MOVE_FLY | MOVE_NODROP);
constexpr const int MOVE_WALK = (1 << 5);
constexpr const int MOVE_SWIM = (1 << 6);
constexpr const int MOVE_ALL_TERRAIN = ((1 << 5) | (1 << 6));
constexpr const int MOVE_ETHEREAL = (1 << 7);
constexpr const int MOVE_ALL
= (MOVE_FLY | MOVE_WALK | MOVE_SWIM | MOVE_ETHEREAL);
constexpr const int MOVE_MAPEDIT = (1 << 8);
// Wrapping:
constexpr inline int INCR_CHUNK(int x) {
return (x + 1) % c_num_chunks;
}
constexpr inline int DECR_CHUNK(int x) {
return (x - 1 + c_num_chunks) % c_num_chunks;
}
constexpr inline int INCR_TILE(int x) {
return (x + 1) % c_num_tiles;
}
constexpr inline int DECR_TILE(int x, int amt = 1) {
return (x - amt + c_num_tiles) % c_num_tiles;
}
// Return x - y with wrapping.
constexpr inline int SUB_TILE(int x, int y) {
const int delta = x - y;
return delta < -c_num_tiles / 2 ? delta + c_num_tiles
: delta >= c_num_tiles / 2 ? delta - c_num_tiles
: delta;
}
// Debug
#ifdef DEBUG
# ifndef COUT
# define COUT(x) \
do { \
std::cout << x << std::endl; \
std::cout.flush(); \
} while (0)
# endif
# ifndef CERR
# define CERR(x) \
do { \
std::cerr << x << std::endl; \
std::cerr.flush(); \
} while (0)
# endif
#else
# ifndef COUT
# define COUT(x) \
do { \
} while (0)
# endif
# ifndef CERR
# define CERR(x) \
do { \
} while (0)
# endif
#endif
enum Exult_Game {
NONE,
BLACK_GATE,
SERPENT_ISLE,
EXULT_DEVEL_GAME, // One that we develop.
EXULT_MENU_GAME // Game type for the exult menu
};
// For the original released translations
enum Game_Language {
ENGLISH,
FRENCH, // Black Gate only
GERMAN, // Black Gate only
SPANISH // Black Gate and Serpent Isle
};
#endif