A_CusValAction is an action that calls the action of the state specified by Var1, but replaces either or both of the action's Var1/Var2 variables with the actor's custom value depending on Var2:
Var2
|
Modification to apply
|
0
|
Replace new action's Var1 with custom value; Var2 is unchanged
|
1
|
Replace new action's Var2 with custom value; Var1 is unchanged
|
2
|
Replace new action's Var1 with custom value and Var2 with memory value
|
3
|
Replace new action's Var2 with custom value and Var1 with memory value
|
4
|
Replace new action's Var1 with memory value; Var2 is unchanged
|
5
|
Replace new action's Var2 with memory value; Var1 is unchanged
|
This action originates from the v2.0 modification SRB2Morphed and was added to SRB2 itself in v2.1.
Code – A_CusValAction
|
|
// Function: A_CusValAction
//
// Description: Calls an action from a reference state applying custom value parameters.
//
// var1 = state # to use action from
// var2:
// if var2 == 5, only replace new action's var2 with memory value
// else if var2 == 4, only replace new action's var1 with memory value
// else if var2 == 3, replace new action's var2 with custom value and var1 with memory value
// else if var2 == 2, replace new action's var1 with custom value and var2 with memory value
// else if var2 == 1, only replace new action's var2 with custom value
// else if var2 == 0, only replace new action's var1 with custom value
//
void A_CusValAction(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_CusValAction", actor))
return;
#endif
if (locvar2 == 5)
{
var1 = states[locvar1].var1;
var2 = (INT32)actor->cvmem;
}
else if (locvar2 == 4)
{
var1 = (INT32)actor->cvmem;
var2 = states[locvar1].var2;
}
else if (locvar2 == 3)
{
var1 = (INT32)actor->cvmem;
var2 = (INT32)actor->cusval;
}
else if (locvar2 == 2)
{
var1 = (INT32)actor->cusval;
var2 = (INT32)actor->cvmem;
}
else if (locvar2 == 1)
{
var1 = states[locvar1].var1;
var2 = (INT32)actor->cusval;
}
else
{
var1 = (INT32)actor->cusval;
var2 = states[locvar1].var2;
}
#ifdef HAVE_BLUA
astate = &states[locvar1];
#endif
states[locvar1].action.acp1(actor);
}
|
|