1 /* 2 * Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file) 3 * 4 * This file is part of Arx Libertatis. 5 * 6 * Arx Libertatis is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Arx Libertatis is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Arx Libertatis. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 /* Based on: 20 =========================================================================== 21 ARX FATALIS GPL Source Code 22 Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company. 23 24 This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code'). 25 26 Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public 27 License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 28 29 Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 30 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 31 32 You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code. If not, see 33 <http://www.gnu.org/licenses/>. 34 35 In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these 36 additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx 37 Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below. 38 39 If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o 40 ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 41 =========================================================================== 42 */ 43 // Code: Cyril Meynier 44 // 45 // Copyright (c) 1999-2000 ARKANE Studios SA. All rights reserved 46 47 #ifndef ARX_GAME_PLAYER_H 48 #define ARX_GAME_PLAYER_H 49 50 #include <string> 51 #include <vector> 52 53 #include "game/Entity.h" 54 #include "game/Spells.h" 55 #include "math/MathFwd.h" 56 #include "platform/Flags.h" 57 58 struct EERIE_3DOBJ; 59 class TextureContainer; 60 61 #define MAX_EQUIPED 12 62 63 struct ARX_NECKLACE { 64 EERIE_3DOBJ * lacet; 65 EERIE_3DOBJ * runes[RUNE_COUNT]; 66 TextureContainer * pTexTab[RUNE_COUNT]; 67 }; 68 69 struct ARX_INTERFACE_MEMORIZE_SPELL { 70 bool bSpell; 71 unsigned long lTimeCreation; 72 unsigned long lDuration; 73 Rune iSpellSymbols[6]; 74 float fPosX; 75 float fPosY; 76 }; 77 78 enum PlayerMovementFlag { 79 PLAYER_MOVE_WALK_FORWARD = (1<<0), 80 PLAYER_MOVE_WALK_BACKWARD = (1<<1), 81 PLAYER_MOVE_STRAFE_LEFT = (1<<2), 82 PLAYER_MOVE_STRAFE_RIGHT = (1<<3), 83 PLAYER_MOVE_JUMP = (1<<4), 84 PLAYER_MOVE_STEALTH = (1<<5), 85 PLAYER_ROTATE = (1<<6), 86 PLAYER_CROUCH = (1<<7), 87 PLAYER_LEAN_LEFT = (1<<8), 88 PLAYER_LEAN_RIGHT = (1<<9) 89 }; 90 DECLARE_FLAGS(PlayerMovementFlag, PlayerMovement) 91 DECLARE_FLAGS_OPERATORS(PlayerMovement) 92 93 enum PlayerFlag { 94 PLAYERFLAGS_NO_MANA_DRAIN = (1<<0), 95 PLAYERFLAGS_INVULNERABILITY = (1<<1) 96 }; 97 DECLARE_FLAGS(PlayerFlag, PlayerFlags) 98 DECLARE_FLAGS_OPERATORS(PlayerFlags) 99 100 enum RuneFlag { 101 FLAG_AAM = (1<<(RUNE_AAM)), 102 FLAG_CETRIUS = (1<<(RUNE_CETRIUS)), 103 FLAG_COMUNICATUM = (1<<(RUNE_COMUNICATUM)), 104 FLAG_COSUM = (1<<(RUNE_COSUM)), 105 FLAG_FOLGORA = (1<<(RUNE_FOLGORA)), 106 FLAG_FRIDD = (1<<(RUNE_FRIDD)), 107 FLAG_KAOM = (1<<(RUNE_KAOM)), 108 FLAG_MEGA = (1<<(RUNE_MEGA)), 109 FLAG_MORTE = (1<<(RUNE_MORTE)), 110 FLAG_MOVIS = (1<<(RUNE_MOVIS)), 111 FLAG_NHI = (1<<(RUNE_NHI)), 112 FLAG_RHAA = (1<<(RUNE_RHAA)), 113 FLAG_SPACIUM = (1<<(RUNE_SPACIUM)), 114 FLAG_STREGUM = (1<<(RUNE_STREGUM)), 115 FLAG_TAAR = (1<<(RUNE_TAAR)), 116 FLAG_TEMPUS = (1<<(RUNE_TEMPUS)), 117 FLAG_TERA = (1<<(RUNE_TERA)), 118 FLAG_VISTA = (1<<(RUNE_VISTA)), 119 FLAG_VITAE = (1<<(RUNE_VITAE)), 120 FLAG_YOK = (1<<(RUNE_YOK)) 121 }; 122 DECLARE_FLAGS(RuneFlag, RuneFlags) 123 DECLARE_FLAGS_OPERATORS(RuneFlags) 124 125 enum JumpPhase { 126 NotJumping = 0, 127 JumpStart = 1, 128 JumpAscending = 2, 129 JumpDescending = 4, 130 JumpEnd = 5 131 }; 132 133 struct ARXCHARACTER { 134 135 Vec3f pos; 136 Anglef angle; 137 ANIM_USE useanim; 138 IO_PHYSICS physics; 139 140 // Jump Sub-data 141 unsigned long jumpstarttime; 142 float jumplastposition; 143 JumpPhase jumpphase; 144 145 short climbing; 146 short levitate; 147 148 Anglef desiredangle; 149 Vec3f size; 150 ARX_PATH * inzone; 151 152 long falling; 153 short doingmagic; 154 short Interface; 155 156 PlayerMovement Current_Movement; 157 PlayerMovement Last_Movement; 158 long onfirmground; 159 160 Entity * rightIO; 161 Entity * leftIO; 162 Entity * equipsecondaryIO; 163 Entity * equipshieldIO; 164 165 short equiped[MAX_EQUIPED]; 166 167 // Modifier Values (Items, curses, etc...) 168 float Mod_Attribute_Strength; 169 float Mod_Attribute_Dexterity; 170 float Mod_Attribute_Constitution; 171 float Mod_Attribute_Mind; 172 float Mod_Skill_Stealth; 173 float Mod_Skill_Mecanism; 174 float Mod_Skill_Intuition; 175 float Mod_Skill_Etheral_Link; 176 float Mod_Skill_Object_Knowledge; 177 float Mod_Skill_Casting; 178 float Mod_Skill_Projectile; 179 float Mod_Skill_Close_Combat; 180 float Mod_Skill_Defense; 181 float Mod_armor_class; 182 float Mod_resist_magic; 183 float Mod_resist_poison; 184 float Mod_Critical_Hit; 185 float Mod_damages; 186 187 // Full Frame values (including items) 188 float Full_Attribute_Strength; 189 float Full_Attribute_Dexterity; 190 float Full_Attribute_Constitution; 191 float Full_Attribute_Mind; 192 193 float Full_Skill_Stealth; 194 float Full_Skill_Mecanism; 195 float Full_Skill_Intuition; 196 197 float Full_Skill_Etheral_Link; 198 float Full_Skill_Object_Knowledge; 199 float Full_Skill_Casting; 200 201 float Full_Skill_Projectile; 202 float Full_Skill_Close_Combat; 203 float Full_Skill_Defense; 204 float Full_armor_class; 205 float Full_resist_magic; 206 float Full_resist_poison; 207 float Full_Critical_Hit; 208 float Full_damages; 209 long Full_AimTime; 210 long Full_Weapon_Type; 211 float Full_life; 212 float Full_maxlife; 213 float Full_maxmana; 214 215 // true (naked) Player Values 216 float Attribute_Strength; 217 float Attribute_Dexterity; 218 float Attribute_Constitution; 219 float Attribute_Mind; 220 221 float Skill_Stealth; 222 float Skill_Mecanism; 223 float Skill_Intuition; 224 225 float Skill_Etheral_Link; 226 float Skill_Object_Knowledge; 227 float Skill_Casting; 228 229 float Skill_Projectile; 230 float Skill_Close_Combat; 231 float Skill_Defense; 232 233 float Critical_Hit; 234 long AimTime; 235 float life; 236 float maxlife; 237 float mana; 238 float maxmana; 239 240 // Player Old Values 241 float Old_Skill_Stealth; 242 float Old_Skill_Mecanism; 243 float Old_Skill_Intuition; 244 245 float Old_Skill_Etheral_Link; 246 float Old_Skill_Object_Knowledge; 247 float Old_Skill_Casting; 248 249 float Old_Skill_Projectile; 250 float Old_Skill_Close_Combat; 251 float Old_Skill_Defense; 252 253 unsigned char Attribute_Redistribute; 254 unsigned char Skill_Redistribute; 255 256 unsigned char level; 257 258 unsigned char armor_class; 259 unsigned char resist_magic; 260 unsigned char resist_poison; 261 long xp; 262 char skin; 263 264 RuneFlags rune_flags; 265 TextureContainer * heads[5]; 266 float damages; 267 float poison; 268 float hunger; 269 PlayerFlags playerflags; 270 long gold; 271 short bag; 272 ARX_INTERFACE_MEMORIZE_SPELL SpellToMemorize; 273 baseRadiusARXCHARACTER274 static float baseRadius() { return 52.f; } baseHeightARXCHARACTER275 static float baseHeight() { return -170.f; } crouchHeightARXCHARACTER276 static float crouchHeight() { return -120.f; } levitateHeightARXCHARACTER277 static float levitateHeight() { return -220.f; } 278 baseOffsetARXCHARACTER279 static Vec3f baseOffset() { return Vec3f(0.f, baseHeight(), 0.f); } 280 basePositionARXCHARACTER281 Vec3f basePosition() { 282 return Vec3f(pos.x, pos.y - baseHeight(), pos.z); 283 } 284 baseCylinderARXCHARACTER285 EERIE_CYLINDER baseCylinder() { 286 EERIE_CYLINDER c; 287 c.height = baseHeight(); 288 c.radius = baseRadius(); 289 c.origin = basePosition(); 290 return c; 291 } 292 293 }; 294 295 struct KEYRING_SLOT { 296 char slot[64]; 297 }; 298 299 300 // Quests Management (QuestLogBook) 301 302 struct STRUCT_QUEST { 303 std::string ident; 304 }; 305 306 extern ARXCHARACTER player; 307 extern ARX_NECKLACE necklace; 308 extern EERIE_3DOBJ * hero; 309 extern ANIM_HANDLE * herowaitbook; 310 extern ANIM_HANDLE * herowait_2h; 311 extern std::vector<STRUCT_QUEST> PlayerQuest; 312 extern std::vector<KEYRING_SLOT> Keyring; 313 314 extern float DeadCameraDistance; 315 extern long BLOCK_PLAYER_CONTROLS; 316 extern long USE_PLAYERCOLLISIONS; 317 extern long WILLRETURNTOCOMBATMODE; 318 319 void ARX_PLAYER_MakeSpHero(); 320 void ARX_PLAYER_LoadHeroAnimsAndMesh(); 321 void ARX_PLAYER_InitPlayer(); 322 void ARX_PLAYER_BecomesDead(); 323 void ARX_PLAYER_ClickedOnTorch(Entity * io); 324 void ARX_PLAYER_RectifyPosition(); 325 void ARX_PLAYER_Frame_Update(); 326 void ARX_PLAYER_Manage_Movement(); 327 void ARX_PLAYER_Manage_Death(); 328 void ARX_PLAYER_GotoAnyPoly(); 329 void ARX_PLAYER_Quest_Add(const std::string & quest, bool _bLoad = false); 330 void ARX_PLAYER_Quest_Init(); 331 void ARX_PLAYER_FrontPos(Vec3f * pos); 332 void ARX_PLAYER_MakePowerfullHero(); 333 void ARX_PLAYER_ComputePlayerFullStats(); 334 void ARX_PLAYER_MakeFreshHero(); 335 void ARX_PLAYER_QuickGeneration(); 336 void ARX_PLAYER_MakeAverageHero(); 337 void ARX_PLAYER_Modify_XP(long val); 338 void ARX_PLAYER_FrameCheck(float Framedelay); 339 void ARX_PLAYER_Poison(float val); 340 void ARX_PLAYER_Manage_Visual(); 341 void ARX_PLAYER_Remove_Invisibility(); 342 void ARX_Player_Rune_Add(RuneFlag rune); 343 void ARX_Player_Rune_Remove(RuneFlag rune); 344 void ARX_PLAYER_AddGold(long value); 345 void ARX_PLAYER_AddGold(Entity * gold); 346 void ARX_PLAYER_AddBag(); 347 bool ARX_PLAYER_CanStealItem(Entity * item); 348 349 void ARX_KEYRING_Init(); 350 void ARX_KEYRING_Add(const std::string & key); 351 void ARX_KEYRING_Combine(Entity * io); 352 353 void ARX_PLAYER_Reset_Fall(); 354 void ARX_PLAYER_KillTorch(); 355 void ARX_PLAYER_PutPlayerInNormalStance(long val); 356 void ARX_PLAYER_Start_New_Quest(); 357 void ARX_PLAYER_Rune_Add_All(); 358 359 void ARX_PLAYER_Restore_Skin(); 360 float GetPlayerStealth(); 361 362 void ARX_GAME_Reset(long type = 0); 363 void Manage_sp_max(); 364 long GetXPforLevel(long level); 365 bool ARX_PLAYER_IsInFightMode(); 366 void ARX_PLAYER_Invulnerability(long flag); 367 368 void ForcePlayerLookAtIO(Entity * io); 369 370 #endif // ARX_GAME_PLAYER_H 371