From e91f31a7e822968136b9379cbaa1ffdb184cb92f Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Tue, 18 Oct 2016 15:18:28 +0300 Subject: [PATCH] shitty title --- engine.d | 19 +++++++++++++++++++ mminer.d | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/engine.d b/engine.d index f1bb6f8..25a9bd7 100644 --- a/engine.d +++ b/engine.d @@ -1340,6 +1340,11 @@ public void blitTo (X11Image src, int x0, int y0, int ww, int hh, X11Image dst, // ////////////////////////////////////////////////////////////////////////// // +public void setPixel8 (int x, int y, ubyte col) { + setPixel(x, y, palcol(col)); +} + + public void drawBar8 (int x, int y, int w, int h, ubyte col) { foreach (immutable dy; 0..h) { foreach (immutable dx; 0..w) { @@ -1350,6 +1355,20 @@ public void drawBar8 (int x, int y, int w, int h, ubyte col) { // ////////////////////////////////////////////////////////////////////////// // +public void drawWilly4 (int ofs) { + auto gw = gameData["willy"][256*ofs..$]; + enum x = 232, y = 72; + foreach (immutable dy; 0..16) { + foreach (immutable dx; 0..16) { + ubyte c = gw[0]; + gw = gw[1..$]; + setPixel8(x+dx, y+dy, (c ? c+0*16 : 39)); + } + } +} + + +// ////////////////////////////////////////////////////////////////////////// // public void printAt (int x, int y, const(char)[] text, ubyte col) { if (text.length == 0) return; diff --git a/mminer.d b/mminer.d index edfb471..3aa7e8b 100644 --- a/mminer.d +++ b/mminer.d @@ -61,6 +61,8 @@ void main (string[] args) { auto gfxFill0 = buildImageMasked(gameData["fill"][], 16, 24); auto gfxFill1 = buildImageMasked(gameData["fill"][384..$], 72, 24); auto gfxAir = buildImageMasked(gameData["air"], 256, 8); + auto gfxSun = buildImageMasked(gameData["sun"], 24, 16); + auto gfxFinal = buildImageMasked(gameData["final"], 256, 64); auto sdwin = x11gfxInit("Manic Miner"); bool doQuit; @@ -90,15 +92,46 @@ void main (string[] args) { } } - clear(0); - if (!inTitle) { + clear(0); roomImg = curRoom.draw(roomImg); roomImg.blitFast(0, 0); } else { + clear(palcol(240)); + + static struct Sun { + int y; + ubyte m, h; + } + static Sun sun; + sun.m = 1; + sun.y = 32; + sun.h = 16; + + void drawSun () { + for (int y = sun.h-1; y >= 0; --y) { + for (int x = 23; x >= 0; --x) { + ubyte data = gameData["sun"][(y*24)+x]; + if (data) setPixel8(60+x, sun.y+y, data); + } + } + } + gfxFinal.blitFast(0, 0); + //sunSpr.blitTo(img, 60, 32); + drawSun(); gfxFill0.blitFast(152, 40); gfxFill1.blitFast(176, 40); - printAt(154, 42, "Hello!", 13); + //printAt(154, 42, "Hello!", 13); + + static int TITLEwf = 2; + static int TITLEwp = 0; + + if (++TITLEwp == 16) { + TITLEwp = 0; + TITLEwf = (TITLEwf+2)&7; + } + drawWilly4(TITLEwf+4); + // levelset: 122 } realizeVBuf(); -- 2.11.4.GIT