| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file level.h |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par History: |
| 9 | * - 23rd August 2005: Created OpenJazz.h |
| 10 | * - 31st January 2006: Created level.h from parts of OpenJazz.h |
| 11 | * - 30th March 2010: Created baselevel.h from parts of level.h |
| 12 | * - 1st August 2012: Renamed baselevel.h to level.h |
| 13 | * |
| 14 | * @par Licence: |
| 15 | * Copyright (c) 2005-2017 AJ Thomson |
| 16 | * |
| 17 | * OpenJazz is distributed under the terms of |
| 18 | * the GNU General Public License, version 2.0 |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | |
| 23 | #ifndef _BASELEVEL_H |
| 24 | #define _BASELEVEL_Hcxx . . $ `src/level/level.h:24:9`! |
| 25 | |
| 26 | #include "menu/menu.h"cxx . . $ `<file>/src/menu/menu.h`/ |
| 27 | |
| 28 | #ifdef OJ_SDL3 |
| 29 | #include <SDL3/SDL.h> |
| 30 | #else |
| 31 | #include <SDL.h> |
| 32 | #endif |
| 33 | |
| 34 | // Macros |
| 35 | |
| 36 | // For converting between tile positions and int/fixed values |
| 37 | #define FTOTcxx . . $ `src/level/level.h:37:9`!(x) ((x) >> 15) ///< Fixed to Tile |
| 38 | #define TTOFcxx . . $ `src/level/level.h:38:9`!(x) ((x) << 15) ///< Tile to Fixed |
| 39 | #define ITOTcxx . . $ `src/level/level.h:39:9`!(x) ((x) >> 5) ///< Int to Tile |
| 40 | #define TTOIcxx . . $ `src/level/level.h:40:9`!(x) ((x) << 5) ///< Tile to Int |
| 41 | |
| 42 | |
| 43 | // Constants |
| 44 | |
| 45 | // Return values |
| 46 | #define WONcxx . . $ `src/level/level.h:46:9`! 1 |
| 47 | #define LOSTcxx . . $ `src/level/level.h:47:9`! 2 |
| 48 | |
| 49 | // Time interval |
| 50 | #define T_STEPcxx . . $ `src/level/level.h:50:9`! 16 |
| 51 | |
| 52 | |
| 53 | // Enums |
| 54 | |
| 55 | /// Level type |
| 56 | enum LevelTypecxx . . $ LevelType# { |
| 57 | |
| 58 | LT_JJ1cxx . . $ LT_JJ1. = 0, ///< JJ1 level |
| 59 | LT_JJ1BONUScxx . . $ LT_JJ1BONUS. = 1, ///< JJ1 bonus level |
| 60 | #ifdef ENABLE_JJ2 |
| 61 | LT_JJ2 = 2 ///< JJ2 level |
| 62 | #endif |
| 63 | |
| 64 | }; |
| 65 | |
| 66 | /// Which stats to display on-screen |
| 67 | enum LevelStatscxx . . $ LevelStats# { |
| 68 | |
| 69 | S_PLAYERScxx . . $ S_PLAYERS. = 1, ///< Display player list |
| 70 | S_SCREENcxx . . $ S_SCREEN. = 2 ///< Display video statisitics |
| 71 | |
| 72 | }; |
| 73 | |
| 74 | /// Level stage |
| 75 | enum LevelStagecxx . . $ LevelStage# { |
| 76 | |
| 77 | LS_NORMALcxx . . $ LS_NORMAL. = 0, ///< Normal gameplay |
| 78 | LS_SUDDENDEATHcxx . . $ LS_SUDDENDEATH. = 1, ///< Sudden death |
| 79 | LS_ENDcxx . . $ LS_END. = 2 ///< Ending sequence |
| 80 | |
| 81 | }; |
| 82 | |
| 83 | |
| 84 | // Classes |
| 85 | |
| 86 | class Animcxx . . $ Anim#; |
| 87 | class Filecxx . . $ File#; |
| 88 | class Gamecxx . . $ Game#; |
| 89 | class PaletteEffectcxx . . $ PaletteEffect#; |
| 90 | class Spritecxx . . $ Sprite#; |
| 91 | |
| 92 | /// Base class for all level classes |
| 93 | class Levelcxx . . $ Level# { |
| 94 | |
| 95 | private: |
| 96 | const char* menuOptionscxx . . $ Level#menuOptions.[6]; |
| 97 | SetupMenucxx . . $ SetupMenu# setupMenucxx . . $ Level#setupMenu.; ///< Setup menu to run on the player's command |
| 98 | FileMenucxx . . $ FileMenu# fileMenucxx . . $ Level#fileMenu.; ///< Save and Load menus to run on the player's command |
| 99 | |
| 100 | int selectcxx . . $ Level#select(2bf25c4362bca0f6). (bool& menu, int option); |
| 101 | |
| 102 | protected: |
| 103 | Gamecxx . . $ Game#* gamecxx . . $ Level#game.; |
| 104 | PaletteEffectcxx . . $ PaletteEffect#* paletteEffectscxx . . $ Level#paletteEffects.; ///< Palette effects in use while playing the level |
| 105 | SDL_Color palettecxx . . $ Level#palette.[MAX_PALETTE_COLORScxx . . $ `src/OpenJazz.h:71:9`!]; ///< Palette in use while playing the level |
| 106 | int spritescxx . . $ Level#sprites.; ///< The number of sprite that have been loaded |
| 107 | unsigned int tickOffsetcxx . . $ Level#tickOffset.; ///< Level time offset from system time |
| 108 | unsigned int stepscxx . . $ Level#steps.; ///< Number of steps taken |
| 109 | unsigned int prevTickscxx . . $ Level#prevTicks.; ///< Time the last visual update started |
| 110 | unsigned int tickscxx . . $ Level#ticks.; ///< Current time |
| 111 | unsigned int endTimecxx . . $ Level#endTime.; ///< Tick at which the level will end |
| 112 | float smoothfpscxx . . $ Level#smoothfps.; ///< Smoothed FPS counter |
| 113 | int itemscxx . . $ Level#items.; ///< Number of items to be collected |
| 114 | bool multiplayercxx . . $ Level#multiplayer.; ///< Whether or not this is a multiplayer game |
| 115 | bool pausedcxx . . $ Level#paused.; ///< Whether or not the level is paused |
| 116 | LevelStagecxx . . $ LevelStage# stagecxx . . $ Level#stage.; ///< Level stage |
| 117 | int statscxx . . $ Level#stats.; ///< Which statistics to display on-screen, see #LevelStats |
| 118 | |
| 119 | void createLevelPlayerscxx . . $ Level#createLevelPlayers(63f12801702f9d1b). (LevelTypecxx . . $ LevelType# levelType, Animcxx . . $ Anim#** anims, Animcxx . . $ Anim#** flippedAnims, bool checkpoint, unsigned char x, unsigned char y); |
| 120 | |
| 121 | int playScenecxx . . $ Level#playScene(5c4306d8553b3696). (const char* file); |
| 122 | void timeCalcscxx . . $ Level#timeCalcs(49f6e7a06ebc5aa8). (); |
| 123 | int getTimeChangecxx . . $ Level#getTimeChange(b126dc7c1de90089). (); |
| 124 | void drawOverlaycxx . . $ Level#drawOverlay(ac8280b982de25d7). (unsigned char bg, bool menu, int option, |
| 125 | unsigned char textPalIndex, unsigned char selectedTextPalIndex, |
| 126 | int textPalSpan); |
| 127 | int loopcxx . . $ Level#loop(98496cf6cd60cdee). (bool& menu, int& option, bool& message); |
| 128 | |
| 129 | public: |
| 130 | explicit Levelcxx . . $ Level#Level(920e21dac2e7a81).(Gamecxx . . $ Game#* owner); |
| 131 | virtual ~cxx . . $ Level#`~Level`(49f6e7a06ebc5aa8).Levelcxx . . $ Level#(); |
| 132 | |
| 133 | void addTimercxx . . $ Level#addTimer(d4f767463ce0a6b3). (int seconds); |
| 134 | LevelStagecxx . . $ LevelStage# getStagecxx . . $ Level#getStage(5189a4c765e66121). (); |
| 135 | void setStagecxx . . $ Level#setStage(7367d6634cee5916). (LevelStagecxx . . $ LevelStage# stage); |
| 136 | virtual void receivecxx . . $ Level#receive(f25546b61a629de7). (unsigned char* buffer) = 0; |
| 137 | |
| 138 | }; |
| 139 | |
| 140 | |
| 141 | // Variables |
| 142 | |
| 143 | EXTERNcxx . . $ `src/OpenJazz.h:38:10`! fixedcxx . . $ fixed# viewXcxx . . $ viewX., viewYcxx . . $ viewY.; ///< Level viewing co-ordinates |
| 144 | |
| 145 | #endif |
| 146 |