summaryrefslogtreecommitdiff
path: root/enginecore.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 /enginecore.cpp
parent8c66c87d920340b116c539a56505b32629275b6a (diff)
downloadRCade-354cd9ff21e878c9a34866b0c3916e42e226d105.tar
RCade-354cd9ff21e878c9a34866b0c3916e42e226d105.tar.gz
RCade-354cd9ff21e878c9a34866b0c3916e42e226d105.tar.bz2
RCade-354cd9ff21e878c9a34866b0c3916e42e226d105.tar.xz
RCade-354cd9ff21e878c9a34866b0c3916e42e226d105.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.cpp36
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
131data/projectile2.bmp #path of the imagefile 131projectile2.bmp #path of the imagefile
132data/sounds/spit #path of the soundfile without n.wav for int n 132sounds/spit #path of the soundfile without n.wav for int n
13310 #damage 13310 #damage
1342 #armorPiercing 1342 #armorPiercing
1351.4142 #collisionSize 1351.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:
234epic imbaweapon of massdestruction #name 234epic imbaweapon of massdestruction #name
235data/weapon89.bmp #filename of image of weapon 235weapon89.bmp #filename of image of weapon
2360.5 #energyusage 2360.5 #energyusage
2370 #sellable 2370 #sellable
23810000000 #cost 23810000000 #cost
2392 #number of distinguished Projectiles 2392 #number of distinguished Projectiles
2401 #cooldown 2401 #cooldown
2410.5 #startTimer 2410.5 #startTimer
242data/projectile11.txt #path 242projectiles/projectile11.txt #path
2430 #xSpeed 2430 #xSpeed
244700 #-ySpeed 244700 #-ySpeed
2455 #cooldown 2455 #cooldown
2460 #startTimer 2460 #startTimer
247data/projectile14.txt #path 247projectiles/projectile14.txt #path
2480 #xSpeed 2480 #xSpeed
249500 #-ySpeed 249500 #-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
499Tork Spacerocket #name 499Tork Spacerocket #name
500data/images/tork_spacerocket.bmp #path of imagefile 500images/tork_spacerocket.bmp #path of imagefile
5017 #maxhp 5017 #maxhp
5025 #armor 5025 #armor
50350 #moveSpeed 50350 #moveSpeed
@@ -507,7 +507,7 @@ data/images/tork_spacerocket.bmp #path of imagefile
5073 #score 5073 #score
5081 #number of weapons 5081 #number of weapons
5090 -1 #relative Position of weapon 5090 -1 #relative Position of weapon
510data/fireball.txt #path of weapon 510weapons/fireball.txt #path of weapon
511*/ 511*/
512EnemyShip::EnemyShip(string filename) 512EnemyShip::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
717small Fighter #name 717small Fighter #name
718data/images/small_fighter.bmp #path of imagefile 718images/small_fighter.bmp #path of imagefile
719200 #cost 719200 #cost
7207 #maxhp 7207 #maxhp
72150 #armor 72150 #armor
@@ -727,10 +727,10 @@ data/images/small_fighter.bmp #path of imagefile
7272 #number of weapons 7272 #number of weapons
7284 4 #relative Position of weapon 7284 4 #relative Position of weapon
7293 #maxSize of attached weapon 7293 #maxSize of attached weapon
730data/fireball.txt #path of weapon 730fireball.txt #path of weapon
7314 4 #relative Position of weapon 7314 4 #relative Position of weapon
7323 #maxSize of attached weapon 7323 #maxSize of attached weapon
733data/fireball.txt #path of weapon 733fireball.txt #path of weapon
734*/ 734*/
735UserShip::UserShip(string filename) 735UserShip::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));