comparison Player.h @ 1361:b3ac17fd12de

Moved condition checking to a separate class, extracted it from player::SetCondition
author Grumpy7
date Sun, 14 Jul 2013 23:22:43 +0200
parents 06926081358f
children d6cf8ead9242
comparison
equal deleted inserted replaced
1360:a47d9282ea7c 1361:b3ac17fd12de
1 #pragma once 1 #pragma once
2 #include "Items.h" 2 #include "Items.h"
3 #include "Spells.h" 3 #include "Spells.h"
4 #include "Conditions.h"
4 5
5 6
6 7
7 8
8 #define PLAYER_BUFF_BLESS 1 9 #define PLAYER_BUFF_BLESS 1
444 }; 445 };
445 446
446 #pragma pack(push, 1) 447 #pragma pack(push, 1)
447 struct Player 448 struct Player
448 { 449 {
449 enum Condition: unsigned __int32
450 {
451 Condition_Cursed = 0,
452 Condition_Weak = 1,
453 Condition_Sleep = 2,
454 Condition_Fear = 3,
455 Condition_Drunk = 4,
456 Condition_Insane = 5,
457 Condition_Poison1 = 6,
458 Condition_Disease1 = 7,
459 Condition_Poison2 = 8,
460 Condition_Disease2 = 9,
461 Condition_Poison3 = 10,
462 Condition_Disease3 = 11,
463 Condition_Paralyzed = 12,
464 Condition_Unconcious = 13,
465 Condition_Dead = 14,
466 Condition_Pertified = 15,
467 Condition_Eradicated = 16,
468 Condition_Zombie = 17,
469 Condition_Good = 18
470 };
471 450
472 Player(); 451 Player();
473 452
474 void SetVariable(enum VariableType var, signed int a3); 453 void SetVariable(enum VariableType var, signed int a3);
475 void AddVariable(enum VariableType var, signed int val); 454 void AddVariable(enum VariableType var, signed int val);
568 int PutItemArInventoryIndex(ItemGen *item, int item_id, int uSlot); 547 int PutItemArInventoryIndex(ItemGen *item, int item_id, int uSlot);
569 void RemoveItemAtInventoryIndex(unsigned int uSlot); 548 void RemoveItemAtInventoryIndex(unsigned int uSlot);
570 bool CanAct(); 549 bool CanAct();
571 bool CanSteal(); 550 bool CanSteal();
572 bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID); 551 bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID);
573 int SetCondition(unsigned int uConditionIdx, int a3); 552 void SetCondition(unsigned int uConditionIdx, int a3);
574 bool ProfessionOrGuildFlagsCorrect(unsigned int uClass, int a3); 553 bool ProfessionOrGuildFlagsCorrect(unsigned int uClass, int a3);
575 void PlaySound(PlayerSpeech speech, int a3); 554 void PlaySound(PlayerSpeech speech, int a3);
576 void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); 555 void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3);
577 void ItemsEnchant(int enchant_count); 556 void ItemsEnchant(int enchant_count);
578 unsigned int GetItemIDAtInventoryIndex(int *a2); 557 unsigned int GetItemIDAtInventoryIndex(int *a2);
593 bool CanCastSpell(unsigned int uRequiredMana); 572 bool CanCastSpell(unsigned int uRequiredMana);
594 void PlaySoundBasedOnCondition(int currPlayerId); 573 void PlaySoundBasedOnCondition(int currPlayerId);
595 void DrawPlayerBuffAnimBasedOnCondition(int currPlayerId); 574 void DrawPlayerBuffAnimBasedOnCondition(int currPlayerId);
596 void EquipBody(ITEM_EQUIP_TYPE uEquipType); 575 void EquipBody(ITEM_EQUIP_TYPE uEquipType);
597 576
598 inline bool Weak() {return pConditions[Condition_Weak] != 0;} 577 bool Weak();
599 inline bool Dead() {return pConditions[Condition_Dead] != 0;} 578 bool Dead();
600 inline bool Eradicated() {return pConditions[Condition_Eradicated] != 0;} 579 bool Eradicated();
601 inline bool Zombie() {return pConditions[Condition_Zombie] != 0;} 580 bool Zombie();
602 inline bool Cursed() {return pConditions[Condition_Cursed] != 0;} 581 bool Cursed();
603 inline bool Pertified() {return pConditions[Condition_Pertified] != 0;} 582 bool Pertified();
604 583 bool Unconcious();
605 inline void SetCursed(bool state) {pConditions[Condition_Cursed] = state;} 584
606 inline void SetWeak(bool state) {pConditions[Condition_Weak] = state;} 585 void SetCursed(bool state);
607 inline void SetAsleep(bool state) {pConditions[Condition_Sleep] = state;} 586 void SetWeak(bool state);
608 inline void SetAfraid(bool state) {pConditions[Condition_Fear] = state;} 587 void SetAsleep(bool state);
609 inline void SetDrunk(bool state) {pConditions[Condition_Drunk] = state;} 588 void SetAfraid(bool state);
610 inline void SetInsane(bool state) {pConditions[Condition_Insane] = state;} 589 void SetDrunk(bool state);
611 inline void SetPoison1(bool state) {pConditions[Condition_Poison1] = state;} 590 void SetInsane(bool state);
612 inline void SetDisease1(bool state) {pConditions[Condition_Disease1] = state;} 591 void SetPoison1(bool state);
613 inline void SetPoison2(bool state) {pConditions[Condition_Poison2] = state;} 592 void SetDisease1(bool state);
614 inline void SetDisease2(bool state) {pConditions[Condition_Disease2] = state;} 593 void SetPoison2(bool state);
615 inline void SetPoison3(bool state) {pConditions[Condition_Poison3] = state;} 594 void SetDisease2(bool state);
616 inline void SetDisease3(bool state) {pConditions[Condition_Disease3] = state;} 595 void SetPoison3(bool state);
617 inline void SetParalyzed(bool state) {pConditions[Condition_Paralyzed] = state;} 596 void SetDisease3(bool state);
618 inline void SetUnconcious(bool state) {pConditions[Condition_Unconcious] = state;} 597 void SetParalyzed(bool state);
619 inline void SetDead(bool state) {pConditions[Condition_Dead] = state;} 598 void SetUnconcious(bool state);
620 inline void SetPertified(bool state) {pConditions[Condition_Pertified] = state;} 599 void SetDead(bool state);
621 inline void SetEradicated(bool state) {pConditions[Condition_Eradicated] = state;} 600 void SetPertified(bool state);
622 inline void SetZombie(bool state) {pConditions[Condition_Zombie] = state;} 601 void SetEradicated(bool state);
602 void SetZombie(bool state);
603
604 void SetCondWeakWithBlockCheck (int blockable);
605 void SetCondInsaneWithBlockCheck (int blockable);
606 void SetCondDeadWithBlockCheck (int blockable);
623 607
624 inline bool IsRaceHuman() {return GetRace() == CHARACTER_RACE_HUMAN;} 608 inline bool IsRaceHuman() {return GetRace() == CHARACTER_RACE_HUMAN;}
625 inline bool IsRaceDwarf() {return GetRace() == CHARACTER_RACE_DWARF;} 609 inline bool IsRaceDwarf() {return GetRace() == CHARACTER_RACE_DWARF;}
626 inline bool IsRaceElf() {return GetRace() == CHARACTER_RACE_ELF;} 610 inline bool IsRaceElf() {return GetRace() == CHARACTER_RACE_ELF;}
627 inline bool IsRaceGoblin() {return GetRace() == CHARACTER_RACE_GOBLIN;} 611 inline bool IsRaceGoblin() {return GetRace() == CHARACTER_RACE_GOBLIN;}