- added Grubber's submission for customizable gravity per actor.

- Fixed: A_Jump didn't work for weapons or CustomInventory items.



SVN r456 (trunk)
This commit is contained in:
Christoph Oelckers 2007-01-20 14:27:44 +00:00
commit d0c910fca6
23 changed files with 121 additions and 37 deletions

View file

@ -88,6 +88,7 @@ FState * CallingState;
struct StateCallData
{
FState * State;
AActor * Item;
bool Result;
};
@ -110,6 +111,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState * State)
int counter = 0;
pStateCall = &StateCall;
StateCall.Item = this;
while (State != NULL)
{
// Assume success. The code pointer will set this to false if necessary
@ -387,7 +389,7 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
{
return CallingState + offset;
}
else
else if (self != NULL)
{
offset = -offset;
@ -412,6 +414,7 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
}
return jumpto;
}
else return NULL;
}
//==========================================================================
@ -421,24 +424,29 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
//==========================================================================
static void DoJump(AActor * self, FState * CallingState, int offset)
{
FState *jumpto = P_GetState(self, CallingState, offset);
if (jumpto == NULL) return;
if (pStateCall != NULL && CallingState == pStateCall->State)
{
FState *jumpto = P_GetState(pStateCall->Item, CallingState, offset);
if (jumpto == NULL) return;
pStateCall->State = jumpto;
}
else if (self->player != NULL && CallingState == self->player->psprites[ps_weapon].state)
{
FState *jumpto = P_GetState(self->player->ReadyWeapon, CallingState, offset);
if (jumpto == NULL) return;
P_SetPsprite(self->player, ps_weapon, jumpto);
}
else if (self->player != NULL && CallingState == self->player->psprites[ps_flash].state)
{
FState *jumpto = P_GetState(self->player->ReadyWeapon, CallingState, offset);
if (jumpto == NULL) return;
P_SetPsprite(self->player, ps_flash, jumpto);
}
else
{
FState *jumpto = P_GetState(self, CallingState, offset);
if (jumpto == NULL) return;
self->SetState (jumpto);
}
}
@ -2045,3 +2053,18 @@ void A_PlayerSkinCheck (AActor *actor)
}
}
}
//===========================================================================
//
// A_SetGravity
//
//===========================================================================
void A_SetGravity(AActor * self)
{
int index=CheckIndex(1);
if (index<0) return;
self->gravity = clamp<fixed_t> (EvalExpressionF (StateParameters[index], self), 0, FRACUNIT);
}