# HG changeset patch # User Matti Hamalainen # Date 1432253528 -10800 # Node ID 77b2bb97fa59fd9f273ebf79aa56c0d3f7b999ef # Parent 0da5de9dcc750b42d45e7bec13bb28d526adef23 Some stuff. diff -r 0da5de9dcc75 -r 77b2bb97fa59 data/skrolli.txt --- a/data/skrolli.txt Fri May 22 02:27:17 2015 +0300 +++ b/data/skrolli.txt Fri May 22 03:12:08 2015 +0300 @@ -1,8 +1,7 @@ - -... Iloista 1v. syntymäpäivää Ossille ja 27v Iirikselle toivottaa Matti-eno/isoveli! Olette -super hyper kivoja! Moiggigset lentää mm. seuraaville: PWP, Trilobit, Bilotrip, (B), Phn., -Dekadence, RubberJ, Jynttäveikot, jne. -Demon koodasi ccr/TNSP. Musiikkina käytetty 'Hyvää Syntymäpäivää' SIG-yhtyeen ja edesmenneen -Matti Inkisen esittämänä ripattu Youtubesta. -Muitten koodia käytössä seuraavasti: LibSDL, zlib, Tremor Ogg Vorbis-dekooderi ja stb_image.c. + +... Well, hello there .. this is a small and silly prod for the Simulaatio 6 +demo competition. ccr of TNSP on da keys now, sending greetings to all the +people here at Simulaatio! And super mega extra greetings to following +elitez: viznut, nrg, bass cadet, ... + \ No newline at end of file diff -r 0da5de9dcc75 -r 77b2bb97fa59 demo.c --- a/demo.c Fri May 22 02:27:17 2015 +0300 +++ b/demo.c Fri May 22 03:12:08 2015 +0300 @@ -215,6 +215,22 @@ } +static int my_toupper(int ch) +{ + switch (ch) + { + case 0xe4: return 142; + case 0xf6: return 153; + default: + if (ch >= 'a' && ch <= 'z') + return ch - 'a' + 'A'; + else + return ch; + } +} + + + static int demoRender(DMEngineData *engine) { float t = engineGetTimeDT(engine); @@ -432,7 +448,62 @@ engine->screen); } + // Skrolleri + if (t > 2) + { + int tt = engineGetTime(engine, 2); + static DMScaledBlitFunc cblit, qblit; + static BOOL nollattu = FALSE; + if (!nollattu) + { + cblit = dmGetScaledBlitFunc(font->glyphs[65]->format, engine->screen->format, DMD_TRANSPARENT); + qblit = dmGetScaledBlitFunc(font->glyphs[65]->format, engine->screen->format, DMD_SATURATE); + } + + size_t txtLen = teksti->rawSize - 1; + Uint8 *txtData = teksti->rawData; + int fwidth = font->width * 2 + 2; + int xc, offs, scrollTime = tt / 10, + scrWidth = engine->screen->w / (dmQX(engine, font->glyphs[65], 1) + dmCX(engine, 0.001)); + + for (xc = offs = 0; offs < scrWidth; offs++) + { + int ch = txtData[((scrollTime / fwidth) + offs) % txtLen]; + SDL_Surface *glyph = dmGetBMGlyph(font, my_toupper(ch)); + if (glyph != NULL) + { + float mt = (offs * 20 + tt) / 100.0f; + int dx = xc - (scrollTime % fwidth), + dy = dmCY(engine, 0.8 + sin(mt) * 0.05), + dw = glyph->w * 2 * (1.0f + sin(mt) * 0.1f), + dh = glyph->h * 2 * (1.0f + cos(mt) * 0.2f); + + cblit(glyph, dx+1, dy+1, dw+1, dh+1, engine->screen); + qblit(glyph, dx, dy, dw, dh, engine->screen); + } + xc += fwidth; + } + } + + // Loppufeidi if (t > 70) + { + static DMLerpContext fadeLerp; + static SDL_Surface *feidi = NULL; + static BOOL nollattu = FALSE; + if (!nollattu) + { + engineGetResImage(engine, feidi, "feidi.png"); + dmLerpInit(&fadeLerp, 0, 255, 5000); + } + + int fadeTime = engineGetTime(engine, 70); + dmScaledBlitSurface32to32TransparentGA(feidi, + 0, 0, engine->screen->w, engine->screen->h, engine->screen, + dmLerpSCurveClamp(&fadeLerp, fadeTime)); + } + + if (t > 75) return 1; else return DMERR_OK;