1//************************************************************************** 2//** 3//** ## ## ## ## ## #### #### ### ### 4//** ## ## ## ## ## ## ## ## ## ## #### #### 5//** ## ## ## ## ## ## ## ## ## ## ## ## ## ## 6//** ## ## ######## ## ## ## ## ## ## ## ### ## 7//** ### ## ## ### ## ## ## ## ## ## 8//** # ## ## # #### #### ## ## 9//** 10//** $Id: TitleScreen.vc 4082 2009-10-22 11:48:22Z dj_jl $ 11//** 12//** Copyright (C) 1999-2006 Jānis Legzdiņš 13//** 14//** This program is free software; you can redistribute it and/or 15//** modify it under the terms of the GNU General Public License 16//** as published by the Free Software Foundation; either version 2 17//** of the License, or (at your option) any later version. 18//** 19//** This program is distributed in the hope that it will be useful, 20//** but WITHOUT ANY WARRANTY; without even the implied warranty of 21//** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22//** GNU General Public License for more details. 23//** 24//************************************************************************** 25 26class TitleScreen : Widget; 27 28ClientGameBase ClGame; 29 30// demo loop control 31int demosequence; 32 33float pagetime; 34int page_pic; 35 36//========================================================================== 37// 38// AdvanceDemo 39// 40// This cycles through the demo sequences. 41// 42//========================================================================== 43 44void AdvanceDemo() 45{ 46 if (StartTitleMap()) 47 { 48 return; 49 } 50 51 demosequence++; 52 demosequence %= 10; 53 54 switch (demosequence) 55 { 56 case 0: 57 pagetime = 12.0; 58 page_pic = R_RegisterPic('titlepic'); 59 CmdBuf_AddText("music play d_logo"); 60 break; 61 62 case 1: 63 pagetime = 5.0; 64 page_pic = R_RegisterPic('rgelogo'); 65 LocalSound('crusader/active'); 66 break; 67 68 case 2: 69 pagetime = 7.0; 70 page_pic = R_RegisterPic('panel1'); 71 CmdBuf_AddText("music play d_intro"); 72 LocalSound('svox/pro1'); 73 break; 74 75 case 3: 76 pagetime = 9.0; 77 page_pic = R_RegisterPic('panel2'); 78 LocalSound('svox/pro2'); 79 break; 80 81 case 4: 82 pagetime = 12.0; 83 page_pic = R_RegisterPic('panel3'); 84 LocalSound('svox/pro3'); 85 break; 86 87 case 5: 88 pagetime = 11.0; 89 page_pic = R_RegisterPic('panel4'); 90 LocalSound('svox/pro4'); 91 break; 92 93 case 6: 94 pagetime = 10.0; 95 page_pic = R_RegisterPic('panel5'); 96 LocalSound('svox/pro5'); 97 break; 98 99 case 7: 100 pagetime = 16.0; 101 page_pic = R_RegisterPic('panel6'); 102 LocalSound('svox/pro6'); 103 break; 104 105 case 8: 106 CmdBuf_AddText("PlayDemo demo1\n"); 107 break; 108 109 case 9: 110 pagetime = 6.0; 111 page_pic = R_RegisterPic('credit'); 112 break; 113 } 114} 115 116//========================================================================== 117// 118// ForceTitle 119// 120//========================================================================== 121 122void ForceTitle() 123{ 124 pagetime = 11.0; 125 page_pic = R_RegisterPic('titlepic'); 126} 127 128//========================================================================== 129// 130// OnVisibilityChanged 131// 132//========================================================================== 133 134void OnVisibilityChanged(bool bNewVisibility) 135{ 136 bTickEnabled = bNewVisibility; 137} 138 139//========================================================================== 140// 141// Tick 142// 143//========================================================================== 144 145void Tick(float DeltaTime) 146{ 147 pagetime -= DeltaTime; 148 if (demosequence == -1 || (/*!ClGame.MenuActive() &&*/ pagetime < 0.0)) 149 { 150 AdvanceDemo(); 151 } 152} 153 154//========================================================================== 155// 156// OnDraw 157// 158//========================================================================== 159 160void OnDraw() 161{ 162 DrawFullScreenPic(page_pic); 163} 164 165//========================================================================== 166// 167// OnHostEndGame 168// 169//========================================================================== 170 171void OnHostEndGame() 172{ 173 if (demosequence != -1) 174 AdvanceDemo(); 175 ForceTitle(); 176} 177 178//========================================================================== 179// 180// OnHostError 181// 182//========================================================================== 183 184void OnHostError() 185{ 186 demosequence = -1; 187 ForceTitle(); 188} 189 190//========================================================================== 191// 192// StopDemoLoop 193// 194//========================================================================== 195 196void StopDemoLoop() 197{ 198 demosequence = -1; // not in the demo loop now 199} 200 201defaultproperties 202{ 203 bTickEnabled = true; 204 Focusable = true; 205 Width = 320; 206 Height = 200; 207 demosequence = -1; // -1 = don't play demos 208} 209