-
Notifications
You must be signed in to change notification settings - Fork 1
/
portris.h
194 lines (155 loc) · 3.23 KB
/
portris.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
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
#ifndef PORTRIS_H_
#define PORTRIS_H_
#if defined(__CC65__)
// use static locals for speed
#pragma static-locals(1)
#endif // compilers
#include "target.h"
#define CHARINDEX(_a) (_a)
#define GET1DIM(_a, _x) _a[CHARINDEX(_x)]
#if !defined (NO2DIMARRAYS)
#define GET2DIM(_a, _y, _x, _nx) _a[CHARINDEX(_y)][CHARINDEX(_x)]
#else
#define GET2DIM(_a, _y, _x, _nx) _a[((int)(_y) * (int)(_nx)) + (int)(_x)]
#endif
///////////////////////////////////////////////////////////////////////////
// nullify some functions that would otherwhise just waste memory
#ifdef NOCOLORS
#ifdef textcolor
#undef textcolor
#endif
#ifndef textcolor
#define textcolor(_x)
#endif
#endif
#ifdef NOBGCOLORS
#ifdef bgcolor
#undef bgcolor
#endif
#ifndef bgcolor
#define bgcolor(_x)
#endif
#ifdef bordercolor
#undef bordercolor
#endif
#ifndef bordercolor
#define bordercolor(_x)
#endif
#elif defined(NOBORDER)
#ifdef bordercolor
#undef bordercolor
#endif
#define bordercolor(_x)
#endif
#ifdef NOKEYBOARD
#define cgetc() 0
#define kbhit() 0
#ifndef NOKBREPEAT
# define NOKBREPEAT
#endif
#endif
#ifdef NOKBREPEAT
#ifdef kbrepeat
#undef kbrepeat
#endif
#ifdef kbrepeatrate
#undef kbrepeatrate
#endif
#ifdef kbrepeatdelay
#undef kbrepeatdelay
#endif
#define kbrepeat(_x)
#define kbrepeatrate(_x)
#define kbrepeatdelay(_x)
#endif
#ifdef NOJOYSTICKS
# define NOJOYSELECT
#endif
#ifdef NOREVERS
#ifdef revers
#undef revers
#endif
#define revers(_x)
#endif
#ifdef NOWAITVBLANK
#ifdef waitvsync
#undef waitvsync
#endif
#define waitvsync()
#endif
#if !defined(CONIOINIT)
#define conio_init()
#endif
#if !defined(CONIOUPDATE)
#define conio_update()
#endif
///////////////////////////////////////////////////////////////////////////
// define some stuff to avoid absolute values in the code
// size of playfield in characters
#define PF_X 9
#define PF_Y ((SCREENY) - 4)
// size of virtual playfield in characters
#define PF_VX ((PF_X) + 3 + 3)
#define PF_VY ((PF_Y) + 3 + 3)
// adjust number of players to screen width
#define MAX_PLR ((SCREENX) / (PF_X + 1))
// define the shape of the blocks
#ifdef NOREVERS
#define BLK_SET 'O'
#else
#define BLK_SET ' '
#endif
#define BLK_NONE ' '
// lines needed to complete a stage, usually 25
# define LINES_PER_STAGE 25
// color to use for background, ie usually black
#define COL_BG COLOR_BLACK
// define some values used for screen-layout
#ifdef CONIODYNSIZE
// logo
#define TOFFS1 1
// version string
#define TOFFS2 9
// menu strings
#define TOFFS3 12
// copyright
#define TOFFS5 19
// controller
#define TOFFS6 22
#else
#if SCREENY < 20
// logo
#define TOFFS1 0
// version string
#define TOFFS2 8
// menu strings
#define TOFFS3 10
// copyright
#define TOFFS5 13
// controller
#define TOFFS6 16
#elif SCREENY < 25
// logo
#define TOFFS1 0
// version string
#define TOFFS2 8
// menu strings
#define TOFFS3 12
// copyright
#define TOFFS5 18
// controller
#define TOFFS6 21
#else
// logo
#define TOFFS1 1
// version string
#define TOFFS2 9
// menu strings
#define TOFFS3 12
// copyright
#define TOFFS5 19
// controller
#define TOFFS6 22
#endif
#endif
#endif // PORTRIS_H_