diff options
-rw-r--r-- | Makefile | 24 | ||||
-rw-r--r-- | src/game/bg_local.h | 5 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 141 | ||||
-rw-r--r-- | src/game/bg_public.h | 6 |
4 files changed, 138 insertions, 38 deletions
@@ -158,6 +158,12 @@ Q3ASM=q3asm Q3ASM_FLAGS= +# --source level flags-- + +SLF_GAME_FLAGS=-D__GAME__ +SLF_CGAME_FLAGS=-D__CGAME__ +SLF_UI_FLAGS=-D__UI__ + # --main targets-- all: release debug qvm @@ -244,39 +250,39 @@ $(BQ)/ui.qvm: $(UIQVMOBJ) $(BQ)/$(GDIRNAME)/bg_lib.asm # --rules for the objects-- #release g_*.o $(BR)/$(GDIRNAME)/%.o: $(GDIR)/%.c - $(CC) $(RELEASE_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + $(CC) $(RELEASE_CFLAGS) $(SLF_GAME_FLAGS) $(SHLIBCFLAGS) -o $@ -c $< #debug g_*.o $(BD)/$(GDIRNAME)/%.o: $(GDIR)/%.c - $(CC) $(DEBUG_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + $(CC) $(DEBUG_CFLAGS) $(SLF_GAME_FLAGS) $(SHLIBCFLAGS) -o $@ -c $< #qvm g_*.asm $(BQ)/$(GDIRNAME)/%.asm: $(GDIR)/%.c - $(LCC) $(LCC_FLAGS) $(LCC_INCLUDES) -o $@ $< + $(LCC) $(LCC_FLAGS) $(SLF_GAME_FLAGS) $(LCC_INCLUDES) -o $@ $< #release cg_*.o $(BR)/$(CGDIRNAME)/%.o: $(CGDIR)/%.c - $(CC) $(RELEASE_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + $(CC) $(RELEASE_CFLAGS) $(SLF_CGAME_FLAGS) $(SHLIBCFLAGS) -o $@ -c $< #debug cg_*.o $(BD)/$(CGDIRNAME)/%.o: $(CGDIR)/%.c - $(CC) $(DEBUG_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + $(CC) $(DEBUG_CFLAGS) $(SLF_CGAME_FLAGS) $(SHLIBCFLAGS) -o $@ -c $< #qvm cg_*.asm $(BQ)/$(CGDIRNAME)/%.asm: $(CGDIR)/%.c - $(LCC) $(LCC_FLAGS) $(LCC_INCLUDES) -o $@ $< + $(LCC) $(LCC_FLAGS) $(SLF_CGAME_FLAGS) $(LCC_INCLUDES) -o $@ $< #release ui_*.o $(BR)/$(UIDIRNAME)/%.o: $(UIDIR)/%.c - $(CC) $(RELEASE_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + $(CC) $(RELEASE_CFLAGS) $(SLF_UI_FLAGS) $(SHLIBCFLAGS) -o $@ -c $< #debug ui_*.o $(BD)/$(UIDIRNAME)/%.o: $(UIDIR)/%.c - $(CC) $(DEBUG_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + $(CC) $(DEBUG_CFLAGS) $(SLF_UI_FLAGS) $(SHLIBCFLAGS) -o $@ -c $< #qvm ui_*.asm $(BQ)/$(UIDIRNAME)/%.asm: $(UIDIR)/%.c - $(LCC) $(LCC_FLAGS) $(LCC_INCLUDES) -o $@ $< + $(LCC) $(LCC_FLAGS) $(SLF_UI_FLAGS) $(LCC_INCLUDES) -o $@ $< # --cleaning rules-- diff --git a/src/game/bg_local.h b/src/game/bg_local.h index f7d4c00d..8a6d99b3 100644 --- a/src/game/bg_local.h +++ b/src/game/bg_local.h @@ -21,8 +21,9 @@ #define JUMP_VELOCITY 270 -#define TIMER_LAND 130 -#define TIMER_GESTURE (34*66+50) +#define TIMER_LAND 130 +#define TIMER_GESTURE (34*66+50) +#define TIMER_ATTACK 500 //nonsegmented models #define OVERCLIP 1.001f diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 9dd7a1fc..5c57a6f7 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -93,29 +93,62 @@ static void PM_StartTorsoAnim( int anim ) | anim; } +/* +=================== +PM_StartLegsAnim +=================== +*/ static void PM_StartLegsAnim( int anim ) { if( pm->ps->pm_type >= PM_DEAD ) return; - if( pm->ps->legsTimer > 0 ) - return; // a high priority animation is running + //legsTimer is clamped too tightly for nonsegmented models + if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) + { + if( pm->ps->legsTimer > 0 ) + return; // a high priority animation is running + } + else + { + if( pm->ps->torsoTimer > 0 ) + return; // a high priority animation is running + } pm->ps->legsAnim = ( ( pm->ps->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; } +/* +=================== +PM_ContinueLegsAnim +=================== +*/ static void PM_ContinueLegsAnim( int anim ) { if( ( pm->ps->legsAnim & ~ANIM_TOGGLEBIT ) == anim ) return; - if( pm->ps->legsTimer > 0 ) - return; // a high priority animation is running + //legsTimer is clamped too tightly for nonsegmented models + if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) + { + if( pm->ps->legsTimer > 0 ) + return; // a high priority animation is running + } + else + { + if( pm->ps->torsoTimer > 0 ) + return; // a high priority animation is running + } PM_StartLegsAnim( anim ); } +/* +=================== +PM_ContinueTorsoAnim +=================== +*/ static void PM_ContinueTorsoAnim( int anim ) { if( ( pm->ps->torsoAnim & ~ANIM_TOGGLEBIT ) == anim ) @@ -127,9 +160,19 @@ static void PM_ContinueTorsoAnim( int anim ) PM_StartTorsoAnim( anim ); } +/* +=================== +PM_ForceLegsAnim +=================== +*/ static void PM_ForceLegsAnim( int anim ) { - pm->ps->legsTimer = 0; + //legsTimer is clamped too tightly for nonsegmented models + if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) + pm->ps->legsTimer = 0; + else + pm->ps->torsoTimer = 0; + PM_StartLegsAnim( anim ); } @@ -1251,7 +1294,10 @@ static void PM_CrashLand( void ) PM_ForceLegsAnim( NSPA_LAND ); } - pm->ps->legsTimer = TIMER_LAND; + if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) + pm->ps->legsTimer = TIMER_LAND; + else + pm->ps->torsoTimer = TIMER_LAND; // calculate the exact velocity on landing dist = pm->ps->origin[ 2 ] - pml.previous_origin[ 2 ]; @@ -2054,14 +2100,28 @@ static void PM_Footsteps( void ) if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_ContinueLegsAnim( LEGS_BACKCR ); else - PM_ContinueLegsAnim( NSPA_WALKBACK ); + { + if( pm->cmd.rightmove > 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKRIGHT ); + else if( pm->cmd.rightmove < 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKLEFT ); + else + PM_ContinueLegsAnim( NSPA_WALKBACK ); + } } else { if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_ContinueLegsAnim( LEGS_WALKCR ); else - PM_ContinueLegsAnim( NSPA_WALK ); + { + if( pm->cmd.rightmove > 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKRIGHT ); + else if( pm->cmd.rightmove < 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKLEFT ); + else + PM_ContinueLegsAnim( NSPA_WALK ); + } } // ducked characters never play footsteps @@ -2088,14 +2148,28 @@ static void PM_Footsteps( void ) if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_ContinueLegsAnim( LEGS_BACK ); else - PM_ContinueLegsAnim( NSPA_RUNBACK ); + { + if( pm->cmd.rightmove > 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_RUNRIGHT ); + else if( pm->cmd.rightmove < 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_RUNLEFT ); + else + PM_ContinueLegsAnim( NSPA_RUNBACK ); + } } else { if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_ContinueLegsAnim( LEGS_RUN ); else - PM_ContinueLegsAnim( NSPA_RUN ); + { + if( pm->cmd.rightmove > 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_RUNRIGHT ); + else if( pm->cmd.rightmove < 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_RUNLEFT ); + else + PM_ContinueLegsAnim( NSPA_RUN ); + } } footstep = qtrue; @@ -2108,14 +2182,28 @@ static void PM_Footsteps( void ) if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_ContinueLegsAnim( LEGS_BACKWALK ); else - PM_ContinueLegsAnim( NSPA_WALKBACK ); + { + if( pm->cmd.rightmove > 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKRIGHT ); + else if( pm->cmd.rightmove < 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKLEFT ); + else + PM_ContinueLegsAnim( NSPA_WALKBACK ); + } } else { if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_ContinueLegsAnim( LEGS_WALK ); else - PM_ContinueLegsAnim( NSPA_WALK ); + { + if( pm->cmd.rightmove > 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKRIGHT ); + else if( pm->cmd.rightmove < 0 && !pm->cmd.forwardmove ) + PM_ContinueLegsAnim( NSPA_WALKLEFT ); + else + PM_ContinueLegsAnim( NSPA_WALK ); + } } } } @@ -2522,7 +2610,10 @@ static void PM_Weapon( void ) if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) PM_StartTorsoAnim( TORSO_ATTACK ); else - PM_ForceLegsAnim( NSPA_ATTACK1 ); + { + PM_ForceLegsAnim( NSPA_ATTACK3 ); + pm->ps->torsoTimer = TIMER_ATTACK; + } pm->ps->weaponstate = WEAPON_FIRING; @@ -2577,23 +2668,23 @@ static void PM_Animate( void ) { if( pm->cmd.buttons & BUTTON_GESTURE ) { - if( pm->ps->torsoTimer == 0 ) - { - PM_StartTorsoAnim( TORSO_GESTURE ); - - pm->ps->torsoTimer = TIMER_GESTURE; - PM_AddEvent( EV_TAUNT ); - } - else if( pm->ps->legsTimer == 0 ) + if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) { - if( ( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) + if( pm->ps->torsoTimer == 0 ) { - PM_ForceLegsAnim( NSPA_GESTURE ); - pm->ps->legsTimer = TIMER_GESTURE; - + PM_StartTorsoAnim( TORSO_GESTURE ); + pm->ps->torsoTimer = TIMER_GESTURE; + PM_AddEvent( EV_TAUNT ); } } + else + { + PM_ForceLegsAnim( NSPA_GESTURE ); + pm->ps->torsoTimer = TIMER_GESTURE; + + PM_AddEvent( EV_TAUNT ); + } } } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 89eae495..f29f8ca5 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -638,8 +638,10 @@ typedef enum NSPA_RUN, NSPA_RUNBACK, - NSPA_STRAFELEFT, - NSPA_STRAFERIGHT, + NSPA_RUNLEFT, + NSPA_WALKLEFT, + NSPA_RUNRIGHT, + NSPA_WALKRIGHT, NSPA_SWIM, |