| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file player.h |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par History: |
| 9 | * - 23rd August 2005: Created OpenJazz.h |
| 10 | * - 31st January 2006: Created player.h from parts of OpenJazz.h |
| 11 | * - 24th June 2010: Created levelplayer.h from parts of player.h |
| 12 | * - 24th June 2010: Created bonusplayer.h from parts of player.h |
| 13 | * |
| 14 | * @par Licence: |
| 15 | * Copyright (c) 2005-2013 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 | /* "Tile" is a flexible term. Here it is used to refer specifically to the |
| 24 | individual elements of the tile set. |
| 25 | "Tiles" in the context of level units are referred to as grid elements. */ |
| 26 | |
| 27 | |
| 28 | #ifndef _PLAYER_H |
| 29 | #define _PLAYER_Hcxx . . $ `src/player/player.h:29:9`! |
| 30 | |
| 31 | |
| 32 | #include "level/level.h"cxx . . $ `<file>/src/level/level.h`/ |
| 33 | |
| 34 | |
| 35 | // Constants |
| 36 | |
| 37 | // Player defaults |
| 38 | #define CHAR_NAMEcxx . . $ `src/player/player.h:38:9`! "jazz" |
| 39 | #define CHAR_FURcxx . . $ `src/player/player.h:39:9`! 4 |
| 40 | #define CHAR_BANDcxx . . $ `src/player/player.h:40:9`! 3 |
| 41 | #define CHAR_GUNcxx . . $ `src/player/player.h:41:9`! 2 |
| 42 | #define CHAR_WBANDcxx . . $ `src/player/player.h:42:9`! 8 |
| 43 | |
| 44 | // General |
| 45 | #define PCONTROLScxx . . $ `src/player/player.h:45:9`! 8 /* Number of player controls. */ |
| 46 | |
| 47 | // Number of configurable player colour ranges |
| 48 | #define PCOLOURScxx . . $ `src/player/player.h:48:9`! 4 |
| 49 | |
| 50 | |
| 51 | // Enums |
| 52 | |
| 53 | /// Player colours |
| 54 | enum PlayerColourcxx . . $ PlayerColour# { |
| 55 | |
| 56 | PC_GREYcxx . . $ PC_GREY. = 0, |
| 57 | PC_SGREENcxx . . $ PC_SGREEN. = 1, |
| 58 | PC_BLUEcxx . . $ PC_BLUE. = 2, |
| 59 | PC_REDcxx . . $ PC_RED. = 3, |
| 60 | PC_LGREENcxx . . $ PC_LGREEN. = 4, |
| 61 | PC_LEVEL1cxx . . $ PC_LEVEL1. = 5, |
| 62 | PC_YELLOWcxx . . $ PC_YELLOW. = 6, |
| 63 | PC_LEVEL2cxx . . $ PC_LEVEL2. = 7, |
| 64 | PC_ORANGEcxx . . $ PC_ORANGE. = 8, |
| 65 | PC_LEVEL3cxx . . $ PC_LEVEL3. = 9, |
| 66 | PC_LEVEL4cxx . . $ PC_LEVEL4. = 10, |
| 67 | PC_SANIMcxx . . $ PC_SANIM. = 11, |
| 68 | PC_LANIMcxx . . $ PC_LANIM. = 12, |
| 69 | PC_LEVEL5cxx . . $ PC_LEVEL5. = 13 |
| 70 | |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | // Classes |
| 75 | |
| 76 | class Animcxx . . $ Anim#; |
| 77 | class JJ1LevelPlayercxx . . $ JJ1LevelPlayer#; |
| 78 | class JJ1BonusLevelPlayercxx . . $ JJ1BonusLevelPlayer#; |
| 79 | #ifdef ENABLE_JJ2 |
| 80 | class JJ2LevelPlayer; |
| 81 | #endif |
| 82 | class LevelPlayercxx . . $ LevelPlayer#; |
| 83 | |
| 84 | /// Game player |
| 85 | class Playercxx . . $ Player# { |
| 86 | |
| 87 | private: |
| 88 | Gamecxx . . $ Game#* gamecxx . . $ Player#game.; |
| 89 | LevelPlayercxx . . $ LevelPlayer#* levelPlayercxx . . $ Player#levelPlayer.; ///< Level player base class |
| 90 | LevelTypecxx . . $ LevelType# levelPlayerTypecxx . . $ Player#levelPlayerType.; |
| 91 | |
| 92 | char* namecxx . . $ Player#name.; ///< Name |
| 93 | bool pcontrolscxx . . $ Player#pcontrols.[PCONTROLScxx . . $ `src/player/player.h:45:9`!]; ///< Control status |
| 94 | unsigned char colscxx . . $ Player#cols.[PCOLOURScxx . . $ `src/player/player.h:48:9`!]; ///< Character colours |
| 95 | int ammocxx . . $ Player#ammo.[5]; ///< Amount of ammo |
| 96 | int ammoTypecxx . . $ Player#ammoType.; ///< Ammo type. -1 = blaster, 0 = toaster, 1 = missiles, 2 = bouncer, 3 = unknown, 4 = TNT |
| 97 | int scorecxx . . $ Player#score.; ///< Total score |
| 98 | int livescxx . . $ Player#lives.; ///< Remaining lives |
| 99 | int fireSpeedcxx . . $ Player#fireSpeed.; ///< Rapid-fire rate |
| 100 | int flockSizecxx . . $ Player#flockSize.; ///< Number of accompanying birds |
| 101 | unsigned char teamcxx . . $ Player#team.; ///< Team ID |
| 102 | |
| 103 | void addAmmocxx . . $ Player#addAmmo(3e454b8ccf442868). (int type, int amount); |
| 104 | |
| 105 | public: |
| 106 | int teamScorecxx . . $ Player#teamScore.; ///< Team's total score |
| 107 | |
| 108 | Playercxx . . $ Player#Player(49f6e7a06ebc5aa8). (); |
| 109 | ~cxx . . $ Player#`~Player`(49f6e7a06ebc5aa8).Playercxx . . $ Player# (); |
| 110 | |
| 111 | void initcxx . . $ Player#init(eadcf6f4775e9cbb). (Gamecxx . . $ Game#* owner, char* playerName, unsigned char* cols, unsigned char newTeam); |
| 112 | void deinitcxx . . $ Player#deinit(49f6e7a06ebc5aa8). (); |
| 113 | void clearAmmocxx . . $ Player#clearAmmo(49f6e7a06ebc5aa8). (); |
| 114 | void resetcxx . . $ Player#reset(3e454b8ccf442868). (int x, int y); |
| 115 | |
| 116 | void createLevelPlayercxx . . $ Player#createLevelPlayer(27ab3ccb3efab72). (LevelTypecxx . . $ LevelType# levelType, Animcxx . . $ Anim#** anims, Animcxx . . $ Anim#** flippedAnims, unsigned char x, unsigned char y); |
| 117 | LevelPlayercxx . . $ LevelPlayer#* getLevelPlayercxx . . $ Player#getLevelPlayer(e55247ee3168a607). (); |
| 118 | JJ1BonusLevelPlayercxx . . $ JJ1BonusLevelPlayer#* getJJ1BonusLevelPlayercxx . . $ Player#getJJ1BonusLevelPlayer(5b714c54c39cd209). (); |
| 119 | JJ1LevelPlayercxx . . $ JJ1LevelPlayer#* getJJ1LevelPlayercxx . . $ Player#getJJ1LevelPlayer(cf23ec4c0d6db922). (); |
| 120 | #ifdef ENABLE_JJ2 |
| 121 | JJ2LevelPlayer* getJJ2LevelPlayer (); |
| 122 | #endif |
| 123 | |
| 124 | void addLifecxx . . $ Player#addLife(49f6e7a06ebc5aa8). (); |
| 125 | void addScorecxx . . $ Player#addScore(d4f767463ce0a6b3). (int addedScore); |
| 126 | bool endOfLevelcxx . . $ Player#endOfLevel(cf9ef193275fa6d8). (int gridX, int gridY); |
| 127 | int getAmmoTypecxx . . $ Player#getAmmoType(b126dc7c1de90089). (); |
| 128 | int getAmmocxx . . $ Player#getAmmo(b126dc7c1de90089). (); |
| 129 | unsigned char* getColscxx . . $ Player#getCols(37d8967d10cb1e7b). (); |
| 130 | bool getControlcxx . . $ Player#getControl(83c267b20bac841a). (int control); |
| 131 | int getLivescxx . . $ Player#getLives(b126dc7c1de90089). (); |
| 132 | char* getNamecxx . . $ Player#getName(41208ce6ca65dd58). (); |
| 133 | int getScorecxx . . $ Player#getScore(b126dc7c1de90089). (); |
| 134 | unsigned char getTeamcxx . . $ Player#getTeam(7c4be072098b358f). (); |
| 135 | bool hitcxx . . $ Player#hit(642b3750baa38d6c). (Playercxx . . $ Player#* source); |
| 136 | bool killcxx . . $ Player#kill(642b3750baa38d6c). (Playercxx . . $ Player#* source); |
| 137 | void setCheckpointcxx . . $ Player#setCheckpoint(3e454b8ccf442868). (int gridX, int gridY); |
| 138 | void setControlcxx . . $ Player#setControl(918ebd27a9ddbad3). (int control, bool state); |
| 139 | |
| 140 | void sendcxx . . $ Player#send(f25546b61a629de7). (unsigned char* buffer); |
| 141 | void receivecxx . . $ Player#receive(f25546b61a629de7). (unsigned char* buffer); |
| 142 | |
| 143 | friend class JJ1LevelPlayercxx . . $ JJ1LevelPlayer#; |
| 144 | #ifdef ENABLE_JJ2 |
| 145 | friend class JJ2LevelPlayer; |
| 146 | #endif |
| 147 | |
| 148 | }; |
| 149 | |
| 150 | |
| 151 | // Variables |
| 152 | |
| 153 | EXTERNcxx . . $ `src/OpenJazz.h:38:10`! Playercxx . . $ Player#* playerscxx . . $ players.; |
| 154 | EXTERNcxx . . $ `src/OpenJazz.h:38:10`! Playercxx . . $ Player#* localPlayercxx . . $ localPlayer.; |
| 155 | EXTERNcxx . . $ `src/OpenJazz.h:38:10`! int nPlayerscxx . . $ nPlayers.; |
| 156 | |
| 157 | #endif |
| 158 |