Allow swapping and cycling even while sliding

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-21 00:04:51 -07:00
parent 077a809168
commit b0aeee6ff0

View File

@ -971,28 +971,24 @@ export class Level extends LevelInterface {
// as an override. // as an override.
let may_move = (! actor.slide_mode || (actor.slide_mode === 'force' && actor.last_move_was_force)); let may_move = (! actor.slide_mode || (actor.slide_mode === 'force' && actor.last_move_was_force));
// Check for special player actions, which can only happen when allowed to move // Check for special player actions, which can only happen at decision time. Dropping can
// FIXME if you press a key while moving it should happen as soon as you stop (assuming // only be done when the player is allowed to make a move (i.e. override), but the other two
// the key is still held down) // can be done freely while sliding.
// FIXME cc2 seems to rely on key repeat for this; the above is true, but also, if you // FIXME cc2 seems to rely on key repeat for this; if you have four bowling balls and hold
// have four bowling balls and hold Q, you'll throw the first, wait a second or so, then // Q, you'll throw the first, wait a second or so, then release the rest rapid-fire. absurd
// release the rest rapid-fire. absurd let new_input = input & this.p1_released;
// FIXME i am not actually sure this goes here if (new_input & INPUT_BITS.cycle) {
if (may_move) { this.cycle_inventory(this.player);
let new_input = input & this.p1_released;
if (new_input & INPUT_BITS.cycle) {
this.cycle_inventory(this.player);
}
if (new_input & INPUT_BITS.drop) {
this.drop_item(this.player);
}
if ((new_input & INPUT_BITS.swap) && this.remaining_players > 1) {
// This is delayed until the end of the tic to avoid screwing up anything
// checking this.player
this.swap_player1 = true;
}
this.p1_released = ~input;
} }
if ((new_input & INPUT_BITS.drop) && may_move) {
this.drop_item(this.player);
}
if ((new_input & INPUT_BITS.swap) && this.remaining_players > 1) {
// This is delayed until the end of the tic to avoid screwing up anything
// checking this.player
this.swap_player1 = true;
}
this.p1_released = ~input;
if (actor.slide_mode && ! (may_move && dir1)) { if (actor.slide_mode && ! (may_move && dir1)) {
// This is a forced move, in which case we don't even check it // This is a forced move, in which case we don't even check it