diff options
Diffstat (limited to 'engine.cpp')
-rw-r--r-- | engine.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | UserShip* getShipWithName(string shipname) | 3 | UserShip* 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 | ||
35 | Weapon* getWeaponWithName(string weaponname) | 35 | Weapon* 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 |
685 | IntroLevel #name | 685 | IntroLevel #name |
686 | data/images/bg_stars.bmp #path of background | 686 | images/bg_stars.bmp #path of background |
687 | 30 #speed of background | 687 | 30 #speed of background |
688 | 1 #wether to randomize background position | 688 | 1 #wether to randomize background position |
689 | 60 #duration [s] | 689 | 60 #duration [s] |
690 | 12346543 #seed | 690 | 12346543 #seed |
691 | 2 #number of Shiptypes | 691 | 2 #number of Shiptypes |
692 | data/tork_capsule.txt #path of Ship | 692 | tork_capsule.txt #path of Ship |
693 | 50 #how many of them should spawn | 693 | 50 #how many of them should spawn |
694 | data/tork_spacerocket.txt #path of Ship | 694 | tork_spacerocket.txt #path of Ship |
695 | 12 #how many | 695 | 12 #how many |
696 | 1 #how many events shall happen | 696 | 1 #how many events shall happen |
697 | 0.5 #percentage of completion the event happens | 697 | 0.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) |