comparison krapula.c @ 14:b2b506e1f42a

Add nice headache white fade synced to beat.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 29 Sep 2012 08:19:14 +0300
parents ca2daec08204
children e5c517ccc1e5
comparison
equal deleted inserted replaced
13:fcca32ea1ca8 14:b2b506e1f42a
905 } 905 }
906 } 906 }
907 else 907 else
908 if (t < 45) 908 if (t < 45)
909 { 909 {
910 SDL_Surface *ruutu; 910 static SDL_Surface *ruutu, *feidi;
911 static int currState, currCredit, creditStartTime; 911 static int currState, currCredit, creditStartTime;
912 static DMLerpContext lerpX, lerpY, lerpZ; 912 static DMLerpContext lerpX, lerpY, lerpZ;
913 static DMScaledBlitFunc nblit, kblit; 913 static DMScaledBlitFunc nblit, kblit;
914 static BOOL stateChange, nollattu = FALSE; 914 static BOOL stateChange, nollattu = FALSE;
915 int currFrame = engineGetTime(20) * 15 / 1000; 915 int currFrame = engineGetTime(20) * 15 / 1000;
916 if (!nollattu) 916 if (!nollattu)
917 { 917 {
918 ruutu = engineGetResImage("ruutu.png"); 918 ruutu = engineGetResImage("ruutu.png");
919 feidi = engineGetResImage("feidi.png");
919 dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0)); 920 dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0));
920 nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine.screen->format, DMD_NONE); 921 nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine.screen->format, DMD_NONE);
921 kblit = dmGetScaledBlitFunc(credits[0].img->format, engine.screen->format, DMD_TRANSPARENT); 922 kblit = dmGetScaledBlitFunc(credits[0].img->format, engine.screen->format, DMD_TRANSPARENT);
922 currCredit = -1; 923 currCredit = -1;
923 currState = -1; 924 currState = -1;
1004 credits[currCredit].img->w * (1.0f + zscale), 1005 credits[currCredit].img->w * (1.0f + zscale),
1005 credits[currCredit].img->h * (1.0f + zscale), 1006 credits[currCredit].img->h * (1.0f + zscale),
1006 engine.screen); 1007 engine.screen);
1007 } 1008 }
1008 } 1009 }
1010
1011 {
1012 static int fadeStartTime;
1013 static BOOL fadeActive;
1014 static DMLerpContext fadeLerp;
1015 BOOL hit = TRUE;
1016 int ch;
1017 JSS_LOCK(plr);
1018 for (hit = FALSE, ch = 0; ch < 6; ch++)
1019 if (plr->iCExtInstrumentN[ch] == 0)
1020 {
1021 hit = TRUE;
1022 break;
1023 }
1024 JSS_UNLOCK(plr);
1025
1026 if (hit && !fadeActive)
1027 {
1028 fadeActive = TRUE;
1029 fadeStartTime = engineGetTime(0);
1030 dmLerpInit(&fadeLerp, 255, 0, 250);
1031 }
1032 if (fadeActive)
1033 {
1034 int fadeTime = engineGetTime(0) - fadeStartTime;
1035 if (fadeTime < 250)
1036 {
1037 dmScaledBlitSurface32to32TransparentGA(feidi,
1038 0, 0, engine.screen->w, engine.screen->h, engine.screen,
1039 dmLerpSCurve(&fadeLerp, fadeTime));
1040 }
1041 else
1042 fadeActive = FALSE;
1043 }
1044 }
1009 } 1045 }
1010 else 1046 else
1011 if (t < 60) 1047 if (t < 60)
1012 { 1048 {
1013 SDL_Surface *logobg, *greets; 1049 SDL_Surface *logobg, *greets;