void Intro(void) { NewGameWindow(1); /* Set to 512 mode */ FadeToBlack(); /* Fade out the video */ DisplayScreen(rMacPlayPic, rMacPlayPal); BlastScreen(); StartSong(SongListPtr[0]); /* Play the song */ FadeTo(rMacPlayPal); /* Fade in the picture */ WaitTicksEvent(240); /* Wait for event */ DisplayScreen(rMacPlayPic, rIdLogoPal); /* higher bpp hack */ BlastScreen(); FadeTo(rIdLogoPal); if (toupper(WaitTicksEvent(240))=='B') { /* Wait for event */ FadeToBlack(); ClearTheScreen(BLACK); DisplayScreen(rYummyPic, rYummyPal); BlastScreen(); FadeTo(rYummyPal); WaitTicksEvent(600); } }
int WolfMain(int argc, char *argv[]) { WaitTick(); /* Wait for a system tick to go by */ playstate = (exit_t)setjmp(ResetJmp); NumberIndex = 36; /* Force the score to redraw properly */ IntermissionHack = FALSE; if (playstate) { goto DoGame; /* Begin a new game or saved game */ } JumpOK = TRUE; /* Jump vector is VALID */ FlushKeys(); /* Allow a system event */ Intro(); /* Do the game intro */ for (;;) { if (TitleScreen()) { /* Show the game logo */ StartSong(SongListPtr[0]); ClearTheScreen(BLACK); /* Blank out the title page */ BlastScreen(); SetAPalette(rBlackPal); if (ChooseGameDiff()) { /* Choose your difficulty */ playstate = EX_NEWGAME; /* Start a new game */ DoGame: FadeToBlack(); /* Fade the screen */ StartGame(); /* Play the game */ } } /* TODO: demos or whatever here */ } return 0; }
eStateType CLogoState::CheckState(void) { //If it stays this, we continue running eStateType eNextState = GetType(); if (m_bStateChanges[STATE_CH_MAINMENU]) { if (FadeToBlack(m_fDT, 1.0f) == FALSE) { return GetType(); } m_bToPop = true; eNextState = STATE_MAINMENU; } if (CBaseState::CheckState() == STATE_NULL) { eNextState = STATE_NULL; } if (eNextState != GetType()) { m_fFadeIn = 0; m_fFadeOut = 0; } return eNextState; }
void scene_gestalt() { float time = 0.0; float offset = 1.0; object p1 = GetObjectByTag("intro_p1_start"); object p2 = GetObjectByTag("intro_p2_start"); object p2e = GetObjectByTag("intro_p2_end"); object p3 = GetObjectByTag("intro_p3"); /* Initialize */ GestaltStartCutscene(pc); GestaltCameraFade(time, pc, FADE_CROSS, FADE_SPEED_MEDIUM, fade_duration); ghost(); /* Setup */ time = 2*delay; GestaltInvisibility(time, pc); GestaltCameraFacing(time, 63.0, 10.0, 85.0, pc); play_audio(time); /* Pass 1 */ GestaltJump(time, pc, p1); GestaltActionMove(time + offset, pc, p2, FALSE, 0.0, 5*delay); /* Pass 2 */ time = 7*delay; GestaltCameraFade(time - offset, pc, FADE_CROSS, FADE_SPEED_MEDIUM, fade_duration); GestaltCameraFacing(time + offset, 293.0, 10.0, 85.0, pc); GestaltJump(time, pc, p2); GestaltActionMove(time + offset, pc, p2e, FALSE, 0.0, 5*delay); /* Pass 3 (zoom into shadow) */ time = 12*delay; GestaltCameraFade(time - offset, pc, FADE_CROSS, FADE_SPEED_MEDIUM, fade_duration); GestaltJump(time + offset, pc, p3); GestaltCameraMove(time + offset, 260.0, 20.0, 85.0, 280.0, 10.0, 85.0, 5*delay, 60.0, pc); /* Clean up and end cutscene */ time = 16 * delay; DelayCommand(time, FadeToBlack(pc)); //GestaltCameraFade(time - offset, pc, FADE_CROSS, FADE_SPEED_MEDIUM, fade_duration); /* Trigger ScriptEase */ time = 18 * delay; GestaltClearEffect(time, pc); GestaltStopCutscene(time, pc, "intro_end"); time = time + offset; // GestaltCameraFacing(time, 270.0, 10.0, 75.0, pc); AssignCommand(pc, SetCameraFacing(270.0, 10.0)); DelayCommand(time, AssignCommand(pc, SetFacing(270.0))); DelayCommand(time, SetLocked(GetObjectByTag("activate_easel_trigger"), FALSE)); DelayCommand(time, FadeFromBlack(pc)); }
void Intermission (void) { FadeToBlack(); LevelCompleted(); /* Show the data (Init ParTime) */ gamestate.globaltime += gamestate.playtime; /* Add in the playtime */ gamestate.globaltimetotal += ParTime; /* Get the par */ gamestate.globalsecret += gamestate.secretcount; /* Secrets found */ gamestate.globaltreasure += gamestate.treasurecount; /* Treasures found */ gamestate.globalkill += gamestate.killcount; /* Number killed */ gamestate.globalsecrettotal += gamestate.secrettotal; /* Total secrets */ gamestate.globaltreasuretotal += gamestate.treasuretotal; /* Total treasures */ gamestate.globalkilltotal += gamestate.killtotal; /* Total kills */ SetupPlayScreen(); /* Reset the game screen */ }
Boolean TitleScreen() { Word RetVal; /* Value to return */ playstate = EX_LIMBO; /* Game is not in progress */ NewGameWindow(1); /* Set to 512 mode */ FadeToBlack(); /* Fade out the video */ DisplayScreen(rTitlePic, rTitlePal); BlastScreen(); StartSong(SongListPtr[0]); FadeTo(rTitlePal); /* Fade in the picture */ BlastScreen(); RetVal = WaitTicksEvent(0); /* Wait for event */ playstate = EX_COMPLETED; return TRUE; }
void main() { object oUsingObject = GetLastUsedBy(); object oPlayer = GetFirstPC(); /* If the using object is the player, change the lighting */ if(oUsingObject == oPlayer) { /* Fade to black, darken the lighting */ FadeToBlack(oPlayer, FADE_SPEED_FAST); DelayCommand(TIME_SEPARATION * 1, DarkenArea()); /* Teleport the using object to the destination */ DelayCommand(TIME_SEPARATION * 2, AssignCommand(oUsingObject, ActionJumpToObject(GetObjectByTag(DESTINATION_TAG)))); /* Fade from black */ DelayCommand(TIME_SEPARATION * 3, FadeFromBlack(oPlayer, FADE_SPEED_FASTEST)); } else { /* Teleport the using object to the corresponding mirror */ AssignCommand(oUsingObject, ActionJumpToObject(GetObjectByTag(DESTINATION_TAG))); } }
/* * UpdateMenu: * The routine which determines which menu buttons are being pressed and does * other tidbits of crap */ void UpdateMenu(void) { RECT SrcRect, DesRect; // Source and Destination rectangles HRESULT ret; // Set the source and destination rectangles SetRect(&SrcRect, 0, 0, 640, 480); SetRect(&DesRect, 0, 0, 640, 480); // Blit the lpDDSMenu surface (Menu Graphic) to the back buffer lpDDSBack->Blt(&DesRect, lpDDSMenu, &SrcRect, DDBLT_WAIT, NULL); // If the left mouse button is pressed if (MouseLB) { // Determine what was clicked on if (XYInRect(MouseX, MouseY, &StartGameRect)) { // The start game button was pressed // Game Start Code Here DrawButtonDown(0); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound FadeToBlack(); // Fade the screen to black MidiStop(); // Stop the midi KillMenuGFX(); // release the menu graphic surface InitWorld(); // initialize the world LoadGameGFX(); // Load the games needed graphics Game_State = DOD_PLAYING; // set the game state to DOD_PLAYING } else if (XYInRect(MouseX, MouseY, &LoadGameRect)) { // The load game button was pressed // Load Game Code Here DrawButtonDown(1); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound } else if (XYInRect(MouseX, MouseY, &OptionsRect)) { // The options button was pressed // Options Code Here DrawButtonDown(2); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound } else if (XYInRect(MouseX, MouseY, &CreditsRect)) { // The credits button was pressed // Credits Code Here DrawButtonDown(3); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound FadeToBlack(); // fade the menu to black MidiStop(); // stop the midi MidiPlay(".\\Music\\credits.mid", TRUE); // play the credits music Game_State = DOD_CREDITS; // set the Game_State into Credits mode } else if (XYInRect(MouseX, MouseY, &ExitRect)) { // The exit button was pressed // Exit Code Here DrawButtonDown(4); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound FadeToBlack(); // Fade to a black screen DDFillSurface(lpDDSPrimary, 0); // Fill the primary surface with black DDFillSurface(lpDDSBack, 0); // Fill the back surface with black KillMenuGFX(); // release the menu graphic surface PostMessage(main_window_handle, WM_DESTROY, 0, 0); // Post the destroy window message Game_State = DOD_NOTHING; // set the game state to nothing } else { // No buttons were pressed // Just draw the cursor, and flip DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } } } else { // the mouse button wasn't pressed // just draw the cursor and flip DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } } }
void CharacterCast(void) { Word Enemy,count, cycle; Word up; state_t *StatePtr; /* reload level and set things up */ gamestate.mapon = 0; /* First level again */ PrepPlayLoop(); /* Prepare the system */ viewx = actors[0].x; /* Mark the starting x,y */ viewy = actors[0].y; topspritescale = 32*2; /* go through the cast */ Enemy = 0; cycle = 0; do { StatePtr = &states[caststate[Enemy]]; /* Init the state pointer */ count = 1; /* Force a fall through on first pass */ up = FALSE; for (;;) { if (++cycle>=60*4) { /* Time up? */ cycle = 0; /* Reset the clock */ if (++Enemy>=NUMCAST) { /* Next bad guy */ Enemy = 0; /* Reset the bad guy */ } break; } if (!--count) { count = StatePtr->tictime; StatePtr = &states[StatePtr->next]; } topspritenum = StatePtr->shapenum; /* Set the formost shape # */ RenderView(); /* Show the 3d view */ WaitTicks(1); /* Limit to 15 frames a second */ ReadSystemJoystick(); /* Read the joystick */ if (!joystick1 && !up) { up = TRUE; continue; } if (!up) { continue; } if (!joystick1) { continue; } if (joystick1 & (JOYPAD_START|JOYPAD_A|JOYPAD_B|JOYPAD_X|JOYPAD_Y)) { Enemy = NUMCAST; break; } if ( (joystick1 & (JOYPAD_TL|JOYPAD_LFT)) && Enemy >0) { Enemy--; break; } if ( (joystick1 & (JOYPAD_TR|JOYPAD_RGT)) && Enemy <NUMCAST-1) { Enemy++; break; } } } while (Enemy < NUMCAST); /* Still able to show */ StopSong(); /* Stop the music */ FadeToBlack(); /* Fade out */ }
void VictoryIntermission (void) { FadeToBlack(); LevelCompleted(); }
void LevelCompleted(void) { Word k; /* setup */ ParTime = MapListPtr->InfoArray[gamestate.mapon].ParTime; BonusScore = 0; /* Init the bonus */ IntermissionHack = TRUE; /* Hack to keep score from drawing twice */ NumberIndex = 47; /* Hack to draw score using an alternate number set */ NewGameWindow(1); /* Force 512 mode screen */ DisplayScreen(rIntermission, rInterPal); BlastScreen(); InitInterMisPic(); WhichBJ = 0; /* Init BJ */ BJTime = ReadTick()-50; /* Force a redraw */ BlastScreen(); /* Draw the screen */ ShowBJ(); /* Draw BJ */ StartSong(SongListPtr[1]); /* Play the intermission song */ SetAPalette(rInterPal); /* Set the palette */ DrawIScore(); /* Draw the current score */ FlushKeys(); /* Flush the keyboard buffer */ /* First an initial pause */ BJBreath(60); /* Display Par Time, Player's Time, and show bonus if any. */ if (gamestate.playtime>=(100*60*60UL)) { k =(99*60)+59; } else { k = gamestate.playtime/60; } DrawTime(TIMEX,TIMEY,k); /* How much time has elapsed? */ DrawTime(TIMEX,TIMEY2,ParTime); if (k < ParTime) { k = (ParTime-k) * 50; /* 50 points per second */ BonusScore += k; /* Add to the bonus */ DrawIBonus(); /* Draw the bonus */ PlaySound(SND_EXTRA); BJBreath(60); /* Breath a little */ } /* Show ratios for "terminations", treasure, and secret stuff. */ /* If 100% on all counts, Perfect Bonus! */ k=0; /* Not perfect (Yet) */ RollRatio(RATIOX,RATIOY,(gamestate.treasurecount*100)/gamestate.treasuretotal); if (gamestate.treasurecount == gamestate.treasuretotal) { k++; /* Perfect treasure */ } if (!NoEnemies) { RollRatio(RATIOX,RATIOY2,(gamestate.killcount*100)/gamestate.killtotal); if (gamestate.killcount == gamestate.killtotal) { k++; /* Perfect kills */ } } RollRatio(RATIOX,RATIOY3,(gamestate.secretcount*100)/gamestate.secrettotal); if (gamestate.secretcount == gamestate.secrettotal) { k++; /* Perfect secret */ } if (BonusScore) { /* Did you get a bonus? */ RollScore(); BJBreath(60); } if (k==3) { WhichBJ = 2; /* Draw thumbs up for BJ */ PlaySound(SND_THUMBSUP); } do { ShowBJ(); /* Animate BJ */ } while (!WaitTicksEvent(1)); /* Wait for a keypress */ FadeToBlack(); /* Fade away */ FreeInitMisPic(); IntermissionHack = FALSE; /* Release the hack */ NumberIndex = 36; /* Restore the index */ }