summaryrefslogtreecommitdiff
path: root/engine.cpp
diff options
context:
space:
mode:
authorReimar <Reimar@Leike.name>2015-12-12 16:20:42 +0100
committerReimar <Reimar@Leike.name>2015-12-12 16:20:42 +0100
commit354cd9ff21e878c9a34866b0c3916e42e226d105 (patch)
tree8e6f2123e503c2f32eed35e629c6c0b9c01352d8 /engine.cpp
parent8c66c87d920340b116c539a56505b32629275b6a (diff)
downloadRCade-master.tar
RCade-master.tar.gz
RCade-master.tar.bz2
RCade-master.tar.xz
RCade-master.zip
Now taking env variable RCADE_DATA and RCADE_SAVE. Default: data/ and save/ . also old saves are not compatibleHEADmaster
Diffstat (limited to 'engine.cpp')
-rw-r--r--engine.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/engine.cpp b/engine.cpp
index 50b39ee..41d6a95 100644
--- a/engine.cpp
+++ b/engine.cpp
@@ -2,7 +2,7 @@
2 2
3UserShip* getShipWithName(string shipname) 3UserShip* getShipWithName(string shipname)
4{ 4{
5 string path = "data/ships/user/"; 5 string path = get_data_path() + "ships/user/";
6 ifstream ships; 6 ifstream ships;
7 ships.open((path + "userships.txt").c_str()); 7 ships.open((path + "userships.txt").c_str());
8 char workaround; 8 char workaround;
@@ -34,7 +34,7 @@ UserShip* getShipWithName(string shipname)
34 34
35Weapon* getWeaponWithName(string weaponname) 35Weapon* getWeaponWithName(string weaponname)
36{ 36{
37 string path = "data/weapons/"; 37 string path = get_data_path() + "weapons/";
38 ifstream weapons; 38 ifstream weapons;
39 weapons.open((path + "weapons.txt").c_str()); 39 weapons.open((path + "weapons.txt").c_str());
40 char workaround; 40 char workaround;
@@ -68,7 +68,7 @@ Account::Account()
68 gold = 0; 68 gold = 0;
69 highscore = 0; 69 highscore = 0;
70 ifstream ins; 70 ifstream ins;
71 string path = "data/ships/user/"; 71 string path = get_data_path() + "ships/user/";
72 ins.open((path + "userships.txt").c_str()); 72 ins.open((path + "userships.txt").c_str());
73 current = 0; 73 current = 0;
74 string shippath; 74 string shippath;
@@ -361,14 +361,14 @@ HUD::HUD(long long *nhighscore, double *nhp, double nhpmax, double *nenergy, dou
361 maxEnergy = nmaxEnergy; 361 maxEnergy = nmaxEnergy;
362 gold = ngold; 362 gold = ngold;
363 exp = nexp; 363 exp = nexp;
364 energyRaw = loadBMP("data/images/energy_raw2.bmp"); 364 energyRaw = loadBMP(get_data_path() + "images/energy_raw2.bmp");
365 SDL_Surface *bubbles = loadBMP("data/images/energy_bubbles3.bmp"); 365 SDL_Surface *bubbles = loadBMP(get_data_path() + "images/energy_bubbles3.bmp");
366 energyBubbles = new SlidingBackground(bubbles,0,-200); 366 energyBubbles = new SlidingBackground(bubbles,0,-200);
367 energyMasc = loadBMP("data/images/energy_masc2.bmp"); 367 energyMasc = loadBMP(get_data_path() + "images/energy_masc2.bmp");
368 hpRaw = loadBMP("data/images/hp_raw.bmp"); 368 hpRaw = loadBMP(get_data_path() + "images/hp_raw.bmp");
369 hpMasc = loadBMP("data/images/hp_masc2.bmp"); 369 hpMasc = loadBMP(get_data_path() + "images/hp_masc2.bmp");
370 background = loadBMP("data/images/hud_background.bmp"); 370 background = loadBMP(get_data_path() + "images/hud_background.bmp");
371 font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",12); 371 font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),12);
372 if(font == NULL) 372 if(font == NULL)
373 { 373 {
374 cout << "Error loading font in HUD" << endl; 374 cout << "Error loading font in HUD" << endl;
@@ -683,15 +683,15 @@ vector<pair<double,vector<pair<double,double> > > > generateWave(int number, int
683 683
684/*structure of a LevelFile 684/*structure of a LevelFile
685IntroLevel #name 685IntroLevel #name
686data/images/bg_stars.bmp #path of background 686images/bg_stars.bmp #path of background
68730 #speed of background 68730 #speed of background
6881 #wether to randomize background position 6881 #wether to randomize background position
68960 #duration [s] 68960 #duration [s]
69012346543 #seed 69012346543 #seed
6912 #number of Shiptypes 6912 #number of Shiptypes
692data/tork_capsule.txt #path of Ship 692tork_capsule.txt #path of Ship
69350 #how many of them should spawn 69350 #how many of them should spawn
694data/tork_spacerocket.txt #path of Ship 694tork_spacerocket.txt #path of Ship
69512 #how many 69512 #how many
6961 #how many events shall happen 6961 #how many events shall happen
6970.5 #percentage of completion the event happens 6970.5 #percentage of completion the event happens
@@ -701,7 +701,7 @@ LevelGenerator::LevelGenerator(string filename, Account* user, SDL_Surface* nscr
701{ 701{
702 vector<int> shouldSpawn; 702 vector<int> shouldSpawn;
703 screen = nscreen; 703 screen = nscreen;
704 SDL_Surface* fakeScreen = loadBMP("data/images/game_screen.bmp"); 704 SDL_Surface* fakeScreen = loadBMP(get_data_path() + "images/game_screen.bmp");
705 current = 0; 705 current = 0;
706 completed = 0; 706 completed = 0;
707 event = false; 707 event = false;
@@ -716,7 +716,7 @@ LevelGenerator::LevelGenerator(string filename, Account* user, SDL_Surface* nscr
716 getline(ins, name); 716 getline(ins, name);
717 string backgroundPath; 717 string backgroundPath;
718 getline(ins, backgroundPath); 718 getline(ins, backgroundPath);
719 SDL_Surface* background = loadBMP(backgroundPath); 719 SDL_Surface* background = loadBMP(get_data_path() + backgroundPath);
720 OH = new ObjectHandler(user, fakeScreen,background); 720 OH = new ObjectHandler(user, fakeScreen,background);
721 UserShip *s = user->ships[user->current]; 721 UserShip *s = user->ships[user->current];
722 hud = new HUD(&OH->highscore, &s->hp, s->maxhp, &s->energy, s->maxEnergy, &OH->gold, user->getExpPointer()); 722 hud = new HUD(&OH->highscore, &s->hp, s->maxhp, &s->energy, s->maxEnergy, &OH->gold, user->getExpPointer());
@@ -735,7 +735,7 @@ LevelGenerator::LevelGenerator(string filename, Account* user, SDL_Surface* nscr
735 ins >> workaround; 735 ins >> workaround;
736 string shipFilename; 736 string shipFilename;
737 getline(ins, shipFilename); 737 getline(ins, shipFilename);
738 EnemyShip* enemy = new EnemyShip(workaround + shipFilename); 738 EnemyShip* enemy = new EnemyShip(get_data_path() + workaround + shipFilename);
739 prototypes.push_back(enemy); 739 prototypes.push_back(enemy);
740 for(int l = 0; l < (int) enemy->weapons.size(); ++l) 740 for(int l = 0; l < (int) enemy->weapons.size(); ++l)
741 for(int i = 0; i < (int) enemy->weapons[l]->sounds.size(); ++i) 741 for(int i = 0; i < (int) enemy->weapons[l]->sounds.size(); ++i)