-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathping.h
423 lines (371 loc) · 8.52 KB
/
ping.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
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/* Jedi/Sector One */
#define NEED_ENVIRONMENT
#define BONI_SUPPORT 1
#define BIGBOOL_SUPPORT 0
#define ALLBONI_SUPPORT 0
#define JOYSTICK_SUPPORT 1
#define MAXBALLS 50
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#ifndef __linux__
# include <sys/nearptr.h>
# include <dpmi.h>
#endif
#include "rgo.h"
#include "xymode.h"
#include "sprites.h"
#include "palette.h"
#include "terrains.h"
#define SCREEN_MIDDLE (SCREEN_WIDTH / 2)
#define FILET_GAP 4
#define BONUS_WIDTH 24
#define BONUS_HEIGHT 24
#define BONUS_MOVE 8
#define ROND_WIDTH 20
#define ROND_HEIGHT 20
typedef struct BonusCouple_ {
void (*sprite) (unsigned char *const where, const int deca);
void (*load) (register unsigned char *where, const ptrdiff_t offset);
} BonusCouple;
typedef enum Iscotched_ {
ISD_SCOTCHED, ISD_NOTSCOTCHED, ISD_DECOLE,
ISD_LEFTSCOTCHED, ISD_RIGHTSCOTCHED
} Iscotched;
typedef enum BallSize_ {
BAE_NORMAL, BAE_TINY, BAE_MIDDLE,
#if BIGBOOL_SUPPORT
BAE_BIG,
#endif
BAE_COEUR1, BAE_COEUR2, BAE_COEUR3, BAE_COEUR4,
NUMBER_OF_COEURS = BAE_COEUR4 - BAE_COEUR1 + 1,
NUMBER_OF_BALLKINDS = BAE_COEUR1
} BallSize;
typedef struct BallList_ {
int width, height;
BonusCouple couple;
} BallList;
typedef struct Ball_ {
int enabled;
unsigned char *addr;
int x, y;
int addx, addy;
BallSize size;
int width, height;
BonusCouple couple;
#if BONI_SUPPORT
Iscotched iscotched;
int dontstop;
#endif
} Ball;
typedef struct SpriteSave_ {
int enabled;
unsigned char *addr;
ptrdiff_t offset;
} SpriteSave;
typedef struct BallSave_ {
int enabled;
unsigned char *addr;
ptrdiff_t offset;
void (*oldLoadBall) (register unsigned char *where,
const ptrdiff_t offset);
} BallSave;
#if BONI_SUPPORT
typedef enum BonusType_ {
BOE_MULTIBALL, BOE_BALLSIZE, BOE_RAQSIZE, BOE_RAQSPEED,
# if ALLBONI_SUPPORT
BOE_INERTIE,
BOE_WALL,
# endif
BOE_GLUE, BOE_BALLWAY,
# if ALLBONI_SUPPORT
BOE_GRAVITY,
# endif
BOE_ANGLE, BOE_DOWNSPEED,
BOE_TIR, BOE_NOLIMIT, BOE_SURPRISE,
NUMBER_OF_BONI
} BonusType;
typedef enum BonusRecycler_ {
BOR_KEEP, BOR_ONEPOINT, BOR_IMMED
} BonusRecycler;
#if 0
typedef enum BonusCumulative_ {
BC_NOCUMULATIVE, BC_CUMULATIVE
} BonusCumulative;
#endif
typedef enum RaqType_ {
RAE_NORMAL, RAE_BIG, RAE_HORIZONTAL,
RAE_BISOU1, RAE_BISOU2,
NUMBER_OF_RAQTYPES = RAE_BISOU1
} RaqType;
typedef struct RaqList_ {
int width, height;
BonusCouple couple;
} RaqList;
typedef struct Bonus_ {
int enabled;
BonusCouple couple;
unsigned char *addr;
int x, y;
BonusType type;
} Bonus;
typedef struct BonusBack_ {
unsigned char *addr;
int x, y;
} BonusBack;
typedef struct BonusRond_ {
int enabled;
unsigned char *addr;
BonusType type;
Christelle *phasis;
int timeout;
int x, y;
} BonusRond;
typedef enum Downspeed_ {
DOD_NORMAL, DOD_DOWNSPEED, DOD_UPSPEED
} Downspeed;
#endif
typedef struct Raq_ {
unsigned char *addr;
int x, y;
int addx, addy;
int width, height;
int acutance;
BonusCouple couple;
RaqType type;
#if BONI_SUPPORT
BonusRond *bonusRond;
Iscotched iscotched;
Downspeed downspeed;
unsigned char hasGlue;
unsigned char hasNoLimit;
unsigned char hasLazer;
#endif
} Raq;
#if BONI_SUPPORT
typedef struct BonusList_ {
# if 0
BonusType type;
# endif
BonusRecycler recycler;
BonusCouple couple;
void (*enableBonus) (Raq * const raq);
void (*disableBonus) (Raq * const raq);
# if 0
BonusCumulative cumulative;
# endif
} BonusList;
#endif
typedef struct LazerSave_ {
unsigned char *lazerAddr;
ptrdiff_t offset;
size_t lazerLen;
} LazerSave;
typedef struct Screen_ {
BallSave oldBall[MAXBALLS];
SpriteSave oldRaq1, oldRaq2;
void (*oldLoadRaq1) (register unsigned char *where,
const ptrdiff_t offset);
void (*oldLoadRaq2) (register unsigned char *where,
const ptrdiff_t offset);
#if BONI_SUPPORT
SpriteSave oldBonus;
SpriteSave oldBonusBack;
SpriteSave oldRond1, oldRond2;
LazerSave oldLazer;
#endif
} Screen;
typedef enum Phasis_ {
PHS_NORMAL, PHS_BISOU
} Phasis;
#define HIPHOP(X) extern void enableBonus_##X(Raq * const raq); \
extern void disableBonus_##X(Raq * const raq)
#define HOPHIP(X) enableBonus_##X, disableBonus_##X
#define TITEL(X) { sprite_bonus##X, load_bonus##X }
HIPHOP(multiball);
HIPHOP(ballsize);
HIPHOP(raqsize);
HIPHOP(raqspeed);
#if ALLBONI_SUPPORT
HIPHOP(inertie);
HIPHOP(wall);
#endif
HIPHOP(glue);
HIPHOP(ballway);
#if ALLBONI_SUPPORT
HIPHOP(gravity);
#endif
HIPHOP(angle);
HIPHOP(downspeed);
HIPHOP(tir);
HIPHOP(nolimit);
HIPHOP(surprise);
#ifndef DEFINE_GLOBALS__
extern
#endif
const BonusList bonusList[]
#ifdef DEFINE_GLOBALS__
#define BT(X)
#define BU(X)
#define BtAnd
#define BuAnd
= {
{BT(BOE_MULTIBALL) BtAnd BOR_IMMED, TITEL(0),
HOPHIP(multiball) BuAnd BU(BC_NOCUMULATIVE)},
{BT(BOE_BALLSIZE) BtAnd BOR_IMMED, TITEL(1),
HOPHIP(ballsize) BuAnd BU(BC_NOCUMULATIVE)},
{BT(BOE_RAQSIZE) BtAnd BOR_KEEP, TITEL(2),
HOPHIP(raqsize) BuAnd BU(BC_NOCUMULATIVE)},
{BT(BOE_RAQSPEED) BtAnd BOR_KEEP, TITEL(3),
HOPHIP(raqspeed) BuAnd BU(BC_CUMULATIVE)},
#if ALLBONI_SUPPORT
{BT(BOE_INERTIE) BtAnd BOR_KEEP, TITEL(4),
HOPHIP(inertie) BuAnd BU(BC_CUMULATIVE)},
{BT(BOE_WALL) BtAnd BOR_KEEP, TITEL(5),
HOPHIP(wall) BuAnd BU(BC_NOCUMULATIVE)},
#endif
{BT(BOE_GLUE) BtAnd BOR_KEEP, TITEL(6),
HOPHIP(glue) BuAnd BU(BC_CUMULATIVE)},
{BT(BOE_BALLWAY) BtAnd BOR_IMMED, TITEL(7),
HOPHIP(ballway) BuAnd BU(BC_CUMULATIVE)},
#if ALLBONI_SUPPORT
{BT(BOE_GRAVITY) BtAnd BOR_KEEP, TITEL(8),
HOPHIP(gravity) BuAnd BU(BC_NOCUMULATIVE)},
#endif
{BT(BOE_ANGLE) BtAnd BOR_ONEPOINT, TITEL(9),
HOPHIP(angle) BuAnd BU(BC_CUMULATIVE)},
{BT(BOE_DOWNSPEED) BtAnd BOR_ONEPOINT, TITEL(10),
HOPHIP(downspeed) BuAnd BU(BC_CUMULATIVE)},
{BT(BOE_TIR) BtAnd BOR_KEEP, TITEL(11),
HOPHIP(tir) BuAnd BU(BC_NOCUMULATIVE)},
{BT(BOE_NOLIMIT) BtAnd BOR_KEEP, TITEL(12),
HOPHIP(nolimit) BuAnd BU(BC_CUMULATIVE)},
{BT(BOE_SURPRISE) BtAnd BOR_IMMED, TITEL(13),
HOPHIP(surprise) BuAnd BU(BC_NOCUMULATIVE)}
}
#endif
;
#define BAYON(X1, Y1, X2, Y2) ((X2) - (X1) + 1), ((Y2) - (Y1) + 1)
#define BAYO(X) { sprite_##X, load_##X }
#ifndef DEFINE_GLOBALS__
extern
#endif
const RaqList raqList[]
#ifdef DEFINE_GLOBALS__
= {
{ /*NORMAL*/ BAYON(12, 8, 19, 39), BAYO(normRaq)},
{ /*BIG*/ BAYON(20, 8, 27, 56), BAYO(bigRaq)},
{ /*HORI*/ BAYON(12, 0, 43, 7), BAYO(horiRaq)},
{ /*BISOU1 */ BAYON(227, 16, 269, 61), BAYO(bisou1)},
{ /*BISOU2 */ BAYON(271, 16, 313, 61), BAYO(bisou2)}
}
#endif
;
#ifndef DEFINE_GLOBALS__
extern
#endif
const BallList ballList[]
#ifdef DEFINE_GLOBALS__
= {
{ /*NORMAL*/ BAYON(128, 0, 135, 7), BAYO(normBool)},
{ /*TINY*/ BAYON(136, 0, 137, 1), BAYO(tinyBool)},
{ /*MIDDLE*/ BAYON(108, 0, 127, 19), BAYO(midBool)},
# if BIGBOOL_SUPPORT
{ /*BIG*/ BAYON(44, 0, 107, 63), BAYO(bigBool)},
# endif
{ /*COEUR1 */ BAYON(85, 90, 91, 93), BAYO(coeur1)},
{ /*COEUR2 */ BAYON(102, 90, 110, 95), BAYO(coeur2)},
{ /*COEUR3 */ BAYON(120, 90, 130, 97), BAYO(coeur3)},
{ /*COEUR3 */ BAYON(84, 103, 98, 113), BAYO(coeur4)}
}
#endif
;
#ifndef DEFINE_GLOBALS__
extern
#endif
Screen screen[2];
#ifndef DEFINE_GLOBALS__
extern Screen *curscreen;
#else
Screen *curscreen = &screen[0];
#endif
#ifndef DEFINE_GLOBALS__
extern int curscrn;
#else
int curscrn = 0;
#endif
#ifndef DEFINE_GLOBALS__
extern
#endif
unsigned char *screenSave, *screenSave2;
#ifndef DEFINE_GLOBALS__
extern
#endif
Raq raq1, raq2;
#ifndef DEFINE_GLOBALS__
extern
#endif
Ball ball[MAXBALLS];
#ifndef DEFINE_GLOBALS__
extern
#endif
int numberOfBalls
#ifdef DEFINE_GLOBALS__
= 1
#endif
;
#ifndef DEFINE_GLOBALS__
extern
#endif
int score1, score2;
#ifndef DEFINE_GLOBALS__
extern
#endif
Bonus bonus;
#ifndef DEFINE_GLOBALS__
extern
#endif
BonusBack bonusBack;
#ifndef DEFINE_GLOBALS__
extern
#endif
BonusRond bonusRond1, bonusRond2;
#ifndef DEFINE_GLOBALS__
extern
#endif
unsigned char cheatMode;
#ifndef DEFINE_GLOBALS__
extern
#endif
Phasis phasis
#ifdef DEFINE_GLOBALS__
= PHS_NORMAL
#endif
;
#ifndef DEFINE_GLOBALS__
extern
#endif
Phasis terrainPhasis
#ifdef DEFINE_GLOBALS__
= PHS_NORMAL
#endif
;
#ifndef DEFINE_GLOBALS__
extern
#endif
Phasis requestedPhasis
#ifdef DEFINE_GLOBALS__
= PHS_NORMAL
#endif
;
#ifndef DEFINE_GLOBALS__
extern
#endif
unsigned char simpleGame;
#if JOYSTICK_SUPPORT
#ifndef DEFINE_GLOBALS__
extern
#endif
unsigned char joy1, joy2;
#endif