Beispiel #1
0
VOID
PAL_StartDialog(
   BYTE         bDialogLocation,
   BYTE         bFontColor,
   INT          iNumCharFace,
   BOOL         fPlayingRNG
)
/*++
  Purpose:

    Start a new dialog.

  Parameters:

    [IN]  bDialogLocation - the location of the text on the screen.

    [IN]  bFontColor - the font color of the text.

    [IN]  iNumCharFace - number of the character face in RGM.MKF.

    [IN]  fPlayingRNG - whether we are playing a RNG video or not.

  Return value:

    None.

--*/
{
   PAL_LARGE BYTE buf[16384];
   SDL_Rect       rect;

   if (gpGlobals->fInBattle && !g_fUpdatedInBattle)
   {
      //
      // Update the screen in battle, or the graphics may seem messed up
      //
      VIDEO_UpdateScreen(NULL);
      g_fUpdatedInBattle = TRUE;
   }

   g_TextLib.bIcon = 0;
   g_TextLib.posIcon = 0;
   g_TextLib.nCurrentDialogLine = 0;
   g_TextLib.posDialogTitle = PAL_XY(12, 8);
   g_TextLib.fUserSkip = FALSE;

   if (bFontColor != 0)
   {
      g_TextLib.bCurrentFontColor = bFontColor;
   }

   if (fPlayingRNG && iNumCharFace)
   {
      VIDEO_BackupScreen();
      g_TextLib.fPlayingRNG = TRUE;
   }

   switch (bDialogLocation)
   {
   case kDialogUpper:
      if (iNumCharFace > 0)
      {
         //
         // Display the character face at the upper part of the screen
         //
         if (PAL_MKFReadChunk(buf, 16384, iNumCharFace, gpGlobals->f.fpRGM) > 0)
         {
            rect.w = PAL_RLEGetWidth((LPCBITMAPRLE)buf);
            rect.h = PAL_RLEGetHeight((LPCBITMAPRLE)buf);
            rect.x = 48 - rect.w / 2;
            rect.y = 55 - rect.h / 2;

            if (rect.x < 0)
            {
               rect.x = 0;
            }

            if (rect.y < 0)
            {
               rect.y = 0;
            }

            PAL_RLEBlitToSurface((LPCBITMAPRLE)buf, gpScreen, PAL_XY(rect.x, rect.y));

            if (rect.x < 0)
            {
               rect.x = 0;
            }
            if (rect.y < 0)
            {
               rect.y = 0;
            }

            VIDEO_UpdateScreen(&rect);
         }
      }
      g_TextLib.posDialogTitle = PAL_XY(iNumCharFace > 0 ? 80 : 12, 8);
      g_TextLib.posDialogText = PAL_XY(iNumCharFace > 0 ? 96 : 44, 26);
      break;

   case kDialogCenter:
      g_TextLib.posDialogText = PAL_XY(80, 40);
      break;

   case kDialogLower:
      if (iNumCharFace > 0)
      {
         //
         // Display the character face at the lower part of the screen
         //
         if (PAL_MKFReadChunk(buf, 16384, iNumCharFace, gpGlobals->f.fpRGM) > 0)
         {
            rect.x = 270 - PAL_RLEGetWidth((LPCBITMAPRLE)buf) / 2;
            rect.y = 144 - PAL_RLEGetHeight((LPCBITMAPRLE)buf) / 2;

            PAL_RLEBlitToSurface((LPCBITMAPRLE)buf, gpScreen, PAL_XY(rect.x, rect.y));

            VIDEO_UpdateScreen(NULL);
         }
      }
      g_TextLib.posDialogTitle = PAL_XY(iNumCharFace > 0 ? 4 : 12, 108);
      g_TextLib.posDialogText = PAL_XY(iNumCharFace > 0 ? 20 : 44, 126);
      break;

   case kDialogCenterWindow:
      g_TextLib.posDialogText = PAL_XY(160, 40);
      break;
   }

   g_TextLib.bDialogPosition = bDialogLocation;
}
Beispiel #2
0
VOID
PAL_ShowDialogText(
   LPCSTR       lpszText
)
/*++
  Purpose:

    Show one line of the dialog text.

  Parameters:

    [IN]  lpszText - the text to be shown.

  Return value:

    None.

--*/
{
   SDL_Rect        rect;
   int             x, y, len = strlen(lpszText);

   PAL_ClearKeyState();
   g_TextLib.bIcon = 0;

   if (gpGlobals->fInBattle && !g_fUpdatedInBattle)
   {
      //
      // Update the screen in battle, or the graphics may seem messed up
      //
      VIDEO_UpdateScreen(NULL);
      g_fUpdatedInBattle = TRUE;
   }

   if (g_TextLib.nCurrentDialogLine > 3)
   {
      //
      // The rest dialogs should be shown in the next page.
      //
      PAL_DialogWaitForKey();
      g_TextLib.nCurrentDialogLine = 0;
      VIDEO_RestoreScreen();
      VIDEO_UpdateScreen(NULL);
   }

   x = PAL_X(g_TextLib.posDialogText);
   y = PAL_Y(g_TextLib.posDialogText) + g_TextLib.nCurrentDialogLine * 18;

   if (g_TextLib.bDialogPosition == kDialogCenterWindow)
   {
      //
      // The text should be shown in a small window at the center of the screen
      //
#ifndef PAL_CLASSIC
      if (gpGlobals->fInBattle && g_Battle.BattleResult == kBattleResultOnGoing)
      {
         PAL_BattleUIShowText(lpszText, 1400);
      }
      else
#endif
      {
         PAL_POS    pos;
         LPBOX      lpBox;

         //
         // Create the window box
         //
         pos = PAL_XY(PAL_X(g_TextLib.posDialogText) - len * 4, PAL_Y(g_TextLib.posDialogText));
         lpBox = PAL_CreateSingleLineBox(pos, (len + 1) / 2, TRUE);

         rect.x = PAL_X(pos);
         rect.y = PAL_Y(pos);
         rect.w = 320 - rect.x * 2 + 32;
         rect.h = 64;

         //
         // Show the text on the screen
         //
         pos = PAL_XY(PAL_X(pos) + 8 + ((len & 1) << 2), PAL_Y(pos) + 10);
         PAL_DrawText(lpszText, pos, 0, FALSE, FALSE);
         VIDEO_UpdateScreen(&rect);

         PAL_DialogWaitForKey();

         //
         // Delete the box
         //
         PAL_DeleteBox(lpBox);
         VIDEO_UpdateScreen(&rect);

         PAL_EndDialog();
      }
   }
   else
   {
      if (g_TextLib.nCurrentDialogLine == 0 &&
         g_TextLib.bDialogPosition != kDialogCenter &&
         (BYTE)lpszText[len - 1] == 0x47 && (BYTE)lpszText[len - 2] == 0xA1)
      {
         //
         // name of character
         //
         PAL_DrawText(lpszText, g_TextLib.posDialogTitle, FONT_COLOR_CYAN_ALT, TRUE, TRUE);
      }
      else
      {
         //
         // normal texts
         //
         char text[3];

         if (!g_TextLib.fPlayingRNG && g_TextLib.nCurrentDialogLine == 0)
         {
            //
            // Save the screen before we show the first line of dialog
            //
            VIDEO_BackupScreen();
         }

         while (lpszText != NULL && *lpszText != '\0')
         {
            switch (*lpszText)
            {
            case '-':
               //
               // Set the font color to Cyan
               //
               if (g_TextLib.bCurrentFontColor == FONT_COLOR_CYAN)
               {
                  g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
               }
               else
               {
                  g_TextLib.bCurrentFontColor = FONT_COLOR_CYAN;
               }
               lpszText++;
               break;

            case '\'':
               //
               // Set the font color to Red
               //
               if (g_TextLib.bCurrentFontColor == FONT_COLOR_RED)
               {
                  g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
               }
               else
               {
                  g_TextLib.bCurrentFontColor = FONT_COLOR_RED;
               }
               lpszText++;
               break;

            case '\"':
               //
               // Set the font color to Yellow
               //
               if (g_TextLib.bCurrentFontColor == FONT_COLOR_YELLOW)
               {
                  g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
               }
               else
               {
                  g_TextLib.bCurrentFontColor = FONT_COLOR_YELLOW;
               }
               lpszText++;
               break;

            case '$':
               //
               // Set the delay time of text-displaying
               //
               g_TextLib.iDelayTime = atoi(lpszText + 1) * 10 / 7;
               lpszText += 3;
               break;

            case '~':
               //
               // Delay for a period and quit
               //
               UTIL_Delay(atoi(lpszText + 1) * 80 / 7);
               g_TextLib.nCurrentDialogLine = 0;
               g_TextLib.fUserSkip = FALSE;
               return; // don't go further

            case ')':
               //
               // Set the waiting icon
               //
               g_TextLib.bIcon = 1;
               lpszText++;
               break;

            case '(':
               //
               // Set the waiting icon
               //
               g_TextLib.bIcon = 2;
               lpszText++;
               break;

            case '\\':
               lpszText++;

            default:
               if (*lpszText & 0x80)
               {
                  text[0] = lpszText[0];
                  text[1] = lpszText[1];
                  text[2] = '\0';
                  lpszText += 2;
               }
               else
               {
                  text[0] = *lpszText;
                  text[1] = '\0';
                  lpszText++;
               }

               PAL_DrawText(text, PAL_XY(x, y), g_TextLib.bCurrentFontColor, TRUE, TRUE);
               x += ((text[0] & 0x80) ? 16 : 8);

               if (!g_TextLib.fUserSkip)
               {
                  PAL_ClearKeyState();
                  UTIL_Delay(g_TextLib.iDelayTime * 8);

                  if (g_InputState.dwKeyPress & (kKeySearch | kKeyMenu))
                  {
                     //
                     // User pressed a key to skip the dialog
                     //
                     g_TextLib.fUserSkip = TRUE;
                  }
               }
            }
         }

         g_TextLib.posIcon = PAL_XY(x, y);
         g_TextLib.nCurrentDialogLine++;
      }
   }
}
Beispiel #3
0
/*++
 The main battle routine.
 
 Return value:
 The result of the battle.
 --*/
static BATTLERESULT PAL_BattleMain(void)
{
    int         i;
    DWORD       dwTime;
    
    VIDEO_BackupScreen();
    
    //
    // Generate the scene and draw the scene to the screen buffer
    //
    PAL_BattleMakeScene();
    SDL_BlitSurface(g_Battle.lpSceneBuf, NULL, gpScreen, NULL);
    
    //
    // Fade out the music and delay for a while
    //
    PAL_PlayMUS(0, FALSE, 1);
    UTIL_Delay(200);
    
    //
    // Switch the screen
    //
    VIDEO_SwitchScreen(5);
    
    //
    // Play the battle music
    //
    PAL_PlayMUS(gpGlobals->wNumBattleMusic, TRUE, 0);
    
    //
    // Fade in the screen when needed
    //
    if (gpGlobals->fNeedToFadeIn)
    {
        PAL_FadeIn(gpGlobals->wNumPalette, gpGlobals->fNightPalette, 1);
        gpGlobals->fNeedToFadeIn = FALSE;
    }
    
    //
    // Run the pre-battle scripts for each enemies
    //
    for (i = 0; i <= g_Battle.wMaxEnemyIndex; i++)
    {
        g_Battle.rgEnemy[i].wScriptOnTurnStart =
        PAL_RunTriggerScript(g_Battle.rgEnemy[i].wScriptOnTurnStart, i);
        
        if (g_Battle.BattleResult != kBattleResultPreBattle)
        {
            break;
        }
    }
    
    if (g_Battle.BattleResult == kBattleResultPreBattle)
    {
        g_Battle.BattleResult = kBattleResultOnGoing;
    }
    
#ifndef PAL_CLASSIC
    PAL_UpdateTimeChargingUnit();
#endif
    
    dwTime = SDL_GetTicks();
    
    PAL_ClearKeyState();
    
    //
    // Run the main battle loop.
    //
    while (TRUE)
    {
        //
        // Break out if the battle ended.
        //
        if (g_Battle.BattleResult != kBattleResultOnGoing)
        {
            break;
        }
        
        //
        // Wait for the time of one frame. Accept input here.
        //
        PAL_ProcessEvent();
        while (SDL_GetTicks() <= dwTime)
        {
            PAL_ProcessEvent();
            SDL_Delay(1);
        }
        
        //
        // Set the time of the next frame.
        //
        dwTime = SDL_GetTicks() + BATTLE_FRAME_TIME;
        
        //
        // Run the main frame routine.
        //
        PAL_BattleStartFrame();
        
        //
        // Update the screen.
        //
        VIDEO_UpdateScreen(NULL);
    }
    
    //
    // Return the battle result
    //
    return g_Battle.BattleResult;
}
Beispiel #4
0
VOID
PAL_NEW_EndingScreen1(
VOID
)
/*++
Purpose:

显示结尾处的消灭合体水魔兽的动画,对应95/98版的第4、5个avi视频

Parameters:

None.

Return value:

None.

--*/
{
	//1128 0043 0019 0000 0000 设置播放音乐 25
	PAL_PlayMUS(0x19, TRUE, 0);

	//1129 008B 0005 0000 0000 改变调色板 05
	PAL_SetPalette(5, FALSE);

	//112A 00A4 0044 0000 000F 卷动FBP图片 68 00 15
	PAL_ScrollFBP(68, 0xf, TRUE);

	//112B 0050 0000 0000 0000 全屏淡出
	PAL_FadeOut(1);

	SDL_FillRect(gpScreen, NULL, 0);
	//112C 008B 0004 0000 0000 改变调色板 04
	PAL_SetPalette(4, FALSE);

	//112D 0096 0000 0000 0000 播放结束动画
	PAL_EndingAnimation();


	gpGlobals->wNumPalette = 4;
	//112E 0077 0001 0000 0000 停止播放音乐 01
	PAL_PlayMUS(0, FALSE, 1);

	//112F 008C 000F 0007 0000 屏幕逐渐褪色 15 07 00
	PAL_ColorFade(7, 15, FALSE);

	//1131 00A3 0002 0011 0000 播放CD音轨 02 若失败 则播放RIX 17
	if (!SOUND_PlayCDA(2))
	{
		RIX_Play(0x11, TRUE, 0);
	}

	SDL_FillRect(gpScreen, NULL, 0);

	//1132 0036 000B 0000 0000 设置动画 11
	//1133 0037 0000 0001 0000 播放动画 00 01 00
	PAL_RNGPlay(0xb, 0, 1, 7);

	//1134 008B 0000 0000 0000 改变调色板 00
	PAL_SetPalette(0, FALSE);

	//1135 0037 0002 0000 0007 播放动画 02 00 07
	PAL_RNGPlay(0xb, 2, 999, 7);

	//1136 0050 0003 0000 0000 全屏淡出
	PAL_FadeOut(3);

	SDL_FillRect(gpScreen, NULL, 0);
	//1137 008B 0008 0000 0000 改变调色板 08
	PAL_SetPalette(8, FALSE);

	//1138 0036 000A 0000 0000 设置动画 10
	//1139 0037 0000 0000 0006 播放动画 00 00 06
	PAL_RNGPlay(10, 0, 999, 6);

	//113A 0076 0047 000A 0000 显示FBP图像 71 10
	PAL_EndingSetEffectSprite(0);
	PAL_ShowFBP(71, 10);

	//113B 00A6 0000 0000 0000 备份画面
	VIDEO_BackupScreen();

	//113C 00A5 0046 027B 0007 淡入FBP图片 70 635 07
	PAL_EndingSetEffectSprite(0x27b);
	PAL_ShowFBP(70, 7);

	//113D 008B 0005 0000 0000 改变调色板 05
	PAL_SetPalette(5, FALSE);

	//113E 00A5 0043 FFFF 0007 淡入FBP图片 67 65535 07
	PAL_ShowFBP(67, 7);

	//113F 00A4 0042 FFFF 0007 卷动FBP图片 66 65535 07
	PAL_ScrollFBP(66, 0xf, TRUE);

	//1140 00A5 0041 FFFF 0007 淡入FBP图片 65 65535 07
	PAL_ShowFBP(65, 7);
}
Beispiel #5
0
VOID
PAL_ShowFBP(
WORD         wChunkNum,
WORD         wFade
)
/*++
  Purpose:

  Draw an FBP picture to the screen.

  Parameters:

  [IN]  wChunkNum - number of chunk in fbp.mkf file.

  [IN]  wFade - fading speed of showing the picture.

  Return value:

  None.

  --*/
{
	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);
#if SDL_VERSION_ATLEAST(2, 0, 0)
		SDL_SetSurfacePalette(p, gpScreen->format->palette);
#else
		SDL_SetPalette(p, SDL_PHYSPAL | SDL_LOGPAL, VIDEO_GetPalette(), 0, 256);
#endif
		PAL_FBPBlitToSurface(buf, p);
		VIDEO_BackupScreen();

		for (i = 0; i < 16; i++)
		{
			for (j = 0; j < 6; j++)
			{
				//
				// Blend the pixels in the 2 buffers, and put the result into the
				// backup buffer
				//
				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);
	}

	//
	// HACKHACK: to make the ending show correctly
	//
#ifdef PAL_WIN95
	if (wChunkNum != 68)
#else
	if (wChunkNum != 49)
#endif
	{
		PAL_FBPBlitToSurface(buf, gpScreen);
	}

	VIDEO_UpdateScreen(NULL);
}
Beispiel #6
0
VOID
PAL_EndingScreen(
VOID
)
{
	RIX_Play(0x1a, TRUE, 0);
	PAL_RNGPlay(gpGlobals->iCurPlayingRNG, 110, 150, 7);
	PAL_RNGPlay(gpGlobals->iCurPlayingRNG, 151, 999, 9);

	PAL_FadeOut(2);

	RIX_Play(0x19, TRUE, 0);

	PAL_ShowFBP(75, 0);
	PAL_FadeIn(5, FALSE, 1);
	PAL_ScrollFBP(74, 0xf, TRUE);

	PAL_FadeOut(1);

	SDL_FillRect(gpScreen, NULL, 0);
	gpGlobals->wNumPalette = 4;
	gpGlobals->fNeedToFadeIn = TRUE;
	PAL_EndingAnimation();

	RIX_Play(0, FALSE, 2);
	PAL_ColorFade(7, 15, FALSE);

	if (!SOUND_PlayCDA(2))
	{
		RIX_Play(0x11, TRUE, 0);
	}

	SDL_FillRect(gpScreen, NULL, 0);
	PAL_SetPalette(0, FALSE);
	PAL_RNGPlay(0xb, 0, 999, 7);

	PAL_FadeOut(2);

	SDL_FillRect(gpScreen, NULL, 0);
	gpGlobals->wNumPalette = 8;
	gpGlobals->fNeedToFadeIn = TRUE;
	PAL_RNGPlay(10, 0, 999, 6);

	PAL_EndingSetEffectSprite(0);
	PAL_ShowFBP(77, 10);

	VIDEO_BackupScreen();

	PAL_EndingSetEffectSprite(0x27b);
	PAL_ShowFBP(76, 7);

	PAL_SetPalette(5, FALSE);
	PAL_ShowFBP(73, 7);
	PAL_ScrollFBP(72, 0xf, TRUE);

	PAL_ShowFBP(71, 7);
	PAL_ShowFBP(68, 7);

	PAL_EndingSetEffectSprite(0);
	PAL_ShowFBP(68, 6);

	PAL_WaitForKey(0);
	RIX_Play(0, FALSE, 1);
	UTIL_Delay(500);

	if (!SOUND_PlayCDA(13))
	{
		RIX_Play(9, TRUE, 0);
	}

	PAL_ScrollFBP(67, 0xf, TRUE);
	PAL_ScrollFBP(66, 0xf, TRUE);
	PAL_ScrollFBP(65, 0xf, TRUE);
	PAL_ScrollFBP(64, 0xf, TRUE);
	PAL_ScrollFBP(63, 0xf, TRUE);
	PAL_ScrollFBP(62, 0xf, TRUE);
	PAL_ScrollFBP(61, 0xf, TRUE);
	PAL_ScrollFBP(60, 0xf, TRUE);
	PAL_ScrollFBP(59, 0xf, TRUE);

	RIX_Play(0, FALSE, 6);
	PAL_FadeOut(3);
}
Beispiel #7
0
VOID
PAL_ScrollFBP(
WORD         wChunkNum,
WORD         wScrollSpeed,
BOOL         fScrollDown
)
/*++
  Purpose:

  Scroll up an FBP picture to the screen.

  Parameters:

  [IN]  wChunkNum - number of chunk in fbp.mkf file.

  [IN]  wScrollSpeed - scrolling speed of showing the picture.

  [IN]  fScrollDown - TRUE if scroll down, FALSE if scroll up.

  Return value:

  None.

  --*/
{
	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;
	}

#if SDL_VERSION_ATLEAST(2, 0, 0)
	SDL_SetSurfacePalette(p, gpScreen->format->palette);
#else
	SDL_SetPalette(p, SDL_PHYSPAL | SDL_LOGPAL, VIDEO_GetPalette(), 0, 256);
#endif

	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;
#if SDL_VERSION_ATLEAST(2, 0, 0)
			SDL_SetSurfacePalette(p, gpScreen->format->palette);
#else
			SDL_SetPalette(p, SDL_PHYSPAL | SDL_LOGPAL, VIDEO_GetPalette(), 0, 256);
#endif
		}

		UTIL_Delay(800 / wScrollSpeed);
	}

	SDL_BlitSurface(p, NULL, gpScreen, NULL);
	SDL_FreeSurface(p);
	VIDEO_UpdateScreen(NULL);
}