123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- #include "main.h"
- static WORD g_wCurEffectSprite = 0;
- VOID
- PAL_EndingSetEffectSprite(
- WORD wSpriteNum
- )
- {
- g_wCurEffectSprite = wSpriteNum;
- }
- VOID
- PAL_ShowFBP(
- WORD wChunkNum,
- WORD wFade
- )
- {
- PAL_LARGE BYTE buf[320 * 200];
- PAL_LARGE BYTE bufSprite[320 * 200];
- const int rgIndex[6] = {0, 3, 1, 5, 2, 4};
- SDL_Surface *p;
- int i, j, k;
- BYTE a, b;
- if (PAL_MKFDecompressChunk(buf, 320 * 200, wChunkNum, gpGlobals->f.fpFBP) <= 0)
- {
- memset(buf, 0, sizeof(buf));
- }
- if (g_wCurEffectSprite != 0)
- {
- PAL_MKFDecompressChunk(bufSprite, 320 * 200, g_wCurEffectSprite, gpGlobals->f.fpMGO);
- }
- if (wFade)
- {
- wFade++;
- wFade *= 10;
- p = SDL_CreateRGBSurface(gpScreen->flags & ~SDL_HWSURFACE, 320, 200, 8,
- gpScreen->format->Rmask, gpScreen->format->Gmask,
- gpScreen->format->Bmask, gpScreen->format->Amask);
- PAL_FBPBlitToSurface(buf, p);
- VIDEO_BackupScreen();
- for (i = 0; i < 16; i++)
- {
- for (j = 0; j < 6; j++)
- {
-
-
-
-
- for (k = rgIndex[j]; k < gpScreen->pitch * gpScreen->h; k += 6)
- {
- a = ((LPBYTE)(p->pixels))[k];
- b = ((LPBYTE)(gpScreenBak->pixels))[k];
- if (i > 0)
- {
- if ((a & 0x0F) > (b & 0x0F))
- {
- b++;
- }
- else if ((a & 0x0F) < (b & 0x0F))
- {
- b--;
- }
- }
- ((LPBYTE)(gpScreenBak->pixels))[k] = ((a & 0xF0) | (b & 0x0F));
- }
- SDL_BlitSurface(gpScreenBak, NULL, gpScreen, NULL);
- if (g_wCurEffectSprite != 0)
- {
- int f = SDL_GetTicks() / 150;
- PAL_RLEBlitToSurface(PAL_SpriteGetFrame(bufSprite, f % PAL_SpriteGetNumFrames(bufSprite)),
- gpScreen, PAL_XY(0, 0));
- }
- VIDEO_UpdateScreen(NULL);
- UTIL_Delay(wFade);
- }
- }
- SDL_FreeSurface(p);
- }
-
-
-
- if (wChunkNum != 49)
- {
- PAL_FBPBlitToSurface(buf, gpScreen);
- }
- VIDEO_UpdateScreen(NULL);
- }
- VOID
- PAL_ScrollFBP(
- WORD wChunkNum,
- WORD wScrollSpeed,
- BOOL fScrollDown
- )
- {
- SDL_Surface *p;
- PAL_LARGE BYTE buf[320 * 200];
- PAL_LARGE BYTE bufSprite[320 * 200];
- int i, l;
- SDL_Rect rect, dstrect;
- if (PAL_MKFDecompressChunk(buf, 320 * 200, wChunkNum, gpGlobals->f.fpFBP) <= 0)
- {
- return;
- }
- if (g_wCurEffectSprite != 0)
- {
- PAL_MKFDecompressChunk(bufSprite, 320 * 200, g_wCurEffectSprite, gpGlobals->f.fpMGO);
- }
- p = SDL_CreateRGBSurface(gpScreen->flags & ~SDL_HWSURFACE, 320, 200, 8,
- gpScreen->format->Rmask, gpScreen->format->Gmask,
- gpScreen->format->Bmask, gpScreen->format->Amask);
- if (p == NULL)
- {
- return;
- }
- VIDEO_BackupScreen();
- PAL_FBPBlitToSurface(buf, p);
- if (wScrollSpeed == 0)
- {
- wScrollSpeed = 1;
- }
- rect.x = 0;
- rect.w = 320;
- dstrect.x = 0;
- dstrect.w = 320;
- for (l = 0; l < 220; l++)
- {
- i = l;
- if (i > 200)
- {
- i = 200;
- }
- if (fScrollDown)
- {
- rect.y = 0;
- dstrect.y = i;
- rect.h = 200 - i;
- dstrect.h = 200 - i;
- }
- else
- {
- rect.y = i;
- dstrect.y = 0;
- rect.h = 200 - i;
- dstrect.h = 200 - i;
- }
- SDL_BlitSurface(gpScreenBak, &rect, gpScreen, &dstrect);
- if (fScrollDown)
- {
- rect.y = 200 - i;
- dstrect.y = 0;
- rect.h = i;
- dstrect.h = i;
- }
- else
- {
- rect.y = 0;
- dstrect.y = 200 - i;
- rect.h = i;
- dstrect.h = i;
- }
- SDL_BlitSurface(p, &rect, gpScreen, &dstrect);
- PAL_ApplyWave(gpScreen);
- if (g_wCurEffectSprite != 0)
- {
- int f = SDL_GetTicks() / 150;
- PAL_RLEBlitToSurface(PAL_SpriteGetFrame(bufSprite, f % PAL_SpriteGetNumFrames(bufSprite)),
- gpScreen, PAL_XY(0, 0));
- }
- VIDEO_UpdateScreen(NULL);
- if (gpGlobals->fNeedToFadeIn)
- {
- PAL_FadeIn(gpGlobals->wNumPalette, gpGlobals->fNightPalette, 1);
- gpGlobals->fNeedToFadeIn = FALSE;
- }
- UTIL_Delay(800 / wScrollSpeed);
- }
- SDL_BlitSurface(p, NULL, gpScreen, NULL);
- SDL_FreeSurface(p);
- VIDEO_UpdateScreen(NULL);
- }
- VOID
- PAL_EndingAnimation(
- VOID
- )
- {
- LPBYTE buf;
- LPBYTE bufGirl;
- SDL_Surface *pUpper;
- SDL_Surface *pLower;
- SDL_Rect srcrect, dstrect;
- int yPosGirl = 180;
- int i;
- buf = (LPBYTE)UTIL_calloc(1, 64000);
- bufGirl = (LPBYTE)UTIL_calloc(1, 6000);
- pUpper = SDL_CreateRGBSurface(gpScreen->flags & ~SDL_HWSURFACE, 320, 200, 8,
- gpScreen->format->Rmask, gpScreen->format->Gmask,
- gpScreen->format->Bmask, gpScreen->format->Amask);
- pLower = SDL_CreateRGBSurface(gpScreen->flags & ~SDL_HWSURFACE, 320, 200, 8,
- gpScreen->format->Rmask, gpScreen->format->Gmask,
- gpScreen->format->Bmask, gpScreen->format->Amask);
- PAL_MKFDecompressChunk(buf, 64000, 61, gpGlobals->f.fpFBP);
- PAL_FBPBlitToSurface(buf, pUpper);
- PAL_MKFDecompressChunk(buf, 64000, 62, gpGlobals->f.fpFBP);
- PAL_FBPBlitToSurface(buf, pLower);
- PAL_MKFDecompressChunk(buf, 64000, 571, gpGlobals->f.fpMGO);
- PAL_MKFDecompressChunk(bufGirl, 6000, 572, gpGlobals->f.fpMGO);
- srcrect.x = 0;
- dstrect.x = 0;
- srcrect.w = 320;
- dstrect.w = 320;
- gpGlobals->wScreenWave = 2;
- for (i = 0; i < 400; i++)
- {
-
-
-
- srcrect.y = 0;
- srcrect.h = 200 - i / 2;
- dstrect.y = i / 2;
- dstrect.h = 200 - i / 2;
- SDL_BlitSurface(pLower, &srcrect, gpScreen, &dstrect);
- srcrect.y = 200 - i / 2;
- srcrect.h = i / 2;
- dstrect.y = 0;
- dstrect.h = i / 2;
- SDL_BlitSurface(pUpper, &srcrect, gpScreen, &dstrect);
- PAL_ApplyWave(gpScreen);
-
-
-
- PAL_RLEBlitToSurface(PAL_SpriteGetFrame(buf, 0), gpScreen, PAL_XY(0, -400 + i));
- PAL_RLEBlitToSurface(PAL_SpriteGetFrame(buf, 1), gpScreen, PAL_XY(0, -200 + i));
-
-
-
- yPosGirl -= i & 1;
- if (yPosGirl < 80)
- {
- yPosGirl = 80;
- }
- PAL_RLEBlitToSurface(PAL_SpriteGetFrame(bufGirl, (SDL_GetTicks() / 50) % 4),
- gpScreen, PAL_XY(220, yPosGirl));
-
-
-
- VIDEO_UpdateScreen(NULL);
- if (gpGlobals->fNeedToFadeIn)
- {
- PAL_FadeIn(gpGlobals->wNumPalette, gpGlobals->fNightPalette, 1);
- gpGlobals->fNeedToFadeIn = FALSE;
- }
- UTIL_Delay(50);
- }
- gpGlobals->wScreenWave = 0;
- SDL_FreeSurface(pUpper);
- SDL_FreeSurface(pLower);
- free(buf);
- free(bufGirl);
- }
|