1 //**************************************************************************
3 //** ## ## ## ## ## #### #### ### ###
4 //** ## ## ## ## ## ## ## ## ## ## #### ####
5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ##
6 //** ## ## ######## ## ## ## ## ## ## ## ### ##
7 //** ### ## ## ### ## ## ## ## ## ##
8 //** # ## ## # #### #### ## ##
10 //** Copyright (C) 1999-2006 Jānis Legzdiņš
11 //** Copyright (C) 2018-2023 Ketmar Dark
13 //** This program is free software: you can redistribute it and/or modify
14 //** it under the terms of the GNU General Public License as published by
15 //** the Free Software Foundation, version 3 of the License ONLY.
17 //** This program is distributed in the hope that it will be useful,
18 //** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 //** GNU General Public License for more details.
22 //** You should have received a copy of the GNU General Public License
23 //** along with this program. If not, see <http://www.gnu.org/licenses/>.
25 //**************************************************************************
26 class IntermissionScreen : Widget;
35 ClientGameBase ClGame;
40 // specifies current state
49 //==========================================================================
53 //==========================================================================
57 StopAllSounds(keepLastSwitch:true);
58 if (!ClGame.deathmatch && !ClGame.cl.Level.bNoIntermission)
60 print("Intermission stats are not yet implemented");
62 if (!ClGame.deathmatch)
68 CmdBuf_AddText("TeleportNewMap\n");
72 //==========================================================================
76 //==========================================================================
78 override void Tick(float DeltaTime)
80 intertime += DeltaTime;
81 if (ClGame.bSkipIntermission || intertime > HubCount)
83 CmdBuf_AddText("TeleportNewMap\n");
84 interstate = IMS_Done;
85 ClGame.bSkipIntermission = false;
89 //==========================================================================
93 //==========================================================================
95 override void OnDraw()
97 if (interstate == IMS_Done)
109 //========================================================================
113 // Initialises the stats for single player mode
115 //========================================================================
117 void IM_InitHubText()
119 IntermissionText *itext =
120 ClGame.intermissionPhase == ClientGame::IM_Phase.Leave ? cast([unsafe])(&ClGame.im.LeaveText) :
121 ClGame.intermissionPhase == ClientGame::IM_Phase.Enter ? cast([unsafe])(&ClGame.im.EnterText) :
126 CmdBuf_AddText("TeleportNewMap\n");
127 interstate = IMS_Done;
131 if (itext.bTextIsLump)
133 HubText = LoadTextLump(name(itext.Text));
137 HubText = itext.Text;
139 HubCount = float(strlenutf8(HubText)) * TextSpeed + TextWait;
145 TextPic = R_RegisterPic(itext.TextPic);
147 else if (itext.TextFlat)
149 TextFlat = itext.TextFlat;
154 CmdBuf_AddText(va("music looprandom \"%q\"\n", itext.TextMusic));
158 CmdBuf_AddText("music looprandom d_intro\n");
160 interstate = IMS_Text;
163 //===========================================================================
167 //===========================================================================
169 void IM_DrawHubText()
173 DrawFullScreenPic(TextPic);
177 FillRectWithFlatRepeat(0, 0, 640, 480, TextFlat);
181 R_FillRect(0, 0, 640, 480, 0);
183 int count = int((intertime - 0.3) / TextSpeed);
184 count = clamp(count, 0, strlenutf8(HubText));
185 SetFont('smallfont');
186 SetTextAlign(hleft, vtop);
187 DrawText(170, 145, substrutf8(HubText, 0, count));
190 //==========================================================================
192 // OnVisibilityChanged
194 //==========================================================================
196 override void OnVisibilityChanged(bool bNewVisibility)
198 bTickEnabled = bNewVisibility;
199 if (bNewVisibility) SetFullScaledSize(Width, Height);