diff options
author | Reimar <Reimar@Leike.name> | 2015-12-12 16:20:42 +0100 |
---|---|---|
committer | Reimar <Reimar@Leike.name> | 2015-12-12 16:20:42 +0100 |
commit | 354cd9ff21e878c9a34866b0c3916e42e226d105 (patch) | |
tree | 8e6f2123e503c2f32eed35e629c6c0b9c01352d8 /enginecore.cpp | |
parent | 8c66c87d920340b116c539a56505b32629275b6a (diff) | |
download | RCade-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 'enginecore.cpp')
-rw-r--r-- | enginecore.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/enginecore.cpp b/enginecore.cpp index 047511e..69bd0b7 100644 --- a/enginecore.cpp +++ b/enginecore.cpp | |||
@@ -128,8 +128,8 @@ Projectile::Projectile(const Projectile& P) : DObject((DObject) P) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | /*structure of a ProjectileFile | 130 | /*structure of a ProjectileFile |
131 | data/projectile2.bmp #path of the imagefile | 131 | projectile2.bmp #path of the imagefile |
132 | data/sounds/spit #path of the soundfile without n.wav for int n | 132 | sounds/spit #path of the soundfile without n.wav for int n |
133 | 10 #damage | 133 | 10 #damage |
134 | 2 #armorPiercing | 134 | 2 #armorPiercing |
135 | 1.4142 #collisionSize | 135 | 1.4142 #collisionSize |
@@ -144,14 +144,14 @@ Projectile::Projectile(string filename, vector<Mix_Chunk*>& sounds) | |||
144 | } | 144 | } |
145 | string imageFilename; | 145 | string imageFilename; |
146 | getline(ins, imageFilename); | 146 | getline(ins, imageFilename); |
147 | image = loadBMP(imageFilename); | 147 | image = loadBMP(get_data_path() + imageFilename); |
148 | string soundPath; | 148 | string soundPath; |
149 | getline(ins, soundPath); | 149 | getline(ins, soundPath); |
150 | bool good = true; | 150 | bool good = true; |
151 | long long files = 1; | 151 | long long files = 1; |
152 | while(good) | 152 | while(good) |
153 | { | 153 | { |
154 | string actualPath = soundPath + lltostr(files) + ".wav"; | 154 | string actualPath = get_data_path() + soundPath + lltostr(files) + ".wav"; |
155 | Mix_Chunk* temp = NULL; | 155 | Mix_Chunk* temp = NULL; |
156 | temp = Mix_LoadWAV(actualPath.c_str()); | 156 | temp = Mix_LoadWAV(actualPath.c_str()); |
157 | if(temp == NULL) | 157 | if(temp == NULL) |
@@ -232,19 +232,19 @@ Weapon::Weapon(const Weapon& w):Item((Item) w) | |||
232 | 232 | ||
233 | /* structure of a Weaponfile: | 233 | /* structure of a Weaponfile: |
234 | epic imbaweapon of massdestruction #name | 234 | epic imbaweapon of massdestruction #name |
235 | data/weapon89.bmp #filename of image of weapon | 235 | weapon89.bmp #filename of image of weapon |
236 | 0.5 #energyusage | 236 | 0.5 #energyusage |
237 | 0 #sellable | 237 | 0 #sellable |
238 | 10000000 #cost | 238 | 10000000 #cost |
239 | 2 #number of distinguished Projectiles | 239 | 2 #number of distinguished Projectiles |
240 | 1 #cooldown | 240 | 1 #cooldown |
241 | 0.5 #startTimer | 241 | 0.5 #startTimer |
242 | data/projectile11.txt #path | 242 | projectiles/projectile11.txt #path |
243 | 0 #xSpeed | 243 | 0 #xSpeed |
244 | 700 #-ySpeed | 244 | 700 #-ySpeed |
245 | 5 #cooldown | 245 | 5 #cooldown |
246 | 0 #startTimer | 246 | 0 #startTimer |
247 | data/projectile14.txt #path | 247 | projectiles/projectile14.txt #path |
248 | 0 #xSpeed | 248 | 0 #xSpeed |
249 | 500 #-ySpeed | 249 | 500 #-ySpeed |
250 | */ | 250 | */ |
@@ -261,7 +261,7 @@ Weapon::Weapon(string filename) | |||
261 | string imageFilename; | 261 | string imageFilename; |
262 | getline(ins, imageFilename); | 262 | getline(ins, imageFilename); |
263 | // cout << imageFilename << endl; | 263 | // cout << imageFilename << endl; |
264 | image = loadBMP(imageFilename); | 264 | image = loadBMP(get_data_path() + imageFilename); |
265 | active = true; | 265 | active = true; |
266 | ins >> energyUsage; | 266 | ins >> energyUsage; |
267 | ins >> sellable; | 267 | ins >> sellable; |
@@ -281,7 +281,7 @@ Weapon::Weapon(string filename) | |||
281 | ins >> workaround; | 281 | ins >> workaround; |
282 | getline(ins,projectileFilename); | 282 | getline(ins,projectileFilename); |
283 | vector<Mix_Chunk*> projectileSounds; | 283 | vector<Mix_Chunk*> projectileSounds; |
284 | prototypes.push_back(new Projectile(workaround + projectileFilename, projectileSounds)); | 284 | prototypes.push_back(new Projectile(get_data_path() + workaround + projectileFilename, projectileSounds)); |
285 | ins >> prototypes[prototypes.size()-1]->xSpeed; | 285 | ins >> prototypes[prototypes.size()-1]->xSpeed; |
286 | ins >> prototypes[prototypes.size()-1]->ySpeed; | 286 | ins >> prototypes[prototypes.size()-1]->ySpeed; |
287 | prototypes[prototypes.size()-1]->ySpeed *= -1; | 287 | prototypes[prototypes.size()-1]->ySpeed *= -1; |
@@ -497,7 +497,7 @@ EnemyShip::EnemyShip(const EnemyShip& s): Ship((Ship) s) | |||
497 | 497 | ||
498 | /*structure of an EnemShipfile | 498 | /*structure of an EnemShipfile |
499 | Tork Spacerocket #name | 499 | Tork Spacerocket #name |
500 | data/images/tork_spacerocket.bmp #path of imagefile | 500 | images/tork_spacerocket.bmp #path of imagefile |
501 | 7 #maxhp | 501 | 7 #maxhp |
502 | 5 #armor | 502 | 5 #armor |
503 | 50 #moveSpeed | 503 | 50 #moveSpeed |
@@ -507,7 +507,7 @@ data/images/tork_spacerocket.bmp #path of imagefile | |||
507 | 3 #score | 507 | 3 #score |
508 | 1 #number of weapons | 508 | 1 #number of weapons |
509 | 0 -1 #relative Position of weapon | 509 | 0 -1 #relative Position of weapon |
510 | data/fireball.txt #path of weapon | 510 | weapons/fireball.txt #path of weapon |
511 | */ | 511 | */ |
512 | EnemyShip::EnemyShip(string filename) | 512 | EnemyShip::EnemyShip(string filename) |
513 | { | 513 | { |
@@ -520,7 +520,7 @@ EnemyShip::EnemyShip(string filename) | |||
520 | getline(ins, name); | 520 | getline(ins, name); |
521 | string imagePath; | 521 | string imagePath; |
522 | getline(ins, imagePath); | 522 | getline(ins, imagePath); |
523 | image = loadBMP(imagePath); | 523 | image = loadBMP(get_data_path() + imagePath); |
524 | ins >> maxhp; | 524 | ins >> maxhp; |
525 | hp = maxhp; | 525 | hp = maxhp; |
526 | ins >> armor; | 526 | ins >> armor; |
@@ -542,7 +542,7 @@ EnemyShip::EnemyShip(string filename) | |||
542 | ins >> workaround; | 542 | ins >> workaround; |
543 | string weaponpath; | 543 | string weaponpath; |
544 | getline(ins, weaponpath); | 544 | getline(ins, weaponpath); |
545 | weapons.push_back(new Weapon(workaround + weaponpath)); | 545 | weapons.push_back(new Weapon(get_data_path() + workaround + weaponpath)); |
546 | weapons[weapons.size()-1]->mirror(); | 546 | weapons[weapons.size()-1]->mirror(); |
547 | } | 547 | } |
548 | if(!(exp || gold || score)) | 548 | if(!(exp || gold || score)) |
@@ -715,7 +715,7 @@ vector<Projectile*> UserShip::frame(double time, SDL_Surface* screen) | |||
715 | 715 | ||
716 | /*structure of an UserShipfile | 716 | /*structure of an UserShipfile |
717 | small Fighter #name | 717 | small Fighter #name |
718 | data/images/small_fighter.bmp #path of imagefile | 718 | images/small_fighter.bmp #path of imagefile |
719 | 200 #cost | 719 | 200 #cost |
720 | 7 #maxhp | 720 | 7 #maxhp |
721 | 50 #armor | 721 | 50 #armor |
@@ -727,10 +727,10 @@ data/images/small_fighter.bmp #path of imagefile | |||
727 | 2 #number of weapons | 727 | 2 #number of weapons |
728 | 4 4 #relative Position of weapon | 728 | 4 4 #relative Position of weapon |
729 | 3 #maxSize of attached weapon | 729 | 3 #maxSize of attached weapon |
730 | data/fireball.txt #path of weapon | 730 | fireball.txt #path of weapon |
731 | 4 4 #relative Position of weapon | 731 | 4 4 #relative Position of weapon |
732 | 3 #maxSize of attached weapon | 732 | 3 #maxSize of attached weapon |
733 | data/fireball.txt #path of weapon | 733 | fireball.txt #path of weapon |
734 | */ | 734 | */ |
735 | UserShip::UserShip(string filename) | 735 | UserShip::UserShip(string filename) |
736 | { | 736 | { |
@@ -746,7 +746,7 @@ UserShip::UserShip(string filename) | |||
746 | getline(ins, name); | 746 | getline(ins, name); |
747 | string imagePath; | 747 | string imagePath; |
748 | getline(ins, imagePath); | 748 | getline(ins, imagePath); |
749 | image = loadBMP(imagePath); | 749 | image = loadBMP(get_data_path() + imagePath); |
750 | ins >> cost; | 750 | ins >> cost; |
751 | ins >> maxhp; | 751 | ins >> maxhp; |
752 | maxhp.name = "Hitpoints"; | 752 | maxhp.name = "Hitpoints"; |
@@ -783,7 +783,7 @@ UserShip::UserShip(string filename) | |||
783 | ins >> workaround; | 783 | ins >> workaround; |
784 | string weaponpath; | 784 | string weaponpath; |
785 | getline(ins, weaponpath); | 785 | getline(ins, weaponpath); |
786 | weapons.push_back(new Weapon(workaround + weaponpath)); | 786 | weapons.push_back(new Weapon(get_data_path() + workaround + weaponpath)); |
787 | } | 787 | } |
788 | if(cost == 0) | 788 | if(cost == 0) |
789 | cost = round_beautiful(estimateValue(*this)); | 789 | cost = round_beautiful(estimateValue(*this)); |