Acttable t: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with ''''<code>acttable_t</code>''' is an shared code enum used to translate the generic activities generated by a PlayerAnimState object into ones specific to…')
 
mNo edit summary
Line 1: Line 1:
'''<code>acttable_t</code>''' is an [[shared code]] [[enum]] used to translate the generic [[Activity|activities]] generated by a [[PlayerAnimState]] object into ones specific to the current weapon. For instance, <code>ACT_MP_STAND_IDLE</code> might be translated into <code>ACT_DOD_STAND_AIM_RIFLE</code> by the Rifle weapon.
'''<code>acttable_t</code>''' defines translations between the generic [[Activity|activities]] generated by a [[PlayerAnimState]] object into ones specific to the current weapon. For instance, <code>ACT_MP_STAND_IDLE</code> might be translated into <code>ACT_DOD_STAND_AIM_RIFLE</code> by the Rifle weapon.


If a weapon doesn't have an ActTable, or has an incomplete one, you are likely to find your player models entering "jesus pose" in some conditions.
If a weapon doesn't have an ActTable, or has an incomplete one, you are likely to find your player models entering "jesus pose" in some conditions.


{{bug|<code>ActivityOverride()</code>, which executes an ActTable, is not called from base code. See [[m_PlayerAnimState#Implementation]] to fix this.}}
{{bug|<code>[[CBaseCombatWeapon]]::ActivityOverride()</code>, which executes an ActTable, is not called from base code. See [[m_PlayerAnimState#Implementation]] to fix this.}}


== Implementation ==
== Implementation ==


Add <code>DECLARE_ACTTABLE()</code> to both the client and server classes. Then, in shared code:
Add <code>DECLARE_ACTTABLE()</code> to both the client and server classes. Then, in [[shared code]]:


<source lang=cpp>
<source lang=cpp>

Revision as of 16:16, 2 February 2010

acttable_t defines translations between the generic activities generated by a PlayerAnimState object into ones specific to the current weapon. For instance, ACT_MP_STAND_IDLE might be translated into ACT_DOD_STAND_AIM_RIFLE by the Rifle weapon.

If a weapon doesn't have an ActTable, or has an incomplete one, you are likely to find your player models entering "jesus pose" in some conditions.

Icon-Bug.pngBug:CBaseCombatWeapon::ActivityOverride(), which executes an ActTable, is not called from base code. See m_PlayerAnimState#Implementation to fix this.  [todo tested in ?]

Implementation

Add DECLARE_ACTTABLE() to both the client and server classes. Then, in shared code:

acttable_t CMyWeapon::m_acttable[] = 
{
	{ ACT_MP_STAND_IDLE,	ACT_MYMOD_STAND_AIM_MYWEAPON,	false },
	{ ACT_MP_CROUCH_IDLE,	ACT_MYMOD_CROUCH_AIM_MYWEAPON,	false },
	{ ACT_MP_RUN,		ACT_MYMOD_RUN_MYWEAPON,		false },
	// etc.
};

IMPLEMENT_ACTTABLE( CMyWeapon );

The third value is whether the animation is "required" or not.

Todo: Meaning of this.