Compare commits
5 Commits
v1.1
...
9c10b6a372
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c10b6a372 | |||
| 31f63516ca | |||
| b5f4425672 | |||
| 51eb933383 | |||
| 3f127b5444 |
BIN
data/fosforo.gif
BIN
data/fosforo.gif
Binary file not shown.
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 148 B |
@@ -2435,13 +2435,13 @@ namespace actor
|
|||||||
int partsCollected = 0;
|
int partsCollected = 0;
|
||||||
bool roomVisited[MAX_ROOMS];
|
bool roomVisited[MAX_ROOMS];
|
||||||
int livesLost = 0;
|
int livesLost = 0;
|
||||||
int catsLifeOdds = 5;
|
int catsLifeOdds = 2;
|
||||||
uint32_t start_time = 0;
|
uint32_t start_time = 0;
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
partsCollected = livesLost = 0;
|
partsCollected = livesLost = 0;
|
||||||
catsLifeOdds = 5;
|
catsLifeOdds = 2;
|
||||||
for (int i = 0; i < MAX_ROOMS; ++i)
|
for (int i = 0; i < MAX_ROOMS; ++i)
|
||||||
roomVisited[i] = false;
|
roomVisited[i] = false;
|
||||||
start_time = SDL_GetTicks();
|
start_time = SDL_GetTicks();
|
||||||
|
|||||||
@@ -93,6 +93,20 @@ namespace draw
|
|||||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
||||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
||||||
|
|
||||||
|
SDL_RendererInfo info;
|
||||||
|
const int num_render_drivers = SDL_GetNumRenderDrivers();
|
||||||
|
printf("Available renderers:\n");
|
||||||
|
for (int i=0; i<num_render_drivers; ++i)
|
||||||
|
{
|
||||||
|
SDL_GetRenderDriverInfo(i, &info);
|
||||||
|
printf(" - %i: %s\n", i, info.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_GetRendererInfo(sdl_renderer, &info);
|
||||||
|
printf("\nRenderer: %s\n", info.name);
|
||||||
|
|
||||||
|
SDL_ShowCursor(false);
|
||||||
|
|
||||||
if (screen_fullscreen)
|
if (screen_fullscreen)
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
@@ -173,6 +187,8 @@ namespace draw
|
|||||||
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
|
||||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
||||||
|
|
||||||
|
SDL_ShowCursor(false);
|
||||||
|
|
||||||
if (screen_fullscreen)
|
if (screen_fullscreen)
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|||||||
@@ -341,7 +341,19 @@ namespace file
|
|||||||
#elif __linux__
|
#elif __linux__
|
||||||
struct passwd *pw = getpwuid(getuid());
|
struct passwd *pw = getpwuid(getuid());
|
||||||
const char *homedir = pw->pw_dir;
|
const char *homedir = pw->pw_dir;
|
||||||
config_folder = std::string(homedir) + "/." + foldername;
|
config_folder = std::string(homedir) + "/.config/" + foldername;
|
||||||
|
|
||||||
|
{
|
||||||
|
// Intenta crear ".config", per si no existeix
|
||||||
|
std::string config_base_folder = std::string(homedir) + "/.config";
|
||||||
|
int ret = mkdir(config_base_folder.c_str(), S_IRWXU);
|
||||||
|
if (ret == -1 && errno != EEXIST)
|
||||||
|
{
|
||||||
|
printf("ERROR CREATING CONFIG BASE FOLDER.");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct stat st = {0};
|
struct stat st = {0};
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ namespace modules
|
|||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
audio::playMusic("mus_gameover.ogg", 0);
|
audio::playMusic("mus_gameover.ogg", 0);
|
||||||
if (gat == nullptr) gat = actor::createFromTemplate("GAT-NEGRE");
|
gat = actor::createFromTemplate("GAT-NEGRE");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loop()
|
bool loop()
|
||||||
{
|
{
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) {
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK))
|
||||||
|
{
|
||||||
|
if (gat) actor::remove(gat);
|
||||||
|
gat = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ namespace modules
|
|||||||
if ( (controller::pressed(KEY_MENU)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) )
|
if ( (controller::pressed(KEY_MENU)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) )
|
||||||
{
|
{
|
||||||
missatge[0] = 0;
|
missatge[0] = 0;
|
||||||
|
audio::resumeMusic();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
draw::color(BLACK);
|
draw::color(BLACK);
|
||||||
@@ -989,6 +990,8 @@ namespace modules
|
|||||||
|
|
||||||
void setMissatge(const char *text)
|
void setMissatge(const char *text)
|
||||||
{
|
{
|
||||||
|
actor::pauseWalkSound();
|
||||||
|
audio::pauseMusic();
|
||||||
strcpy(missatge, text);
|
strcpy(missatge, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace modules
|
|||||||
{
|
{
|
||||||
if (audio::getCurrentMusic() != "mus_gameover.ogg") audio::playMusic("mus_gameover.ogg", 0);
|
if (audio::getCurrentMusic() != "mus_gameover.ogg") audio::playMusic("mus_gameover.ogg", 0);
|
||||||
|
|
||||||
if (heroi) actor::remove(heroi);
|
|
||||||
if (actor::hero::isPrologo()) {
|
if (actor::hero::isPrologo()) {
|
||||||
heroi = actor::create("HERO", {16, 32, 0}, {6, 6, 8}, "gat.gif", {0, 0, 24, 28}, {-4, 32});
|
heroi = actor::create("HERO", {16, 32, 0}, {6, 6, 8}, "gat.gif", {0, 0, 24, 28}, {-4, 32});
|
||||||
} else {
|
} else {
|
||||||
@@ -43,7 +42,12 @@ namespace modules
|
|||||||
|
|
||||||
bool loop()
|
bool loop()
|
||||||
{
|
{
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) { return false; }
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK))
|
||||||
|
{
|
||||||
|
if (heroi) actor::remove(heroi);
|
||||||
|
heroi = nullptr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
draw::cls(2);
|
draw::cls(2);
|
||||||
draw::color(1);
|
draw::color(1);
|
||||||
|
|||||||
@@ -76,9 +76,17 @@ namespace modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cleanup()
|
||||||
|
{
|
||||||
|
for (int i=0; i<6; ++i) { actor::remove(parts[i]); parts[i]=nullptr;}
|
||||||
|
actor::remove(anbernic); anbernic=nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int loop()
|
int loop()
|
||||||
{
|
{
|
||||||
if (controller::pressed(KEY_MENU)) {
|
if (controller::pressed(KEY_MENU))
|
||||||
|
{
|
||||||
|
cleanup();
|
||||||
return INGAME_CONTINUAR;
|
return INGAME_CONTINUAR;
|
||||||
}
|
}
|
||||||
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
||||||
@@ -94,11 +102,7 @@ namespace modules
|
|||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_RETURN))
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_RETURN))
|
||||||
{
|
{
|
||||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
if (selected_option==INGAME_EIXIR)
|
cleanup();
|
||||||
{
|
|
||||||
for (int i=0; i<6; ++i) { actor::remove(parts[i]); parts[i]=nullptr;}
|
|
||||||
actor::remove(anbernic); anbernic=nullptr;
|
|
||||||
}
|
|
||||||
return selected_option;
|
return selected_option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace modules
|
|||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
srand(SDL_GetTicks());
|
srand(SDL_GetTicks());
|
||||||
anys = draw::getSurface("25anys.gif");
|
anys = draw::getSurface("25anys.gif"); // getSurface() no crea res, així que no fa falta destruir ni fer res al eixir
|
||||||
num_pixels = 0;
|
num_pixels = 0;
|
||||||
draw::surface *surf = draw::getSurface("jailgames.gif");
|
draw::surface *surf = draw::getSurface("jailgames.gif");
|
||||||
for (int y=0; y<surf->h; ++y)
|
for (int y=0; y<surf->h; ++y)
|
||||||
|
|||||||
@@ -104,9 +104,10 @@ void game::init()
|
|||||||
{
|
{
|
||||||
if (game::getParams(1) && strcmp(game::getParams(1), "editor")==0) editor::setDevMode();
|
if (game::getParams(1) && strcmp(game::getParams(1), "editor")==0) editor::setDevMode();
|
||||||
|
|
||||||
if (editor::isDevMode())
|
if (editor::isDevMode()) {
|
||||||
draw::init("The Pool", 520, 240, zoom);
|
draw::init("The Pool", 520, 240, zoom);
|
||||||
else {
|
SDL_ShowCursor(true);
|
||||||
|
} else {
|
||||||
loadConfig();
|
loadConfig();
|
||||||
draw::init("The Pool", 320, 240, zoom, fullscreen);
|
draw::init("The Pool", 320, 240, zoom, fullscreen);
|
||||||
console::init();
|
console::init();
|
||||||
|
|||||||
Reference in New Issue
Block a user