2
* OpenTyrian: A modern cross-platform port of Tyrian
3
* Copyright (C) 2007-2009 The OpenTyrian Development Team
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
36
// only used for code entry
40
// only used in pItems[P_SUPERARCADE]
45
#define ENEMY_SHOT_MAX 60 /* 60*/
47
#define CURRENT_KEY_SPEED 1 /*Keyboard/Joystick movement rate*/
49
#define MAX_EXPLOSIONS 200
50
#define MAX_REPEATING_EXPLOSIONS 20
51
#define MAX_SUPERPIXELS 101
53
struct JE_SingleEnemyType
56
JE_integer ex, ey; /* POSITION */
57
JE_shortint exc, eyc; /* CURRENT SPEED */
58
JE_shortint exca, eyca; /* RANDOM ACCELERATION */
59
JE_shortint excc, eycc; /* FIXED ACCELERATION WAITTIME */
60
JE_shortint exccw, eyccw;
62
JE_byte eshotwait[3], eshotmultipos[3]; /* [1..3] */
65
JE_word egr[20]; /* [1..20] */
71
Sprite2_array *sprite2s;
72
JE_shortint exrev, eyrev;
73
JE_integer exccadd, eyccadd;
74
JE_byte exccwmax, eyccwmax;
85
JE_integer fixedmovey;
86
JE_byte freq[3]; /* [1..3] */
92
JE_byte tur[3]; /* [1..3] */
93
JE_word enemydie; /* Enemy created when this one dies */
94
JE_boolean enemyground;
103
JE_byte iced; /*Duration*/
105
JE_byte launchspecial;
107
JE_integer xminbounce;
108
JE_integer xmaxbounce;
109
JE_integer yminbounce;
110
JE_integer ymaxbounce;
111
JE_byte fill[3]; /* [1..3] */
114
typedef struct JE_SingleEnemyType JE_MultiEnemyType[100]; /* [1..100] */
116
typedef JE_word JE_DanCShape[(24 * 28) / 2]; /* [1..(24*28) div 2] */
118
typedef JE_char JE_CharString[256]; /* [1..256] */
120
typedef JE_byte JE_Map1Buffer[24 * 28 * 13 * 4]; /* [1..24*28*13*4] */
122
typedef JE_byte *JE_MapType[300][14]; /* [1..300, 1..14] */
123
typedef JE_byte *JE_MapType2[600][14]; /* [1..600, 1..14] */
124
typedef JE_byte *JE_MapType3[600][15]; /* [1..600, 1..15] */
126
struct JE_EventRecType
130
JE_integer eventdat, eventdat2;
131
JE_shortint eventdat3, eventdat5, eventdat6;
135
struct JE_MegaDataType1
141
} shapes[72]; /* [0..71] */
143
/*JE_DanCShape filler;*/
146
struct JE_MegaDataType2
151
JE_byte nothing[3]; /* [1..3] */
154
} shapes[71]; /* [0..70] */
158
struct JE_MegaDataType3
163
JE_byte nothing[3]; /* [1..3] */
166
} shapes[70]; /* [0..69] */
170
typedef JE_byte JE_EnemyAvailType[100]; /* [1..100] */
175
JE_shortint sxc, syc;
188
signed int delta_x, delta_y;
199
} rep_explosion_type;
202
unsigned int x, y, z;
203
signed int delta_x, delta_y;
207
extern JE_integer tempDat, tempDat2, tempDat3;
208
extern const JE_byte SANextShip[SA + 2];
209
extern const JE_word SASpecialWeapon[SA];
210
extern const JE_word SASpecialWeaponB[SA];
211
extern const JE_byte SAShip[SA];
212
extern const JE_word SAWeapon[SA][5];
213
extern const JE_byte specialArcadeWeapon[PORT_NUM];
214
extern const JE_byte optionSelect[16][3][2];
215
extern const JE_word PGR[21];
216
extern const JE_byte PAni[21];
217
extern const JE_word linkGunWeapons[38];
218
extern const JE_word chargeGunWeapons[38];
219
extern const JE_byte randomEnemyLaunchSounds[3];
220
extern const JE_byte keyboardCombos[26][8];
221
extern const JE_byte shipCombosB[21];
222
extern const JE_byte superTyrianSpecials[4];
223
extern const JE_byte shipCombos[14][3];
224
extern JE_byte SFCurrentCode[2][21];
225
extern JE_byte SFExecuted[2];
226
extern JE_byte lvlFileNum;
227
extern JE_word maxEvent, eventLoc;
228
extern JE_word tempBackMove, explodeMove;
229
extern JE_byte levelEnd;
230
extern JE_word levelEndFxWait;
231
extern JE_shortint levelEndWarp;
232
extern JE_boolean endLevel, reallyEndLevel, waitToEndLevel, playerEndLevel, normalBonusLevelCurrent, bonusLevelCurrent, smallEnemyAdjust, readyToEndLevel, quitRequested;
233
extern JE_byte newPL[10];
234
extern JE_word returnLoc;
235
extern JE_boolean returnActive;
236
extern JE_word galagaShotFreq;
237
extern JE_longint galagaLife;
238
extern JE_boolean debug;
239
extern Uint32 debugTime, lastDebugTime;
240
extern JE_longint debugHistCount;
241
extern JE_real debugHist;
242
extern JE_word curLoc;
243
extern JE_boolean firstGameOver, gameLoaded, enemyStillExploding;
244
extern JE_word totalEnemy;
245
extern JE_word enemyKilled;
246
extern struct JE_MegaDataType1 megaData1;
247
extern struct JE_MegaDataType2 megaData2;
248
extern struct JE_MegaDataType3 megaData3;
249
extern JE_byte flash;
250
extern JE_shortint flashChange;
251
extern JE_byte displayTime;
253
extern bool play_demo, record_demo, stopped_demo;
254
extern Uint8 demo_num;
255
extern FILE *demo_file;
257
extern Uint8 demo_keys, next_demo_keys;
258
extern Uint16 demo_keys_wait;
260
extern JE_byte soundQueue[8];
261
extern JE_boolean enemyContinualDamage;
262
extern JE_boolean enemiesActive;
263
extern JE_boolean forceEvents;
264
extern JE_boolean stopBackgrounds;
265
extern JE_byte stopBackgroundNum;
266
extern JE_byte damageRate;
267
extern JE_boolean background3x1;
268
extern JE_boolean background3x1b;
269
extern JE_boolean levelTimer;
270
extern JE_word levelTimerCountdown;
271
extern JE_word levelTimerJumpTo;
272
extern JE_boolean randomExplosions;
273
extern JE_boolean editShip1, editShip2;
274
extern JE_boolean globalFlags[10];
275
extern JE_byte levelSong;
276
extern JE_boolean loadDestruct;
277
extern JE_word mapOrigin, mapPNum;
278
extern JE_byte mapPlanet[5], mapSection[5];
279
extern JE_boolean moveTyrianLogoUp;
280
extern JE_boolean skipStarShowVGA;
281
extern JE_MultiEnemyType enemy;
282
extern JE_EnemyAvailType enemyAvail;
283
extern JE_word enemyOffset;
284
extern JE_word enemyOnScreen;
285
extern JE_byte enemyShapeTables[6];
286
extern JE_word superEnemy254Jump;
287
extern explosion_type explosions[MAX_EXPLOSIONS];
288
extern JE_integer explosionFollowAmountX, explosionFollowAmountY;
289
extern JE_boolean fireButtonHeld;
290
extern JE_boolean enemyShotAvail[ENEMY_SHOT_MAX];
291
extern EnemyShotType enemyShot[ENEMY_SHOT_MAX];
292
extern JE_byte zinglonDuration;
293
extern JE_byte astralDuration;
294
extern JE_word flareDuration;
295
extern JE_boolean flareStart;
296
extern JE_shortint flareColChg;
297
extern JE_byte specialWait;
298
extern JE_byte nextSpecialWait;
299
extern JE_boolean spraySpecial;
300
extern JE_byte doIced;
301
extern JE_boolean infiniteShot;
302
extern JE_boolean allPlayersGone;
303
extern const uint shadowYDist;
304
extern JE_real optionSatelliteRotate;
305
extern JE_integer optionAttachmentMove;
306
extern JE_boolean optionAttachmentLinked, optionAttachmentReturn;
307
extern JE_byte chargeWait, chargeLevel, chargeMax, chargeGr, chargeGrWait;
309
extern rep_explosion_type rep_explosions[MAX_REPEATING_EXPLOSIONS];
310
extern superpixel_type superpixels[MAX_SUPERPIXELS];
311
extern unsigned int last_superpixel;
312
extern JE_byte temp, temp2, temp3;
313
extern JE_word tempX, tempY;
314
extern JE_word tempW;
315
extern JE_boolean doNotSaveBackup;
318
extern JE_byte **BKwrap1to, **BKwrap2to, **BKwrap3to, **BKwrap1, **BKwrap2, **BKwrap3;
319
extern JE_shortint specialWeaponFilter, specialWeaponFreq;
320
extern JE_word specialWeaponWpn;
321
extern JE_boolean linkToPlayer;
322
extern JE_word shipGr, shipGr2;
323
extern Sprite2_array *shipGrPtr, *shipGr2ptr;
325
static const int hud_sidekick_y[2][2] =
327
{ 64, 82 }, // one player HUD
328
{ 108, 126 }, // two player HUD
331
void JE_getShipInfo( void );
332
JE_word JE_SGr( JE_word ship, Sprite2_array **ptr );
334
void JE_drawOptions( void );
336
void JE_tyrianHalt( JE_byte code ); /* This ends the game */
337
void JE_specialComplete( JE_byte playernum, JE_byte specialType );
338
void JE_doSpecialShot( JE_byte playernum, uint *armor, uint *shield );
340
void JE_wipeShieldArmorBars( void );
341
JE_byte JE_playerDamage( JE_byte temp, Player * );
343
void JE_setupExplosion( signed int x, signed int y, signed int delta_y, unsigned int type, bool fixed_position, bool follow_player );
344
void JE_setupExplosionLarge( JE_boolean enemyground, JE_byte explonum, JE_integer x, JE_integer y );
346
void JE_drawShield( void );
347
void JE_drawArmor( void );
349
JE_word JE_portConfigs( void );
352
void JE_doSP( JE_word x, JE_word y, JE_word num, JE_byte explowidth, JE_byte color );
353
void JE_drawSP( void );
355
void JE_drawOptionLevel( void );