From: <ch...@us...> - 2011-12-03 12:53:50
|
Revision: 603 http://freesynd.svn.sourceforge.net/freesynd/?rev=603&view=rev Author: chamel Date: 2011-12-03 12:53:44 +0000 (Sat, 03 Dec 2011) Log Message: ----------- states implementation commit #17 Modified Paths: -------------- freesynd/trunk/src/ped.cpp freesynd/trunk/src/ped.h Modified: freesynd/trunk/src/ped.cpp =================================================================== --- freesynd/trunk/src/ped.cpp 2011-12-02 11:39:19 UTC (rev 602) +++ freesynd/trunk/src/ped.cpp 2011-12-03 12:53:44 UTC (rev 603) @@ -193,10 +193,12 @@ case pa_smStanding: action_state_ &= (pa_smAll ^(pa_smFollowing | pa_smFiring | pa_smUsingCar | pa_smInCar)); + action_state_ |= pa_smStanding; break; case pa_smWalking: action_state_ &= (pa_smAll ^(pa_smFollowing | pa_smFiring | pa_smUsingCar | pa_smInCar)); + action_state_ |= pa_smWalking; break; case pa_smHit: action_state_ = pa_smHit; @@ -206,7 +208,8 @@ break; case pa_smFollowing: action_state_ &= (pa_smAll ^(pa_smStanding | pa_smWalking - | pa_smFollowing | pa_smFiring | pa_smUsingCar | pa_smInCar)); + | pa_smFiring | pa_smUsingCar | pa_smInCar)); + action_state_ |= pa_smFollowing; break; case pa_smPickUp: action_state_ = pa_smPickUp; @@ -238,6 +241,58 @@ } } +void PedInstance::switchActionStateFrom(uint32 as) { + switch(as) { + case pa_smNone: + printf("Ped has undefined state"); + break; + case pa_smStanding: + action_state_ ^= pa_smStanding; + break; + case pa_smWalking: + action_state_ ^= pa_smWalking; + action_state_ |= pa_smStanding; + break; + case pa_smHit: + action_state_ ^= pa_smHit; + break; + case pa_smFiring: + action_state_ ^= pa_smFiring; + break; + case pa_smFollowing: + action_state_ ^= pa_smFollowing; + break; + case pa_smPickUp: + action_state_ = pa_smPickUp; + break; + case pa_smPutDown: + action_state_ ^= pa_smPutDown; + break; + case pa_smBurning: + action_state_ ^= pa_smBurning; + break; + case pa_smGetInCar: + action_state_ ^= (pa_smStanding | pa_smGetInCar); + break; + case pa_smUsingCar: + action_state_ ^= (pa_smStanding | pa_smUsingCar); + break; + case pa_smInCar: + action_state_ ^= (pa_smStanding | pa_smInCar); + break; + case pa_smLeaveCar: + action_state_ ^= (pa_smStanding | pa_smLeaveCar); + break; + case pa_smDead: + action_state_ = pa_smDead; + printf("It's alive!"); + break; + case pa_smUnavailable: + action_state_ = pa_smUnavailable; + break; + } +} + #ifdef NEW_ANIMATE_HANDLING bool PedInstance::animate(int elapsed, Mission *mission) { @@ -788,8 +843,10 @@ if ((aqt.state & 16) != 0) { } else if ((aqt.state & 8) != 0) { } else if ((aqt.state & 4) != 0) { + switchActionStateTo(aqt.as); acts_g_prcssd |= aqt.group_desc; } else if ((aqt.state & 2) != 0) { + switchActionStateTo(aqt.as); acts_g_prcssd |= aqt.group_desc; } else if ((aqt.state & 1) != 0) { printf("should not get here"); Modified: freesynd/trunk/src/ped.h =================================================================== --- freesynd/trunk/src/ped.h 2011-12-02 11:39:19 UTC (rev 602) +++ freesynd/trunk/src/ped.h 2011-12-03 12:53:44 UTC (rev 603) @@ -201,6 +201,7 @@ void kill(); void switchActionStateTo(uint32 as); + void switchActionStateFrom(uint32 as); bool animate(int elapsed, Mission *mission); void drawSelectorAnim(int x, int y); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |