diff --git a/code/debug.js b/code/debug.js index bf393d9..b4a2d8c 100644 --- a/code/debug.js +++ b/code/debug.js @@ -4,11 +4,11 @@ const debug = 1; let enhancedMode = 1; let enableAsserts = 1; let devMode = 0; -let autoPause = 1; let downloadLink, debugMesh, debugTile, debugCapture, debugCanvas; let debugGenerativeCanvas=0, debugInfo=0, debugSkipped=0; let debugGenerativeCanvasCached, showMap; let freeCamPos, freeCamRot, mouseDelta; +const js13kBuildLevel2 = 0; // more space is needed for js13k function ASSERT(assert, output) { enableAsserts&&(output ? console.assert(assert, output) : console.assert(assert)); } @@ -24,39 +24,8 @@ function debugInit() debugCanvas = document.createElement('canvas'); downloadLink = document.createElement('a'); } - -function enhancedModeUpdate() -{ - if (!enhancedMode) - return; - - if (autoPause && !document.hasFocus() && !titleScreenMode && !isTouchDevice) - paused = 1; // pause when losing focus - - if (keyWasPressed('Home')) // dev mode - devMode || (debugInfo = devMode = 1); - if (keyWasPressed('KeyI')) // debug info - debugInfo = !debugInfo; - if (keyWasPressed('KeyM')) // toggle mute - { - if (soundVolume) - sound_bump.play(.4,3); - soundVolume = soundVolume ? 0 : .3; - if (soundVolume) - sound_bump.play(); - } - if (keyWasPressed('KeyR')) // restart - { - titleScreenMode = 0; - sound_lose.play(1,2); - gameStart(); - } -} - function debugUpdate() { - enhancedModeUpdate(); - if (!devMode) return; diff --git a/code/game.js b/code/game.js index e108c51..cb68ace 100644 --- a/code/game.js +++ b/code/game.js @@ -1,15 +1,14 @@ 'use strict'; // debug settings -let testLevel = 0; -let quickStart = 0; -let aiVehicles = 1; -let testDrive = 0; -let freeCamMode = 0; +let testLevel; +let quickStart; +let disableAiVehicles; +let testDrive; +let freeCamMode; let testLevelInfo; -let testQuick = 0; -const js13kBuild = 1; // hacks made when building for js13k -const js13kBuildLevel2 = 0; // if more space is needed for js13k +let testQuick; +const js13kBuild = 1; // fixes for legacy code made during js13k /////////////////////////////////////////////////// @@ -22,6 +21,7 @@ const pixelateScale = 3; const clampAspectRatios = enhancedMode; const optimizedCulling = 1; const random = new Random; +let autoPause = enhancedMode; let autoFullscreen = 0; // setup @@ -332,6 +332,7 @@ function gameUpdate(frameTimeMS=0) // increment frame and update time time = frame++ / frameRate; gameUpdateInternal(); + enhancedModeUpdate(); debugUpdate(); inputUpdate(); @@ -362,6 +363,34 @@ function gameUpdate(frameTimeMS=0) debugDraw(); } +function enhancedModeUpdate() +{ + if (!enhancedMode) + return; + + if (autoPause && !document.hasFocus() && !titleScreenMode && !isTouchDevice) + paused = 1; // pause when losing focus + + if (keyWasPressed('Home')) // dev mode + devMode || (debugInfo = devMode = 1); + if (keyWasPressed('KeyI')) // debug info + debugInfo = !debugInfo; + if (keyWasPressed('KeyM')) // toggle mute + { + if (soundVolume) + sound_bump.play(.4,3); + soundVolume = soundVolume ? 0 : .3; + if (soundVolume) + sound_bump.play(); + } + if (keyWasPressed('KeyR')) // restart + { + titleScreenMode = 0; + sound_lose.play(1,2); + gameStart(); + } +} + function updateCamera() { // update camera diff --git a/code/generative.js b/code/generative.js index 9a80f73..c44fb45 100644 --- a/code/generative.js +++ b/code/generative.js @@ -408,7 +408,6 @@ function generateTetures() drawRock(x,random.float(.03),random.float(.05),.005,.4,.3,.3,y,z,500,cHSL,.4); } setupContext(5,4); - random.setSeed(9); for(let i=99; i--;) // water { const p = i/99; diff --git a/code/hud.js b/code/hud.js index 696ef6b..0cf7758 100644 --- a/code/hud.js +++ b/code/hud.js @@ -37,7 +37,9 @@ function drawHUD() for(let i=0;i 5) { - const timeString = formatTimeString(bestTime); - if (!js13kBuildLevel2) - drawHUDText('BEST TIME', vec3(.5,.9), .07, undefined, 'monospace',undefined,900,undefined,undefined,undefined,3); - drawHUDText(timeString, vec3(.5,.97), .07, undefined, 'monospace',undefined,900,undefined,undefined,undefined,3); - } - else if (enhancedMode && !isTouchDevice) - { - drawHUDText('CLICK TO PLAY', vec3(.5,.97), .07, undefined, 'monospace',undefined,900,undefined,undefined,undefined,3); + if (bestTime && (!enhancedMode || time%20<10)) + { + const timeString = formatTimeString(bestTime); + if (!js13kBuildLevel2) + drawHUDText('BEST TIME', vec3(.5,.9), .07, undefined, 'monospace',undefined,900,undefined,undefined,undefined,3); + drawHUDText(timeString, vec3(.5,.97), .07, undefined, 'monospace',undefined,900,undefined,undefined,undefined,3); + } + else if (enhancedMode && !isTouchDevice) + { + drawHUDText('CLICK TO PLAY', vec3(.5,.97), .07, undefined, 'monospace',undefined,900,undefined,undefined,undefined,3); + } } } else if (startCountdownTimer.active() || startCountdown) diff --git a/code/main.js b/code/main.js index e5306e1..ecb3e05 100644 --- a/code/main.js +++ b/code/main.js @@ -34,7 +34,7 @@ Features //debugGenerativeCanvas = 1 //autoPause = 0 //quickStart = 1 -//aiVehicles = 0 +//disableAiVehicles = 1 /////////////////////////////////////////////////// diff --git a/code/release.js b/code/release.js index fc309c4..dc81a7e 100644 --- a/code/release.js +++ b/code/release.js @@ -1,7 +1,9 @@ 'use strict'; const debug = 0; -let debugInfo, debugMesh, debugTile, debugGenerativeCanvas, devMode, enhancedMode; +const enhancedMode = 1; +let debugInfo, debugMesh, debugTile, debugGenerativeCanvas, devMode; +const js13kBuildLevel2 = 0; // more space is needed for js13k // disable debug features function ASSERT() {} diff --git a/code/releaseJS13K.js b/code/releaseJS13K.js new file mode 100644 index 0000000..b216599 --- /dev/null +++ b/code/releaseJS13K.js @@ -0,0 +1,15 @@ +'use strict'; + +const debug = 0; +let debugInfo, debugMesh, debugTile, debugGenerativeCanvas, devMode, enhancedMode; +const js13kBuildLevel2 = 1; // more space is needed for js13k + +// disable debug features +function ASSERT() {} +function debugInit() {} +function drawDebug() {} +function debugUpdate() {} +function debugSaveCanvas() {} +function debugSaveText() {} +function debugDraw() {} +function debugSaveDataURL() {} \ No newline at end of file diff --git a/code/vehicle.js b/code/vehicle.js index 6f436fa..7e9bdb6 100644 --- a/code/vehicle.js +++ b/code/vehicle.js @@ -30,7 +30,7 @@ function updateCars() function spawnVehicle(z) { - if (!aiVehicles) + if (disableAiVehicles) return; const v = new Vehicle(z); diff --git a/favicon.png b/favicon.png index cc65050..17aaf40 100644 Binary files a/favicon.png and b/favicon.png differ diff --git a/index.html b/index.html index f8a2959..7029223 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ Dr1v3n Wild! 🚗🌴 - + @@ -27,19 +27,19 @@ document.body.style.backgroundColor = '#222'; } - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + \ No newline at end of file