From a522cb597d805ef7e9d5d974398047eb5697272c Mon Sep 17 00:00:00 2001 From: Dominic Szablewski Date: Tue, 14 Sep 2021 11:43:44 +0200 Subject: [PATCH] Implement mouse invert checkbox --- build.sh | 2 +- source/document.js | 2 +- source/entity_player.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index b36798b..271a658 100755 --- a/build.sh +++ b/build.sh @@ -109,7 +109,7 @@ npx uglify-js build/game.packed.js \ --compress --mangle toplevel --mangle-props regex=/^_/ \ -o build/game.min.js -npx roadroller -Zab14 -Zlr1113 -Zmd16 -Zpr14 -S0,1,2,3,6,7,13,21,25,50,235,333 build/game.min.js -o build/game.roadrolled.js +npx roadroller -Zab14 -Zlr930 -Zmd19 -Zpr14 -S0,1,2,3,7,13,14,19,58,97,305,422 build/game.min.js -o build/game.roadrolled.js # Embed source into HTML sed -e '/GAME_SOURCE/{r build/game.roadrolled.js' -e 'd}' source/html_template.html > build/index.html diff --git a/source/document.js b/source/document.js index 22c1c30..d961f54 100644 --- a/source/document.js +++ b/source/document.js @@ -17,7 +17,7 @@ document.body.innerHTML += '
'+ '
'+ ''+ - '

MOUSE SPEED:

'+ + '

MOUSE SPEED: INVERT:

'+ '

'+ '

'+ 'code: phoboslab.org / music: no-fate.net'+ diff --git a/source/entity_player.js b/source/entity_player.js index 875992d..4bcb904 100755 --- a/source/entity_player.js +++ b/source/entity_player.js @@ -24,7 +24,7 @@ class entity_player_t extends entity_t { _update() { // Mouse look - this._pitch = clamp(this._pitch + mouse_y * m.value * 0.00015, -1.5, 1.5); + this._pitch = clamp(this._pitch + mouse_y * m.value * (mi.checked ? -0.00015 : 0.00015), -1.5, 1.5); this._yaw = (this._yaw + mouse_x * m.value * 0.00015) % (Math.PI*2); // Acceleration in movement direction