From 354cd9ff21e878c9a34866b0c3916e42e226d105 Mon Sep 17 00:00:00 2001 From: Reimar Date: Sat, 12 Dec 2015 16:20:42 +0100 Subject: Now taking env variable RCADE_DATA and RCADE_SAVE. Default: data/ and save/ . also old saves are not compatible --- enginecore.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'enginecore.cpp') 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) } /*structure of a ProjectileFile -data/projectile2.bmp #path of the imagefile -data/sounds/spit #path of the soundfile without n.wav for int n +projectile2.bmp #path of the imagefile +sounds/spit #path of the soundfile without n.wav for int n 10 #damage 2 #armorPiercing 1.4142 #collisionSize @@ -144,14 +144,14 @@ Projectile::Projectile(string filename, vector& sounds) } string imageFilename; getline(ins, imageFilename); - image = loadBMP(imageFilename); + image = loadBMP(get_data_path() + imageFilename); string soundPath; getline(ins, soundPath); bool good = true; long long files = 1; while(good) { - string actualPath = soundPath + lltostr(files) + ".wav"; + string actualPath = get_data_path() + soundPath + lltostr(files) + ".wav"; Mix_Chunk* temp = NULL; temp = Mix_LoadWAV(actualPath.c_str()); if(temp == NULL) @@ -232,19 +232,19 @@ Weapon::Weapon(const Weapon& w):Item((Item) w) /* structure of a Weaponfile: epic imbaweapon of massdestruction #name -data/weapon89.bmp #filename of image of weapon +weapon89.bmp #filename of image of weapon 0.5 #energyusage 0 #sellable 10000000 #cost 2 #number of distinguished Projectiles 1 #cooldown 0.5 #startTimer -data/projectile11.txt #path +projectiles/projectile11.txt #path 0 #xSpeed 700 #-ySpeed 5 #cooldown 0 #startTimer -data/projectile14.txt #path +projectiles/projectile14.txt #path 0 #xSpeed 500 #-ySpeed */ @@ -261,7 +261,7 @@ Weapon::Weapon(string filename) string imageFilename; getline(ins, imageFilename); // cout << imageFilename << endl; - image = loadBMP(imageFilename); + image = loadBMP(get_data_path() + imageFilename); active = true; ins >> energyUsage; ins >> sellable; @@ -281,7 +281,7 @@ Weapon::Weapon(string filename) ins >> workaround; getline(ins,projectileFilename); vector projectileSounds; - prototypes.push_back(new Projectile(workaround + projectileFilename, projectileSounds)); + prototypes.push_back(new Projectile(get_data_path() + workaround + projectileFilename, projectileSounds)); ins >> prototypes[prototypes.size()-1]->xSpeed; ins >> prototypes[prototypes.size()-1]->ySpeed; prototypes[prototypes.size()-1]->ySpeed *= -1; @@ -497,7 +497,7 @@ EnemyShip::EnemyShip(const EnemyShip& s): Ship((Ship) s) /*structure of an EnemShipfile Tork Spacerocket #name -data/images/tork_spacerocket.bmp #path of imagefile +images/tork_spacerocket.bmp #path of imagefile 7 #maxhp 5 #armor 50 #moveSpeed @@ -507,7 +507,7 @@ data/images/tork_spacerocket.bmp #path of imagefile 3 #score 1 #number of weapons 0 -1 #relative Position of weapon -data/fireball.txt #path of weapon +weapons/fireball.txt #path of weapon */ EnemyShip::EnemyShip(string filename) { @@ -520,7 +520,7 @@ EnemyShip::EnemyShip(string filename) getline(ins, name); string imagePath; getline(ins, imagePath); - image = loadBMP(imagePath); + image = loadBMP(get_data_path() + imagePath); ins >> maxhp; hp = maxhp; ins >> armor; @@ -542,7 +542,7 @@ EnemyShip::EnemyShip(string filename) ins >> workaround; string weaponpath; getline(ins, weaponpath); - weapons.push_back(new Weapon(workaround + weaponpath)); + weapons.push_back(new Weapon(get_data_path() + workaround + weaponpath)); weapons[weapons.size()-1]->mirror(); } if(!(exp || gold || score)) @@ -715,7 +715,7 @@ vector UserShip::frame(double time, SDL_Surface* screen) /*structure of an UserShipfile small Fighter #name -data/images/small_fighter.bmp #path of imagefile +images/small_fighter.bmp #path of imagefile 200 #cost 7 #maxhp 50 #armor @@ -727,10 +727,10 @@ data/images/small_fighter.bmp #path of imagefile 2 #number of weapons 4 4 #relative Position of weapon 3 #maxSize of attached weapon -data/fireball.txt #path of weapon +fireball.txt #path of weapon 4 4 #relative Position of weapon 3 #maxSize of attached weapon -data/fireball.txt #path of weapon +fireball.txt #path of weapon */ UserShip::UserShip(string filename) { @@ -746,7 +746,7 @@ UserShip::UserShip(string filename) getline(ins, name); string imagePath; getline(ins, imagePath); - image = loadBMP(imagePath); + image = loadBMP(get_data_path() + imagePath); ins >> cost; ins >> maxhp; maxhp.name = "Hitpoints"; @@ -783,7 +783,7 @@ UserShip::UserShip(string filename) ins >> workaround; string weaponpath; getline(ins, weaponpath); - weapons.push_back(new Weapon(workaround + weaponpath)); + weapons.push_back(new Weapon(get_data_path() + workaround + weaponpath)); } if(cost == 0) cost = round_beautiful(estimateValue(*this)); -- cgit v1.2.3