@@ -185,13 +185,16 @@ <h2>Mines:</h2>
185185 </ div >
186186 < hr />
187187 < div class ="cmenu-radio optional ">
188- < p > Marks (?)</ p >
188+ < p id ="marks "> Marks (?)</ p >
189+ </ div >
190+ < div class ="cmenu-radio optional ">
191+ < p id ="shortcuts "> Shortcuts</ p >
189192 </ div >
190193 < div class ="cmenu-radio optional ">
191194 < p id ="saturation " class ="selected "> Color</ p >
192195 </ div >
193196 < hr />
194- < p > Best Times...</ p >
197+ < p onclick =" getLeaderboardForDifficulty(true) " > Best Times...</ p >
195198 < hr />
196199 < p > Exit</ p >
197200 </ div >
@@ -247,6 +250,8 @@ <h2>Mines:</h2>
247250 canvasHTML = createCanvas ( windowWidth - border * 2 , windowHeight - border * 2 ) ;
248251 document . getElementById ( "defaultCanvas0" ) . remove ( ) ;
249252
253+ markedCell . filter ( GRAY ) ;
254+
250255 let canvasElement = canvasHTML . elt ;
251256 canvasElement . parentElement . class = "game" ;
252257
@@ -290,6 +295,9 @@ <h2>Mines:</h2>
290295 }
291296
292297 function clickLogic ( ) {
298+ const shortcutsEnabled = getPreferenceValue ( "shortcuts" ) ;
299+ const marksEnabled = getPreferenceValue ( "marks" ) ;
300+
293301 if ( ! hoveringMain ) {
294302 return ;
295303 }
@@ -319,27 +327,31 @@ <h2>Mines:</h2>
319327 if ( ! touch ) {
320328 if ( mouseIsPressed == 1 ) {
321329 game . peekCell ( mX , mY ) ;
322- // if (!lastClick)
323- // // rButton.src = facePeek;
330+
324331 let cell = game . grid [ xStart + yStart * game . width ] ;
325- if ( mX != xStart || mY != yStart || cell . revealed ) {
332+ const draggedOrClicking = mX != xStart || mY != yStart || cell . revealed ;
333+ if ( draggedOrClicking && shortcutsEnabled ) {
326334 peekRadius ( xStart , yStart , false ) ;
327335 }
328336 } else if ( lastClick == 1 && mouseIsPressed == 0 ) {
329337 if ( mouseButton === LEFT && ! keyIsDown ( SHIFT ) ) {
330- game . peekCell ( mX , mY ) ;
331338 let cell = game . grid [ xStart + yStart * game . width ] ;
332- if ( ! cell . revealed ) {
339+ game . peekCell ( mX , mY ) ;
340+ if ( ! cell . revealed && ! cell . marked ) {
333341 game . revealCell ( mX , mY ) ;
334- } else if ( mX == xStart && mY == yStart ) {
342+ } else if ( ! cell . revealed && cell . marked ) {
343+ game . unmarkCell ( mX , mY ) ;
344+ } else if ( mX == xStart && mY == yStart && shortcutsEnabled ) {
335345 peekRadius ( mX , mY , "reveal" ) ;
336346 }
337347 } else if ( mouseButton === RIGHT || keyIsDown ( SHIFT ) ) {
338348 let cell = game . grid [ xStart + yStart * game . width ] ;
339- if ( ! cell . revealed ) {
349+ if ( ! cell . revealed && ( ( marksEnabled && ! cell . flagged ) || ! marksEnabled ) ) {
340350 game . flagCell ( mX , mY ) ;
341- } else if ( mX == xStart && mY == yStart ) {
351+ } else if ( mX == xStart && mY == yStart && ! cell . flagged && ! cell . marked && shortcutsEnabled ) {
342352 peekRadius ( xStart , yStart , "flag" ) ;
353+ } else if ( cell . flagged && marksEnabled ) {
354+ game . markCell ( mX , mY ) ;
343355 }
344356 }
345357 }
@@ -407,7 +419,7 @@ <h2>Mines:</h2>
407419 if ( ! cell . revealed && ! cell . flagged ) game . flagCell ( iX , iY ) ;
408420 }
409421
410- if ( cell . flagged ) safeCount ++ ;
422+ if ( cell . flagged || cell . marked ) safeCount ++ ;
411423
412424 rect ( cX , cY , cellSize ) ;
413425 }
@@ -425,7 +437,9 @@ <h2>Mines:</h2>
425437 if ( iX < 0 || iX > game . width - 1 || iY < 0 || iY > game . height - 1 ) continue ;
426438
427439 let cell = game . grid [ iX + iY * game . width ] ;
428- game . revealCell ( iX , iY ) ;
440+ if ( ! cell . marked ) {
441+ game . revealCell ( iX , iY ) ;
442+ }
429443 }
430444 }
431445 }
0 commit comments