/** * Handle clicks on the Mentat widget. * @return True, always. */ bool GUI_Widget_Mentat_Click(Widget *w) { VARIABLE_NOT_USED(w); g_cursorSpriteID = 0; Sprites_SetMouseSprite(0, 0, g_sprites[0]); Sound_Output_Feedback(0xFFFE); Driver_Voice_Play(NULL, 0xFF); Music_Play(g_table_houseInfo[g_playerHouseID].musicBriefing); Sprites_UnloadTiles(); Timer_SetTimer(TIMER_GAME, false); GUI_Mentat_ShowHelpList(false); Timer_SetTimer(TIMER_GAME, true); Driver_Sound_Play(1, 0xFF); Sprites_LoadTiles(); g_textDisplayNeedsUpdate = true; GUI_DrawInterfaceAndRadar(SCREEN_0); Music_Play(Tools_RandomLCG_Range(0, 5) + 8); return true; }
void SceneScriptNR04::sub_402960() { int v0 = Global_Variable_Query(53); if (!v0) { Music_Play(14, 11, 80, 2, -1, 0, 0); } else if (v0 == 1) { Music_Play(13, 11, 80, 2, -1, 0, 0); } else if (v0 == 2) { Music_Play(5, 11, 80, 2, -1, 0, 0); } v0++; if (v0 > 2) { v0 = 0; } Global_Variable_Set(53, v0); }
/** * Show the Mentat screen with a dialog (Proceed / Repeat). * @param houseID The house to show the mentat of. * @param stringID The string to show. * @param wsaFilename The WSA to show. * @param musicID The Music to play. */ static void GUI_Mentat_ShowDialog(uint8 houseID, uint16 stringID, const char *wsaFilename, uint16 musicID) { Widget *w1, *w2; if (g_debugSkipDialogs) return; w1 = GUI_Widget_Allocate(1, GUI_Widget_GetShortcut(String_Get_ByIndex(STR_PROCEED)[0]), 168, 168, 379, 0); w2 = GUI_Widget_Allocate(2, GUI_Widget_GetShortcut(String_Get_ByIndex(STR_REPEAT)[0]), 240, 168, 381, 0); w1 = GUI_Widget_Link(w1, w2); Sound_Output_Feedback(0xFFFE); Driver_Voice_Play(NULL, 0xFF); Music_Play(musicID); stringID += STR_HOUSE_HARKONNENFROM_THE_DARK_WORLD_OF_GIEDI_PRIME_THE_SAVAGE_HOUSE_HARKONNEN_HAS_SPREAD_ACROSS_THE_UNIVERSE_A_CRUEL_PEOPLE_THE_HARKONNEN_ARE_RUTHLESS_TOWARDS_BOTH_FRIEND_AND_FOE_IN_THEIR_FANATICAL_PURSUIT_OF_POWER + houseID * 40; do { strncpy(g_readBuffer, String_Get_ByIndex(stringID), g_readBufferSize); sleepIdle(); } while (GUI_Mentat_Show(g_readBuffer, wsaFilename, w1, true) == 0x8002); free(w2); free(w1); if (musicID != 0xFFFF) Driver_Music_FadeOut(); }
/** * The Intro. */ void GameLoop_GameIntroAnimation(void) { GUI_ChangeSelectionType(SELECTIONTYPE_INTRO); Gameloop_Logos(); if (Input_Keyboard_NextKey() == 0 || !g_canSkipIntro) { const HouseAnimation_Animation *animation = g_table_houseAnimation_animation[HOUSEANIMATION_INTRO]; const HouseAnimation_Subtitle *subtitle = g_table_houseAnimation_subtitle[HOUSEANIMATION_INTRO]; const HouseAnimation_SoundEffect *soundEffect = g_table_houseAnimation_soundEffect[HOUSEANIMATION_INTRO]; Music_Play(0x1B); /* 0x4A = 74 = Intro feedback base index */ GameLoop_PrepareAnimation(subtitle, 0x4A, soundEffect); GameLoop_PlayAnimation(animation); Driver_Music_FadeOut(); GameLoop_FinishAnimation(); } GUI_ChangeSelectionType(SELECTIONTYPE_MENTAT); }
void SceneScriptCT01::InitializeScene() { Music_Play(3, 28, 0, 2, -1, 1, 0); Game_Flag_Reset(kFlagArrivedFromSpinner1); if (Game_Flag_Query(kFlagCT02toCT01)) { Game_Flag_Reset(kFlagCT02toCT01); Setup_Scene_Information(-35.2f, -6.5f, 352.28f, 603); } else if (Game_Flag_Query(kFlagCT03toCT01)) { Game_Flag_Reset(kFlagCT03toCT01); Setup_Scene_Information(-311.0f, -6.5f, 710.0f, 878); } else if (Game_Flag_Query(kFlagCT12toCT01)) { Game_Flag_Reset(kFlagCT12toCT01); Setup_Scene_Information(-419.0f, -6.5f, 696.0f, 28); if (Global_Variable_Query(kVariableChapter) != 2 && Global_Variable_Query(kVariableChapter) != 3 ) { if (Game_Flag_Query(kFlagSpinnerAtCT01)) { Scene_Loop_Start_Special(kSceneLoopModeLoseControl, kCT01LoopInshotFromCT12WithSpinner, false); } else { Scene_Loop_Start_Special(kSceneLoopModeLoseControl, kCT01LoopInshotFromCT12NoSpinner, false); } } } else if (Game_Flag_Query(kFlagSpinnerAtCT01)) { Setup_Scene_Information(-530.0f, -6.5f, 241.0f, 506); Game_Flag_Set(kFlagArrivedFromSpinner1); } else { Setup_Scene_Information(-397.0f, -6.5f, 471.0f, 250); } Scene_Exit_Add_2D_Exit(kCT01ExitCT02, 290, 256, 360, 304, 1); if (Actor_Clue_Query(kActorMcCoy, kClueZubenRunsAway)) { Scene_Exit_Add_2D_Exit(kCT01ExitCT03, 571, 233, 639, 367, 1); } if (Game_Flag_Query(kFlagCT05WarehouseOpen)) { Scene_Exit_Add_2D_Exit(kCT01ExitCT12, 506, 400, 639, 479, 2); } if (Game_Flag_Query(kFlagSpinnerAtCT01)) { Scene_Exit_Add_2D_Exit(kCT01ExitSpinner, 0, 286, 158, 350, 2); } Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); Ambient_Sounds_Add_Looping_Sound(55, 40, -100, 1); Ambient_Sounds_Add_Looping_Sound(56, 40, 100, 1); Ambient_Sounds_Add_Sound(61, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(62, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(63, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(64, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Sound(68, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(69, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(375, 20, 40, 33, 50, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(376, 20, 40, 33, 50, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(377, 20, 40, 33, 50, -100, 100, -101, -101, 0, 0); if (Game_Flag_Query(kFlagSpinnerAtCT01)) { Scene_Loop_Set_Default(kCT01LoopMain); } else { Scene_Loop_Set_Default(kCT01LoopMainLoopNoSpinner); } }
// this function will toggle the music playing void PressB(void){ mute ^= 1; if (mute){ Music_Stop(); } else{ Music_Play(); } }
void SceneScriptNR06::sub_401BAC() { if (Music_Is_Playing()) { Music_Adjust(31, 80, 2); } else { int v0 = Global_Variable_Query(54); if (v0 == 0) { Music_Play(16, 61, -80, 2, -1, 0, 0); } else if (v0 == 1) { Music_Play(15, 41, -80, 2, -1, 0, 0); } else if (v0 == 2) { Music_Play(7, 41, -80, 2, -1, 0, 0); } v0++; if (v0 > 2) { v0 = 0; } Global_Variable_Set(54, v0); } }
void SceneScriptHF04::PlayerWalkedIn() { if (Actor_Query_Goal_Number(kActorLucy) == kGoalLucyHF04Start || Actor_Query_Goal_Number(kActorLucy) == kGoalLucyHF04Run1 ) { Player_Set_Combat_Mode(true); Music_Play(kMusicBatl226M, 60, 0, 2, -1, 0, 0); } Loop_Actor_Walk_To_XYZ(kActorMcCoy, -45.0f, -0.31f, 307.0f, 0, false, true, false); Delay(2500); }
void ScriptKP07::SceneLoaded() { if (!Game_Flag_Query(653)) { Music_Play(19, 25, 0, 0, -1, 1, 0); } Obstacle_Object("BUNK_TRAY01", true); Unobstacle_Object("BUNK_TRAY01", true); if (Game_Flag_Query(653)) { Player_Set_Combat_Mode(false); Scene_Exits_Disable(); } }
/** * Saves the game options. */ void GameOptions_Save(void) { uint8 index; index = File_Open("OPTIONS.CFG", 2); File_Write(index, &g_gameConfig, sizeof(g_gameConfig)); File_Close(index); if (g_gameConfig.music == 0) Music_Play(0); }
void ScriptNR08::sub_4021B4() { if (Music_Is_Playing()) { Music_Adjust(51, 0, 2); } else if (Actor_Query_Goal_Number(3) == 210) { Music_Play(6, 61, 0, 1, -1, 0, 0); } else { int v0 = Global_Variable_Query(54); if (v0 == 0) { Music_Play(16, 61, -80, 2, -1, 0, 0); } else if (v0 == 1) { Music_Play(15, 41, -80, 2, -1, 0, 0); } else if (v0 == 2) { Music_Play(7, 41, -80, 2, -1, 0, 0); } v0++; if (v0 > 2) { v0 = 0; } Global_Variable_Set(54, v0); } }
void GUI_Widget_Mentat_Click_Close() { Timer_SetTimer(TIMER_GAME, true); Driver_Sound_Play(1, 0xFF); Sprites_LoadTiles(); g_textDisplayNeedsUpdate = true; GUI_DrawInterfaceAndRadar(0); Music_Play(Tools_RandomRange(0, 5) + 8); }
int main(void){ HeartBeat_Init(); DAC_Init(1024); // initialize with command: Vout = Vref Timer0A_Init(dt[0]); LCD_Init(); // Initialize RNG Random_Init(121213); // Initialize touchscreen GPIO Touch_Init(); //lenPush = 1; //for(i=0; i<50; i=i+1){ InitializeBars(); for(i=0; i<400; i=i+1){ MovingColorBars(); } for(i=0; i<400; i=i+1){ DestabilizeBars(); } for(i=0; i<350; i=i+1){ FinishBars(); } for(i=0; i<1000; i=i+1){ Random4BPPTestSprite(); } LCD_ColorFill(convertColor(0, 0, 0)); Buttons_Init(); play = 0; while(1){ if (instrument == 0){ Music_Play(Wave[0], 64, strobePtr, 35); } if (instrument == 1){ Music_Play(Trumpet[0], 32, strobePtr, 35); } if (instrument == 2){ Music_Play(Flute[0], 32, strobePtr, 35); } } }
void SceneScriptHC02::InitializeScene() { Music_Play(4, 45, -60, 1, -1, 1, 3); if (Game_Flag_Query(kFlagHC04toHC02)) { Setup_Scene_Information(-88.0f, 0.14f, -463.0f, 540); } else { Setup_Scene_Information(-57.0f, 0.14f, 83.0f, 746); } Scene_Exit_Add_2D_Exit(0, 589, 255, 639, 479, 1); Scene_Exit_Add_2D_Exit(1, 505, 0, 639, 170, 0); Ambient_Sounds_Add_Looping_Sound(103, 50, 50, 0); Ambient_Sounds_Add_Looping_Sound(280, 50, 50, 0); Ambient_Sounds_Add_Sound(252, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(254, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(255, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(256, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(257, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(258, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(259, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(260, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(261, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(262, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(242, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(243, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(244, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(245, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(246, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(247, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(248, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(249, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(238, 3, 50, 20, 20, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(240, 3, 50, 25, 25, -100, 100, -101, -101, 0, 0); if (Game_Flag_Query(kFlagHC01toHC02)) { Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false); Scene_Loop_Set_Default(1); Game_Flag_Reset(kFlagHC01toHC02); } else { Scene_Loop_Set_Default(1); } }
void ScriptAR02::InitializeScene() { Music_Play(0, 22, 0, 2, -1, 1, 2); if (Game_Flag_Query(116)) { Setup_Scene_Information(-560.0f, 0.0f, -799.0f, 333); } else { Setup_Scene_Information(-182.0f, 0.0f, -551.0f, 973); } Scene_Exit_Add_2D_Exit(0, 0, 439, 212, 479, 2); Scene_Exit_Add_2D_Exit(1, 81, 202, 215, 406, 3); Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); Ambient_Sounds_Add_Looping_Sound(81, 60, 100, 1); Ambient_Sounds_Add_Looping_Sound(241, 50, 1, 1); Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(242, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(243, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(244, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(245, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(246, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(247, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(248, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(249, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); Ambient_Sounds_Add_Sound(68, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(69, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(375, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(376, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(377, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); if (Game_Flag_Query(252) && Game_Flag_Query(320)) { Scene_Loop_Start_Special(0, 1, 0); Scene_Loop_Set_Default(2); Game_Flag_Reset(320); } else if (!Game_Flag_Query(252) && Game_Flag_Query(320)) { Scene_Loop_Start_Special(0, 0, 0); Scene_Loop_Set_Default(2); Game_Flag_Reset(320); } else { Scene_Loop_Set_Default(2); } }
void async_GUI_Mentat_ShowDialogOpen() { asyncMentatShowDialog.w1 = GUI_Widget_Allocate(1, GUI_Widget_GetShortcut(String_Get_ByIndex(STR_PROCEED)[0]), 168, 168, 379, 0); asyncMentatShowDialog.w2 = GUI_Widget_Allocate(2, GUI_Widget_GetShortcut(String_Get_ByIndex(STR_REPEAT)[0]), 240, 168, 381, 0); asyncMentatShowDialog.w1 = GUI_Widget_Link(asyncMentatShowDialog.w1, asyncMentatShowDialog.w2); Sound_Output_Feedback(0xFFFE); Driver_Voice_Play(NULL, 0xFF); Music_Play(asyncMentatShowDialog.musicID); asyncMentatShowDialog.stringID += STR_HOUSE_HARKONNENFROM_THE_DARK_WORLD_OF_GIEDI_PRIME_THE_SAVAGE_HOUSE_HARKONNEN_HAS_SPREAD_ACROSS_THE_UNIVERSE_A_CRUEL_PEOPLE_THE_HARKONNEN_ARE_RUTHLESS_TOWARDS_BOTH_FRIEND_AND_FOE_IN_THEIR_FANATICAL_PURSUIT_OF_POWER + asyncMentatShowDialog.houseID * 40; }
void SceneScriptMA02::PlayerWalkedIn() { if (Game_Flag_Query(34)) { sub_402044(); } if (Game_Flag_Query(36)) { Loop_Actor_Walk_To_XYZ(kActorMcCoy, -148.12f, -144.13f, 34.27f, 0, 1, false, 0); } if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(655)) { Game_Flag_Set(623); Game_Flag_Set(655); sub_401E4C(); Loop_Actor_Walk_To_XYZ(kActorMcCoy, 23.19f, -144.12f, 378.27f, 0, 0, false, 0); Game_Flag_Set(33); Set_Enter(52, 52); // return true; return; } if (Global_Variable_Query(1) == 5 && !Game_Flag_Query(654)) { if (Game_Flag_Query(653)) { Actor_Says(kActorMcCoy, 2390, 0); Music_Play(2, 25, 0, 3, -1, 0, 0); } else { Actor_Says(kActorMcCoy, 2385, 3); } Game_Flag_Set(654); Autosave_Game(3); } if (Global_Variable_Query(1) < 4 && !Game_Flag_Query(36) && Actor_Query_Goal_Number(kActorMaggie) != 2) { Actor_Set_Goal_Number(kActorMaggie, 1); if (!Game_Flag_Query(60)) { Game_Flag_Set(60); Actor_Face_Actor(kActorMcCoy, kActorMaggie, true); Actor_Voice_Over(1210, kActorVoiceOver); if (!Game_Flag_Query(378)) { Actor_Voice_Over(1220, kActorVoiceOver); } Actor_Voice_Over(1230, kActorVoiceOver); if (!Game_Flag_Query(378)) { Actor_Voice_Over(1240, kActorVoiceOver); Actor_Voice_Over(1250, kActorVoiceOver); } } } Game_Flag_Reset(36); Game_Flag_Reset(34); //return false; return; }
bool ScriptKP07::ClickedOnActor(int actorId) { if (actorId == 5) { if (Game_Flag_Query(697) || actorId != 5 || Actor_Query_Goal_Number(5) == 599 || Actor_Query_Goal_Number(5) == 515) { return false; } if (Game_Flag_Query(653)) { Actor_Set_Goal_Number(5, 516); } else { Music_Play(20, 31, 0, 0, -1, 1, 0); Actor_Set_Goal_Number(5, 514); } } else { Actor_Face_Actor(0, actorId, true); Actor_Says(0, 8590, 14); } return true; }
/** * Shows the end game "movie" */ void GameLoop_GameEndAnimation(void) { const HouseAnimation_Animation *animation; const HouseAnimation_Subtitle *subtitle; const HouseAnimation_SoundEffect *soundEffect; uint16 sound; Voice_LoadVoices(0xFFFE); switch (g_playerHouseID) { case HOUSE_HARKONNEN: animation = g_table_houseAnimation_animation[HOUSEANIMATION_LEVEL9_HARKONNEN]; subtitle = g_table_houseAnimation_subtitle[HOUSEANIMATION_LEVEL9_HARKONNEN]; soundEffect = g_table_houseAnimation_soundEffect[HOUSEANIMATION_LEVEL9_HARKONNEN]; sound = 0x1E; break; default: case HOUSE_ATREIDES: animation = g_table_houseAnimation_animation[HOUSEANIMATION_LEVEL9_ARTREIDES]; subtitle = g_table_houseAnimation_subtitle[HOUSEANIMATION_LEVEL9_ARTREIDES]; soundEffect = g_table_houseAnimation_soundEffect[HOUSEANIMATION_LEVEL9_ARTREIDES]; sound = 0x1F; break; case HOUSE_ORDOS: animation = g_table_houseAnimation_animation[HOUSEANIMATION_LEVEL9_ORDOS]; subtitle = g_table_houseAnimation_subtitle[HOUSEANIMATION_LEVEL9_ORDOS]; soundEffect = g_table_houseAnimation_soundEffect[HOUSEANIMATION_LEVEL9_ORDOS]; sound = 0x20; break; } GameLoop_PrepareAnimation(subtitle, 0xFFFF, soundEffect); Music_Play(sound); GameLoop_PlayAnimation(animation); Driver_Music_FadeOut(); GameLoop_FinishAnimation(); GameLoop_GameCredits(); }
void SceneScriptHC04::InitializeScene() { if (Game_Flag_Query(108)) { Setup_Scene_Information(-112.0f, 0.14f, -655.0f, 460); Game_Flag_Reset(108); } else { Setup_Scene_Information(-88.0f, 0.14f, -463.0f, 1013); } Music_Play(4, 14, -90, 1, -1, 1, 2); Actor_Put_In_Set(kActorIsabella, 8); Actor_Set_At_XYZ(kActorIsabella, -210.0f, 0.0f, -445.0f, 250); Scene_Exit_Add_2D_Exit(0, 539, 51, 639, 309, 0); Scene_Exit_Add_2D_Exit(1, 0, 456, 639, 479, 2); Ambient_Sounds_Add_Looping_Sound(103, 50, 50, 0); Ambient_Sounds_Add_Looping_Sound(329, 16, 16, 0); Ambient_Sounds_Add_Looping_Sound(330, 40, 40, 0); Ambient_Sounds_Add_Sound(182, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(184, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(185, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(186, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(188, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(189, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(191, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(192, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(195, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(252, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(252, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(254, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(255, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(256, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(257, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(258, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(259, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(260, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(261, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); Ambient_Sounds_Add_Sound(262, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); if (Game_Flag_Query(110)) { Scene_Loop_Start_Special(0, 0, 0); Scene_Loop_Set_Default(1); Game_Flag_Reset(110); } else { Scene_Loop_Set_Default(1); } }
void SceneScriptUG01::PlayerWalkedIn() { if (Game_Flag_Query(kFlagUG02toUG01)) { Loop_Actor_Walk_To_XYZ(kActorMcCoy, -55.0f, -50.13f, -288.0f, 12, 0, false, 0); Game_Flag_Reset(kFlagUG02toUG01); } if (Game_Flag_Query(kFlagRC03toUG01)) { Actor_Set_At_XYZ(kActorMcCoy, -70.0f, 93.87f, -500.0f, 768); Loop_Actor_Travel_Ladder(kActorMcCoy, 12, 0, 0); Loop_Actor_Walk_To_XYZ(kActorMcCoy, -58.0f, -50.13f, -488.0f, 0, 0, false, 0); Game_Flag_Reset(kFlagRC03toUG01); } if (Actor_Query_Goal_Number(kActorLucy) == 310) { Music_Play(21, 35, 0, 3, -1, 0, 0); Actor_Set_Goal_Number(kActorLucy, 311); } //return false; }
int main(void){ //PLL_Init(); //16MHZ bus clock //when PLL is on, nothing works HeartBeat_Init(); //SysTick_Init(); PolledButtons_Init(); // initialize interrupts and ports DAC_Init(1024); // initialize with command: Vout = Vref // DAC_Init(0x1000); // initialize with command: Vout = Vref //Timer0A_Init(dt[0]); Board_Init(); //Initalize the On Board Switches Switch_Init2(); //i used the board switches because our switches were doing the thing //where they worked for a bit then they stopped working again lenPush = 1; int instrument = 0; while(1){ if(mode){ resetSwitches(); if (instrument == 0){ Music_Play(Wave[0], 32, strobePtr, 35); instrument += 1; } else if (instrument == 1){ Music_Play(Trumpet[0], 32, strobePtr, 35); instrument += 1; } else if (instrument == 2){ Music_Play(Flute[0], 32, strobePtr, 35); instrument = 0; } } else if(play){ resetSwitches(); if (instrument == 0){ Music_Play(Wave[0], 64, strobePtr, 35); } if (instrument == 1){ Music_Play(Trumpet[0], 32, strobePtr, 35); } if (instrument == 2){ Music_Play(Flute[0], 32, strobePtr, 35); } } } }
void ScriptNR08::SceneFrameAdvanced(int frame) { if (!Music_Is_Playing()) { sub_4021B4(); } Set_Fade_Color(0, 0, 0); if (frame >= 76 && frame < 91) { Set_Fade_Density((frame - 76) / 14.0f); Music_Stop(3); Ambient_Sounds_Play_Sound(566, 27, 0, 99, 0); } else if (frame >= 91 && frame < 120) { Actor_Set_Invisible(0, true); Set_Fade_Density(1.0f); } else if (frame >= 120 && frame < 135) { Set_Fade_Density((134 - frame) / 14.0f); Music_Play(7, 61, 0, 1, -1, 0, 0); } else { Actor_Set_Invisible(0, false); Set_Fade_Density(0.0f); } if (Game_Flag_Query(651) && !Game_Flag_Query(636)) { Game_Flag_Set(636); Scene_Exits_Disable(); Scene_Loop_Set_Default(1); Scene_Loop_Start_Special(2, 3, 1); } if (frame == 95) { Actor_Put_In_Set(3, 91); Actor_Set_At_Waypoint(3, 33, 0); Actor_Change_Animation_Mode(3, 0); Actor_Set_Goal_Number(3, 200); Scene_Exit_Add_2D_Exit(1, 0, 309, 30, 398, 3); Scene_Exit_Add_2D_Exit(2, 520, 330, 556, 386, 0); } if (frame == 130) { Scene_Exits_Enable(); } //return false; }
/** * Handle clicks on the Mentat widget. * @return True, always. */ bool GUI_Widget_Mentat_Click(Widget *w) { VARIABLE_NOT_USED(w); g_cursorSpriteID = 0; Sprites_SetMouseSprite(0, 0, g_sprites[0]); Sound_Output_Feedback(0xFFFE); Driver_Voice_Play(NULL, 0xFF); Music_Play(g_table_houseInfo[g_playerHouseID].musicBriefing); Sprites_UnloadTiles(); Timer_SetTimer(TIMER_GAME, false); AsyncGUI_Mentat_ShowHelpList(false); Async_InvokeAfterAsync(GUI_Widget_Mentat_Click_Close); return true; }
bool ScriptDR05::ClickedOnItem(int itemId, bool a2) { if (itemId == 78) { if (Player_Query_Combat_Mode()) { Game_Flag_Set(271); Actor_Set_Goal_Number(35, 30); } else if (!Game_Flag_Query(272) && !Loop_Actor_Walk_To_Item(0, 78, 24, 1, true) && Actor_Query_Goal_Number(35) != 11) { if (!Actor_Query_Goal_Number(35)) { Actor_Says_With_Pause(0, 1015, 0.1f, 12); Actor_Says(35, 70, 13); } Actor_Set_Goal_Number(35, 30); } //return true; //bug? } if (itemId == 122 && Player_Query_Combat_Mode() && !Actor_Query_Goal_Number(35)) { Overlay_Play("DR05OVER", 1, 0, 1, 0); Item_Remove_From_World(122); Game_Flag_Set(270); Actor_Set_Goal_Number(35, 10); Music_Play(18, 71, 0, 0, -1, 0, 2); return true; } return false; }
void ScriptMA04::PlayerWalkedIn() { if (Game_Flag_Query(647)) { Player_Gains_Control(); } if (sub_402820() || sub_402758()) { Overlay_Play("MA04OVER", 0, 1, 0, 0); } if (Game_Flag_Query(647)) { Loop_Actor_Walk_To_XYZ(0, -7139.0f, 954.0f, 1746.0f, 0, 1, false, 0); } else if (Game_Flag_Query(35)) { Loop_Actor_Walk_To_XYZ(0, -7143.0f, 954.0f, 1868.0f, 0, 1, false, 0); } Game_Flag_Reset(35); Game_Flag_Reset(63); Game_Flag_Reset(647); if (Game_Flag_Query(61)) { if (Global_Variable_Query(1) == 2 && !Actor_Clue_Query(0, 43)) { Sound_Play(403, 100, 0, 0, 50); Loop_Actor_Walk_To_XYZ(0, -7176.0f, 954.0f, 1806.0f, 0, 0, false, 0); Actor_Face_Heading(0, 256, true); Actor_Says(0, 2680, 0); Sound_Play(123, 100, 0, 0, 50); Delay(500); Actor_Says(4, 0, 3); Actor_Says(0, 2685, 13); Actor_Says(4, 10, 3); Actor_Says(0, 2690, 17); Actor_Says(4, 30, 3); Actor_Says(0, 2695, 12); Actor_Says(4, 40, 3); Actor_Says(4, 50, 3); Actor_Says(0, 2700, 3); Actor_Says(4, 60, 3); Actor_Says(4, 70, 3); Sound_Play(123, 100, 0, 0, 50); Actor_Clue_Acquire(0, 43, 1, 4); Spinner_Set_Selectable_Destination_Flag(5, 1); Game_Flag_Set(186); if (!Game_Flag_Query(163)) { Game_Flag_Set(163); Item_Remove_From_World(66); } Actor_Set_Goal_Number(23, 99); Actor_Put_In_Set(23, 93); Actor_Set_At_Waypoint(23, 35, 0); Autosave_Game(0); } //return false; return; } if ((Game_Flag_Query(40) || Game_Flag_Query(41)) && !Game_Flag_Query(146)) { Music_Play(2, 52, 0, 2, -1, 0, 0); Player_Loses_Control(); Loop_Actor_Walk_To_XYZ(0, -7199.0f, 955.0f, 1677.0f, 0, 1, false, 0); if (sub_402820() || sub_402758()) { Overlay_Remove("MA04OVER"); } Loop_Actor_Walk_To_XYZ(0, -7199.0f, 955.0f, 1675.0f, 0, 1, false, 0); Game_Flag_Set(146); Async_Actor_Walk_To_XYZ(0, -7204.0f, 956.17f, 1568.0f, 0, false); Set_Enter(51, 51); } }
bool ScriptMA04::ClickedOn2DRegion(int region) { if (Player_Query_Combat_Mode()) { return false; } if (region == 1) { sub_403DA8(); return true; } if (region == 0) { if (!Loop_Actor_Walk_To_XYZ(0, -7176.0f, 954.0f, 1806.0f, 0, 1, false, 0)) { Actor_Face_Heading(0, 256, false); if (sub_402758()) { Actor_Says(0, 2680, 0); Ambient_Sounds_Remove_Sound(403, true); Sound_Play(123, 100, 0, 0, 50); Overlay_Remove("MA04OVER"); Delay(500); if (Game_Flag_Query(653)) { if (Global_Variable_Query(45) == 2) { sub_4028A8(); } else if (Global_Variable_Query(45) == 3) { sub_402F2C(); } else { sub_4034D8(); } } else { sub_4032A0(); } Music_Play(2, 52, 0, 3, -1, 0, 0); return false; } if (Actor_Clue_Query(5, 222) && !Game_Flag_Query(649)) { Sound_Play(123, 100, 0, 0, 50); Overlay_Remove("MA04OVER"); Delay(500); Actor_Says(5, 310, 3); Actor_Says(5, 320, 3); if (!Game_Flag_Query(378) && Global_Variable_Query(1) < 3) { Actor_Voice_Over(1300, 99); Actor_Voice_Over(1310, 99); Actor_Voice_Over(1320, 99); } Actor_Says(0, 2445, 13); Sound_Play(123, 100, 0, 0, 50); Game_Flag_Set(649); return true; } if (Actor_Clue_Query(6, 215) && !Game_Flag_Query(650)) { Sound_Play(123, 100, 0, 0, 50); Overlay_Remove("MA04OVER"); Delay(500); Actor_Says(6, 500, 3); Actor_Says(6, 510, 3); if (!Game_Flag_Query(378) && Global_Variable_Query(1) < 3) { Actor_Voice_Over(1330, 99); Actor_Voice_Over(1340, 99); Actor_Voice_Over(1350, 99); } Actor_Says(0, 2445, 13); Sound_Play(123, 100, 0, 0, 50); Game_Flag_Set(650); return true; } Actor_Says(0, 2670, 13); if (!Game_Flag_Query(378)) { Actor_Says(0, 2675, 17); } } return true; } return false; }
/** * Main game loop. */ static void GameLoop_Main(void) { static uint32 l_timerNext = 0; static uint32 l_timerUnitStatus = 0; static int16 l_selectionState = -2; uint16 key; String_Init(); Sprites_Init(); Input_Flags_SetBits(INPUT_FLAG_KEY_REPEAT | INPUT_FLAG_UNKNOWN_0010 | INPUT_FLAG_UNKNOWN_0200 | INPUT_FLAG_UNKNOWN_2000); Input_Flags_ClearBits(INPUT_FLAG_KEY_RELEASE | INPUT_FLAG_UNKNOWN_0400 | INPUT_FLAG_UNKNOWN_0100 | INPUT_FLAG_UNKNOWN_0080 | INPUT_FLAG_UNKNOWN_0040 | INPUT_FLAG_UNKNOWN_0020 | INPUT_FLAG_UNKNOWN_0008 | INPUT_FLAG_UNKNOWN_0004 | INPUT_FLAG_NO_TRANSLATE); Timer_SetTimer(TIMER_GAME, true); Timer_SetTimer(TIMER_GUI, true); g_campaignID = 0; g_scenarioID = 1; g_playerHouseID = HOUSE_INVALID; g_debugScenario = false; g_selectionType = SELECTIONTYPE_MENTAT; g_selectionTypeNew = SELECTIONTYPE_MENTAT; g_palette1 = calloc(1, 256 * 3); g_palette2 = calloc(1, 256 * 3); g_readBufferSize = 12000; g_readBuffer = calloc(1, g_readBufferSize); ReadProfileIni("PROFILE.INI"); free(g_readBuffer); g_readBuffer = NULL; File_ReadBlockFile("IBM.PAL", g_palette_998A, 256 * 3); memmove(g_palette1, g_palette_998A, 256 * 3); GUI_ClearScreen(SCREEN_0); Video_SetPalette(g_palette1, 0, 256); GFX_SetPalette(g_palette1); GFX_SetPalette(g_palette2); g_paletteMapping1 = malloc(256); g_paletteMapping2 = malloc(256); GUI_Palette_CreateMapping(g_palette1, g_paletteMapping1, 0xC, 0x55); g_paletteMapping1[0xFF] = 0xFF; g_paletteMapping1[0xDF] = 0xDF; g_paletteMapping1[0xEF] = 0xEF; GUI_Palette_CreateMapping(g_palette1, g_paletteMapping2, 0xF, 0x55); g_paletteMapping2[0xFF] = 0xFF; g_paletteMapping2[0xDF] = 0xDF; g_paletteMapping2[0xEF] = 0xEF; Script_LoadFromFile("TEAM.EMC", g_scriptTeam, g_scriptFunctionsTeam, NULL); Script_LoadFromFile("BUILD.EMC", g_scriptStructure, g_scriptFunctionsStructure, NULL); GUI_Palette_CreateRemap(HOUSE_MERCENARY); g_cursorSpriteID = 0; Sprites_SetMouseSprite(0, 0, g_sprites[0]); while (g_mouseHiddenDepth > 1) { GUI_Mouse_Show_Safe(); } Window_WidgetClick_Create(); GameOptions_Load(); Unit_Init(); Team_Init(); House_Init(); Structure_Init(); GUI_Mouse_Show_Safe(); if (g_debugSkipDialogs) { Music_Play(0); free(g_readBuffer); g_readBufferSize = (g_enableVoices == 0) ? 12000 : 20000; g_readBuffer = calloc(1, g_readBufferSize); g_gameMode = GM_NORMAL; } for (;; sleepIdle()) { if (g_gameMode == GM_MENU) { GameLoop_GameIntroAnimationMenu(); if (!g_running) break; if (g_gameMode == GM_MENU) continue; GUI_Mouse_Hide_Safe(); g_canSkipIntro = false; GUI_DrawFilledRectangle(g_curWidgetXBase << 3, g_curWidgetYBase, (g_curWidgetXBase + g_curWidgetWidth) << 3, g_curWidgetYBase + g_curWidgetHeight, 12); Input_History_Clear(); if (s_enableLog != 0) Mouse_SetMouseMode((uint8)s_enableLog, "DUNE.LOG"); GFX_SetPalette(g_palette1); GUI_Mouse_Show_Safe(); } if (g_gameMode == GM_PICKHOUSE) { Music_Play(28); g_playerHouseID = HOUSE_MERCENARY; g_playerHouseID = GUI_PickHouse(); GUI_Mouse_Hide_Safe(); GFX_ClearBlock(SCREEN_0); Sprites_LoadTiles(); GUI_Palette_CreateRemap(g_playerHouseID); Voice_LoadVoices(g_playerHouseID); GUI_Mouse_Show_Safe(); g_gameMode = GM_RESTART; g_scenarioID = 1; g_campaignID = 0; g_strategicRegionBits = 0; } if (g_selectionTypeNew != g_selectionType) { GUI_ChangeSelectionType(g_selectionTypeNew); } GUI_PaletteAnimate(); if (g_gameMode == GM_RESTART) { GUI_ChangeSelectionType(SELECTIONTYPE_MENTAT); Game_LoadScenario(g_playerHouseID, g_scenarioID); if (!g_debugScenario && !g_debugSkipDialogs) GUI_Mentat_ShowBriefing(); g_gameMode = GM_NORMAL; GUI_ChangeSelectionType(g_debugScenario ? SELECTIONTYPE_DEBUG : SELECTIONTYPE_STRUCTURE); Music_Play(Tools_RandomLCG_Range(0, 8) + 8); l_timerNext = g_timerGUI + 300; } if (l_selectionState != g_selectionState) { Map_SetSelectionObjectPosition(0xFFFF); Map_SetSelectionObjectPosition(g_selectionRectanglePosition); l_selectionState = g_selectionState; } if (!Driver_Voice_IsPlaying() && !Sound_StartSpeech()) { if (g_gameConfig.music == 0) { Music_Play(2); g_musicInBattle = 0; } else if (g_musicInBattle > 0) { Music_Play(Tools_RandomLCG_Range(0, 5) + 17); l_timerNext = g_timerGUI + 300; g_musicInBattle = -1; } else { g_musicInBattle = 0; if (g_enableSoundMusic != 0 && g_timerGUI > l_timerNext) { if (!Driver_Music_IsPlaying()) { Music_Play(Tools_RandomLCG_Range(0, 8) + 8); l_timerNext = g_timerGUI + 300; } } } } GFX_Screen_SetActive(SCREEN_0); key = GUI_Widget_HandleEvents(g_widgetLinkedListHead); if (g_selectionType == SELECTIONTYPE_TARGET || g_selectionType == SELECTIONTYPE_PLACE || g_selectionType == SELECTIONTYPE_UNIT || g_selectionType == SELECTIONTYPE_STRUCTURE) { if (g_unitSelected != NULL) { if (l_timerUnitStatus < g_timerGame) { Unit_DisplayStatusText(g_unitSelected); l_timerUnitStatus = g_timerGame + 300; } if (g_selectionType != SELECTIONTYPE_TARGET) { g_selectionPosition = Tile_PackTile(Tile_Center(g_unitSelected->o.position)); } } GUI_Widget_ActionPanel_Draw(false); InGame_Numpad_Move(key); GUI_DrawCredits(g_playerHouseID, 0); GameLoop_Team(); GameLoop_Unit(); GameLoop_Structure(); GameLoop_House(); GUI_DrawScreen(SCREEN_0); } GUI_DisplayText(NULL, 0); if (g_running && !g_debugScenario) { GameLoop_LevelEnd(); } if (!g_running) break; } GUI_Mouse_Hide_Safe(); if (s_enableLog != 0) Mouse_SetMouseMode(INPUT_MOUSE_MODE_NORMAL, "DUNE.LOG"); GUI_Mouse_Hide_Safe(); Widget_SetCurrentWidget(0); GFX_Screen_SetActive(SCREEN_1); GFX_ClearScreen(); GUI_Screen_FadeIn(g_curWidgetXBase, g_curWidgetYBase, g_curWidgetXBase, g_curWidgetYBase, g_curWidgetWidth, g_curWidgetHeight, SCREEN_1, SCREEN_0); }
/** * Intro menu. */ static void GameLoop_GameIntroAnimationMenu(void) { static const uint16 mainMenuStrings[][6] = { {STR_PLAY_A_GAME, STR_REPLAY_INTRODUCTION, STR_EXIT_GAME, STR_NULL, STR_NULL, STR_NULL}, /* Neither HOF nor save. */ {STR_PLAY_A_GAME, STR_REPLAY_INTRODUCTION, STR_LOAD_GAME, STR_EXIT_GAME, STR_NULL, STR_NULL}, /* Has a save game. */ {STR_PLAY_A_GAME, STR_REPLAY_INTRODUCTION, STR_EXIT_GAME, STR_HALL_OF_FAME, STR_NULL, STR_NULL}, /* Has a HOF. */ {STR_PLAY_A_GAME, STR_REPLAY_INTRODUCTION, STR_LOAD_GAME, STR_EXIT_GAME, STR_HALL_OF_FAME, STR_NULL} /* Has a HOF and a save game. */ }; bool loadGame = false; static bool drawMenu = true; static uint16 stringID = STR_REPLAY_INTRODUCTION; uint16 maxWidth; static bool hasSave = false; static bool hasFame = false; static const char *strings[6]; static uint16 index = 0xFFFF; if (index == 0xFFFF) { hasSave = File_Exists("_save000.dat"); hasFame = File_Exists("SAVEFAME.DAT"); index = (hasFame ? 2 : 0) + (hasSave ? 1 : 0); } if (hasSave || File_Exists("ONETIME.DAT")) g_canSkipIntro = true; switch (stringID) { case STR_REPLAY_INTRODUCTION: Music_Play(0); free(g_readBuffer); g_readBufferSize = (g_enableVoices == 0) ? 12000 : 28000; g_readBuffer = calloc(1, g_readBufferSize); GUI_Mouse_Hide_Safe(); Driver_Music_FadeOut(); GameLoop_GameIntroAnimation(); Sound_Output_Feedback(0xFFFE); File_ReadBlockFile("IBM.PAL", g_palette_998A, 256 * 3); memmove(g_palette1, g_palette_998A, 256 * 3); if (!g_canSkipIntro) { File_Create("ONETIME.DAT"); g_canSkipIntro = true; } Music_Play(0); free(g_readBuffer); g_readBufferSize = (g_enableVoices == 0) ? 12000 : 20000; g_readBuffer = calloc(1, g_readBufferSize); GUI_Mouse_Show_Safe(); Music_Play(28); drawMenu = true; break; case STR_EXIT_GAME: g_running = false; return; case STR_HALL_OF_FAME: GUI_HallOfFame_Show(0xFFFF); GFX_SetPalette(g_palette2); hasFame = File_Exists("SAVEFAME.DAT"); drawMenu = true; break; case STR_LOAD_GAME: GUI_Mouse_Hide_Safe(); GUI_SetPaletteAnimated(g_palette2, 30); GUI_ClearScreen(SCREEN_0); GUI_Mouse_Show_Safe(); GFX_SetPalette(g_palette1); if (GUI_Widget_SaveLoad_Click(false)) { loadGame = true; if (g_gameMode == GM_RESTART) break; g_gameMode = GM_NORMAL; } else { GFX_SetPalette(g_palette2); drawMenu = true; } break; default: break; } if (drawMenu) { uint16 i; g_widgetProperties[21].height = 0; for (i = 0; i < 6; i++) { strings[i] = NULL; if (mainMenuStrings[index][i] == 0) { if (g_widgetProperties[21].height == 0) g_widgetProperties[21].height = i; continue; } strings[i] = String_Get_ByIndex(mainMenuStrings[index][i]); } GUI_DrawText_Wrapper(NULL, 0, 0, 0, 0, 0x22); maxWidth = 0; for (i = 0; i < g_widgetProperties[21].height; i++) { if (Font_GetStringWidth(strings[i]) <= maxWidth) continue; maxWidth = Font_GetStringWidth(strings[i]); } maxWidth += 7; g_widgetProperties[21].width = maxWidth >> 3; g_widgetProperties[13].width = g_widgetProperties[21].width + 2; g_widgetProperties[13].xBase = 19 - (maxWidth >> 4); g_widgetProperties[13].yBase = 160 - ((g_widgetProperties[21].height * g_fontCurrent->height) >> 1); g_widgetProperties[13].height = (g_widgetProperties[21].height * g_fontCurrent->height) + 11; Sprites_LoadImage(String_GenerateFilename("TITLE"), SCREEN_1, NULL); GUI_Mouse_Hide_Safe(); GUI_ClearScreen(SCREEN_0); GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, SCREEN_HEIGHT, SCREEN_1, SCREEN_0); GUI_SetPaletteAnimated(g_palette1, 30); GUI_DrawText_Wrapper("V1.07", 319, 192, 133, 0, 0x231, 0x39); GUI_DrawText_Wrapper(NULL, 0, 0, 0, 0, 0x22); Widget_SetCurrentWidget(13); GUI_Widget_DrawBorder(13, 2, 1); GameLoop_DrawMenu(strings); GUI_Mouse_Show_Safe(); drawMenu = false; } if (loadGame) return; stringID = GameLoop_HandleEvents(strings); if (stringID != 0xFFFF) stringID = mainMenuStrings[index][stringID]; GUI_PaletteAnimate(); if (stringID == STR_PLAY_A_GAME) g_gameMode = GM_PICKHOUSE; }
/** * Checks if the level comes to an end. If so, it shows all end-level stuff, * and prepares for the next level. */ static void GameLoop_LevelEnd(void) { static uint32 levelEndTimer = 0; if (levelEndTimer >= g_timerGame && !s_debugForceWin) return; if (GameLoop_IsLevelFinished()) { Music_Play(0); g_cursorSpriteID = 0; Sprites_SetMouseSprite(0, 0, g_sprites[0]); Sound_Output_Feedback(0xFFFE); GUI_ChangeSelectionType(SELECTIONTYPE_MENTAT); if (GameLoop_IsLevelWon()) { Sound_Output_Feedback(40); GUI_DisplayModalMessage(String_Get_ByIndex(STR_YOU_HAVE_SUCCESSFULLY_COMPLETED_YOUR_MISSION), 0xFFFF); GUI_Mentat_ShowWin(); Sprites_UnloadTiles(); g_campaignID++; GUI_EndStats_Show(g_scenario.killedAllied, g_scenario.killedEnemy, g_scenario.destroyedAllied, g_scenario.destroyedEnemy, g_scenario.harvestedAllied, g_scenario.harvestedEnemy, g_scenario.score, g_playerHouseID); if (g_campaignID == 9) { GUI_Mouse_Hide_Safe(); GUI_SetPaletteAnimated(g_palette2, 15); GUI_ClearScreen(SCREEN_0); GameLoop_GameEndAnimation(); PrepareEnd(); exit(0); } GUI_Mouse_Hide_Safe(); GameLoop_LevelEndAnimation(); GUI_Mouse_Show_Safe(); File_ReadBlockFile("IBM.PAL", g_palette1, 256 * 3); g_scenarioID = GUI_StrategicMap_Show(g_campaignID, true); GUI_SetPaletteAnimated(g_palette2, 15); if (g_campaignID == 1 || g_campaignID == 7) { if (!GUI_Security_Show()) { PrepareEnd(); exit(0); } } } else { Sound_Output_Feedback(41); GUI_DisplayModalMessage(String_Get_ByIndex(STR_YOU_HAVE_FAILED_YOUR_MISSION), 0xFFFF); GUI_Mentat_ShowLose(); Sprites_UnloadTiles(); g_scenarioID = GUI_StrategicMap_Show(g_campaignID, false); } g_playerHouse->flags.doneFullScaleAttack = false; Sprites_LoadTiles(); g_gameMode = GM_RESTART; s_debugForceWin = false; } levelEndTimer = g_timerGame + 300; }