From a834b601f67a73c8f715a444f8093df03433a9ea Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Mon, 17 Oct 2016 20:01:26 +0300 Subject: [PATCH] cosmetix --- engine.d | 23 ++++++++++++++++++++--- mminer.d | 6 ++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/engine.d b/engine.d index a722681..e61a5f7 100644 --- a/engine.d +++ b/engine.d @@ -1,7 +1,7 @@ module engine is aliced; import iv.txtser; -import iv.vfs.io; +import iv.vfs; import x11gfx; @@ -28,7 +28,6 @@ VColor palcol (ubyte c) { static VColor[256] palette; static bool palset = false; if (!palset) { - //palette = gameData["palmain"][]; auto pp = gameData["palmain"]; foreach (immutable cc; 0..256) { ubyte r = cast(ubyte)(255*pp[cc*3+0]/63); @@ -199,6 +198,23 @@ public struct Room { X11Image willySpr; } + ubyte saveKeyState () { + return + ((kLeftDown ? 1 : 0)<<0)| + ((kRightDown ? 1 : 0)<<1)| + ((kUpDown ? 1 : 0)<<2)| + ((kDownDown ? 1 : 0)<<3)| + ((kJumpDown ? 1 : 0)<<4)| + 0; + } + + void restoreKeyState (ubyte b) { + keyLeft = ((b&(1<<0)) != 0); + keyRight = ((b&(1<<1)) != 0); + keyUp = ((b&(1<<2)) != 0); + keyDown = ((b&(1<<3)) != 0); + keyJump = ((b&(1<<4)) != 0); + } void initRoom () { void initWilly () { @@ -445,7 +461,8 @@ public struct Room { if (sidx < slist.length) { slist[sidx].blitTo(img, x&248, m.y); } else { - writeln("monster #", f, " is fucked: sidx=", sidx, "; max=", slist.length); + import core.stdc.stdio : stderr, fprintf; + stderr.fprintf("monster #%u is fucked: sidx=%u; max=%u", cast(uint)f, cast(uint)sidx, cast(uint)slist.length); } } } diff --git a/mminer.d b/mminer.d index f7f2d08..05a32c9 100644 --- a/mminer.d +++ b/mminer.d @@ -17,6 +17,8 @@ void main (string[] args) { void loadRoom (int idx) { curRoom = gameRooms[idx]; curRoom.initRoom(); + blitType = BlitType.Green; + curRoom.willyDead = true; } loadRoom(0); @@ -96,7 +98,11 @@ void main (string[] args) { if (!evt.pressed) break; blitType = BlitType.Normal; if (curRoom.willyDead) { + auto kst = curRoom.saveKeyState(); loadRoom(curRoom.roomIdx); + blitType = BlitType.Normal; + curRoom.willyDead = false; + curRoom.restoreKeyState(kst); } break; case Key.Q: case Key.Escape: doQuit = true; break; -- 2.11.4.GIT