mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
wip: staterange actions
# Conflicts: # src/doomdef.h
This commit is contained in:
parent
09885ce34b
commit
ed00874f5f
3 changed files with 51 additions and 0 deletions
|
|
@ -207,6 +207,8 @@ actionpointer_t actionpointers[] =
|
|||
{{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"},
|
||||
{{A_RandomState}, "A_RANDOMSTATE"},
|
||||
{{A_RandomStateRange}, "A_RANDOMSTATERANGE"},
|
||||
{{A_StateRangeByAngle}, "A_STATERANGEBYANGLE"},
|
||||
{{A_StateRangeByParameter}, "A_STATERANGEBYPARAMETER"},
|
||||
{{A_DualAction}, "A_DUALACTION"},
|
||||
{{A_RemoteAction}, "A_REMOTEACTION"},
|
||||
{{A_ToggleFlameJet}, "A_TOGGLEFLAMEJET"},
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ enum actionnum
|
|||
A_SETOBJECTFLAGS2,
|
||||
A_RANDOMSTATE,
|
||||
A_RANDOMSTATERANGE,
|
||||
A_STATERANGEBYANGLE,
|
||||
A_STATERANGEBYPARAMETER,
|
||||
A_DUALACTION,
|
||||
A_REMOTEACTION,
|
||||
A_TOGGLEFLAMEJET,
|
||||
|
|
@ -428,6 +430,8 @@ void A_SetObjectFlags();
|
|||
void A_SetObjectFlags2();
|
||||
void A_RandomState();
|
||||
void A_RandomStateRange();
|
||||
void A_StateRangeByAngle();
|
||||
void A_StateRangeByParameter();
|
||||
void A_DualAction();
|
||||
void A_RemoteAction();
|
||||
void A_ToggleFlameJet();
|
||||
|
|
|
|||
|
|
@ -187,6 +187,8 @@ void A_SetObjectFlags(mobj_t *actor);
|
|||
void A_SetObjectFlags2(mobj_t *actor);
|
||||
void A_RandomState(mobj_t *actor);
|
||||
void A_RandomStateRange(mobj_t *actor);
|
||||
void A_StateRangeByAngle(mobj_t *actor);
|
||||
void A_StateRangeByParameter(mobj_t *actor);
|
||||
void A_DualAction(mobj_t *actor);
|
||||
void A_RemoteAction(mobj_t *actor);
|
||||
void A_ToggleFlameJet(mobj_t *actor);
|
||||
|
|
@ -8132,6 +8134,49 @@ void A_RandomStateRange(mobj_t *actor)
|
|||
P_SetMobjState(actor, P_RandomRange(locvar1, locvar2));
|
||||
}
|
||||
|
||||
// Function: A_StateRangeByAngle
|
||||
//
|
||||
// Description: Chooses a state within the range supplied, depending on the actor's angle.
|
||||
//
|
||||
// var1 = Minimum state number to use.
|
||||
// var2 = Maximum state number to use. The difference will act as a modulo operator.
|
||||
//
|
||||
void A_StateRangeByAngle(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
|
||||
if (LUA_CallAction(A_STATERANGEBYANGLE, actor))
|
||||
return;
|
||||
|
||||
if (locvar2 - locvar1 < 0)
|
||||
return; // invalid range
|
||||
|
||||
P_SetMobjState(actor, locvar1 + (AngleFixed(actor->angle)>>FRACBITS % (1 + locvar2 - locvar1)));
|
||||
}
|
||||
|
||||
// Function: A_StateRangeByParameter
|
||||
//
|
||||
// Description: Chooses a state within the range supplied, depending on the actor's parameter/extrainfo value.
|
||||
//
|
||||
// var1 = Minimum state number to use.
|
||||
// var2 = Maximum state number to use. The difference will act as a modulo operator.
|
||||
//
|
||||
void A_StateRangeByParameter(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
UINT8 parameter = (actor->spawnpoint ? actor->spawnpoint->extrainfo : 0);
|
||||
|
||||
if (LUA_CallAction(A_STATERANGEBYANGLE, actor))
|
||||
return;
|
||||
|
||||
if (locvar2 - locvar1 < 0)
|
||||
return; // invalid range
|
||||
|
||||
P_SetMobjState(actor, locvar1 + (parameter % (1 + locvar2 - locvar1)));
|
||||
}
|
||||
|
||||
// Function: A_DualAction
|
||||
//
|
||||
// Description: Calls two actions. Be careful, if you reference the same state this action is called from, you can create an infinite loop.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue