My Project
Loading...
Searching...
No Matches
varz.h
1/*
2 * OpenTyrian: A modern cross-platform port of Tyrian
3 * Copyright (C) 2007-2009 The OpenTyrian Development Team
4 *
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.
9 *
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.
14 *
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.
18 */
19#ifndef VARZ_H
20#define VARZ_H
21
22#include "episodes.h"
23#include "opentyr.h"
24#include "player.h"
25#include "sprite.h"
26
27#include <stdbool.h>
28
29#define SA 9
30
31enum
32{
33 SA_NONE = 0,
34 SA_NORTSHIPZ = 7,
35 SA_LASTSHIP = 9,
36
37 // only used for code entry
38 SA_DESTRUCT = 10,
39 SA_ENGAGE = 11,
40
41 // only used in pItems[P_SUPERARCADE]
42 SA_SUPERTYRIAN = 254,
43 SA_ARCADE = 255
44};
45
46#define ENEMY_SHOT_MAX 60 /* 60*/
47
48#define CURRENT_KEY_SPEED 1 /*Keyboard/Joystick movement rate*/
49
50#define MAX_EXPLOSIONS 200
51#define MAX_REPEATING_EXPLOSIONS 20
52#define MAX_SUPERPIXELS 101
53
55{
56 JE_byte fillbyte;
57 JE_integer ex, ey; /* POSITION */
58 JE_shortint exc, eyc; /* CURRENT SPEED */
59 JE_shortint exca, eyca; /* RANDOM ACCELERATION */
60 JE_shortint excc, eycc; /* FIXED ACCELERATION WAITTIME */
61 JE_shortint exccw, eyccw;
62 JE_byte armorleft;
63 JE_byte eshotwait[3], eshotmultipos[3]; /* [1..3] */
64 JE_byte enemycycle;
65 JE_byte ani;
66 JE_word egr[20]; /* [1..20] */
67 JE_byte size;
68 JE_byte linknum;
69 JE_byte aniactive;
70 JE_byte animax;
71 JE_byte aniwhenfire;
72 Sprite2_array *sprite2s;
73 JE_shortint exrev, eyrev;
74 JE_integer exccadd, eyccadd;
75 JE_byte exccwmax, eyccwmax;
76 void *enemydatofs;
77 JE_boolean edamaged;
78 JE_word enemytype;
79 JE_byte animin;
80 JE_word edgr;
81 JE_shortint edlevel;
82 JE_shortint edani;
83 JE_byte fill1;
84 JE_byte filter;
85 JE_integer evalue;
86 JE_integer fixedmovey;
87 JE_byte freq[3]; /* [1..3] */
88 JE_byte launchwait;
89 JE_word launchtype;
90 JE_byte launchfreq;
91 JE_byte xaccel;
92 JE_byte yaccel;
93 JE_byte tur[3]; /* [1..3] */
94 JE_word enemydie; /* Enemy created when this one dies */
95 JE_boolean enemyground;
96 JE_byte explonum;
97 JE_word mapoffset;
98 JE_boolean scoreitem;
99
100 JE_boolean special;
101 JE_byte flagnum;
102 JE_boolean setto;
103
104 JE_byte iced; /*Duration*/
105
106 JE_byte launchspecial;
107
108 JE_integer xminbounce;
109 JE_integer xmaxbounce;
110 JE_integer yminbounce;
111 JE_integer ymaxbounce;
112 JE_byte fill[3]; /* [1..3] */
113};
114
115typedef struct JE_SingleEnemyType JE_MultiEnemyType[100]; /* [1..100] */
116
117typedef JE_byte JE_DanCShape[24 * 28]; /* [1..(24*28) div 2] OF WORD */
118
119typedef JE_char JE_CharString[256]; /* [1..256] */
120
121typedef JE_byte JE_Map1Buffer[24 * 28 * 13 * 4]; /* [1..24*28*13*4] */
122
123typedef JE_byte *JE_MapType[300][14]; /* [1..300, 1..14] */
124typedef JE_byte *JE_MapType2[600][14]; /* [1..600, 1..14] */
125typedef JE_byte *JE_MapType3[600][15]; /* [1..600, 1..15] */
126
128{
129 JE_word eventtime;
130 JE_byte eventtype;
131 JE_integer eventdat, eventdat2;
132 JE_shortint eventdat3, eventdat5, eventdat6;
133 JE_byte eventdat4;
134};
135
137{
138 JE_MapType mainmap;
139 struct
140 {
141 JE_DanCShape sh;
142 } shapes[72]; /* [0..71] */
143 JE_byte tempdat1;
144 /*JE_DanCShape filler;*/
145};
146
148{
149 JE_MapType2 mainmap;
150 struct
151 {
152 JE_byte nothing[3]; /* [1..3] */
153 JE_byte fill;
154 JE_DanCShape sh;
155 } shapes[71]; /* [0..70] */
156 JE_byte tempdat2;
157};
158
160{
161 JE_MapType3 mainmap;
162 struct
163 {
164 JE_byte nothing[3]; /* [1..3] */
165 JE_byte fill;
166 JE_DanCShape sh;
167 } shapes[70]; /* [0..69] */
168 JE_byte tempdat3;
169};
170
171typedef JE_byte JE_EnemyAvailType[100]; /* [1..100] */
172
173typedef struct {
174 JE_integer sx, sy;
175 JE_integer sxm, sym;
176 JE_shortint sxc, syc;
177 JE_byte tx, ty;
178 JE_word sgr;
179 JE_byte sdmg;
180 JE_byte duration;
181 JE_word animate;
182 JE_word animax;
183 JE_byte fill[12];
185
186typedef struct {
187 unsigned int ttl;
188 signed int x, y;
189 signed int delta_x, delta_y;
190 bool fixed_position;
191 bool follow_player;
192 unsigned int sprite;
194
195typedef struct {
196 unsigned int delay;
197 unsigned int ttl;
198 unsigned int x, y;
199 bool big;
201
202typedef struct {
203 unsigned int x, y, z;
204 signed int delta_x, delta_y;
205 Uint8 color;
207
208extern JE_integer tempDat, tempDat2, tempDat3;
209extern const JE_byte SANextShip[SA + 2];
210extern const JE_word SASpecialWeapon[SA];
211extern const JE_word SASpecialWeaponB[SA];
212extern const JE_byte SAShip[SA];
213extern const JE_word SAWeapon[SA][5];
214extern const JE_byte specialArcadeWeapon[PORT_NUM];
215extern const JE_byte optionSelect[16][3][2];
216extern const JE_word PGR[21];
217extern const JE_byte PAni[21];
218extern const JE_word linkGunWeapons[38];
219extern const JE_word chargeGunWeapons[38];
220extern const JE_byte randomEnemyLaunchSounds[3];
221extern const JE_byte keyboardCombos[26][8];
222extern const JE_byte shipCombosB[21];
223extern const JE_byte superTyrianSpecials[4];
224extern const JE_byte shipCombos[19][3];
225extern JE_byte SFCurrentCode[2][21];
226extern JE_byte SFExecuted[2];
227extern JE_byte lvlFileNum;
228extern JE_word maxEvent, eventLoc;
229extern JE_word tempBackMove, explodeMove;
230extern JE_byte levelEnd;
231extern JE_word levelEndFxWait;
232extern JE_shortint levelEndWarp;
233extern JE_boolean endLevel, reallyEndLevel, waitToEndLevel, playerEndLevel, normalBonusLevelCurrent, bonusLevelCurrent, smallEnemyAdjust, readyToEndLevel, quitRequested;
234extern JE_byte newPL[10];
235extern JE_word returnLoc;
236extern JE_boolean returnActive;
237extern JE_word galagaShotFreq;
238extern JE_longint galagaLife;
239extern JE_boolean debug;
240extern Uint32 debugTime, lastDebugTime;
241extern JE_longint debugHistCount;
242extern JE_real debugHist;
243extern JE_word curLoc;
244extern JE_boolean firstGameOver, gameLoaded, enemyStillExploding;
245extern JE_word totalEnemy;
246extern JE_word enemyKilled;
247extern struct JE_MegaDataType1 megaData1;
248extern struct JE_MegaDataType2 megaData2;
249extern struct JE_MegaDataType3 megaData3;
250extern JE_byte flash;
251extern JE_shortint flashChange;
252extern JE_byte displayTime;
253
254extern bool play_demo, record_demo, stopped_demo;
255extern Uint8 demo_num;
256extern FILE *demo_file;
257
258extern Uint8 demo_keys;
259extern Uint16 demo_keys_wait;
260
261extern JE_byte soundQueue[8];
262extern JE_boolean enemyContinualDamage;
263extern JE_boolean enemiesActive;
264extern JE_boolean forceEvents;
265extern JE_boolean stopBackgrounds;
266extern JE_byte stopBackgroundNum;
267extern JE_byte damageRate;
268extern JE_boolean background3x1;
269extern JE_boolean background3x1b;
270extern JE_boolean levelTimer;
271extern JE_word levelTimerCountdown;
272extern JE_word levelTimerJumpTo;
273extern JE_boolean randomExplosions;
274extern JE_boolean editShip1, editShip2;
275extern JE_boolean globalFlags[10];
276extern JE_byte levelSong;
277extern JE_boolean loadDestruct;
278extern JE_word mapOrigin, mapPNum;
279extern JE_byte mapPlanet[5], mapSection[5];
280extern JE_boolean moveTyrianLogoUp;
281extern JE_boolean skipStarShowVGA;
282extern JE_MultiEnemyType enemy;
283extern JE_EnemyAvailType enemyAvail;
284extern JE_word enemyOffset;
285extern JE_word enemyOnScreen;
286extern JE_word superEnemy254Jump;
287extern explosion_type explosions[MAX_EXPLOSIONS];
288extern JE_integer explosionFollowAmountX, explosionFollowAmountY;
289extern JE_boolean fireButtonHeld;
290extern JE_boolean enemyShotAvail[ENEMY_SHOT_MAX];
291extern EnemyShotType enemyShot[ENEMY_SHOT_MAX];
292extern JE_byte zinglonDuration;
293extern JE_byte astralDuration;
294extern JE_word flareDuration;
295extern JE_boolean flareStart;
296extern JE_shortint flareColChg;
297extern JE_byte specialWait;
298extern JE_byte nextSpecialWait;
299extern JE_boolean spraySpecial;
300extern JE_byte doIced;
301extern JE_boolean infiniteShot;
302extern JE_boolean allPlayersGone;
303extern const uint shadowYDist;
304extern JE_real optionSatelliteRotate;
305extern JE_integer optionAttachmentMove;
306extern JE_boolean optionAttachmentLinked, optionAttachmentReturn;
307extern JE_byte chargeWait, chargeLevel, chargeMax, chargeGr, chargeGrWait;
308extern JE_word neat;
309extern rep_explosion_type rep_explosions[MAX_REPEATING_EXPLOSIONS];
310extern superpixel_type superpixels[MAX_SUPERPIXELS];
311extern unsigned int last_superpixel;
312extern JE_byte temp, temp2, temp3;
313extern JE_word tempX, tempY;
314extern JE_word tempW;
315extern JE_boolean doNotSaveBackup;
316extern JE_word x, y;
317extern JE_integer b;
318extern JE_byte **BKwrap1to, **BKwrap2to, **BKwrap3to, **BKwrap1, **BKwrap2, **BKwrap3;
319extern JE_shortint specialWeaponFilter, specialWeaponFreq;
320extern JE_word specialWeaponWpn;
321extern JE_boolean linkToPlayer;
322extern JE_word shipGr, shipGr2;
323extern Sprite2_array *shipGrPtr, *shipGr2ptr;
324
325static const int hud_sidekick_y[2][2] =
326{
327 { 64, 82 }, // one player HUD
328 { 108, 126 }, // two player HUD
329};
330
331void JE_getShipInfo(void);
332JE_word JE_SGr(JE_word ship, Sprite2_array **ptr);
333
334void JE_drawOptions(void);
335
336void JE_tyrianHalt(JE_byte code); /* This ends the game */
337void JE_specialComplete(JE_byte playernum, JE_byte specialType);
338void JE_doSpecialShot(JE_byte playernum, uint *armor, uint *shield);
339
340void JE_wipeShieldArmorBars(void);
341JE_byte JE_playerDamage(JE_byte temp, Player *);
342
343void JE_setupExplosion(signed int x, signed int y, signed int delta_y, unsigned int type, bool fixed_position, bool follow_player);
344void JE_setupExplosionLarge(JE_boolean enemyground, JE_byte explonum, JE_integer x, JE_integer y);
345
346void JE_drawShield(void);
347void JE_drawArmor(void);
348
349JE_word JE_portConfigs(void);
350
351/*SuperPixels*/
352void JE_doSP(JE_word x, JE_word y, JE_word num, JE_byte explowidth, JE_byte color);
353void JE_drawSP(void);
354
355void JE_drawOptionLevel(void);
356
357#endif /* VARZ_H */
Definition varz.h:173
Definition varz.h:128
Definition varz.h:137
Definition varz.h:148
Definition varz.h:160
Definition varz.h:55
Definition player.h:61
Definition sprite.h:90
Definition varz.h:186
Definition varz.h:195
Definition varz.h:202