#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <string>
#include "SDL2/SDL.h"
#include "SDL2/SDL_mixer.h"
strcpy (gatebeam3.radar, "|");
//pods
- struct game_object pods[podmax] = {
+ game_object pods[podmax] = {
{ 2, 1, 18, rand()%620, 0, 0, 1, 0, 0 },
{ 3, 1, 18, rand()%620, 0, 0, 1, 0, 0 },
{ 4, 1, 18, rand()%620, 0, 0, 1, 0, 0 },
};
//bullets
- struct game_object bullets[bulletmax] = {
+ game_object bullets[bulletmax] = {
{ 40, 0, 0, 0, 5, 0, 0, 0, 0 },
{ 41, 0, 0, 0, 5, 0, 0, 0, 0 },
{ 42, 0, 0, 0, 5, 0, 0, 0, 0 },
};
//landers
- struct game_object landers[landermax] = {
+ game_object landers[landermax] = {
{ 60, 1, rand()%16, rand()%620, 0, 0, 1, 0, 0 },
{ 61, 1, rand()%16, rand()%620, 0, 0, 1, 0, 0 },
{ 62, 1, rand()%16, rand()%620, 0, 0, 1, 0, 0 },
};
//lander shots
- struct game_object landershot[landershotmax] = {
+ game_object landershot[landershotmax] = {
{ 80, 0, 0, 0, 5, 0, 0, 0, 0 },
{ 81, 0, 0, 0, 5, 0, 0, 0, 0 },
{ 82, 0, 0, 0, 5, 0, 0, 0, 0 },
};
//crazies
- struct game_object crazies[landermax] = {
+ game_object crazies[landermax] = {
{ 90, 0, 0, 0, 6, 0, 1, 0, 0 },
{ 91, 0, 0, 0, 4, 0, 1, 0, 0 },
{ 92, 0, 0, 0, 6, 0, 1, 0, 0 },
};
//shield
- struct game_object shields[12] = {
+ game_object shields[12] = {
{ 110, 1, 0, 0, 5, 0, 1, 0, 0 },
{ 111, 1, 0, 0, 5, 0, 1, 0, 0 },
{ 112, 1, 0, 0, 5, 0, 1, 0, 0 },
strcpy (shields[10].line0, ")");
strcpy (shields[11].line0, "(");
- struct game_object powerups[4] = {
+ game_object powerups[4] = {
{ 130, 0, 0, 0, 6, 0, 1, 0, 0 },
{ 131, 0, 0, 0, 4, 0, 1, 0, 0 },
{ 132, 0, 0, 0, 6, 0, 1, 0, 0 },
};
//Reference loops 200-230
- struct game_object refs[31] = {
+ game_object refs[31] = {
{ 200, 1, 19, 0, 5, 0, 0, 0, 0 },
{ 201, 1, 19, 20, 5, 0, 0, 0, 0 },
{ 202, 1, 19, 40, 5, 0, 0, 0, 0 },
};
//crawlers
- struct game_object crawlers[crawlermax] = {
+ game_object crawlers[crawlermax] = {
{ 30, 1, 18, rand()%620, 0, 0, 1, 0, 0 },
{ 31, 1, 18, rand()%620, 0, 0, 1, 0, 0 },
{ 32, 0, 18, rand()%620, 0, 0, 1, 0, 0 },
strcpy (crawlers[crawlerloop].radar, "^");
};
- struct game_object bosses[6] = {
+ game_object bosses[6] = {
{ 300, 0, 0, 0, 5, 4, 0, 0, 0 },
{ 301, 0, 0, 0, 5, 4, 0, 0, 0 },
{ 302, 0, 0, 0, 5, 4, 0, 0, 0 },
strcpy (boomstuff.line1, "/");
//missiles
- struct game_object missiles[missilemax] = {
+ game_object missiles[missilemax] = {
{ 50, 0, 0, 0, 5, 0, 0, 0, 0 },
{ 51, 0, 0, 0, 5, 0, 0, 0, 0 },
{ 52, 0, 0, 0, 5, 0, 0, 0, 0 }
char *env_tty;
env_tty = getenv("SSH_TTY");
-
+
struct stat datatest;
if(env_tty == NULL && sound == 1){
exit(1);
}
- if(stat("data/boom.ogg", &datatest)==0){
- shotsound = Mix_LoadWAV("data/shot.ogg");
- boomsound = Mix_LoadWAV("data/boom.ogg");
- dropoffsound = Mix_LoadWAV("data/dropoff.ogg");
- pickupsound = Mix_LoadWAV("data/pickup.ogg");
- lasersound = Mix_LoadWAV("data/laser.ogg");
- warningsound = Mix_LoadWAV("data/warning.ogg");
- pupcreatesound = Mix_LoadWAV("data/pup-create.ogg");
- puptakesound = Mix_LoadWAV("data/pup-take.ogg");
- shieldupsound = Mix_LoadWAV("data/shieldup.ogg");
- shielddownsound = Mix_LoadWAV("data/shielddown.ogg");
- crazifysound = Mix_LoadWAV("data/crazify.ogg");
- enshotsound = Mix_LoadWAV("data/enshot.ogg");
- missilesound = Mix_LoadWAV("data/missile.ogg");
- levelendsound = Mix_LoadWAV("data/level_end.ogg");
-
- title = Mix_LoadMUS("data/title_music.ogg");
+ std::string path_prefix;
+
+ if(stat("data/boom.ogg", &datatest)==0) {
+ path_prefix = "";
} else {
- shotsound = Mix_LoadWAV("/usr/share/curblaster/data/shot.ogg");
- boomsound = Mix_LoadWAV("/usr/share/curblaster/data/boom.ogg");
- dropoffsound = Mix_LoadWAV("/usr/share/curblaster/data/dropoff.ogg");
- pickupsound = Mix_LoadWAV("/usr/share/curblaster/data/pickup.ogg");
- lasersound = Mix_LoadWAV("/usr/share/curblaster/data/laser.ogg");
- warningsound = Mix_LoadWAV("/usr/share/curblaster/data/warning.ogg");
- pupcreatesound = Mix_LoadWAV("/usr/share/curblaster/data/pup-create.ogg");
- puptakesound = Mix_LoadWAV("/usr/share/curblaster/data/pup-take.ogg");
- shieldupsound = Mix_LoadWAV("/usr/share/curblaster/data/shieldup.ogg");
- shielddownsound = Mix_LoadWAV("/usr/share/curblaster/data/shielddown.ogg");
- crazifysound = Mix_LoadWAV("/usr/share/curblaster/data/crazify.ogg");
- enshotsound = Mix_LoadWAV("/usr/share/curblaster/data/enshot.ogg");
- missilesound = Mix_LoadWAV("/usr/share/curblaster/data/missile.ogg");
- levelendsound = Mix_LoadWAV("/usr/share/curblaster/data/level_end.ogg");
-
- title = Mix_LoadMUS("/usr/share/curblaster/data/title_music.ogg");
+ path_prefix = "/usr/share/curblaster/";
}
+ shotsound = Mix_LoadWAV((path_prefix + "data/shot.ogg").c_str());
+ boomsound = Mix_LoadWAV((path_prefix + "data/boom.ogg").c_str());
+ dropoffsound = Mix_LoadWAV((path_prefix + "data/dropoff.ogg").c_str());
+ pickupsound = Mix_LoadWAV((path_prefix + "data/pickup.ogg").c_str());
+ lasersound = Mix_LoadWAV((path_prefix + "data/laser.ogg").c_str());
+ warningsound = Mix_LoadWAV((path_prefix + "data/warning.ogg").c_str());
+ pupcreatesound = Mix_LoadWAV((path_prefix + "data/pup-create.ogg").c_str());
+ puptakesound = Mix_LoadWAV((path_prefix + "data/pup-take.ogg").c_str());
+ shieldupsound = Mix_LoadWAV((path_prefix + "data/shieldup.ogg").c_str());
+ shielddownsound = Mix_LoadWAV((path_prefix + "data/shielddown.ogg").c_str());
+ crazifysound = Mix_LoadWAV((path_prefix + "data/crazify.ogg").c_str());
+ enshotsound = Mix_LoadWAV((path_prefix + "data/enshot.ogg").c_str());
+ missilesound = Mix_LoadWAV((path_prefix + "data/missile.ogg").c_str());
+ levelendsound = Mix_LoadWAV((path_prefix + "data/level_end.ogg").c_str());
+ title = Mix_LoadMUS((path_prefix + "data/title_music.ogg").c_str());
} else {
sound = 0;
}