- Added the A_JumpSet function for what seems to be a fairly common scenario.
It is like A_Jump, except it accepts up to 20 jump targets. The jump probability is still the first parameter and controls whether any jump is taken at all; use 256 if you always want to jump. If a jump is taken, then one of the jump targets will be chosen at random, with each target having an equal chance of being chosen. - Fixed: The unfreeze ccmd was not multiplayer-safe. And I renamed it to thaw, since it has nothing to do with the freeze ccmd. SVN r360 (trunk)
This commit is contained in:
parent
0d5e3cf97e
commit
2efba66558
6 changed files with 46 additions and 2 deletions
|
|
@ -413,6 +413,28 @@ void A_Jump(AActor * self)
|
|||
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains!
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// State jump function
|
||||
//
|
||||
//==========================================================================
|
||||
void A_JumpSet(AActor * self)
|
||||
{
|
||||
FState * CallingState;
|
||||
int index=CheckIndex(21, &CallingState);
|
||||
int i;
|
||||
|
||||
if (index>=0 && pr_cajump() < clamp<int>(EvalExpressionI (StateParameters[index], self), 0, 256))
|
||||
{
|
||||
// Find out how many targets are actually used
|
||||
for (i = 0; i < 20 && StateParameters[index+i+1] != 0; ++i)
|
||||
{ }
|
||||
DoJump(self, CallingState, StateParameters[index + (pr_cajump() % i) + 1]);
|
||||
}
|
||||
|
||||
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains!
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// State jump function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue