Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c30e6aeec | |||
| dbac3eb3ee | |||
| 3946ea749b | |||
| 0ab4ca06e3 | |||
| a8892f4f8c | |||
| 4d1739d8e1 |
175
source/actor.cpp
175
source/actor.cpp
@@ -643,6 +643,76 @@ namespace actor
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t PickSpecial(actor_t *act, uint8_t result = 0)
|
||||
{
|
||||
if (act->name[0] == 'B')
|
||||
{ // Es un booster
|
||||
hero::collectBooster(&act->name[5], (act->name[2] - 48) * 10 + (act->name[3] - 48));
|
||||
audio::playSound("snd_boost.wav", SOUND_BASIC);
|
||||
}
|
||||
else if (act->name[0] == 'S')
|
||||
{ // Es un skill
|
||||
hero::giveSkill(&act->name[2]);
|
||||
audio::playSound("snd_boost.wav", SOUND_BASIC);
|
||||
}
|
||||
else if (act->name[0] == 'P')
|
||||
{
|
||||
if (hero::getSkills() & SKILL_BAG)
|
||||
{ // Es una part
|
||||
hero::pickPart(&act->name[2]);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (act->name[0] == 'A')
|
||||
{
|
||||
hero::pickAnbernic(act->name);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
}
|
||||
else if (act->name[0] == 'X')
|
||||
{
|
||||
if (hero::isCarryingPrologoObject()) {
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
} else {
|
||||
hero::pickPrologoObject(act->name[2]-48);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
}
|
||||
}
|
||||
else if (act->name[0] == 'Y')
|
||||
{
|
||||
const int which = act->name[2]-48;
|
||||
if (hero::getPrologoObjectState(which)==PROLOGO_OBJECT_PICKED)
|
||||
{
|
||||
hero::leavePrologoObject(which);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
act->name[0] = 'Z';
|
||||
room::cycleColor(1);
|
||||
return result;
|
||||
} else {
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (act->name[0] == 'Z')
|
||||
{
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_assert(false);
|
||||
}
|
||||
act = actor::replaceWithTemplate(act, "EXPLOSION");
|
||||
act->name[0] = '_';
|
||||
room::cycleColor(1);
|
||||
return PUSH_NONE;
|
||||
}
|
||||
|
||||
uint8_t push(actor_t *source, actor_t *act, uint8_t push)
|
||||
{
|
||||
uint8_t result = 0;
|
||||
@@ -672,72 +742,7 @@ namespace actor
|
||||
{
|
||||
if (act->flags & FLAG_SPECIAL)
|
||||
{
|
||||
if (act->name[0] == 'B')
|
||||
{ // Es un booster
|
||||
hero::collectBooster(&act->name[5], (act->name[2] - 48) * 10 + (act->name[3] - 48));
|
||||
audio::playSound("snd_boost.wav", SOUND_BASIC);
|
||||
}
|
||||
else if (act->name[0] == 'S')
|
||||
{ // Es un skill
|
||||
hero::giveSkill(&act->name[2]);
|
||||
audio::playSound("snd_boost.wav", SOUND_BASIC);
|
||||
}
|
||||
else if (act->name[0] == 'P')
|
||||
{
|
||||
if (hero::getSkills() & SKILL_BAG)
|
||||
{ // Es una part
|
||||
hero::pickPart(&act->name[2]);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (act->name[0] == 'A')
|
||||
{
|
||||
hero::pickAnbernic(act->name);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
}
|
||||
else if (act->name[0] == 'X')
|
||||
{
|
||||
if (hero::isCarryingPrologoObject()) {
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
} else {
|
||||
hero::pickPrologoObject(act->name[2]-48);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
}
|
||||
}
|
||||
else if (act->name[0] == 'Y')
|
||||
{
|
||||
const int which = act->name[2]-48;
|
||||
if (hero::getPrologoObjectState(which)==PROLOGO_OBJECT_PICKED)
|
||||
{
|
||||
hero::leavePrologoObject(which);
|
||||
audio::playSound("snd_pick.wav", SOUND_BASIC);
|
||||
act->name[0] = 'Z';
|
||||
room::cycleColor(1);
|
||||
return result;
|
||||
} else {
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (act->name[0] == 'Z')
|
||||
{
|
||||
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_assert(false);
|
||||
}
|
||||
act = actor::replaceWithTemplate(act, "EXPLOSION");
|
||||
act->name[0] = '_';
|
||||
room::cycleColor(1);
|
||||
return PUSH_NONE;
|
||||
return PickSpecial(act, result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -780,7 +785,11 @@ namespace actor
|
||||
{
|
||||
hero::useBoostRun();
|
||||
act->orient = PUSH_XP;
|
||||
if (((act->pos.x + act->size.x) < max.x && act->pos.y >= min.y && (act->pos.y + act->size.y) <= max.y) || ((room::getDoors() & DOOR_XP) && (act->pos.y >= 24) && (act->pos.y <= 32)))
|
||||
if (
|
||||
( ((act->pos.x + act->size.x) < max.x) && (act->pos.y >= min.y) && ((act->pos.y + act->size.y) <= max.y) )
|
||||
||
|
||||
( (room::getDoors() & DOOR_XP) && (act->pos.y >= 24) && (act->pos.y <= 32) )
|
||||
)
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
@@ -911,10 +920,23 @@ namespace actor
|
||||
actor::actor_t *future_below = any_below_me(act);
|
||||
// if ((input::keyDown(SDL_SCANCODE_SPACE) || input::keyDown(config::getKey(KEY_JUMP))) &&
|
||||
if ((controller::down(KEY_JUMP)) && ((hero::getSkills() & SKILL_SHOES) || actor::hero::isPrologo())
|
||||
&& (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y && (act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x && act->react_mask == 0 && ((act->pos.z == 0 && room::getFloor() != 11) || (act->below || future_below)))
|
||||
&& (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y &&
|
||||
(act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x &&
|
||||
act->react_mask == 0 &&
|
||||
( (act->pos.z == 0 && room::getFloor() != 11 && room::getExit(ZN)==-1) || (act->below || future_below) )
|
||||
)
|
||||
{
|
||||
audio::pauseChannel(walk_channel);
|
||||
audio::playSound("snd_jump.wav", SOUND_BASIC);
|
||||
// [RZC 31/10/2024] Hack per a que al aterrar sobre els especials els pille
|
||||
if (!act->below && future_below && future_below->flags & FLAG_SPECIAL)
|
||||
{
|
||||
act->push |= PickSpecial(future_below);
|
||||
}
|
||||
// [RZC 11/10/2024] Hack per a que al aterrar sobre els que maten, te maten
|
||||
if (!act->below && future_below && future_below->flags & FLAG_DEADLY)
|
||||
act->push |= PUSH_KILL;
|
||||
|
||||
// [RZC 01/10/2024] Hack per a que al aterrar sobre els que desapareixen puga botar sobre ells, i a més ells desapareguen
|
||||
if (!act->below && future_below && future_below->flags & FLAG_DISAPPEAR)
|
||||
actor::push(act, future_below, PUSH_ZN);
|
||||
@@ -1261,7 +1283,7 @@ namespace actor
|
||||
{
|
||||
act->pos.x += vel;
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || !(act->flags & FLAG_HERO))))
|
||||
if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || (act->pos.z != room::getDoor(XP) * 4) || !(act->flags & FLAG_HERO))))
|
||||
{
|
||||
if (other) {
|
||||
uint8_t push_value = push(act, other, PUSH_XP);
|
||||
@@ -1342,7 +1364,7 @@ namespace actor
|
||||
{
|
||||
act->pos.y += vel;
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || !(act->flags & FLAG_HERO))))
|
||||
if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || (act->pos.z != room::getDoor(YP) * 4) || !(act->flags & FLAG_HERO))))
|
||||
{
|
||||
if (other) {
|
||||
uint8_t push_value = push(act, other, PUSH_YP);
|
||||
@@ -2077,6 +2099,7 @@ namespace actor
|
||||
brilli = draw::getSurface("objectes.gif");
|
||||
if ((config::getSoundMode() == SOUND_ALL))
|
||||
{
|
||||
if (walk_channel != -1) audio::stopChannel(walk_channel);
|
||||
walk_channel = audio::playSound("snd_walk.wav", SOUND_ALL, -1);
|
||||
audio::pauseChannel(walk_channel);
|
||||
}
|
||||
@@ -2222,6 +2245,8 @@ namespace actor
|
||||
|
||||
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"};
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
@@ -2259,10 +2284,10 @@ namespace actor
|
||||
bool giveSkill(char *skill)
|
||||
{
|
||||
const int skill_number = getSkillFromString(skill);
|
||||
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_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!");
|
||||
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_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!");
|
||||
return giveSkill(skill_number);
|
||||
}
|
||||
|
||||
@@ -2289,6 +2314,8 @@ namespace actor
|
||||
|
||||
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"};
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
|
||||
@@ -72,6 +72,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (SDL_GetTicks()-current_ticks >= game::ticks_per_frame)
|
||||
{
|
||||
current_ticks = SDL_GetTicks();
|
||||
if (!game::loop()) game::should_exit = true;
|
||||
input::updateKey(SDL_SCANCODE_UNKNOWN);
|
||||
input::updateKeypressed(SDL_SCANCODE_UNKNOWN);
|
||||
@@ -79,7 +80,6 @@ int main(int argc, char *argv[])
|
||||
input::updateWheel(0);
|
||||
input::updatePadBtn(SDL_CONTROLLER_BUTTON_INVALID);
|
||||
input::updatePadBtnPressed(SDL_CONTROLLER_BUTTON_INVALID);
|
||||
current_ticks = SDL_GetTicks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace modules
|
||||
|
||||
void init()
|
||||
{
|
||||
audio::playMusic("mus_gameover.ogg", 0);
|
||||
gat = actor::createFromTemplate("GAT-NEGRE");
|
||||
if (audio::getCurrentMusic() != "mus_gameover.ogg") audio::playMusic("mus_gameover.ogg", 0);
|
||||
gat = actor::createFromTemplate("GAT-BATMAN");
|
||||
}
|
||||
|
||||
bool loop()
|
||||
@@ -26,6 +26,7 @@ namespace modules
|
||||
{
|
||||
if (gat) actor::remove(gat);
|
||||
gat = nullptr;
|
||||
audio::playMusic("mus_ingame.ogg");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace modules
|
||||
|
||||
void init(bool go_direct_to_credits)
|
||||
{
|
||||
audio::stopAllChannel();
|
||||
stage = go_direct_to_credits ? 2 : 0;
|
||||
time = SDL_GetTicks();
|
||||
if (go_direct_to_credits) time += 5000;
|
||||
@@ -55,7 +56,7 @@ namespace modules
|
||||
const bool shouldGoToNext()
|
||||
{
|
||||
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)) ||
|
||||
(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(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("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE);
|
||||
draw::print2(actor::stats::getLivesLost(), 2, 8, 16, TEAL, 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("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE);
|
||||
draw::print2(time_text, 4, 18, TEAL, 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;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace modules
|
||||
draw::color(1);
|
||||
draw::swapcol(1, WHITE);
|
||||
actor::update(heroi, false);
|
||||
actor::drawAt(heroi, 150, 160);
|
||||
actor::drawAt(heroi, 150, 176);
|
||||
|
||||
draw::print2("THE POOL", 16, 3, TEAL, FONT_ZOOM_VERTICAL);
|
||||
|
||||
@@ -63,21 +63,27 @@ namespace modules
|
||||
{
|
||||
int num_objectes = 0;
|
||||
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("OBJECTES DEJATS", 14, 12, GREEN, FONT_ZOOM_NONE);
|
||||
draw::print2(num_objectes, 2, 8, 12, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("OBJECTES DEJATS", 13, 12, GREEN, FONT_ZOOM_NONE);
|
||||
} else {
|
||||
draw::print2(actor::stats::getNumPartsCollected(), 2, 11, 12, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("PARTS TROBADES", 14, 12, GREEN, FONT_ZOOM_NONE);
|
||||
draw::print2(actor::stats::getNumPartsCollected(), 2, 8, 12, TEAL, 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("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("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE);
|
||||
draw::print2(actor::stats::getLivesLost(), 2, 8, 16, TEAL, 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("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE);
|
||||
draw::print2(time_text, 4, 18, TEAL, 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);
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ namespace modules
|
||||
//draw::print2(input::getPadBtnPressed(), 3, 0, 24, RED, FONT_ZOOM_NONE);
|
||||
|
||||
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("v1.5", 36, 28, WHITE, FONT_ZOOM_NONE);
|
||||
|
||||
draw::render();
|
||||
return OPTION_NONE;
|
||||
|
||||
Reference in New Issue
Block a user