VOID PAL_FreeGlobals( VOID ) /*++ Purpose: Free global data. Parameters: None. Return value: None. --*/ { if (gpGlobals != NULL) { // // Close all opened files // UTIL_CloseFile(gpGlobals->f.fpFBP); UTIL_CloseFile(gpGlobals->f.fpMGO); UTIL_CloseFile(gpGlobals->f.fpBALL); UTIL_CloseFile(gpGlobals->f.fpDATA); UTIL_CloseFile(gpGlobals->f.fpF); UTIL_CloseFile(gpGlobals->f.fpFIRE); UTIL_CloseFile(gpGlobals->f.fpRGM); UTIL_CloseFile(gpGlobals->f.fpSSS); UTIL_CloseFile(gpGlobals->f.fpVOC); // // Free the game data // free(gpGlobals->g.lprgEventObject); free(gpGlobals->g.lprgScriptEntry); free(gpGlobals->g.lprgStore); free(gpGlobals->g.lprgEnemy); free(gpGlobals->g.lprgEnemyTeam); free(gpGlobals->g.lprgMagic); free(gpGlobals->g.lprgBattleField); free(gpGlobals->g.lprgLevelUpMagic); // // Free the object description data // PAL_FreeObjectDesc(gpGlobals->lpObjectDesc); // // Delete the instance // free(gpGlobals); } gpGlobals = NULL; }
/*++ Free global data. --*/ VOID PAL_FreeGlobals(void) { if (gpGlobals != NULL) { // // Close all opened files // UTIL_CloseFile(gpGlobals->f.fpFBP); UTIL_CloseFile(gpGlobals->f.fpMGO); UTIL_CloseFile(gpGlobals->f.fpBALL); UTIL_CloseFile(gpGlobals->f.fpDATA); UTIL_CloseFile(gpGlobals->f.fpF); UTIL_CloseFile(gpGlobals->f.fpFIRE); UTIL_CloseFile(gpGlobals->f.fpRGM); UTIL_CloseFile(gpGlobals->f.fpSSS); // // Free the game data // free(gpGlobals->g.lprgEventObject); free(gpGlobals->g.lprgScriptEntry); free(gpGlobals->g.lprgStore); free(gpGlobals->g.lprgEnemy); free(gpGlobals->g.lprgEnemyTeam); free(gpGlobals->g.lprgMagic); free(gpGlobals->g.lprgBattleField); free(gpGlobals->g.lprgLevelUpMagic); // // Free the object description data // #ifndef PAL_WIN95 PAL_FreeObjectDesc(gpGlobals->lpObjectDesc); #endif // // Delete the instance // free(gpGlobals); } gpGlobals = NULL; }
VOID PAL_RNGPlay( INT iNumRNG, INT iStartFrame, INT iEndFrame, INT iSpeed ) /*++ Purpose: Play a RNG movie. Parameters: [IN] iNumRNG - number of the RNG movie. [IN] iStartFrame - start frame number. [IN] iEndFrame - end frame number. [IN] iSpeed - speed of playing. Return value: None. --*/ { UINT iTime; int iDelay = 800 / (iSpeed == 0 ? 16 : iSpeed); FILE *fp; fp = UTIL_OpenRequiredFile("rng.mkf.tns"); for (; iStartFrame <= iEndFrame; iStartFrame++) { iTime = SDL_GetTicks() + iDelay; if (PAL_RNGBlitToSurface(iNumRNG, iStartFrame, gpScreen, fp) == -1) { // // Failed to get the frame, don't go further // UTIL_CloseFile(fp); return; } // // Update the screen // VIDEO_UpdateScreen(NULL); // // Fade in the screen if needed // if (gpGlobals->fNeedToFadeIn) { PAL_FadeIn(gpGlobals->wNumPalette, gpGlobals->fNightPalette, 1); gpGlobals->fNeedToFadeIn = FALSE; } // // Delay for a while // PAL_ProcessEvent(); while (SDL_GetTicks() <= iTime) { PAL_ProcessEvent(); SDL_Delay(1); } } UTIL_CloseFile(fp); }