CInfButtonArray Class¶
The structure used for this class is CInfButtonArray
Quick Ref |
void CInfButtonArray::CInfButtonArray() |
void CInfButtonArray::~CInfButtonArray() |
int CInfButtonArray::CannotCast(CResRef spl, CGameSprite* sprite) |
int CInfButtonArray::CheckActivation(long buttonId) |
virtual void __cdecl CInfButtonArray::ClearList() |
CString CInfButtonArray::GetButtonBam(int buttonID) |
unsigned char CInfButtonArray::GetButtonId(int buttonType) |
int CInfButtonArray::GetButtonSequence(int buttonID) |
virtual void __cdecl CInfButtonArray::GetQuickSlotData(int nSlot, CButtonData& cButtonData, int nType) |
virtual unsigned char __cdecl CInfButtonArray::GetSelectedModalMode() |
virtual void __cdecl CInfButtonArray::GetSelectedQuickWeaponData(CButtonData& cButtonData) |
int CInfButtonArray::OnLButtonPressed(int buttonID) |
int CInfButtonArray::OnRButtonPressed(int buttonID) |
virtual unsigned char __cdecl CInfButtonArray::PickAbility(CButtonData* pButtonData) |
virtual unsigned char __cdecl CInfButtonArray::PickItem(CButtonData* pButtonData, int instantUse) |
virtual unsigned char __cdecl CInfButtonArray::PickOffInternalList(CButtonData* pButtonData, int instantUse) |
virtual void __cdecl CInfButtonArray::PickQuickSlot(int nButton, int nType) |
virtual unsigned char __cdecl CInfButtonArray::PickSpell(CButtonData* pButtonData, int instantUse) |
int CInfButtonArray::PostRenderButton(CPoint& cRenderLocation, CRect& rClipControl, int bPressed, int buttonID) |
int CInfButtonArray::PreRenderButton(CPoint& cRenderLocation, CRect& rClipControl, int bPressed, int buttonID) |
int CInfButtonArray::ResetState() |
virtual void __cdecl CInfButtonArray::SetQuickSlot(CButtonData* pButtonData, int nButton, int nType) |
int CInfButtonArray::SetState(int nState) |
void CInfButtonArray::SetTooltip(CString sFunctionKey, unsigned long strRef, int hotKey1, int hotKey2, int nButton) |
int CInfButtonArray::UpdateButtons() |
void CInfButtonArray::UpdateState() |
Constructors¶
Name |
Description |
Constructs a |
|
Destroys a |
CInfButtonArray::CInfButtonArray¶
Constructs a CInfButtonArray
object
void CInfButtonArray::CInfButtonArray();
Remarks
Constructs a CInfButtonArray
object
CInfButtonArray::~CInfButtonArray¶
Destroys the CInfButtonArray
object
void CInfButtonArray::~CInfButtonArray();
Remarks
Destroys the CInfButtonArray
object
Methods¶
Name |
Description |
Checks if the specified button id is active (enabled) |
|
Clears all buttons |
|
Return the button id for the specified button type |
|
Returns button frame image if specified button id is selected or not |
|
Get quick slot data for a specified slot |
|
Returns modal state for the currently selected group of characters |
|
Get quick slot data for the selected weapon quick button |
|
Event action for when the left mouse button is clicked and the button is pressed |
|
Event action for when the right mouse button is clicked and the button is pressed |
|
Select a quick slot button that has been assigned to using an ability |
|
Select a quick slot button that has been assigned to using an item |
|
Select a quick slot button that has been assigned to using an internal list |
|
Select a quick slot button that has been assigned to using a weapon, a spell or an item |
|
Select a quick slot button that has been assigned to casting a spell |
|
Draw the specified actionbar button’s icon on top of the prerendered slot |
|
Draw the specified actionbar button’s slot |
|
Resets actionbar buttons state |
|
Customize quick slot button for casting a favourite spell, using an item or ability |
|
Sets actionbar buttons state |
|
Set a tooltip for a button on the actionbar when the mouse hovers over button |
|
Refreshes and updates actionbar buttons: button data and quick slot button data |
|
Updates actionbar buttons state |
CInfButtonArray::CannotCast¶
int CInfButtonArray::CannotCast(
CResRef spl,
CGameSprite* sprite);
Parameters
CResRef spl - resource reference of spell
CGameSprite* sprite - pointer to game sprite object
Return Value
Returns int
Remarks
Called from CInfButtonArray::UpdateButtons
CInfButtonArray::CheckActivation¶
Checks if the specified button id is active (enabled)
int CInfButtonArray::CheckActivation(long buttonId);
Parameters
long
buttonId - id of button to check activation (enabled) status for
Return Value
Returns an int
value reprenting true 1
or false 0
if the button is active (not disabled)
Remarks
buttonId > 30
always returns true
Checks index of button id in CDerivedStats.m_disabledButtons.
If CDerivedStats.m_disabledButtons is 0
(enabled) then CInfButtonArray::CheckActivation returns true 1
, otherwise
If CDerivedStats.m_disabledButtons is 1
(disabled), then CInfButtonArray::CheckActivation returns false 0
CInfButtonArray::ClearList¶
Clears all buttons
virtual void __cdecl CInfButtonArray::ClearList();
Remarks
Frees the list and sets CGameButtonList.m_cButtonDataList to 0
CInfButtonArray::GetButtonBam¶
CString CInfButtonArray::GetButtonBam(int buttonID);
Parameters
int
buttonID - id of button
Return Value
Returns CString
Remarks
CInfButtonArray::GetButtonId¶
Return the button id for the specified button type
unsigned char CInfButtonArray::GetButtonId(int buttonType);
Parameters
int
buttonType - type of button - see remarks for details
Return Value
Returns unsigned char
representing the index (0-``11
] of the buttonType on the actionbar or -1
if error
Remarks
Skips buttons that are disabled. Checks CInfButtonSettings.m_bGreyOut = 0 (enabled) in CInfButtonArray and returns index for that button type, otherwise returns 0xFF
(-1
)
buttonType values can be one of the following:
Button Type ID |
Button Type Notes |
0 |
Left Arrow |
1 |
Right Arrow |
2 |
Bard Song |
3 |
Cast Spell |
4 |
Find Traps |
5 |
Talk |
6 |
Unknown / Blank |
7 |
Guard |
8 |
Attack |
9 |
Shape Change |
10 |
Special Abilities |
11 |
Stealth |
12 |
Thieving |
13 |
Turn Unded |
14 |
Use Item |
15 |
Stop |
16 |
Quick Formation - Rectangle |
17 |
Quick Formation - Defensive Wedge |
18 |
Quick Formation - T-Shape |
19 |
Quick Formation - Offsensive Wedge |
20 |
Quick Formation - Circle |
21 |
Quick Item 1 |
22 |
Quick Item 2 |
23 |
Quick Item 3 |
24 |
Quick Spell 1 |
25 |
Quick Spell 2 |
26 |
Quick Spell 3 |
27 |
Quick Weapon 1 |
28 |
Quick Weapon 2 |
29 |
Quick Weapon 3 |
30 |
Quick Weapon 4 |
43 |
Left Arrow |
44 |
Right Arrow |
67 |
Crashes game - dont use |
100 |
None |
Note: other button types not listed may be available, but typically are used internally for spell buttons and other dynamic buttons for the game engine.
CInfButtonArray::GetButtonSequence¶
Returns button frame image if specified button id is selected or not
int CInfButtonArray::GetButtonSequence(int buttonID);
Parameters
int
buttonID - id of button
Return Value
Returns an int
value representing a pointer to a button frame image
Remarks
Checks CInfButtonSettings.m_bSelected = 0 (enabled) in CInfButtonArray and returns CInfButtonSettings.m_nButtonSelectedFrame if it is otherwise returns CInfButtonSettings.m_nButtonFrame
CInfButtonArray::GetQuickSlotData¶
Get quick slot data for a specified slot
virtual void __cdecl CInfButtonArray::GetQuickSlotData(
int nSlot,
CButtonData& cButtonData,
int nType);
Parameters
int
nSlot -CButtonData& cButtonData - address
int
nType -
Remarks
Fills in quick slot data to a CButtonData structure which is stored at the address of the cButtonData parameter
CInfButtonArray::GetSelectedModalMode¶
Returns modal state for the currently selected group of characters
virtual unsigned char __cdecl CInfButtonArray::GetSelectedModalMode();
Return Value
Returns unsigned char
Remarks
Returns CGameSprite.m_nModalState field value if successful or 0
otherwise
The values that can be returned can be found in MODAL.IDS
:
0 NONE
1 BATTLESONG
2 DETECTTRAPS
3 STEALTH
4 TURNUNDEAD
5 SHAMANDANCE
CInfButtonArray::GetSelectedQuickWeaponData¶
Get quick slot data for the selected weapon quick button
virtual void __cdecl CInfButtonArray::GetSelectedQuickWeaponData(CButtonData& cButtonData);
Parameters
CButtonData& cButtonData -
Remarks
CInfButtonArray::OnLButtonPressed¶
Event action for when the left mouse button is clicked and the button is pressed
int CInfButtonArray::OnLButtonPressed(int buttonID);
Parameters
int
buttonID - id of button pressed
Return Value
Returns int
Remarks
Selects the button pressed
CInfButtonArray::OnRButtonPressed¶
Event action for when the right mouse button is clicked and the button is pressed
int CInfButtonArray::OnRButtonPressed(int buttonID);
Parameters
int
buttonID - id of button pressed
Return Value
Returns int
Remarks
Allows the assignment of quick slot buttons for casting a spell, using an item or ability. See CInfButtonArray::SetQuickSlot
CInfButtonArray::PickAbility¶
Select a quick slot button that has been assigned to using an ability
virtual unsigned char __cdecl CInfButtonArray::PickAbility(CButtonData* pButtonData);
Parameters
CButtonData* pButtonData - pointer to button data
Return Value
Returns unsigned char
- true 1
if succesful or false 0
if ability cannot be used
Remarks
CInfButtonArray::PickItem¶
Select a quick slot button that has been assigned to using an item
virtual unsigned char __cdecl CInfButtonArray::PickItem(
CButtonData* pButtonData,
int instantUse);
Parameters
CButtonData* pButtonData - pointer to button data
int
instantUse - boolean instant use
Return Value
Returns unsigned char
- true 1
if succesful or false 0
if item cannot be used (no charges etc)
Remarks
CInfButtonArray::PickOffInternalList¶
Select a quick slot button that has been assigned to using an internal list
virtual unsigned char __cdecl CInfButtonArray::PickOffInternalList(
CButtonData* pButtonData,
int instantUse);
Parameters
CButtonData* pButtonData - pointer to button data
int
instantUse - boolean instant use
Return Value
Returns unsigned char
Remarks
CInfButtonArray::PickQuickSlot¶
Select a quick slot button that has been assigned to using a weapon, a spell or an item
virtual void __cdecl CInfButtonArray::PickQuickSlot(
int nButton,
int nType);
Parameters
int
nButton - button idint
nType - type of button to set as quick slot button
Remarks
CInfButtonArray::PickSpell¶
Select a quick slot button that has been assigned to casting a spell
virtual unsigned char __cdecl CInfButtonArray::PickSpell(
CButtonData* pButtonData,
int instantUse);
Parameters
CButtonData* pButtonData - pointer to button data
int
instantUse - boolean instant use
Return Value
Returns unsigned char
- true 1
if succesful or false 0
if spell cannot be used (not memorized or already used)
Remarks
See also CInfButtonArray::PostRenderButton
CInfButtonArray::PostRenderButton¶
Draw the specified actionbar button’s icon on top of the prerendered slot
int CInfButtonArray::PostRenderButton(
CPoint& cRenderLocation,
CRect& rClipControl,
int bPressed,
int buttonID);
Parameters
CPoint& cRenderLocation - x and y coordinates of button rendering location
CRect& rClipControl - clipping rectangle for button rendering
int
bPressed - boolean if button is pressed or notint
buttonID - button id for post render
Return Value
Returns int
Remarks
See also CInfButtonArray::PreRenderButton
CInfButtonArray::PreRenderButton¶
Draw the specified actionbar button’s slot
int CInfButtonArray::PreRenderButton(
CPoint& cRenderLocation,
CRect& rClipControl,
int bPressed,
int buttonID);
Parameters
CPoint& cRenderLocation - x and y coordinates of button rendering location
CRect& rClipControl - clipping rectangle for button rendering
int
bPressed - boolean if button is pressed or notint
buttonID - button id for pre render
Return Value
Returns int
Remarks
CInfButtonArray::ResetState¶
Resets actionbar buttons state
int CInfButtonArray::ResetState();
Return Value
Returns int
- always returns true 1
Remarks
Sets CInfButtonArray.m_nState to 0
and sets CInfButtonArray.m_bToggleButtonCleric to 1
CInfButtonArray::SetQuickSlot¶
Customize quick slot button to another type for casting a favourite spell, using an item or special ability
virtual void __cdecl CInfButtonArray::SetQuickSlot(
CButtonData* pButtonData,
int nButton,
int nType);
Parameters
CButtonData* pButtonData - pointer to button data
int
nButton - id of buttonint
nType - type of button to set quick slot button to
Remarks
CInfButtonArray::SetState¶
Sets actionbar buttons state
int CInfButtonArray::SetState(int nState);
Parameters
int
nState - state id to set the actionbar to, see remarks
Return Value
Returns int
Remarks
nState can be one of the following values:
Unique Config |
State(s) |
Notes |
[0] |
1 |
Mage / Sorcerer |
[1] |
2 |
Fighter |
[2] |
3 |
Cleric |
[3] |
4 |
Thief |
[4] |
5 |
Bard |
[5] |
6 |
Paladin |
[6] |
7 |
Fighter Mage |
[7] |
8 |
Fighter Cleric |
[8] |
9 |
Fighter Thief |
[9] |
10 |
Fighter Mage Thief |
[10] |
11 |
Druid |
[11] |
12 |
Ranger |
[12] |
13 |
Mage Thief |
[13] |
14 |
Cleric Mage |
[14] |
15 |
Cleric Thief |
[15] |
16 |
Fighter Druid |
[16] |
17 |
Fighter Mage Cleric |
[17] |
18 |
Cleric Ranger |
[18] |
20 |
Monk |
[19] |
21 |
Shaman |
[20] |
101 |
Select Weapon Ability |
[21] |
102 |
Spells (Select Quick Spell) |
[21] |
103 |
Spells (Cast) |
[22] |
104 |
Select Quick Item Ability |
[22] |
105 |
Use Item |
[23] |
106 |
Special Abilities |
[24] |
107 |
Select Quick Formation |
[25] |
108 |
Defunct Select Quick Formation (Not used) |
[26] |
109 |
Group Selected |
[27] |
110 |
Unknown (No buttons defined; not used?) |
[28] |
111 |
Internal List (Opcode #214) |
[29] |
112 |
Controlled (Class doesn’t have a dedicated state) |
[30] |
113 |
Cleric / Mage Spells (Cast) |
[30] |
114 |
Cleric / Mage Spells (Select Quick Spell) |
Note
“Unique Config” refers to the button types that eventually get set from the state(s) on the right. In a few instances the engine reuses the same button configuration for multiple purposes. You can see this in the Spells config; one state is for setting a quick button, while another is actually for casting.
Each class will have their own default class actionbar. Summoned creatures will use state 112
for their actionbar.
CInfButtonArray::SetTooltip¶
Set a tooltip for a button on the actionbar when the mouse hovers over button
void CInfButtonArray::SetTooltip(
CString sFunctionKey,
unsigned long strRef,
int hotKey1,
int hotKey2,
int nButton);
Parameters
CString sFunctionKey -
unsigned long
strRef - string reference containing tooltip text to displayint
hotKey1 - string reference to hotkey that can activate the buttonint
hotKey2 - string reference to 2nd key in the hotkey combination (if ussed) that can activate the buttonint
nButton - id of button to set tooltip for
Remarks
CInfButtonArray::UpdateButtons¶
Refreshes and updates actionbar buttons: button data and quick slot button data
int CInfButtonArray::UpdateButtons();
Return Value
Returns int
Remarks
CInfButtonArray::UpdateState¶
Updates actionbar buttons state
void CInfButtonArray::UpdateState();
Remarks
EEex Notes¶
Some of the CInfButtonArray methods are directly or indirectly used and/or callable via the EEex ActionBar Functions
EEex_AddActionbarListener - Add a listener function to the actionbar
EEex_GetActionbarButton - Retrieves the type of an actionbar button
EEex_GetActionbarButtonFrame - Returns the current frame of the actionbar button
EEex_GetActionbarState - Returns the state of the actionbar
EEex_GetLastActionbarState - Returns the last state of the actionbar
EEex_IsActionbarButtonDown - Determines if an actionbar button is being clicked
EEex_SetActionbarButton - Sets the type of an actionbar button
EEex_SetActionbarState - Sets the state of the actionbar
EEex_UpdateActionbar - Forces the actionbar to refresh its state
The EEex pattern database (EEex.db
) defines the following labels for use with the EEex_Label function:
CInfButtonArray::OnLButtonPressed()_InvalidSpecialAbility
CInfButtonArray::OnLButtonPressed()_MainSwitchTable
CInfButtonArray::SetState
CInfButtonArray::SetState()_AfterUpdate
CInfButtonArray::SetState()_BeforeUpdate
CInfButtonArray::SetState()_IndirectJumpTable
CInfButtonArray::SetState()_NormalPath
CInfButtonArray::SetTooltip
CInfButtonArray::UpdateButtons
CInfButtonArray::UpdateState