Debian Codegraph @

src/level/level.cpp

raw symbols SCIP
1
2 /**
3 *
4 * @file level.cpp
5 *
6 * Part of the OpenJazz project
7 *
8 * @par History:
9 * - 23rd August 2005: Created level.c
10 * - 3rd February 2009: Renamed level.c to level.cpp
11 * - 19th July 2009: Created levelframe.cpp from parts of level.cpp
12 * - 19th July 2009: Added parts of levelload.cpp to level.cpp
13 * - 30th March 2010: Created baselevel.cpp from parts of level.cpp and
14 * levelframe.cpp
15 * - 1st August 2012: Renamed baselevel.cpp to level.cpp
16 *
17 * @par Licence:
18 * Copyright (c) 2005-2017 AJ Thomson
19 * Copyright (c) 2015-2026 Carsten Teibes
20 *
21 * OpenJazz is distributed under the terms of
22 * the GNU General Public License, version 2.0
23 *
24 * @par Description:
25 * Deals with functionality common to ordinary levels and bonus levels.
26 *
27 */
28
29
30 #include "level.h"cxx . . $ `<file>/src/level/level.h`/
31
32 #include "game/game.h"cxx . . $ `<file>/src/game/game.h`/
33 #include "io/controls.h"cxx . . $ `<file>/src/io/controls.h`/
34 #include "io/gfx/font.h"cxx . . $ `<file>/src/io/gfx/font.h`/
35 #include "io/gfx/sprite.h"cxx . . $ `<file>/src/io/gfx/sprite.h`/
36 #include "io/gfx/video.h"cxx . . $ `<file>/src/io/gfx/video.h`/
37 #include "io/sound.h"cxx . . $ `<file>/src/io/sound.h`/
38 #include "player/player.h"cxx . . $ `<file>/src/player/player.h`/
39 #include "jj1/scene/jj1scene.h"cxx . . $ `<file>/src/jj1/scene/jj1scene.h`/
40 #include "loop.h"cxx . . $ `<file>/src/loop.h`/
41 #include "setup.h"cxx . . $ `<file>/src/setup.h`/
42
43
44 /**
45 * Create a new base level
46 */
47 Levelcxx . . $ Level#::Levelcxx . . $ Level#Level(920e21dac2e7a81). (Gamecxx . . $ Game#* owner) {
48
49 gamecxx . . $ Level#game. = owner;
50
51 menuOptionscxx . . $ Level#menuOptions.[0] = "continue game";
52 menuOptionscxx . . $ Level#menuOptions.[1] = "save game";
53 menuOptionscxx . . $ Level#menuOptions.[2] = "load game";
54 menuOptionscxx . . $ Level#menuOptions.[3] = "setup options";
55 menuOptionscxx . . $ Level#menuOptions.[4] = "quit game";
56
57 // Arbitrary initial value
58 smoothfpscxx . . $ Level#smoothfps. = 50.0f;
59 paletteEffectscxx . . $ Level#paletteEffects. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
60 pausedcxx . . $ Level#paused. = false;
61
62 // Set the level stage
63 stagecxx . . $ Level#stage. = LS_NORMALcxx . . $ LS_NORMAL.;
64 spritescxx . . $ Level#sprites. = tickOffsetcxx . . $ Level#tickOffset. = stepscxx . . $ Level#steps. = prevTickscxx . . $ Level#prevTicks. = tickscxx . . $ Level#ticks. = endTimecxx . . $ Level#endTime. = itemscxx . . $ Level#items. = statscxx . . $ Level#stats. = 0;
65 multiplayercxx . . $ Level#multiplayer. = false;
66 }
67
68
69 /**
70 * Destroy base level
71 */
72 Levelcxx . . $ Level#::~cxx . . $ Level#`~Level`(49f6e7a06ebc5aa8).Levelcxx . . $ Level# () {
73
74 stopMusiccxx . . $ stopMusic(49f6e7a06ebc5aa8).();
75
76 if (paletteEffectscxx . . $ Level#paletteEffects.) delete paletteEffectscxx . . $ Level#paletteEffects.;
77
78 }
79
80
81 /**
82 * Set the players' initial values.
83 *
84 * @param levelType The type of level for which to create a level player
85 * @param anims New level player animations
86 * @param flippedAnims New level player flipped animations
87 * @param checkpoint Whether or not a checkpoint is in use
88 * @param x The level players' new grid x-coordinate
89 * @param y The level players' new grid y-coordinate
90 */
91 void Levelcxx . . $ Level#::createLevelPlayerscxx . . $ Level#createLevelPlayers(63f12801702f9d1b). (LevelTypecxx . . $ LevelType# levelType, Animcxx . . $ Anim#** anims,
92 Animcxx . . $ Anim#** flippedAnims, bool checkpoint, unsigned char x, unsigned char y) {
93
94 int count;
95
96 if (!checkpoint) gamecxx . . $ Level#game.->setCheckpointcxx . . $ Game#setCheckpoint(3e454b8ccf442868).(x, y);
97
98 for (count = 0; count < nPlayerscxx . . $ nPlayers.; count++) {
99
100 playerscxx . . $ players.[count].createLevelPlayercxx . . $ Player#createLevelPlayer(27ab3ccb3efab72).(levelType, anims, flippedAnims, x, y);
101 gamecxx . . $ Level#game.->resetPlayercxx . . $ Game#resetPlayer(34e2c302b1f0e5dd).(playerscxx . . $ players. + count);
102
103 }
104
105 }
106
107
108 /**
109 * Play a cutscene.
110 *
111 * @param file File name of the cutscene to be played
112 *
113 * @return Error code
114 */
115 int Levelcxx . . $ Level#::playScenecxx . . $ Level#playScene(5c4306d8553b3696). (const char* file) {
116
117 JJ1Scenecxx . . $ JJ1Scene#* scene;
118 int ret;
119
120 delete paletteEffectscxx . . $ Level#paletteEffects.;
121 paletteEffectscxx . . $ Level#paletteEffects. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
122
123 try {
124
125 scene = new JJ1Scenecxx . . $ JJ1Scene#(file);
126
127 } catch (int e) {
128
129 return e;
130
131 }
132
133 ret = scene->playcxx . . $ JJ1Scene#play(b126dc7c1de90089).();
134
135 delete scene;
136
137 return ret;
138
139 }
140
141
142 /**
143 * Perform timing calculations.
144 */
145 void Levelcxx . . $ Level#::timeCalcscxx . . $ Level#timeCalcs(49f6e7a06ebc5aa8). () {
146
147 // Calculate smoothed fps
148 smoothfpscxx . . $ Level#smoothfps. = smoothfpscxx . . $ Level#smoothfps. + 1.0f -
149 (smoothfpscxx . . $ Level#smoothfps. * ((float)(tickscxx . . $ Level#ticks. - prevTickscxx . . $ Level#prevTicks.)) / 1000.0f);
150 /* This equation is a simplified version of
151 (fps * c) + (smoothfps * (1 - c))
152 where c = (1 / fps)
153 and fps = 1000 / (ticks - prevTicks)
154 In other words, the response of smoothFPS to changes in FPS decreases as the
155 framerate increases
156 The following version is for c = (1 / smoothfps)
157 */
158 // smoothfps = (fps / smoothfps) + smoothfps - 1;
159
160 // Ignore outlandish values
161 if (smoothfpscxx . . $ Level#smoothfps. > 9999.0f) smoothfpscxx . . $ Level#smoothfps. = 9999.0f;
162 if (smoothfpscxx . . $ Level#smoothfps. < 1.0f) smoothfpscxx . . $ Level#smoothfps. = 1.0f;
163
164
165 // Track number of ticks of gameplay since the level started
166
167 if (pausedcxx . . $ Level#paused.) {
168
169 tickOffsetcxx . . $ Level#tickOffset. = globalTickscxx . . $ globalTicks. - tickscxx . . $ Level#ticks.;
170
171 } else if (globalTickscxx . . $ globalTicks. - tickOffsetcxx . . $ Level#tickOffset. > tickscxx . . $ Level#ticks. + 100) {
172
173 prevTickscxx . . $ Level#prevTicks. = tickscxx . . $ Level#ticks.;
174 tickscxx . . $ Level#ticks. += 100;
175
176 tickOffsetcxx . . $ Level#tickOffset. = globalTickscxx . . $ globalTicks. - tickscxx . . $ Level#ticks.;
177
178 } else {
179
180 prevTickscxx . . $ Level#prevTicks. = tickscxx . . $ Level#ticks.;
181 tickscxx . . $ Level#ticks. = globalTickscxx . . $ globalTicks. - tickOffsetcxx . . $ Level#tickOffset.;
182
183 }
184
185 }
186
187
188 /**
189 * Calculate the amount of time since the last completed step.
190 *
191 * @return Time since last step
192 */
193 int Levelcxx . . $ Level#::getTimeChangecxx . . $ Level#getTimeChange(b126dc7c1de90089). () {
194
195 return pausedcxx . . $ Level#paused.? 0: tickscxx . . $ Level#ticks. - ((stepscxx . . $ Level#steps. * (setupcxx . . $ setup..slowMotioncxx . . $ Setup#slowMotion.? 100: 50)) / 3);
196
197 }
198
199
200 /**
201 * Display menu (if visible) and statistics.
202 *
203 * @param bg Palette index of the box(es)
204 * @param menu Whether or not the level menu should be displayed
205 * @param option Selected menu uption
206 * @param textPalIndex The first palette index for unseleceted text
207 * @param selectedTextPalIndex The first palette index for selected text
208 * @param textPalSpan The number of palette indices for text
209 */
210 void Levelcxx . . $ Level#::drawOverlaycxx . . $ Level#drawOverlay(ac8280b982de25d7). (unsigned char bg, bool menu, int option,
211 unsigned char textPalIndex, unsigned char selectedTextPalIndex,
212 int textPalSpan) {
213
214 int count, width;
215
216 // Draw graphics statistics
217
218 if (statscxx . . $ Level#stats. & S_SCREENcxx . . $ S_SCREEN.) {
219 if (videocxx . . $ video..getScaleFactorcxx . . $ Video#getScaleFactor(455f465bc33b4cdf).() > MIN_SCALEcxx . . $ `src/io/gfx/video.h:41:9`!)
220 videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).(canvasWcxx . . $ canvasW. - 84, 11, 80, 37, bg);
221 else
222 videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).(canvasWcxx . . $ canvasW. - 84, 11, 80, 25, bg);
223
224 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(videocxx . . $ video..getWidthcxx . . $ Video#getWidth(455f465bc33b4cdf).(), canvasWcxx . . $ canvasW. - 52, 14);
225 panelBigFontcxx . . $ panelBigFont.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("x", canvasWcxx . . $ canvasW. - 48, 14);
226 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(videocxx . . $ video..getHeightcxx . . $ Video#getHeight(455f465bc33b4cdf).(), canvasWcxx . . $ canvasW. - 12, 14);
227 panelBigFontcxx . . $ panelBigFont.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("fps", canvasWcxx . . $ canvasW. - 76, 26);
228 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).((int)smoothfpscxx . . $ Level#smoothfps., canvasWcxx . . $ canvasW. - 12, 26);
229
230 if (videocxx . . $ video..getScaleFactorcxx . . $ Video#getScaleFactor(455f465bc33b4cdf).() > MIN_SCALEcxx . . $ `src/io/gfx/video.h:41:9`!) {
231 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(canvasWcxx . . $ canvasW., canvasWcxx . . $ canvasW. - 52, 38);
232 panelBigFontcxx . . $ panelBigFont.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).("x", canvasWcxx . . $ canvasW. - 48, 39);
233 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(canvasHcxx . . $ canvasH., canvasWcxx . . $ canvasW. - 12, 38);
234 }
235 }
236
237 // Draw player list
238
239 if (statscxx . . $ Level#stats. & S_PLAYERScxx . . $ S_PLAYERS.) {
240
241 width = 39;
242
243 for (count = 0; count < nPlayerscxx . . $ nPlayers.; count++)
244 if (panelBigFontcxx . . $ panelBigFont.->getStringWidthcxx . . $ Font#getStringWidth(5c4306d8553b3696).(playerscxx . . $ players.[count].getNamecxx . . $ Player#getName(41208ce6ca65dd58).()) > width)
245 width = panelBigFontcxx . . $ panelBigFont.->getStringWidthcxx . . $ Font#getStringWidth(5c4306d8553b3696).(playerscxx . . $ players.[count].getNamecxx . . $ Player#getName(41208ce6ca65dd58).());
246
247 videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).((canvasWcxx . . $ canvasW. >> 1) - 48, 11, width + 57, (nPlayerscxx . . $ nPlayers. * 12) + 1, bg);
248
249 for (count = 0; count < nPlayerscxx . . $ nPlayers.; count++) {
250
251 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(count + 1,
252 (canvasWcxx . . $ canvasW. >> 1) - 24, 14 + (count * 12));
253 panelBigFontcxx . . $ panelBigFont.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(playerscxx . . $ players.[count].getNamecxx . . $ Player#getName(41208ce6ca65dd58).(),
254 (canvasWcxx . . $ canvasW. >> 1) - 16, 14 + (count * 12));
255 panelBigFontcxx . . $ panelBigFont.->showNumbercxx . . $ Font#showNumber(b1146eedae1e1d0b).(playerscxx . . $ players.[count].teamScorecxx . . $ Player#teamScore.,
256 (canvasWcxx . . $ canvasW. >> 1) + width + 1, 14 + (count * 12));
257
258 }
259
260 }
261
262
263 if (menu) {
264
265 // Draw the menu
266
267 videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).((canvasWcxx . . $ canvasW. >> 1) - 72, (canvasHcxx . . $ canvasH. >> 1) - 54, 140, 92, bg);
268 videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).((canvasWcxx . . $ canvasW. >> 1) - 72, (canvasHcxx . . $ canvasH. >> 1) - 54, 140, 92, textPalIndex, false);
269
270
271 for (count = 0; count < 5; count++) {
272
273 // Gray out Save (unimplemented) FIXME: needs to be disabled generally in multiplayer
274
275 if (count == 1) {
276
277 videocxx . . $ video..drawRectcxx . . $ Video#drawRect(a4376a5627a47301).((canvasWcxx . . $ canvasW. >> 1) - 68, (canvasHcxx . . $ canvasH. >> 1) + (count << 4) - 48, 132, 15, textPalIndex);
278
279 }
280
281 if (count == option) fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, selectedTextPalIndex, textPalSpan);
282 else fontmn2cxx . . $ fontmn2.->mapPalettecxx . . $ Font#mapPalette(748afa4755bc9595).(240, 8, textPalIndex, textPalSpan);
283
284 fontmn2cxx . . $ fontmn2.->showStringcxx . . $ Font#showString(7e50a619d5a117f1).(menuOptionscxx . . $ Level#menuOptions.[count], (canvasWcxx . . $ canvasW. >> 1) - 64, (canvasHcxx . . $ canvasH. >> 1) + (count << 4) - 46);
285
286 }
287
288 fontmn2cxx . . $ fontmn2.->restorePalettecxx . . $ Font#restorePalette(49f6e7a06ebc5aa8).();
289
290 }
291
292 }
293
294
295 /**
296 * Process in-game menu selection.
297 *
298 * @param menu Whether or not the level menu should be displayed
299 * @param option Chosen menu option
300 *
301 * @return Error code
302 */
303 int Levelcxx . . $ Level#::selectcxx . . $ Level#select(2bf25c4362bca0f6). (bool& menu, int option) {
304
305 switch (option) {
306
307 case 0: // Continue
308
309 menu = false;
310
311 break;
312
313 case 1: // Save
314
315 if (!multiplayercxx . . $ Level#multiplayer.) {
316
317 int ret = fileMenucxx . . $ Level#fileMenu..maincxx . . $ FileMenu#main(9f1afb2e1f195c72).(true, false);
318 if (ret == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!;
319 if (ret >= 0) {
320 // TODO
321 }
322
323 // Restore level palette
324 videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(palettecxx . . $ Level#palette.);
325
326 }
327
328 break;
329
330 case 2: // Load
331
332 if (!multiplayercxx . . $ Level#multiplayer.) {
333
334 int ret = fileMenucxx . . $ Level#fileMenu..maincxx . . $ FileMenu#main(9f1afb2e1f195c72).(false, false);
335 if (ret == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!;
336 if (ret >= 0) {
337 return E_LOAD0cxx . . $ `src/OpenJazz.h:62:9`! + ret;
338 }
339
340 // Restore level palette
341 videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(palettecxx . . $ Level#palette.);
342
343 }
344
345 break;
346
347 case 3: // Setup
348
349 if (!multiplayercxx . . $ Level#multiplayer.) {
350
351 bool wasSlow = setupcxx . . $ setup..slowMotioncxx . . $ Setup#slowMotion.;
352
353 if (setupMenucxx . . $ Level#setupMenu..setupMaincxx . . $ SetupMenu#setupMain(b126dc7c1de90089).() == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!;
354
355 if (wasSlow && !setupcxx . . $ setup..slowMotioncxx . . $ Setup#slowMotion.) stepscxx . . $ Level#steps. <<= 1;
356 else if (!wasSlow && setupcxx . . $ setup..slowMotioncxx . . $ Setup#slowMotion.) stepscxx . . $ Level#steps. >>= 1;
357
358 // Restore level palette
359 videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(palettecxx . . $ Level#palette.);
360
361 }
362
363 break;
364
365 case 4: // Quit game
366
367 return E_RETURNcxx . . $ `src/OpenJazz.h:66:9`!;
368
369 }
370
371 return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!;
372
373 }
374
375 /**
376 * Process iteration.
377 *
378 * @param menu Whether or not the level menu should be displayed
379 * @param option Selected menu uption
380 * @param message Whether or not the "paused" message is being displayed
381 *
382 * @return Error code
383 */
384 int Levelcxx . . $ Level#::loopcxx . . $ Level#loop(98496cf6cd60cdee). (bool& menu, int& option, bool& message) {
385
386 int ret, x, y;
387
388 // Networking
389 if (multiplayercxx . . $ Level#multiplayer.) {
390
391 ret = gamecxx . . $ Level#game.->stepcxx . . $ Game#step(4c679297bf94b9eb).(tickscxx . . $ Level#ticks.);
392
393 if (ret < 0) return ret;
394
395 }
396
397
398 // Main loop
399 if (::loopcxx . . $ loop(fd873fd06cfe1135).(NORMAL_LOOPcxx . . $ NORMAL_LOOP., paletteEffectscxx . . $ Level#paletteEffects., pausedcxx . . $ Level#paused.) == E_QUITcxx . . $ `src/OpenJazz.h:67:9`!) return E_QUITcxx . . $ `src/OpenJazz.h:67:9`!;
400
401
402 if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!)) {
403
404 menu = !menu;
405 option = 0;
406
407 }
408
409 if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_PAUSEcxx . . $ `src/io/controls.h:46:9`!)) message = !message;
410
411 if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_STATScxx . . $ `src/io/controls.h:45:9`!)) {
412
413 if (!multiplayercxx . . $ Level#multiplayer.) statscxx . . $ Level#stats. ^= S_SCREENcxx . . $ S_SCREEN.;
414 else statscxx . . $ Level#stats. = (statscxx . . $ Level#stats. + 1) & 3;
415
416 }
417
418 if (menu) {
419
420 // Deal with menu controls
421
422 if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_UPcxx . . $ `src/io/controls.h:30:9`!)) option = (option + 4) % 5;
423
424 if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_DOWNcxx . . $ `src/io/controls.h:31:9`!)) option = (option + 1) % 5;
425
426 if (controlscxx . . $ controls..releasecxx . . $ Controls#release(83c267b20bac841a).(C_ENTERcxx . . $ `src/io/controls.h:38:9`!)) {
427
428 ret = selectcxx . . $ Level#select(2bf25c4362bca0f6).(menu, option);
429
430 if (ret < 0) return ret;
431
432 }
433
434 if (controlscxx . . $ controls..getCursorcxx . . $ Controls#getCursor(8a990ad1ed500b42).(x, y)) {
435
436 x -= (canvasWcxx . . $ canvasW. >> 1) - 64;
437 y -= (canvasHcxx . . $ canvasH. >> 1) - 46;
438
439 if ((x >= 0) && (x < 120) && (y >= 0) && (y < 96)) {
440
441 option = y >> 4;
442
443 if (controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) {
444
445 ret = selectcxx . . $ Level#select(2bf25c4362bca0f6).(menu, option);
446
447 if (ret < 0) return ret;
448
449 }
450
451 } else if (controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) menu = false;
452
453 }
454
455 } else {
456
457 if (controlscxx . . $ controls..wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba).()) menu = true;
458
459 }
460
461 if (!multiplayercxx . . $ Level#multiplayer.) pausedcxx . . $ Level#paused. = message || menu;
462
463 timeCalcscxx . . $ Level#timeCalcs(49f6e7a06ebc5aa8).();
464
465 return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!;
466
467 }
468
469
470 /**
471 * Add extra time.
472 *
473 * @param seconds Number of seconds to add
474 */
475 void Levelcxx . . $ Level#::addTimercxx . . $ Level#addTimer(d4f767463ce0a6b3). (int seconds) {
476
477 if (stagecxx . . $ Level#stage. != LS_NORMALcxx . . $ LS_NORMAL.) return;
478
479 endTimecxx . . $ Level#endTime. += seconds * 1000;
480
481 if (endTimecxx . . $ Level#endTime. >= tickscxx . . $ Level#ticks. + (10 * 60 * 1000))
482 endTimecxx . . $ Level#endTime. = tickscxx . . $ Level#ticks. + (10 * 60 * 1000) - 1;
483
484 if (multiplayercxx . . $ Level#multiplayer.) {
485
486 unsigned char buffer[MTL_L_PROPcxx . . $ `src/game/game.h:71:9`!];
487 buffer[0] = MTL_L_PROPcxx . . $ `src/game/game.h:71:9`!;
488 buffer[1] = MT_L_PROPcxx . . $ `src/game/game.h:55:9`!;
489 buffer[2] = 2; // add timer
490 buffer[3] = seconds;
491 buffer[4] = 0; // not used
492
493 gamecxx . . $ Level#game.->sendcxx . . $ Game#send(f25546b61a629de7).(buffer);
494
495 }
496
497 }
498
499
500 /**
501 * Set the level stage.
502 *
503 * @param newStage New level stage
504 */
505 void Levelcxx . . $ Level#::setStagecxx . . $ Level#setStage(7367d6634cee5916). (LevelStagecxx . . $ LevelStage# newStage) {
506
507 if (stagecxx . . $ Level#stage. == newStage) return;
508
509 stagecxx . . $ Level#stage. = newStage;
510
511 if (multiplayercxx . . $ Level#multiplayer.) {
512
513 unsigned char buffer[MTL_L_STAGEcxx . . $ `src/game/game.h:73:9`!];
514 buffer[0] = MTL_L_STAGEcxx . . $ `src/game/game.h:73:9`!;
515 buffer[1] = MT_L_STAGEcxx . . $ `src/game/game.h:57:9`!;
516 buffer[2] = stagecxx . . $ Level#stage.;
517 gamecxx . . $ Level#game.->sendcxx . . $ Game#send(f25546b61a629de7).(buffer);
518
519 }
520
521 }
522
523
524 /**
525 * Determine the current level stage.
526 *
527 * @return The current level stage.
528 */
529 LevelStagecxx . . $ LevelStage# Levelcxx . . $ Level#::getStagecxx . . $ Level#getStage(5189a4c765e66121). () {
530
531 return stagecxx . . $ Level#stage.;
532
533 }