Implement MS-style instant movement for some reason

This commit is contained in:
Eevee (Evelyn Woods) 2024-04-11 03:50:58 -06:00
parent 2b35dd5bce
commit 1df89884ed
3 changed files with 14 additions and 10 deletions

View File

@ -183,15 +183,14 @@ export const COMPAT_FLAGS = [
key: 'force_lynx_animation_lengths',
label: "Animations use Lynx duration",
rulesets: new Set(['lynx']),
}, {
key: 'actors_move_instantly',
label: "Movement happens instantly",
rulesets: new Set(['ms']),
},
// Tiles
{
// XXX this is goofy
key: 'tiles_react_instantly',
label: "Tiles react when approached",
rulesets: new Set(['ms']),
}, {
key: 'rff_actually_random',
label: "Random force floors are actually random",
rulesets: new Set(['ms']),

View File

@ -33,7 +33,7 @@ export class Tile {
// Gives the effective position of an actor in motion, given smooth scrolling
visual_position(update_progress = 0, update_rate = 0) {
if (! this.previous_cell || this.movement_speed === null) {
if (! this.previous_cell || this.movement_speed === null || this.moves_instantly) {
return [this.cell.x, this.cell.y];
}
@ -414,6 +414,9 @@ export class Level extends LevelInterface {
}
if (tile.type.is_actor) {
this.actors.push(tile);
if (this.compat.actors_move_instantly) {
tile.moves_instantly = true;
}
}
cell._add(tile);
@ -564,7 +567,7 @@ export class Level extends LevelInterface {
// but it can't anyway because Tile.wire_directions = 0; need some
// other way to identify a tile as wired, or at least an actor
if (actor && actor.wire_directions &&
(actor.movement_cooldown === 0 || this.compat.tiles_react_instantly))
(actor.movement_cooldown === 0 || this.compat.actors_move_instantly))
{
wire_directions = actor.wire_directions;
}
@ -1128,7 +1131,7 @@ export class Level extends LevelInterface {
}
}
if (! this.compat.tiles_react_instantly) {
if (! this.compat.actors_move_instantly) {
this.step_on_cell(actor, actor.cell);
}
// Note that we don't erase the movement bookkeeping until next decision phase, because
@ -1971,7 +1974,7 @@ export class Level extends LevelInterface {
this.add_tile(actor, goal_cell);
}
if (this.compat.tiles_react_instantly) {
if (this.compat.actors_move_instantly) {
this.step_on_cell(actor, actor.cell);
}
}
@ -2198,6 +2201,9 @@ export class Level extends LevelInterface {
}
if (tile.cell) {
this.add_actor(tile);
if (this.compat.actors_move_instantly) {
tile.moves_instantly = true;
}
}
this.add_tile(dropping_actor, cell);
}

View File

@ -1750,7 +1750,6 @@ class Player extends PrimaryView {
else {
// Figure out how far we are between the last game update and the next one, so the
// renderer can interpolate appropriately.
let now = performance.now();
let elapsed = (performance.now() - this.last_advance) / 1000;
let speed = this.play_speed;
if (this.state === 'rewinding') {