mirror of
https://github.com/solcloud/Counter-Strike.git
synced 2025-02-22 19:02:27 +01:00
Tuning
This commit is contained in:
parent
49487f51b1
commit
4a7cdc1a05
@ -140,7 +140,7 @@ class World
|
||||
$targetFloor = null;
|
||||
foreach ($floors as $floor) {
|
||||
$distanceSquared = Collision::circleCenterToPlaneBoundaryDistanceSquared($px, $py, $floor);
|
||||
if ($distanceSquared === $targetRadiusSquared) {
|
||||
if ($distanceSquared === $targetRadiusSquared || $distanceSquared === 0) {
|
||||
return $floor;
|
||||
}
|
||||
if ($distanceSquared < $smallestRadiusSquared) {
|
||||
|
@ -8,6 +8,7 @@ export class Game {
|
||||
#hud
|
||||
#stats
|
||||
#pointer
|
||||
#shouldRenderInsideTick
|
||||
#round = 1
|
||||
#roundHalfTime = 2
|
||||
#paused = false
|
||||
@ -314,7 +315,9 @@ export class Game {
|
||||
game.#eventProcessor.process(event)
|
||||
})
|
||||
|
||||
this.#render()
|
||||
if (this.#shouldRenderInsideTick) {
|
||||
this.#render()
|
||||
}
|
||||
this.#stats.end()
|
||||
}
|
||||
|
||||
@ -416,8 +419,9 @@ export class Game {
|
||||
return (!this.meIsAlive())
|
||||
}
|
||||
|
||||
setPointer(pointer) {
|
||||
setDependency(pointer, renderWorldInsideTick) {
|
||||
this.#pointer = pointer
|
||||
this.#shouldRenderInsideTick = renderWorldInsideTick
|
||||
}
|
||||
|
||||
getPlayerMeRotation() {
|
||||
|
@ -11,6 +11,7 @@ export class Setting {
|
||||
crosshair: '✛',
|
||||
crosshairColor: 'd31b1b',
|
||||
preferPerformance: false,
|
||||
matchServerFps: true,
|
||||
anisotropic: 16,
|
||||
exposure: 0.8,
|
||||
},
|
||||
@ -53,46 +54,50 @@ export class Setting {
|
||||
}
|
||||
|
||||
getSprayTriggerDeltaMs() {
|
||||
return this.#setting.base.sprayTriggerDeltaMs || 80
|
||||
return this.#setting.base.sprayTriggerDeltaMs ?? 80
|
||||
}
|
||||
|
||||
getRadarZoom() {
|
||||
return this.#setting.base.radarZoom || 0.9
|
||||
return this.#setting.base.radarZoom ?? 0.9
|
||||
}
|
||||
|
||||
getFieldOfView() {
|
||||
return this.#setting.base.fov || 70
|
||||
return this.#setting.base.fov ?? 70
|
||||
}
|
||||
|
||||
getAnisotropicFiltering() {
|
||||
if (this.shouldPreferPerformance()) {
|
||||
return 1
|
||||
}
|
||||
return this.#setting.base.anisotropic || 16
|
||||
return this.#setting.base.anisotropic ?? 16
|
||||
}
|
||||
|
||||
shouldPreferPerformance() {
|
||||
return this.#setting.base.preferPerformance || false
|
||||
return this.#setting.base.preferPerformance ?? false
|
||||
}
|
||||
|
||||
shouldMatchServerFps() {
|
||||
return this.#setting.base.matchServerFps ?? true
|
||||
}
|
||||
|
||||
getSensitivity() {
|
||||
return this.#setting.base.sensitivity || 1.0
|
||||
return this.#setting.base.sensitivity ?? 1.0
|
||||
}
|
||||
|
||||
getExposure() {
|
||||
return this.#setting.base.exposure || 0.8
|
||||
return this.#setting.base.exposure ?? 0.8
|
||||
}
|
||||
|
||||
getMasterVolume() {
|
||||
return this.#setting.base.volume || 30
|
||||
return this.#setting.base.volume ?? 30
|
||||
}
|
||||
|
||||
getCrosshairSymbol() {
|
||||
return this.#setting.base.crosshair || '+'
|
||||
return this.#setting.base.crosshair ?? '+'
|
||||
}
|
||||
|
||||
getCrosshairColor() {
|
||||
return this.#setting.base.crosshairColor || 'd31b1b'
|
||||
return this.#setting.base.crosshairColor ?? 'd31b1b'
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ let launchGame
|
||||
let initialized = false
|
||||
const world = new World()
|
||||
const hud = new HUD()
|
||||
const stats = new Stats();
|
||||
const game = new Game(world, hud, stats);
|
||||
const stats = new Stats()
|
||||
const game = new Game(world, hud, stats)
|
||||
const action = new PlayerAction(hud)
|
||||
const control = new Control(game, action)
|
||||
hud.injectDependency(game)
|
||||
@ -55,7 +55,7 @@ let launchGame
|
||||
pointerLock.pointerSpeed = setting.getSensitivity()
|
||||
hud.createHud(elementHud, map, setting)
|
||||
control.init(pointerLock, setting)
|
||||
game.setPointer(pointerLock)
|
||||
game.setDependency(pointerLock, setting.shouldMatchServerFps())
|
||||
document.addEventListener("click", function (e) {
|
||||
if (e.target.classList.contains('hud-action')) {
|
||||
return
|
||||
@ -74,11 +74,19 @@ let launchGame
|
||||
})
|
||||
game.onReady(function (options) {
|
||||
connector.startLoop(control, options.tickMs)
|
||||
if (!setting.shouldMatchServerFps()) {
|
||||
render()
|
||||
}
|
||||
})
|
||||
|
||||
connector.connect(url.hostname, url.port, loginCode)
|
||||
}
|
||||
|
||||
function render() {
|
||||
world.render()
|
||||
requestAnimationFrame(render)
|
||||
}
|
||||
|
||||
})()
|
||||
|
||||
export {
|
||||
|
Loading…
x
Reference in New Issue
Block a user