/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see .
===========================================================================
*/
//wp_saberLoad.cpp
#include "../qcommon/q_shared.h"
#include "g_local.h"
#include "wp_saber.h"
#include "../cgame/cg_local.h"
extern qboolean G_ParseLiteral( const char **data, const char *string );
extern saber_colors_t TranslateSaberColor( const char *name );
extern qboolean PM_SaberInStart( int move );
extern qboolean PM_SaberInTransition( int move );
extern qboolean PM_SaberInAttack( int move );
extern stringID_table_t FPTable[];
#define MAX_SABER_DATA_SIZE (1024*1024) // 1mb, was 512kb
char SaberParms[MAX_SABER_DATA_SIZE];
void Saber_SithSwordPrecache( void )
{//*SIGH* special sounds used by the sith sword
int i;
for ( i = 1; i < 5; i++ )
{
G_SoundIndex( va( "sound/weapons/sword/stab%d.wav", i ) );
}
for ( i = 1; i < 5; i++ )
{
G_SoundIndex( va( "sound/weapons/sword/swing%d.wav", i ) );
}
for ( i = 1; i < 7; i++ )
{
G_SoundIndex( va( "sound/weapons/sword/fall%d.wav", i ) );
}
/*
for ( i = 1; i < 4; i++ )
{
G_SoundIndex( va( "sound/weapons/sword/spin%d.wav", i ) );
}
*/
}
stringID_table_t SaberTable[] =
{
ENUM2STRING(SABER_NONE),
ENUM2STRING(SABER_SINGLE),
ENUM2STRING(SABER_STAFF),
ENUM2STRING(SABER_BROAD),
ENUM2STRING(SABER_PRONG),
ENUM2STRING(SABER_DAGGER),
ENUM2STRING(SABER_ARC),
ENUM2STRING(SABER_SAI),
ENUM2STRING(SABER_CLAW),
ENUM2STRING(SABER_LANCE),
ENUM2STRING(SABER_STAR),
ENUM2STRING(SABER_TRIDENT),
ENUM2STRING(SABER_SITH_SWORD),
{ "", -1 }
};
stringID_table_t SaberMoveTable[] =
{
ENUM2STRING(LS_NONE),
// Attacks
ENUM2STRING(LS_A_TL2BR),
ENUM2STRING(LS_A_L2R),
ENUM2STRING(LS_A_BL2TR),
ENUM2STRING(LS_A_BR2TL),
ENUM2STRING(LS_A_R2L),
ENUM2STRING(LS_A_TR2BL),
ENUM2STRING(LS_A_T2B),
ENUM2STRING(LS_A_BACKSTAB),
ENUM2STRING(LS_A_BACK),
ENUM2STRING(LS_A_BACK_CR),
ENUM2STRING(LS_ROLL_STAB),
ENUM2STRING(LS_A_LUNGE),
ENUM2STRING(LS_A_JUMP_T__B_),
ENUM2STRING(LS_A_FLIP_STAB),
ENUM2STRING(LS_A_FLIP_SLASH),
ENUM2STRING(LS_JUMPATTACK_DUAL),
ENUM2STRING(LS_JUMPATTACK_ARIAL_LEFT),
ENUM2STRING(LS_JUMPATTACK_ARIAL_RIGHT),
ENUM2STRING(LS_JUMPATTACK_CART_LEFT),
ENUM2STRING(LS_JUMPATTACK_CART_RIGHT),
ENUM2STRING(LS_JUMPATTACK_STAFF_LEFT),
ENUM2STRING(LS_JUMPATTACK_STAFF_RIGHT),
ENUM2STRING(LS_BUTTERFLY_LEFT),
ENUM2STRING(LS_BUTTERFLY_RIGHT),
ENUM2STRING(LS_A_BACKFLIP_ATK),
ENUM2STRING(LS_SPINATTACK_DUAL),
ENUM2STRING(LS_SPINATTACK),
ENUM2STRING(LS_LEAP_ATTACK),
ENUM2STRING(LS_SWOOP_ATTACK_RIGHT),
ENUM2STRING(LS_SWOOP_ATTACK_LEFT),
ENUM2STRING(LS_TAUNTAUN_ATTACK_RIGHT),
ENUM2STRING(LS_TAUNTAUN_ATTACK_LEFT),
ENUM2STRING(LS_KICK_F),
ENUM2STRING(LS_KICK_B),
ENUM2STRING(LS_KICK_R),
ENUM2STRING(LS_KICK_L),
ENUM2STRING(LS_KICK_S),
ENUM2STRING(LS_KICK_BF),
ENUM2STRING(LS_KICK_RL),
ENUM2STRING(LS_KICK_F_AIR),
ENUM2STRING(LS_KICK_B_AIR),
ENUM2STRING(LS_KICK_R_AIR),
ENUM2STRING(LS_KICK_L_AIR),
ENUM2STRING(LS_STABDOWN),
ENUM2STRING(LS_STABDOWN_STAFF),
ENUM2STRING(LS_STABDOWN_DUAL),
ENUM2STRING(LS_DUAL_SPIN_PROTECT),
ENUM2STRING(LS_STAFF_SOULCAL),
ENUM2STRING(LS_A1_SPECIAL),
ENUM2STRING(LS_A2_SPECIAL),
ENUM2STRING(LS_A3_SPECIAL),
ENUM2STRING(LS_UPSIDE_DOWN_ATTACK),
ENUM2STRING(LS_PULL_ATTACK_STAB),
ENUM2STRING(LS_PULL_ATTACK_SWING),
ENUM2STRING(LS_SPINATTACK_ALORA),
ENUM2STRING(LS_DUAL_FB),
ENUM2STRING(LS_DUAL_LR),
ENUM2STRING(LS_HILT_BASH),
{ "", -1 }
};
saber_styles_t TranslateSaberStyle( const char *name ) {
if ( !Q_stricmp( name, "fast" ) ) return SS_FAST;
if ( !Q_stricmp( name, "medium" ) ) return SS_MEDIUM;
if ( !Q_stricmp( name, "strong" ) ) return SS_STRONG;
if ( !Q_stricmp( name, "desann" ) ) return SS_DESANN;
if ( !Q_stricmp( name, "tavion" ) ) return SS_TAVION;
if ( !Q_stricmp( name, "dual" ) ) return SS_DUAL;
if ( !Q_stricmp( name, "staff" ) ) return SS_STAFF;
return SS_NONE;
}
void WP_SaberFreeStrings( saberInfo_t &saber ) {
if ( saber.name && gi.bIsFromZone( saber.name, TAG_G_ALLOC ) ) {
gi.Free( saber.name );
saber.name = NULL;
}
if ( saber.fullName && gi.bIsFromZone( saber.fullName, TAG_G_ALLOC ) ) {
gi.Free( saber.fullName );
saber.fullName = NULL;
}
if ( saber.model && gi.bIsFromZone( saber.model, TAG_G_ALLOC ) ) {
gi.Free( saber.model );
saber.model = NULL;
}
if ( saber.skin && gi.bIsFromZone( saber.skin, TAG_G_ALLOC ) ) {
gi.Free( saber.skin );
saber.skin = NULL;
}
if ( saber.brokenSaber1 && gi.bIsFromZone( saber.brokenSaber1, TAG_G_ALLOC ) ) {
gi.Free( saber.brokenSaber1 );
saber.brokenSaber1 = NULL;
}
if ( saber.brokenSaber2 && gi.bIsFromZone( saber.brokenSaber2, TAG_G_ALLOC ) ) {
gi.Free( saber.brokenSaber2 );
saber.brokenSaber2 = NULL;
}
}
qboolean WP_SaberBladeUseSecondBladeStyle( saberInfo_t *saber, int bladeNum ) {
if ( saber
&& saber->bladeStyle2Start > 0
&& bladeNum >= saber->bladeStyle2Start )
return qtrue;
return qfalse;
}
qboolean WP_SaberBladeDoTransitionDamage( saberInfo_t *saber, int bladeNum ) {
//use first blade style for this blade
if ( !WP_SaberBladeUseSecondBladeStyle( saber, bladeNum ) && (saber->saberFlags2 & SFL2_TRANSITION_DAMAGE) )
return qtrue;
//use second blade style for this blade
else if ( WP_SaberBladeUseSecondBladeStyle( saber, bladeNum ) && (saber->saberFlags2 & SFL2_TRANSITION_DAMAGE2) )
return qtrue;
return qfalse;
}
qboolean WP_UseFirstValidSaberStyle( gentity_t *ent, int *saberAnimLevel )
{
if ( ent && ent->client )
{
qboolean styleInvalid = qfalse;
int validStyles = 0, styleNum;
//initially, all styles are valid
for ( styleNum = SS_NONE+1; styleNum < SS_NUM_SABER_STYLES; styleNum++ )
{
validStyles |= (1<client->ps.saber[0].Active()
&& ent->client->ps.saber[0].stylesForbidden )
{
if ( (ent->client->ps.saber[0].stylesForbidden&(1<<*saberAnimLevel)) )
{//not a valid style for first saber!
styleInvalid = qtrue;
validStyles &= ~ent->client->ps.saber[0].stylesForbidden;
}
}
if ( ent->client->ps.dualSabers )
{//check second saber, too
if ( ent->client->ps.saber[1].Active()
&& ent->client->ps.saber[1].stylesForbidden )
{
if ( (ent->client->ps.saber[1].stylesForbidden&(1<<*saberAnimLevel)) )
{//not a valid style for second saber!
styleInvalid = qtrue;
//only the ones both sabers allow is valid
validStyles &= ~ent->client->ps.saber[1].stylesForbidden;
}
}
else
{//can't use dual style if not using 2 sabers
validStyles &= ~(1<client )
{
if ( ent->client->ps.saber[0].Active()
&& ent->client->ps.saber[0].stylesForbidden )
{
if ( (ent->client->ps.saber[0].stylesForbidden&(1<client->ps.dualSabers )
{//check second saber, too
if ( ent->client->ps.saber[1].Active() )
{
if ( ent->client->ps.saber[1].stylesForbidden )
{
if ( (ent->client->ps.saber[1].stylesForbidden&(1<client->ps.saber[0].Active()
&& (ent->client->ps.saber[0].stylesLearned&(1<client->ps.saber[1].stylesLearned&(1<bladeStyle2Start > 0
&& saber->numBlades > saber->bladeStyle2Start )
{
if ( (saber->saberFlags2&SFL2_NO_MANUAL_DEACTIVATE)
&& (saber->saberFlags2&SFL2_NO_MANUAL_DEACTIVATE2) )
{//all blades are always on
return qfalse;
}
}
else
{
if ( (saber->saberFlags2&SFL2_NO_MANUAL_DEACTIVATE) )
{//all blades are always on
return qfalse;
}
}
//you can turn some off
return qtrue;
}
void WP_SaberSetDefaults( saberInfo_t *saber, qboolean setColors = qtrue )
{
//Set defaults so that, if it fails, there's at least something there
saber->name = NULL;
saber->fullName = NULL;
for ( int i = 0; i < MAX_BLADES; i++ )
{
if ( setColors )
{
saber->blade[i].color = SABER_RED;
}
saber->blade[i].radius = SABER_RADIUS_STANDARD;
saber->blade[i].lengthMax = 32;
}
saber->model = "models/weapons2/saber_reborn/saber_w.glm";
saber->skin = NULL;
saber->soundOn = G_SoundIndex( "sound/weapons/saber/enemy_saber_on.wav" );
saber->soundLoop = G_SoundIndex( "sound/weapons/saber/saberhum3.wav" );
saber->soundOff = G_SoundIndex( "sound/weapons/saber/enemy_saber_off.wav" );
saber->numBlades = 1;
saber->type = SABER_SINGLE;
saber->stylesLearned = 0;
saber->stylesForbidden = 0;
saber->maxChain = 0;//0 = use default behavior
saber->forceRestrictions = 0;
saber->lockBonus = 0;
saber->parryBonus = 0;
saber->breakParryBonus = 0;
saber->breakParryBonus2 = 0;
saber->disarmBonus = 0;
saber->disarmBonus2 = 0;
saber->singleBladeStyle = SS_NONE;//makes it so that you use a different style if you only have the first blade active
saber->brokenSaber1 = NULL;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your right hand
saber->brokenSaber2 = NULL;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your left hand
//===NEW========================================================================================
//these values are global to the saber, like all of the ones above
saber->saberFlags = 0; //see all the SFL_ flags
saber->saberFlags2 = 0; //see all the SFL2_ flags
saber->spinSound = 0; //none - if set, plays this sound as it spins when thrown
saber->swingSound[0] = 0; //none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
saber->swingSound[1] = 0; //none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
saber->swingSound[2] = 0; //none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
saber->fallSound[0] = 0; //none - if set, plays one of these 3 sounds when weapon falls to the ground - NOTE: must provide all 3!!!
saber->fallSound[1] = 0; //none - if set, plays one of these 3 sounds when weapon falls to the ground - NOTE: must provide all 3!!!
saber->fallSound[2] = 0; //none - if set, plays one of these 3 sounds when weapon falls to the ground - NOTE: must provide all 3!!!
//done in game (server-side code)
saber->moveSpeedScale = 1.0f; //1.0 - you move faster/slower when using this saber
saber->animSpeedScale = 1.0f; //1.0 - plays normal attack animations faster/slower
saber->kataMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they press both attack buttons at the same time
saber->lungeAtkMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they crouch+fwd+attack
saber->jumpAtkUpMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they jump+attack
saber->jumpAtkFwdMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they jump+fwd+attack
saber->jumpAtkBackMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they jump+back+attack
saber->jumpAtkRightMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they jump+rightattack
saber->jumpAtkLeftMove = LS_INVALID; //LS_INVALID - if set, player will execute this move when they jump+left+attack
saber->readyAnim = -1; //-1 - anim to use when standing idle
saber->drawAnim = -1; //-1 - anim to use when drawing weapon
saber->putawayAnim = -1; //-1 - anim to use when putting weapon away
saber->tauntAnim = -1; //-1 - anim to use when hit "taunt"
saber->bowAnim = -1; //-1 - anim to use when hit "bow"
saber->meditateAnim = -1; //-1 - anim to use when hit "meditate"
saber->flourishAnim = -1; //-1 - anim to use when hit "flourish"
saber->gloatAnim = -1; //-1 - anim to use when hit "gloat"
//***NOTE: you can only have a maximum of 2 "styles" of blades, so this next value, "bladeStyle2Start" is the number of the first blade to use these value on... all blades before this use the normal values above, all blades at and after this number use the secondary values below***
saber->bladeStyle2Start = 0; //0 - if set, blades from this number and higher use the following values (otherwise, they use the normal values already set)
//***The following can be different for the extra blades - not setting them individually defaults them to the value for the whole saber (and first blade)***
//===PRIMARY BLADES=====================
//done in cgame (client-side code)
saber->trailStyle = 0; //0 - default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods)
saber->g2MarksShader[0]=0; //none - if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark"
saber->g2WeaponMarkShader[0]=0; //none - if set, the game will ry to project this shader onto the weapon when it damages a person (good for a blood splatter on the weapon)
//saber->bladeShader = 0; //none - if set, overrides the shader used for the saber blade?
//saber->trailShader = 0; //none - if set, overrides the shader used for the saber trail?
saber->hitSound[0] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->hitSound[1] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->hitSound[2] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->blockSound[0] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->blockSound[1] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->blockSound[2] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->bounceSound[0] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
saber->bounceSound[1] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
saber->bounceSound[2] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
saber->blockEffect = 0; //none - if set, plays this effect when the saber/sword hits another saber/sword (instead of "saber/saber_block.efx")
saber->hitPersonEffect = 0; //none - if set, plays this effect when the saber/sword hits a person (instead of "saber/blood_sparks_mp.efx")
saber->hitOtherEffect = 0; //none - if set, plays this effect when the saber/sword hits something else damagable (instead of "saber/saber_cut.efx")
saber->bladeEffect = 0; //none - if set, plays this effect at the blade tag
//done in game (server-side code)
saber->knockbackScale = 0; //0 - if non-zero, uses damage done to calculate an appropriate amount of knockback
saber->damageScale = 1.0f; //1 - scale up or down the damage done by the saber
saber->splashRadius = 0.0f; //0 - radius of splashDamage
saber->splashDamage = 0; //0 - amount of splashDamage, 100% at a distance of 0, 0% at a distance = splashRadius
saber->splashKnockback = 0.0f; //0 - amount of splashKnockback, 100% at a distance of 0, 0% at a distance = splashRadius
//===SECONDARY BLADES===================
//done in cgame (client-side code)
saber->trailStyle2 = 0; //0 - default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods)
saber->g2MarksShader2[0]=0; //none - if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark"
saber->g2WeaponMarkShader2[0]=0; //none - if set, the game will ry to project this shader onto the weapon when it damages a person (good for a blood splatter on the weapon)
//saber->bladeShader = 0; //none - if set, overrides the shader used for the saber blade?
//saber->trailShader = 0; //none - if set, overrides the shader used for the saber trail?
saber->hit2Sound[0] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->hit2Sound[1] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->hit2Sound[2] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->block2Sound[0] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->block2Sound[1] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->block2Sound[2] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->bounce2Sound[0] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
saber->bounce2Sound[1] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
saber->bounce2Sound[2] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
saber->blockEffect2 = 0; //none - if set, plays this effect when the saber/sword hits another saber/sword (instead of "saber/saber_block.efx")
saber->hitPersonEffect2 = 0; //none - if set, plays this effect when the saber/sword hits a person (instead of "saber/blood_sparks_mp.efx")
saber->hitOtherEffect2 = 0; //none - if set, plays this effect when the saber/sword hits something else damagable (instead of "saber/saber_cut.efx")
saber->bladeEffect2 = 0; //none - if set, plays this effect at the blade tag
//done in game (server-side code)
saber->knockbackScale2 = 0; //0 - if non-zero, uses damage done to calculate an appropriate amount of knockback
saber->damageScale2 = 1.0f; //1 - scale up or down the damage done by the saber
saber->splashRadius2 = 0.0f; //0 - radius of splashDamage
saber->splashDamage2 = 0; //0 - amount of splashDamage, 100% at a distance of 0, 0% at a distance = splashRadius
saber->splashKnockback2 = 0.0f; //0 - amount of splashKnockback, 100% at a distance of 0, 0% at a distance = splashRadius
//=========================================================================================================================================
}
static void Saber_ParseName( saberInfo_t *saber, const char **p ) {
const char *value;
if ( COM_ParseString( p, &value ) )
return;
saber->fullName = G_NewString( value );
}
static void Saber_ParseSaberType( saberInfo_t *saber, const char **p ) {
const char *value;
int saberType;
if ( COM_ParseString( p, &value ) )
return;
saberType = GetIDForString( SaberTable, value );
if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS )
saber->type = (saberType_t)saberType;
}
static void Saber_ParseSaberModel( saberInfo_t *saber, const char **p ) {
const char *value;
if ( COM_ParseString( p, &value ) )
return;
saber->model = G_NewString( value );
}
static void Saber_ParseCustomSkin( saberInfo_t *saber, const char **p ) {
const char *value;
if ( COM_ParseString( p, &value ) )
return;
saber->skin = G_NewString( value );
}
static void Saber_ParseSoundOn( saberInfo_t *saber, const char **p ) {
const char *value;
if ( COM_ParseString( p, &value ) )
return;
saber->soundOn = G_SoundIndex( value );
}
static void Saber_ParseSoundLoop( saberInfo_t *saber, const char **p ) {
const char *value;
if ( COM_ParseString( p, &value ) )
return;
saber->soundLoop = G_SoundIndex( value );
}
static void Saber_ParseSoundOff( saberInfo_t *saber, const char **p ) {
const char *value;
if ( COM_ParseString( p, &value ) )
return;
saber->soundOff = G_SoundIndex( value );
}
static void Saber_ParseNumBlades( saberInfo_t *saber, const char **p ) {
int n;
if ( COM_ParseInt( p, &n ) ) {
SkipRestOfLine( p );
return;
}
if ( n < 1 || n > MAX_BLADES ) {
Com_Error( ERR_DROP, "WP_SaberParseParms: saber %s has illegal number of blades (%d) max: %d", saber->name, n, MAX_BLADES );
return;
}
saber->numBlades = n;
}
qboolean Saber_SetColor = qtrue;
static void Saber_ParseSaberColor( saberInfo_t *saber, const char **p ) {
const char *value;
int i=0;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
for ( i=0; iblade[i].color = color;
}
static void Saber_ParseSaberColor2( saberInfo_t *saber, const char **p ) {
const char *value;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
saber->blade[1].color = color;
}
static void Saber_ParseSaberColor3( saberInfo_t *saber, const char **p ) {
const char *value;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
saber->blade[2].color = color;
}
static void Saber_ParseSaberColor4( saberInfo_t *saber, const char **p ) {
const char *value;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
saber->blade[3].color = color;
}
static void Saber_ParseSaberColor5( saberInfo_t *saber, const char **p ) {
const char *value;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
saber->blade[4].color = color;
}
static void Saber_ParseSaberColor6( saberInfo_t *saber, const char **p ) {
const char *value;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
saber->blade[5].color = color;
}
static void Saber_ParseSaberColor7( saberInfo_t *saber, const char **p ) {
const char *value;
saber_colors_t color;
if ( COM_ParseString( p, &value ) )
return;
// don't actually want to set the colors
// read the color out anyway just to advance the *p pointer
if ( !Saber_SetColor )
return;
color = TranslateSaberColor( value );
saber->blade[6].color = color;
}
static void Saber_ParseSaberLength( saberInfo_t *saber, const char **p ) {
int i=0;
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
for ( i=0; iblade[i].lengthMax = f;
}
static void Saber_ParseSaberLength2( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
saber->blade[1].lengthMax = f;
}
static void Saber_ParseSaberLength3( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
saber->blade[2].lengthMax = f;
}
static void Saber_ParseSaberLength4( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
saber->blade[3].lengthMax = f;
}
static void Saber_ParseSaberLength5( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
saber->blade[4].lengthMax = f;
}
static void Saber_ParseSaberLength6( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
saber->blade[5].lengthMax = f;
}
static void Saber_ParseSaberLength7( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 4.0f )
f = 4.0f;
saber->blade[6].lengthMax = f;
}
static void Saber_ParseSaberRadius( saberInfo_t *saber, const char **p ) {
int i=0;
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
for ( i=0; iblade[i].radius = f;
}
static void Saber_ParseSaberRadius2( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
saber->blade[1].radius = f;
}
static void Saber_ParseSaberRadius3( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
saber->blade[2].radius = f;
}
static void Saber_ParseSaberRadius4( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
saber->blade[3].radius = f;
}
static void Saber_ParseSaberRadius5( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
saber->blade[4].radius = f;
}
static void Saber_ParseSaberRadius6( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
saber->blade[5].radius = f;
}
static void Saber_ParseSaberRadius7( saberInfo_t *saber, const char **p ) {
float f;
if ( COM_ParseFloat( p, &f ) )
return;
if ( f < 0.25f )
f = 0.25f;
saber->blade[6].radius = f;
}
static void Saber_ParseSaberStyle( saberInfo_t *saber, const char **p ) {
const char *value;
int style, styleNum;
if ( COM_ParseString( p, &value ) )
return;
//OLD WAY: only allowed ONE style
style = TranslateSaberStyle( value );
//learn only this style
saber->stylesLearned = (1<