1
--- wing-0.7.orig/util.h
10
#include "additional/apstring.h"
11
#include "additional/apvector.h"
12
+#include "constants.h"
14
//==============================================================================
17
bool Confirm ( BITMAP *draw_buffer,char *query,int xcoord,int ycoord);
18
void LoadStrings (apvector <apstring> & strings, char * file );
21
+//==========================================================================
22
+template < class ItemTYPE >
23
+void Swap ( ItemTYPE & left,ItemTYPE & right )
25
+ ItemTYPE temp = left;
30
--- wing-0.7.orig/enemytype.h
31
+++ wing-0.7/enemytype.h
38
#include "bullettype.h"
39
#include "animationtype.h"
44
- int xpos, ypos, dx,dy,health;
45
+ EnemyNodeTYPE * next; // pointer to next node
46
+ EnemyNodeTYPE * back; // pointer to previous node
49
- unsigned int TimeOfLastFired;
50
+ int TimeOfLastFired;
52
EnemyEnum TypeOfEnemy;
53
+ int xpos, ypos, dx,dy,health;
57
- EnemyNodeTYPE * next; // pointer to next node
58
- EnemyNodeTYPE * back; // pointer to previous node
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;
74
-#include "enemytype.cpp"
76
\ No newline at end of file
78
--- wing-0.7.orig/scorelisttype.h
79
+++ wing-0.7/scorelisttype.h
81
#ifndef _SCORELISTTYPE_H
82
#define _SCORELISTTYPE_H
84
-#include <iostream.h>
90
#include "additional/apvector.h"
92
apvector <ScoreTYPE> list;
95
-#include "scorelisttype.cpp"
97
--- wing-0.7.orig/animationtype.cpp
98
+++ wing-0.7/animationtype.cpp
100
+#include "animationtype.h"
102
//=======================================================
103
AnimationTYPE :: AnimationTYPE ( )
104
: mySize ( 0 ), myImageBank ( 0 )
106
: mySize ( 0 ), myImageBank ( 0 )
109
- ifstream ImageFile;
110
+ std::ifstream ImageFile;
111
ImageFile.open ( fileName );
113
myImageBank.resize ( mySize);
117
myImageBank [index] = load_bmp ((char*) source.c_str(), myPal);
118
- cout << "Loaded OK" << endl;
119
+ std::cout << "Loaded OK" << std::endl;
124
void AnimationTYPE :: LoadImages ( char * fileName )
127
- BITMAP * Temp = NULL;
128
- ifstream ImageFile;
129
+ //BITMAP * Temp = NULL;
130
+ std::ifstream ImageFile;
131
ImageFile.open ( fileName );
133
myImageBank.resize ( mySize);
134
--- wing-0.7.orig/enemytype.cpp
135
+++ wing-0.7/enemytype.cpp
137
+#include "enemytype.h"
138
+extern volatile int timer;
140
//========================================================================
141
EnemyTYPE :: EnemyTYPE ( )
142
: num_enemies_left ( 0 ),
144
//========================================================================
145
void EnemyTYPE :: UpdateAI ( int plane_x, int plane_y )
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)
152
+ next_scan = scan -> next;
153
if ( scan -> health <= 0 && scan->explode_stage == ENEMY_EXPLODE_STAGES - 1 )
157
- if ( scan -> attacking )
158
+ if ( scan -> attacking && ! scan -> dead )
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))
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;
172
if (num_enemies_left == num_enemies_per_level && num_enemies_attacking == 0 )
173
most_recent = enemy_list;
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;
179
if ( most_recent != NULL )
180
--- wing-0.7.orig/collision.h
181
+++ wing-0.7/collision.h
184
#include "constants.h"
185
#include "additional/apvector.h"
186
+#include "bullettype.h"
189
struct spr_mask // Sprite Mask
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
194
+typedef struct spr_mask spr_mask;
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);
200
-#include "collision.cpp"
202
\ No newline at end of file
204
--- wing-0.7.orig/animationtype.h
205
+++ wing-0.7/animationtype.h
208
#include "additional/apstring.h"
209
#include "additional/apvector.h"
210
-#include <fstream.h>
211
+#include <allegro.h>
217
apvector < BITMAP* > myImageBank;
220
-#include "animationtype.cpp"
223
--- wing-0.7.orig/star.cpp
224
+++ wing-0.7/star.cpp
228
+STAR_TYPE stars [256];
231
//****************************************************************************
234
--- wing-0.7.orig/main.cpp
235
+++ wing-0.7/main.cpp
237
// these must be declared volatile so the optimiser doesn't mess up
238
volatile int timer = 0;
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
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
258
apvector <apstring> level_names;
259
+ bool windowed = false;
262
//****************************************************************************
264
//****************************************************************************
268
+int main(int argc, char **argv)
270
+ chdir("/usr/share/games/wing");
271
+ if(argc>1 && !strcmp(argv[1],"-w")) windowed = true;
277
END_OF_FUNCTION(inc_x);
278
//****************************************************************************
279
+void Segv_Handler ( int sig )
281
+ signal(SIGSEGV, SIG_IGN);
282
+ std::cerr << "ouch, we crashed! resetting keyboard state..." << std::endl;
285
+//****************************************************************************
288
// turn on Allegro, initialize, set graphics mode
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);
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);
299
fade_in ( MenuPal,5 );
300
entering_menu = false;
303
+// Emergency quit with Escape
305
+ if ( key [KEY_ESC] )
307
+ play_sample(menu_beep , 127, 127, 1000, 0);
314
// bitmask to determine if 1st mouse button is pressed
315
if ( mouse_x >= BUTTON_LEFT && mouse_x <= BUTTON_RIGHT)
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");
324
menu_beep = load_sample ("sound/menuitem.wav");
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);
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);
342
play_sample(menu_beep , 127, 127, 1000, 0);
344
- score_list.WriteToFile ("scores.dat");
345
+ score_list.WriteToFile ("/var/games/wing.scores");
351
play_sample(menu_beep , 127, 127, 1000, 0);
353
- score_list.WriteToFile ("scores.dat");
354
+ score_list.WriteToFile ("/var/games/wing.scores");
360
set_palette (MenuPal);
361
ScoreListTYPE score_list;
362
- score_list.ReadFromFile ("scores.dat");
363
+ score_list.ReadFromFile ("/var/games/wing.scores");
365
if ( plane_object.GetScore() < score_list.Lowest_Score () )
368
if ( name.length() == 0 )
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 ();
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);
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);
393
@@ -452,11 +478,11 @@
396
plane_object.Display ( buffer );
399
textprintf (buffer, font, 300 , 250, 15, "Level 1");
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);
409
bool ok_to_add = false;
410
int pause_counter = NEW_LEVEL_PAUSE;
411
- int rand_attackers;
412
+ int rand_attackers = 0;
414
int add_enemy_timer = 0;
415
int add_group_timer = 0;
420
- if ( plane_object.GetHealth () <= 0 )
421
+ if ( plane_object.GetHealth () <= 0 && !plane_object.GetDead () )
423
plane_object.SetDead (true);
424
play_sample(die_sound , sample_vol, 127, 1000, 0);
426
fire_sound = shoot_sounds [laser];
429
- if ( plane_object.GetNumLives () == 0 )
430
+ if ( plane_object.GetNumLives () == 0 && !plane_object.GetDead () )
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 ( );
439
+ if ( key[KEY_F1] || key[KEY_1] )
441
plane_object.SetWeapon ( laser );
442
fire_sound = shoot_sounds [laser];
445
+ if ( key[KEY_F2] || key[KEY_2] )
447
plane_object.SetWeapon ( minigun );
448
fire_sound = shoot_sounds [minigun];
451
+ if ( key[KEY_F3] || key[KEY_3] )
453
plane_object.SetWeapon ( plasma );
454
fire_sound = shoot_sounds [plasma];
457
+ if ( key[KEY_F4] || key[KEY_4] )
459
plane_object.SetWeapon ( torpedo );
460
fire_sound = shoot_sounds [torpedo];
462
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); // Copy Buffer to VRam
464
// Lock at 60FPS -- 15 represents 15 milliseconds
465
- while (( timer - startTimer <= 15 ));
466
+ while (( timer - startTimer <= 15 )) usleep(2000);
473
blit(menu_buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
477
//****************************************************************************
480
for (; enemy_node != NULL; enemy_node = enemy_node -> next )
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)
485
for ( ; bullet_list != NULL ; bullet_list = bullet_list -> next )
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() ))
494
plane_object.SetHealth ( 0 );
495
enemy_node-> health = 0 ;
500
- if ( ! plane_object.GetDead () )
501
+ if ( plane_object.GetVuln () )
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
508
#include "animationtype.h"
509
#include "collision.h"
510
#include "additional/apvector.h"
511
-#include <fstream.h>
515
struct BulletNodeTYPE
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 );
525
BulletNodeTYPE * myBullets;
527
AnimationTYPE myBulletImages;
528
apvector <spr_mask > myBulletMask;
531
-#include "bullettype.cpp"
533
--- wing-0.7.orig/sound.cpp
534
+++ wing-0.7/sound.cpp
538
+AUDIOSTREAM *stream = NULL;
539
+FILE *stream_file = NULL;
541
+int stream_vol = DEFAULT_STREAM_VOL;
542
+int sample_vol = DEFAULT_SAMPLE_VOL;
544
void stream_callback(void)
546
if (stream_file && stream)
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);
560
--- wing-0.7.orig/planetype.cpp
561
+++ wing-0.7/planetype.cpp
563
+#include "planetype.h"
564
+extern volatile int timer;
566
//========================================================================
567
PlaneTYPE :: PlaneTYPE ( )
571
last_shot_time ( 0 ),
572
+ invuln_count ( 0 ),
574
myNumLives ( MAX_NUM_LIVES )
579
//========================================================================
580
+bool PlaneTYPE :: GetVuln ( ) const
582
+ return !dead && !invuln_count;
584
+//========================================================================
585
int PlaneTYPE :: GetNumLives ( ) const
590
myBullets.UpdateAndDisplayShot ( buffer );
592
- draw_sprite ( buffer, myArrayOfImages.GetImage( myImageIndex ), myXPos, myYPos );
594
+ if (invuln_count > 0)
596
+ if (!(invuln_count & 1))
597
+ draw_sprite ( buffer, myArrayOfImages.GetImage( myImageIndex ), myXPos, myYPos );
599
else if ( explode_stage != PLANE_EXPLODE_STAGES - 1 )
601
draw_sprite ( buffer, explode_images.GetImage( explode_stage ), myXPos, myYPos );
603
myImageIndex = myArrayOfImages.Length () / 2;
606
+ invuln_count = 100;
608
//=======================================================================
609
--- wing-0.7.orig/planetype.h
610
+++ wing-0.7/planetype.h
615
-#include <fstream.h>
617
#include "bullettype.h"
618
#include "animationtype.h"
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;
629
BulletTYPE myBullets;
630
AnimationTYPE myArrayOfImages;
631
AnimationTYPE explode_images;
632
- unsigned int last_shot_time;
633
+ int last_shot_time;
637
apvector <spr_mask > myPlaneMasks;
640
-#include "planetype.cpp"
642
--- wing-0.7.orig/star.h
648
+#include <allegro.h>
649
+#include "constants.h"
651
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
658
-STAR_TYPE stars [256];
659
+extern STAR_TYPE stars [];
662
void Draw_Stars ( BITMAP * buffer );
669
--- wing-0.7.orig/scorelisttype.cpp
670
+++ wing-0.7/scorelisttype.cpp
672
+#include "scorelisttype.h"
674
//==========================================================================
675
ScoreListTYPE :: ScoreListTYPE ()
678
//==========================================================================
679
void ScoreListTYPE :: ReadFromFile ( char * file_name )
681
- ifstream score_file;
684
+ std::ifstream score_file;
685
score_file.open (file_name);
688
- for ( int i=0; i < NUM_HIGH_SCORES && score_file >> list[i].name >> list[i].score; i++ )
690
+ for ( int i=0; i < NUM_HIGH_SCORES; i++ ) {
691
+ score_file >> newname;
692
+ score_file >> newscore;
693
+ if (!newscore || !score_file.good())
695
+ list[i].name = newname;
696
+ list[i].score = newscore;
700
//==========================================================================
701
void ScoreListTYPE :: DisplayList ( BITMAP * buffer )
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++ )
707
apstring converter ("");
708
- converter = NumToString ( i );
709
+ converter = NumToString ( i+1 );
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 );
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 );
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 );
734
//==========================================================================
735
void ScoreListTYPE :: WriteToFile ( char * file_name )
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;
745
//==========================================================================
746
--- wing-0.7.orig/collision.cpp
747
+++ wing-0.7/collision.cpp
749
+#include "collision.h"
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
756
for(z=0; z<NUM_CHUNKS; z++)
758
- for (x1=(z*32); x1<((z*32)+32); x1++)
759
+ for (x1=(z*32); x1<(z*32+32); x1++)
761
p=getpixel(s3,x1,y1);
767
- mask.sp_mask[y1][z]+=0x80000000 >> (x1 - ((z+1)*32));
768
+ mask.sp_mask[y1][z]+=1<<(z*32+32-1-x1);
772
--- wing-0.7.orig/additional/apvector.cpp
773
+++ wing-0.7/additional/apvector.cpp
776
//****************************************************************
778
-#include <iostream.h>
782
+#include "apvector.h"
784
//****************************************************************
785
//******** Constructors / destructor ***********
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;
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;
808
--- wing-0.7.orig/additional/apstring.h
809
+++ wing-0.7/additional/apstring.h
814
-#include <iostream.h>
819
//****************************************************************
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);
832
// Concatenation operators:
835
bool operator> (const apstring &str1, const apstring &str2);
836
bool operator>= (const apstring &str1, const apstring &str2);
838
-#include "apstring.cpp"
839
+//#include "apstring.cpp"
840
// Continued in apstring.cpp...
843
--- wing-0.7.orig/additional/apstring.cpp
844
+++ wing-0.7/additional/apstring.cpp
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);
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);
868
//******** I/O functions *************
869
//****************************************************************
871
-ostream &operator<< (ostream &os, const apstring &str)
872
+std::ostream &operator<< (std::ostream &os, const apstring &str)
874
// Inserts the string into os and returns os.
876
@@ -324,13 +324,14 @@
878
//****************************************************************
880
-istream &operator>> (istream &is, apstring &str)
881
+std::istream &operator>> (std::istream &is, apstring &str)
883
// Skips all white space and reads one word from is and returns is.
886
char buf[MAX_LENGTH];
888
+ memset(buf, 0, MAX_LENGTH);
894
//****************************************************************
896
-istream &getline(istream &is, apstring &str)
897
+std::istream &getline(std::istream &is, apstring &str)
899
// Reads a line from input stream is into the string str
901
--- wing-0.7.orig/bullettype.cpp
902
+++ wing-0.7/bullettype.cpp
904
+#include "bullettype.h"
906
//***************************************************************************
907
BulletTYPE :: BulletTYPE ( )
908
: myBullets ( NULL ),
909
--- wing-0.7.orig/util.cpp
910
+++ wing-0.7/util.cpp
914
//==========================================================================
916
apstring NumToString ( long int i )
918
case 3 : return ATTACKING_4;
919
case 4 : return ATTACKING_5;
920
case 5 : return ATTACKING_6;
921
+ default : return ATTACKING_1;
924
//==========================================================================
925
-template < class ItemTYPE >
926
-void Swap ( ItemTYPE & left,ItemTYPE & right )
928
- ItemTYPE temp = left;
932
-//==========================================================================
933
apstring GetText ( BITMAP * draw_buffer, char *msg,char * query, int xcoord, int ycoord,int length )
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);
942
if ( key [KEY_ENTER] )
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);
953
void LoadStrings (apvector <apstring> & strings, char * file_name )
957
+ std::ifstream file;
958
file.open ( file_name );
960
strings.resize ( size);
961
--- wing-0.7.orig/sound.h
967
+#include <allegro.h>
968
#include "constants.h"
970
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
975
-AUDIOSTREAM *stream = NULL;
976
-FILE *stream_file = NULL;
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;
986
void install_stream();
992
-#include "sound.cpp"