Пример #1
0
/*
===============
UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char* headmodel ) {
	memset( pi, 0, sizeof(*pi) );
	UI_RegisterClientModelname( pi, model, headmodel );
	pi->weapon = WP_PHASER;
	pi->currentWeapon = pi->weapon;
	pi->lastWeapon = pi->weapon;
	pi->pendingWeapon = (weapon_t) -1;
	pi->weaponTimer = 0;
	pi->chat = qfalse;
	UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
Пример #2
0
/*
===============
UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model ) {
    memset( pi, 0, sizeof(*pi) );
    UI_RegisterClientModelname( pi, model );
    pi->weapon = WP_PEACEMAKER;
    pi->currentWeapon = pi->weapon;
    pi->lastWeapon = pi->weapon;
    pi->pendingWeapon = -1;
    pi->weaponTimer = 0;
    pi->chat = qfalse;
    pi->newModel = qtrue;
    UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
Пример #3
0
/*
===============
UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char *headmodel, char *teamName ) {
	memset( pi, 0, sizeof(*pi) );
	UI_RegisterClientModelname( pi, model, headmodel, teamName );
	pi->weapon = WP_MACHINEGUN;
	pi->currentWeapon = pi->weapon;
	pi->lastWeapon = pi->weapon;
	pi->pendingWeapon = -1;
	pi->weaponTimer = 0;
	pi->chat = qfalse;
	pi->newModel = qtrue;
	UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
Пример #4
0
/*
===============
UI_TorsoSequencing
===============
*/
static void UI_TorsoSequencing( uiPlayerInfo_t *pi ) {
	int		currentAnim;

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( pi->weapon != pi->currentWeapon ) {
		if ( currentAnim != TORSO_DROP ) {
			pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
			UI_ForceTorsoAnim( pi, TORSO_DROP );
		}
	}

	if ( pi->torsoAnimationTimer > 0 ) {
		return;
	}

	if( currentAnim == TORSO_GESTURE ) {
#ifdef TA_WEAPSYS
		UI_SetTorsoAnim( pi, BG_TorsoStandForWeapon(pi->realWeapon) );
#else
		UI_SetTorsoAnim( pi, TORSO_STAND );
#endif
		return;
	}

#ifdef TA_WEAPSYS
	if (BG_PlayerAttackAnim(currentAnim)) {
		UI_SetTorsoAnim( pi, BG_TorsoStandForWeapon(pi->realWeapon) );
		return;
	}
#else
	if( currentAnim == TORSO_ATTACK || currentAnim == TORSO_ATTACK2 ) {
		UI_SetTorsoAnim( pi, TORSO_STAND );
		return;
	}
#endif

	if ( currentAnim == TORSO_DROP ) {
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
		UI_ForceTorsoAnim( pi, TORSO_RAISE );
		return;
	}

	if ( currentAnim == TORSO_RAISE ) {
#ifdef TA_WEAPSYS
		UI_SetTorsoAnim( pi, BG_TorsoStandForWeapon(pi->realWeapon) );
#else
		UI_SetTorsoAnim( pi, TORSO_STAND );
#endif
		return;
	}
}
Пример #5
0
/*
===============
UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model ) {
	memset( pi, 0, sizeof( *pi ) );
	UI_RegisterClientModelname( pi, model );
//	pi->weapon = WP_MACHINEGUN;
//	pi->weapon = WP_MP40;
	pi->currentWeapon = pi->weapon;
	pi->lastWeapon = pi->weapon;
	pi->pendingWeapon = WP_NUM_WEAPONS;
	pi->weaponTimer = 0;
	pi->chat = qfalse;
	pi->newModel = qtrue;
	UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
Пример #6
0
/*
===============
UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( uiPlayerInfo_t *pi, const char *model, const char *headmodel, char *teamName ) {
	memset( pi, 0, sizeof(*pi) );
	UI_RegisterPlayerModelname( pi, model, headmodel, teamName );
#if defined TA_PLAYERSYS && defined TA_WEAPSYS
	pi->weapon = pi->playercfg.default_weapon;
#else
	pi->weapon = WP_MACHINEGUN;
#endif
	pi->currentWeapon = pi->weapon;
	pi->lastWeapon = pi->weapon;
	pi->pendingWeapon = WP_NUM_WEAPONS;
	pi->weaponTimer = 0;
	pi->chat = qfalse;
	pi->newModel = qtrue;
	UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
Пример #7
0
/*
===============
UI_TorsoSequencing
===============
*/
static void UI_TorsoSequencing( playerInfo_t *pi )
{
	int currentAnim;

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( pi->weapon != pi->currentWeapon )
	{
		if ( currentAnim != TORSO_DROP )
		{
			pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
			UI_ForceTorsoAnim( pi, TORSO_DROP );
		}
	}

	if ( pi->torsoAnimationTimer > 0 )
	{
		return;
	}

	if ( currentAnim == TORSO_GESTURE )
	{
		UI_SetTorsoAnim( pi, TORSO_STAND );
		return;
	}

	if ( currentAnim == TORSO_ATTACK || currentAnim == TORSO_ATTACK2 )
	{
		UI_SetTorsoAnim( pi, TORSO_STAND );
		return;
	}

	if ( currentAnim == TORSO_DROP )
	{
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
		UI_ForceTorsoAnim( pi, TORSO_RAISE );
		return;
	}

	if ( currentAnim == TORSO_RAISE )
	{
		UI_SetTorsoAnim( pi, TORSO_STAND );
		return;
	}
}
Пример #8
0
/*
===============
UI_TorsoSequencing
===============
*/
static void UI_TorsoSequencing( playerInfo_t *pi ) {
	int		currentAnim;

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( pi->weapon != pi->currentWeapon ) {
		if ( currentAnim != TORSO_DROPWEAP1 ) {
			pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
			UI_ForceTorsoAnim( pi, TORSO_DROPWEAP1 );
		}
	}

	if ( pi->torsoAnimationTimer > 0 ) {
		return;
	}

	if( currentAnim == BOTH_GESTURE1 ) {
		UI_SetTorsoAnim( pi, TORSO_WEAPONREADY3 );
		return;
	}

	if( currentAnim == BOTH_ATTACK3 || currentAnim == BOTH_A1_T__B_ ) {
		UI_SetTorsoAnim( pi, TORSO_WEAPONREADY3 );
		return;
	}

	if ( currentAnim == TORSO_DROPWEAP1 ) {
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
		UI_ForceTorsoAnim( pi, TORSO_RAISEWEAP1 );
		return;
	}

	if ( currentAnim == TORSO_RAISEWEAP1 ) {
		UI_SetTorsoAnim( pi, TORSO_WEAPONREADY3 );
		return;
	}
}
Пример #9
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qbool chat ) {
    int			currentAnim;
    weapon_t	weaponNum;

    pi->chat = chat;

    // view angles
    VectorCopy( viewAngles, pi->viewAngles );

    // move angles
    VectorCopy( moveAngles, pi->moveAngles );

    if ( pi->newModel ) {
        pi->newModel = qfalse;

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim( pi, legsAnim );
        pi->legs.yawAngle = viewAngles[YAW];
        pi->legs.yawing = qfalse;

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim( pi, torsoAnim );
        pi->torso.yawAngle = viewAngles[YAW];
        pi->torso.yawing = qfalse;

        if ( weaponNumber != -1 ) {
            pi->weapon = weaponNumber;
            pi->currentWeapon = weaponNumber;
            pi->lastWeapon = weaponNumber;
            pi->pendingWeapon = -1;
            pi->weaponTimer = 0;
            UI_PlayerInfo_SetWeapon( pi, pi->weapon );
        }

        return;
    }

    // weapon
    if ( weaponNumber == -1 ) {
        pi->pendingWeapon = -1;
        pi->weaponTimer = 0;
    }
    else if ( weaponNumber != WP_NONE ) {
        pi->pendingWeapon = weaponNumber;
        pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
    }
    weaponNum = pi->lastWeapon;
    pi->weapon = weaponNum;

    if ( torsoAnim == BOTH_DEATH_DEFAULT || legsAnim == BOTH_DEATH_DEFAULT ) {
        torsoAnim = legsAnim = BOTH_DEATH_DEFAULT;
        pi->weapon = pi->currentWeapon = WP_NONE;
        UI_PlayerInfo_SetWeapon( pi, pi->weapon );

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim( pi, legsAnim );

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim( pi, torsoAnim );

        return;
    }

    // leg animation
    currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
    if ( legsAnim != currentAnim ) {
        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim( pi, legsAnim );
    }

    // torso animation
    if ( torsoAnim == TORSO_PISTOL_STAND || torsoAnim == TORSO_RIFLE_STAND ) {
        if ( weaponNum == WP_NONE || weaponNum == WP_KNIFE ) {
            torsoAnim = TORSO_KNIFE_STAND;
        }
        else {
            torsoAnim = TORSO_PISTOL_STAND;
        }
    }

    if ( torsoAnim == TORSO_PISTOL_ATTACK || torsoAnim == TORSO_RIFLE_ATTACK ) {
        if ( weaponNum == WP_NONE || weaponNum == WP_KNIFE ) {
            torsoAnim = TORSO_KNIFE_ATTACK;
        }
        else {
            torsoAnim = TORSO_PISTOL_ATTACK;
        }
        pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
        //FIXME play firing sound here
    }

    currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

    if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_PISTOL_RAISE || currentAnim == TORSO_PISTOL_DROP ) {
        pi->pendingTorsoAnim = torsoAnim;
    }
    else if ( ( currentAnim == TORSO_TAUNT_PISTOL || currentAnim == TORSO_PISTOL_ATTACK ) && ( torsoAnim != currentAnim ) ) {
        pi->pendingTorsoAnim = torsoAnim;
    }
    else if ( torsoAnim != currentAnim ) {
        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim( pi, torsoAnim );
    }
}
Пример #10
0
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName ) {
	char modelName[MAX_QPATH];
	char skinName[MAX_QPATH];
	char filename[MAX_QPATH];
	char        *slash;
	const char* backpack = NULL;
	const char* helmet = NULL;

	pi->torsoModel = 0;
	pi->headModel = 0;

	if ( !modelSkinName[0] ) {
		return qfalse;
	}

	Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );

	slash = strchr( modelName, '/' );
	if ( !slash ) {
		// modelName did not include a skin name
		Q_strncpyz( skinName, "default", sizeof( skinName ) );
	} else {
		Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
		// truncate modelName
		*slash = 0;
	}

	// NERVE - SMF - set weapon
	pi->weapon = WM_getWeaponIndex();
	UI_PlayerInfo_SetWeapon( pi, pi->weapon );

	// NERVE - SMF - determine skin
	{
		const char *team;
		const char *playerClass;
		int var, teamval;

		teamval = trap_Cvar_VariableValue( "mp_team" );

		if ( teamval == 1 ) {
			team = "blue";
		} else {
			team = "red";
		}

		var = trap_Cvar_VariableValue( "mp_playerType" );

		if ( var == 0 ) {
			playerClass = "soldier";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_sol.md3";
				helmet = "acc/helmet_american/sol.md3";
			} else {
				backpack = "acc/backpack/backpack_german_sol.md3";
				helmet = "acc/helmet_german/helmet_german_sol.md3";
			}
		} else if ( var == 1 )   {
			playerClass = "medic";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_med.md3";
				helmet = "acc/helmet_american/med.md3";
			} else {
				backpack = "acc/backpack/backpack_german_med.md3";
				helmet = "acc/helmet_german/helmet_german_med.md3";
			}
		} else if ( var == 2 )   {
			playerClass = "engineer";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_eng.md3";
				helmet = "acc/helmet_american/eng.md3";
			} else {
				backpack = "acc/backpack/backpack_german_eng.md3";
				helmet = "acc/helmet_german/helmet_german_eng.md3";
			}
		} else {
			playerClass = "lieutenant";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_lieu.md3";
				helmet = "acc/helmet_american/lieu.md3";
			} else {
				backpack = "acc/backpack/backpack_german_lieu.md3";
				helmet = "acc/helmet_american/lieu.md3";
			}
		}

		strcpy( skinName, va( "%s%s1", team, playerClass ) );
	}
	// -NERVE - SMF

//		Q_strncpyz( skinName, "bluesoldier1", sizeof( skinName ) );		// NERVE - SMF - make this work with wolf - TESTING!!!
//	}
//	else {
//		Q_strncpyz( skinName, "redsoldier1", sizeof( skinName ) );		// NERVE - SMF - make this work with wolf - TESTING!!!
//	}

	// load cmodels before models so filecache works

//	Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/body.mds", modelName ); // NERVE - SMF - make this work with wolf
	pi->legsModel = trap_R_RegisterModel( filename );
	if ( !pi->legsModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

//	Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/body.mds", modelName ); // NERVE - SMF - make this work with wolf
	pi->torsoModel = trap_R_RegisterModel( filename );
	if ( !pi->torsoModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", modelName );
	pi->headModel = trap_R_RegisterModel( filename );
	if ( !pi->headModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	// NERVE - SMF - load backpack and helmet
	if ( backpack ) {
		pi->backpackModel = trap_R_RegisterModel( va( "models/players/%s/%s", modelName, backpack ) );
	}

	if ( helmet ) {
		pi->helmetModel = trap_R_RegisterModel( va( "models/players/%s/%s", modelName, helmet ) );
	}

	// if any skins failed to load, fall back to default
	if ( !UI_RegisterClientSkin( pi, modelName, skinName ) ) {
		if ( !UI_RegisterClientSkin( pi, modelName, "default" ) ) {
			Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
			return qfalse;
		}
	}

	// load the animations
//----(SA) changing name of config file to avoid backwards or alternate compatibility confustion
//	Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/wolfanim.cfg", modelName );
//----(SA) end
	if ( !UI_ParseAnimationFile( filename, pi ) ) {         // NERVE - SMF - make this work with wolf
		Com_Printf( "Failed to load animation file %s\n", filename );
		return qfalse;
	}

	return qtrue;
}
Пример #11
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo(playerInfo_t* pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat) {
    int         currentAnim;
    weapon_t    weaponNum;
    int         c;

    pi->chat = chat;

    c = (int)trap_Cvar_VariableValue("color1");

    VectorClear(pi->color1);

    if (c < 1 || c > 7) {
        VectorSet(pi->color1, 1, 1, 1);
    } else {
        if (c & 1) {
            pi->color1[2] = 1.0f;
        }

        if (c & 2) {
            pi->color1[1] = 1.0f;
        }

        if (c & 4) {
            pi->color1[0] = 1.0f;
        }
    }

    pi->c1RGBA[0] = 255 * pi->color1[0];
    pi->c1RGBA[1] = 255 * pi->color1[1];
    pi->c1RGBA[2] = 255 * pi->color1[2];
    pi->c1RGBA[3] = 255;

    // view angles
    VectorCopy(viewAngles, pi->viewAngles);

    // move angles
    VectorCopy(moveAngles, pi->moveAngles);

    if (pi->newModel) {
        pi->newModel = qfalse;

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim(pi, legsAnim);
        pi->legs.yawAngle = viewAngles[YAW];
        pi->legs.yawing = qfalse;

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim(pi, torsoAnim);
        pi->torso.yawAngle = viewAngles[YAW];
        pi->torso.yawing = qfalse;

        if (weaponNumber != -1) {
            pi->weapon = weaponNumber;
            pi->currentWeapon = weaponNumber;
            pi->lastWeapon = weaponNumber;
            pi->pendingWeapon = -1;
            pi->weaponTimer = 0;
            UI_PlayerInfo_SetWeapon(pi, pi->weapon);
        }

        return;
    }

    // weapon
    if (weaponNumber == -1) {
        pi->pendingWeapon = -1;
        pi->weaponTimer = 0;
    } else if (weaponNumber != WP_NONE) {
        pi->pendingWeapon = weaponNumber;
        pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
    }
    weaponNum = pi->lastWeapon;
    pi->weapon = weaponNum;

    if (torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1) {
        torsoAnim = legsAnim = BOTH_DEATH1;
        pi->weapon = pi->currentWeapon = WP_NONE;
        UI_PlayerInfo_SetWeapon(pi, pi->weapon);

        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim(pi, legsAnim);

        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim(pi, torsoAnim);

        return;
    }

    // leg animation
    currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
    if (legsAnim != LEGS_JUMP && (currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND)) {
        pi->pendingLegsAnim = legsAnim;
    } else if (legsAnim != currentAnim) {
        jumpHeight = 0;
        pi->pendingLegsAnim = 0;
        UI_ForceLegsAnim(pi, legsAnim);
    }

    // torso animation
    if (torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2) {
        if (weaponNum == WP_NONE || weaponNum == WP_GAUNTLET) {
            torsoAnim = TORSO_STAND2;
        } else {
            torsoAnim = TORSO_STAND;
        }
    }

    if (torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2) {
        if (weaponNum == WP_NONE || weaponNum == WP_GAUNTLET) {
            torsoAnim = TORSO_ATTACK2;
        } else {
            torsoAnim = TORSO_ATTACK;
        }
        pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
        //FIXME play firing sound here
    }

    currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

    if (weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP) {
        pi->pendingTorsoAnim = torsoAnim;
    } else if ((currentAnim == TORSO_GESTURE || currentAnim == TORSO_ATTACK) && (torsoAnim != currentAnim)) {
        pi->pendingTorsoAnim = torsoAnim;
    } else if (torsoAnim != currentAnim) {
        pi->pendingTorsoAnim = 0;
        UI_ForceTorsoAnim(pi, torsoAnim);
    }
}
Пример #12
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( uiPlayerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat ) {
	int			currentAnim;
	weapon_t	weaponNum;

	pi->chat = chat;

	UI_PlayerInfo_UpdateColor( pi );

	// view angles
	VectorCopy( viewAngles, pi->viewAngles );

	// move angles
	VectorCopy( moveAngles, pi->moveAngles );

	if ( pi->newModel ) {
		pi->newModel = qfalse;

#ifdef TA_WEAPSYS
		atkAnim = 0;
#endif
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
		pi->legs.yawAngle = viewAngles[YAW];
		pi->legs.yawing = qfalse;

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
		pi->torso.yawAngle = viewAngles[YAW];
		pi->torso.yawing = qfalse;

		if ( weaponNumber != WP_NUM_WEAPONS ) {
			pi->weapon = weaponNumber;
			pi->currentWeapon = weaponNumber;
			pi->lastWeapon = weaponNumber;
			pi->pendingWeapon = WP_NUM_WEAPONS;
			pi->weaponTimer = 0;
			UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		}

		return;
	}

	// weapon
	if ( weaponNumber == WP_NUM_WEAPONS ) {
		pi->pendingWeapon = WP_NUM_WEAPONS;
		pi->weaponTimer = 0;
	}
	else if ( weaponNumber != WP_NONE ) {
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = WP_NONE;
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );

		return;
	}

	// leg animation
#ifdef TA_WEAPSYS
	if (BG_PlayerAttackAnim(torsoAnim))
	{
		// if torso is attacking, possibly need to animate legs too.
		currentAnim = BG_LegsAttackForWeapon(&pi->playercfg, weaponNum, atkAnim);
		if (currentAnim != -1) {
			legsAnim = currentAnim;
		}
	}
#endif

	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if ( legsAnim != LEGS_JUMP && ( currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND ) ) {
		pi->pendingLegsAnim = legsAnim;
	}
	else if ( legsAnim != currentAnim ) {
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
	}

	// torso animation
#ifdef TA_WEAPSYS
	if (BG_PlayerStandAnim(&pi->playercfg, AP_TORSO, torsoAnim))
	{
		torsoAnim = BG_TorsoStandForWeapon(weaponNum);
	}
#else
	if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
		if ( weaponNum == WP_NONE || weaponNum == WP_GAUNTLET ) {
			torsoAnim = TORSO_STAND2;
		}
		else {
			torsoAnim = TORSO_STAND;
		}
	}
#endif

#ifdef TA_WEAPSYS
	if (BG_PlayerAttackAnim(torsoAnim))
	{
		torsoAnim = BG_TorsoAttackForWeapon(weaponNum, atkAnim);
		if (!BG_WeaponHasMelee(weaponNum))
		{
			pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		}
		//FIXME play firing sound here

		atkAnim++;
	}
#else
	if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
		if ( weaponNum == WP_NONE || weaponNum == WP_GAUNTLET ) {
			torsoAnim = TORSO_ATTACK2;
		}
		else {
			torsoAnim = TORSO_ATTACK;
		}
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		//FIXME play firing sound here
	}
#endif

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( ( currentAnim == TORSO_GESTURE ||
#ifdef TA_WEAPSYS
		BG_PlayerAttackAnim(currentAnim)
#else
		currentAnim == TORSO_ATTACK
#endif
	) && ( torsoAnim != currentAnim ) ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( torsoAnim != currentAnim ) {
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
	}
}
Пример #13
0
/*
===============
UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat ) {
	int			currentAnim;
	weapon_t	weaponNum;

	pi->chat = chat;

	// view angles
	VectorCopy( viewAngles, pi->viewAngles );

	// move angles
	VectorCopy( moveAngles, pi->moveAngles );

	// weapon
	if ( weaponNumber == -1 ) {
		pi->pendingWeapon = (weapon_t) -1;
		pi->weaponTimer = 0;
	}
	else if ( weaponNumber != WP_NONE ) {
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = WP_NONE;
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );

		return;
	}

	// leg animation
	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if ( legsAnim != BOTH_JUMP1 && ( currentAnim == BOTH_JUMP1 || currentAnim == BOTH_LAND1 ) ) {
		pi->pendingLegsAnim = legsAnim;
	}
	else if ( legsAnim != currentAnim ) {
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
	}

	// torso animation
	if ( torsoAnim == BOTH_STAND1 || torsoAnim == BOTH_STAND2 ) 
	{
		if ( weaponNum == WP_NONE || weaponNum == WP_PHASER ) 
		{
			torsoAnim = BOTH_STAND1;
		}
		else 
		{
			torsoAnim = BOTH_STAND2;
		}
	}

	if ( torsoAnim == BOTH_ATTACK1 || torsoAnim == BOTH_ATTACK2 ) {
		if ( weaponNum == WP_NONE || weaponNum == WP_PHASER ) {
			torsoAnim = BOTH_ATTACK1;
		}
		else {
			torsoAnim = BOTH_ATTACK2;
		}
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
	}

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISEWEAP1 || currentAnim == TORSO_DROPWEAP1) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( ( currentAnim == BOTH_GESTURE1 || currentAnim == BOTH_ATTACK1 ) && ( torsoAnim != currentAnim ) ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( torsoAnim != currentAnim ) {
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
	}
}
Пример #14
0
/*
 * UI_PlayerInfo_SetInfo
 */
void
UI_PlayerInfo_SetInfo(Playerinfo *pi, int legsAnim, int torsoAnim,
		      Vec3 viewAngles, Vec3 moveAngles,
		      Weapon weaponNumber,
		      qbool chat)
{
	int	currentAnim;
	Weapon weaponNum;
	int	c;

	pi->chat = chat;

	c = (int)trap_cvargetf("color1");

	clearv3(pi->color1);

	if(c < 1 || c > 7)
		setv3(pi->color1, 1, 1, 1);
	else{
		if(c & 1)
			pi->color1[2] = 1.0f;

		if(c & 2)
			pi->color1[1] = 1.0f;

		if(c & 4)
			pi->color1[0] = 1.0f;
	}

	pi->c1RGBA[0]	= 255 * pi->color1[0];
	pi->c1RGBA[1]	= 255 * pi->color1[1];
	pi->c1RGBA[2]	= 255 * pi->color1[2];
	pi->c1RGBA[3]	= 255;

	/* view angles */
	copyv3(viewAngles, pi->viewAngles);

	/* move angles */
	copyv3(moveAngles, pi->moveAngles);

	if(pi->newModel){
		pi->newModel = qfalse;

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim(pi, legsAnim);
		pi->legs.yawAngle = viewAngles[YAW];
		pi->legs.yawing = qfalse;

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim(pi, torsoAnim);
		pi->torso.yawAngle = viewAngles[YAW];
		pi->torso.yawing = qfalse;

		if(weaponNumber != -1){
			pi->weapon = weaponNumber;
			pi->currentWeapon = weaponNumber;
			pi->lastWeapon = weaponNumber;
			pi->pendingWeapon = -1;
			pi->weaponTimer = 0;
			UI_PlayerInfo_SetWeapon(pi, pi->weapon);
		}

		return;
	}

	/* weapon */
	if(weaponNumber == -1){
		pi->pendingWeapon = -1;
		pi->weaponTimer = 0;
	}else if(weaponNumber != Wnone){
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if(torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1){
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = Wnone;
		UI_PlayerInfo_SetWeapon(pi, pi->weapon);

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim(pi, legsAnim);

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim(pi, torsoAnim);

		return;
	}

	/* leg animation */
	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if(legsAnim != LEGS_JUMP &&
	   (currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND))
		pi->pendingLegsAnim = legsAnim;
	else if(legsAnim != currentAnim){
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim(pi, legsAnim);
	}

	/* torso animation */
	if(torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2){
		if(weaponNum == Wnone || weaponNum == Wmelee)
			torsoAnim = TORSO_STAND2;
		else
			torsoAnim = TORSO_STAND;
	}

	if(torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2){
		if(weaponNum == Wnone || weaponNum == Wmelee)
			torsoAnim = TORSO_ATTACK2;
		else
			torsoAnim = TORSO_ATTACK;
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		/* FIXME play firing sound here */
	}

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if(weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE ||
	   currentAnim == TORSO_DROP)
		pi->pendingTorsoAnim = torsoAnim;
	else if((currentAnim == TORSO_GESTURE ||
		 currentAnim == TORSO_ATTACK) && (torsoAnim != currentAnim))
		pi->pendingTorsoAnim = torsoAnim;
	else if(torsoAnim != currentAnim){
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim(pi, torsoAnim);
	}
}
Пример #15
0
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vector3 *viewAngles, vector3 *moveAngles, weapon_t weaponNumber, qboolean chat ) {
	int			currentAnim;
	weapon_t	weaponNum;

	pi->chat = chat;

	// view angles
	VectorCopy( viewAngles, &pi->viewAngles );

	// move angles
	VectorCopy( moveAngles, &pi->moveAngles );

	if ( pi->newModel ) {
		pi->newModel = qfalse;

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
		pi->legs.yawAngle = viewAngles->yaw;
		pi->legs.yawing = qfalse;

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
		pi->torso.yawAngle = viewAngles->yaw;
		pi->torso.yawing = qfalse;

		if ( weaponNumber != -1 ) {
			pi->weapon = weaponNumber;
			pi->currentWeapon = weaponNumber;
			pi->lastWeapon = weaponNumber;
			pi->pendingWeapon = -1;
			pi->weaponTimer = 0;
			UI_PlayerInfo_SetWeapon( pi, pi->weapon );
		}

		return;
	}

	// weapon
	if ( weaponNumber == -1 ) {
		pi->pendingWeapon = -1;
		pi->weaponTimer = 0;
	}
	else if ( weaponNumber != WP_NONE ) {
		pi->pendingWeapon = weaponNumber;
		pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
	}
	weaponNum = pi->lastWeapon;
	pi->weapon = weaponNum;

	if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
		torsoAnim = legsAnim = BOTH_DEATH1;
		pi->weapon = pi->currentWeapon = WP_NONE;
		UI_PlayerInfo_SetWeapon( pi, pi->weapon );

		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );

		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );

		return;
	}

	// leg animation
	currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
	if ( legsAnim != LEGS_JUMP && ( currentAnim == LEGS_JUMP || currentAnim == LEGS_LAND ) ) {
		pi->pendingLegsAnim = legsAnim;
	}
	else if ( legsAnim != currentAnim ) {
		jumpHeight = 0;
		pi->pendingLegsAnim = 0;
		UI_ForceLegsAnim( pi, legsAnim );
	}

	// torso animation
	if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
		torsoAnim = TORSO_STAND;
	}

	if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
		torsoAnim = TORSO_ATTACK;
		pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
		//FIXME play firing sound here
	}

	currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;

	if ( weaponNum != pi->currentWeapon || currentAnim == TORSO_RAISE || currentAnim == TORSO_DROP ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( ( currentAnim == TORSO_GESTURE || currentAnim == TORSO_ATTACK ) && ( torsoAnim != currentAnim ) ) {
		pi->pendingTorsoAnim = torsoAnim;
	}
	else if ( torsoAnim != currentAnim ) {
		pi->pendingTorsoAnim = 0;
		UI_ForceTorsoAnim( pi, torsoAnim );
	}
}