comparison krapula.c @ 15:e5c517ccc1e5

Joo.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 29 Sep 2012 08:25:18 +0300
parents b2b506e1f42a
children 833dad075e3b
comparison
equal deleted inserted replaced
14:b2b506e1f42a 15:e5c517ccc1e5
905 } 905 }
906 } 906 }
907 else 907 else
908 if (t < 45) 908 if (t < 45)
909 { 909 {
910 static SDL_Surface *ruutu, *feidi; 910 static SDL_Surface *ruutu;
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");
920 dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0)); 919 dmClearSurface(ruutu, dmMapRGBA(ruutu, 0,0,0,0));
921 nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine.screen->format, DMD_NONE); 920 nblit = dmGetScaledBlitFunc(nosfe[0]->format, engine.screen->format, DMD_NONE);
922 kblit = dmGetScaledBlitFunc(credits[0].img->format, engine.screen->format, DMD_TRANSPARENT); 921 kblit = dmGetScaledBlitFunc(credits[0].img->format, engine.screen->format, DMD_TRANSPARENT);
923 currCredit = -1; 922 currCredit = -1;
924 currState = -1; 923 currState = -1;
1006 credits[currCredit].img->h * (1.0f + zscale), 1005 credits[currCredit].img->h * (1.0f + zscale),
1007 engine.screen); 1006 engine.screen);
1008 } 1007 }
1009 } 1008 }
1010 1009
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 }
1045 } 1010 }
1046 else 1011 else
1047 if (t < 60) 1012 if (t < 60)
1048 { 1013 {
1049 SDL_Surface *logobg, *greets; 1014 SDL_Surface *logobg, *greets;
1061 dmLerpInit(&lerpD, 0.01, 500, 10000); 1026 dmLerpInit(&lerpD, 0.01, 500, 10000);
1062 nollattu = TRUE; 1027 nollattu = TRUE;
1063 } 1028 }
1064 1029
1065 float q = dmLerpSCurve(&lerpD, dt); 1030 float q = dmLerpSCurve(&lerpD, dt);
1066 float t = sin((float) dt / 150.0f); 1031 float t = sin((float) dt / 150.0f),
1032 j = (1.0 + t) * 15;
1067 int x = t * 25.0f + q, y = t * 35.0f + q, 1033 int x = t * 25.0f + q, y = t * 35.0f + q,
1068 w = t * 70.0f + q*2.0f, h = t * 40.0f + q*2.0f; 1034 w = t * 70.0f + q*2.0f, h = t * 40.0f + q*2.0f;
1069 1035
1070 kblit(logobg, 0, 0, engine.screen->w, engine.screen->h, engine.screen); 1036 kblit(logobg, -j, -j, engine.screen->w+j*2.0f, engine.screen->h+j*2.0f, engine.screen);
1071 nblit(greets, -x, -y, engine.screen->w+w, engine.screen->h+h, engine.screen); 1037 nblit(greets, -x, -y, engine.screen->w+w, engine.screen->h+h, engine.screen);
1072 } 1038 }
1073 else 1039 else
1074 engine.exitFlag = TRUE; 1040 engine.exitFlag = TRUE;
1041
1042 {
1043 static SDL_Surface *feidi;
1044 static int fadeStartTime;
1045 static BOOL fadeActive, nollattu = FALSE;
1046 static DMLerpContext fadeLerp;
1047 BOOL hit;
1048 int ch;
1049
1050 if (!nollattu)
1051 {
1052 feidi = engineGetResImage("feidi.png");
1053 dmLerpInit(&fadeLerp, 255, 0, 250);
1054 nollattu = TRUE;
1055 }
1056
1057 JSS_LOCK(plr);
1058 for (hit = FALSE, ch = 0; ch < 6; ch++)
1059 if (plr->iCExtInstrumentN[ch] == 0)
1060 {
1061 hit = TRUE;
1062 break;
1063 }
1064 JSS_UNLOCK(plr);
1065
1066 if (hit && !fadeActive)
1067 {
1068 fadeActive = TRUE;
1069 fadeStartTime = engineGetTime(0);
1070 }
1071 if (fadeActive)
1072 {
1073 int fadeTime = engineGetTime(0) - fadeStartTime;
1074 if (fadeTime < 250)
1075 {
1076 dmScaledBlitSurface32to32TransparentGA(feidi,
1077 0, 0, engine.screen->w, engine.screen->h, engine.screen,
1078 dmLerpSCurve(&fadeLerp, fadeTime));
1079 }
1080 else
1081 fadeActive = FALSE;
1082 }
1083 }
1075 1084
1076 // Flip screen 1085 // Flip screen
1077 if (SDL_MUSTLOCK(engine.screen) != 0) 1086 if (SDL_MUSTLOCK(engine.screen) != 0)
1078 SDL_UnlockSurface(engine.screen); 1087 SDL_UnlockSurface(engine.screen);
1079 1088