Codebase list gravitywars / f50c7fc
Import Upstream version 1.102 Reiner Herrmann 4 years ago
137 changed file(s) with 6138 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 CHANGES
1 -------
2 v1.0 (June1995)- The first release version.
3
4 v1.1 (November1995)- The source is totally reorganized.
5 The timeconsuming floating scoretable is now put
6 into a splitscreen.
7 Changes in levels / Gfx.
8 Faster Routines.
9 Some small stuff.
10 Faster Block Blit Routine.
11 Symbolic links should work now.
12 Better Installation-script.
13 Everybody can run the game now.
14
15 v1.101 (August 1996)- Some Comments added. (Very few..)
16 (The source released.)
17 ELF Binary.
18
19 v1.102 (November 1996)-The Install Script.
20 The release of the source.
0 #!/bin/sh
1 cd ~games/GravityWars101
2 GravityWars101 $1 $2
Binary diff not shown
0 /* -------------------------------------------------------------------------
1 Gravity Wars v1.1, (C) Sami Niemi 1995, 1996
2
3 NOTES: [960824] [RELEASE NOTES 961101]
4
5 The game started as a bunch of fun routines that made the ship fly.
6 Later on I added collition control, and after Pär got involved with
7 the graphics I just couldn't stop... So, the structure of the game is
8 just terrible, with lots of unecessary variables , flags that
9 are used as variables etc.. I should've written the program in c++, and
10 for X! Svgalib just contains too many bugs..
11
12 I'd be fun to see this game ported to different operating systems, though
13 the structure of the game might make it hard, especially since I used
14 the SVGALIB.
15
16 You're free to modify the code and the graphics as long as you write
17 that the original code was written by Sami Niemi, and the original
18 graphics were drawn by Pär Johannesson (If you're using any parts of
19 the original graphics)
20
21 I'd love to hear from any changes that you've made to the game!
22
23 / Sami
24
25 e96sn@efd.lth.se
26 sniemi@kuai.se
27 http://www.kuai.se/~sniemi
28 http://www.efd.lth.se/~e96sn
29
30
31 REMEMBER:
32
33 getbox(x,y,*ptr) Gets the original graphics based on the block[]&level[]
34 getbox2(x,y,*ptr Gets the graphics directly from the screen
35
36
37
38 BUGS (i.e. I don't have the time to fix'em):
39
40 - consoleswitching takes away the splitscreen (real easy to fix)
41
42 ------------------------------------------------------------------------- */
43 #include <unistd.h>
44 #include "includes.h"
45 #include "memory.h"
46
47 /*--------------------------------------------------------------------- main */
48 int main(int n_args, char *arg[]) {
49
50
51 int n,ch,x,y;
52
53 long tmp_long;
54
55 long pal_m;
56 long pal_n;
57
58 short baselevel;
59 char filename[128];
60
61 char firstlevel[20]="levels/level01";
62 char buf[128];
63
64 levelnum=1;
65
66 if (readlink(arg[0],buf,128)==-1)
67 strcpy(buf,arg[0]);
68
69 n=strlen(buf);
70 while(n>=0)
71 if (buf[n--]=='/') break;
72 if (n<0) {
73 strcpy(gamename,"./");
74 gamenamelen=2;
75 }
76 else {
77 strcpy(gamename,buf);
78 gamename[n+2]=0;
79 gamenamelen=strlen(gamename);
80 }
81
82
83 if (n_args>1) {
84 n=0;
85 do {
86 n++;
87 } while ( (strncmp(arg[1],codes[n],6)) && (n<99));
88 if (n!=99) {
89 levelnum=n+1;
90 if (n_args>2)
91 delay_len=atoi(arg[2]);
92 } else {
93 if ((arg[1][0]<'0') || (arg[1][0]>'9')) {
94 printf("\nUsage: %s [code-to-a-given-level] [beam-adjustment]\n"
95 "(Sure you've got the right code?)\n\n",arg[0]);
96 exit(0);
97 }
98 else
99 delay_len=atoi(arg[1]);
100 }
101 }
102
103 baselevel=levelnum;
104
105 strcpy(firstlevel,nextlevel);
106
107
108 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
109 "\n"
110 "-----------------------------------------------------------------------------\n"
111 " G R A V I T Y W A R S\n\n"
112 " v 1.1\n"
113 " (November 1995)\n"
114 "\n"
115 " A Gravity Force clone for the Linux operating system\n"
116
117 "\n\n"
118 " Coding by Sami Niemi\n\n"
119
120 " Graphics by Pär Johannesson\n"
121
122 "-----------------------------------------------------------------------------\n"
123 );
124 initParams();
125 loadGfx();
126 rotGfx();
127
128 initScreen();
129
130 keyboard_init();
131 mouse_init("/dev/mouse", MOUSE_MICROSOFT, MOUSE_DEFAULTSAMPLERATE);
132 scans=keyboard_getstate();
133
134 ending=TRUE;
135
136 while(ending) {
137
138 intro();
139 if (escape)
140 goto escaped;
141 loaddata();
142 drawScreen();
143
144 /*
145 old_x=0;
146 old_y=0;
147 getbox(old_x, old_y, shipback[0]);
148 putbox(old_x, old_y, shipback[0]);
149 moveShip(0,0);
150 */
151 old_x=sx[0] >> STEP;
152 old_y=sy[0] >> STEP;
153 moveShip(0,0);
154
155 updatescore();
156 win_y=(sy[0] >> STEP)-232;
157 if (win_y<8)
158 win_y=8;
159 else
160 if (win_y>968)
161 win_y=968;
162 putscore(0,win_y);
163
164
165 /*CenterShip*/
166 y=(sy[0] >> STEP)-240;
167 if (y<16)
168 y=16;
169 else
170 if (y>960)
171 y=960;
172 gl_setdisplaystart(0,y);
173
174 stampnum(levelnum);
175 putstamp(272,y+184,68,69,70);
176
177 if (levelnum&1) {
178 for(pal_n=0; pal_n<=1024; pal_n+=16) {
179 for (pal_m=0; pal_m<=767; pal_m++)
180 p1[pal_m]=(((long)pal[pal_m])*pal_n)>>10;
181 vga_waitretrace();
182 gl_setpalette(p1);
183 }
184 gl_setpalette(pal);
185 }
186 else {
187 for(pal_n=0; pal_n<=1024; pal_n+=16) {
188 for (pal_m=0; pal_m<=767; pal_m++)
189 p1[pal_m]=(((long)palB[pal_m])*pal_n)>>10;
190 vga_waitretrace();
191 gl_setpalette(p1);
192 }
193 gl_setpalette(palB);
194 }
195
196 waitanykey();
197
198 killstamp(272,y+184);
199
200 anim_frame=0;
201 ShipScore=0;
202
203 control(0);
204
205 /*------ The End --------*/
206 if (ending) {
207
208 for(n=0; n<=4095; n++) {
209 tmpscore[n]=score[n];
210 score[n]=highscore[n];
211 }
212
213 tmp_long=Dec2BCD[ShipScore];
214
215 putdigit(1375,tmp_long>>16);
216 putdigit(1383,(tmp_long>>12)&15);
217 putdigit(1391,(tmp_long>>8)&15);
218 putdigit(1399,(tmp_long>>4)&15);
219 putdigit(1407,tmp_long&15);
220
221 if (ShipScore>HighScore) {
222 HighScore=ShipScore;
223
224 strcpy(filename,gamename);
225 strcpy(&filename[gamenamelen],"data/hscore.gw");
226 if ( ( fileptr=fopen(filename,"w") )!=NULL) {
227 fprintf(fileptr,"%d\n",ShipScore);
228 fclose(fileptr);
229 }
230 else {
231 printf("Can't write the HighScore!!!!");
232 doPanic();
233 }
234 }
235
236 tmp_long=Dec2BCD[HighScore];
237
238 putdigit(1474,tmp_long>>16);
239 putdigit(1482,(tmp_long>>12)&15);
240 putdigit(1490,(tmp_long>>8)&15);
241 putdigit(1498,(tmp_long>>4)&15);
242 putdigit(1506,tmp_long&15);
243
244 putscoreOnly(0,win_y);
245
246 putstamp(272,win_y+192,54,60,61);
247 waitanykey();
248 killstamp(272,win_y+192);
249 if (*(scans+SCANCODE_ESCAPE))
250 goto escaped;
251
252 for(n=0; n<=4095; n++) {
253 score[n]=tmpscore[n];
254 }
255
256 if (levelnum&1) {
257 for(pal_n=1024; pal_n>=0; pal_n-=16) {
258 for (pal_m=0; pal_m<=767; pal_m++)
259 p1[pal_m]=(((long)pal[pal_m])*pal_n)>>10;
260 vga_waitretrace();
261 gl_setpalette(p1);
262 }
263 gl_setpalette(p0);
264 }
265 else {
266 for(pal_n=1024; pal_n>=0; pal_n-=16) {
267 for (pal_m=0; pal_m<=767; pal_m++)
268 p1[pal_m]=(((long)palB[pal_m])*pal_n)>>10;
269 vga_waitretrace();
270 gl_setpalette(p1);
271 }
272 gl_setpalette(p0);
273 }
274
275 strcpy(nextlevel,firstlevel);
276 levelnum=baselevel;
277 ShipLife=3;
278 }
279
280 }
281 escaped:
282
283 mouse_close();
284 keyboard_close();
285
286 vga_setmode(TEXT);
287 printf("\n");
288 exit(0);
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
0 #
1 # Makefile for Gravity Wars, by Sami Niemi
2 #
3
4 BINDIR=/usr/local/bin
5
6 CFLAGS=-O2 -s
7 CC=cc
8 LIBS=-lm -lvgagl -lvga
9 TARGET=GravityWars101
10 OBJECTS=memory.o macros.o misc.o water.o score.o hole.o bullet.o pixel.o \
11 blocks.o introutro.o animate.o init.o makepic.o scroll.o moveship.o \
12 control.o GravityWars101.o
13
14 $(TARGET): $(OBJECTS)
15 $(CC) $(CFLAGS) $(OBJECTS) $(OBJECTS2) -o $(TARGET) $(LIBS)
16
17 GravityWars101.o: GravityWars101.c config.h macros.h
18
19 memory.o: memory.c config.h macros.h
20
21 macros.o: config.h memory.o macros.c macros.h
22
23 misc.o: misc.c config.h macros.h
24
25 water.o: water.c config.h macros.h
26
27 score.o: score.c config.h macros.h
28
29 hole.o: hole.c config.h macros.h
30
31 bullet.o: bullet.c config.h macros.h
32
33 pixel.o: pixel.c config.h macros.h
34
35 blocks.o: blocks.c config.h macros.h
36
37 introutro.o: introutro.c config.h macros.h
38
39 animate.o: animate.c config.h macros.h
40
41 init.o: init.c config.h macros.h
42
43 makepic.o: makepic.c config.h macros.h
44
45 scroll.o: scroll.c config.h macros.h
46
47 moveship.o: moveship.c config.h macros.h
48
49 control.o: control.c config.h macros.h
50
51
52 clean:
53 rm -f $(OBJECTS)
54 rm -f $(TARGET)
55
56 install:
57 do_install
0
1
2 G R A V I T Y W A R S
3 ======================
4
5 v1.1
6 (August 1996)
7
8
9 "A Gravity Force clone for the Linux operating system"
10
11
12 Credits:
13
14 ...Programming by Sami Niemi...
15
16 ...Graphics by Pär Johannesson...
17
18 ...Title picture by Mattias Johansson...
19
20
21
22 INTRODUCTION
23 ------------
24
25
26 Gravity Force is based on Gravity Force, one of the greatest games
27 for the Amiga. This version is a little different, with a much higher
28 resolution, and better graphics. It also includes some new features
29 like water, exploding doors, bonus objects, fans (ie. wind), and some
30 other special effects like exploding bullets, and splashing water..
31
32 Gravity Wars has been developed from scratch by Sami Niemi in June
33 1995. The game comes with a DOS based level editor which is coded by
34 Pär Johannesson, the gfx dude. The level editor hopefully means a
35 longer lifespan for the game, since everybody can now design their
36 own levels. I've also included a C source/bin for converting the edi-
37 tor output to an object map. More about that in the technical secti-
38 on. The game also gives a level code, so you can start from the last
39 level.
40
41
42
43
44
45 REQUIREMENTS
46 ------------
47
48 The game (v1.1 or higher) should run on a 386, with enough memory.
49 You also need an SVGA card that is supported by SVGALIB. The game
50 runs in UNLINEAR mode, which means that it should run on all SVGA
51 cards. (The unlinear mode also consumes a lot of CPU power.) The
52 game uses only the normal VGA functions, the only real SVGA funtion
53 sets the screen on..
54
55 USAGE
56 -----
57
58 GravityWars [code-to-a-given-level] [beam-adjustment]
59
60 You'll receive the codes after a completed level. The beam-adjust-
61 ment is a number somewhere between 0 and 30000,which adjust the ras-
62 terbeams position while drawing the graphics. It should be higher on
63 fast computers, and lower on slow ones (If it's wrong, the screen
64 might flicker a bit). The default is 0.
65
66 HOW TO PLAY
67 -----------
68
69 The goal is to get all the keys without getting killed. After you've
70 picked up the last one, the hidden StarGate opens. You're supposed to
71 fly into it, and it'll beam you into the next level. You can pick up
72 bonus objects on the way. The round (look kinda like the European Uni-
73 on logos) objects are extra lifes. The bottles with an "F" on contain
74 extra fuel. The clocks give you extra time. Rest of the objects just
75 give you points. You can shoot yourself through the red doors (try
76 to shoot into the water), and fill your tank by landing on the fuel
77 platform. That should get you started..
78
79 CONTROLS
80 --------
81
82 - Left/Right cursor keys turn the ship.
83 - Forward cursor key turns the throttle on.
84 - CTRL shoots.
85 - ESC/CTRL-C kills the game. Mouse buttons also kill the game.
86 - ALT-F1 switches to the first console
87 (if you started the game in some other)
88
89 POLICY
90 ------
91
92 The programs and graphics are public domain, with the following
93 restrictions: You're free to modify the code and the graphics as long
94 as you state that the original code was written by Sami Niemi, and
95 that the original graphics were drawn by P<E4>r Johannesson (If you're
96 using any parts of it). You're not allowed to sell the game or use it
97 for other commercial purposes without my permission, modified or not.
98
99 Please inform me of the latest changes to the game.
100
101
102 TECHNICAL
103 ---------
104
105 The game uses a 640*1440 256 color virtual screen, which leaves no
106 space for a doublebuffer. The graphical mode is a normal NON-Linear
107 640*480 screen. I decided to use a NON linear mode(What a sacrifice!)
108 to make it possible for people with NON linear gfx cards to also play
109 the game. Unfortunately, the NON linear memory is more than ten times
110 slower to access, and with it's complex structure even slower to wri-
111 te to! (and a LOT harder to code a fast 'blitting' routine for!).
112
113 Because of the slow MEM->VIDEOMEM copying, it would've been too
114 slow to do a real hardware-software scrolling, with a double buffer.
115 This means that everything has to be drawn to the screen while the
116 rasterbeam is far away from the drawn object.. Problems.. As you mig-
117 ht know - this is not fully possible... Atleast not on any slow con-
118 figurations. Sorry about that, but you have to admit that playing the
119 game on a standard VGA screen would've been boring...
120
121 As you know, Linux is a multitasking OS, which means that someti-
122 mes the OS just wants to do it's little disk access, and 'gives a sh-
123 it' about eventual undubbelbuffered games running on it.. (No offence
124 on the OS! I love it, even though it seems like it's running a bit
125 unevenly, with occational peaks. Any comments from the OS development
126 side?) This means even more problems for an undubbelbuffered game, so
127 to get the best results (smoothness, with no flicker), you should use
128 a fast computer! There is also a parameter that'll change the beam
129 tracking position. The default value is 5000. If you have a fast mac-
130 hine, you should use a higher value, otherwise same or smaller.
131
132 (The above text is about the v1.0, the newer versions are much faster
133 and should run without flicker on slow machines too.)
134
135 The game hasn't been through much beta testing, since I just don't
136 have time to supervise the hole thing. My military service in Finland
137 starts in 12 days... This also means that the eventual second better
138 version won't be released for a while, and that the bugs won't get
139 fixed unless someone living in HELSINKI (where I'm doing the manda-
140 tory service) with a nice Linux machine let's me use his machine.. ;)
141
142 (Yeah.. I'm still in the service... 7th Nov 1995.. What a waste...)
143
144
145
146
147 THE LEVEL EDITOR
148 ----------------
149
150 Not much to say about. Saves a map containing internal an external
151 information about the level. The last part contain the information th-
152 at the Converter.c reads, and processes. That data contains 20*45 blo-
153 ck numbers. The blocks are contained in the data/blocks.gw in my own
154 raw image format:
155
156 768 bytes - first palette
157 768 bytes - second palette
158 ??? bytes - data
159
160 data:
161 x size - 320 pixels
162 y size - 792 pixels
163 block_size - 32*32, separated with a grid to the 'north'
164 and 'west'.
165
166 (This means that there are four 320*198 screens attached
167 to eachother, with 32*32 blocks starting from the (1,1)
168 position, not from (0,0), due to the grid)
169
170 Some important blocks are: (You'd have to use the same colors, be-
171 cause of the way the collision controll works.. Ofcourse you can have
172 a different palette.)
173
174 36-38 background
175
176 18-20 Start
177
178 41 End
179
180 45-50 Ship Explotion
181
182 51 Key
183
184 54,60,61 Game Over
185
186 67,76,85 Out Of Time
187
188 68,69,70 Level, Get Ready
189
190 67,105,154 Out Of Fuel
191
192 108,109,117,
193 119,120,122,
194 127,130,136,
195 139,144,146,
196 147,153 Congratulations message
197
198 112-116 Water Splash
199
200 123-125,
201 132-134,
202 141-143,
203 150-152 Fan Anims
204
205 157-161 Ship Implotion
206
207 170 Water Key
208
209 204 Water Background
210
211 207 Ship with thrust
212 208 Ship
213
214
215 So, if you decide to change the graphics to the game, you have to keep
216 these blocks.
217
218 The level maps consist of three things:
219
220 1. level??.gfx, which contains 20*45 block numbers starting from 0
221 meaning the upperleft corner of the blocks.gw
222
223 2. level??.obj, which contains the object, water, red wall, etc in-
224 formation. Check out the Converter.c source. The only things that
225 are not handled by the converter are the wind motions:
226
227 Q W E If the ship flies into a block with one of the letters,
228 \ ^ / it'll be accelerated into the given direction. The Con-
229 \|/ verter places an 'S' to the place where the fan is ro-
230 A<--o-->D tating, so the designer can edit the file easily with a
231 /|\ text editor.
232 / v \
233 Z X C
234
235 3. level??.dat, which consist of the remarks on the level, amount of
236 fuel, and time at the start, and after explosions. It also conta-
237 ins the animation information:
238
239 Starting with 'anim', followed by: (numbers)
240
241 X coordinate,
242 Y coordinate,
243 Start frame times eight,
244 Stop frame times eight,
245 Actual frame times eight,
246 Speed (1,2,4,8,16,32,...) Small numbers are slow, and require less
247 processor power.
248
249
250 Current animations consist only of these: (plus different explosions)
251
252 animation start stop
253 ----------------- ----- ----
254 Fan blowing down 984 1007
255 Fan blowing left 1056 1079
256 Fan blowing right 1128 1151
257 Fan blowing up 1200 1223
258
259 Well, I hope this is enough of information for y'all to get started..
260 I hope to see more levels, a new editor, and why not a level to postsc-
261 ript converter too.. So you could print out your favourite levels. I
262 don't have time to code anymore on the game, and the source is not re-
263 ally ready for release, so just hang on.. I'll be baeck..
264
265 (Ok, so I'm back... Fixed the worst bugs.. So, just fill my mailbox with
266 comments...)
267
268
269
270
271 TO DO, BUGS
272 -----------
273
274 Oh.. There are thousands of things to do.. The best thing is that the
275 source supports all these features, me and Pär just haven't had time to
276 implement all that. The source (some parts of it) supports for example
277 two players, and a magnet object which pulls the ship towards itself
278 etc... If you'll get me encouraged enough, I might just write a much
279 better version. Network support is ofcourse one of the top priorities,
280 and is fairly easy to write. The Top priority should be to convert the
281 whole thing to X11.
282
283
284
285
286
287 THANKS
288 ------
289
290 - Linus Torvalds, for the kernel.
291 - All the people behind the Linux, and the GNU software.
292
293
294
295
296 CREDITS
297 -------
298
299 - Sami Niemi: Coding, Design, Graphics, Levels
300
301 - Pär Johannesson: Graphics, Design, Levels
302
303 - Mattias Johansson: Title Picture
304
305 - Paul Fritzsche: Levels
306
307
308
309
310
311
312 CONTACT ADDRESSES
313 -----------------
314
315
316
317
318 Sami Niemi (Coding, level design)
319 ---------------------------------
320
321 Address: (Sandvägen 4b)
322 (374 53 Asarum)
323 (Sweden)
324
325
326 Voice: (+46-454-84704)
327
328 Fax: +46-454-84992
329
330 email: e96sn@efd.LTH.se
331 sniemi@kuai.se
332
333 WWW: http://www.kuai.se/~sniemi
334 http://www.efd.lth.se/~e96sn
335
336
337
338
339
340 Pär Johannesson (Graphics, level design)
341 ----------------------------------------
342
343 Address: Knäpparestigen 6
344 374 51 Asarum
345 Sweden.
346
347 Voice: +46-454-87249
348 email: pt95pjo@pt.hk-r.se
349
350
351
352
353
354
355 Mattias Johansson (Raytraced title picture)
356 ------------------------------------------
357
358 FAX: +46-8-330892
359 BBS: +46-8-54062686
360 email: mjoh@kuai.se
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
0 =====================================================================
1 Gravity Wars 1.1 ELF Binary & Source
2 =====================================================================
3
4 WHATS NEW?
5 ----------
6
7 Bugfixes: Miscolored water, a levelcode bug, and other smallbugs.
8 New stuff: A new installation script. The source is now included in
9 the package. The binary is in ELF format.
10
11 THE GAME
12 --------
13
14 Gravity Force is based on Gravity Force, one of the greatest games
15 for the Amiga. This version is a little different, with a much higher
16 resolution, and better graphics. It also includes some new features
17 like water, exploding doors, bonus objects, fans (ie. wind), and some
18 other special effects like exploding bullets, and splashing water..
19
20
21 REQUIREMENTS
22 ------------
23
24 The game (v1.1 or higher) should run on a 386, with enough memory.
25 You also need an SVGA card that is supported by SVGALIB. The game
26 runs in UNLINEAR mode, which means that it should run on all SVGA
27 cards. (The unlinear mode also consumes a lot of CPU power.) The
28 game uses only the normal VGA functions, the only real SVGA funtion
29 sets the screen into the svga mode..
30
31
32 FTP SITES
33 ---------
34
35 ftp://ftp.funet.fi/pub/Linux/incoming/gwars11s.tgz
36 ftp://sunsite.unc.edu/pub/Linux/Incoming/gwars11s.tgz
37
38 ,and later from
39
40 ftp://ftp.funet.fi/pub/Linux/util/games/video/gwars11s.tgz
41 ftp://sunsite.unc.edu/pub/Linux/games/video/gwars11s.tgz
42 http://www.kuai.se/~sniemi
43
44
45 CREDITS
46 -------
47
48 Sami Niemi: Coding, Design, Graphics, Levels
49 e96sn@efd.LTH.se
50 sniemi@kuai.se
51 http://www.kuai.se/~sniemi
52 http://www.efd.lth.se/~e96sn
53
54
55 Pär Johannesson: Graphics, Design, Levels
56 pt95pjo@pt.hk-r.se
57
58
59 Mattias Johansson: Title Picture
60 mjoh@kuai.se
61
62 Paul Fritzsche: Levels
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*------------------------------------------------------------------ animate */
5 void animate() {
6
7 static short obj,n,m,fr,adj,x,y,num_anim;
8 static uchar col,c1,c2,c3;
9
10 static uchar *blockadr;
11 static uchar *actionadr;
12
13 /* Fade the Red Door */
14
15 c1=51+(SIN[(col_frame>>1)&31]>>8);
16
17 pal[DOOR1COLOR*3]=c1;
18 pal[DOOR1COLOR*3+1]=15;
19 pal[DOOR1COLOR*3+2]=15;
20 palB[DOOR1COLOR*3]=c1;
21 palB[DOOR1COLOR*3+1]=15;
22 palB[DOOR1COLOR*3+2]=15;
23 p2[DOOR1COLOR*3]=48-c1;
24 p2[DOOR1COLOR*3+1]=48;
25 p2[DOOR1COLOR*3+2]=48;
26 p2B[DOOR1COLOR*3]=48-c1;
27 p2B[DOOR1COLOR*3+1]=48;
28 p2B[DOOR1COLOR*3+2]=48;
29
30 gl_setpalettecolor(DOOR1COLOR,c1,0,0);
31 col=42+((2048+SIN[(16+col_frame)&31])>>8);
32 c1=col>>1;
33 c2=63-col;
34 c3=col>>2;
35
36 pal[GREENCOLOR*3]=c1;
37 pal[GREENCOLOR*3+1]=c2;
38 pal[GREENCOLOR*3+2]=c3;
39 palB[GREENCOLOR*3]=c1;
40 palB[GREENCOLOR*3+1]=c2;
41 palB[GREENCOLOR*3+2]=c3;
42 p2[GREENCOLOR*3]=63-c1;
43 p2[GREENCOLOR*3+1]=63-c2;
44 p2[GREENCOLOR*3+2]=63-c3;
45 p2B[GREENCOLOR*3]=63-c1;
46 p2B[GREENCOLOR*3+1]=63-c2;
47 p2B[GREENCOLOR*3+2]=63-c3;
48
49 gl_setpalettecolor(GREENCOLOR,c1,c2,c3);
50 col_frame++;
51
52
53 /* Statical Animations */
54
55 num_anim=n_anim-1;
56 if (n_anim>0) {
57 obj=anim_frame & ANIMSPEED;
58 for(n=obj; n<=num_anim; n+=ANIMSTEP) {
59 fr=anim[n].frame;
60 if ( ( (anim[n].start ^ anim[n].frame) & 7)==0)
61 putbox(anim[n].x << 5, anim[n].y << 5, block[fr>>3]);
62 fr+=anim[n].speed;
63 if (fr>anim[n].stop) fr=anim[n].start;
64 anim[n].frame=fr;
65 }
66 anim_frame++;
67 }
68 /* Action Animations */
69
70 for(n=0; n<=N_ACTION; n++) {
71 if (action[n].state) {
72
73 blockadr=block[action[n].frame];
74 x=action[n].x-16;
75 y=action[n].y-16;
76 if(action[n].frame==action[n].start) {
77
78 getbox(x,y,actionback[n]);
79 actionadr=actionback[n];
80
81 for(m=0; m<=1023; m++) /* Plot the new ship before scrolling */
82 actionmix[m]=blockadr[m] ? blockadr[m] : actionadr[m];
83 putbox(x,y, actionmix);
84 action[n].frame++;
85 }
86 else
87 if (action[n].frame==action[n].stop) {
88
89 /* beep(20000);*/
90
91 if (action[n].delay>0)
92 action[n].delay--;
93 else {
94 putbox(action[n].x-16,action[n].y-16,actionback[n]);
95 action[n].state=FALSE;
96 }
97 }
98 else {
99 if (action[n].delay>0)
100 action[n].delay--;
101 else {
102
103 actionadr=actionback[n];
104 for(m=0; m<=1023; m++) /* Plot the new ship before scrolling */
105 actionmix[m]=blockadr[m] ? blockadr[m] : actionadr[m];
106 putbox(x,y, actionmix);
107 action[n].frame++;
108 action[n].delay=action[n].speed;
109 }
110 }
111 }
112 }
113 }
114
115 void AnimateAll() {
116
117 #ifdef ANIM
118 vga_waitretrace();
119 animate();
120 #endif
121
122 #ifdef SCORE
123 putscoreOnly(0,win_y);
124 #endif
125 }
126
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*-------------------------------------------------------------------putbox */
5 /* Put a 32*32 linear box into an unlinear 65536 block address space */
6 /*--------------------------------------------------------------------------*/
7 void putbox(int x, int y, uchar *dp) {
8
9 static long adr;
10 static short xx,yy;
11 static uchar len,mask;
12 static uchar *address;
13
14 adr=(y<<9)+(y<<7)+x;
15 mask=adr >> 16;
16 adr=adr & 65535;
17
18 vga_setpage(mask);
19
20 if (adr < 45024) {
21
22 /* NORMAL */
23 address=vga_ptr+adr;
24 for (yy=0; yy<=31; yy++) {
25 for (xx=0; xx<=31; xx++) {
26 *(address++)=*(dp++);
27 }
28 address+=608;
29 }
30
31 }
32 else {
33
34 /* BORDER */
35 for (yy=0; yy<=31; yy++) {
36
37 if (adr>65504) { /* Approaching */
38 if (adr<=65535) { /* SplitLine */
39
40 len=(65536-adr);
41
42 for(xx=len; xx>=1; xx--) {
43 *(vga_ptr+adr++)=*(dp++);
44 }
45
46 mask++;
47 vga_setpage(mask);
48 adr=0;
49
50 for(xx=(32-len); xx>=1; xx--) {
51 *(vga_ptr+adr++)=*(dp++);
52 }
53 }
54 else {
55 mask++;
56 vga_setpage(mask);
57 adr=adr & 65535;
58 for (xx=0; xx<=31; xx++) {
59 *(vga_ptr+adr++)=*(dp++);
60 }
61 }
62 }
63 else {
64 for (xx=0; xx<=31; xx++) {
65 *(vga_ptr+adr++)=*(dp++);
66 }
67 }
68 adr+=608;
69 }
70 }
71 vga_setpage(0);
72 }
73
74
75
76 /*--------------------------------------------------------------------------*/
77 /* Get a 32*32 linear box from the blockmap/blockgfx address space */
78 /*--------------------------------------------------------------------------*/
79 void getbox(int orx, int ory, uchar *out) {
80
81 static int rx,ry,cx,cy,ix,iy,ox,oy,n;
82
83 static char *from;
84 static char *to;
85 static int num;
86 static int mod;
87
88 rx=orx;
89 ry=ory;
90
91 ox=rx&31;
92 oy=ry&31;
93
94 /* Left Up */
95 n=(ry>>5);
96 num=(rx>>5)+(n<<4)+(n<<2);
97
98 ix=ox;
99 iy=oy;
100 from=block[level[num]]+ix+(iy<<5);
101 to=&out[0];
102 for(cy=iy; cy<=31; cy++) {
103 for(cx=ix; cx<=31; cx++) {
104 *(to++)=*(from++);
105 }
106 to+=ix;
107 from+=ix;
108 }
109
110 /* Right Up */
111 if (ox>0) {
112 rx=orx+31;
113 ix=31-rx&31;
114 iy=oy;
115 from=block[level[num+1]]+(iy<<5);
116 to=&out[ix];
117 for(cy=iy; cy<=31; cy++) {
118 for(cx=ix; cx<=31; cx++) {
119 *(to++)=*(from++);
120 }
121 to+=ix;
122 from+=ix;
123 }
124
125
126
127
128 /* Right Down */
129 if (oy>0) {
130 rx=orx+31;
131 ry=ory+31;
132 iy=ry&31;
133 ix=31-rx&31;
134 from=block[level[num+21]];
135 to=&out[ix+((31-iy)<<5)];
136 for(cy=0; cy<=iy; cy++) {
137 for(cx=ix; cx<=31; cx++)
138 *(to++)=*(from++);
139 to+=ix;
140 from+=ix;
141 }
142 }
143 }
144
145
146 /* Left Down */
147 if (oy>0) {
148 ry=ory+31;
149 rx=ox;
150 ix=rx&31;
151 iy=ry&31;
152 from=block[level[num+20]]+ix;
153 to=&out[((31-iy)<<5)];
154 for(cy=0; cy<=iy; cy++) {
155 for(cx=0; cx<=(31-ix); cx++)
156 *(to++)=*(from++);
157 to+=ix;
158 from+=ix;
159 }
160 }
161 }
162 /*--------------------------------------------------------------------------*/
163 /* Put a 32*32 linear box to the blockmap/blockgfx address space */
164 /*--------------------------------------------------------------------------*/
165 void changeblocks(int orx, int ory, uchar *out) {
166
167 static int rx,ry,cx,cy,ix,iy,ox,oy,n;
168
169 static char *from;
170 static char *to;
171 static int num;
172 static int mod;
173
174 rx=orx;
175 ry=ory;
176
177 ox=rx&31;
178 oy=ry&31;
179
180 /* Left Up */
181 n=(ry>>5);
182 num=(rx>>5)+(n<<4)+(n<<2);
183
184 if (objects[num]==L_RED_DOOR) {
185 ix=ox;
186 iy=oy;
187 from=block[level[num]]+ix+(iy<<5);
188 to=&out[0];
189 for(cy=iy; cy<=31; cy++) {
190 for(cx=ix; cx<=31; cx++) {
191 *(from++)=*(to++);
192 }
193 to+=ix;
194 from+=ix;
195 }
196 }
197
198 /* Right Up */
199 if (ox>0) {
200 if (objects[num+1]==L_RED_DOOR) {
201 rx=orx+31;
202 ix=31-rx&31;
203 iy=oy;
204 from=block[level[num+1]]+(iy<<5);
205 to=&out[ix];
206 for(cy=iy; cy<=31; cy++) {
207 for(cx=ix; cx<=31; cx++) {
208 *(from++)=*(to++);
209 }
210 to+=ix;
211 from+=ix;
212 }
213 }
214
215
216
217
218 /* Right Down */
219 if ( (oy>0) && (objects[num+21]==L_RED_DOOR) ) {
220 rx=orx+31;
221 ry=ory+31;
222 iy=ry&31;
223 ix=31-rx&31;
224 from=block[level[num+21]];
225 to=&out[ix+((31-iy)<<5)];
226 for(cy=0; cy<=iy; cy++) {
227 for(cx=ix; cx<=31; cx++)
228 *(from++)=*(to++);
229 to+=ix;
230 from+=ix;
231 }
232 }
233 }
234
235
236 /* Left Down */
237 if ( (oy>0) && (objects[num+20]==L_RED_DOOR) ) {
238 ry=ory+31;
239 rx=ox;
240 ix=rx&31;
241 iy=ry&31;
242 from=block[level[num+20]]+ix;
243 to=&out[((31-iy)<<5)];
244 for(cy=0; cy<=iy; cy++) {
245 for(cx=0; cx<=(31-ix); cx++)
246 *(from++)=*(to++);
247 to+=ix;
248 from+=ix;
249 }
250 }
251 }
252
253 #ifdef GETBOX
254 /*--------------------------------------------------------------------------*/
255 /* Get a 32*32 linear box from an unlinear 65536 block address space */
256 /*--------------------------------------------------------------------------*/
257 void getbox2(int x, int y, uchar *dp) {
258
259 static long adr;
260 static short xx,yy;
261 static uchar len,mask;
262
263 adr=(y<<9)+(y<<7)+x;
264 mask=adr >> 16;
265 adr=adr & 65535;
266
267 vga_setpage(mask);
268
269 if (adr < 45024) {
270
271 /* NORMAL */
272 for (yy=0; yy<=31; yy++) {
273 for (xx=0; xx<=31; xx++) {
274 *(dp++)=*(vga_ptr+adr++);
275 }
276 adr+=608;
277 }
278
279 }
280 else {
281
282 /* BORDER */
283 for (yy=0; yy<=31; yy++) {
284
285
286 if (adr>65504) { /* Approaching */
287 if (adr<=65535) { /* SplitLine */
288
289 len=(65536-adr);
290
291 for(xx=len; xx>=1; xx--) {
292 *(dp++)=*(vga_ptr+adr++);
293 }
294
295 mask++;
296 vga_setpage(mask);
297 adr=0;
298
299 for(xx=(32-len); xx>=1; xx--) {
300 *(dp++)=*(vga_ptr+adr++);
301 }
302 }
303 else {
304 mask++;
305 vga_setpage(mask);
306 adr=adr & 65535;
307 for (xx=0; xx<=31; xx++) {
308 *(dp++)=*(vga_ptr+adr++);
309 }
310 }
311 }
312 else {
313 for (xx=0; xx<=31; xx++) {
314 *(dp++)=*(vga_ptr+adr++);
315 }
316 }
317 adr+=608;
318 }
319 }
320 vga_setpage(0);
321 }
322 #endif
323
324 /* Put a combination of 3 blocks to x,y coordinates (a stamp) */
325 void putstamp(short x, short y, short a, short b, short c) {
326
327 static uchar box[1024];
328 static short n;
329 static char *adr;
330
331 adr=block[a];
332 getbox(x,y,box);
333 for(n=0; n<=1023; n++)
334 box[n]=adr[n] ? adr[n] : box[n];
335 putbox(x,y,box);
336
337 x+=32;
338 adr=block[b];
339 getbox(x,y,box);
340 for(n=0; n<=1023; n++)
341 box[n]=adr[n] ? adr[n] : box[n];
342 putbox(x,y,box);
343
344 x+=32;
345 adr=block[c];
346 getbox(x,y,box);
347 for(n=0; n<=1023; n++)
348 box[n]=adr[n] ? adr[n] : box[n];
349 putbox(x,y,box);
350 }
351
352
353 void killstamp(short x, short y) {
354
355 static uchar box[1024];
356
357 getbox(x,y,box);
358 putbox(x,y,box);
359
360 x+=32;
361 getbox(x,y,box);
362 putbox(x,y,box);
363
364 x+=32;
365 getbox(x,y,box);
366 putbox(x,y,box);
367 }
368
369
370 /* Write a Digit into one of the stamps w/ the digit info */
371 void stampnum(short num) {
372
373 static short bcd,a,b;
374 static short xx,yy;
375 static char *to;
376 static char *from;
377
378
379 bcd=Dec2BCD[num];
380 a=bcd>>4;
381 b=bcd&15;
382
383
384 to=&block[69][24];
385 from=&numbers[a<<3];
386 for(yy=0; yy<=10; yy++) {
387 for(xx=0; xx<=7; xx++) {
388 *(to++)=*(from++);
389 }
390 to+=24;
391 from+=72;
392 }
393
394 to=&block[70][1];
395 from=&numbers[b<<3];
396 for(yy=0; yy<=10; yy++) {
397 for(xx=0; xx<=7; xx++) {
398 *(to++)=*(from++);
399 }
400 to+=24;
401 from+=72;
402 }
403
404
405 }
406
407
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*-----------------------------------------------------------------setbullet */
5 void setbullet(int x, int y,int num) {
6
7 static long adr;
8 static short page,xx,yy,n;
9 static char *adr2;
10 static char *bullet;
11
12 bullet=bulletback[num];
13
14 adr=(y<<9)+(y<<7)+x;
15 page=adr >> 16;
16 vga_setpage(page);
17
18
19 n=0;
20 for(yy=0; yy<=2; yy++) {
21 for(xx=0; xx<=2; xx++) {
22
23 if ( (adr >> 16) != page) {
24 page++;
25 vga_setpage(page);
26 }
27 adr2=vga_ptr+(adr&65535);
28 bullet[n]=*(adr2);
29 *(adr2)=bulletgfx[n];
30 n++;
31 adr++;
32 }
33 adr+=637;
34 }
35 }
36
37 /*----------------------------------------------------------------killbullet */
38 void killbullet(int x, int y,int num) {
39
40 static long adr;
41 static short page,xx,yy,n;
42 static uchar *adr2;
43
44 static char *bullet;
45
46 bullet=bulletback[num];
47
48 adr=(y<<9)+(y<<7)+x;
49 page=adr >> 16;
50 vga_setpage(page);
51
52
53 n=0;
54 for(yy=0; yy<=2; yy++) {
55 for(xx=0; xx<=2; xx++) {
56
57 if ( (adr >> 16) != page) {
58 page++;
59 vga_setpage(page);
60 }
61 *(vga_ptr+(adr&65535))=bullet[n];
62 n++;
63 adr++;
64 }
65 adr+=637;
66 }
67 }
68
69
70
0 /*
1
2 These are generated with random numbers.
3 I wanted to have a list to ease the debugging.
4
5 */
6
7 char codes[100][6]={
8 "jkfobt",
9 "evfyvb",
10 "tirtxq",
11 "cqaryo",
12 "vhhhcv",
13 "alficj",
14 "dgeigb",
15 "lzjcvh",
16 "uxxuqy",
17 "knhsvl",
18 "nxxvfb",
19 "gijkrq",
20 "merxjm",
21 "gdlgae",
22 "gkrnem",
23 "zumypr",
24 "zxaiht",
25 "yvzqvi",
26 "ebmsjo",
27 "wpandf",
28 "cezocq",
29 "fdnhlu",
30 "cmscen",
31 "kkqyca",
32 "oyppms",
33 "uqytec",
34 "jlfyvt",
35 "sxfmbl",
36 "zmvqmy",
37 "qbwhqk",
38 "ckaafg",
39 "dquiop",
40 "bioivq",
41 "twepoq",
42 "pgrloj",
43 "yqvasa",
44 "hvqbgg",
45 "sjpgsm",
46 "ynicez",
47 "vtfohv",
48 "yfnvfg",
49 "wodorj",
50 "xjtmsn",
51 "asakxh",
52 "jsargj",
53 "mgoccw",
54 "iakloe",
55 "xnpszh",
56 "fzchmz",
57 "ovrrmz",
58 "abgrdk",
59 "nnkzya",
60 "dxotpp",
61 "cwreed",
62 "duywln",
63 "wmqcdt",
64 "osgyrg",
65 "yxgosv",
66 "eusvby",
67 "aesybg",
68 "nzsdbx",
69 "yppgpi",
70 "ppfvex",
71 "skumhv",
72 "khbfhc",
73 "lvbfae",
74 "czvtfm",
75 "buchpi",
76 "gisawb",
77 "xhizop",
78 "dbmhgn",
79 "lkmjdt",
80 "xeoznf",
81 "jupdwm",
82 "euvmvj",
83 "eykqfs",
84 "dtcref",
85 "lblbdz",
86 "gmvyqt",
87 "kupfhk",
88 "qnjadq",
89 "ujjwcn",
90 "dnpoqu",
91 "pxgmxw",
92 "ghtxoa",
93 "ieprgs",
94 "hadtwg",
95 "ibvzpm",
96 "thlavi",
97 "ydrrbf",
98 "tjjicp",
99 "blpgen",
100 "mnoimf",
101 "wgohik",
102 "rgniyo",
103 "nrzyab",
104 "pdpgjt",
105 "twijgx",
106 "qcfhln",
107 "tevimt"
108 };
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 /*------------------ TESTING OPTIONS ------------------------*/
3 #define SCORE
4 #define ANIM
5 #define NOSOUND
6 /*#define TRAINER*/
7 /*-----------------------------------------------------------*/
8
9 #define STEP 10 /* Bullet step */
10 #define ACCEL 64 /* Bullet Accel */
11 #define N_BULLETS 11 /* (Number of bullets)-1 */
12 #define TIME_TO_LOAD 100 /* Bullets Loading Time */
13
14 #define N_CEXCEPT 10 /* n of Exceptions */
15 #define N_ANIM 30 /* n of Animations */
16
17 #define N_ACTION 11 /* n of action frames +1 (?) */
18 #define N_DESTROYEABLE 38 /* n of red walls (?) */
19
20 /* Object Map Definitions */
21
22 #define E_NULL '.'
23 #define E_START 's'
24 #define E_FUEL 'f'
25 #define E_STOP 'x'
26 #define E_WATER 'w'
27 #define E_TOP_WATER 'v'
28 #define E_AIR 'a'
29 #define E_BONUS '£'
30 #define E_BONUS1 '1'
31 #define E_BONUS2 '2'
32 #define E_BONUS3 '3'
33 #define E_BONUS4 '4'
34 #define E_BONUS5 '5'
35 #define E_BONUS6 '6'
36 #define E_BONUS7 '7'
37 #define E_BONUS8 '8'
38
39 #define E_WBONUS 'q'
40 #define E_WBONUS1 ']'
41 #define E_WBONUS2 '('
42 #define E_WBONUS3 ')'
43 #define E_WBONUS4 '['
44
45 #define E_XTIME 'T'
46 #define E_XLIFE 'L'
47 #define E_XFUEL 'F'
48 #define E_WFUEL '%'
49 #define E_KEY '&'
50 #define E_WKEY '?'
51 #define E_WIND_Q 'Q'
52 #define E_WIND_W 'W'
53 #define E_WIND_E 'E'
54 #define E_WIND_A 'A'
55 #define E_WIND_D 'D'
56 #define E_WIND_Z 'Z'
57 #define E_WIND_X 'X'
58 #define E_WIND_C 'C'
59
60 #define L_RED_DOOR '@'
61
62 /* Door Colors */
63
64 #define DOOR1COLOR 192
65 #define DOOR2COLOR 193
66 #define DOOR3COLOR 194
67 #define WATERCOLOR 195
68 #define GREENCOLOR 196
69
70 /* Define Actions */
71 #define EXPL_START 23
72 #define EXPL_STOP 24
73 #define SPLASH_START 25
74 #define SPLASH_STOP 27
75
76 #define SMALLDELAY 30000 /* Beam Adjustment (?) */
77
78 /* 1 is fastest (?) */
79 #define ANIMSPEED 1 /* 1,3,7,15,.. */
80 #define ANIMSTEP (ANIMSPEED+1)
81
82 #define TRUE 1
83 #define FALSE 0
84 #define uchar unsigned char
85
86
87
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include <vgakeyboard.h>
3 #include "memory.h"
4
5
6 /*------------------------------------------------------------------ control */
7 /* The control & moveship routines contain really bad code because
8 /* they have been changed too many times since the start of the project...
9 /* I wish I had written them from scratch after the n:th change...
10 /* As you see some of the routines take the ship # as an argument =>
11 /* the game was going to be a multiuser game, but lazy as i am.. */
12
13 void control(short nr) {
14
15 static int ch;
16 static short n,m,bulletmax,angle;
17 static long x,y,tmp;
18 static uchar *bul_adr;
19 static uchar bul_col;
20 static int objadr;
21
22 keyboard_update();
23
24 ending=FALSE;
25
26 while ((*(scans+SCANCODE_ESCAPE)==0) && (!ending) && (!escape)) {
27
28 mouse_update();
29 if (mouse_getbutton()!=0) doPanic();
30
31 keyboard_update();
32
33 if ( /* Ctrl */
34 (
35 *(scans+SCANCODE_LEFTCONTROL) ||
36 *(scans+SCANCODE_RIGHTCONTROL)
37 )
38 && (loadtime[nr]==0)
39 && (sf[nr]==0) /*!!!!!!!!!! SHOULD BE HANDELED AS FLAGS!!*/
40 && ( (ship_flag & 2)!=2)
41 ) {
42
43 for(n=0; n<=N_BULLETS; n++) { /* Shoots if there are free bullets */
44
45 if (!bullet[n].active) {
46 bullet[n].active=TRUE;
47 bullet[n].ang=angle=sa[nr] >> 5;
48 bullet[n].dis=16;
49 bullet[n].xs=((angX[angle] << 6)+(angX[angle]<<5)+sVx[nr]);
50 bullet[n].ys=((angY[angle] << 6)+(angY[angle]<<5)+sVy[nr]+sVg[nr]);
51 bullet[n].x=sx[nr]+16384+(angX[angle] << 8)+(angX[angle] << 7);
52 bullet[n].y=sy[nr]+16384+(angY[angle] << 8)+(angY[angle] << 7);
53
54
55 setbullet(bullet[n].x >> STEP,bullet[n].y >> STEP,n);
56
57
58
59 loadtime[nr]=16;
60 break;
61
62 }
63 }
64 }
65
66 if ((ship_flag & 1)==0) {
67 if (*(scans+SCANCODE_CURSORBLOCKLEFT)) { /* Left */
68 sa[nr]+=12; /*22222222222*/
69 if (sa[nr]>1023) sa[nr]=0;
70 }
71
72 if (*(scans+SCANCODE_CURSORBLOCKRIGHT)) { /* Right */
73 sa[nr]-=12;
74 if (sa[nr]<0) sa[nr]=1023;
75 }
76 }
77
78 if ( (*(scans+SCANCODE_CURSORBLOCKUP)) && (ShipFuel>0) ) { /* Up */
79
80 ShipFuel--;
81 if ((ShipFuel&15)==0)
82 updatescore();
83
84 if (ShipFuel==0) {
85 putstamp(272,win_y+184,67,105,154);
86 sleep(2);
87 killstamp(272,win_y+184);
88 }
89
90 if (ShipFuel<0)
91 ShipFuel=0;
92
93
94 sVx[nr]+=((angX[sa[nr] >> 5]*friction)>>10);
95 tmp=(angY[sa[nr] >> 5]*friction)>>10;
96 sVy[nr]+=tmp;
97 sVg[nr]+=tmp;
98 if (sVg[nr]<0) sVg[nr]=0;
99
100
101 g_flag=g_flag | 1;
102
103 thrust_len++;
104 }
105 else {
106 thrust_len=0;
107 g_flag=g_flag & 254;
108 }
109
110 sVx[nr]=(sVx[nr]*medium) >> 10; /* Tröghetsmoment */
111 sVy[nr]=(sVy[nr]*medium) >> 10;
112
113
114 if ((ship_flag & 1)==0)
115 sVg[nr]+=gravity; /* Gravity */
116
117
118 if (sVx[nr]>MaxNorm) sVx[nr]=MaxNorm;
119 if (sVy[nr]>MaxNorm) sVy[nr]=MaxNorm;
120 if (sVx[nr]<-MaxNorm) sVx[nr]=-MaxNorm;
121 /*
122 if (sVy[nr]<-MaxFall) sVy[nr]=-MaxFall;
123 */
124 if (sVg[nr]>MaxNorm) sVg[nr]=MaxNorm;
125 if ( (sVy[nr]+sVg[nr])<-MaxFall) sVy[nr]=-MaxFall+sVg[nr];
126
127
128 if ((loadtime[0]--) < 0) loadtime[0]=0;
129 if ((loadtime[1]--) < 0) loadtime[1]=0;
130
131 ShipTime--;
132 if ((ShipTime&127)==0)
133 updatescore();
134 if (ShipTime==0)
135 explode();
136
137
138 old_x=sx[nr] >> STEP;
139 old_y=sy[nr] >> STEP;
140
141 if ((ship_flag & 1)==0) {
142 sx[nr]+=sVx[nr];
143 sy[nr]+=sVy[nr]+sVg[nr];
144 }
145
146 moveShip(0,g_flag);
147
148 centerShip(0);
149
150
151
152 for(n=0; n<=N_BULLETS; n++) {
153
154
155 if (bullet[n].active) {
156
157 x=bullet[n].x>>STEP;
158 y=bullet[n].y>>STEP;
159
160 tmp=y>>5;
161 objadr=(x>>5)+(tmp<<4)+(tmp<<2);
162
163 /* remove bullet */
164 killbullet(x,y,n);
165
166 if (bullet[n].dis>43)
167 bullet[n].active=FALSE;
168
169 bul_adr=bulletback[n];
170 for(tmp=0; tmp<=8; tmp++) {
171 bul_col=bul_adr[tmp];
172 if (
173 (bul_col==DOOR1COLOR) ||
174 (bul_col==DOOR2COLOR) ||
175 (bul_col==DOOR3COLOR) ||
176 (bul_col==WATERCOLOR)
177 ){
178
179 switch(objects[objadr]) {
180
181 case L_RED_DOOR:
182 makehole(x,y,0);
183 for(m=0; m<=N_ACTION; m++) {
184 if (!action[m].state) {
185 action[m].state=TRUE;
186 action[m].x=x;
187 action[m].y=y;
188 action[m].start=48;
189 action[m].stop=51;
190 action[m].frame=48;
191 action[m].speed=4;
192 action[m].delay=4;
193 goto nomoreloop;
194 }
195 }
196 break;
197
198 case E_TOP_WATER:
199 for(m=0; m<=N_ACTION; m++) {
200 if (!action[m].state) {
201 action[m].state=TRUE;
202 action[m].x=x;
203 action[m].y=y;
204 action[m].start=112;
205 action[m].stop=117;
206 action[m].frame=112;
207 action[m].speed=4;
208 action[m].delay=4;
209 goto nomoreloop;
210 }
211 }
212 break;
213
214
215 default:
216 for(m=0; m<=N_ACTION; m++) {
217 if (!action[m].state) {
218 action[m].state=TRUE;
219 action[m].x=x;
220 action[m].y=y;
221 action[m].start=48;
222 action[m].stop=51;
223 action[m].frame=48;
224 action[m].speed=4;
225 action[m].delay=4;
226 goto nomoreloop;
227 }
228 }
229 break;
230 };
231
232 nomoreloop:
233
234 bullet[n].active=FALSE;
235 break;
236 }
237 else
238 if (
239 (bul_col>127) &&
240 (bul_col<175)
241 ) {
242
243 for(m=0; m<=N_ACTION; m++) {
244 if (!action[m].state) {
245 action[m].state=TRUE;
246 action[m].x=x;
247 action[m].y=y;
248 action[m].start=49;
249 action[m].stop=51;
250 action[m].frame=49;
251 action[m].speed=6;
252 action[m].delay=6;
253 goto nomoreloop2;
254 }
255 }
256 nomoreloop2:
257
258 bullet[n].active=FALSE;
259 break;
260 }
261 }
262
263 if (bullet[n].active) {
264 bullet[n].x+=bullet[n].xs;
265 bullet[n].y+=bullet[n].ys;
266 bullet[n].dis++;
267
268 setbullet(bullet[n].x>>STEP,bullet[n].y>>STEP,n);
269 }
270 }
271 }
272 }
273 }
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 # This script installs the game into the ~games directory
1
2 echo Installing GravityWars...
3
4 if test -e ~games/GravityWars; then
5 rm ~games/GravityWars
6 fi
7
8 if test -e ~games/GravityWars101; then
9 rm -r ~games/GravityWars101
10 fi
11
12
13 mkdir ~games/GravityWars101
14 cp -r data ~games/GravityWars101
15 cp -r levels ~games/GravityWars101
16 cp GravityWars101 ~games/GravityWars101
17 cp GravityWars.script ~games/GravityWars101/GravityWars
18 chmod a-rwxs,+rwx,a+rx ~games/GravityWars101/GravityWars
19 chmod a-rwx,u+rwxs,a+x ~games/GravityWars101/GravityWars101
20 chgrp users ~games/GravityWars101/GravityWars
21 chgrp bin ~games/GravityWars101/GravityWars101
22 ln -s ~games/GravityWars101/GravityWars ~games/GravityWars
23
0 emacs animate.c blocks.c bullet.c config.h control.c hole.c includes.h init.c introutro.c macros.c makepic.c memory.c memory.h misc.c moveship.c pixel.c score.c scroll.c water.c GravityWars101.c
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*-----------------------------------------------------------------setbullet */
5 /* I think this one made holes just in the screen. Not in the virtual
6 /* BlockMap.. I.e. They dissappear when flown over.. */
7
8 void OLDmakehole(int x, int y, int type) {
9
10 static long adr;
11 static short page,xx,yy,n;
12 static uchar *adr2;
13 static uchar *holemask;
14 static uchar *gfx;
15 static uchar col;
16
17 x-=7;
18 y-=7;
19
20 xx=x&31;
21 yy=y&31;
22 gfx=&block[0][(yy<<5)+xx];
23
24
25 holemask=hole[type];
26
27 adr=(y<<9)+(y<<7)+x;
28 page=adr >> 16;
29 vga_setpage(page);
30
31 for(yy=0; yy<=15; yy++) {
32 for(xx=0; xx<=15; xx++) {
33
34 if ( (adr >> 16) != page) {
35 page++;
36 vga_setpage(page);
37 }
38
39 if (*(holemask)) {
40 col=*(gfx);
41 *(vga_ptr+(adr&65535))=col;
42 }
43
44 gfx++;
45 adr++;
46 holemask++;
47 }
48 adr+=624;
49 gfx+=16;
50 }
51 }
52
53 /*-----------------------------------------------------------------setbullet */
54 void makehole(int x, int y, int type) {
55
56 static short xx,yy,s,d;
57 static uchar *holemask;
58 static uchar *gfx;
59
60 x-=15;
61 y-=15;
62
63 gfx=&backgnd[((y&31)<<6)+(x&31)];
64
65 holemask=hole[type];
66
67 getbox(x,y,tmpmix);
68
69 s=d=0;
70 for(yy=0; yy<=31; yy++) {
71 for(xx=0; xx<=31; xx++) {
72 tmpmix[d]=holemask[d] ? gfx[s] : tmpmix[d];
73 s++;
74 d++;
75 }
76 s+=32;
77 }
78
79 changeblocks(x,y,tmpmix);
80
81 }
82
83
84
0 #include <stdio.h>
1 #include <vgakeyboard.h>
2 #include <vgamouse.h>
3 #include <vgagl.h>
4 #include <vga.h>
5 #include <math.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8
9 #include <sys/kd.h> /* FOR BEEP() */
10
11 #include "config.h"
12
13
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include <vga.h>
3 #include <vgagl.h>
4 #include <math.h>
5 #include <asm/io.h>
6 #include "memory.h"
7
8 /*--------------------------------------------------------------- initScreen */
9 int initScreen() {
10 vga_modeinfo *minfo;
11 short n,ptr;
12 uchar reg;
13
14 vga_init();
15 vga_setmode(G640x480x256);
16 gl_setcontextvga(G640x480x256);
17 gl_setcontextvirtual(640,1440,BYTESPERPIXEL,BITSPERPIXEL,VBUF);
18 vga_claimvideomemory(640*480*3);
19
20 vga_ptr=vga_getgraphmem();
21 gl_setpalette(p0);
22
23 /* Split Screen (sl=SplitScreenLine) */
24 outb(0x18,0x3d4); /* LineCompare */
25 outb(208,0x3d5); /* sl&255 */
26 outb(7,0x3d4); /* Overflow */
27 reg=inb(0x3d5);
28 outb(reg|0x10,0x3d5); /* outb(reg|((sl&256)>>4),0x3d5) */
29 outb(9,0x3d4); /* Maximum Scanline */
30 reg=inb(0x3d5);
31 outb(reg&191,0x3d5); /* outb(reg|((sl&512)>>3),0x3d5) */
32
33 }
34
35 /*--------------------------------------------------------------- initParams */
36 void initParams() {
37
38 short a,b,c,d,e;
39 long n;
40
41 for(n=0; n<=N_BULLETS; n++) {
42 bullet[n].active=FALSE;
43 }
44
45 /* Count a "DECIMAL to BCD" table
46
47 Hmmm.. I think I've got some explaining to do over here.. :)
48 The game was just too slow on my machine, so I had to
49 optimize the things as much as I could.. I had plenty of memory
50 so I thought that I'd be OK to waste some of it...
51 */
52
53 n=0;
54 for(a=0; a<=9; a++)
55 for(b=0; b<=9; b++)
56 for(c=0; c<=9; c++)
57 for(d=0; d<=9; d++)
58 for(e=0; e<=9; e++, n++)
59 Dec2BCD[n]=(a<<16)|(b<<12)|(c<<8)|(d<<4)|e;
60
61
62 /* Should really be set from #defines in an include file.. */
63
64 ship_flag=0;
65 g_flag=0;
66 ScoreChange=0;
67 thrust_len=0;
68 watercount=0;
69 num_of_collisions=0;
70 ShipScore=0;
71 ShipLife=3;
72 delay_len=0;
73 escape=FALSE;
74 loadtime[0]=0;
75 loadtime[1]=0;
76 }
77
78
79 /*---------------------------------------------------------------------------*/
80 /* Just a routine to read some *.dat info */
81
82 void readquotes(char *dest) {
83
84 static int ch,pos;
85
86 pos=0;
87 while( (ch=fgetc(fileptr))!='"');
88 while( (ch=fgetc(fileptr))!='"')
89 dest[pos++]=ch;
90 }
91
92
93 /*---------------------------------------------------------------------------*/
94 /* Load & Parse the level */
95 void loaddata() {
96
97 char command[256];
98 char buffer[128];
99 char fname[128];
100 char tmp_nextlevel[128];
101
102 static short err;
103
104 static short x,y,adr,count,n,ptr;
105 static char ch;
106
107 strcpy(nextlevel,gamename);
108 strcpy(&nextlevel[gamenamelen],"levels/level00");
109 nextlevel[gamenamelen+12]=(levelnum/10)+'0';
110 nextlevel[gamenamelen+13]=(levelnum%10)+'0';
111
112 /* printf("(Loading: %s)\n",nextlevel); */
113
114 strcpy(tmp_nextlevel,nextlevel);
115 strcpy(fname,tmp_nextlevel);
116 strcpy(&fname[strlen(fname)],".dat");
117
118 err=0;
119 n_anim=0;
120
121 if ( ( fileptr=fopen(fname,"r") )!=NULL) {
122
123 do {
124 err=fscanf(fileptr,"%s",command);
125
126 if (err!=EOF) {
127 if (!strcmp(command,"anim")) {
128 if (n_anim>N_ANIM) {
129 printf("\nOoops... The level designer has screwed up..\n"
130 "You're not allowed to have more than %d animations..\n"
131 ,N_ANIM);
132 doPanic();
133 }
134 fscanf(fileptr,"%s",buffer);
135 anim[n_anim].x=atoi(buffer);
136 fscanf(fileptr,"%s",buffer);
137 anim[n_anim].y=atoi(buffer);
138 fscanf(fileptr,"%s",buffer);
139 anim[n_anim].start=atoi(buffer);
140 fscanf(fileptr,"%s",buffer);
141 anim[n_anim].stop=atoi(buffer);
142 fscanf(fileptr,"%s",buffer);
143 anim[n_anim].frame=atoi(buffer);
144 fscanf(fileptr,"%s",buffer);
145 anim[n_anim].speed=atoi(buffer);
146 n_anim++;
147 }
148 else
149
150 /*
151 if (!strcmp(command,"level"))
152 readquotes(LEVEL);
153 else
154 if (!strcmp(command,"author"))
155 readquotes(AUTHOR);
156 else
157 if (!strcmp(command,"comment"))
158 readquotes(COMMENT);
159 else
160 if (!strcmp(command,"next"))
161 fscanf(fileptr,"%s\n",nextlevel);
162 else
163 */
164 if (!strcmp(command,"time")) {
165 fscanf(fileptr,"%s",buffer);
166 BaseTime=atoi(buffer)<<7;
167 ShipTime=BaseTime;
168 }
169 else
170 if (!strcmp(command,"fuel")) {
171 fscanf(fileptr,"%s\n",buffer);
172 BaseFuel=atoi(buffer)<<4;
173 ShipFuel=BaseFuel;
174 }
175 }
176 } while(err!=EOF);
177
178 /*
179 printf("---------------------------------------"
180 "--------------------------------------\n"
181 "Level...... %s\n"
182 "Author..... %s\n"
183 "Comments... %s\n"
184 "---------------------------------------"
185 "--------------------------------------\n"
186 ,LEVEL,AUTHOR,COMMENT);
187 */
188
189 fclose(fileptr);
190 }
191 else {
192 /*
193 printf("Error: Can't open %s!\n",fname);
194 doPanic();
195 */
196 outro();
197 }
198
199
200 /* Load Level Data */
201
202 strcpy(fname,tmp_nextlevel);
203 strcpy(&fname[strlen(fname)],".gfx");
204
205 if ( ( fileptr=fopen(fname,"r") )!=NULL) {
206
207 for(y=ptr=0; y<=44; y++,ptr+=20) {
208 fread(&level[ptr],20,1,fileptr);
209 }
210 fclose(fileptr);
211 }
212 else {
213 printf("Error: Can't open %s!\n",fname);
214 doPanic();
215 }
216
217 strcpy(fname,tmp_nextlevel);
218 strcpy(&fname[strlen(fname)],".obj");
219
220 if ( ( fileptr=fopen(fname,"r") )!=NULL) {
221
222 for(y=ptr=0; y<=44; y++,ptr+=20) {
223 fscanf(fileptr,"%s",&objects[ptr]);
224 }
225
226 fclose(fileptr);
227 }
228 else {
229 printf("Error: Can't open %s!\n",fname);
230 doPanic();
231 }
232
233 /* Go through the level and copy the L_RED_DOOR blocks to indipendent blocks */
234
235 count=0;
236 for(y=0; y<=44; y++) {
237 for(x=0; x<=19; x++) {
238 adr=x+(y<<4)+(y<<2);
239 ch=objects[adr];
240
241 if (ch==L_RED_DOOR) {
242 if (count>(N_DESTROYEABLE+1)) {
243 printf(
244 "Sorry to interrupt you, but it looks like the level \n"
245 "designer screwed up... There can only be %d so called \n"
246 "Red Doors (+surrounding blocks) in a level.\n\n",
247 N_DESTROYEABLE);
248 doPanic();
249 }
250 memcpy(block[216+count],block[level[adr]],1024);
251 level[adr]=216+count;
252 count++;
253 }
254 }
255 }
256
257
258 /* Go through the level and make c_except[] structures */
259 count=0;
260 n_cexcept=0;
261 for(y=0; y<=44; y++) {
262 for(x=0; x<=19; x++) {
263
264 if ((ch=objects[x+(y<<4)+(y<<2)])=='f') {
265 if (n_cexcept>N_CEXCEPT) {
266 printf("\nOoops... The level designer has screwed up..\n"
267 "You're not allowed to have more than %d fuelstations..\n"
268 ,N_CEXCEPT-1);
269 doPanic();
270 }
271 c_except[n_cexcept].x=x;
272 c_except[n_cexcept].y=y-1;
273 c_except[n_cexcept].type=E_FUEL;
274 n_cexcept++;
275 }
276 else
277 if (ch=='s') {
278 if (count>0) {
279 printf("\nOoops... The level designer has screwed up..\n"
280 "You can't have more than one startfield..\n"
281 ,N_CEXCEPT-1);
282 doPanic();
283 }
284 c_except[n_cexcept].x=x;
285 c_except[n_cexcept].y=y-1;
286 c_except[n_cexcept].type=E_START;
287 n_cexcept++;
288 Lsx[0]=(x<<5) << STEP;
289 Lsy[0]=((y<<5)-28) << STEP;
290 }
291 else
292 if (ch=='x') {
293 stop_x=x;
294 stop_y=y;
295 level[x+(y<<4)+(y<<2)]=38;
296 objects[x+(y<<4)+(y<<2)]=E_NULL;
297 }
298 }
299 }
300
301 n_cexcept--;
302
303 sx[0]=Lsx[0];
304 sy[0]=Lsy[0];
305 sa[0]=0;
306 sVx[0]=sVy[0]=sVg[0]=1; /* Shouldn't ever be Zero */
307 sA[0]=0;
308 sf[0]=0;
309
310 /* Count the nymber of keys */
311 NumKeys=0;
312 for(n=0; n<=899; n++) {
313 if ((objects[n]==E_KEY) || (objects[n]==E_WKEY)) NumKeys++;
314 }
315
316 for(n=0; n<=N_ACTION; n++) {
317 action[n].state=FALSE;
318 }
319
320 /* Default Air Values */
321 gravity=10; /*15*/
322 lift_thrust=10;
323 medium=1010;
324 friction=1000; /*24;*/
325 MaxNorm=3072;
326 MaxFall=4096;
327
328 }
329
330 /*---------------------------------------------------------------------------*/
331 /* Load the graphics */
332 /* Format:
333
334 char Palette1[768];
335 char Palette2[768];
336 char blocks[]; // Consists of 32*32 blocks starting at (1,1)
337 // 9 by 24, I think.. (A single pixel between
338 // The blocks.
339 */
340
341
342 int loadGfx() {
343
344
345 short obj,err,n,x,y,yy,ptr,row;
346
347 char hs[10];
348
349 char filename[128];
350
351 /* Load Gfx */
352 strcpy(filename,gamename);
353 strcpy(&filename[gamenamelen],"data/blocks.gw");
354 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
355
356 fread(pal,768,1,fileptr); /* Palette */
357
358 /* Copy and invert the palette for FADE routine */
359
360
361 for(n=0; n<=767; n++) {
362 realpal[n]=pal[n];
363 p2B[n]=63-pal[n];
364 p0[n]=0;
365 p3[n]=63;
366 }
367
368
369 fread(palB,768,1,fileptr); /* Palette II */
370 for(n=0; n<=767; n++) {
371 realpal2[n]=palB[n];
372 p2[n]=63-palB[n];
373 }
374
375 fread(buffer,321,1,fileptr); /* get rid of the grid */
376
377 obj=0;
378 for(row=0; row<=23; row++) {
379 err=fread(buffer,10560,1,fileptr); /* Gfx (320*33)*/
380 /* printf("Err: %d\n",err);*/
381
382 /*if (err==1) {*/
383 ptr=0;
384 for(n=0; n<=8; n++) {
385 for(x=0; x<=31; x++)
386 for(y=0,yy=0; y<=31; y++,yy+=320)
387 block[obj][x+(y << 5)]=buffer[ptr+x+yy];
388 obj++;
389 ptr+=33;
390 /* printf("Object #%d\n",obj);*/
391 }
392 /*}*/
393 }
394
395
396 fclose(fileptr);
397 }
398 else {
399 printf("ERROR!!!!!!!!! CAN'T LOAD THE GFX!\n");
400 exit(1);
401 }
402
403 /* Get Ship (also for the unused one)*/
404
405 memcpy(ship[0][0],block[208],1024);
406 memcpy(ship[1][0],block[208],1024);
407
408 memcpy(ship[2][0],block[207],1024);
409 memcpy(ship[3][0],block[207],1024);
410
411
412 /* Copy The Background block to a 3*3 area (Slow code) */
413 n=0;
414 for(y=0; y<=63; y++) {
415 for(x=0; x<=63; x++) {
416 backgnd[n]=block[38][(x&31)+((y&31)<<5)];
417 n++;
418 }
419 }
420
421
422 /* Load Score */
423
424 strcpy(filename,gamename);
425 strcpy(&filename[gamenamelen],"data/score.gw");
426 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
427 fread(score,4096,1,fileptr); /* Picture */
428 fclose(fileptr);
429 }
430 else {
431 printf("ERROR!!!!!!!!! CAN'T LOAD THE SCORE GFX!\n");
432 exit(1);
433 }
434
435 strcpy(filename,gamename);
436 strcpy(&filename[gamenamelen],"data/digits.gw");
437 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
438 fread(digits,528,1,fileptr); /* Picture */
439 fclose(fileptr);
440 }
441 else {
442 printf("ERROR!!!!!!!!! CAN'T LOAD THE DIGITS GFX!\n");
443 exit(1);
444 }
445
446 strcpy(filename,gamename);
447 strcpy(&filename[gamenamelen],"data/numbers.gw");
448 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
449 fread(numbers,880,1,fileptr);
450 fclose(fileptr);
451 }
452 else {
453 printf("ERROR!!!!!!!!! CAN'T LOAD THE NUMBERS GFX!\n");
454 exit(1);
455 }
456
457 strcpy(filename,gamename);
458 strcpy(&filename[gamenamelen],"data/high.gw");
459 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
460 fread(highscore,4096,1,fileptr); /* Picture */
461 fclose(fileptr);
462 }
463 else {
464 printf("ERROR!!!!!!!!! CAN'T LOAD THE HIGHSCORE GFX!\n");
465 exit(1);
466 }
467
468 strcpy(filename,gamename);
469 strcpy(&filename[gamenamelen],"data/level.gw");
470 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
471 fread(levelcode,4096,1,fileptr); /* Picture */
472 fclose(fileptr);
473 }
474 else {
475 printf("ERROR!!!!!!!!! CAN'T LOAD THE LEVELCODE GFX!\n");
476 exit(1);
477 }
478
479 strcpy(filename,gamename);
480 strcpy(&filename[gamenamelen],"data/fonts.gw");
481 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
482 fread(fonts,1820,1,fileptr); /* Picture */
483 fclose(fileptr);
484 }
485 else {
486 printf("ERROR!!!!!!!!! CAN'T LOAD THE FONTS GFX!\n");
487 exit(1);
488 }
489
490 strcpy(filename,gamename);
491 strcpy(&filename[gamenamelen],"data/hscore.gw");
492 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
493 fscanf(fileptr,"%s",hs);
494 fclose(fileptr);
495 }
496 else {
497 printf("ERROR!!!!!!!!! CAN'T LOAD THE HIGHSCORE!\n");
498 exit(1);
499 }
500
501 HighScore=atoi(hs);
502
503 }
504
505 /*------------------------------------------------------------------- rotGfx */
506 /* Rotates the ship and saves the frames */
507 /*---------------------------------------------------------------------------*/
508
509 int rotGfx() {
510
511 short n,x,y;
512 long sx,sy,dx,dy,rx,ry,ptr,adr;
513 float ang;
514
515 angX[0]=0;
516 angY[0]=-ACCEL;
517
518
519 for(n=1; n<=31; n++) {
520 ptr=0;
521 ang=.196349540*n;
522 dx=1024*cos(ang);
523 dy=1024*sin(ang);
524
525 angX[n]=ACCEL*cos(ang+1.57079);
526 angY[n]=-ACCEL*sin(ang+1.57079);
527
528 rx=16*1024+16*(dy-dx);
529 ry=16*1024+16*(-dx-dy);
530
531 for(y=0; y<=31; y++) {
532 rx-=dy;
533 ry+=dx;
534 for(x=0; x<=31; x++) {
535 rx+=dx;
536 ry+=dy;
537
538 if ( (rx<0) || (rx>32768) || (ry<0) || (ry>32768) ) {
539 ship[0][n][ptr]=0;
540 ship[1][n][ptr]=0;
541 ship[2][n][ptr]=0;
542 ship[3][n][ptr]=0;
543 ptr++;
544 }
545 else {
546 adr=(rx>>10) + ((ry>>10) << 5);
547 ship[0][n][ptr]=ship[0][0][adr];
548 ship[1][n][ptr]=ship[1][0][adr];
549
550 ship[2][n][ptr]=ship[2][0][adr];
551 ship[3][n][ptr]=ship[3][0][adr];
552 ptr++;
553 }
554 }
555 rx-=(dx << 5);
556 ry-=(dy << 5);
557 }
558 }
559 }
560
561
562
563
564
565
566
567
568
569
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include <vgakeyboard.h>
3 #include <math.h>
4 #include <vga.h>
5 #include <asm/io.h>
6 #include "memory.h"
7
8 void intro() {
9
10 long pal_m;
11 long pal_n;
12 uchar pal[768],p1[768],p2[768];
13 uchar map[320000];
14 uchar dst[307200];
15 uchar filename[128];
16 uchar reg;
17
18 signed long n,x,y;
19 char col;
20 unsigned char num;
21 long adr;
22
23 unsigned char *s;
24 long d;
25 char wrdy[4];
26
27 float nn;
28 long nnn,sn1,sn2;
29
30
31 long m;
32
33 FILE *fileptr2;
34
35 for(nn=m=0; nn<=6.28318; nn+=0.0245,m++)
36 bigsin[m]=512+512*sin(nn);
37
38 strcpy(filename,gamename);
39 strcpy(&filename[gamenamelen],"data/gravmix.gw");
40 if ( ( fileptr2=fopen(filename,"r") )!=NULL) {
41 fread(map,320000,1,fileptr2);
42
43 fclose(fileptr2);
44 }
45 else {
46 printf("ERROR!!!!!!!!! CAN'T LOAD THE TITLE GFX!\n");
47 exit(1);
48 }
49
50 /* LBM -> RAW Convert */
51
52 s=map;
53
54 do {
55 wrdy[0]=wrdy[1];
56 wrdy[1]=wrdy[2];
57 wrdy[2]=wrdy[3];
58 wrdy[3]=*(s++);
59 } while((wrdy[0]!='C') ||
60 (wrdy[1]!='M') ||
61 (wrdy[2]!='A') ||
62 (wrdy[3]!='P'));
63 s+=4;
64 for(n=0; n<=767; n++) {
65 pal[n]=s[n]>>2;
66 }
67
68 memcpy(p1,pal,768);
69 for (n=0; n<=767; n++) {
70 p2[n]=63-pal[n];
71 }
72
73 do {
74 wrdy[0]=wrdy[1];
75 wrdy[1]=wrdy[2];
76 wrdy[2]=wrdy[3];
77 wrdy[3]=*(s++);
78 } while((wrdy[0]!='B') ||
79 (wrdy[1]!='O') ||
80 (wrdy[2]!='D') ||
81 (wrdy[3]!='Y'));
82
83 s+=4;
84
85 d=0;
86 adr=0;
87 do {
88
89 num=*(s++);
90 if (num&128) {
91 col=*(s++);
92 for(n=1; n<=(257-num); n++) {
93
94 vga_setpage(adr >> 16);
95 *(vga_ptr+(d&65535))=col;
96 d++;
97
98 adr++;
99 }
100 }
101 else {
102 num++;
103 if (num==256)
104 num=1;
105 for(n=1; n<=num; n++) {
106
107
108 vga_setpage(adr >> 16);
109 *(vga_ptr+(d&65535))=*(s++);
110 d++;
111
112 adr++;
113 }
114 }
115 } while(adr<307200);
116
117 /*-----------*/
118
119
120 gl_setdisplaystart(0,0);
121
122
123 /* Split Screen (sl=SplitScreenLine) */
124 outb(0x18,0x3d4); /* LineCompare */
125 outb(0,0x3d5); /* sl&255 */
126 outb(7,0x3d4); /* Overflow */
127 reg=inb(0x3d5);
128 outb(reg&239,0x3d5); /* outb(reg|((sl&256)>>4),0x3d5) */
129 outb(9,0x3d4); /* Maximum Scanline */
130 reg=inb(0x3d5);
131 outb(reg&191,0x3d5); /* outb(reg|((sl&512)>>3),0x3d5) */
132
133
134
135
136 while(keyboard_update());
137
138 for(pal_n=0; pal_n<=1024; pal_n+=16) {
139 for (pal_m=0; pal_m<=767; pal_m++)
140 p1[pal_m]=((((long)pal[pal_m])*pal_n)>>10);
141 vga_waitretrace();
142 gl_setpalette(p1);
143 }
144 gl_setpalette(pal);
145
146 pal[756]=34;
147 pal[757]=17;
148 pal[758]=19;
149
150 pal[759]=25;
151 pal[760]=16;
152 pal[761]=41;
153
154 pal[762]=22;
155 pal[763]=23;
156 pal[764]=22;
157
158 while(keyboard_update()==0) {
159
160
161
162 for(nnn=64; nnn<=192; nnn++) {
163 sn1=bigsin[nnn];
164 sn2=bigsin[(nnn+128) & 255];
165
166 for(m=0; m<=767; m++)
167 p1[m]=(pal[m]*sn1)>>10;
168 for(m=756; m<=765; m++)
169 p1[m]=(pal[m]*sn2)>>10;
170 if(keyboard_update()) goto exitfade;
171 vga_waitretrace();
172 gl_setpalette(p1);
173 }
174
175 for(m=0; m<=100; m++) {
176 if(keyboard_update()) goto exitfade;
177 vga_waitretrace();
178 }
179
180 for(nnn=192; nnn<=320; nnn++) {
181 sn1=bigsin[nnn&255];
182 sn2=bigsin[(nnn+128)&255];
183
184 for(m=0; m<=767; m++)
185 p1[m]=(pal[m]*sn1)>>10;
186 for(m=756; m<=765; m++)
187 p1[m]=(pal[m]*sn2)>>10;
188 if(keyboard_update()) goto exitfade;
189 vga_waitretrace();
190 gl_setpalette(p1);
191 }
192
193 for(m=0; m<=100; m++) {
194 if(keyboard_update())
195 goto exitfade;
196 vga_waitretrace();
197 }
198 }
199 exitfade:
200
201 if (*(scans+SCANCODE_ESCAPE))
202 escape=TRUE;
203
204
205 for(pal_n=1024; pal_n>=0; pal_n-=16) {
206 for (pal_m=0; pal_m<=767; pal_m++)
207 pal[pal_m]=(((long)p1[pal_m])*pal_n)>>10;
208 vga_waitretrace();
209 gl_setpalette(pal);
210 }
211 gl_setpalette(p0);
212
213 /* Split Screen (sl=SplitScreenLine) */
214 outb(0x18,0x3d4); /* LineCompare */
215 outb(208,0x3d5); /* sl&255 */
216 outb(7,0x3d4); /* Overflow */
217 reg=inb(0x3d5);
218 outb(reg|0x10,0x3d5); /* outb(reg|((sl&256)>>4),0x3d5) */
219 outb(9,0x3d4); /* Maximum Scanline */
220 reg=inb(0x3d5);
221 outb(reg&191,0x3d5); /* outb(reg|((sl&512)>>3),0x3d5) */
222
223
224
225 }
226
227
228 void outro() {
229 long pal_m;
230 long pal_n;
231
232 putstamp(240,win_y+192,139,144,146);
233 putstamp(336,win_y+192,147,153,50);
234 killstamp(400,win_y+192);
235
236 putstamp(176,win_y+256,108,109,117);
237 putstamp(272,win_y+256,119,120,122);
238 putstamp(368,win_y+256,127,130,136);
239
240 sleep(3);
241 waitanykey();
242
243 if (levelnum&1) {
244 for(pal_n=1024; pal_n>=0; pal_n-=16) {
245 for (pal_m=0; pal_m<=767; pal_m++)
246 p1[pal_m]=(((long)palB[pal_m])*pal_n)>>10;
247 vga_waitretrace();
248 gl_setpalette(p1);
249 }
250 gl_setpalette(p0);
251 }
252 else {
253 for(pal_n=1024; pal_n>=0; pal_n-=16) {
254 for (pal_m=0; pal_m<=767; pal_m++)
255 p1[pal_m]=(((long)pal[pal_m])*pal_n)>>10;
256 vga_waitretrace();
257 gl_setpalette(p1);
258 }
259 gl_setpalette(p0);
260 }
261 mouse_close();
262 keyboard_close();
263
264 vga_setmode(TEXT);
265 printf("-----------------------------------------------------------------------------\n"
266 " C o n g r a t u l a t i o n s ! ! ! \n"
267 " Thanks for playing the game, I hope you enjoyed it!\n"
268 " Now... Feel free to design some new levels with the\n"
269 " tools (or develop better ones..) that come with the\n"
270 " package, since these ones just seem to be too easy!\n"
271 " (or maybe you just cheated...)\n"
272 "-----------------------------------------------------------------------------\n");
273 exit(0);
274 }
275
276
Binary diff not shown
0 level "The Arcade Hall"
1 author "Pär Johannesson"
2 comment "No Speed limit!"
3
4 time 45
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 ********************--2
3 ***..............***--3
4 ***....&....&....***--4
5 ***..............***--5
6 ***.33.*.22.*.33.***--6
7 ***.33.*.22.*.33.***--7
8 ***.33.*.22.*.33.***--8
9 ***.33.*.22.*.33.***--9
10 ***..............***--10
11 ***....&....&....***--11
12 ***..............***--12
13 ***.33.*....*.33.***--13
14 ***.33.*....*.33.***--14
15 ***.33.*....*.33.***--15
16 ***.33.*....*.33.***--16
17 ***..............***--17
18 ***....&....&....***--18
19 ***..............***--19
20 ***.33.*....*.33.***--20
21 ***.33.*....*.33.***--21
22 ***.33.*....*.33.***--22
23 ***.33.*....*.33.***--23
24 ***.33.*....*.33.***--24
25 ***..............***--25
26 ***....&....&....***--26
27 ***..............***--27
28 ***.33.*....*.33.***--28
29 ***.33.*....*.33.***--29
30 ***.33.*....*.33.***--30
31 ***.33.*....*.33.***--31
32 ***..............***--32
33 ***....&....&....***--33
34 ***..............***--34
35 ***.33.*.22.*.33.***--35
36 ***.33.*.22.*.33.***--36
37 ***.33.*.22.*.33.***--37
38 ***.33.*.22.*.33.***--38
39 ***..............***--39
40 ***.x..&....&.*s****--40
41 ***..............***--41
42 ********************--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level ""
1 author ""
2 comment ""
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **....*...........**--2
3 **.x..*...........**--3
4 **....*...........**--4
5 **....*....*......**--5
6 **....*....*......**--6
7 **....*....*......**--7
8 **....*....*......**--8
9 **....*....*......**--9
10 **....*....*......**--10
11 **.........*......**--11
12 **.........*......**--12
13 **333333333*......**--13
14 *************.....**--14
15 *************..&..**--15
16 *************.....**--16
17 **................**--17
18 **................**--18
19 **..3*3333*3333*33**--19
20 **..****************--20
21 **..****************--21
22 **................**--22
23 **................**--23
24 **................**--24
25 *************.....**--25
26 *************..&..**--26
27 *************.....**--27
28 **................**--28
29 **................**--29
30 **..3*3333*3333*33**--30
31 **..****************--31
32 **..****************--32
33 **..**3...........**--33
34 **..**3.&.........**--34
35 **..**3...........**--35
36 **..**3...***.....**--36
37 **..**3...***.....**--37
38 **..**3...***.....**--38
39 **..**3...***.....**--39
40 **........***.....**--40
41 **........***.*s*.**--41
42 **........***.....**--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "King's World"
1 author "Pär Johannesson"
2 comment ""
3
4 time 73
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **......44...**...**--2
3 **......44...**.&.**--3
4 **......44...**...**--4
5 **......*aaaaaaaaaa*--5
6 **...*s**vvvvvvvvvv*--6
7 **...****wwwwwwwwww*--7
8 *@@@@@***w]]]]]]]]w*--8
9 **...****w]]]]]]]]w*--9
10 **......*w]]]]]]]]w*--10
11 **......*wwwwwwwwww*--11
12 **......************--12
13 **................**--13
14 **................**--14
15 ****f*....666666..**--15
16 ********44******44**--16
17 ********44******44**--17
18 **..........**....**--18
19 **........&.**.&..**--19
20 **..........**....**--20
21 **44************44**--21
22 **44************44**--22
23 **......**........**--23
24 **......**........**--24
25 **......**..666666**--25
26 **......**..********--26
27 **......44..********--27
28 **......44..**....**--28
29 **......44..**.&..**--29
30 **......**..**....**--30
31 **......**..**....**--31
32 **......**........**--32
33 **......**........**--33
34 **....*.**6666....**--34
35 **..**********....**--35
36 *@@@@*********....**--36
37 **6.**********....**--37
38 **.6.6.6.6.***....**--38
39 **6.6.6.6.6*@*....**--39
40 **.6.6x6.6.6@.....**--40
41 **6.6.6.6.6.@..&..**--41
42 **.6.6.6.6.6@.....**--42
43 ************@*******--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "The Cave of Strawberries"
1 author "Pär Johannesson"
2 comment "You gotta be fast..."
3
4 time 24
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 ****...........*****--2
3 ***....2.&.22...****--3
4 **....2......2...***--4
5 **...2...**...2...**--5
6 **...2...***...2..**--6
7 ***...2...***...2.**--7
8 ****...2...***..2.**--8
9 *****...2...**..2.**--9
10 *****...2...**..2.**--10
11 *****...2...**..2.**--11
12 *****...2...**..2.**--12
13 *****...2...**..2.**--13
14 ****....2...**..2.**--14
15 ***....2....**..2.**--15
16 **....2....***..2.**--16
17 **...2....***..2..**--17
18 **.......***..2..***--18
19 **.......***..2..***--19
20 **..*s*..***..2...**--20
21 **......***...2..***--21
22 ***....***...2..****--22
23 ****..***...2..*****--23
24 ********...2..***.**--24
25 *******...2..***..**--25
26 ****.....2..***...**--26
27 *****...2...***...**--27
28 **.***...2...***..**--28
29 **..***...2...***.**--29
30 **...***...2...*****--30
31 **....***...&...****--31
32 **.....***...2...***--32
33 **......***...2...**--33
34 **.......***...2..**--34
35 **....*...***.....**--35
36 **.&..*....***....**--36
37 **...**aaaaaaaaaaaa*--37
38 *@@@@@*vvvvvvvvvvvv*--38
39 **...**wwwwwwwwwwww*--39
40 **...**wwwwwwwwwwww*--40
41 **.x.**wwwwwwwwwwww*--41
42 **...**wwwwwwwwwwww*--42
43 ********wwwwwwwwww**--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "The Gates"
1 author "Pär Johannesson"
2 comment ""
3
4 time 49
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **23332*2332*23332**--2
3 **3...3*3TT3*3...3**--3
4 **3.x.3*3TT3*3...3**--4
5 **23332*2332*23332**--5
6 **.....*....*.....**--6
7 **................**--7
8 **................**--8
9 **................**--9
10 **&..............&**--10
11 ********....********--11
12 **&2222......2222&**--12
13 **2..............2**--13
14 **2..............2**--14
15 **&2222......2222&**--15
16 ********....********--16
17 **&.........*....&**--17
18 **..........*....T**--18
19 **..........*....T**--19
20 **...********....T**--20
21 **...55555555....T**--21
22 **...55555555....T**--22
23 **...55555555....T**--23
24 *************....T**--24
25 **...............T**--25
26 **...............T**--26
27 **&..............&**--27
28 ********....********--28
29 **&2222......2222&**--29
30 **2..............2**--30
31 **2..............2**--31
32 **&2222......2222&**--32
33 ********....********--33
34 **&..............&**--34
35 **................**--35
36 **................**--36
37 **................**--37
38 **.....*....*.....**--38
39 **23332*2332*23332**--39
40 **3...3*3..3*3...3**--40
41 **3*f*3*3..3*3*s*3**--41
42 **23332*2332*23332**--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "The Bambu Labyrinth"
1 author "Pär Johannesson"
2 comment ""
3
4 time 33
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
0
1
2
3
4
5
6
7
8
9
10 Iddddd!ddddde!dddJ
11
12 ]&%&%%(%%&%%&(%%&Z ]%%$%%(%%%%¾%(%)%Z
13
14 ]%%%%%(%%&·%(%%&Z ]%%%%(%¾%(±±±Z
15
16 ]&%%%&%&%(&·&(%&&Z ]%%$%%%%&(%¾%(&®%Z
17
18  &·%(&¬%Z ]&%&%$&%&%&¾&(&®%Z
19
20 ]%·½·½·½·½·3%(%¬&Z ]%½%%%%%%%$%%(&®%Z
21
22 ]%·& &¬%Z ]%½&(%%%%&%%%($®%Z
23
24 ]&·%(%½&&&µµ&(%¬&Z ]%½&(&¾&%&µµ%(&®&Z
25
26 ]%·%(%½%%µµ&(&¬%Z ]&½%%¾&(%µµ%(&®&Z
27
28 ]&·%%$½&(%µµ%(%¬&Z ]%3½¾½¾$(&µµ%($®&Z
29
30 ]%%%$%%&(%µµ%(&¬%Z  %µµ%(%®&Z
31
32 ]%%%&%%&(&µµ$(%¬&Z ]%«««««$(&µµ%(%®%Z
33
34 ]%«%&&«&(%µµ%(&¬%Z ]&«$$«%(&µµ&(&®&Z
35
36 ]%«%(&«&&µµ&(%¬%Z ]%«&(&«&%&µµ&(%®&Z
37
38 ]&«%(%3µµµµµ&(&¬&Z ]%«%(&&&&&&&&(%®%Z
39
40 ]%«% &¬&Z ]%«%(%&%&%&%&&$&%Z
41
42 ]&«&($%&%%%&%%%%&Z ]&«&(%%%%%$&%&&%%Z
43
44 ]&«&(%&&%&%%%%%%&Z ]±±±($&% '
45
46 ]&­&(&%&%%$&%&%&%Z ]&­&(%$%%&%%&%%&&Z
47
48 ]&­&(&%&$%%&%&%%%Z ]%­% &&&Z
49
50 ]%н&%&$&%%%$%%&%%Z ]&ннннннннннннн3%Z
51
52 ]&%%%%&&&%%&%&Z [@@@@@@@@@@@@@@@@\
53
54
55
56
57
58
59
60
61
62
63
0 ********************--0
1 ********************--1
2 **.....*......*...**--2
3 **.....*....4.*.x.**--3
4 **.....*..*.4.*...**--4
5 ***s*..*..*.4.*@@@**--5
6 **........*.4.*...**--6
7 **........*.4.*.6.**--7
8 ***********.4.*.5.**--8
9 **..........4.*.6.**--9
10 **.444444444&.*.5.**--10
11 **.4..........*.6.**--11
12 **.4.**********.5.**--12
13 **.4.*........*.6.**--13
14 **.4.*.4...22.*.5.**--14
15 **.4.*.4...22.*.6.**--15
16 **.4.*.4.*.22.*.5.**--16
17 **.4.*.4.*.22.*.6.**--17
18 **.4...4.*.22.*.5.**--18
19 **.&4444.*.22.*.6.**--19
20 **.......*.22.*.5.**--20
21 **********.22.*.6.**--21
22 **.......*.22.*.5.**--22
23 **.55555.*.22.*.6.**--23
24 **.5...5.*.22.*.5.**--24
25 **.5.*.5.*.22.*.6.**--25
26 **.5.*.5.*.22.*.5.**--26
27 **.5.*.5...22.*.6.**--27
28 **.5.*.&22222.*.5.**--28
29 **.5.*........*.6.**--29
30 **.5.**********.5.**--30
31 **.5.*............**--31
32 **.5.*............**--32
33 **.5.*............**--33
34 **.5.*............**--34
35 **@@@*...***********--35
36 **.5.*............**--36
37 **.5.*............**--37
38 **.5.*............**--38
39 **.5.**********...**--39
40 **.5..............**--40
41 **.5555555555555&.**--41
42 ***f*.............**--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "The Fan Factory"
1 author "Sami Niemi"
2 comment "This might slow down the computer a bit...
3 If so, then change the speed to 1"
4
5 time 60
6 fuel 99
7
8 x y start stop frame speed
9 -----------------------------------------------------
10 anim 6 16 1128 1151 1128 2
11 anim 6 17 1128 1151 1132 2
12 anim 6 18 1128 1151 1136 2
13 anim 6 19 1128 1151 1140 2
14
15 anim 7 20 1200 1223 1200 2
16 anim 8 20 1200 1223 1208 2
17 anim 9 20 1200 1223 1216 2
18 anim 11 20 1200 1223 1220 2
19
20 anim 13 18 1056 1079 1056 2
Binary diff not shown
0 ********************--0
1 ********************--1
2 ********************--2
3 ***..............***--3
4 ***.1.1.1.1.1.1.1***--4
5 ***5.5.5.5.5.5.5.***--5
6 ***.2.2.2.2.2.2.2***--6
7 ***4.4.4.4.4.4.4.***--7
8 ***.3.3.3.3.3.3.3***--8
9 ***..............***--9
10 ***..............***--10
11 ***..............***--11
12 ***..............***--12
13 ***.F**......**F.***--13
14 ***F.**......**.F***--14
15 ***.F**......**F.***--15
16 ***F.*SDDDD..**.F***--16
17 ***.F*SEEEDW.**F.***--17
18 ***F.*SEEE*QAS*.F***--18
19 ***.F*SxEE*W&**F.***--19
20 ***F.**SSS*S***.F***--20
21 ***...********...***--21
22 ***..............***--22
23 ***.***......***.***--23
24 ***.***.....6***.***--24
25 ***..**....****..***--25
26 ***..*@@@@@@@@*..***--26
27 ***..*aaaaaaaa*..***--27
28 ***..*vvvvvvvv*..***--28
29 ***..*w(w]]w(w*..***--29
30 ***..*ww?ww?ww*..***--30
31 ***..*w[w((w[w*..***--31
32 ***..*wwwwwwww*..***--32
33 ***...********...***--33
34 ***..............***--34
35 ***..............***--35
36 ***....**..**....***--36
37 ********@@@@********--37
38 ***....**..**....***--38
39 ***..............***--39
40 ***..............***--40
41 ****s*........*f****--41
42 ********************--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "Water Loo"
1 author "Pär Johannesson"
2 comment ""
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **....66..........**--2
3 **....66..........**--3
4 **....**..........**--4
5 *aaaaaa*......x...**--5
6 *vvvvvv*..........**--6
7 *w((((w@@@@@@@@@@@@*--7
8 *wwwwww*..........**--8
9 ********....555555**--9
10 **................**--10
11 **.33333....11111.**--11
12 **.33333....11111.**--12
13 **.33333....11111.**--13
14 **.33333..........**--14
15 **.33333..........**--15
16 **................**--16
17 **................**--17
18 **................**--18
19 **................**--19
20 **.*s**aaaaaaaaaaaa*--20
21 **....*vvvvvvvvvvvv*--21
22 **...F*wwwwwwwwwwww*--22
23 **...F*ww?wwwwww?ww*--23
24 **...F*wwwwwwwwwwww*--24
25 ****.F*wwwwwwwwwwww*--25
26 **...F*wwwwwww?wwww*--26
27 **...F*ww?wwwwwwwww*--27
28 **...F*wwwwwwwwwwww*--28
29 **...F*wwwwwwwwwwww*--29
30 **....**************--30
31 **.4.4.44.4.4.4.4.**--31
32 **4.4.4..4.4.4.4..**--32
33 *********.4.4.4..***--33
34 *********.......****--34
35 ********.......*****--35
36 *******.......******--36
37 ******.......*******--37
38 *****........*******--38
39 **.2.2.2.2.2.2.2..**--39
40 *aaaaaaaaaaaaaaaaaa*--40
41 *vvvvvvvvvvvvvvvvvv*--41
42 *ww?w[w(w]]w(w[w?ww*--42
43 *wwwwwwwwwwwwwwwwww*--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "Yellow Submarine World"
1 author "Sami Niemi"
2 comment "Save your fuel..."
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 *******************.--0
1 ********************--1
2 ********************--2
3 ***.F5555F...*...***--3
4 ***.******...*...***--4
5 ***..*.......*.&.***--5
6 ****.*..*....*...***--6
7 ***..*..*....*...***--7
8 ***..*..*....*...***--8
9 ***..*..*........***--9
10 ***.....*..*********--10
11 ***.....*........***--11
12 ***.******.......***--12
13 ***....*222222...***--13
14 ***....*222&222*.***--14
15 ****f*.*2222222*.***--15
16 ***....*********.***--16
17 ***....*.......*.***--17
18 ***....*.........***--18
19 ***....**s**********--19
20 ***TTT***x***T33T***--20
21 **@@@@@**.***3TT3***--21
22 ***aaaaaaaa*aaaaaa**--22
23 ***vvvvvvvv*vvvvvv**--23
24 **www*wwwww*wwwwww**--24
25 **w?w*wwwww*www*]w**--25
26 **www*ww%%w*www*]w**--26
27 **ww%*w*****www*]w**--27
28 **ww%*wwwww*www*]w**--28
29 **ww%*ww*%w*wwwwww**--29
30 **w(w*ww*%w*ww?www**--30
31 **w(w*ww*%w*wwwwww**--31
32 **w(*%ww*%w*wwwwww**--32
33 **w(*%ww*w******ww**--33
34 **w(*%ww*wwwwwwwww**--34
35 **w(*%w%%%%%ww*www**--35
36 **w(*%******ww*www**--36
37 **w(w%wwwwwwww*www**--37
38 **wwwww*wwwwww*www**--38
39 **w**ww*wwwwww*www**--39
40 **w**ww*ww(w?w*www**--40
41 *****w?*ww*www*w?w**--41
42 w****wwwww*wwwwwww**--42
43 w******************w--43
44 ww****************ww--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "3Net and the deadly fans"
1 author "Sami Niemi"
2 comment "3N is the former 'Trinet Software Development'"
3
4 time 55
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
9 anim 8 2 984 1007 984 2
10 anim 10 2 984 1007 992 2
11 anim 14 2 984 1007 1000 2
12 anim 15 2 984 1007 1004 2
13
14 anim 9 5 1200 1223 1200 2
15
16 anim 17 4 1056 1079 1056 2
17 anim 17 5 1056 1079 1072 2
Binary diff not shown
0 ********************--0
1 ********************--1
2 ********S*S***SS****--2
3 **1.....XWX...XX&***--3
4 **......XWX...XZAS**--4
5 **1*f*..*S*...ZAAS**--5
6 **......***.....L***--6
7 **1.....***....*****--7
8 **.1...*****....****--8
9 ***@@@*******..*****--9
10 **....*..........***--10
11 **....*..........***--11
12 **....*..........***--12
13 **....*.*s*......***--13
14 **5...**************--14
15 **55....*........***--15
16 **555............***--16
17 ***************..***--17
18 **.....&*........***--18
19 **...*****.**.**x***--19
20 ***..*****.**.******--20
21 ****...**..*****L***--21
22 ****...**..*****.***--22
23 ***..**T**.*****.***--23
24 ***..*****.**.**.***--24
25 **...****..**.**.***--25
26 **...............***--26
27 **...............***--27
28 **....******TTTTT***--28
29 **.*.....***********--29
30 *******......*LLL***--30
31 **.*.........*LLL***--31
32 *****........*******--32
33 **.*...........*L***--33
34 **.....*fff*...*****--34
35 **...............***--35
36 **...............***--36
37 ***..............***--37
38 ***....**6..6*...***--38
39 ***...****66***..***--39
40 ****T&*********&T***--40
41 ********************--41
42 ********************--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "The Neverending Keys"
1 author "Paul Fritzsche"
2 comment ""
3
4 time 66
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **&...&*...**2332&**--2
3 **.....*...**23232**--3
4 **.....*...**22332**--4
5 **.....*...**@@@@@@*--5
6 **..*f**..........**--6
7 **..****...*aaaaaaa*--7
8 **.........*vvvvvvv*--8
9 **.........*ww(w(ww*--9
10 **.........*www?www*--10
11 **.........*w(www(w*--11
12 **.........*wwwwwww*--12
13 **.........*********--13
14 **..........********--14
15 ******.****..*******--15
16 ******.****...******--16
17 ******.******..*****--17
18 ******.****.*...****--18
19 *****.......*....***--19
20 ****........*.....**--20
21 ***.........*.....**--21
22 **......*5.5*.....**--22
23 **......*.5.*.....**--23
24 ******..*5.5*.....**--24
25 **......*.5.*.....**--25
26 **......*5.5*.....**--26
27 **......*.5.*.....**--27
28 **......*5&5*.....**--28
29 **..************..**--29
30 **......*.F.*.....**--30
31 **......*F&F*.....**--31
32 **......*.F.*.....**--32
33 ******s**F&F*.....**--33
34 *********.F.......**--34
35 *****222*....*..*.**--35
36 ****2222******..****--36
37 ***..........*..*.**--37
38 **..............*.**--38
39 **3.*aaaa*...****.**--39
40 **.3*vvvv*........**--40
41 **3.*ww?w*........**--41
42 **x3*w?ww**&*&*&*&**--42
43 *****wwww***********--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level ""
1 author ""
2 comment ""
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
0 &&%& %& %&%%&%%%& &%ญ$ %% %%ญญญญญ%% &%&% %& %% ฑฑ % & %$&%% &%&%$% & % &%ญญ3 %%ญญญญ % $ %% &% % % %%$%%ฑ%%&%%% & & $&&%ฑ$&ญ&%% % % %% %& %%
1 %&& % % %%%%% %%
2 &$% % % &$ннн %&
3  %(&&%% %% &(%%%&ฑ%%%%&&%$% %(ญญ&%ฑญญญญญญญ%& % %& %% & 3&%&&$%%&%& && & ญญ$%ญญญญญ%% %% % %% ฑฑ %& %ญ%&%%ฑ%%%$%3ฑ%% &&%&%%ฑ&%ญญญญฑ%& % &&&% %& %% % & &&&%%% $% % &&ญญ ญญญญ%& %% & && &% %& % %%&&&%&%%$& &% % &%ญญญญญญญ%% $& & %& &% %& % %%&&3 &%&%%ฑ&% % ญญญ%& &&&%ฑ%& % ฑฑ %& && &% & &%$%&%%%&%% %& % %&ญญญญ%$ญญญ %% % %% &% %& & %&$&%%%&%&&ฑ%% % &%ญญญญ%$ญญญฑ&% & %& &% && & &%&%& %%&%& %% % ญญญ&% &&3&% $% % $& ฑฑ ฑฑ %% & 3%%%&%&%&%%%%% ) ญญญญญญญญญญญญญญ
0 ********************--0
1 ********************--1
2 *....*..*.........**--2
3 *..5.*..*..55555..**--3
4 *....*..*..*****@@**--4
5 **.*.*.....*......**--5
6 **.*.*..55&*..5555**--6
7 **.*.*..****..******--7
8 **.*.*.....@......**--8
9 **.*.*..*..@..5...**--9
10 **.*.*..*..*..*...**--10
11 **.*.*.....*..*...**--11
12 **.*.*..555*..**s***--12
13 **.*....****..******--13
14 **.*....@.........**--14
15 **.*55..@5555555..**--15
16 **.***..********..**--16
17 **.*&..........*..**--17
18 **.*55..55555..*..**--18
19 **.***..*****@@*..**--19
20 **.5....@.....&@..**--20
21 **......@..5555@..**--21
22 **.*....*..*****..**--22
23 **.**f*.*......*..**--23
24 **.*..55*5555..*..**--24
25 **.*..*******..*..**--25
26 **.*...........*..**--26
27 **.*..5555555..*..**--27
28 **.*..*******..*..**--28
29 **.*....&*.....@..**--29
30 **.*555..*..*..@..**--30
31 **.****@@*..*..*..**--31
32 **.*...........*..**--32
33 **.*..5555..555*..**--33
34 **.*..****..****..**--34
35 **.*...........@..**--35
36 **.*..5555..555@..**--36
37 **.*..****..****..**--37
38 **.*.....*.....*..**--38
39 **.*555..*..&..*..**--39
40 **.****..*@@*@@*..**--40
41 **.*&.............**--41
42 **x*55555555555555**--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level ""
1 author ""
2 comment ""
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **x5.5.5.5.**.....**--2
3 **5.5.5**.5**.....**--3
4 **.5**.**5.**.....**--4
5 **5.**5.5.5**..*s***--5
6 **.5.5.5**.**.....**--6
7 *****.5.**5**.....**--7
8 *****5.5.5.**.....**--8
9 **......5.5**.....**--9
10 *aaaaaaaaaaaaaaaaaa*--10
11 *vvvvvvvvvvvvvvvvvv*--11
12 *wwwwwwwww?wwwwwwww*--12
13 *wwwwwwwww%wwwwwwww*--13
14 *wwwwwwwww%wwwwwwww*--14
15 *wwwwwwwww%wwwwwwww*--15
16 *wwwwwwwww%wwwwwwww*--16
17 *wwwwwwwww%wwwwwwww*--17
18 *www%%%%%%%wwwwwwww*--18
19 *wwwwwwwwwwwwwwwwww*--19
20 *wwwwwwwwwwwwwwwwww*--20
21 *wwwwwwwwwwwwwwwwww*--21
22 *wwwwwwwwwwwwwwwwww*--22
23 *wwwwwwwwwwwwwwwwww*--23
24 *wwwwwwwwwwwwwwwwww*--24
25 *wwwwwwwwwwwwwwwwww*--25
26 *wwwwwwwwwwwwwwwwww*--26
27 *wwwwwwwwwwwwwwwwww*--27
28 *wwwwwwwwwwwwwwwwww*--28
29 *wwwwwwwwwwwwwwwwww*--29
30 *wwwwwwwwwwwwwwwwww*--30
31 *wwwwwwwwwwwwwwwwww*--31
32 *wwwwwwwwwwwwwwwwww*--32
33 *wwwwwwwwwwwwwwwwww*--33
34 *wwwwwwwwwwwwwwwwww*--34
35 *wwwwwwwwwwwwwwwwww*--35
36 *wwwwwwwwwwwwwwwwww*--36
37 *wwwwwwwwwwwwwwwwww*--37
38 *wwwwwwwwwwwwwwwwww*--38
39 *w)w)w)w)ww*********--39
40 *w((((((((((((((((w*--40
41 *w]]]]]]]]]]]]]]]]w*--41
42 *w[[[[[[[[[[[[[[[[w*--42
43 *wwwwwwwwwwwwwwwwww*--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level ""
1 author ""
2 comment ""
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
Binary diff not shown
0 ********************--0
1 ********************--1
2 **********3.3.3*****--2
3 ****...***......****--3
4 ***.....*****f*..***--4
5 ***.*s*.******...***--5
6 ***.....*..***...***--6
7 ***......*.......***--7
8 ***5.5.5****...2.***--8
9 *************aaaaa**--9
10 *******@*****vvvvv**--10
11 ****6..@..4**w(www**--11
12 ****...@...**www(w**--12
13 ****...@...**wwwww**--13
14 ***..**@*..**w(www**--14
15 **..****aaaa*wwwww**--15
16 **..****vvvv*www(w**--16
17 **...***ww(w*wwwww**--17
18 ***....*wwwwww(w?w**--18
19 ***....*w(?wwwwwww**--19
20 ***....*wwww(www(w**--20
21 ***...**wwwwwwwwww**--21
22 ***.&.**************--22
23 ***...*x2***T.T.****--23
24 ***...*2..*T.T.T.***--24
25 ***...*..2*T***.T***--25
26 ***...*3..*.T&*T.***--26
27 ***...*...*****.T***--27
28 ***...*..........***--28
29 ***...*..........***--29
30 ***...*...**f*...***--30
31 ***..**...*.2....***--31
32 ***..*3&..*3*2...***--32
33 ***..*3*..****...***--33
34 ***..33*..***@@@@@**--34
35 ***...**..****555***--35
36 ****..*...***5555***--36
37 ****..*...*.**555***--37
38 ****..*...***@@@@@**--38
39 ****.....*****...***--39
40 ****.....*..@....***--40
41 ******...*&.@...****--41
42 ************@*L*****--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
Binary diff not shown
0 level "The Impossible"
1 author "Pär Johannesson"
2 comment "Just keep on trying, there's an 'outro' waiting.."
3
4 time 99
5 fuel 99
6
7 x y start stop frame speed
8 -----------------------------------------------------
9 anim 6 12 984 1007 984 2
10 anim 8 17 1200 1223 1200 2
11 anim 13 37 984 1007 984 2
Binary diff not shown
0 ********************--0
1 ********************--1
2 ***...**...*......**--2
3 **.....*.*.*.*....**--3
4 ****s*...*...*....**--4
5 ***********..****.**--5
6 ************.*2222**--6
7 ************.*2222**--7
8 ************.*2222**--8
9 ************.*2222**--9
10 *****........**22&**--10
11 ****.***************--11
12 ***.**S*************--12
13 **.***X.*&3333333.**--13
14 *..**.X.*.*******3**--14
15 *.....X.W.*******3**--15
16 *.....*.W.*******3**--16
17 ********S********3.*--17
18 ****************.3**--18
19 **333333333333333***--19
20 *3.********.********--20
21 *3.*******@@@*******--21
22 *3.*******@@@*******--22
23 *3.*******@@@*******--23
24 *3.********.**@*****--24
25 *3............@*****--25
26 **............@.****--26
27 ***..*.*.*....@..***--27
28 ****.*.*.**f*.@...**--28
29 **************@**..*--29
30 *****************..*--30
31 **.................*--31
32 **..*********aaaaaa*--32
33 **..***@*****vvvvvvw--33
34 **...22@...&*w%%%%%w--34
35 **...22@....*w?%%%?w--35
36 **.....@....*wwwwwww--36
37 **22.22@....*S******--37
38 **22.22@.....X....**--38
39 *@@@@@@@.....X....**--39
40 **...........X*...**--40
41 **............*.x.**--41
42 **333333333333*...**--42
43 ********************--43
44 ********************--44
45 ||||||||||||||||||||
46 00000000001111111111
47 01234567890123456789
48
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 /* Wow.. A lot of stuff... */
3
4
5 #include "memory.h"
6
7 void the_end() {
8 ending=TRUE;
9 }
10
11
12 void explode() {
13 sf[0]=(sf[0]&65479)|8;
14 }
15
16
17
18
19
20
21
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 /*--------------------------------------------------------------------- beep */
3 #ifndef NOSOUND
4 #define beep(time) ioctl(1,KDMKTONE, 3276800+time);
5 #else
6 #define beep(time)
7 #endif
8
9
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*---------------------------------------------------------- drawSplitScreen */
5 void drawSplitScreen() {
6
7 static long adr;
8 static int mask,xx,yy;
9 static char *dp;
10
11 vga_setpage(0);
12 mask=adr=0;
13
14 for (yy=0; yy<=15; yy++) {
15 for (xx=0; xx<=639; xx++) {
16 if (adr>65535) {
17 adr=0;
18 mask++;
19 vga_setpage(mask);
20 }
21 *(vga_ptr+adr++)=0;
22 }
23 }
24
25 }
26
27
28 /*--------------------------------------------------------------- drawScreen */
29 int drawScreen() {
30
31 static short x,y,xx,yy,blk;
32 static char *address;
33 static char *gfx;
34 static long ptr;
35
36 /*---- ScreenShot-----
37 static long adr;
38 static int mask;
39 ---------------------*/
40
41
42 for(yy=y=0; y<=44; y++,yy+=32) {
43 for(xx=x=0; x<=19; x++,xx+=32) {
44 putbox(xx,yy, block[level[x+y*20]]);
45 }
46 }
47
48 drawSplitScreen();
49
50 wipe.active=255; /* Not Active */
51
52 /* This routine writes the screen to stdout to produce
53 /* a screen shot.. */
54 /* SCREEN SHOT
55 vga_setpage(0);
56 mask=adr=0;
57
58 putchar('*');
59 for (yy=0; yy<=1439; yy++) {
60 for (xx=0; xx<=639; xx++) {
61 if (adr>65535) {
62 adr=0;
63 mask++;
64 vga_setpage(mask);
65 }
66 putchar(*(vga_ptr+adr++));
67 }
68 }
69 */
70
71 }
72
73
74
75
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "includes.h"
3
4 #define SIZE 1.5 /* Sinus Table Size */
5
6 FILE *fileptr;
7
8 char gamename[128];
9 int gamenamelen;
10
11 char buffer[320*33]; /* The Gfx is save on a 320*x screen, with lines
12 between the objects.. -> only 9 objects per line */
13
14
15 /* The Buffer for the Ships and The Backgrounds (2 ships supported!) */
16
17 uchar ship[4][32][32*32]; /* 32 frames of ships 32*32 */
18 /* ship[0][..][..]=Ship#1
19 [1] =Ship#2
20 [2] =Thrust#1
21 [3] =Thrust#2
22 */
23
24 uchar shipremo[2][32*32]; /* Not only ships */
25 uchar shipback[2][32*32]; /* Not only ships */
26 uchar shipbackM[32*32];
27 uchar shipmix[32*32];
28
29 uchar block[216+N_DESTROYEABLE][32*32]; /* Allocate Mem for the Gfx blocks */
30 uchar level[20*45]; /* Level Gfx Map */
31 uchar objects[20*45+80]; /* Level Object Map */
32 /* +80 to avoid too long lines */
33 uchar backgnd[32*32*4];
34
35 uchar actionback[N_ACTION][32*32];
36 uchar actionmix[32*32];
37
38 uchar tmpmix[32*32];
39
40 uchar bulletback[N_BULLETS+1][9];
41
42 uchar bulletgfx[9]= {
43 12,13,12,
44 13,14,13,
45 12,13,12
46 };
47
48 uchar score[256*16];
49 uchar scoreback[256*16];
50 uchar digits[88*6];
51 uchar numbers[880]; /* old was 800 ?? */
52 uchar highscore[4096];
53 uchar levelcode[4096];
54 uchar tmpscore[4096];
55 uchar fonts[1820];
56
57 /*uchar LEVEL[128],AUTHOR[128],COMMENT[128],*/
58 uchar nextlevel[128];
59
60
61 short n_cexcept,n_anim; /* Number of these.. */
62
63 long SIN[32]={ 399*SIZE, 783*SIZE, 1137*SIZE, 1448*SIZE,
64 1702*SIZE, 1892*SIZE, 2008*SIZE, 2048*SIZE,
65 2008*SIZE, 1892*SIZE, 1702*SIZE, 1448*SIZE,
66 1137*SIZE, 783*SIZE, 399*SIZE, 0*SIZE,
67 -399*SIZE, -783*SIZE,-1137*SIZE,-1448*SIZE,
68 -1702*SIZE,-1892*SIZE,-2008*SIZE,-2048*SIZE,
69 -2008*SIZE,-1892*SIZE,-1702*SIZE,-1448*SIZE,
70 -1137*SIZE, -783*SIZE, -399*SIZE, 0*SIZE};
71
72 long bigsin[256];
73
74 uchar hole[2][1024]={
75 {
76 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
77 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
78 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
79 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
80 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
81 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,
82 0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,
83 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
84 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
85 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
86 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
87 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
88 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
89 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
90 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
91 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
92 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
93 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
94 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
95 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
96 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
97 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
98 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
99 0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,
100 0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
101 0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
102 0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
103 0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
104 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
105 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
106 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
107 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
108
109 },
110 {
111 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
112 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
113 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
114 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
115 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
116 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
117 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
118 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
119 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
120 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,
121 0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
122 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
123 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
124 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
125 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
126 0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
127 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,
128 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
129 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
130 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
131 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,
132 0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
133 0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
134 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
135 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
136 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
137 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
138 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
139 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
140 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
141 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
142 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
143
144 }
145 };
146
147 struct excepttype {
148 uchar type;
149 short x,y;
150 } c_except[N_CEXCEPT];
151
152 struct animtype {
153 short x,y,start,stop,frame,speed;
154 } anim[N_ANIM+1];
155
156 struct actiontype {
157 short x,y,start,stop,frame,state,speed,delay;
158 } action[N_ACTION+1];
159
160 uchar pal[768],palB[768],realpal[768],realpal2[768];
161
162 struct bullettype {
163 long x,y,ang,xs,ys,dis,type;
164 unsigned char active;
165 } bullet[N_BULLETS+1];
166
167 struct wipetype { /* Stores a block 2 B destryed in vertical blank. */
168 int x,y,active;
169 } wipe;
170
171 /* sx/sy=coord, sa=angle
172 sV=Velocity(x,y, gravity),
173 sA=Acceleration
174 sf=Flags
175
176 */
177
178 /* Original Ship Coordinates for the level */
179 long Lsx[2],Lsy[2];
180
181 /* s= Ship X/Y
182 os= Old Ship X/Y
183 a= Angle
184 V= Velocity
185 A= Acceleration
186 f= flags (explosion state [0-5], etc.)
187 */
188 long sx[2],sy[2],osx[2],osy[2],sa[2],sVx[2],sVy[2],sVg[2],sA[2],sf[2];
189 long gravity,lift_thrust,medium,friction;
190
191
192 /* sf=[0-5] Explotion State */
193
194
195 uchar *vga_ptr;
196 uchar *scans;
197
198 short angX[32],angY[32];
199 short loadtime[2]={0,0};
200 short win_y;
201 short anim_frame;
202 short col_frame;
203
204 uchar ship_flag=0; /* 0=STILL
205 1=WATER
206 2=??
207 */
208 uchar g_flag=0;
209
210 uchar ScoreChange=0;
211
212 short thrust_len=0;
213 short watercount=0;
214 short num_of_collisions=0;
215 short MaxNorm,MaxFall; /* Max speeds */
216 uchar fueling; /* A flag for fueling on/off */
217
218 long ShipScore=0;
219 long HighScore=23456;
220 short ShipFuel;
221 short ShipTime;
222 short ShipLife=3;
223 short NumKeys;
224 short stop_x,stop_y;
225 short levelnum;
226
227 short old_x,old_y;
228
229 short BaseFuel,BaseTime,BaseLife;
230
231 long delay_len=0;
232
233 long Dec2BCD[100000];
234
235 uchar ending,escape=FALSE;
236
237 uchar p0[768],p1[768],p2[768],p3[768];
238 uchar p2B[768];
239
240 /* The easy way... */
241 char codes[100][6]={
242 "jkfobt",
243 "evfyvb",
244 "tirtxq",
245 "cqaryo",
246 "vhhhcv",
247 "alficj",
248 "dgeigb",
249 "lzjcvh",
250 "uxxuqy",
251 "knhsvl",
252 "nxxvfb",
253 "gijkrq",
254 "merxjm",
255 "gdlgae",
256 "gkrnem",
257 "zumypr",
258 "zxaiht",
259 "yvzqvi",
260 "ebmsjo",
261 "wpandf",
262 "cezocq",
263 "fdnhlu",
264 "cmscen",
265 "kkqyca",
266 "oyppms",
267 "uqytec",
268 "jlfyvt",
269 "sxfmbl",
270 "zmvqmy",
271 "qbwhqk",
272 "ckaafg",
273 "dquiop",
274 "bioivq",
275 "twepoq",
276 "pgrloj",
277 "yqvasa",
278 "hvqbgg",
279 "sjpgsm",
280 "ynicez",
281 "vtfohv",
282 "yfnvfg",
283 "wodorj",
284 "xjtmsn",
285 "asakxh",
286 "jsargj",
287 "mgoccw",
288 "iakloe",
289 "xnpszh",
290 "fzchmz",
291 "ovrrmz",
292 "abgrdk",
293 "nnkzya",
294 "dxotpp",
295 "cwreed",
296 "duywln",
297 "wmqcdt",
298 "osgyrg",
299 "yxgosv",
300 "eusvby",
301 "aesybg",
302 "nzsdbx",
303 "yppgpi",
304 "ppfvex",
305 "skumhv",
306 "khbfhc",
307 "lvbfae",
308 "czvtfm",
309 "buchpi",
310 "gisawb",
311 "xhizop",
312 "dbmhgn",
313 "lkmjdt",
314 "xeoznf",
315 "jupdwm",
316 "euvmvj",
317 "eykqfs",
318 "dtcref",
319 "lblbdz",
320 "gmvyqt",
321 "kupfhk",
322 "qnjadq",
323 "ujjwcn",
324 "dnpoqu",
325 "pxgmxw",
326 "ghtxoa",
327 "ieprgs",
328 "hadtwg",
329 "ibvzpm",
330 "thlavi",
331 "ydrrbf",
332 "tjjicp",
333 "blpgen",
334 "mnoimf",
335 "wgohik",
336 "rgniyo",
337 "nrzyab",
338 "pdpgjt",
339 "twijgx",
340 "qcfhln",
341 "tevimt"
342 };
343
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "config.h"
3 #include <stdio.h>
4
5 extern char gamename[128];
6 extern gamenamelen;
7
8 extern FILE *fileptr;
9 extern char buffer[320*33];
10 extern uchar ship[4][32][32*32];
11 extern uchar shipremo[2][32*32];
12 extern uchar shipback[2][32*32];
13 extern uchar shipbackM[32*32];
14 extern uchar shipmix[32*32];
15 extern uchar block[216+N_DESTROYEABLE][32*32];
16 extern uchar level[20*45];
17 extern uchar objects[20*45+80];
18 extern uchar backgnd[32*32*4];
19 extern uchar actionback[N_ACTION][32*32];
20 extern uchar actionmix[32*32];
21 extern uchar tmpmix[32*32];
22 extern uchar bulletback[N_BULLETS+1][9];
23 extern uchar score[256*16];
24 extern uchar scoreback[256*16];
25 extern uchar digits[88*6];
26 extern uchar numbers[880]; /* old was 800 ?? */
27 extern uchar highscore[4096];
28 extern uchar levelcode[4096];
29 extern uchar tmpscore[4096];
30 extern uchar fonts[1820];
31 extern uchar nextlevel[128];
32 extern short n_cexcept,n_anim;
33 extern long bigsin[256];
34
35 extern struct excepttype {
36 uchar type;
37 short x,y;
38 } c_except[N_CEXCEPT];
39
40 extern struct animtype {
41 short x,y,start,stop,frame,speed;
42 } anim[N_ANIM+1];
43
44 extern struct actiontype {
45 short x,y,start,stop,frame,state,speed,delay;
46 } action[N_ACTION+1];
47
48 extern uchar pal[768],palB[768],realpal[768],realpal2[768];
49
50 extern struct bullettype {
51 long x,y,ang,xs,ys,dis,type;
52 unsigned char active;
53 } bullet[N_BULLETS+1];
54
55 extern struct wipetype {
56 int x,y,active;
57 } wipe;
58
59 extern long Lsx[2],Lsy[2];
60 extern long sx[2],sy[2],osx[2],osy[2],sa[2],sVx[2],sVy[2],sVg[2],sA[2],sf[2];
61 extern long gravity,lift_thrust,medium,friction;
62 extern uchar *vga_ptr;
63 extern uchar *scans;
64 extern short angX[32],angY[32];
65 extern short loadtime[2];
66 extern short win_y;
67 extern short anim_frame;
68 extern short col_frame;
69 extern uchar ship_flag;
70 extern uchar g_flag;
71 extern uchar ScoreChange;
72 extern short thrust_len;
73 extern short watercount;
74 extern short num_of_collisions;
75 extern short MaxNorm,MaxFall;
76 extern uchar fueling;
77
78 extern long ShipScore;
79 extern long HighScore;
80 extern short ShipFuel;
81 extern short ShipTime;
82 extern short ShipLife;
83 extern short NumKeys;
84 extern short stop_x,stop_y;
85 extern short levelnum;
86
87 extern short old_x,old_y;
88
89 extern short BaseFuel,BaseTime,BaseLife;
90
91 extern long delay_len;
92
93 /* If you are running out of memory change the BSD routine
94 /* I just didn't like performing 4 divisions by 10, or
95 /* figuring out a better way... */
96 extern long Dec2BCD[100000];
97
98 extern uchar ending,escape;
99
100 extern uchar p0[768],p1[768],p2[768],p3[768];
101 extern uchar p2B[768];
102
103 extern uchar hole[2][1024];
104 extern long SIN[32];
105 extern uchar bulletgfx[9];
106
107 extern char codes[100][6];
108
109
110
111
112
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 /* Wait Any Key */
3 void waitanykey() {
4
5 while(keyboard_update())
6 vga_waitretrace();
7
8 while(!keyboard_update())
9 vga_waitretrace();
10
11 }
12
13 /*------------------------------------------------------------------ doPanic */
14 /* It also panics if you push a mouse button, in case svgalib crashes.. */
15
16 void doPanic() {
17 printf("------------------------------\n"
18 "- PANICING!!!!!!! WHOAAAAA!! -\n"
19 "------------------------------\n");
20 keyboard_close();
21 mouse_close();
22 exit(1);
23 }
24
25
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include <asm/io.h>
3 #include "memory.h"
4 #include "macros.h"
5
6
7 /*----------------------------------------------------------------- moveShip */
8 /* Once again... This routine contains a lot of bad "undocumented" non logical
9 /* code due to all the changes to the project that was never supposed to
10 /* become a real game... */
11
12 int moveShip(short nr, unsigned char flag) {
13
14 static short n,num,x,y,xx,yy,x2,y2,wflag,level_adr,m;
15 static short e_num,lx,ly,tmp1,tmp2,sl;
16 static long pal_m;
17 static long pal_n;
18 static uchar reg;
19
20 static char blocktype;
21
22 static uchar *shipptr;
23 static uchar *backptr;
24
25 backptr=shipbackM;
26
27 x=sx[nr] >> STEP;
28 y=sy[nr] >> STEP;
29 getbox(x, y, backptr);
30
31
32
33 if (!(flag & 1))
34 num=nr;
35 else
36 num=nr+2;
37
38 /*===================*/
39 switch ((sf[nr] & 63) >> 3) {
40
41 case 0:
42 wflag=1;
43 shipptr=ship[num][sa[nr] >> 5];
44 break;
45 case 1:
46 wflag=0;
47 ship_flag=ship_flag | 1; /* Keep the explosion still */
48 sf[nr]++;
49 shipptr=block[45];
50 break;
51 case 2:
52 wflag=0;
53 sf[nr]++;
54 shipptr=block[46];
55 break;
56 case 3:
57 wflag=0;
58 sf[nr]++;
59 shipptr=block[47];
60 break;
61 case 4:
62 wflag=0;
63 sf[nr]++;
64 shipptr=block[48];
65 break;
66 case 5:
67 wflag=0;
68 sf[nr]++;
69 shipptr=block[49];
70 break;
71 case 6:
72 wflag=2;
73 sf[nr]=sf[nr] & 65472;
74
75 /*
76 sx[nr]=Lsx[nr];
77 sy[nr]=Lsy[nr];
78 */
79
80 sa[nr]=0;
81 sVx[nr]=sVy[nr]=sVg[nr]=1; /* Shouldn't ever be Zero */
82 sA[nr]=0;
83
84 /* AIR */
85 gravity=15;
86 lift_thrust=10;
87 medium=1000;
88 friction=1014;
89 ship_flag=ship_flag & 0xfd; /* Water=0 */
90 MaxNorm=3072;
91 MaxFall=4096;
92
93 shipptr=ship[num][sa[nr] >> 5];
94
95 putbox(x,y,backptr);
96
97 ShipLife--;
98 if (ShipLife<=0)
99 the_end();
100 else {
101 ShipFuel=BaseFuel;
102
103 getbox(Lsx[nr] >> STEP, Lsy[nr] >> STEP, backptr);
104
105 if (ShipTime<=0) {
106 putstamp(272,win_y+184,67,76,85);
107 for(n=0; n<=100; n++) {
108 AnimateAll();
109 putstamp(272,win_y+184,67,76,85);
110 }
111 killstamp(272,win_y+184);
112 }
113 ShipTime=BaseTime;
114 ShipFuel=BaseFuel;
115
116 for(n=0; n<=1023; n++) /* Plot the new ship before scrolling */
117 shipmix[n]=shipptr[n] ? shipptr[n] : backptr[n];
118
119 /* ANIMATE THE SHIP INTO THE NEW POSITION */
120
121 scrollY(nr,y-240,(Lsy[nr] >> STEP)-232);
122 updatescore();
123
124 for(n=0; n<=N_ACTION; n++) {
125 if (!action[n].state) {
126 action[n].state=TRUE;
127 action[n].x=(Lsx[nr] >> STEP)+16;
128 action[n].y=(Lsy[nr] >> STEP)+16;
129 action[n].start=157;
130 action[n].stop=162;
131 action[n].frame=157;
132 action[n].speed=7;
133 action[n].delay=7;
134 m=n;
135 goto nomoreloop2;
136 }
137 }
138 nomoreloop2:
139
140 sx[nr]=Lsx[nr];
141 sy[nr]=Lsy[nr];
142
143 for(n=0; n<=40; n++) {
144 AnimateAll();
145 }
146 action[m].state=FALSE;
147 putbox(Lsx[nr] >> STEP, Lsy[nr] >> STEP, shipmix);
148 }
149 break;
150 }
151
152 if (wflag<2) {
153
154 if ( ((ship_flag & 2)==0) || (wflag==0) )
155 for(n=0; n<=1023; n++)
156 shipmix[n]=shipptr[n] ? shipptr[n] : backptr[n];
157
158
159
160
161
162 /*===================*/
163 shipptr=ship[num & 254][sa[nr] >> 5]; /* & 254 to mask out thrust */
164
165
166 x2=x+31;
167 y2=y+31;
168
169 num_of_collisions=0;
170
171 /* Check for Collision */
172 if ((sf[nr] & 63)==0) { /* ZERO => Not Exploding! */
173
174 if ((ship_flag&1)==0) { /* If !ZERO => LAYING STILL */
175
176 n=0;
177 for(yy=y; yy<=y2; yy++) {
178 for(xx=x; xx<=x2; xx++) {
179 n++;
180
181 if (
182 (shipptr[n]!=0) &&
183 (
184 (
185 (backptr[n]>127)
186 &&
187 (backptr[n]<175)
188 )
189 ||
190 (backptr[n]==DOOR1COLOR)
191 )
192 ) {
193
194 num_of_collisions++;
195
196 /* The exceptions go here! */
197
198 /* beep(5000);*/
199
200
201
202 wflag=0; /* Marks if in exception */
203 ship_flag=ship_flag & 0xfe;
204
205 lx=(x+16) >> 5;
206 ly=(y+16) >> 5;
207 for(e_num=0; e_num<=n_cexcept; e_num++) {
208
209 if ((ly==c_except[e_num].y) &&
210 (lx==c_except[e_num].x)) {
211
212 switch(c_except[e_num].type) {
213
214 case E_FUEL:
215
216 fueling=TRUE;
217 /* Gimme more fuel goes here */
218
219 case E_START:
220
221 if (
222 ((sa[nr]<=56) ||
223 (sa[nr]>=968)) &&
224 ((sVy[nr]+sVg[nr])<900)) {
225
226 /* Landed succesfully here */
227
228 num_of_collisions--;
229
230 ship_flag=ship_flag | 1;
231 sa[nr]=0;
232 sVy[nr]=0;
233
234 wflag=1;
235 beep(10000);
236 }
237 break;
238
239 default:
240
241 fueling=FALSE;
242
243 }
244
245 }
246 }
247
248
249 #ifndef TRAINER
250
251 if ((wflag==0) && (num_of_collisions>5)) {
252 sf[nr]=(sf[nr] & 65472) | 8;
253 num_of_collisions=0;
254 }
255
256 if ((num_of_collisions>5) || (wflag==1)) goto Explode;
257
258 #endif
259 }
260
261 }
262 }
263
264
265 /* Check the level collisions if no other collisions occured */
266 lx=(x+16) >> 5;
267 ly=(y+16) >> 5;
268
269 level_adr=(ly << 4)+(ly<<2)+lx; /* ly*20+lx */
270 blocktype=objects[level_adr];
271
272 switch(blocktype) {
273
274 case E_WIND_Q:
275 sVx[nr]-=50;
276 sVy[nr]-=50;
277 break;
278
279 case E_WIND_W:
280 sVy[nr]-=50;
281 break;
282
283 case E_WIND_E:
284 sVx[nr]+=50;
285 sVy[nr]-=50;
286 break;
287
288 case E_WIND_D:
289 sVx[nr]+=50;
290 break;
291
292 case E_WIND_C:
293 sVx[nr]+=50;
294 sVy[nr]+=50;
295 break;
296
297 case E_WIND_X:
298 sVy[nr]+=50;
299 break;
300
301 case E_WIND_Z:
302 sVx[nr]-=50;
303 sVy[nr]+=50;
304 break;
305
306 case E_WIND_A:
307 sVx[nr]-=50;
308 break;
309
310 case E_AIR:
311
312 if ((ship_flag & 2)==2) { /* Lifting! (Pintajännite) */
313 sVy[nr]=sVy[nr] >> 5;
314 sVg[nr]=sVg[nr] << 5;
315 }
316
317 /* Default Air Values */
318 gravity=15;
319 lift_thrust=10;
320 medium=1000;
321 friction=1024;
322 ship_flag=ship_flag & 0xfd; /* Water=0 */
323 MaxNorm=3072;
324 MaxFall=4096;
325 break;
326
327 case E_WKEY:
328 NumKeys--;
329 blocktype=E_WBONUS;
330 goto h2o;
331
332 case E_WFUEL:
333 ShipFuel+=80; /* 5 */
334 if (ShipFuel>1599) ShipFuel=1599;
335 blocktype=E_WBONUS;
336 updatescore();
337 goto h2o;
338
339 case E_WBONUS1:
340 ShipScore+=2;
341 blocktype=E_WBONUS;
342 updatescore();
343 goto h2o;
344
345 case E_WBONUS2:
346 ShipScore+=3;
347 blocktype=E_WBONUS;
348 updatescore();
349 goto h2o;
350
351 case E_WBONUS3:
352 ShipScore+=4;
353 blocktype=E_WBONUS;
354 updatescore();
355 goto h2o;
356
357 case E_WBONUS4:
358 ShipScore+=6;
359 blocktype=E_WBONUS;
360 updatescore();
361 goto h2o;
362
363
364 case E_TOP_WATER:
365 case E_WATER:
366 h2o:
367 watermask(x,y,blocktype,backptr);
368
369 /* Water */
370 if ((ship_flag & 2)==0) { /* Splash! */
371 sVx[nr]=sVx[nr] >> 2;
372 sVy[nr]=sVy[nr] >> 2;
373 sVg[nr]=sVg[nr] >> 2;
374 }
375 watercount++;
376
377 sVy[nr]+=((-SIN[watercount & 31]*sVx[nr]) >> 15);
378 sVx[nr]+=((SIN[watercount & 31]*(sVy[nr]+sVg[nr])) >> 15);
379
380 gravity=4;
381 lift_thrust=15;
382 medium=970;
383 friction=750;
384 ship_flag=ship_flag | 2; /* Water=1 */
385 MaxNorm=2048;
386 MaxFall=2048;
387 break;
388
389 case E_BONUS8:
390 ShipScore+=8;
391 blocktype=E_BONUS;
392 updatescore();
393 break;
394
395 case E_BONUS7:
396 ShipScore+=7;
397 blocktype=E_BONUS;
398 updatescore();
399 break;
400
401 case E_BONUS6:
402 ShipScore+=6;
403 blocktype=E_BONUS;
404 updatescore();
405 break;
406
407 case E_BONUS5:
408 ShipScore+=5;
409 blocktype=E_BONUS;
410 updatescore();
411 break;
412
413 case E_BONUS4:
414 ShipScore+=4;
415 blocktype=E_BONUS;
416 updatescore();
417 break;
418
419 case E_BONUS3:
420 ShipScore+=3;
421 blocktype=E_BONUS;
422 updatescore();
423 break;
424
425 case E_BONUS2:
426 ShipScore+=2;
427 blocktype=E_BONUS;
428 updatescore();
429 break;
430
431 case E_BONUS1:
432 ShipScore+=1;
433 blocktype=E_BONUS;
434 updatescore();
435 break;
436
437 case E_KEY:
438 NumKeys--;
439 blocktype=E_BONUS;
440 break;
441
442 case E_XLIFE:
443 ShipLife++;
444 if (ShipLife>9) ShipLife=9;
445 blocktype=E_BONUS;
446 updatescore();
447 break;
448
449 case E_XFUEL:
450 ShipFuel+=80; /* 5 */
451 if (ShipFuel>1599) ShipFuel=1599;
452 blocktype=E_BONUS;
453 updatescore();
454 break;
455
456 case E_XTIME:
457 ShipTime+=640; /* 5 */
458 if (ShipTime>12671) ShipTime=12671;
459 blocktype=E_BONUS;
460 updatescore();
461 break;
462
463 case E_STOP:
464 beep(10000);
465
466 levelnum++;
467 loaddata(); /* Branches to outro() if it cant load! */
468
469
470 for (pal_m=0; pal_m<=767; pal_m++) {
471 p3[pal_m]=63;
472 p0[pal_m]=0;
473 p2[pal_m]=63-palB[pal_m];
474 p2B[pal_m]=63-pal[pal_m];
475 pal[pal_m]=realpal[pal_m];
476 palB[pal_m]=realpal2[pal_m];
477 }
478
479 /* Roll The Split Screen Down */
480 for(sl=464; sl<=480; sl++) {
481 outb(0x18,0x3d4); /* LineCompare */
482 outb(sl&255,0x3d5);
483 outb(7,0x3d4); /* Overflow */
484 reg=inb(0x3d5);
485 outb(reg|((sl&256)>>4),0x3d5);
486 outb(9,0x3d4); /* Maximum Scanline */
487 reg=inb(0x3d5);
488 outb(reg|((sl&512)>>3),0x3d5);
489 vga_waitretrace();
490 }
491
492 if (levelnum&1) {
493
494 for(pal_n=992; pal_n>=32; pal_n-=64) {
495 for (pal_m=0; pal_m<=767; pal_m++)
496 p1[pal_m]=63-(( ((long)p2[pal_m])*pal_n)>>10);
497 vga_waitretrace();
498 gl_setpalette(p1);
499 }
500
501 }
502 else {
503
504 for(pal_n=992; pal_n>=32; pal_n-=64) {
505 for (pal_m=0; pal_m<=767; pal_m++)
506 p1[pal_m]=63-(((long)p2B[pal_m])*pal_n)>>10;
507 vga_waitretrace();
508
509 gl_setpalette(p1);
510 }
511
512
513 }
514
515 gl_setpalette(p3);
516
517 /* DRAW NEW LEVEL AND INITIALIZE IT HERE */
518 drawScreen();
519
520 /* Put New Score Sign */
521 for(n=0; n<=4095; n++) {
522 tmpscore[n]=score[n];
523 score[n]=levelcode[n];
524 }
525
526 tmp1=(sy[nr] >> STEP)-240;
527 if (tmp1<16)
528 tmp1=16;
529 else
530 if (tmp1>960)
531 tmp1=960;
532 win_y=tmp1+8;
533
534 putletter(1426,codes[levelnum-1][0]-'a');
535 putletter(1435,codes[levelnum-1][1]-'a');
536 putletter(1444,codes[levelnum-1][2]-'a');
537 putletter(1453,codes[levelnum-1][3]-'a');
538 putletter(1462,codes[levelnum-1][4]-'a');
539 putletter(1471,codes[levelnum-1][5]-'a');
540
541 sx[nr]=Lsx[nr]; /* unnecessary??*/
542 sy[nr]=Lsy[nr];
543
544 x=sx[nr] >> STEP;
545 y=sy[nr] >> STEP;
546
547 sa[nr]=0;
548 sVx[nr]=sVy[nr]=sVg[nr]=1; /* Shouldn't ever be Zero(?)*/
549 sA[nr]=0;
550
551 getbox(Lsx[nr] >> STEP, Lsy[nr] >> STEP, backptr);
552
553 shipptr=ship[num][0];
554 for(n=0; n<=1023; n++)
555 shipmix[n]=shipptr[n] ? shipptr[n] : backptr[n];
556
557
558 wflag=1; /* Do not plot */
559
560
561 putscore(nr,win_y);
562 tmp1=(sy[nr] >> STEP)-240;
563 if (tmp1<16)
564 tmp1=16;
565 else
566 if (tmp1>960)
567 tmp1=960;
568 gl_setdisplaystart(0,tmp1);
569
570 for (pal_m=0; pal_m<=767; pal_m++) {
571 p3[pal_m]=63;
572 p0[pal_m]=0;
573 p2[pal_m]=63-palB[pal_m];
574 p2B[pal_m]=63-pal[pal_m];
575 }
576
577 if (levelnum&1) {
578
579 for(pal_n=16; pal_n<=1008; pal_n+=32) {
580 for (pal_m=0; pal_m<=767; pal_m++)
581 p1[pal_m]=63-(((long)p2B[pal_m])*pal_n)>>10;
582 vga_waitretrace();
583 gl_setpalette(p1);
584 }
585 gl_setpalette(pal);
586
587 }
588 else {
589 for(pal_n=16; pal_n<=1008; pal_n+=32) {
590 for (pal_m=0; pal_m<=767; pal_m++)
591 p1[pal_m]=63-(((long)p2[pal_m])*pal_n)>>10;
592 vga_waitretrace();
593 gl_setpalette(p1);
594 }
595 gl_setpalette(palB);
596 }
597
598 /* ANIMATE THE SHIP INTO THE NEW LEVEL */
599
600 for(n=0; n<=N_ACTION; n++) {
601 if (!action[n].state) {
602 action[n].state=TRUE;
603 action[n].x=(Lsx[nr] >> STEP)+16;
604 action[n].y=(Lsy[nr] >> STEP)+16;
605 action[n].start=157;
606 action[n].stop=162;
607 action[n].frame=157;
608 action[n].speed=6;
609 action[n].delay=6;
610 m=n;
611 goto nomoreloop;
612 }
613 }
614 nomoreloop:
615
616 /* Roll the SplitScreen Up */
617 for(sl=480; sl>=464; sl--) {
618 outb(0x18,0x3d4); /* LineCompare */
619 outb(sl&255,0x3d5);
620 outb(7,0x3d4); /* Overflow */
621 reg=inb(0x3d5);
622 outb(reg|((sl&256)>>4),0x3d5);
623 outb(9,0x3d4); /* Maximum Scanline */
624 reg=inb(0x3d5);
625 outb(reg|((sl&512)>>3),0x3d5);
626 vga_waitretrace();
627 }
628
629
630 for(n=0; n<=35; n++) {
631 AnimateAll();
632 }
633 action[m].state=FALSE;
634 putbox(Lsx[nr] >> STEP, Lsy[nr] >> STEP, shipmix);
635
636 getbox(old_x, old_y,shipback[nr]);
637
638 stampnum(levelnum);
639
640 while (keyboard_update()) {
641 AnimateAll();
642 putstamp(272,win_y+184,68,69,70);
643 }
644 while (!keyboard_update()) {
645 AnimateAll();
646 putstamp(272,win_y+184,68,69,70);
647 }
648 killstamp(272,win_y+184);
649
650 for(n=0; n<=4095; n++) {
651 score[n]=tmpscore[n];
652 }
653
654 AnimateAll(); /* Activate the new Score again */
655
656 while (keyboard_update()==0);
657
658
659 break;
660
661 }
662
663 wipe.active=255; /* Not Active */
664
665 if (blocktype==E_BONUS) {
666 beep(15000);
667
668 backptr=shipback[nr];
669
670 tmp1=37+(rand()&1);
671 tmp2=lx+(ly<<4)+(ly<<2);
672
673 level[tmp2]=tmp1;
674 objects[tmp2]=E_NULL;
675 getbox(x,y, backptr);
676
677 wipe.x=lx << 5;
678 wipe.y=ly << 5;
679 wipe.active=tmp1;
680 }
681 else
682 if (blocktype==E_WBONUS) {
683 beep(15000);
684
685 backptr=shipback[nr];
686
687 tmp2=lx+(ly<<4)+(ly<<2);
688
689 level[tmp2]=204;
690 objects[tmp2]=E_WATER;
691 getbox(x,y, backptr);
692 watermask(x,y,E_WATER,backptr);
693
694 wipe.x=lx << 5;
695 wipe.y=ly << 5;
696 wipe.active=204;
697 }
698
699
700 if (NumKeys==0) { /* == should be enough... */
701 NumKeys--;
702 level[stop_x+(stop_y<<4)+(stop_y<<2)]=41;
703 objects[stop_x+(stop_y<<4)+(stop_y<<2)]='x';
704 putbox(stop_x<<5, stop_y<<5, block[41]);
705 }
706
707 }
708 else {
709 if (thrust_len>lift_thrust) {
710 sVy[nr]-=128;
711 ship_flag=ship_flag & 0xfe;
712 fueling=FALSE;
713 }
714 }
715 }
716
717 if ((fueling) && ((ShipTime&7)==0)) {
718 ShipFuel+=16;
719 if (ShipFuel>1599) ShipFuel=1599;
720 updatescore();
721 }
722
723
724 Explode:
725 }
726
727 if (wflag<2) {
728 vga_waitretrace();
729
730 if (wipe.active!=255)
731 putbox(wipe.x,wipe.y,block[wipe.active]);
732
733 putbox(old_x, old_y, shipback[nr]);
734 putbox(x, y, shipmix);
735
736 for(n=0; n<=1023; n++) shipback[nr][n]=backptr[n];
737 }
738 }
739
740
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*-----------------------------------------------------------------setpixel */
5 void setpixel(int x, int y, uchar c) {
6
7 static long adr;
8
9 adr=(y<<9)+(y<<7)+x;
10 vga_setpage(adr >> 16);
11 *(vga_ptr+(adr&65535))=c;
12 }
13
14
15 /*-----------------------------------------------------------------setpixel */
16 uchar getpixel(int x, int y) {
17
18 static long adr;
19
20 adr=(y<<9)+(y<<7)+x;
21 vga_setpage(adr >> 16);
22 return *(vga_ptr+(adr&65535));
23 }
24
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /* Level code letters */
5 void putletter(short adr, short num) { /* adr=x+(y<<8) */
6
7 static short xx,yy;
8 static char *to;
9 static char *from;
10 static uchar colr;
11
12 to=&score[adr];
13 from=&fonts[(num<<3)+num+num];
14
15 for(yy=0; yy<=6; yy++) {
16 for(xx=0; xx<=8; xx++) {
17 colr=*(from++);
18 if (colr!=0) colr+=48;
19 *(to++)=colr;
20 }
21 to+=247;
22 from+=251; /*253*/
23 }
24 }
25
26 /* Score Digits */
27 void putdigit(short adr, short num) { /* adr=x+(y<<8) */
28
29 static short xx,yy;
30 static char *to;
31 static char *from;
32
33 to=&score[adr];
34 from=&digits[(num<<3)];
35
36 for(yy=0; yy<=5; yy++) {
37 for(xx=0; xx<=7; xx++) {
38 *(to++)=*(from++);
39 }
40 to+=248;
41 from+=80;
42 }
43 }
44
45 #define SCR_AB 55040
46 #define SCR_AP 65280
47 /*-----------------------------------------------------------------putscore */
48 void putscore(int nr, short y) {
49
50 #ifdef foo
51
52 static long adr;
53 static short xx,yy;
54 static uchar len,mask,col;
55 static uchar *dp;
56 static uchar *back;
57 static uchar *adr3;
58
59 adr=(y<<9)+(y<<7)+8;
60 mask=adr >> 16;
61 adr=adr & 65535;
62 dp=score;
63 back=scoreback;
64
65 vga_setpage(mask);
66
67 if (adr < SCR_AB) {
68
69 /* NORMAL */
70 for (yy=0; yy<=15; yy++) {
71 for (xx=0; xx<=255; xx++) {
72 adr3=vga_ptr+adr++;
73 *(back++)=*(adr3);
74 /* if ((col=*(dp++))!=0) */
75 *(adr3)=*(dp++);
76 }
77 adr+=384;
78 }
79
80 }
81 else {
82 /* BORDER */
83 for (yy=0; yy<=15; yy++) {
84
85
86 if (adr>SCR_AP) { /* Approaching */
87
88
89 if (adr<=65535) { /* SplitLine */
90
91 len=(65536-adr);
92
93 for(xx=len; xx>=1; xx--) {
94 adr3=vga_ptr+adr++;
95 *(back++)=*(adr3);
96 /* if ((col=*(dp++))!=0)*/
97 *(adr3)=*(dp++); /*col*/
98
99 }
100
101 mask++;
102 vga_setpage(mask);
103 adr=0;
104
105 for(xx=(256-len); xx>=1; xx--) {
106 adr3=vga_ptr+adr++;
107 *(back++)=*(adr3);
108 /* if ((col=*(dp++))!=0)*/
109 *(adr3)=*(dp++); /*col*/
110 }
111 }
112 else {
113 mask++;
114 vga_setpage(mask);
115 adr=adr & 65535;
116 for (xx=0; xx<=255; xx++) {
117 adr3=vga_ptr+adr++;
118 *(back++)=*(adr3);
119 /* if ((col=*(dp++))!=0)*/
120 *(adr3)=*(dp++);/*col*/
121
122 }
123 }
124 }
125 else {
126 for (xx=0; xx<=255; xx++) {
127 adr3=vga_ptr+adr++;
128 *(back++)=*(adr3);
129 /* if ((col=*(dp++))!=0) */
130 *(adr3)=*(dp++); /*col*/
131 }
132 }
133 adr+=384;
134 }
135 }
136 #endif
137 }
138
139 void putscoreOnly(int nr, short y) { /* Don't save the background */
140 #ifndef foo
141 static long adr;
142 static short xx,yy;
143 static uchar len,mask,col;
144 static uchar *dp;
145 static uchar *adr3;
146
147 adr=184; /*(y<<9)+(y<<7)+8;*/
148 mask=adr >> 16;
149 adr=adr & 65535;
150 dp=score;
151
152 vga_setpage(mask);
153
154 if (adr < SCR_AB) {
155
156 /* NORMAL */
157 for (yy=0; yy<=15; yy++) {
158 for (xx=0; xx<=255; xx++) {
159 adr3=vga_ptr+adr++;
160 *(adr3)=*(dp++);
161 }
162 adr+=384;
163 }
164
165 }
166 else {
167 /* BORDER */
168 for (yy=0; yy<=15; yy++) {
169
170
171 if (adr>SCR_AP) { /* Approaching */
172
173
174 if (adr<=65535) { /* SplitLine */
175
176 len=(65536-adr);
177
178 for(xx=len; xx>=1; xx--) {
179 adr3=vga_ptr+adr++;
180 *(adr3)=*(dp++); /*col*/
181
182 }
183
184 mask++;
185 vga_setpage(mask);
186 adr=0;
187
188 for(xx=(256-len); xx>=1; xx--) {
189 adr3=vga_ptr+adr++;
190 *(adr3)=*(dp++); /*col*/
191 }
192 }
193 else {
194 mask++;
195 vga_setpage(mask);
196 adr=adr & 65535;
197 for (xx=0; xx<=255; xx++) {
198 adr3=vga_ptr+adr++;
199 *(adr3)=*(dp++);/*col*/
200
201 }
202 }
203 }
204 else {
205 for (xx=0; xx<=255; xx++) {
206 adr3=vga_ptr+adr++;
207 *(adr3)=*(dp++); /*col*/
208 }
209 }
210 adr+=384;
211 }
212 }
213 #endif
214 }
215 void updatescore() { /* Terrible Routine... (optimal speed though) */
216
217 static short fuel;
218 static short time;
219 static short score;
220
221 fuel=Dec2BCD[ShipFuel>>4];
222 time=Dec2BCD[ShipTime>>7];
223 score=Dec2BCD[ShipScore];
224
225 putdigit(1322,fuel>>4);
226 putdigit(1330,fuel&15);
227
228 putdigit(1371,ShipLife);
229
230 putdigit(1415,time>>4);
231 putdigit(1423,time&15);
232
233 putdigit(1482,score>>16);
234 putdigit(1490,(score>>12)&15);
235 putdigit(1498,(score>>8)&15);
236 putdigit(1506,(score>>4)&15);
237 putdigit(1514,score&15);
238
239 putscoreOnly(0,0);
240
241 }
242
243
244
245
246 /*----------------------------------------------------------------killscore */
247 void killscore(int nr, short y, short newy) {
248 #ifdef foo
249 static long adr;
250 static short xx,yy,y1,y2;
251 static uchar len,mask;
252 static uchar *dp;
253 static uchar *back;
254
255 adr=(y<<9)+(y<<7)+8;
256 mask=adr >> 16;
257 adr=adr & 65535;
258 back=scoreback;
259
260 /*
261 if (y<newy) {
262 y1=y;
263 y2=newy;
264 }
265 else {
266 if (y>newy) {
267 y1=newy+16;
268 y2=y+16;
269 }
270 else
271 goto skipkillscore;
272 }
273 */
274
275 vga_setpage(mask);
276
277 if (adr < SCR_AB) {
278
279 /* NORMAL */
280 for (yy=0; yy<=15; yy++) {
281 for (xx=0; xx<=255; xx++) {
282 *(vga_ptr+adr++)=*(back++);
283 }
284 adr+=384;
285 }
286
287 }
288 else {
289 /* BORDER */
290 for (yy=0; yy<=15; yy++) {
291
292
293 if (adr>SCR_AP) { /* Approaching */
294
295
296 if (adr<=65535) { /* SplitLine */
297
298 len=(65536-adr);
299
300 for(xx=len; xx>=1; xx--) {
301 *(vga_ptr+adr++)=*(back++);
302 }
303
304 mask++;
305 vga_setpage(mask);
306 adr=0;
307
308 for(xx=(256-len); xx>=1; xx--) {
309 *(vga_ptr+adr++)=*(back++);
310 }
311 }
312 else {
313 mask++;
314 vga_setpage(mask);
315 adr=adr & 65535;
316 for (xx=0; xx<=255; xx++) {
317 *(vga_ptr+adr++)=*(back++);
318 }
319 }
320 }
321 else {
322 for (xx=0; xx<=255; xx++) {
323 *(vga_ptr+adr++)=*(back++);
324 }
325 }
326 adr+=384;
327 }
328 }
329 skipkillscore:
330 #endif
331 }
332
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4 /*--------------------------------------------------------------- centerShip */
5 /* Centers the scrolling picture in Y direction */
6
7 void centerShip(short nr) {
8
9 static short y;
10
11 y=(sy[nr] >> STEP)-240;
12
13 if (y<16)
14 y=16;
15 else
16 if (y>960)
17 y=960;
18
19 gl_setdisplaystart(0,y);
20
21 #ifdef ANIM
22
23 animate();
24
25 #endif
26
27
28 #ifdef SCORE
29 if ((y>16) || (y<960) || (ScoreChange)){
30 /* Don't draw the scoretable in the upper part of the screen */
31 y+=8; /* Why? - Because it's not moving....*/
32
33 /*fixscore();*/
34 killscore(nr,win_y,y);
35 win_y=y;
36 putscore(nr,win_y);
37 }
38 #endif
39 }
40
41
42 /*------------------------------------------------------------------ scrollY */
43 /* Scroll the screen from y1 -> y2 */
44
45 void scrollY(short nr, short y1, short y2) {
46
47 static int y,n;
48
49 if ((y1<950) || (y2<950)) { /* y2 -> changed ?????? */
50
51 if (y1<16)
52 y1=16;
53 else
54 if (y1>=968)
55 y1=968; /* 968 */
56
57 if (y2<24)
58 y2=24;
59 else
60 if (y2>968)
61 y2=968;
62
63 if (y1<y2) {
64 for(y=y1+8+4; y<=y2; y+=3) {
65
66 vga_waitretrace();
67
68
69 #ifdef ANIM
70 animate();
71 #endif
72
73 for(n=0; n<=delay_len; n++);
74
75 #ifdef SCORE
76 killscore(nr,win_y,y);
77 win_y=y;
78 putscore(nr,win_y);
79
80 gl_setdisplaystart(0,y-8);
81
82 #endif
83
84
85 /*
86 #ifdef SCORE
87 putscoreOnly(nr,win_y);
88 #endif
89 */
90
91 }
92 vga_waitretrace();
93
94 delay_len=delay_len<<1;
95 for(n=0; n<=delay_len; n++);
96 delay_len=delay_len>>1;
97
98 #ifdef SCORE
99 killscore(nr,win_y,y2);
100 win_y=y2;
101 putscore(nr,win_y);
102 #endif
103 gl_setdisplaystart(0,y2-8);
104
105 }
106 else {
107 for(y=y1+8-4; y>=y2; y-=3) {
108
109 vga_waitretrace();
110
111
112 #ifdef ANIM
113 animate();
114 #endif
115
116 for(n=0; n<=delay_len; n++);
117
118 #ifdef SCORE
119 killscore(nr,win_y,y);
120 win_y=y;
121 putscore(nr,win_y);
122 #endif
123 gl_setdisplaystart(0,y-8);
124
125
126 /*
127 #ifdef SCORE
128 putscoreOnly(nr,win_y);
129 #endif
130 */
131 }
132 vga_waitretrace();
133 gl_setdisplaystart(0,y2-8);
134
135 delay_len=delay_len<<1;
136 for(n=0; n<=delay_len; n++);
137 delay_len=delay_len>>1;
138
139
140 #ifdef SCORE
141 killscore(nr,win_y,y2);
142 win_y=y2;
143 putscore(nr,win_y);
144 #endif
145
146 }
147 }
148 }
Binary diff not shown
0 /*
1 LevelEditorData -> Level.gfx & Level.obj Converter (C) Sami Niemi 1995
2 */
3
4 #include<stdio.h>
5
6 FILE *fileptr;
7
8 char filename[32];
9
10 char buf20x45[20*45];
11
12 char buf40x45[40*45];
13
14
15 #define TRUE 1
16 #define FALSE 0
17
18 void loadit() {
19
20 char wrdy[4];
21
22 if ( ( fileptr=fopen(filename,"r") )!=NULL) {
23
24 do {
25 wrdy[0]=wrdy[1];
26 wrdy[1]=wrdy[2];
27 wrdy[2]=wrdy[3];
28 wrdy[3]=fgetc(fileptr);
29 } while((wrdy[0]!='S') ||
30 (wrdy[1]!='M') ||
31 (wrdy[2]!='A') ||
32 (wrdy[3]!='P'));
33
34 fread(buf20x45,20*45,1,fileptr);
35
36 fclose(fileptr);
37 }
38 else {
39 printf("ERROR!!!!!!!!! CAN'T LOAD THE LEVEL!\n");
40 exit(1);
41 }
42 };
43
44
45 /*
46 char chk_S(int xx, int yy) {
47
48 static int x,y;
49 static unsigned char ch;
50 static char bool;
51
52 xx--;
53 yy--;
54
55 bool=FALSE;
56 for(y=yy; y<=(yy+2); y++) {
57 for(x=xx; x<=(xx+2); x++) {
58 ch=buf40x45[x+y*40];
59 if (BACKGROUND) {
60 bool=TRUE;
61 goto out;
62 }
63 }
64 }
65 out:
66 return bool;
67 }
68
69 char chk_M(int xx, int yy) {
70
71 static int x,y;
72 static unsigned char ch;
73 static char bool;
74
75 xx-=2;
76 yy-=2;
77
78 bool=FALSE;
79 for(y=yy; y<=(4+yy); y++) {
80 for(x=xx; x<=(4+xx); x++) {
81 ch=buf40x45[x+y*40];
82 if (BACKGROUND) {
83 bool=TRUE;
84 goto out;
85 }
86 }
87 }
88 out:
89 return bool;
90 }
91 */
92
93
94 void procit() {
95
96 unsigned char ch,obj;
97
98 int x,y;
99
100 for(y=0; y<=44; y++) {
101 memcpy(&buf40x45[y*40],&buf20x45[y*20],20);
102 }
103
104 for(y=0; y<=44; y++) {
105 for(x=0; x<=19; x++) {
106
107 ch=buf40x45[x+y*40];
108
109 switch(ch) {
110
111 case 19: /* Start Field */
112 obj='s';
113 break;
114
115 case 28: /* Fuel Field */
116 obj='f';
117 break;
118
119
120 case 36: /* Background */
121 case 37:
122 case 38:
123 obj='.';
124 break;
125
126 case 41: /* Exit */
127 obj='x';
128 break;
129
130 case 51: /* Air Key */
131 obj='&';
132 break;
133
134 case 149: /* Water Fuel */
135 obj='%';
136 break;
137
138 case 209:
139 obj='F'; /* Extra Fuel */
140 break;
141
142 case 166:
143 case 175:
144 case 184:
145 obj='L'; /* Extra Life */
146 break;
147
148 case 162:
149 case 163:
150 case 164:
151 case 165:
152 obj='1'; /* Bonus 10 pts */
153 break;
154
155 case 170: /* Water Key */
156 obj='?';
157 break;
158
159 case 171:
160 case 172:
161 case 173:
162 obj='5';
163 break;
164
165 case 174:
166 obj='6';
167 break;
168
169 case 180:
170 case 181:
171 obj='2';
172 break;
173
174 case 182:
175 obj='T'; /* Extra Time */
176 break;
177
178 case 183:
179 case 189:
180 case 190:
181 obj='4';
182 break;
183
184 case 191:
185 case 192:
186 case 193:
187 obj='3';
188 break;
189
190 case 168: /* Destroyable Graphics (Ex. The Red Doors) */
191 case 176:
192 case 177:
193 case 178:
194 case 186:
195 obj='@';
196 break;
197
198 case 194: /* Water */
199 case 195:
200 case 196:
201 case 201:
202 case 202:
203 case 203:
204 case 204:
205 case 205:
206 case 210:
207 case 211:
208 case 212:
209 case 213:
210 case 214:
211 obj='w';
212 break;
213
214 case 198: /* Top Water */
215 case 199:
216 case 200:
217 obj='v';
218 break;
219
220 case 179: /* Water Bonus */
221 case 206:
222 obj='(';
223 break;
224
225 case 188:
226 obj=')';
227 break;
228
229 case 197:
230 obj='[';
231 break;
232
233 case 215:
234 obj=']';
235 break;
236
237 case 123: /* The Fan, you have to edit the wind yourself! */
238 case 124:
239 case 125: /* Wind: QWE */
240 case 132: /* A D */
241 case 133: /* ZXC */
242 case 134:
243 case 141:
244 case 142:
245 case 143:
246 case 150:
247 case 151:
248 case 152:
249 obj='S';
250 break;
251
252
253 default: /* Default */
254 obj='*';
255 break;
256 };
257
258
259 /* Air above the water */
260 if ( (y<45) && (((ch=buf40x45[x+y*40+40])>=198) && (ch<=200) ) )
261 obj='a';
262
263 buf40x45[20+x+y*40]=obj;
264 }
265 }
266 }
267
268
269 void saveit() {
270
271 int y;
272
273 char name[64];
274 char author[64];
275
276 strcpy(filename+strlen(filename),".obj");
277
278 if ( ( fileptr=fopen(filename,"w") )!=NULL) {
279
280 for(y=0; y<=44; y++) {
281 fwrite(&buf40x45[20+y*40],20,1,fileptr);
282 fprintf(fileptr,"--%d\n",y);
283 }
284 fprintf(fileptr,
285 "||||||||||||||||||||\n"
286 "00000000001111111111\n"
287 "01234567890123456789\n\n");
288
289 fclose(fileptr);
290 }
291 else {
292 printf("ERROR!!!!!!!!! CAN'T SAVE THE LEVEL OBJECT DATA!\n");
293 exit(1);
294 }
295
296 strcpy(filename+strlen(filename)-4,".gfx");
297
298 if ( ( fileptr=fopen(filename,"w") )!=NULL) {
299
300 for(y=0; y<=44; y++) {
301 fwrite(&buf40x45[y*40],20,1,fileptr);
302 }
303 fclose(fileptr);
304 }
305 else {
306 printf("ERROR!!!!!!!!! CAN'T SAVE THE LEVEL GFX DATA!\n");
307 exit(1);
308 }
309
310 }
311
312 main(int number, char *arg[]){
313
314 strcpy(filename,arg[1]);
315 printf("\n"
316 "GravityWars Level Converter v0.01, Sami Niemi -95\n\n"
317 "Converting '%s'\n\n",filename,filename);
318
319 loadit();
320 procit();
321 saveit();
322 }
323
324
325
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 The GW (GravityWars) format that I'm using in the picture files is just
1 a normal raw format for the pictures. I think...
2
0 TOOLS
1 -----
2
3 Just a little warning. These tools are all sorta hacks, so don't blame
4 me if they are low quality... :) (I just wanted to make the game work
5 in first hand.) All the levels (etc..) were designed with these tools
6 though!
7
8 EDITO:
9 The DOS based editor, which is written by the Gfx guy Pär Johannesson.
10 Seems there's a bug in one of the int86 calls, which makes it crash in
11 DOS emulator, and other PMODE systems. It works in DOS though. He hasn't
12 had time to fix it yet. Anyone? We really need an editor for Linux!
13
14 CONVERTER:
15 The converter is a program that is needed for converting the
16 EDITO.EXE output to .obj and .gfx files. You gotta write the .dat file
17 yourself. It's just a fast hack. So, it'll give a segmentation fault
18 without parameters..
19
20 LEVEL-SOURCE:
21 Inputfiles to EDITO.EXE.
22
23
0 /* GravityWars 1.1, (C) Sami Niemi -95 */
1
2 #include "memory.h"
3
4
5 /*----------------------------------------------------------------watermask */
6 /* Raterize the ship when in the water, and only to a certain height.. */
7
8 void watermask(short x, short y, uchar type, char *back_adr) {
9
10 static short xx,yy,n;
11 static uchar *mix_adr;
12 static uchar *ship_adr;
13 static uchar col;
14 static short m,start;
15
16 y-=9;
17
18 if (type==E_WATER)
19 start=0;
20 else {
21 start=(y & 65504)+32-y;
22 if (start>25) start=0;
23 }
24
25 m=(x^y);
26
27 mix_adr=shipmix;
28 ship_adr=ship[1+(g_flag & 1)][sa[0] >> 5];
29
30 n=0;
31 for(yy=0; yy<=31; yy++) {
32 for(xx=0; xx<=31; xx++,n++) {
33 col=ship_adr[n];
34 if (col!=0) {
35 if ( (((xx^yy)^m)&1) && (yy>start)) {
36 col=WATERCOLOR;
37 }
38 }
39 else {
40 col=back_adr[n];
41 }
42 mix_adr[n]=col;
43 }
44 }
45 }
46
47