# HG changeset patch # User Matti Hamalainen # Date 1348896318 -10800 # Node ID e5c517ccc1e543ce7f2c327db66e6628c2ed32d3 # Parent b2b506e1f42a5b7b384cabdb5e74f98f49415173 Joo. diff -r b2b506e1f42a -r e5c517ccc1e5 krapula.c --- a/krapula.c Sat Sep 29 08:19:14 2012 +0300 +++ b/krapula.c Sat Sep 29 08:25:18 2012 +0300 @@ -907,7 +907,7 @@ else if (t < 45) { - static SDL_Surface *ruutu, *feidi; + static SDL_Surface *ruutu; static int currState, currCredit, creditStartTime; static DMLerpContext lerpX, lerpY, lerpZ; static DMScaledBlitFunc nblit, kblit; @@ -916,7 +916,6 @@ if (!nollattu) { ruutu = engineGetResImage("ruutu.png"); - feidi = engineGetResImage("feidi.png"); dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0)); nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine.screen->format, DMD_NONE); kblit = dmGetScaledBlitFunc(credits[0].img->format, engine.screen->format, DMD_TRANSPARENT); @@ -1008,40 +1007,6 @@ } } - { - static int fadeStartTime; - static BOOL fadeActive; - static DMLerpContext fadeLerp; - BOOL hit = TRUE; - int ch; - JSS_LOCK(plr); - for (hit = FALSE, ch = 0; ch < 6; ch++) - if (plr->iCExtInstrumentN[ch] == 0) - { - hit = TRUE; - break; - } - JSS_UNLOCK(plr); - - if (hit && !fadeActive) - { - fadeActive = TRUE; - fadeStartTime = engineGetTime(0); - dmLerpInit(&fadeLerp, 255, 0, 250); - } - if (fadeActive) - { - int fadeTime = engineGetTime(0) - fadeStartTime; - if (fadeTime < 250) - { - dmScaledBlitSurface32to32TransparentGA(feidi, - 0, 0, engine.screen->w, engine.screen->h, engine.screen, - dmLerpSCurve(&fadeLerp, fadeTime)); - } - else - fadeActive = FALSE; - } - } } else if (t < 60) @@ -1063,16 +1028,60 @@ } float q = dmLerpSCurve(&lerpD, dt); - float t = sin((float) dt / 150.0f); + float t = sin((float) dt / 150.0f), + j = (1.0 + t) * 15; int x = t * 25.0f + q, y = t * 35.0f + q, w = t * 70.0f + q*2.0f, h = t * 40.0f + q*2.0f; - kblit(logobg, 0, 0, engine.screen->w, engine.screen->h, engine.screen); + kblit(logobg, -j, -j, engine.screen->w+j*2.0f, engine.screen->h+j*2.0f, engine.screen); nblit(greets, -x, -y, engine.screen->w+w, engine.screen->h+h, engine.screen); } else engine.exitFlag = TRUE; + { + static SDL_Surface *feidi; + static int fadeStartTime; + static BOOL fadeActive, nollattu = FALSE; + static DMLerpContext fadeLerp; + BOOL hit; + int ch; + + if (!nollattu) + { + feidi = engineGetResImage("feidi.png"); + dmLerpInit(&fadeLerp, 255, 0, 250); + nollattu = TRUE; + } + + JSS_LOCK(plr); + for (hit = FALSE, ch = 0; ch < 6; ch++) + if (plr->iCExtInstrumentN[ch] == 0) + { + hit = TRUE; + break; + } + JSS_UNLOCK(plr); + + if (hit && !fadeActive) + { + fadeActive = TRUE; + fadeStartTime = engineGetTime(0); + } + if (fadeActive) + { + int fadeTime = engineGetTime(0) - fadeStartTime; + if (fadeTime < 250) + { + dmScaledBlitSurface32to32TransparentGA(feidi, + 0, 0, engine.screen->w, engine.screen->h, engine.screen, + dmLerpSCurve(&fadeLerp, fadeTime)); + } + else + fadeActive = FALSE; + } + } + // Flip screen if (SDL_MUSTLOCK(engine.screen) != 0) SDL_UnlockSurface(engine.screen);