view Party.h @ 1643:7182930263b3

fixpoint functions renaming
author zipi
date Tue, 17 Sep 2013 19:24:23 +0100
parents 30db6d265ceb
children c6fe09a06712
line wrap: on
line source

#pragma once
#include "Player.h"
#include "NPC.h"
#include "mm7_data.h"



#define PARTY_AUTONOTES_BIT__EMERALD_FIRE_FOUNTAIN 2

enum PARTY_QUEST_BITS: uint16
{
  PARTY_QUEST_EMERALD_RED_POTION_ACTIVE = 1,
  PARTY_QUEST_EMERALD_SEASHELL_ACTIVE = 2,
  PARTY_QUEST_EMERALD_LONGBOW_ACTIVE = 3,
  PARTY_QUEST_EMERALD_PLATE_ACTIVE = 4,
  PARTY_QUEST_EMERALD_LUTE_ACTIVE = 5,
  PARTY_QUEST_EMERALD_HAT_ACTIVE = 6,

  PARTY_QUEST_EMERALD_MARGARETH_OFF = 17,

  PARTY_QUEST_EVENMORN_MAP_FOUND = 64,
  PARTY_QUEST_FINISHED_EMERALD_ISLE = 136,

  PARTY_QUEST_OBELISK_HARMONDALE = 164,
  PARTY_QUEST_OBELISK_ERATHIA = 165,
  PARTY_QUEST_OBELISK_TULAREAN_FOREST = 166,
  PARTY_QUEST_OBELISK_DEYJA = 167,
  PARTY_QUEST_OBELISK_BRACADA_DESERT = 168,
  PARTY_QUEST_OBELISK_CELESTE = 169,
  PARTY_QUEST_OBELISK_THE_PIT = 170,
  PARTY_QUEST_OBELISK_EVENMORN_ISLAND = 171,
  PARTY_QUEST_OBELISK_MOUNT_NIGHON = 172,
  PARTY_QUEST_OBELISK_BARROW_DOWNS = 173,
  PARTY_QUEST_OBELISK_LAND_OF_THE_GIANTS = 174,
  PARTY_QUEST_OBELISK_TATALIA = 175,
  PARTY_QUEST_OBELISK_AVLEE = 176,
  PARTY_QUEST_OBELISK_STONE_CITY = 177,

  PARTY_QUEST_OBELISK_TREASURE_FOUND = 178,

  PARTY_QUEST_FOUNTAIN_HARMONDALE = 206,
  PARTY_QUEST_FOUNTAIN_NIGHON = 207,
  PARTY_QUEST_FOUNTAIN_PIERPONT = 208,
  PARTY_QUEST_FOUNTAIN_CELESTIA = 209,
  PARTY_QUEST_FOUNTAIN_THE_PIT = 210,
  PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE = 211
};

/*  355 */
enum PARTY_FLAGS_1: __int32
{
  PARTY_FLAGS_1_WATER_DAMAGE = 0x0004,
  PARTY_FLAGS_1_FALLING = 0x0008,
  PARTY_FLAGS_1_ALERT_RED = 0x0010,
  PARTY_FLAGS_1_ALERT_YELLOW = 0x0020,
  PARTY_FLAGS_1_STANDING_ON_WATER = 0x0080,
  PARTY_FLAGS_1_LANDING = 0x0100,
  PARTY_FLAGS_1_BURNING = 0x200
};
enum PARTY_FLAGS_2: __int32
{
  PARTY_FLAGS_2_RUNNING = 0x2,
};

/*  347 */
enum PARTY_BUFF_INDEX
{
  PARTY_BUFF_RESIST_AIR = 0,
  PARTY_BUFF_RESIST_BODY = 1,
  PARTY_BUFF_DAY_OF_GODS = 2,
  PARTY_BUFF_DETECT_LIFE = 3,
  PARTY_BUFF_RESIST_EARTH = 4,
  PARTY_BUFF_FEATHER_FALL = 5,
  PARTY_BUFF_RESIST_FIRE = 6,
  PARTY_BUFF_FLY = 7,
  PARTY_BUFF_HASTE = 8,
  PARTY_BUFF_HEROISM = 9,
  PARTY_BUFF_IMMOLATION = 10,
  PARTY_BUFF_INVISIBILITY = 11,
  PARTY_BUFF_RESIST_MIND = 12,
  PARTY_BUFF_PROTECTION_FROM_MAGIC = 13,
  PARTY_BUFF_SHIELD = 14,
  PARTY_BUFF_STONE_SKIN = 15,
  PARTY_BUFF_TORCHLIGHT = 16,
  PARTY_BUFF_RESIST_WATER = 17,
  PARTY_BUFF_WATER_WALK = 18,
  PARTY_BUFF_WIZARD_EYE = 19,
};



/*  300 */
enum PartyAction: unsigned __int32
{
  PARTY_INVALID = 0,
  PARTY_TurnLeft = 0x1,
  PARTY_TurnRight = 0x2,
  PARTY_StrafeLeft = 0x3,
  PARTY_StrafeRight = 0x4,
  PARTY_WalkForward = 0x5,
  PARTY_WalkBackward = 0x6,
  PARTY_LookUp = 0x7,
  PARTY_LookDown = 0x8,
  PARTY_CenterView = 0x9,
  PARTY_unkA = 0xA,
  PARTY_unkB = 0xB,
  PARTY_Jump = 0xC,
  PARTY_FlyUp = 0xD,
  PARTY_FlyDown = 0xE,
  PARTY_Land = 0xF,
  PARTY_RunForward = 0x10,
  PARTY_RunBackward = 0x11,
  PARTY_FastTurnLeft = 0x12,
  PARTY_FastTurnRight = 0x13,

  PARTY_dword = 0xFFFFFFFF
};



/*  135 */
#pragma pack(push, 1)
struct ActionQueue
{
  void Add(PartyAction action);
  void Reset();
  PartyAction Next();

  unsigned int uNumActions;
  PartyAction  pActions[30];
};
#pragma pack(pop)





enum PartyAlignment: unsigned __int32
{
  PartyAlignment_Good = 0,
  PartyAlignment_Neutral = 1,
  PartyAlignment_Evil = 2
};





/*  208 */
#pragma pack(push, 1)
struct Party_stru0
{
  //__int64 field_0[10];
  __int64 bountyHunting_next_generation_time[10];
 // int field_50[170];
  __int64 Shops_next_generation_time[85];//field_50
  __int64 _shop_ban_times[53];
  int field_4A0[20];
  int field_4F0[38];
  char field_588[2];
  __int64 _s_times[21]; //5d8 440h+8*51
  __int64 field_632[8];
  char field_672[6];
 // char pIsArtifactFound[8];
};
#pragma pack(pop)

/*  207 */
#pragma pack(push, 1)
struct Party
{
  Party():
    uTimePlayed(0)
  {
    Zero();
  }

  void Zero();
  void UpdatePlayersAndHirelingsEmotions();
  void RestAndHeal();
  unsigned int GetPartyFame();
  void CreateDefaultParty(char bGiveItems);
  int Reset();
  void ResetPosMiscAndSpellBuffs();
  bool HasItem(unsigned int uItemID);
  void SetHoldingItem(ItemGen *pItem);
  int GetNextActiveCharacter();
  bool _497FC5_check_party_perception_against_level();
  bool AddItemToParty(ItemGen *pItem);
  void Yell();
  void CountHirelings();
  
  static void SetGold(unsigned int uNumGold);
  static void TakeGold(unsigned int uNumGold);
  static void SetFood(unsigned int uNumFood);
  static void TakeFood(unsigned int uNumFood);
  static void GiveFood(unsigned int _this);

  inline bool WizardEyeActive()      {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;}
  inline int  WizardEyeSkillLevel()  {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;}
  inline bool TorchlightActive()     {return pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0;}
  inline bool FlyActive()            {return pPartyBuffs[PARTY_BUFF_FLY].uExpireTime > 0;}
  inline bool WaterWalkActive()      {return pPartyBuffs[PARTY_BUFF_WATER_WALK].uExpireTime > 0;}
  inline bool ImmolationActive()     {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uExpireTime > 0;}
  inline int ImmolationSkillLevel() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uSkill;}
  inline bool FeatherFallActive()    {return pPartyBuffs[PARTY_BUFF_FEATHER_FALL].uExpireTime > 0;}
  inline bool Invisible()            {return pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0;}

  inline bool GetRedAlert()    {return (uFlags & PARTY_FLAGS_1_ALERT_RED) != 0;}
  inline void SetRedAlert()    {uFlags |= PARTY_FLAGS_1_ALERT_RED;}
  inline bool GetYellowAlert() {return (uFlags & PARTY_FLAGS_1_ALERT_YELLOW) != 0;}
  inline void SetYellowAlert() {uFlags |= PARTY_FLAGS_1_ALERT_YELLOW;}

  bool IsPartyEvil();
  bool IsPartyGood();

  int field_0;
  unsigned int uPartyHeight;
  unsigned int uDefaultPartyHeight;
  int sEyelevel;
  unsigned int uDefaultEyelevel;
  int field_14_radius;
  int y_rotation_granularity;
  unsigned int uWalkSpeed;
  int y_rotation_speed;  // deg/s
  int field_24;
  int field_28;
  unsigned __int64 uTimePlayed;
  __int64 uLastRegenerationTime;
  Party_stru0 field_3C;
  Vec3_int_ vPosition;
  int sRotationY;
  int sRotationX;
  Vec3_int_ vPrevPosition;
  int sPrevRotationY;
  int sPrevRotationX;
  int sPrevEyelevel;
  int field_6E0;
  int field_6E4;
  int uFallSpeed;
  int field_6EC;
  int field_6F0;
  int floor_face_pid; // face we are standing at
  int walk_sound_timer;
  int field_6FC;
  int uFallStartY;
  unsigned int bFlying;
  char field_708;
  char field_709;
  char field_70A;
  char field_70B;
  unsigned int uCurrentYear;
  unsigned int uCurrentMonth;
  unsigned int uCurrentMonthWeek;
  unsigned int uDaysPlayed;
  unsigned int uCurrentHour;
  unsigned int uCurrentMinute;
  unsigned int uCurrentTimeSecond;
  unsigned int uNumFoodRations;
  int field_72C;
  int field_730;
  unsigned int uNumGold;
  unsigned int uNumGoldInBank;
  unsigned int uNumDeaths;
  int field_740;
  int uNumPrisonTerms;
  unsigned int uNumBountiesCollected;
  int field_74C;
  __int16 monster_id_for_hunting[5];
  __int16 monster_for_hunting_killed[5];
  unsigned char   days_played_without_rest;
  unsigned __int8 _quest_bits[64];
  unsigned __int8 pArcomageWins[16];
  char field_7B5_in_arena_quest;
  char uNumArenaPageWins;
  char uNumArenaSquireWins;
  char uNumArenaKnightWins;
  char uNumArenaLordWins;
  char pIsArtifactFound[29];  //7ba
  char field_7d7[39];
  unsigned char _autonote_bits[26];
  char field_818[60];
  char field_854[32];
  int uNumArcomageWins;
  int uNumArcomageLoses;
  unsigned int bTurnBasedModeOn;
  int field_880;
  int uFlags2;
  PartyAlignment alignment;
  SpellBuff pPartyBuffs[20];
  Player pPlayers[4];
  NPCData pHirelings[2];
  ItemGen pPickedItem;
  unsigned int uFlags;
  ItemGen StandartItemsInShops[53][12];
  ItemGen SpecialItemsInShops[53][12];   //D0EC
  ItemGen SpellBooksInGuilds[32][12];
  char field_1605C[24];
  char pHireling1Name[100];
  char pHireling2Name[100];
  int armageddon_timer;
  int field_16140;
  int pTurnBasedPlayerRecoveryTimes[4];
  int InTheShopFlags[53];
  int uFine;
  float flt_TorchlightColorR;
  float flt_TorchlightColorG;
  float flt_TorchlightColorB;
};
#pragma pack(pop)



extern Party *pParty; // idb


extern struct ActionQueue *pPartyActionQueue;

inline bool TestPartyQuestBit(PARTY_QUEST_BITS bit)
{
  return _449B57_test_bit(pParty->_quest_bits, bit);
}