1 /* GemRB - Infinity Engine Emulator
2  * Copyright (C) 2003 The GemRB Project
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  *
19  */
20 
21 #ifndef PCSTATSTRUCT_H
22 #define PCSTATSTRUCT_H
23 
24 #include "exports.h"
25 #include "ie_types.h"
26 
27 #include <list>
28 
29 namespace GemRB {
30 
31 #define MAX_QUICKITEMSLOT   5   //pst has 5
32 #define MAX_QUICKWEAPONSLOT 8   //iwd2 has 4x2
33 #define MAX_QSLOTS          9   //iwd2 has 9
34 #define MAX_PORTRAIT_ICONS 12
35 #define MAX_FAVOURITES     4
36 #define SOUNDFOLDERSIZE    32+1
37 #define MAX_INTERACT       24
38 
39 //action buttons
40 //the order of these buttons are based on opcode #144
41 #define ACT_NONE 100 //iwd2's maximum is 99
42 #define ACT_STEALTH 0
43 #define ACT_THIEVING 1
44 #define ACT_CAST 2
45 #define ACT_QSPELL1 3
46 #define ACT_QSPELL2 4
47 #define ACT_QSPELL3 5
48 #define ACT_TURN 6
49 #define ACT_TALK 7
50 #define ACT_USE 8
51 #define ACT_QSLOT1 9
52 #define ACT_QSLOT4 10 //this seems to be intentionally so
53 #define ACT_QSLOT2 11
54 #define ACT_QSLOT3 12
55 #define ACT_QSLOT5 31 //this is intentional too
56 #define ACT_INNATE 13
57 #define ACT_DEFEND 14 //these are gemrb specific
58 #define ACT_ATTACK 15
59 #define ACT_WEAPON1 16
60 #define ACT_WEAPON2 17
61 #define ACT_WEAPON3 18
62 #define ACT_WEAPON4 19
63 #define ACT_BARDSONG 20
64 #define ACT_STOP 21
65 #define ACT_SEARCH 22
66 #define ACT_SHAPE 23
67 #define ACT_TAMING 24
68 #define ACT_SKILLS 25
69 #define ACT_WILDERNESS 26
70 //gui navigation (scrolling button rows left or right)
71 #define ACT_LEFT 32
72 #define ACT_RIGHT 33
73 #define ACT_BARD   40
74 #define ACT_CLERIC   41
75 #define ACT_DRUID   42
76 #define ACT_PALADIN   43
77 #define ACT_RANGER   44
78 #define ACT_SORCERER   45
79 #define ACT_WIZARD   46
80 #define ACT_DOMAIN   47
81 #define ACT_WILDSHAPE 48
82 
83 #define ACT_IWDQSPELL 50
84 #define ACT_IWDQITEM  60
85 #define ACT_IWDQSPEC  70
86 #define ACT_IWDQSONG  80
87 
88 #define MAX_ACT_COUNT 100
89 
90 #define ES_COUNT 16  //number of iwd2 persistent feat preset values (original iwd2 had only 5)
91 
92 #define GUIBT_COUNT (MAX_QSLOTS + 3)
93 
94 #define FAV_SPELL  0
95 #define FAV_WEAPON 1
96 
97 class GEM_EXPORT PCStatsStruct {
98 public:
99 	ieStrRef  BestKilledName;
100 	ieDword   BestKilledXP;
101 	ieDword   AwayTime;
102 	ieDword   JoinDate;
103 	ieDword   unknown10;
104 	ieDword   KillsChapterXP;
105 	ieDword   KillsChapterCount;
106 	ieDword   KillsTotalXP;
107 	ieDword   KillsTotalCount;
108 	ieResRef  FavouriteSpells[MAX_FAVOURITES];
109 	ieWord    FavouriteSpellsCount[MAX_FAVOURITES];
110 	ieResRef  FavouriteWeapons[MAX_FAVOURITES];
111 	ieWord    FavouriteWeaponsCount[MAX_FAVOURITES];
112 	ieResRef  SoundSet;
113 	char      SoundFolder[SOUNDFOLDERSIZE];
114 	ieDword   ExtraSettings[ES_COUNT];     //iwd2 - expertise, hamstring, arterial strike, etc
115 	ieResRef  QuickSpells[MAX_QSLOTS];     //iwd2 uses 9, others use only 3
116 	ieWord    QuickWeaponSlots[MAX_QUICKWEAPONSLOT]; //iwd2 uses 8, others use only 4
117 	ieWord    QuickWeaponHeaders[MAX_QUICKWEAPONSLOT];
118 	ieWord    QuickItemSlots[MAX_QUICKITEMSLOT];           //pst has 5, others use only 3
119 	ieWord    QuickItemHeaders[MAX_QUICKITEMSLOT];
120 	ieByte    QSlots[GUIBT_COUNT];          //iwd2 specific
121 	ieByte    QuickSpellClass[MAX_QSLOTS];
122 	ieWord    PortraitIcons[MAX_PORTRAIT_ICONS];
123 	ieWord    PreviousPortraitIcons[MAX_PORTRAIT_ICONS];
124 	ieByte    PortraitIconString[MAX_PORTRAIT_ICONS+2];
125 	ieDword   LastLeft;   //trigger
126 	ieDword   LastJoined; //trigger
127 	ieDword   Interact[MAX_INTERACT];
128 	ieWordSigned Happiness;
129 	std::list<int> ClassLevels;
130 private:
131 	void SetQuickItemSlot(int x, int slot, int headerindex);
132 public:
133 	PCStatsStruct();
134 	PCStatsStruct(std::list<int> levels);
135 	PCStatsStruct& operator=(const PCStatsStruct &source);
136 	void Init(bool all=true);
137 	void IncrementChapter();
138 	void NotifyKill(ieDword xp, ieStrRef name);
139 	void InitQuickSlot(unsigned int which, int slot, int headerindex);
140 	void SetSlotIndex(unsigned int which, ieWord headerindex);
141 	void GetSlotAndIndex(unsigned int which, ieWord &slot, ieWord &headerindex);
142 	int GetHeaderForSlot(int slot);
143 	void RegisterFavourite(ieResRef fav, int what);
144 	void UpdateClassLevels(const std::list<int> &levels);
145 };
146 }
147 
148 #endif
149