VOID PAL_StartFrame( VOID ) /*++ Purpose: Starts a video frame. Called once per video frame. Parameters: None. Return value: None. --*/ { // // Run the game logic of one frame // PAL_GameUpdate(TRUE); if (gpGlobals->fEnteringScene) { return; } // // Update the positions and gestures of party members // PAL_UpdateParty(); // // Update the scene // PAL_MakeScene(); VIDEO_UpdateScreen(NULL); if (g_InputState.dwKeyPress & kKeyMenu) { // // Show the in-game menu // PAL_InGameMenu(); } else if (g_InputState.dwKeyPress & kKeyUseItem) { // // Show the use item menu // PAL_GameUseItem(); } else if (g_InputState.dwKeyPress & kKeyThrowItem) { // // Show the equipment menu // PAL_GameEquipItem(); } else if (g_InputState.dwKeyPress & kKeyForce) { // // Show the magic menu // PAL_InGameMagicMenu(); } else if (g_InputState.dwKeyPress & kKeyStatus) { // // Show the player status // PAL_PlayerStatus(); } else if (g_InputState.dwKeyPress & kKeySearch) { // // Process search events // PAL_Search(); } else if (g_InputState.dwKeyPress & kKeyFlee) { // // Quit Game // if (PAL_ConfirmMenu()) { PAL_PlayMUS(0, FALSE, 2); PAL_FadeOut(2); PAL_Shutdown(); exit(0); } } if (--gpGlobals->wChasespeedChangeCycles == 0) { gpGlobals->wChaseRange = 1; } }
VOID PAL_SceneFade( INT iPaletteNum, BOOL fNight, INT iStep ) /*++ Purpose: Fade in or fade out the screen. Update the scene during the process. Parameters: [IN] iPaletteNum - number of the palette. [IN] fNight - whether use the night palette or not. [IN] iStep - positive to fade in, nagative to fade out. Return value: None. --*/ { SDL_Color *palette, newpalette[256]; int i, j; DWORD time; palette = PAL_GetPalette(iPaletteNum, fNight); if (palette == NULL) { return; } if (iStep == 0) { iStep = 1; } gpGlobals->fNeedToFadeIn = FALSE; if (iStep > 0) { for (i = 0; i < 64; i += iStep) { time = SDL_GetTicks() + 100; // // Generate the scene // PAL_ClearKeyState(); g_InputState.dir = kDirUnknown; g_InputState.prevdir = kDirUnknown; PAL_GameUpdate(FALSE); PAL_MakeScene(); VIDEO_UpdateScreen(NULL); // // Calculate the current palette... // for (j = 0; j < 256; j++) { newpalette[j].r = (palette[j].r * i) >> 6; newpalette[j].g = (palette[j].g * i) >> 6; newpalette[j].b = (palette[j].b * i) >> 6; } VIDEO_SetPalette(newpalette); PAL_ProcessEvent(); while (!SDL_TICKS_PASSED(SDL_GetTicks(), time)) { PAL_ProcessEvent(); SDL_Delay(5); } } } else { for (i = 63; i >= 0; i += iStep)
VOID PAL_StartFrame( VOID ) /*++ Purpose: Starts a video frame. Called once per video frame. Parameters: None. Return value: None. --*/ { // // Run the game logic of one frame // LoginInfo("PAL_StartFrame\n" ); PAL_GameUpdate(TRUE); if (gpGlobals->fEnteringScene) { return; } // // Update the positions and gestures of party members // PAL_UpdateParty(); // // Update the scene // PAL_MakeScene(); VIDEO_UpdateScreen(NULL); if (g_InputState.dwKeyPress & kKeyMenu) { // // Show the in-game menu // PAL_InGameMenu(); } else if (g_InputState.dwKeyPress & kKeyUseItem) { // // Show the use item menu // PAL_GameUseItem(); } else if (g_InputState.dwKeyPress & kKeyStatus) { // // Show the player status // PAL_PlayerStatus(); } else if (g_InputState.dwKeyPress & kKeySearch) { // // Process search events // PAL_Search(); } if (--gpGlobals->wChasespeedChangeCycles == 0) { gpGlobals->wChaseRange = 1; } }