[FIX] [#7] Es pot botar damunt de les peces a arreplegar

This commit is contained in:
2024-10-31 13:18:03 +01:00
parent 3946ea749b
commit dbac3eb3ee

View File

@@ -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 push(actor_t *source, actor_t *act, uint8_t push)
{ {
uint8_t result = 0; uint8_t result = 0;
@@ -672,72 +742,7 @@ namespace actor
{ {
if (act->flags & FLAG_SPECIAL) if (act->flags & FLAG_SPECIAL)
{ {
if (act->name[0] == 'B') return PickSpecial(act, result);
{ // 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 result; return result;
@@ -923,6 +928,11 @@ namespace actor
{ {
audio::pauseChannel(walk_channel); audio::pauseChannel(walk_channel);
audio::playSound("snd_jump.wav", SOUND_BASIC); 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 // [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) if (!act->below && future_below && future_below->flags & FLAG_DEADLY)
act->push |= PUSH_KILL; act->push |= PUSH_KILL;