Mapbase v4.2

- Added keyvalue to use random bounds on logic_timer to limit AddToTimer/SubtractFromTimer inputs (suggested by White_Red_Dragons)
- Fixed inconsistent env_projectedtexture state on save/load
- Added code to allow skybox to use a direct entity handle instead of a stored origin and angles in order to take advantage of entity interpolation while moving (less jittering)
- Moved map-specific file manifest parsing to happen after other entities are created (highly experimental)
- Added various misc. code improvements related to debug build and MP branch
- Fixed some VScript ammo type-related code forgotten in the previous update
- Added more VScript functions to CBaseAnimating, including pose parameter functions and the ability to look up bones and get bone position
- Added more origin and angles functions for VScript (suggested by krassell)
This commit is contained in:
Blixibon
2020-07-01 19:32:49 +00:00
parent bc6a35a99c
commit f636089003
24 changed files with 380 additions and 120 deletions

View File

@@ -289,6 +289,12 @@ BEGIN_ENT_SCRIPTDESC( CBaseAnimating, CBaseEntity, "Animating models" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAttachmentAngles, "GetAttachmentAngles", "Get the attachement id's angles as a p,y,r vector" )
#ifdef MAPBASE_VSCRIPT
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAttachmentMatrix, "GetAttachmentMatrix", "Get the attachement id's matrix transform" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetPoseParameter, "GetPoseParameter", "Get the specified pose parameter's value" )
DEFINE_SCRIPTFUNC_NAMED( ScriptSetPoseParameter, "SetPoseParameter", "Set the specified pose parameter to the specified value" )
DEFINE_SCRIPTFUNC( LookupBone, "Get the named bone id" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoneTransform, "GetBoneTransform", "Get the transform for the specified bone" )
DEFINE_SCRIPTFUNC( Dissolve, "" )
DEFINE_SCRIPTFUNC( Scorch, "Makes the entity darker from scorching" )
#endif
DEFINE_SCRIPTFUNC( IsSequenceFinished, "Ask whether the main sequence is done playing" )
DEFINE_SCRIPTFUNC( SetBodygroup, "Sets a bodygroup")
@@ -2166,6 +2172,36 @@ HSCRIPT CBaseAnimating::ScriptGetAttachmentMatrix( int iAttachment )
CBaseAnimating::GetAttachment( iAttachment, matrix );
return ScriptCreateMatrixInstance( matrix );
}
float CBaseAnimating::ScriptGetPoseParameter( const char* szName )
{
CStudioHdr* pHdr = GetModelPtr();
if (pHdr == NULL)
return 0.0f;
int iPoseParam = LookupPoseParameter( pHdr, szName );
return GetPoseParameter( iPoseParam );
}
void CBaseAnimating::ScriptSetPoseParameter( const char* szName, float fValue )
{
CStudioHdr* pHdr = GetModelPtr();
if (pHdr == NULL)
return;
int iPoseParam = LookupPoseParameter( pHdr, szName );
SetPoseParameter( pHdr, iPoseParam, fValue );
}
extern matrix3x4_t *ToMatrix3x4( HSCRIPT hMat );
void CBaseAnimating::ScriptGetBoneTransform( int iBone, HSCRIPT hTransform )
{
if (hTransform == NULL)
return;
GetBoneTransform( iBone, *ToMatrix3x4( hTransform ) );
}
#endif
//-----------------------------------------------------------------------------