~ubuntu-branches/ubuntu/intrepid/wing/intrepid

« back to all changes in this revision

Viewing changes to debian/patches/020_misc.diff

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hocevar (Debian packages)
  • Date: 2006-05-29 15:23:03 UTC
  • mfrom: (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20060529152303-m1nyh4gf9b9few04
Tags: 0.7-27
* debian/control:
  + Removed the wing/wing-data circular dependency.
  + Set policy to 3.7.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- wing-0.7.orig/util.h
 
2
+++ wing-0.7/util.h
 
3
@@ -27,9 +27,11 @@
 
4
 #define UTIL_H
 
5
 
 
6
 #include <ctype.h>
 
7
-#include <fstream.h>
 
8
+#include <fstream>
 
9
+#include <allegro.h> 
 
10
 #include "additional/apstring.h"
 
11
 #include "additional/apvector.h"
 
12
+#include "constants.h"
 
13
 
 
14
 //==============================================================================
 
15
 // Prototypes
 
16
@@ -49,5 +51,12 @@
 
17
 bool Confirm     ( BITMAP *draw_buffer,char *query,int xcoord,int ycoord);
 
18
 void LoadStrings (apvector <apstring> & strings, char * file );
 
19
 
 
20
-#include "util.cpp"      
 
21
+//==========================================================================
 
22
+template < class ItemTYPE >
 
23
+void Swap ( ItemTYPE & left,ItemTYPE & right )
 
24
+{
 
25
+       ItemTYPE temp = left;
 
26
+   left = right;
 
27
+   right = temp;
 
28
+}
 
29
 #endif
 
30
--- wing-0.7.orig/enemytype.h
 
31
+++ wing-0.7/enemytype.h
 
32
@@ -27,24 +27,24 @@
 
33
 #ifndef _ENEMYTYPE_H
 
34
 #define _ENEMYTYPE_H
 
35
 
 
36
-#include <fstream.h>
 
37
+#include <fstream>
 
38
 #include "bullettype.h"
 
39
 #include "animationtype.h"
 
40
 #include "util.h"
 
41
 
 
42
                struct EnemyNodeTYPE
 
43
       {
 
44
-                       int            xpos, ypos, dx,dy,health;
 
45
+                       EnemyNodeTYPE  *  next;              // pointer to next node
 
46
+                  EnemyNodeTYPE  *  back;              // pointer to previous node
 
47
                        bool                            attacking;
 
48
                        bool                            dead;         
 
49
-               unsigned int   TimeOfLastFired;
 
50
+               int   TimeOfLastFired;
 
51
                        WeaponEnum     weapon;
 
52
                EnemyEnum      TypeOfEnemy;
 
53
+                       int            xpos, ypos, dx,dy,health;
 
54
          StateEnum      state;
 
55
-         int                           explode_stage;
 
56
          int                           state_stage;
 
57
-                       EnemyNodeTYPE  *  next;              // pointer to next node
 
58
-                  EnemyNodeTYPE  *  back;              // pointer to previous node
 
59
+         int                           explode_stage;
 
60
 
 
61
                // constructors
 
62
 
 
63
@@ -118,11 +118,10 @@
 
64
       int num_enemies_attacking;
 
65
       int num_enemies_per_level;
 
66
       EnemyNodeTYPE * most_recent;          // ####################### is this necessary ???
 
67
-      BulletTYPE                enemy_bullets;
 
68
       AnimationTYPE   enemy_images;
 
69
       AnimationTYPE   explode_images;
 
70
       EnemyNodeTYPE * enemy_list;
 
71
+      BulletTYPE                enemy_bullets;
 
72
 };
 
73
 
 
74
-#include "enemytype.cpp"
 
75
-#endif
 
76
\ No newline at end of file
 
77
+#endif
 
78
--- wing-0.7.orig/scorelisttype.h
 
79
+++ wing-0.7/scorelisttype.h
 
80
@@ -28,8 +28,8 @@
 
81
 #ifndef _SCORELISTTYPE_H
 
82
 #define _SCORELISTTYPE_H
 
83
 
 
84
-#include <iostream.h>
 
85
-#include <fstream.h>
 
86
+#include <iostream>
 
87
+#include <fstream>
 
88
 #include <string.h>
 
89
 #include "util.h"
 
90
 #include "additional/apvector.h"
 
91
@@ -69,5 +69,4 @@
 
92
       apvector <ScoreTYPE> list;
 
93
 };
 
94
 
 
95
-#include "scorelisttype.cpp"
 
96
 #endif
 
97
--- wing-0.7.orig/animationtype.cpp
 
98
+++ wing-0.7/animationtype.cpp
 
99
@@ -1,3 +1,5 @@
 
100
+#include "animationtype.h"
 
101
+
 
102
 //=======================================================
 
103
 AnimationTYPE :: AnimationTYPE ( )
 
104
        : mySize ( 0 ), myImageBank ( 0 )
 
105
@@ -7,7 +9,7 @@
 
106
        : mySize ( 0 ), myImageBank ( 0 )
 
107
 {
 
108
    apstring source;
 
109
-   ifstream ImageFile;
 
110
+   std::ifstream ImageFile;
 
111
    ImageFile.open ( fileName );
 
112
    ImageFile >> mySize;
 
113
    myImageBank.resize ( mySize);
 
114
@@ -19,7 +21,7 @@
 
115
    {
 
116
       ImageFile >> source;
 
117
       myImageBank [index] = load_bmp ((char*) source.c_str(), myPal);
 
118
-      cout << "Loaded OK" << endl;
 
119
+      std::cout << "Loaded OK" << std::endl;
 
120
    }
 
121
    ImageFile.close ( );   
 
122
 }
 
123
@@ -30,8 +32,8 @@
 
124
 void AnimationTYPE :: LoadImages ( char * fileName )
 
125
 {
 
126
    apstring source;
 
127
-   BITMAP * Temp = NULL;
 
128
-   ifstream ImageFile;
 
129
+   //BITMAP * Temp = NULL;
 
130
+   std::ifstream ImageFile;
 
131
    ImageFile.open ( fileName );
 
132
    ImageFile >> mySize;
 
133
    myImageBank.resize ( mySize);
 
134
--- wing-0.7.orig/enemytype.cpp
 
135
+++ wing-0.7/enemytype.cpp
 
136
@@ -1,3 +1,6 @@
 
137
+#include "enemytype.h"
 
138
+extern volatile int timer;
 
139
+
 
140
 //========================================================================
 
141
 EnemyTYPE :: EnemyTYPE ( )
 
142
 :      num_enemies_left                ( 0 ),
 
143
@@ -28,14 +31,15 @@
 
144
 //========================================================================
 
145
 void EnemyTYPE :: UpdateAI ( int plane_x, int plane_y )
 
146
 {
 
147
-       EnemyNodeTYPE * scan = enemy_list;
 
148
-   for (; scan != NULL; scan = scan -> next)
 
149
+       EnemyNodeTYPE * scan = enemy_list, * next_scan;
 
150
+   for (; scan != NULL; scan = next_scan)
 
151
    {
 
152
+      next_scan = scan -> next;
 
153
       if ( scan -> health <= 0 && scan->explode_stage == ENEMY_EXPLODE_STAGES - 1 )
 
154
        DeleteNode ( scan );
 
155
       else
 
156
       {
 
157
-                       if ( scan -> attacking )
 
158
+                       if ( scan -> attacking && ! scan -> dead )
 
159
              {
 
160
                if ( (scan -> xpos >= plane_x && scan -> xpos < plane_x + PLANE_WIDTH) || (scan -> xpos + EnemyWidths [scan->TypeOfEnemy] >= plane_x && scan -> xpos + EnemyWidths [scan->TypeOfEnemy] < plane_x + PLANE_WIDTH))
 
161
           {
 
162
@@ -80,7 +84,7 @@
 
163
    explode_images.LoadImages ( explode_file );
 
164
    enemy_images.LoadImages ( sprite_file );
 
165
    enemy_bullets.LoadWeapon ( bullet_file );
 
166
-   ifstream enemy_file;
 
167
+   std::ifstream enemy_file;
 
168
    enemy_file.open ( level_file );
 
169
    enemy_file >> num_enemies_per_level;
 
170
    num_enemies_left = num_enemies_per_level;
 
171
@@ -118,7 +122,7 @@
 
172
        if  (num_enemies_left == num_enemies_per_level && num_enemies_attacking == 0 )
 
173
        most_recent = enemy_list;
 
174
 
 
175
-       while ( most_recent != NULL && most_recent -> attacking )
 
176
+       while ( most_recent != NULL && (most_recent -> attacking || most_recent -> dead) )
 
177
                most_recent = most_recent -> next;
 
178
 
 
179
    if ( most_recent != NULL )
 
180
--- wing-0.7.orig/collision.h
 
181
+++ wing-0.7/collision.h
 
182
@@ -13,6 +13,7 @@
 
183
 
 
184
 #include "constants.h"
 
185
 #include "additional/apvector.h"
 
186
+#include "bullettype.h"
 
187
 
 
188
 
 
189
 struct spr_mask                // Sprite Mask
 
190
@@ -22,10 +23,10 @@
 
191
  int max_chunk;                                // The number of the last 32 bit chunk in the sprite's bitmap
 
192
  unsigned long int sp_mask[NUM_Y][NUM_CHUNKS]; // The (NUM_Y x (NUM_CHUNKS x 32)) bit Sprite Mask
 
193
 };
 
194
+typedef struct spr_mask spr_mask;
 
195
 
 
196
 void init_sp_bb( apvector<spr_mask> & mask_list  );
 
197
 void mk_spr_mask           (BITMAP *s3, spr_mask & mask);
 
198
 int  check_ppcollision     (const spr_mask & mask1 , int spr1x, int spr1y, const spr_mask & mask2, int spr2x, int spr2y);
 
199
 
 
200
-#include "collision.cpp"
 
201
-#endif
 
202
\ No newline at end of file
 
203
+#endif
 
204
--- wing-0.7.orig/animationtype.h
 
205
+++ wing-0.7/animationtype.h
 
206
@@ -29,7 +29,8 @@
 
207
 
 
208
 #include "additional/apstring.h"
 
209
 #include "additional/apvector.h"
 
210
-#include <fstream.h>
 
211
+#include <allegro.h>
 
212
+#include <fstream>
 
213
 
 
214
 class AnimationTYPE
 
215
 {
 
216
@@ -53,6 +54,5 @@
 
217
       apvector < BITMAP* > myImageBank;
 
218
 };
 
219
 
 
220
-#include "animationtype.cpp"
 
221
 #endif
 
222
 
 
223
--- wing-0.7.orig/star.cpp
 
224
+++ wing-0.7/star.cpp
 
225
@@ -1,3 +1,8 @@
 
226
+#include "star.h"
 
227
+
 
228
+STAR_TYPE  stars [256];
 
229
+
 
230
+
 
231
 //****************************************************************************
 
232
 void Init_Stars()
 
233
 {
 
234
--- wing-0.7.orig/main.cpp
 
235
+++ wing-0.7/main.cpp
 
236
@@ -18,8 +18,8 @@
 
237
  // these must be declared volatile so the optimiser doesn't mess up
 
238
  volatile int timer = 0;
 
239
 
 
240
-#include <iostream.h>                          // for standard I/O routines used in debugging
 
241
-#include "allegro.h"                                   //      libraries for graphics and sound
 
242
+#include <iostream>                            // for standard I/O routines used in debugging
 
243
+#include <allegro.h>                                   //      libraries for graphics and sound
 
244
 #include "constants.h"                         // constants for program
 
245
 #include "collision.h"         // fucnctions for collision detection
 
246
 #include "util.h"                                              // additional functions for program
 
247
@@ -31,6 +31,7 @@
 
248
 #include "sound.h"                                     // sound functions
 
249
 #include "star.h"                                              // functions for stars
 
250
 #include <stdio.h>                             // for rand()
 
251
+#include <signal.h>                            // for signal()
 
252
 #define VERSION 0.7                    // Keep Track of the Version
 
253
 
 
254
 
 
255
@@ -46,6 +47,7 @@
 
256
    EnemyTYPE * enemies;
 
257
    int level_index;
 
258
    apvector <apstring> level_names;
 
259
+   bool       windowed = false;
 
260
 
 
261
 
 
262
 //****************************************************************************
 
263
@@ -72,8 +74,10 @@
 
264
 //****************************************************************************
 
265
 // Functions
 
266
 
 
267
-int main()
 
268
+int main(int argc, char **argv)
 
269
 {
 
270
+  chdir("/usr/share/games/wing");
 
271
+  if(argc>1 && !strcmp(argv[1],"-w")) windowed = true;
 
272
    Program_Init ();
 
273
    Active_Menu ( );
 
274
        Game_Shutdown ();
 
275
@@ -88,13 +92,21 @@
 
276
 }
 
277
 END_OF_FUNCTION(inc_x);
 
278
 //****************************************************************************
 
279
+void Segv_Handler ( int sig )
 
280
+{
 
281
+   signal(SIGSEGV, SIG_IGN);
 
282
+   std::cerr << "ouch, we crashed! resetting keyboard state..." << std::endl;
 
283
+   remove_keyboard();
 
284
+}
 
285
+//****************************************************************************
 
286
 void Program_Init ()
 
287
 {
 
288
        // turn on Allegro, initialize, set graphics mode
 
289
    allegro_init();
 
290
-   set_gfx_mode( GFX_AUTODETECT, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
 
291
+   set_gfx_mode( windowed ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
 
292
    install_keyboard();
 
293
 
 
294
+signal(SIGSEGV, Segv_Handler);
 
295
    // allocate the memory buffer -- double buffering, load palette
 
296
    buffer = create_bitmap (SCREEN_W, SCREEN_H);
 
297
    menu_buffer = create_bitmap (SCREEN_W, SCREEN_H);
 
298
@@ -153,6 +165,18 @@
 
299
          fade_in ( MenuPal,5 );
 
300
          entering_menu = false;
 
301
       }
 
302
+
 
303
+// Emergency quit with Escape
 
304
+
 
305
+      if ( key [KEY_ESC] )
 
306
+      {
 
307
+               play_sample(menu_beep , 127, 127, 1000, 0);
 
308
+                       clear_keybuf();
 
309
+                       break;
 
310
+      }
 
311
+
 
312
+
 
313
+      
 
314
                // bitmask to determine if 1st mouse button is pressed
 
315
        if ( mouse_x >= BUTTON_LEFT && mouse_x <= BUTTON_RIGHT)
 
316
                {
 
317
@@ -229,14 +253,14 @@
 
318
    set_pallete ( MenuPal );
 
319
        bool changed = false;
 
320
        ScoreListTYPE score_list;
 
321
-   score_list.ReadFromFile ("scores.dat");
 
322
+   score_list.ReadFromFile ("/var/games/wing.scores");
 
323
    SAMPLE *menu_beep;
 
324
    menu_beep = load_sample ("sound/menuitem.wav");
 
325
 
 
326
    AnimationTYPE  HS_Images;
 
327
    HS_Images.LoadImages ( "images/hsimages.dat");
 
328
    BITMAP * score_menu_buffer = NULL;
 
329
-   BITMAP * title_sprite = load_bmp ( "images/hstitle.bmp", MenuPal );
 
330
+   //BITMAP * title_sprite = load_bmp ( "images/hstitle.bmp", MenuPal );
 
331
    score_menu_buffer = create_bitmap (SCREEN_W, SCREEN_H);
 
332
    clear (score_menu_buffer);
 
333
 
 
334
@@ -250,12 +274,13 @@
 
335
       score_list.DisplayList ( score_menu_buffer );
 
336
       show_mouse ( score_menu_buffer );
 
337
                blit(score_menu_buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 
338
+               usleep(10000);
 
339
 
 
340
       if ( key [KEY_ESC] )
 
341
       {
 
342
                play_sample(menu_beep , 127, 127, 1000, 0);
 
343
              if (changed)
 
344
-                       score_list.WriteToFile ("scores.dat");
 
345
+                       score_list.WriteToFile ("/var/games/wing.scores");
 
346
                        clear_keybuf();
 
347
                        break;
 
348
       }
 
349
@@ -282,7 +307,7 @@
 
350
             {
 
351
                play_sample(menu_beep , 127, 127, 1000, 0);
 
352
                         if (changed)
 
353
-                                       score_list.WriteToFile ("scores.dat");
 
354
+                                       score_list.WriteToFile ("/var/games/wing.scores");
 
355
                                        clear_keybuf();
 
356
                                break;
 
357
                                }
 
358
@@ -303,7 +328,7 @@
 
359
        clear (screen);
 
360
    set_palette (MenuPal);
 
361
        ScoreListTYPE score_list;
 
362
-   score_list.ReadFromFile ("scores.dat");
 
363
+   score_list.ReadFromFile ("/var/games/wing.scores");
 
364
 
 
365
    if ( plane_object.GetScore() < score_list.Lowest_Score () )
 
366
        return;
 
367
@@ -312,7 +337,7 @@
 
368
    if ( name.length() == 0 )
 
369
        name = "anonymous";
 
370
    score_list.InsertNewEntry ( name, plane_object.GetScore() );
 
371
-   score_list.WriteToFile ("scores.dat");
 
372
+   score_list.WriteToFile ("/var/games/wing.scores");
 
373
    set_pallete ( MenuPal );
 
374
        Display_High_Scores ();
 
375
  }
 
376
@@ -326,7 +351,7 @@
 
377
    AnimationTYPE  Option_Images;
 
378
    Option_Images.LoadImages ( "images/oimages.dat");
 
379
    BITMAP * option_menu_buffer = NULL;
 
380
-   BITMAP * title_sprite = load_bmp ( "images/otitle.bmp", MenuPal );
 
381
+   //BITMAP * title_sprite = load_bmp ( "images/otitle.bmp", MenuPal );
 
382
    option_menu_buffer = create_bitmap (SCREEN_W, SCREEN_H);
 
383
    clear (option_menu_buffer);
 
384
 
 
385
@@ -342,6 +367,7 @@
 
386
       textprintf(option_menu_buffer, font, 320 , 280, 15, strcpy (temp,NumToString (stream_vol).c_str()));
 
387
       show_mouse ( option_menu_buffer );
 
388
                blit(option_menu_buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 
389
+               usleep(10000);
 
390
 
 
391
       if ( key [KEY_ESC] )
 
392
       {
 
393
@@ -452,11 +478,11 @@
 
394
        intro_counter --;
 
395
                Move_Stars ();
 
396
           plane_object.Display ( buffer );
 
397
-       char temp [3];
 
398
+       //char temp [3];
 
399
       textprintf (buffer, font, 300 , 250, 15, "Level 1");
 
400
 
 
401
       blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); // Copy Buffer to VRam
 
402
-      while (( timer - startTimer <= 15 ));
 
403
+      while (( timer - startTimer <= 15 )) usleep(2000);
 
404
              startTimer = timer;
 
405
    }
 
406
 }
 
407
@@ -466,7 +492,7 @@
 
408
 
 
409
    bool ok_to_add = false;
 
410
    int pause_counter = NEW_LEVEL_PAUSE;
 
411
-       int rand_attackers;
 
412
+       int rand_attackers = 0;
 
413
    int startTimer = 0;
 
414
    int add_enemy_timer = 0;
 
415
    int add_group_timer = 0;
 
416
@@ -542,7 +568,7 @@
 
417
           }
 
418
                }         
 
419
 
 
420
-      if ( plane_object.GetHealth () <= 0 )
 
421
+      if ( plane_object.GetHealth () <= 0 && !plane_object.GetDead () )
 
422
       {
 
423
        plane_object.SetDead (true);
 
424
              play_sample(die_sound , sample_vol, 127, 1000, 0);
 
425
@@ -551,7 +577,7 @@
 
426
          fire_sound = shoot_sounds [laser];
 
427
                }
 
428
 
 
429
-      if ( plane_object.GetNumLives () == 0 )
 
430
+      if ( plane_object.GetNumLives () == 0 && !plane_object.GetDead () )
 
431
       {
 
432
                clear_keybuf ();
 
433
        GAME_STARTED = false;
 
434
@@ -570,22 +596,22 @@
 
435
       if (!(key[KEY_LEFT] || key[KEY_RIGHT]) || (key[KEY_LEFT] && key[KEY_RIGHT] ))
 
436
          plane_object.Normalize ( );
 
437
 
 
438
-      if ( key[KEY_1] )
 
439
+      if ( key[KEY_F1] || key[KEY_1] )
 
440
       {
 
441
                        plane_object.SetWeapon ( laser );
 
442
          fire_sound = shoot_sounds [laser];
 
443
                }
 
444
-      if ( key[KEY_2] )
 
445
+      if ( key[KEY_F2] || key[KEY_2] )
 
446
       {
 
447
                        plane_object.SetWeapon ( minigun );
 
448
          fire_sound = shoot_sounds [minigun];
 
449
                }
 
450
-      if ( key[KEY_3] )
 
451
+      if ( key[KEY_F3] || key[KEY_3] )
 
452
                {
 
453
                        plane_object.SetWeapon ( plasma );
 
454
          fire_sound = shoot_sounds [plasma];
 
455
                }
 
456
-      if ( key[KEY_4] )
 
457
+      if ( key[KEY_F4] || key[KEY_4] )
 
458
       {
 
459
                        plane_object.SetWeapon ( torpedo );
 
460
          fire_sound = shoot_sounds [torpedo];
 
461
@@ -623,7 +649,7 @@
 
462
       blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); // Copy Buffer to VRam
 
463
 
 
464
       // Lock at 60FPS -- 15 represents 15 milliseconds
 
465
-      while (( timer - startTimer <= 15 ));
 
466
+      while (( timer - startTimer <= 15 )) usleep(2000);
 
467
              startTimer = timer;
 
468
    }
 
469
    stream_stop();
 
470
@@ -650,6 +676,7 @@
 
471
 void Display_Menu ()
 
472
 {
 
473
        blit(menu_buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 
474
+       usleep(10000);
 
475
 }
 
476
 
 
477
 //****************************************************************************
 
478
@@ -661,7 +688,7 @@
 
479
 
 
480
    for (; enemy_node != NULL; enemy_node = enemy_node -> next )
 
481
    {
 
482
-       if ( enemy_node -> attacking && enemy_node -> ypos + EnemyHeights [enemy_node->TypeOfEnemy] > 0)
 
483
+       if ( ! enemy_node -> dead && enemy_node -> attacking && enemy_node -> ypos + EnemyHeights [enemy_node->TypeOfEnemy] > 0)
 
484
       {
 
485
                        for ( ; bullet_list != NULL ; bullet_list = bullet_list -> next )
 
486
          {
 
487
@@ -673,7 +700,7 @@
 
488
                                }
 
489
                        }
 
490
                        bullet_list = plane_bullets->GetBulletList ();
 
491
-                       if ( check_ppcollision ( enemies.myEnemyMasks[enemy_node->TypeOfEnemy],enemy_node->xpos, enemy_node->ypos, *(plane_object.GetMask()), plane_object.GetXPos(), plane_object.GetYPos() ))
 
492
+                       if ( plane_object.GetVuln () && check_ppcollision ( enemies.myEnemyMasks[enemy_node->TypeOfEnemy],enemy_node->xpos, enemy_node->ypos, *(plane_object.GetMask()), plane_object.GetXPos(), plane_object.GetYPos() ))
 
493
              {
 
494
                                plane_object.SetHealth ( 0 );
 
495
           enemy_node-> health = 0 ;
 
496
@@ -688,7 +715,7 @@
 
497
                }
 
498
                }
 
499
        }
 
500
-   if ( ! plane_object.GetDead () )
 
501
+   if ( plane_object.GetVuln () )
 
502
    {
 
503
           BulletTYPE * enemy_bullets = enemies.GetBullets ();
 
504
        BulletNodeTYPE * enemy_bullet_list = enemy_bullets->GetBulletList();
 
505
--- wing-0.7.orig/bullettype.h
 
506
+++ wing-0.7/bullettype.h
 
507
@@ -30,7 +30,7 @@
 
508
 #include "animationtype.h"
 
509
 #include "collision.h"
 
510
 #include "additional/apvector.h"
 
511
-#include <fstream.h>
 
512
+#include <fstream>
 
513
 #include "util.h"
 
514
 
 
515
 struct BulletNodeTYPE
 
516
@@ -70,14 +70,13 @@
 
517
       void UpdateAndDisplayShot  ( BITMAP * buffer );   // updates shot queue
 
518
       BulletNodeTYPE * GetBulletList   (  );
 
519
       BITMAP   * GetImage ( int index );
 
520
-      spr_mask * GetMask ( int index );
 
521
+      struct spr_mask * GetMask ( int index );
 
522
 
 
523
    private :
 
524
-       int                  myNumBullets;
 
525
           BulletNodeTYPE  *   myBullets;
 
526
+       int                  myNumBullets;
 
527
       AnimationTYPE myBulletImages;
 
528
       apvector <spr_mask > myBulletMask;
 
529
 };
 
530
 
 
531
-#include "bullettype.cpp"
 
532
 #endif
 
533
--- wing-0.7.orig/sound.cpp
 
534
+++ wing-0.7/sound.cpp
 
535
@@ -1,3 +1,11 @@
 
536
+#include "sound.h"
 
537
+
 
538
+AUDIOSTREAM *stream = NULL;
 
539
+FILE        *stream_file  = NULL;
 
540
+WFXSTREAM    wfx;
 
541
+int                    stream_vol = DEFAULT_STREAM_VOL;
 
542
+int                    sample_vol = DEFAULT_SAMPLE_VOL;
 
543
+
 
544
 void stream_callback(void)
 
545
 {
 
546
        if (stream_file && stream)
 
547
@@ -67,9 +75,9 @@
 
548
 
 
549
 void stream_stop()
 
550
 {
 
551
-  fclose(stream_file);
 
552
-  stream_file = NULL;
 
553
-  stop_audio_stream(stream);
 
554
+//  fclose(stream_file);
 
555
+//  stream_file = NULL;
 
556
+//  stop_audio_stream(stream);
 
557
 }
 
558
 
 
559
 
 
560
--- wing-0.7.orig/planetype.cpp
 
561
+++ wing-0.7/planetype.cpp
 
562
@@ -1,3 +1,5 @@
 
563
+#include "planetype.h"
 
564
+extern volatile int timer;
 
565
 
 
566
 //========================================================================
 
567
 PlaneTYPE :: PlaneTYPE ( )
 
568
@@ -7,6 +9,7 @@
 
569
   myImageIndex ( 0 ),
 
570
   explode_stage ( 0 ),  
 
571
   last_shot_time ( 0 ),
 
572
+  invuln_count ( 0 ),
 
573
   myScore              (0),
 
574
   myNumLives   ( MAX_NUM_LIVES )
 
575
 { }
 
576
@@ -80,6 +83,11 @@
 
577
        return dead;
 
578
 }
 
579
 //========================================================================
 
580
+bool PlaneTYPE :: GetVuln ( ) const
 
581
+{
 
582
+       return !dead && !invuln_count;
 
583
+}
 
584
+//========================================================================
 
585
 int PlaneTYPE :: GetNumLives ( ) const
 
586
 {
 
587
        return myNumLives;
 
588
@@ -94,7 +102,12 @@
 
589
 {
 
590
        myBullets.UpdateAndDisplayShot ( buffer );
 
591
    if ( ! dead )
 
592
-               draw_sprite ( buffer, myArrayOfImages.GetImage( myImageIndex ), myXPos, myYPos );
 
593
+   {
 
594
+               if (invuln_count > 0)
 
595
+                       invuln_count--;
 
596
+                if (!(invuln_count & 1))
 
597
+                       draw_sprite ( buffer, myArrayOfImages.GetImage( myImageIndex ), myXPos, myYPos );
 
598
+   }
 
599
        else if ( explode_stage != PLANE_EXPLODE_STAGES - 1 )
 
600
    {
 
601
                draw_sprite ( buffer, explode_images.GetImage( explode_stage ), myXPos, myYPos );
 
602
@@ -183,5 +196,6 @@
 
603
    myImageIndex = myArrayOfImages.Length () / 2;
 
604
    dead = false;
 
605
    explode_stage = 0;
 
606
+   invuln_count = 100;
 
607
 }
 
608
 //=======================================================================
 
609
--- wing-0.7.orig/planetype.h
 
610
+++ wing-0.7/planetype.h
 
611
@@ -27,7 +27,7 @@
 
612
 #ifndef _PlaneTYPE_H
 
613
 #define _PlaneTYPE_H
 
614
 
 
615
-#include <fstream.h>
 
616
+#include <fstream>
 
617
 #include "bullettype.h"
 
618
 #include "animationtype.h"
 
619
 #include "util.h"
 
620
@@ -63,6 +63,7 @@
 
621
       BITMAP *    GetImage      ( int index ) const;
 
622
       WeaponEnum  GetWeapon     ( ) const;
 
623
       bool                     GetDead           ( ) const;
 
624
+      bool                     GetVuln           ( ) const;
 
625
       long int    GetScore      ( ) const;
 
626
       int         GetXPos       ( ) const;
 
627
       int         GetYPos       ( ) const;
 
628
@@ -82,11 +83,11 @@
 
629
       BulletTYPE          myBullets;
 
630
       AnimationTYPE       myArrayOfImages;
 
631
       AnimationTYPE       explode_images;
 
632
-      unsigned int          last_shot_time;
 
633
+      int                 last_shot_time;
 
634
+      int                 invuln_count;
 
635
       long int                           myScore;
 
636
       int                 myNumLives;
 
637
       apvector <spr_mask > myPlaneMasks;
 
638
 };
 
639
 
 
640
-#include "planetype.cpp"
 
641
 #endif
 
642
--- wing-0.7.orig/star.h
 
643
+++ wing-0.7/star.h
 
644
@@ -1,6 +1,9 @@
 
645
 #ifndef _STAR_H
 
646
 #define _STAR_H
 
647
 
 
648
+#include <allegro.h>
 
649
+#include "constants.h"
 
650
+
 
651
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
652
  * StarTYPE                                                                                                                                                                      *
 
653
  *                                                                                                                                                                                                         *
 
654
@@ -15,7 +18,7 @@
 
655
 } STAR, *STAR_PTR;
 
656
 
 
657
 
 
658
-STAR_TYPE  stars [256];
 
659
+extern STAR_TYPE  stars [];
 
660
 
 
661
 
 
662
 void Draw_Stars ( BITMAP * buffer );
 
663
@@ -23,5 +26,4 @@
 
664
 void Init_Stars ( );
 
665
 
 
666
 
 
667
-#include "star.cpp"
 
668
 #endif
 
669
--- wing-0.7.orig/scorelisttype.cpp
 
670
+++ wing-0.7/scorelisttype.cpp
 
671
@@ -1,3 +1,5 @@
 
672
+#include "scorelisttype.h"
 
673
+
 
674
 //==========================================================================
 
675
 ScoreListTYPE :: ScoreListTYPE ()
 
676
 {
 
677
@@ -19,41 +21,54 @@
 
678
 //==========================================================================
 
679
 void ScoreListTYPE :: ReadFromFile ( char * file_name )
 
680
 {
 
681
-       ifstream score_file;
 
682
+   apstring newname;
 
683
+   int newscore;
 
684
+       std::ifstream score_file;
 
685
    score_file.open (file_name);
 
686
 
 
687
    // I love c++
 
688
-   for ( int i=0; i < NUM_HIGH_SCORES && score_file >> list[i].name >> list[i].score; i++ )
 
689
-       ;
 
690
+   for ( int i=0; i < NUM_HIGH_SCORES; i++ ) {
 
691
+       score_file >> newname;
 
692
+       score_file >> newscore;
 
693
+       if (!newscore || !score_file.good())
 
694
+               break;
 
695
+       list[i].name = newname;
 
696
+       list[i].score = newscore;
 
697
+       }
 
698
    score_file.close ();
 
699
 }
 
700
 //==========================================================================
 
701
 void ScoreListTYPE :: DisplayList ( BITMAP * buffer )
 
702
 {
 
703
        char temp_c_str [10];
 
704
-       for ( int i = 1; i <= NUM_HIGH_SCORES; i++ )
 
705
+       for ( int i = 0; i < NUM_HIGH_SCORES; i++ )
 
706
    {
 
707
       apstring converter ("");
 
708
-      converter = NumToString ( i );
 
709
+      converter = NumToString ( i+1 );
 
710
       converter += '.';
 
711
 
 
712
-      strcpy (temp_c_str, converter.c_str());
 
713
-       textprintf(buffer, font , 300 , 150+20*i, 15, temp_c_str );
 
714
-      strcpy (temp_c_str,list [i-1].name.c_str());
 
715
-       textprintf(buffer, font , 328 , 150+20*i, 15,  temp_c_str );
 
716
-      converter = NumToString (list [i-1].score);
 
717
-      strcpy (temp_c_str,converter.c_str());
 
718
-       textprintf(buffer, font , 430 , 150+20*i, 15,  temp_c_str );
 
719
+      strncpy (temp_c_str, converter.c_str(), 10);
 
720
+      temp_c_str[9] = '\0';
 
721
+       textprintf(buffer, font , 300 , 170+20*i, 15, temp_c_str );
 
722
+
 
723
+      strncpy (temp_c_str, list [i].name.c_str(), 10);
 
724
+      temp_c_str[9] = '\0';
 
725
+       textprintf(buffer, font , 328 , 170+20*i, 15,  temp_c_str );
 
726
+
 
727
+      converter = NumToString (list [i].score);
 
728
+      strncpy (temp_c_str, converter.c_str(), 10);
 
729
+      temp_c_str[9] = '\0';
 
730
+       textprintf(buffer, font , 430 , 170+20*i, 15,  temp_c_str );
 
731
    }
 
732
 
 
733
 }
 
734
 //==========================================================================
 
735
 void ScoreListTYPE :: WriteToFile ( char * file_name )
 
736
 {
 
737
-       ofstream score_file;
 
738
+       std::ofstream score_file;
 
739
    score_file.open (file_name);
 
740
    for ( int i = 0; i < NUM_HIGH_SCORES; i++ )
 
741
-               score_file << list [i].name <<" "<<list[i].score << endl;
 
742
+               score_file << list [i].name <<" "<<list[i].score << std::endl;
 
743
    score_file.close ();
 
744
 }
 
745
 //==========================================================================
 
746
--- wing-0.7.orig/collision.cpp
 
747
+++ wing-0.7/collision.cpp
 
748
@@ -1,3 +1,5 @@
 
749
+#include "collision.h"
 
750
+
 
751
 //****************************************************************************
 
752
 void init_sp_bb( apvector<spr_mask> & mask_list  )
 
753
 // This function initializes the bounding box used to do the initial collision detection
 
754
@@ -28,7 +30,7 @@
 
755
 
 
756
          for(z=0; z<NUM_CHUNKS; z++)
 
757
      {
 
758
-                       for (x1=(z*32); x1<((z*32)+32); x1++)
 
759
+                       for (x1=(z*32); x1<(z*32+32); x1++)
 
760
          {
 
761
                                p=getpixel(s3,x1,y1);
 
762
                           if (p>0)
 
763
@@ -39,7 +41,7 @@
 
764
                        bb_height=y1;
 
765
                              if (x1>bb_width)
 
766
                        bb_width=x1;
 
767
-                       mask.sp_mask[y1][z]+=0x80000000 >> (x1 - ((z+1)*32));
 
768
+                       mask.sp_mask[y1][z]+=1<<(z*32+32-1-x1);
 
769
                           }
 
770
                        }
 
771
                }
 
772
--- wing-0.7.orig/additional/apvector.cpp
 
773
+++ wing-0.7/additional/apvector.cpp
 
774
@@ -4,9 +4,10 @@
 
775
 //
 
776
 //****************************************************************
 
777
 
 
778
-#include <iostream.h>
 
779
+#include <iostream>
 
780
 #include <stdlib.h>
 
781
 #include <assert.h>
 
782
+#include "apvector.h"
 
783
 
 
784
 //****************************************************************
 
785
 //********           Constructors / destructor         ***********
 
786
@@ -111,8 +112,8 @@
 
787
 
 
788
 {
 
789
     if (k < 0 || k >= mSize) {
 
790
-        cerr << "Illegal vector index: " << k << " max index = "
 
791
-             << (mSize-1) << endl;
 
792
+        std::cerr << "Illegal vector index: " << k << " max index = "
 
793
+                  << (mSize-1) << std::endl;
 
794
         abort();
 
795
     }
 
796
     return mList[k]; 
 
797
@@ -128,8 +129,8 @@
 
798
 
 
799
 {
 
800
     if (k < 0 || k >= mSize) {
 
801
-        cerr << "Illegal vector index: " << k << " max index = "
 
802
-             << (mSize-1) << endl;
 
803
+        std::cerr << "Illegal vector index: " << k << " max index = "
 
804
+                  << (mSize-1) << std::endl;
 
805
         abort();
 
806
     }
 
807
     return mList[k]; 
 
808
--- wing-0.7.orig/additional/apstring.h
 
809
+++ wing-0.7/additional/apstring.h
 
810
@@ -1,8 +1,8 @@
 
811
 #ifndef _APSTRING_H
 
812
 #define _APSTRING_H
 
813
 
 
814
-#include <iostream.h>
 
815
-#include "bool.h"
 
816
+#include <iostream>
 
817
+//#include "bool.h"
 
818
 
 
819
 //****************************************************************
 
820
 //
 
821
@@ -79,9 +79,9 @@
 
822
 
 
823
 // I/O functions:
 
824
 
 
825
-ostream &operator<< (ostream &os, const apstring &str);
 
826
-istream &operator>> (istream &is, apstring &str); 
 
827
-istream &getline(istream &is, apstring &str);  
 
828
+std::ostream &operator<< (std::ostream &os, const apstring &str);
 
829
+std::istream &operator>> (std::istream &is, apstring &str); 
 
830
+std::istream &getline(std::istream &is, apstring &str);  
 
831
           
 
832
 // Concatenation operators:
 
833
 
 
834
@@ -98,7 +98,7 @@
 
835
 bool operator>  (const apstring &str1, const apstring &str2);  
 
836
 bool operator>= (const apstring &str1, const apstring &str2);
 
837
 
 
838
-#include "apstring.cpp"
 
839
+//#include "apstring.cpp"
 
840
 // Continued in apstring.cpp...
 
841
 
 
842
 
 
843
--- wing-0.7.orig/additional/apstring.cpp
 
844
+++ wing-0.7/additional/apstring.cpp
 
845
@@ -141,8 +141,8 @@
 
846
 
 
847
 {
 
848
     if (k < 0 || k >= mLength) {
 
849
-        cerr << "index out of range: " << k << " string: "
 
850
-             << mCstring << endl;
 
851
+        std::cerr << "index out of range: " << k << " string: "
 
852
+                  << mCstring << std::endl;
 
853
         assert (0 <= k && k < mLength);
 
854
     }
 
855
     return mCstring[k];
 
856
@@ -157,8 +157,8 @@
 
857
 
 
858
 {
 
859
     if (k < 0 || k >= mLength) {
 
860
-        cerr << "index out of range: " << k << " string: "
 
861
-             << mCstring << endl;
 
862
+        std::cerr << "index out of range: " << k << " string: "
 
863
+                  << mCstring << std::endl;
 
864
         assert(0 <= k && k < mLength);
 
865
     }
 
866
     return mCstring[k];
 
867
@@ -314,7 +314,7 @@
 
868
 //********             I/O functions                 *************
 
869
 //****************************************************************
 
870
 
 
871
-ostream &operator<< (ostream &os, const apstring &str)
 
872
+std::ostream &operator<< (std::ostream &os, const apstring &str)
 
873
 
 
874
 // Inserts the string into os and returns os.
 
875
 
 
876
@@ -324,13 +324,14 @@
 
877
 
 
878
 //****************************************************************
 
879
 
 
880
-istream &operator>> (istream &is, apstring &str)
 
881
+std::istream &operator>> (std::istream &is, apstring &str)
 
882
 
 
883
 // Skips all white space and reads one word from is and returns is.
 
884
 
 
885
 {
 
886
     char buf[MAX_LENGTH];
 
887
 
 
888
+    memset(buf, 0, MAX_LENGTH);
 
889
     is >> buf;
 
890
     str = buf;
 
891
     return is;
 
892
@@ -338,7 +339,7 @@
 
893
 
 
894
 //****************************************************************
 
895
 
 
896
-istream &getline(istream &is, apstring &str)
 
897
+std::istream &getline(std::istream &is, apstring &str)
 
898
 
 
899
 // Reads a line from input stream is into the string str
 
900
 {
 
901
--- wing-0.7.orig/bullettype.cpp
 
902
+++ wing-0.7/bullettype.cpp
 
903
@@ -1,3 +1,5 @@
 
904
+#include "bullettype.h"
 
905
+
 
906
 //***************************************************************************
 
907
 BulletTYPE :: BulletTYPE ( )
 
908
 : myBullets    ( NULL ),
 
909
--- wing-0.7.orig/util.cpp
 
910
+++ wing-0.7/util.cpp
 
911
@@ -1,3 +1,5 @@
 
912
+#include "util.h"
 
913
+
 
914
 //==========================================================================
 
915
 
 
916
 apstring NumToString ( long int i )
 
917
@@ -69,17 +71,10 @@
 
918
       case 3  : return ATTACKING_4;
 
919
       case 4  : return ATTACKING_5;
 
920
       case 5  : return ATTACKING_6;
 
921
+      default : return ATTACKING_1;
 
922
    }
 
923
 }
 
924
 //==========================================================================
 
925
-template < class ItemTYPE >
 
926
-void Swap ( ItemTYPE & left,ItemTYPE & right )
 
927
-{
 
928
-       ItemTYPE temp = left;
 
929
-   left = right;
 
930
-   right = temp;
 
931
-}
 
932
-//==========================================================================
 
933
 apstring GetText ( BITMAP * draw_buffer, char *msg,char * query, int xcoord, int ycoord,int length )
 
934
 {
 
935
        char temp;
 
936
@@ -98,6 +93,7 @@
 
937
       textprintf (draw_buffer,font,xcoord + text_length(font, query)+8, ycoord+70,15, strcpy ( temp_string,name_string.c_str()));
 
938
       show_mouse ( draw_buffer );
 
939
                blit(draw_buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 
940
+               usleep(10000);
 
941
       poll_keyboard ();
 
942
           if ( key [KEY_ENTER] )
 
943
       {
 
944
@@ -174,6 +170,7 @@
 
945
       textprintf(draw_buffer, font, xcoord + 135 , ycoord + 70, 15, "No");
 
946
       show_mouse ( draw_buffer );
 
947
                blit(draw_buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 
948
+               usleep(10000);
 
949
 
 
950
       if (key [KEY_ENTER])
 
951
       {
 
952
@@ -217,7 +214,7 @@
 
953
  void LoadStrings (apvector <apstring> & strings, char * file_name )
 
954
  {
 
955
        int size;
 
956
-   ifstream file;
 
957
+   std::ifstream file;
 
958
    file.open ( file_name );
 
959
    file >> size;
 
960
    strings.resize ( size);
 
961
--- wing-0.7.orig/sound.h
 
962
+++ wing-0.7/sound.h
 
963
@@ -3,6 +3,7 @@
 
964
 
 
965
 #include <stdio.h>
 
966
 #include <string.h>
 
967
+#include <allegro.h>
 
968
 #include "constants.h"
 
969
 
 
970
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
971
@@ -24,11 +25,11 @@
 
972
   int played;
 
973
 } WFXSTREAM;
 
974
 
 
975
-AUDIOSTREAM *stream = NULL;
 
976
-FILE        *stream_file  = NULL;
 
977
-WFXSTREAM    wfx;
 
978
-int                    stream_vol = DEFAULT_STREAM_VOL;
 
979
-int                    sample_vol = DEFAULT_SAMPLE_VOL;
 
980
+extern AUDIOSTREAM *stream;
 
981
+extern FILE        *stream_file;
 
982
+extern WFXSTREAM    wfx;
 
983
+extern int                     stream_vol;
 
984
+extern int                     sample_vol;
 
985
 
 
986
 void install_stream();
 
987
 void stream_start();
 
988
@@ -36,5 +37,4 @@
 
989
 void stream_stop();
 
990
 
 
991
 
 
992
-#include "sound.cpp"
 
993
 #endif