Why it don´t works?!


(Jaquboss) #1

I have tried to implement leaning but I have spend musch time on animation adding.
I am now not talking about animating , but about coding , nothing is shown…
ok I can begin…
I have changed anim movetypes in bg_animation.c

static animStringItem_t animMoveTypesStr[] =
{
	{"** UNUSED **", -1},
	{"IDLE", -1},
	{"IDLECR", -1},
	{"WALK", -1},
	{"WALKBK", -1},
	{"WALKCR", -1},
	{"WALKCRBK", -1},
	{"RUN", -1},
	{"RUNBK", -1},
	{"SWIM", -1},
	{"SWIMBK", -1},
	{"STRAFERIGHT", -1},
	{"STRAFELEFT", -1},
	{"TURNRIGHT", -1},
	{"TURNLEFT", -1},
	{"CLIMBUP", -1},
	{"CLIMBDOWN", -1},
	{"FALLEN", -1},					// DHM - Nerve :: dead, before limbo
	{"PRONE", -1},
	{"PRONEBK", -1},
	{"IDLEPRONE", -1},
	{"FLAILING", -1},
	{"LEANRIGHT", -1},
	{"LEANLEFT", -1},
	{"LEANRIGHTCR", -1},
	{"LEANLEFTCR", -1},

	{NULL, -1},
};

also quoted existing leaning anim code , I want movetype not condition…
Then I have done this

	//LEANING - LEFT

	if (( pm->ps->pm_flags & PMF_LEANLEFT ) && !( pm->ps->pm_flags & PMF_DUCKED )) {
			animResult = BG_AnimScriptAnimation( pm->ps, pm->character->animModelInfo, ANIM_MT_LEANLEFT, qtrue );									 
		return;
	}
	// Crouch
	if (( pm->ps->pm_flags & PMF_LEANLEFT ) && ( pm->ps->pm_flags & PMF_DUCKED) ) {
			animResult = BG_AnimScriptAnimation( pm->ps, pm->character->animModelInfo, ANIM_MT_LEANLEFTCR, qtrue );
		return;
	 }

	//LEANING - RIGHT

	if (( pm->ps->pm_flags & PMF_LEANRIGHT ) && !( pm->ps->pm_flags & PMF_DUCKED )) {
			animResult = BG_AnimScriptAnimation( pm->ps, pm->character->animModelInfo, ANIM_MT_LEANRIGHT, qtrue );									 
		return;
	}
	// Crouch
	if (( pm->ps->pm_flags & PMF_LEANRIGHT ) && ( pm->ps->pm_flags & PMF_DUCKED) ) {
			animResult = BG_AnimScriptAnimation( pm->ps, pm->character->animModelInfo, ANIM_MT_LEANRIGHTCR, qtrue );
		return;
 }

in bg_pmove.c
also in same file i got this

	if (leaning == -1){
		pm->ps->eFlags |= PMF_LEANLEFT;
					}
	else pm->ps->eFlags &= ~PMF_LEANLEFT;

	if (leaning == 1){
		pm->ps->eFlags |= PMF_LEANRIGHT;
					}
		else pm->ps->eFlags &= ~PMF_LEANRIGHT;

in bg_puvlic.h i have changed this :

#define	PMF_LEANLEFT		65536
#define	PMF_LEANRIGHT		131072

#define	PMF_ALL_TIMES	(PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_LOCKPLAYER|PMF_LEANLEFT|PMF_LEANRIGHT)

and this

typedef enum
{
	ANIM_MT_UNUSED,
	ANIM_MT_IDLE,
	ANIM_MT_IDLECR,
	ANIM_MT_WALK,
	ANIM_MT_WALKBK,
	ANIM_MT_WALKCR,
	ANIM_MT_WALKCRBK,
	ANIM_MT_RUN,
	ANIM_MT_RUNBK,
	ANIM_MT_SWIM,
	ANIM_MT_SWIMBK,
	ANIM_MT_STRAFERIGHT,
	ANIM_MT_STRAFELEFT,
	ANIM_MT_TURNRIGHT,
	ANIM_MT_TURNLEFT,
	ANIM_MT_CLIMBUP,
	ANIM_MT_CLIMBDOWN,
	ANIM_MT_FALLEN,					// DHM - Nerve :: dead, before limbo
	ANIM_MT_PRONE,
	ANIM_MT_PRONEBK,
	ANIM_MT_IDLEPRONE,
	ANIM_MT_FLAILING,
//	ANIM_MT_TALK,
	ANIM_MT_SNEAK,
	ANIM_MT_AFTERBATTLE,	// xkan, 1/8/2003, just finished battle
	ANIM_MT_LEANRIGHT,
	ANIM_MT_LEANLEFT,
	ANIM_MT_LEANRIGHTCR,
	ANIM_MT_LEANLEFTCR,

	NUM_ANIM_MOVETYPES
} scriptAnimMoveTypes_t;

then in human_bas.script I have added this

leanleft
	{
		weapons all_two_handed_weapons
		{
			both stand_rifle
		}
		weapons all_one_handed_weapons

		{
			both stand_rifle
		}
	}
	leanright
	{
		weapons all_two_handed_weapons
		{
			both mortar_deployed
		}
		weapons all_one_handed_weapons
		{
			both mortar_deployed
		}
	}
	leanleftcr
	{
		weapons all_two_handed_weapons
		{
			both stand_rifle
		}
		weapons all_one_handed_weapons

		{
			both stand_rifle
		}
	}
	leanrightcr
	{
		weapons all_two_handed_weapons
		{
			both mortar_deployed
		}
		weapons all_one_handed_weapons
		{
			both mortar_deployed
		}
	}

If you see problem please help me , if you don´t have enough , and want to help me , post here email or PM , i can send you WfV SDK , or only changed sources …
Please don´t post OT.
THanks.


(bacon) #2

Where did you put that in the script?
I spent some time working on custom animations a while ago, if I find it I’ll post it :slight_smile:


(Jaquboss) #3

What script? human_base ?
To the same place like in pak0.pk3 of course…