Improve touchscreen controls slightly. Fix softlock bug during 2nd silicon piece collection

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent ff94eabef2
commit dcd5c2f28b
  1. 15
      SeasonsOfLoneliness.cpp
  2. BIN
      SeasonsOfLoneliness.zip
  3. BIN
      Seasons_of_Loneliness
  4. BIN
      Seasons_of_Loneliness.wasm
  5. 75
      index.html
  6. BIN
      src.zip

@ -1282,8 +1282,7 @@ public:
} else {
USE_TOUCH_CONTROLS=false;
}
if (!GetKey(W).bPressed&&!GetKey(A).bPressed&&!GetKey(S).bPressed&&!GetKey(D).bPressed&&
!GetKey(UP).bPressed&&!GetKey(RIGHT).bPressed&&!GetKey(DOWN).bPressed&&!GetKey(LEFT).bPressed) {
if (!UpPressed()&&!DownPressed()&&!LeftPressed()&&!RightPressed()) {
ActionButtonPress();
}
switch (GAME_STATE) {
@ -3330,12 +3329,14 @@ public:
if (CURRENT_MAP==MAP_5) {
if (!GAME_FLAGS[gameflag::COLLECTED_SILICON_4]) {
GAME_FLAGS[gameflag::COLLECTED_SILICON_4]=true;
updatePlayerState();
GAME_STATE=GAMEWORLD;
}
} else
if (CURRENT_MAP==MAP_4) {
if (!GAME_FLAGS[gameflag::COLLECTED_SILICON_3]) {
GAME_FLAGS[gameflag::COLLECTED_SILICON_3]=true;
updatePlayerState();
DisplayMessageBox(34);
GAME_STATE=GAMEWORLD;
}
@ -3343,6 +3344,7 @@ public:
if (CURRENT_MAP==MAP_3) {
if (!GAME_FLAGS[gameflag::COLLECTED_SILICON_2]) {
GAME_FLAGS[gameflag::COLLECTED_SILICON_2]=true;
updatePlayerState();
DisplayMessageBox(29);
} else {
GAME_STATE=GAMEWORLD;
@ -3352,6 +3354,7 @@ public:
} else {
if (!GAME_FLAGS[gameflag::COLLECTED_SILICON_1]) {
GAME_FLAGS[gameflag::COLLECTED_SILICON_1]=true;
updatePlayerState();
DisplayMessageBox(15);
} else {
GAME_STATE=GAMEWORLD;
@ -3626,6 +3629,14 @@ public:
}break;
case THANKS:{
DrawStringDecal({(float)(WIDTH/2-GetTextSize(THANKS_TEXT).x*3/2),(float)(HEIGHT/2-GetTextSize(THANKS_TEXT).y*3/2)},THANKS_TEXT,WHITE,{3,3});
DrawStringDecal({0,(float)(HEIGHT-GetTextSize("Playtime").y)},"Playtime: ",WHITE,{1,1});
int hours=frameCount/60/60/60;
int minutes=(frameCount/60/60)%60;
int seconds=(frameCount/60)%60;
DrawStringDecal({0,(float)(HEIGHT-GetTextSize("Playtime: ").y)},"Playtime: ",WHITE,{1,1});
DrawStringDecal({(float)(GetTextSize("Playtime: ").x),(float)(HEIGHT-GetTextSize("Playtime: ").y)},(hours<10)?"0"+std::to_string(hours)+":":std::to_string(hours)+":",WHITE,{1,1});
DrawStringDecal({(float)(GetTextSize("Playtime: ").x+24*1),(float)(HEIGHT-GetTextSize("Playtime: ").y)},(minutes<10)?"0"+std::to_string(minutes)+":":std::to_string(minutes)+":",WHITE,{1,1});
DrawStringDecal({(float)(GetTextSize("Playtime: ").x+24*2),(float)(HEIGHT-GetTextSize("Playtime: ").y)},(seconds<10)?"0"+std::to_string(seconds):std::to_string(seconds),WHITE,{1,1});
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1});
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1});

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,75 @@
<!doctype html>
<html lang="en-us">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Emscripten-Generated Code</title>
<style>
html,body { width: 100%; height: 100%; }
body { font-family: arial; margin: 0; padding: 0; background: #000; }
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten_border { border: none; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; background-color: black; }
</style>
</head>
<body>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
<script type='text/javascript'>
var Module = {
preRun: [],
postRun: [],
canvas: (function() {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
};
</script>
<script async type="text/javascript" src="Seasons_of_Loneliness.js"></script>
<script type="text/javascript">
Module.canvas.addEventListener("resize", (e) => {
var viewWidth = e.detail.width;
var viewHeight = e.detail.width / Module._olc_WindowAspectRatio;
if(viewHeight > e.detail.height)
{
viewHeight = e.detail.height;
viewWidth = e.detail.height * Module._olc_WindowAspectRatio;
}
// update dom attributes
Module.canvas.setAttribute("width", viewWidth);
Module.canvas.setAttribute("height", viewHeight);
var top = (e.detail.height - viewHeight) / 2;
var left = (e.detail.width - viewWidth) / 2;
// update styles
Module.canvas.style.position = "fixed";
Module.canvas.style.top = top.toString() + "px";
Module.canvas.style.left = left.toString() + "px";
Module.canvas.style.width = "";
Module.canvas.style.height = "";
// trigger PGE update
Module._olc_PGE_UpdateWindowSize(viewWidth, viewHeight);
// ensure canvas has focus
Module.canvas.focus();
e.preventDefault();
});
</script>
</body>
</html>

Binary file not shown.
Loading…
Cancel
Save