- [FIX] [#2] Quan et donen una cat's life, ja no torna la música del joc

- [FIX] [#3] Quan entres a la habitació de la depuradora ...
- [FIX] [#4] ficar anbernics recopilades en el game over i altres pantalles de resum
- [FIX] [#5] que al acabar el joc la seuquencia acabe amb els stats, com el game over
This commit is contained in:
2024-10-31 12:08:10 +01:00
parent a8892f4f8c
commit 0ab4ca06e3
5 changed files with 41 additions and 22 deletions

View File

@@ -2072,7 +2072,7 @@ namespace actor
if (complete) if (complete)
{ {
stats::reset(); stats::reset();
lives = 8; lives = 1;
skills = SKILL_NONE; skills = SKILL_NONE;
if (prologo) skills &= SKILL_SHOES; if (prologo) skills &= SKILL_SHOES;
for (int i=0;i<4;++i) prologo_objects[i] = PROLOGO_OBJECT_INITIAL; for (int i=0;i<4;++i) prologo_objects[i] = PROLOGO_OBJECT_INITIAL;
@@ -2085,6 +2085,7 @@ namespace actor
brilli = draw::getSurface("objectes.gif"); brilli = draw::getSurface("objectes.gif");
if ((config::getSoundMode() == SOUND_ALL)) if ((config::getSoundMode() == SOUND_ALL))
{ {
if (walk_channel != -1) audio::stopChannel(walk_channel);
walk_channel = audio::playSound("snd_walk.wav", SOUND_ALL, -1); walk_channel = audio::playSound("snd_walk.wav", SOUND_ALL, -1);
audio::pauseChannel(walk_channel); audio::pauseChannel(walk_channel);
} }
@@ -2230,6 +2231,8 @@ namespace actor
const int getSkillFromString(char *skill) const int getSkillFromString(char *skill)
{ {
if ( (strcmp(skill, "ALL")==0) || (strcmp(skill, "SKILLS")==0) ) return SKILL_SHOES | SKILL_GLOVES | SKILL_PANTS | SKILL_BAG;
static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"}; static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
@@ -2267,10 +2270,10 @@ namespace actor
bool giveSkill(char *skill) bool giveSkill(char *skill)
{ {
const int skill_number = getSkillFromString(skill); const int skill_number = getSkillFromString(skill);
if (skill_number==SKILL_SHOES) modules::game::setMissatge(" JA TENS LES SABATES!- ARA JA POTS BOTAR!"); if (skill_number | SKILL_SHOES) modules::game::setMissatge(" JA TENS LES SABATES!- ARA JA POTS BOTAR!");
else if (skill_number==SKILL_GLOVES) modules::game::setMissatge(" JA TENS ELS GUANTS!- ARA JA POTS ESPENTAR!"); else if (skill_number | SKILL_GLOVES) modules::game::setMissatge(" JA TENS ELS GUANTS!- ARA JA POTS ESPENTAR!");
else if (skill_number==SKILL_PANTS) modules::game::setMissatge(" JA TENS ELS PANTALONS!- JA POTS AGAFAR COSES!"); else if (skill_number | SKILL_PANTS) modules::game::setMissatge(" JA TENS ELS PANTALONS!- JA POTS AGAFAR COSES!");
else if (skill_number==SKILL_BAG) modules::game::setMissatge(" JA TENS LA MOTXILLA!- A ARREPLEGAR PECES!"); else if (skill_number | SKILL_BAG) modules::game::setMissatge(" JA TENS LA MOTXILLA!- A ARREPLEGAR PECES!");
return giveSkill(skill_number); return giveSkill(skill_number);
} }
@@ -2297,6 +2300,8 @@ namespace actor
const int getPartFromString(char *part) const int getPartFromString(char *part)
{ {
if ( (strcmp(part, "ALL")==0) || (strcmp(part, "PARTS")==0) ) return 0x3f;
static const char *partset_name[6] = {"FILTER", "PUMP", "TIMER", "SALT", "PIPE", "ELBOW"}; static const char *partset_name[6] = {"FILTER", "PUMP", "TIMER", "SALT", "PIPE", "ELBOW"};
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {

View File

@@ -72,6 +72,7 @@ int main(int argc, char *argv[])
if (SDL_GetTicks()-current_ticks >= game::ticks_per_frame) if (SDL_GetTicks()-current_ticks >= game::ticks_per_frame)
{ {
current_ticks = SDL_GetTicks();
if (!game::loop()) game::should_exit = true; if (!game::loop()) game::should_exit = true;
input::updateKey(SDL_SCANCODE_UNKNOWN); input::updateKey(SDL_SCANCODE_UNKNOWN);
input::updateKeypressed(SDL_SCANCODE_UNKNOWN); input::updateKeypressed(SDL_SCANCODE_UNKNOWN);
@@ -79,7 +80,6 @@ int main(int argc, char *argv[])
input::updateWheel(0); input::updateWheel(0);
input::updatePadBtn(SDL_CONTROLLER_BUTTON_INVALID); input::updatePadBtn(SDL_CONTROLLER_BUTTON_INVALID);
input::updatePadBtnPressed(SDL_CONTROLLER_BUTTON_INVALID); input::updatePadBtnPressed(SDL_CONTROLLER_BUTTON_INVALID);
current_ticks = SDL_GetTicks();
} }
} }

View File

@@ -26,6 +26,7 @@ namespace modules
{ {
if (gat) actor::remove(gat); if (gat) actor::remove(gat);
gat = nullptr; gat = nullptr;
audio::playMusic("mus_ingame.ogg");
return false; return false;
} }

View File

@@ -21,6 +21,7 @@ namespace modules
void init(bool go_direct_to_credits) void init(bool go_direct_to_credits)
{ {
audio::stopAllChannel();
stage = go_direct_to_credits ? 2 : 0; stage = go_direct_to_credits ? 2 : 0;
time = SDL_GetTicks(); time = SDL_GetTicks();
if (go_direct_to_credits) time += 5000; if (go_direct_to_credits) time += 5000;
@@ -55,7 +56,7 @@ namespace modules
const bool shouldGoToNext() const bool shouldGoToNext()
{ {
if (SDL_GetTicks()-time < 1000) return false; if (SDL_GetTicks()-time < 1000) return false;
return (SDL_GetTicks()-time > (stage==15||stage==16?10000:5000)) || return ( (stage<16) && (SDL_GetTicks()-time > (stage==15?10000:5000)) ) ||
(controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) ||
(input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN)); (input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN));
} }
@@ -147,13 +148,19 @@ namespace modules
draw::print2("GRACIES PER JUGAR!", 11, 9, PURPLE, FONT_ZOOM_VERTICAL); draw::print2("GRACIES PER JUGAR!", 11, 9, PURPLE, FONT_ZOOM_VERTICAL);
draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE); draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 11, 14, GREEN, FONT_ZOOM_NONE); draw::print2("HABITACIONS VISITADES", 13, 14, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 11, 16, TEAL, FONT_ZOOM_NONE); draw::print2(actor::stats::getLivesLost(), 2, 8, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE); draw::print2("VIDES PERDUDES", 13, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 11, 18, TEAL, FONT_ZOOM_NONE); draw::print2(time_text, 4, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE); draw::print2("TEMPS TOTAL", 13, 18, GREEN, FONT_ZOOM_NONE);
if (actor::hero::getNumAmbernicsCollected()>0)
{
draw::print2(actor::hero::getNumAmbernicsCollected(), 2, 8, 20, TEAL, FONT_ZOOM_NONE);
draw::print2("ANBERNICS ARREPLEGADES", 13, 20, GREEN, FONT_ZOOM_NONE);
}
break; break;

View File

@@ -53,7 +53,7 @@ namespace modules
draw::color(1); draw::color(1);
draw::swapcol(1, WHITE); draw::swapcol(1, WHITE);
actor::update(heroi, false); actor::update(heroi, false);
actor::drawAt(heroi, 150, 160); actor::drawAt(heroi, 150, 176);
draw::print2("THE POOL", 16, 3, TEAL, FONT_ZOOM_VERTICAL); draw::print2("THE POOL", 16, 3, TEAL, FONT_ZOOM_VERTICAL);
@@ -63,21 +63,27 @@ namespace modules
{ {
int num_objectes = 0; int num_objectes = 0;
for (int i=0;i<4;++i) if (actor::hero::getPrologoObjectState(i)==PROLOGO_OBJECT_LEFT) num_objectes++; for (int i=0;i<4;++i) if (actor::hero::getPrologoObjectState(i)==PROLOGO_OBJECT_LEFT) num_objectes++;
draw::print2(num_objectes, 2, 11, 12, TEAL, FONT_ZOOM_NONE); draw::print2(num_objectes, 2, 8, 12, TEAL, FONT_ZOOM_NONE);
draw::print2("OBJECTES DEJATS", 14, 12, GREEN, FONT_ZOOM_NONE); draw::print2("OBJECTES DEJATS", 13, 12, GREEN, FONT_ZOOM_NONE);
} else { } else {
draw::print2(actor::stats::getNumPartsCollected(), 2, 11, 12, TEAL, FONT_ZOOM_NONE); draw::print2(actor::stats::getNumPartsCollected(), 2, 8, 12, TEAL, FONT_ZOOM_NONE);
draw::print2("PARTS TROBADES", 14, 12, GREEN, FONT_ZOOM_NONE); draw::print2("PARTS TROBADES", 13, 12, GREEN, FONT_ZOOM_NONE);
} }
draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE); draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 11, 14, GREEN, FONT_ZOOM_NONE); draw::print2("HABITACIONS VISITADES", 13, 14, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 11, 16, TEAL, FONT_ZOOM_NONE); draw::print2(actor::stats::getLivesLost(), 2, 8, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE); draw::print2("VIDES PERDUDES", 13, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 11, 18, TEAL, FONT_ZOOM_NONE); draw::print2(time_text, 4, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE); draw::print2("TEMPS TOTAL", 13, 18, GREEN, FONT_ZOOM_NONE);
if (actor::hero::getNumAmbernicsCollected()>0)
{
draw::print2(actor::hero::getNumAmbernicsCollected(), 2, 8, 20, TEAL, FONT_ZOOM_NONE);
draw::print2("ANBERNICS ARREPLEGADES", 13, 20, GREEN, FONT_ZOOM_NONE);
}
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE); draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);