00001
00002 #include "q_shared.h"
00003 #include "bg_public.h"
00004 #include "bg_local.h"
00005 #include "w_saber.h"
00006
00007 extern stringID_table_t animTable [MAX_ANIMATIONS+1];
00008
00009
00010 #include "../namespace_begin.h"
00011 extern int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
00012 extern void trap_FS_Read( void *buffer, int len, fileHandle_t f );
00013 extern void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
00014 extern void trap_FS_FCloseFile( fileHandle_t f );
00015 extern int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
00016 extern qhandle_t trap_R_RegisterSkin( const char *name );
00017 #include "../namespace_end.h"
00018
00019
00020 #ifdef QAGAME
00021 extern int G_SoundIndex( const char *name );
00022 #elif defined CGAME
00023 #include "../namespace_begin.h"
00024 sfxHandle_t trap_S_RegisterSound( const char *sample);
00025 qhandle_t trap_R_RegisterShader( const char *name );
00026 int trap_FX_RegisterEffect(const char *file);
00027 #include "../namespace_end.h"
00028 #endif
00029
00030 #include "../namespace_begin.h"
00031
00032 int BG_SoundIndex(char *sound)
00033 {
00034 #ifdef QAGAME
00035 return G_SoundIndex(sound);
00036 #elif defined CGAME
00037 return trap_S_RegisterSound(sound);
00038 #endif
00039 }
00040
00041 extern stringID_table_t FPTable[];
00042
00043 #define MAX_SABER_DATA_SIZE 0x80000
00044 static char SaberParms[MAX_SABER_DATA_SIZE];
00045
00046 stringID_table_t SaberTable[] =
00047 {
00048 ENUM2STRING(SABER_NONE),
00049 ENUM2STRING(SABER_SINGLE),
00050 ENUM2STRING(SABER_STAFF),
00051 ENUM2STRING(SABER_BROAD),
00052 ENUM2STRING(SABER_PRONG),
00053 ENUM2STRING(SABER_DAGGER),
00054 ENUM2STRING(SABER_ARC),
00055 ENUM2STRING(SABER_SAI),
00056 ENUM2STRING(SABER_CLAW),
00057 ENUM2STRING(SABER_LANCE),
00058 ENUM2STRING(SABER_STAR),
00059 ENUM2STRING(SABER_TRIDENT),
00060 "", -1
00061 };
00062
00063 stringID_table_t SaberMoveTable[] =
00064 {
00065 ENUM2STRING(LS_NONE),
00066
00067 ENUM2STRING(LS_A_TL2BR),
00068 ENUM2STRING(LS_A_L2R),
00069 ENUM2STRING(LS_A_BL2TR),
00070 ENUM2STRING(LS_A_BR2TL),
00071 ENUM2STRING(LS_A_R2L),
00072 ENUM2STRING(LS_A_TR2BL),
00073 ENUM2STRING(LS_A_T2B),
00074 ENUM2STRING(LS_A_BACKSTAB),
00075 ENUM2STRING(LS_A_BACK),
00076 ENUM2STRING(LS_A_BACK_CR),
00077 ENUM2STRING(LS_ROLL_STAB),
00078 ENUM2STRING(LS_A_LUNGE),
00079 ENUM2STRING(LS_A_JUMP_T__B_),
00080 ENUM2STRING(LS_A_FLIP_STAB),
00081 ENUM2STRING(LS_A_FLIP_SLASH),
00082 ENUM2STRING(LS_JUMPATTACK_DUAL),
00083 ENUM2STRING(LS_JUMPATTACK_ARIAL_LEFT),
00084 ENUM2STRING(LS_JUMPATTACK_ARIAL_RIGHT),
00085 ENUM2STRING(LS_JUMPATTACK_CART_LEFT),
00086 ENUM2STRING(LS_JUMPATTACK_CART_RIGHT),
00087 ENUM2STRING(LS_JUMPATTACK_STAFF_LEFT),
00088 ENUM2STRING(LS_JUMPATTACK_STAFF_RIGHT),
00089 ENUM2STRING(LS_BUTTERFLY_LEFT),
00090 ENUM2STRING(LS_BUTTERFLY_RIGHT),
00091 ENUM2STRING(LS_A_BACKFLIP_ATK),
00092 ENUM2STRING(LS_SPINATTACK_DUAL),
00093 ENUM2STRING(LS_SPINATTACK),
00094 ENUM2STRING(LS_LEAP_ATTACK),
00095 ENUM2STRING(LS_SWOOP_ATTACK_RIGHT),
00096 ENUM2STRING(LS_SWOOP_ATTACK_LEFT),
00097 ENUM2STRING(LS_TAUNTAUN_ATTACK_RIGHT),
00098 ENUM2STRING(LS_TAUNTAUN_ATTACK_LEFT),
00099 ENUM2STRING(LS_KICK_F),
00100 ENUM2STRING(LS_KICK_B),
00101 ENUM2STRING(LS_KICK_R),
00102 ENUM2STRING(LS_KICK_L),
00103 ENUM2STRING(LS_KICK_S),
00104 ENUM2STRING(LS_KICK_BF),
00105 ENUM2STRING(LS_KICK_RL),
00106 ENUM2STRING(LS_KICK_F_AIR),
00107 ENUM2STRING(LS_KICK_B_AIR),
00108 ENUM2STRING(LS_KICK_R_AIR),
00109 ENUM2STRING(LS_KICK_L_AIR),
00110 ENUM2STRING(LS_STABDOWN),
00111 ENUM2STRING(LS_STABDOWN_STAFF),
00112 ENUM2STRING(LS_STABDOWN_DUAL),
00113 ENUM2STRING(LS_DUAL_SPIN_PROTECT),
00114 ENUM2STRING(LS_STAFF_SOULCAL),
00115 ENUM2STRING(LS_A1_SPECIAL),
00116 ENUM2STRING(LS_A2_SPECIAL),
00117 ENUM2STRING(LS_A3_SPECIAL),
00118 ENUM2STRING(LS_UPSIDE_DOWN_ATTACK),
00119 ENUM2STRING(LS_PULL_ATTACK_STAB),
00120 ENUM2STRING(LS_PULL_ATTACK_SWING),
00121 ENUM2STRING(LS_SPINATTACK_ALORA),
00122 ENUM2STRING(LS_DUAL_FB),
00123 ENUM2STRING(LS_DUAL_LR),
00124 ENUM2STRING(LS_HILT_BASH),
00125 "", -1
00126 };
00127
00128
00129 qboolean BG_ParseLiteral( const char **data, const char *string )
00130 {
00131 const char *token;
00132
00133 token = COM_ParseExt( data, qtrue );
00134 if ( token[0] == 0 )
00135 {
00136 Com_Printf( "unexpected EOF\n" );
00137 return qtrue;
00138 }
00139
00140 if ( Q_stricmp( token, string ) )
00141 {
00142 Com_Printf( "required string '%s' missing\n", string );
00143 return qtrue;
00144 }
00145
00146 return qfalse;
00147 }
00148
00149 saber_colors_t TranslateSaberColor( const char *name )
00150 {
00151 if ( !Q_stricmp( name, "red" ) )
00152 {
00153 return SABER_RED;
00154 }
00155 if ( !Q_stricmp( name, "orange" ) )
00156 {
00157 return SABER_ORANGE;
00158 }
00159 if ( !Q_stricmp( name, "yellow" ) )
00160 {
00161 return SABER_YELLOW;
00162 }
00163 if ( !Q_stricmp( name, "green" ) )
00164 {
00165 return SABER_GREEN;
00166 }
00167 if ( !Q_stricmp( name, "blue" ) )
00168 {
00169 return SABER_BLUE;
00170 }
00171 if ( !Q_stricmp( name, "purple" ) )
00172 {
00173 return SABER_PURPLE;
00174 }
00175 if ( !Q_stricmp( name, "random" ) )
00176 {
00177 return ((saber_colors_t)(Q_irand( SABER_ORANGE, SABER_PURPLE )));
00178 }
00179 return SABER_BLUE;
00180 }
00181
00182 saber_styles_t TranslateSaberStyle( const char *name )
00183 {
00184 if ( !Q_stricmp( name, "fast" ) )
00185 {
00186 return SS_FAST;
00187 }
00188 if ( !Q_stricmp( name, "medium" ) )
00189 {
00190 return SS_MEDIUM;
00191 }
00192 if ( !Q_stricmp( name, "strong" ) )
00193 {
00194 return SS_STRONG;
00195 }
00196 if ( !Q_stricmp( name, "desann" ) )
00197 {
00198 return SS_DESANN;
00199 }
00200 if ( !Q_stricmp( name, "tavion" ) )
00201 {
00202 return SS_TAVION;
00203 }
00204 if ( !Q_stricmp( name, "dual" ) )
00205 {
00206 return SS_DUAL;
00207 }
00208 if ( !Q_stricmp( name, "staff" ) )
00209 {
00210 return SS_STAFF;
00211 }
00212 return SS_NONE;
00213 }
00214
00215 qboolean WP_SaberBladeUseSecondBladeStyle( saberInfo_t *saber, int bladeNum )
00216 {
00217 if ( saber )
00218 {
00219 if ( saber->bladeStyle2Start > 0 )
00220 {
00221 if ( bladeNum >= saber->bladeStyle2Start )
00222 {
00223 return qtrue;
00224 }
00225 }
00226 }
00227 return qfalse;
00228 }
00229
00230 qboolean WP_SaberBladeDoTransitionDamage( saberInfo_t *saber, int bladeNum )
00231 {
00232 if ( !WP_SaberBladeUseSecondBladeStyle( saber, bladeNum )
00233 && (saber->saberFlags2&SFL2_TRANSITION_DAMAGE) )
00234 {
00235 return qtrue;
00236 }
00237 else if ( WP_SaberBladeUseSecondBladeStyle( saber, bladeNum )
00238 && (saber->saberFlags2&SFL2_TRANSITION_DAMAGE2) )
00239 {
00240 return qtrue;
00241 }
00242 return qfalse;
00243 }
00244
00245 qboolean WP_UseFirstValidSaberStyle( saberInfo_t *saber1, saberInfo_t *saber2, int saberHolstered, int *saberAnimLevel )
00246 {
00247 qboolean styleInvalid = qfalse;
00248 qboolean saber1Active;
00249 qboolean saber2Active;
00250 qboolean dualSabers = qfalse;
00251 int validStyles = 0, styleNum;
00252
00253 if ( saber2 && saber2->model && saber2->model[0] )
00254 {
00255 dualSabers = qtrue;
00256 }
00257
00258 if ( dualSabers )
00259 {
00260 if ( saberHolstered > 1 )
00261 {
00262 saber1Active = saber2Active = qfalse;
00263 }
00264 else if ( saberHolstered > 0 )
00265 {
00266 saber1Active = qtrue;
00267 saber2Active = qfalse;
00268 }
00269 else
00270 {
00271 saber1Active = saber2Active = qtrue;
00272 }
00273 }
00274 else
00275 {
00276 saber2Active = qfalse;
00277 if ( !saber1
00278 || !saber1->model
00279 || !saber1->model[0] )
00280 {
00281 saber1Active = qfalse;
00282 }
00283 else if ( saber1->numBlades > 1 )
00284 {
00285 if ( saberHolstered > 1 )
00286 {
00287 saber1Active = qfalse;
00288 }
00289 else
00290 {
00291 saber1Active = qtrue;
00292 }
00293 }
00294 else
00295 {
00296 if ( saberHolstered )
00297 {
00298 saber1Active = qfalse;
00299 }
00300 else
00301 {
00302 saber1Active = qtrue;
00303 }
00304 }
00305 }
00306
00307
00308 for ( styleNum = SS_NONE+1; styleNum < SS_NUM_SABER_STYLES; styleNum++ )
00309 {
00310 validStyles |= (1<<styleNum);
00311 }
00312
00313 if ( saber1Active
00314 && saber1
00315 && saber1->model
00316 && saber1->model[0]
00317 && saber1->stylesForbidden )
00318 {
00319 if ( (saber1->stylesForbidden&(1<<*saberAnimLevel)) )
00320 {
00321 styleInvalid = qtrue;
00322 validStyles &= ~saber1->stylesForbidden;
00323 }
00324 }
00325 if ( dualSabers )
00326 {
00327 if ( saber2Active
00328 && saber2->stylesForbidden )
00329 {
00330 if ( (saber2->stylesForbidden&(1<<*saberAnimLevel)) )
00331 {
00332 styleInvalid = qtrue;
00333
00334 validStyles &= ~saber2->stylesForbidden;
00335 }
00336 }
00337 }
00338 if ( styleInvalid && validStyles )
00339 {
00340 int styleNum;
00341 for ( styleNum = SS_FAST; styleNum < SS_NUM_SABER_STYLES; styleNum++ )
00342 {
00343 if ( (validStyles&(1<<styleNum)) )
00344 {
00345 *saberAnimLevel = styleNum;
00346 return qtrue;
00347 }
00348 }
00349 }
00350 return qfalse;
00351 }
00352
00353 qboolean WP_SaberStyleValidForSaber( saberInfo_t *saber1, saberInfo_t *saber2, int saberHolstered, int saberAnimLevel )
00354 {
00355 qboolean saber1Active;
00356 qboolean saber2Active;
00357 qboolean dualSabers = qfalse;
00358
00359 if ( saber2 && saber2->model && saber2->model[0] )
00360 {
00361 dualSabers = qtrue;
00362 }
00363
00364 if ( dualSabers )
00365 {
00366 if ( saberHolstered > 1 )
00367 {
00368 saber1Active = saber2Active = qfalse;
00369 }
00370 else if ( saberHolstered > 0 )
00371 {
00372 saber1Active = qtrue;
00373 saber2Active = qfalse;
00374 }
00375 else
00376 {
00377 saber1Active = saber2Active = qtrue;
00378 }
00379 }
00380 else
00381 {
00382 saber2Active = qfalse;
00383 if ( !saber1
00384 || !saber1->model
00385 || !saber1->model[0] )
00386 {
00387 saber1Active = qfalse;
00388 }
00389 else if ( saber1->numBlades > 1 )
00390 {
00391 if ( saberHolstered > 1 )
00392 {
00393 saber1Active = qfalse;
00394 }
00395 else
00396 {
00397 saber1Active = qtrue;
00398 }
00399 }
00400 else
00401 {
00402 if ( saberHolstered )
00403 {
00404 saber1Active = qfalse;
00405 }
00406 else
00407 {
00408 saber1Active = qtrue;
00409 }
00410 }
00411 }
00412
00413 if ( saber1Active
00414 && saber1
00415 && saber1->model
00416 && saber1->model[0]
00417 && saber1->stylesForbidden )
00418 {
00419 if ( (saber1->stylesForbidden&(1<<saberAnimLevel)) )
00420 {
00421 return qfalse;
00422 }
00423 }
00424 if ( dualSabers
00425 && saber2Active
00426 && saber2
00427 && saber2->model
00428 && saber2->model[0] )
00429 {
00430 if ( saber2->stylesForbidden )
00431 {
00432 if ( (saber2->stylesForbidden&(1<<saberAnimLevel)) )
00433 {
00434 return qfalse;
00435 }
00436 }
00437
00438 if ( saberAnimLevel != SS_DUAL )
00439 {
00440 if ( saberAnimLevel != SS_TAVION )
00441 {
00442 return qfalse;
00443 }
00444 else
00445 {
00446 if ( saber1Active
00447 && saber1
00448 && saber1->model
00449 && saber1->model[0]
00450 && (saber1->stylesLearned&(1<<SS_TAVION)) )
00451 {
00452 }
00453 else if ( (saber2->stylesLearned&(1<<SS_TAVION)) )
00454 {
00455 }
00456 else
00457 {
00458 return qfalse;
00459 }
00460 }
00461 }
00462 }
00463 return qtrue;
00464 }
00465
00466 qboolean WP_SaberCanTurnOffSomeBlades( saberInfo_t *saber )
00467 {
00468 if ( saber->bladeStyle2Start > 0
00469 && saber->numBlades > saber->bladeStyle2Start )
00470 {
00471 if ( (saber->saberFlags2&SFL2_NO_MANUAL_DEACTIVATE)
00472 && (saber->saberFlags2&SFL2_NO_MANUAL_DEACTIVATE2) )
00473 {
00474 return qfalse;
00475 }
00476 }
00477 else
00478 {
00479 if ( (saber->saberFlags2&SFL2_NO_MANUAL_DEACTIVATE) )
00480 {
00481 return qfalse;
00482 }
00483 }
00484
00485 return qtrue;
00486 }
00487
00488 void WP_SaberSetDefaults( saberInfo_t *saber )
00489 {
00490 int i;
00491
00492
00493 for ( i = 0; i < MAX_BLADES; i++ )
00494 {
00495 saber->blade[i].color = SABER_RED;
00496 saber->blade[i].radius = SABER_RADIUS_STANDARD;
00497 saber->blade[i].lengthMax = 32;
00498 }
00499
00500 strcpy(saber->name, "default");
00501 strcpy(saber->fullName, "lightsaber");
00502 strcpy(saber->model, "models/weapons2/saber_reborn/saber_w.glm");
00503 saber->skin = 0;
00504 saber->soundOn = BG_SoundIndex( "sound/weapons/saber/enemy_saber_on.wav" );
00505 saber->soundLoop = BG_SoundIndex( "sound/weapons/saber/saberhum3.wav" );
00506 saber->soundOff = BG_SoundIndex( "sound/weapons/saber/enemy_saber_off.wav" );
00507 saber->numBlades = 1;
00508 saber->type = SABER_SINGLE;
00509 saber->stylesLearned = 0;
00510 saber->stylesForbidden = 0;
00511 saber->maxChain = 0;
00512 saber->forceRestrictions = 0;
00513 saber->lockBonus = 0;
00514 saber->parryBonus = 0;
00515 saber->breakParryBonus = 0;
00516 saber->breakParryBonus2 = 0;
00517 saber->disarmBonus = 0;
00518 saber->disarmBonus2 = 0;
00519 saber->singleBladeStyle = SS_NONE;
00520
00521
00522
00523
00524 saber->saberFlags = 0;
00525 saber->saberFlags2 = 0;
00526
00527 saber->spinSound = 0;
00528 saber->swingSound[0] = 0;
00529 saber->swingSound[1] = 0;
00530 saber->swingSound[2] = 0;
00531
00532
00533 saber->moveSpeedScale = 1.0f;
00534 saber->animSpeedScale = 1.0f;
00535
00536 saber->kataMove = LS_INVALID;
00537 saber->lungeAtkMove = LS_INVALID;
00538 saber->jumpAtkUpMove = LS_INVALID;
00539 saber->jumpAtkFwdMove = LS_INVALID;
00540 saber->jumpAtkBackMove = LS_INVALID;
00541 saber->jumpAtkRightMove = LS_INVALID;
00542 saber->jumpAtkLeftMove = LS_INVALID;
00543 saber->readyAnim = -1;
00544 saber->drawAnim = -1;
00545 saber->putawayAnim = -1;
00546 saber->tauntAnim = -1;
00547 saber->bowAnim = -1;
00548 saber->meditateAnim = -1;
00549 saber->flourishAnim = -1;
00550 saber->gloatAnim = -1;
00551
00552
00553 saber->bladeStyle2Start = 0;
00554
00555
00556
00557
00558
00559 saber->trailStyle = 0;
00560 saber->g2MarksShader = 0;
00561 saber->g2WeaponMarkShader = 0;
00562
00563
00564 saber->hitSound[0] = 0;
00565 saber->hitSound[1] = 0;
00566 saber->hitSound[2] = 0;
00567 saber->blockSound[0] = 0;
00568 saber->blockSound[1] = 0;
00569 saber->blockSound[2] = 0;
00570 saber->bounceSound[0] = 0;
00571 saber->bounceSound[1] = 0;
00572 saber->bounceSound[2] = 0;
00573 saber->blockEffect = 0;
00574 saber->hitPersonEffect = 0;
00575 saber->hitOtherEffect = 0;
00576 saber->bladeEffect = 0;
00577
00578
00579 saber->knockbackScale = 0;
00580 saber->damageScale = 1.0f;
00581 saber->splashRadius = 0.0f;
00582 saber->splashDamage = 0;
00583 saber->splashKnockback = 0.0f;
00584
00585
00586
00587 saber->trailStyle2 = 0;
00588 saber->g2MarksShader2 = 0;
00589 saber->g2WeaponMarkShader2 = 0;
00590
00591
00592 saber->hit2Sound[0] = 0;
00593 saber->hit2Sound[1] = 0;
00594 saber->hit2Sound[2] = 0;
00595 saber->block2Sound[0] = 0;
00596 saber->block2Sound[1] = 0;
00597 saber->block2Sound[2] = 0;
00598 saber->bounce2Sound[0] = 0;
00599 saber->bounce2Sound[1] = 0;
00600 saber->bounce2Sound[2] = 0;
00601 saber->blockEffect2 = 0;
00602 saber->hitPersonEffect2 = 0;
00603 saber->hitOtherEffect2 = 0;
00604 saber->bladeEffect2 = 0;
00605
00606
00607 saber->knockbackScale2 = 0;
00608 saber->damageScale2 = 1.0f;
00609 saber->splashRadius2 = 0.0f;
00610 saber->splashDamage2 = 0;
00611 saber->splashKnockback2 = 0.0f;
00612
00613 }
00614
00615 #define DEFAULT_SABER "Kyle"
00616
00617 qboolean WP_SaberParseParms( const char *SaberName, saberInfo_t *saber )
00618 {
00619 const char *token;
00620 const char *value;
00621 const char *p;
00622 char useSaber[1024];
00623 float f;
00624 int n;
00625 qboolean triedDefault = qfalse;
00626 int saberMove = LS_INVALID;
00627 int anim = -1;
00628
00629 if ( !saber )
00630 {
00631 return qfalse;
00632 }
00633
00634
00635 WP_SaberSetDefaults( saber );
00636
00637 if ( !SaberName || !SaberName[0] )
00638 {
00639 strcpy(useSaber, DEFAULT_SABER);
00640 triedDefault = qtrue;
00641 }
00642 else
00643 {
00644 strcpy(useSaber, SaberName);
00645 }
00646
00647
00648 p = SaberParms;
00649 COM_BeginParseSession("saberinfo");
00650
00651
00652 while ( p )
00653 {
00654 token = COM_ParseExt( &p, qtrue );
00655 if ( token[0] == 0 )
00656 {
00657 if (!triedDefault)
00658 {
00659 p = SaberParms;
00660 COM_BeginParseSession("saberinfo");
00661 strcpy(useSaber, DEFAULT_SABER);
00662 triedDefault = qtrue;
00663 }
00664 else
00665 {
00666 return qfalse;
00667 }
00668 }
00669
00670 if ( !Q_stricmp( token, useSaber ) )
00671 {
00672 break;
00673 }
00674
00675 SkipBracedSection( &p );
00676 }
00677 if ( !p )
00678 {
00679 return qfalse;
00680 }
00681
00682
00683 strcpy(saber->name, useSaber);
00684
00685 if ( BG_ParseLiteral( &p, "{" ) )
00686 {
00687 return qfalse;
00688 }
00689
00690
00691 while ( 1 )
00692 {
00693 token = COM_ParseExt( &p, qtrue );
00694 if ( !token[0] )
00695 {
00696 Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", useSaber );
00697 return qfalse;
00698 }
00699
00700 if ( !Q_stricmp( token, "}" ) )
00701 {
00702 break;
00703 }
00704
00705
00706 if ( !Q_stricmp( token, "name" ) )
00707 {
00708 if ( COM_ParseString( &p, &value ) )
00709 {
00710 continue;
00711 }
00712 strcpy(saber->fullName, value);
00713 continue;
00714 }
00715
00716
00717 if ( !Q_stricmp( token, "saberType" ) )
00718 {
00719 int saberType;
00720
00721 if ( COM_ParseString( &p, &value ) )
00722 {
00723 continue;
00724 }
00725 saberType = GetIDForString( SaberTable, value );
00726 if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS )
00727 {
00728 saber->type = (saberType_t)saberType;
00729 }
00730 continue;
00731 }
00732
00733
00734 if ( !Q_stricmp( token, "saberModel" ) )
00735 {
00736 if ( COM_ParseString( &p, &value ) )
00737 {
00738 continue;
00739 }
00740 strcpy(saber->model, value);
00741 continue;
00742 }
00743
00744 if ( !Q_stricmp( token, "customSkin" ) )
00745 {
00746 if ( COM_ParseString( &p, &value ) )
00747 {
00748 continue;
00749 }
00750 saber->skin = trap_R_RegisterSkin(value);
00751 continue;
00752 }
00753
00754
00755 if ( !Q_stricmp( token, "soundOn" ) )
00756 {
00757 if ( COM_ParseString( &p, &value ) )
00758 {
00759 continue;
00760 }
00761 saber->soundOn = BG_SoundIndex( (char *)value );
00762 continue;
00763 }
00764
00765
00766 if ( !Q_stricmp( token, "soundLoop" ) )
00767 {
00768 if ( COM_ParseString( &p, &value ) )
00769 {
00770 continue;
00771 }
00772 saber->soundLoop = BG_SoundIndex( (char *)value );
00773 continue;
00774 }
00775
00776
00777 if ( !Q_stricmp( token, "soundOff" ) )
00778 {
00779 if ( COM_ParseString( &p, &value ) )
00780 {
00781 continue;
00782 }
00783 saber->soundOff = BG_SoundIndex( (char *)value );
00784 continue;
00785 }
00786
00787 if ( !Q_stricmp( token, "numBlades" ) )
00788 {
00789 if ( COM_ParseInt( &p, &n ) )
00790 {
00791 SkipRestOfLine( &p );
00792 continue;
00793 }
00794 if ( n < 1 || n > MAX_BLADES )
00795 {
00796 Com_Error(ERR_DROP, "WP_SaberParseParms: saber %s has illegal number of blades (%d) max: %d", useSaber, n, MAX_BLADES );
00797 continue;
00798 }
00799 saber->numBlades = n;
00800 continue;
00801 }
00802
00803
00804 if ( !Q_stricmpn( token, "saberColor", 10 ) )
00805 {
00806 if (strlen(token)==10)
00807 {
00808 n = -1;
00809 }
00810 else if (strlen(token)==11)
00811 {
00812 n = atoi(&token[10])-1;
00813 if (n > 7 || n < 1 )
00814 {
00815 Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber );
00816 continue;
00817 }
00818 }
00819 else
00820 {
00821 Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber );
00822 continue;
00823 }
00824
00825 if ( COM_ParseString( &p, &value ) )
00826 {
00827 continue;
00828 }
00829
00830 if (n==-1)
00831 {
00832 saber_colors_t color = TranslateSaberColor( value );
00833 for ( n = 0; n < MAX_BLADES; n++ )
00834 {
00835 saber->blade[n].color = color;
00836 }
00837 } else
00838 {
00839 saber->blade[n].color = TranslateSaberColor( value );
00840 }
00841 continue;
00842 }
00843
00844
00845 if ( !Q_stricmpn( token, "saberLength", 11 ) )
00846 {
00847 if (strlen(token)==11)
00848 {
00849 n = -1;
00850 }
00851 else if (strlen(token)==12)
00852 {
00853 n = atoi(&token[11])-1;
00854 if (n > 7 || n < 1 )
00855 {
00856 Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber );
00857 continue;
00858 }
00859 }
00860 else
00861 {
00862 Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber );
00863 continue;
00864 }
00865
00866 if ( COM_ParseFloat( &p, &f ) )
00867 {
00868 SkipRestOfLine( &p );
00869 continue;
00870 }
00871
00872 if ( f < 4.0f )
00873 {
00874 f = 4.0f;
00875 }
00876
00877 if (n==-1)
00878 {
00879 for ( n = 0; n < MAX_BLADES; n++ )
00880 {
00881 saber->blade[n].lengthMax = f;
00882 }
00883 }
00884 else
00885 {
00886 saber->blade[n].lengthMax = f;
00887 }
00888 continue;
00889 }
00890
00891
00892 if ( !Q_stricmpn( token, "saberRadius", 11 ) )
00893 {
00894 if (strlen(token)==11)
00895 {
00896 n = -1;
00897 }
00898 else if (strlen(token)==12)
00899 {
00900 n = atoi(&token[11])-1;
00901 if (n > 7 || n < 1 )
00902 {
00903 Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber );
00904 continue;
00905 }
00906 }
00907 else
00908 {
00909 Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber );
00910 continue;
00911 }
00912
00913 if ( COM_ParseFloat( &p, &f ) )
00914 {
00915 SkipRestOfLine( &p );
00916 continue;
00917 }
00918
00919 if ( f < 0.25f )
00920 {
00921 f = 0.25f;
00922 }
00923 if (n==-1)
00924 {
00925 for ( n = 0; n < MAX_BLADES; n++ )
00926 {
00927 saber->blade[n].radius = f;
00928 }
00929 }
00930 else
00931 {
00932 saber->blade[n].radius = f;
00933 }
00934 continue;
00935 }
00936
00937
00938 if ( !Q_stricmp( token, "saberStyle" ) )
00939 {
00940 int style, styleNum;
00941 if ( COM_ParseString( &p, &value ) )
00942 {
00943 continue;
00944 }
00945
00946 style = TranslateSaberStyle( value );
00947
00948 saber->stylesLearned = (1<<style);
00949
00950 saber->stylesForbidden = 0;
00951 for ( styleNum = SS_NONE+1; styleNum < SS_NUM_SABER_STYLES; styleNum++ )
00952 {
00953 if ( styleNum != style )
00954 {
00955 saber->stylesForbidden |= (1<<styleNum);
00956 }
00957 }
00958 continue;
00959 }
00960
00961
00962 if ( !Q_stricmp( token, "saberStyleLearned" ) )
00963 {
00964 if ( COM_ParseString( &p, &value ) )
00965 {
00966 continue;
00967 }
00968 saber->stylesLearned |= (1<<TranslateSaberStyle( value ));
00969 continue;
00970 }
00971
00972
00973 if ( !Q_stricmp( token, "saberStyleForbidden" ) )
00974 {
00975 if ( COM_ParseString( &p, &value ) )
00976 {
00977 continue;
00978 }
00979 saber->stylesForbidden |= (1<<TranslateSaberStyle( value ));
00980 continue;
00981 }
00982
00983
00984 if ( !Q_stricmp( token, "maxChain" ) )
00985 {
00986 if ( COM_ParseInt( &p, &n ) )
00987 {
00988 SkipRestOfLine( &p );
00989 continue;
00990 }
00991 saber->maxChain = n;
00992 continue;
00993 }
00994
00995
00996 if ( !Q_stricmp( token, "lockable" ) )
00997 {
00998 if ( COM_ParseInt( &p, &n ) )
00999 {
01000 SkipRestOfLine( &p );
01001 continue;
01002 }
01003 if ( n == 0 )
01004 {
01005 saber->saberFlags |= SFL_NOT_LOCKABLE;
01006 }
01007 continue;
01008 }
01009
01010
01011 if ( !Q_stricmp( token, "throwable" ) )
01012 {
01013 if ( COM_ParseInt( &p, &n ) )
01014 {
01015 SkipRestOfLine( &p );
01016 continue;
01017 }
01018 if ( n == 0 )
01019 {
01020 saber->saberFlags |= SFL_NOT_THROWABLE;
01021 }
01022 continue;
01023 }
01024
01025
01026 if ( !Q_stricmp( token, "disarmable" ) )
01027 {
01028 if ( COM_ParseInt( &p, &n ) )
01029 {
01030 SkipRestOfLine( &p );
01031 continue;
01032 }
01033 if ( n == 0 )
01034 {
01035 saber->saberFlags |= SFL_NOT_DISARMABLE;
01036 }
01037 continue;
01038 }
01039
01040
01041 if ( !Q_stricmp( token, "blocking" ) )
01042 {
01043 if ( COM_ParseInt( &p, &n ) )
01044 {
01045 SkipRestOfLine( &p );
01046 continue;
01047 }
01048 if ( n == 0 )
01049 {
01050 saber->saberFlags |= SFL_NOT_ACTIVE_BLOCKING;
01051 }
01052 continue;
01053 }
01054
01055
01056 if ( !Q_stricmp( token, "twoHanded" ) )
01057 {
01058 if ( COM_ParseInt( &p, &n ) )
01059 {
01060 SkipRestOfLine( &p );
01061 continue;
01062 }
01063 if ( n )
01064 {
01065 saber->saberFlags |= SFL_TWO_HANDED;
01066 }
01067 continue;
01068 }
01069
01070
01071 if ( !Q_stricmp( token, "forceRestrict" ) )
01072 {
01073 int fp;
01074
01075 if ( COM_ParseString( &p, &value ) )
01076 {
01077 continue;
01078 }
01079 fp = GetIDForString( FPTable, value );
01080 if ( fp >= FP_FIRST && fp < NUM_FORCE_POWERS )
01081 {
01082 saber->forceRestrictions |= (1<<fp);
01083 }
01084 continue;
01085 }
01086
01087
01088 if ( !Q_stricmp( token, "lockBonus" ) )
01089 {
01090 if ( COM_ParseInt( &p, &n ) )
01091 {
01092 SkipRestOfLine( &p );
01093 continue;
01094 }
01095 saber->lockBonus = n;
01096 continue;
01097 }
01098
01099
01100 if ( !Q_stricmp( token, "parryBonus" ) )
01101 {
01102 if ( COM_ParseInt( &p, &n ) )
01103 {
01104 SkipRestOfLine( &p );
01105 continue;
01106 }
01107 saber->parryBonus = n;
01108 continue;
01109 }
01110
01111
01112 if ( !Q_stricmp( token, "breakParryBonus" ) )
01113 {
01114 if ( COM_ParseInt( &p, &n ) )
01115 {
01116 SkipRestOfLine( &p );
01117 continue;
01118 }
01119 saber->breakParryBonus = n;
01120 continue;
01121 }
01122
01123
01124 if ( !Q_stricmp( token, "breakParryBonus2" ) )
01125 {
01126 if ( COM_ParseInt( &p, &n ) )
01127 {
01128 SkipRestOfLine( &p );
01129 continue;
01130 }
01131 saber->breakParryBonus2 = n;
01132 continue;
01133 }
01134
01135
01136 if ( !Q_stricmp( token, "disarmBonus" ) )
01137 {
01138 if ( COM_ParseInt( &p, &n ) )
01139 {
01140 SkipRestOfLine( &p );
01141 continue;
01142 }
01143 saber->disarmBonus = n;
01144 continue;
01145 }
01146
01147
01148 if ( !Q_stricmp( token, "disarmBonus2" ) )
01149 {
01150 if ( COM_ParseInt( &p, &n ) )
01151 {
01152 SkipRestOfLine( &p );
01153 continue;
01154 }
01155 saber->disarmBonus2 = n;
01156 continue;
01157 }
01158
01159
01160 if ( !Q_stricmp( token, "singleBladeStyle" ) )
01161 {
01162 if ( COM_ParseString( &p, &value ) )
01163 {
01164 continue;
01165 }
01166 saber->singleBladeStyle = TranslateSaberStyle( value );
01167 continue;
01168 }
01169
01170
01171 if ( !Q_stricmp( token, "singleBladeThrowable" ) )
01172 {
01173 if ( COM_ParseInt( &p, &n ) )
01174 {
01175 SkipRestOfLine( &p );
01176 continue;
01177 }
01178 if ( n )
01179 {
01180 saber->saberFlags |= SFL_SINGLE_BLADE_THROWABLE;
01181 }
01182 continue;
01183 }
01184
01185
01186 if ( !Q_stricmp( token, "brokenSaber1" ) )
01187 {
01188 if ( COM_ParseString( &p, &value ) )
01189 {
01190 continue;
01191 }
01192
01193 continue;
01194 }
01195
01196
01197 if ( !Q_stricmp( token, "brokenSaber2" ) )
01198 {
01199 if ( COM_ParseString( &p, &value ) )
01200 {
01201 continue;
01202 }
01203
01204 continue;
01205 }
01206
01207
01208 if ( !Q_stricmp( token, "returnDamage" ) )
01209 {
01210 if ( COM_ParseInt( &p, &n ) )
01211 {
01212 SkipRestOfLine( &p );
01213 continue;
01214 }
01215 if ( n )
01216 {
01217 saber->saberFlags |= SFL_RETURN_DAMAGE;
01218 }
01219 continue;
01220 }
01221
01222
01223 if ( !Q_stricmp( token, "spinSound" ) )
01224 {
01225 if ( COM_ParseString( &p, &value ) )
01226 {
01227 continue;
01228 }
01229 saber->spinSound = BG_SoundIndex( (char *)value );
01230 continue;
01231 }
01232
01233
01234 if ( !Q_stricmp( token, "swingSound1" ) )
01235 {
01236 if ( COM_ParseString( &p, &value ) )
01237 {
01238 continue;
01239 }
01240 saber->swingSound[0] = BG_SoundIndex( (char *)value );
01241 continue;
01242 }
01243
01244
01245 if ( !Q_stricmp( token, "swingSound2" ) )
01246 {
01247 if ( COM_ParseString( &p, &value ) )
01248 {
01249 continue;
01250 }
01251 saber->swingSound[1] = BG_SoundIndex( (char *)value );
01252 continue;
01253 }
01254
01255
01256 if ( !Q_stricmp( token, "swingSound3" ) )
01257 {
01258 if ( COM_ParseString( &p, &value ) )
01259 {
01260 continue;
01261 }
01262 saber->swingSound[2] = BG_SoundIndex( (char *)value );
01263 continue;
01264 }
01265
01266
01267 if ( !Q_stricmp( token, "moveSpeedScale" ) )
01268 {
01269 if ( COM_ParseFloat( &p, &f ) )
01270 {
01271 SkipRestOfLine( &p );
01272 continue;
01273 }
01274 saber->moveSpeedScale = f;
01275 continue;
01276 }
01277
01278
01279 if ( !Q_stricmp( token, "animSpeedScale" ) )
01280 {
01281 if ( COM_ParseFloat( &p, &f ) )
01282 {
01283 SkipRestOfLine( &p );
01284 continue;
01285 }
01286 saber->animSpeedScale = f;
01287 continue;
01288 }
01289
01290
01291 if ( !Q_stricmp( token, "bounceOnWalls" ) )
01292 {
01293 if ( COM_ParseInt( &p, &n ) )
01294 {
01295 SkipRestOfLine( &p );
01296 continue;
01297 }
01298 if ( n )
01299 {
01300 saber->saberFlags |= SFL_BOUNCE_ON_WALLS;
01301 }
01302 continue;
01303 }
01304
01305
01306 if ( !Q_stricmp( token, "boltToWrist" ) )
01307 {
01308 if ( COM_ParseInt( &p, &n ) )
01309 {
01310 SkipRestOfLine( &p );
01311 continue;
01312 }
01313 if ( n )
01314 {
01315 saber->saberFlags |= SFL_BOLT_TO_WRIST;
01316 }
01317 continue;
01318 }
01319
01320
01321 if ( !Q_stricmp( token, "kataMove" ) )
01322 {
01323 if ( COM_ParseString( &p, &value ) )
01324 {
01325 continue;
01326 }
01327 saberMove = GetIDForString( SaberMoveTable, value );
01328 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01329 {
01330 saber->kataMove = saberMove;
01331 }
01332 continue;
01333 }
01334
01335 if ( !Q_stricmp( token, "lungeAtkMove" ) )
01336 {
01337 if ( COM_ParseString( &p, &value ) )
01338 {
01339 continue;
01340 }
01341 saberMove = GetIDForString( SaberMoveTable, value );
01342 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01343 {
01344 saber->lungeAtkMove = saberMove;
01345 }
01346 continue;
01347 }
01348
01349 if ( !Q_stricmp( token, "jumpAtkUpMove" ) )
01350 {
01351 if ( COM_ParseString( &p, &value ) )
01352 {
01353 continue;
01354 }
01355 saberMove = GetIDForString( SaberMoveTable, value );
01356 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01357 {
01358 saber->jumpAtkUpMove = saberMove;
01359 }
01360 continue;
01361 }
01362
01363 if ( !Q_stricmp( token, "jumpAtkFwdMove" ) )
01364 {
01365 if ( COM_ParseString( &p, &value ) )
01366 {
01367 continue;
01368 }
01369 saberMove = GetIDForString( SaberMoveTable, value );
01370 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01371 {
01372 saber->jumpAtkFwdMove = saberMove;
01373 }
01374 continue;
01375 }
01376
01377 if ( !Q_stricmp( token, "jumpAtkBackMove" ) )
01378 {
01379 if ( COM_ParseString( &p, &value ) )
01380 {
01381 continue;
01382 }
01383 saberMove = GetIDForString( SaberMoveTable, value );
01384 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01385 {
01386 saber->jumpAtkBackMove = saberMove;
01387 }
01388 continue;
01389 }
01390
01391 if ( !Q_stricmp( token, "jumpAtkRightMove" ) )
01392 {
01393 if ( COM_ParseString( &p, &value ) )
01394 {
01395 continue;
01396 }
01397 saberMove = GetIDForString( SaberMoveTable, value );
01398 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01399 {
01400 saber->jumpAtkRightMove = saberMove;
01401 }
01402 continue;
01403 }
01404
01405 if ( !Q_stricmp( token, "jumpAtkLeftMove" ) )
01406 {
01407 if ( COM_ParseString( &p, &value ) )
01408 {
01409 continue;
01410 }
01411 saberMove = GetIDForString( SaberMoveTable, value );
01412 if ( saberMove >= LS_INVALID && saberMove < LS_MOVE_MAX )
01413 {
01414 saber->jumpAtkLeftMove = saberMove;
01415 }
01416 continue;
01417 }
01418
01419 if ( !Q_stricmp( token, "readyAnim" ) )
01420 {
01421 if ( COM_ParseString( &p, &value ) )
01422 {
01423 continue;
01424 }
01425 anim = GetIDForString( animTable, value );
01426 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01427 {
01428 saber->readyAnim = anim;
01429 }
01430 continue;
01431 }
01432
01433 if ( !Q_stricmp( token, "drawAnim" ) )
01434 {
01435 if ( COM_ParseString( &p, &value ) )
01436 {
01437 continue;
01438 }
01439 anim = GetIDForString( animTable, value );
01440 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01441 {
01442 saber->drawAnim = anim;
01443 }
01444 continue;
01445 }
01446
01447 if ( !Q_stricmp( token, "putawayAnim" ) )
01448 {
01449 if ( COM_ParseString( &p, &value ) )
01450 {
01451 continue;
01452 }
01453 anim = GetIDForString( animTable, value );
01454 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01455 {
01456 saber->putawayAnim = anim;
01457 }
01458 continue;
01459 }
01460
01461 if ( !Q_stricmp( token, "tauntAnim" ) )
01462 {
01463 if ( COM_ParseString( &p, &value ) )
01464 {
01465 continue;
01466 }
01467 anim = GetIDForString( animTable, value );
01468 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01469 {
01470 saber->tauntAnim = anim;
01471 }
01472 continue;
01473 }
01474
01475 if ( !Q_stricmp( token, "bowAnim" ) )
01476 {
01477 if ( COM_ParseString( &p, &value ) )
01478 {
01479 continue;
01480 }
01481 anim = GetIDForString( animTable, value );
01482 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01483 {
01484 saber->bowAnim = anim;
01485 }
01486 continue;
01487 }
01488
01489 if ( !Q_stricmp( token, "meditateAnim" ) )
01490 {
01491 if ( COM_ParseString( &p, &value ) )
01492 {
01493 continue;
01494 }
01495 anim = GetIDForString( animTable, value );
01496 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01497 {
01498 saber->meditateAnim = anim;
01499 }
01500 continue;
01501 }
01502
01503 if ( !Q_stricmp( token, "flourishAnim" ) )
01504 {
01505 if ( COM_ParseString( &p, &value ) )
01506 {
01507 continue;
01508 }
01509 anim = GetIDForString( animTable, value );
01510 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01511 {
01512 saber->flourishAnim = anim;
01513 }
01514 continue;
01515 }
01516
01517 if ( !Q_stricmp( token, "gloatAnim" ) )
01518 {
01519 if ( COM_ParseString( &p, &value ) )
01520 {
01521 continue;
01522 }
01523 anim = GetIDForString( animTable, value );
01524 if ( anim >= 0 && anim < MAX_ANIMATIONS )
01525 {
01526 saber->gloatAnim = anim;
01527 }
01528 continue;
01529 }
01530
01531
01532 if ( !Q_stricmp( token, "noRollStab" ) )
01533 {
01534 if ( COM_ParseInt( &p, &n ) )
01535 {
01536 SkipRestOfLine( &p );
01537 continue;
01538 }
01539 if ( n )
01540 {
01541 saber->saberFlags |= SFL_NO_ROLL_STAB;
01542 }
01543 continue;
01544 }
01545
01546
01547 if ( !Q_stricmp( token, "noPullAttack" ) )
01548 {
01549 if ( COM_ParseInt( &p, &n ) )
01550 {
01551 SkipRestOfLine( &p );
01552 continue;
01553 }
01554 if ( n )
01555 {
01556 saber->saberFlags |= SFL_NO_PULL_ATTACK;
01557 }
01558 continue;
01559 }
01560
01561
01562 if ( !Q_stricmp( token, "noBackAttack" ) )
01563 {
01564 if ( COM_ParseInt( &p, &n ) )
01565 {
01566 SkipRestOfLine( &p );
01567 continue;
01568 }
01569 if ( n )
01570 {
01571 saber->saberFlags |= SFL_NO_BACK_ATTACK;
01572 }
01573 continue;
01574 }
01575
01576
01577 if ( !Q_stricmp( token, "noStabDown" ) )
01578 {
01579 if ( COM_ParseInt( &p, &n ) )
01580 {
01581 SkipRestOfLine( &p );
01582 continue;
01583 }
01584 if ( n )
01585 {
01586 saber->saberFlags |= SFL_NO_STABDOWN;
01587 }
01588 continue;
01589 }
01590
01591
01592 if ( !Q_stricmp( token, "noWallRuns" ) )
01593 {
01594 if ( COM_ParseInt( &p, &n ) )
01595 {
01596 SkipRestOfLine( &p );
01597 continue;
01598 }
01599 if ( n )
01600 {
01601 saber->saberFlags |= SFL_NO_WALL_RUNS;
01602 }
01603 continue;
01604 }
01605
01606
01607 if ( !Q_stricmp( token, "noWallFlips" ) )
01608 {
01609 if ( COM_ParseInt( &p, &n ) )
01610 {
01611 SkipRestOfLine( &p );
01612 continue;
01613 }
01614 if ( n )
01615 {
01616 saber->saberFlags |= SFL_NO_WALL_FLIPS;
01617 }
01618 continue;
01619 }
01620
01621
01622 if ( !Q_stricmp( token, "noWallGrab" ) )
01623 {
01624 if ( COM_ParseInt( &p, &n ) )
01625 {
01626 SkipRestOfLine( &p );
01627 continue;
01628 }
01629 if ( n )
01630 {
01631 saber->saberFlags |= SFL_NO_WALL_GRAB;
01632 }
01633 continue;
01634 }
01635
01636
01637 if ( !Q_stricmp( token, "noRolls" ) )
01638 {
01639 if ( COM_ParseInt( &p, &n ) )
01640 {
01641 SkipRestOfLine( &p );
01642 continue;
01643 }
01644 if ( n )
01645 {
01646 saber->saberFlags |= SFL_NO_ROLLS;
01647 }
01648 continue;
01649 }
01650
01651
01652 if ( !Q_stricmp( token, "noFlips" ) )
01653 {
01654 if ( COM_ParseInt( &p, &n ) )
01655 {
01656 SkipRestOfLine( &p );
01657 continue;
01658 }
01659 if ( n )
01660 {
01661 saber->saberFlags |= SFL_NO_FLIPS;
01662 }
01663 continue;
01664 }
01665
01666
01667 if ( !Q_stricmp( token, "noCartwheels" ) )
01668 {
01669 if ( COM_ParseInt( &p, &n ) )
01670 {
01671 SkipRestOfLine( &p );
01672 continue;
01673 }
01674 if ( n )
01675 {
01676 saber->saberFlags |= SFL_NO_CARTWHEELS;
01677 }
01678 continue;
01679 }
01680
01681
01682 if ( !Q_stricmp( token, "noKicks" ) )
01683 {
01684 if ( COM_ParseInt( &p, &n ) )
01685 {
01686 SkipRestOfLine( &p );
01687 continue;
01688 }
01689 if ( n )
01690 {
01691 saber->saberFlags |= SFL_NO_KICKS;
01692 }
01693 continue;
01694 }
01695
01696
01697 if ( !Q_stricmp( token, "noMirrorAttacks" ) )
01698 {
01699 if ( COM_ParseInt( &p, &n ) )
01700 {
01701 SkipRestOfLine( &p );
01702 continue;
01703 }
01704 if ( n )
01705 {
01706 saber->saberFlags |= SFL_NO_MIRROR_ATTACKS;
01707 }
01708 continue;
01709 }
01710
01711
01712 if ( !Q_stricmp( token, "onInWater" ) )
01713 {
01714 SkipRestOfLine( &p );
01715 continue;
01716 }
01717
01718 if ( !Q_stricmp( token, "notInMP" ) )
01719 {
01720 SkipRestOfLine( &p );
01721 continue;
01722 }
01723
01724
01725
01726 if ( !Q_stricmp( token, "bladeStyle2Start" ) )
01727 {
01728 if ( COM_ParseInt( &p, &n ) )
01729 {
01730 SkipRestOfLine( &p );
01731 continue;
01732 }
01733 saber->bladeStyle2Start = n;
01734 continue;
01735 }
01736
01737
01738
01739
01740 if ( !Q_stricmp( token, "noWallMarks" ) )
01741 {
01742 if ( COM_ParseInt( &p, &n ) )
01743 {
01744 SkipRestOfLine( &p );
01745 continue;
01746 }
01747 if ( n )
01748 {
01749 saber->saberFlags2 |= SFL2_NO_WALL_MARKS;
01750 }
01751 continue;
01752 }
01753
01754
01755 if ( !Q_stricmp( token, "noDlight" ) )
01756 {
01757 if ( COM_ParseInt( &p, &n ) )
01758 {
01759 SkipRestOfLine( &p );
01760 continue;
01761 }
01762 if ( n )
01763 {
01764 saber->saberFlags2 |= SFL2_NO_DLIGHT;
01765 }
01766 continue;
01767 }
01768
01769
01770 if ( !Q_stricmp( token, "noBlade" ) )
01771 {
01772 if ( COM_ParseInt( &p, &n ) )
01773 {
01774 SkipRestOfLine( &p );
01775 continue;
01776 }
01777 if ( n )
01778 {
01779 saber->saberFlags2 |= SFL2_NO_BLADE;
01780 }
01781 continue;
01782 }
01783
01784
01785 if ( !Q_stricmp( token, "trailStyle" ) )
01786 {
01787 if ( COM_ParseInt( &p, &n ) )
01788 {
01789 SkipRestOfLine( &p );
01790 continue;
01791 }
01792 saber->trailStyle = n;
01793 continue;
01794 }
01795
01796
01797 if ( !Q_stricmp( token, "g2MarksShader" ) )
01798 {
01799 if ( COM_ParseString( &p, &value ) )
01800 {
01801 SkipRestOfLine( &p );
01802 continue;
01803 }
01804 #ifdef QAGAME//cgame-only cares about this
01805 SkipRestOfLine(&p);
01806 #elif defined CGAME
01807 saber->g2MarksShader = trap_R_RegisterShader( value );
01808 #else
01809 SkipRestOfLine(&p);
01810 #endif
01811 continue;
01812 }
01813
01814
01815 if ( !Q_stricmp( token, "g2WeaponMarkShader" ) )
01816 {
01817 if ( COM_ParseString( &p, &value ) )
01818 {
01819 SkipRestOfLine( &p );
01820 continue;
01821 }
01822 #ifdef QAGAME//cgame-only cares about this
01823 SkipRestOfLine(&p);
01824 #elif defined CGAME
01825 saber->g2WeaponMarkShader = trap_R_RegisterShader( value );
01826 #else
01827 SkipRestOfLine(&p);
01828 #endif
01829 continue;
01830 }
01831
01832
01833 if ( !Q_stricmp( token, "knockbackScale" ) )
01834 {
01835 if ( COM_ParseFloat( &p, &f ) )
01836 {
01837 SkipRestOfLine( &p );
01838 continue;
01839 }
01840 saber->knockbackScale = f;
01841 continue;
01842 }
01843
01844
01845 if ( !Q_stricmp( token, "damageScale" ) )
01846 {
01847 if ( COM_ParseFloat( &p, &f ) )
01848 {
01849 SkipRestOfLine( &p );
01850 continue;
01851 }
01852 saber->damageScale = f;
01853 continue;
01854 }
01855
01856
01857 if ( !Q_stricmp( token, "noDismemberment" ) )
01858 {
01859 if ( COM_ParseInt( &p, &n ) )
01860 {
01861 SkipRestOfLine( &p );
01862 continue;
01863 }
01864 if ( n )
01865 {
01866 saber->saberFlags2 |= SFL2_NO_DISMEMBERMENT;
01867 }
01868 continue;
01869 }
01870
01871
01872 if ( !Q_stricmp( token, "noIdleEffect" ) )
01873 {
01874 if ( COM_ParseInt( &p, &n ) )
01875 {
01876 SkipRestOfLine( &p );
01877 continue;
01878 }
01879 if ( n )
01880 {
01881 saber->saberFlags2 |= SFL2_NO_IDLE_EFFECT;
01882 }
01883 continue;
01884 }
01885
01886
01887 if ( !Q_stricmp( token, "alwaysBlock" ) )
01888 {
01889 if ( COM_ParseInt( &p, &n ) )
01890 {
01891 SkipRestOfLine( &p );
01892 continue;
01893 }
01894 if ( n )
01895 {
01896 saber->saberFlags2 |= SFL2_ALWAYS_BLOCK;
01897 }
01898 continue;
01899 }
01900
01901
01902 if ( !Q_stricmp( token, "noManualDeactivate" ) )
01903 {
01904 if ( COM_ParseInt( &p, &n ) )
01905 {
01906 SkipRestOfLine( &p );
01907 continue;
01908 }
01909 if ( n )
01910 {
01911 saber->saberFlags2 |= SFL2_NO_MANUAL_DEACTIVATE;
01912 }
01913 continue;
01914 }
01915
01916
01917 if ( !Q_stricmp( token, "transitionDamage" ) )
01918 {
01919 if ( COM_ParseInt( &p, &n ) )
01920 {
01921 SkipRestOfLine( &p );
01922 continue;
01923 }
01924 if ( n )
01925 {
01926 saber->saberFlags2 |= SFL2_TRANSITION_DAMAGE;
01927 }
01928 continue;
01929 }
01930
01931
01932 if ( !Q_stricmp( token, "splashRadius" ) )
01933 {
01934 if ( COM_ParseFloat( &p, &f ) )
01935 {
01936 SkipRestOfLine( &p );
01937 continue;
01938 }
01939 saber->splashRadius = f;
01940 continue;
01941 }
01942
01943
01944 if ( !Q_stricmp( token, "splashDamage" ) )
01945 {
01946 if ( COM_ParseInt( &p, &n ) )
01947 {
01948 SkipRestOfLine( &p );
01949 continue;
01950 }
01951 saber->splashDamage = n;
01952 continue;
01953 }
01954
01955
01956 if ( !Q_stricmp( token, "splashKnockback" ) )
01957 {
01958 if ( COM_ParseFloat( &p, &f ) )
01959 {
01960 SkipRestOfLine( &p );
01961 continue;
01962 }
01963 saber->splashKnockback = f;
01964 continue;
01965 }
01966
01967
01968 if ( !Q_stricmp( token, "hitSound1" ) )
01969 {
01970 if ( COM_ParseString( &p, &value ) )
01971 {
01972 continue;
01973 }
01974 saber->hitSound[0] = BG_SoundIndex( (char *)value );
01975 continue;
01976 }
01977
01978
01979 if ( !Q_stricmp( token, "hitSound2" ) )
01980 {
01981 if ( COM_ParseString( &p, &value ) )
01982 {
01983 continue;
01984 }
01985 saber->hitSound[1] = BG_SoundIndex( (char *)value );
01986 continue;
01987 }
01988
01989
01990 if ( !Q_stricmp( token, "hitSound3" ) )
01991 {
01992 if ( COM_ParseString( &p, &value ) )
01993 {
01994 continue;
01995 }
01996 saber->hitSound[2] = BG_SoundIndex( (char *)value );
01997 continue;
01998 }
01999
02000
02001 if ( !Q_stricmp( token, "blockSound1" ) )
02002 {
02003 if ( COM_ParseString( &p, &value ) )
02004 {
02005 continue;
02006 }
02007 saber->blockSound[0] = BG_SoundIndex( (char *)value );
02008 continue;
02009 }
02010
02011
02012 if ( !Q_stricmp( token, "blockSound2" ) )
02013 {
02014 if ( COM_ParseString( &p, &value ) )
02015 {
02016 continue;
02017 }
02018 saber->blockSound[1] = BG_SoundIndex( (char *)value );
02019 continue;
02020 }
02021
02022
02023 if ( !Q_stricmp( token, "blockSound3" ) )
02024 {
02025 if ( COM_ParseString( &p, &value ) )
02026 {
02027 continue;
02028 }
02029 saber->blockSound[2] = BG_SoundIndex( (char *)value );
02030 continue;
02031 }
02032
02033
02034 if ( !Q_stricmp( token, "bounceSound1" ) )
02035 {
02036 if ( COM_ParseString( &p, &value ) )
02037 {
02038 continue;
02039 }
02040 saber->bounceSound[0] = BG_SoundIndex( (char *)value );
02041 continue;
02042 }
02043
02044
02045 if ( !Q_stricmp( token, "bounceSound2" ) )
02046 {
02047 if ( COM_ParseString( &p, &value ) )
02048 {
02049 continue;
02050 }
02051 saber->bounceSound[1] = BG_SoundIndex( (char *)value );
02052 continue;
02053 }
02054
02055
02056 if ( !Q_stricmp( token, "bounceSound3" ) )
02057 {
02058 if ( COM_ParseString( &p, &value ) )
02059 {
02060 continue;
02061 }
02062 saber->bounceSound[2] = BG_SoundIndex( (char *)value );
02063 continue;
02064 }
02065
02066
02067 if ( !Q_stricmp( token, "blockEffect" ) )
02068 {
02069 if ( COM_ParseString( &p, &value ) )
02070 {
02071 continue;
02072 }
02073 #ifdef QAGAME//cgame-only cares about this
02074 SkipRestOfLine(&p);
02075 #elif defined CGAME
02076 saber->blockEffect = trap_FX_RegisterEffect( (char *)value );
02077 #else
02078 SkipRestOfLine(&p);
02079 #endif
02080 continue;
02081 }
02082
02083
02084 if ( !Q_stricmp( token, "hitPersonEffect" ) )
02085 {
02086 if ( COM_ParseString( &p, &value ) )
02087 {
02088 continue;
02089 }
02090 #ifdef QAGAME//cgame-only cares about this
02091 SkipRestOfLine(&p);
02092 #elif defined CGAME
02093 saber->hitPersonEffect = trap_FX_RegisterEffect( (char *)value );
02094 #else
02095 SkipRestOfLine(&p);
02096 #endif
02097 continue;
02098 }
02099
02100
02101 if ( !Q_stricmp( token, "hitOtherEffect" ) )
02102 {
02103 if ( COM_ParseString( &p, &value ) )
02104 {
02105 continue;
02106 }
02107 #ifdef QAGAME//cgame-only cares about this
02108 SkipRestOfLine(&p);
02109 #elif defined CGAME
02110 saber->hitOtherEffect = trap_FX_RegisterEffect( (char *)value );
02111 #else
02112 SkipRestOfLine(&p);
02113 #endif
02114 continue;
02115 }
02116
02117
02118 if ( !Q_stricmp( token, "bladeEffect" ) )
02119 {
02120 if ( COM_ParseString( &p, &value ) )
02121 {
02122 continue;
02123 }
02124 #ifdef QAGAME//cgame-only cares about this
02125 SkipRestOfLine(&p);
02126 #elif defined CGAME
02127 saber->bladeEffect = trap_FX_RegisterEffect( (char *)value );
02128 #else
02129 SkipRestOfLine(&p);
02130 #endif
02131 continue;
02132 }
02133
02134
02135 if ( !Q_stricmp( token, "noClashFlare" ) )
02136 {
02137 if ( COM_ParseInt( &p, &n ) )
02138 {
02139 SkipRestOfLine( &p );
02140 continue;
02141 }
02142 if ( n )
02143 {
02144 saber->saberFlags2 |= SFL2_NO_CLASH_FLARE;
02145 }
02146 continue;
02147 }
02148
02149
02150
02151 if ( !Q_stricmp( token, "noWallMarks2" ) )
02152 {
02153 if ( COM_ParseInt( &p, &n ) )
02154 {
02155 SkipRestOfLine( &p );
02156 continue;
02157 }
02158 if ( n )
02159 {
02160 saber->saberFlags2 |= SFL2_NO_WALL_MARKS2;
02161 }
02162 continue;
02163 }
02164
02165
02166 if ( !Q_stricmp( token, "noDlight2" ) )
02167 {
02168 if ( COM_ParseInt( &p, &n ) )
02169 {
02170 SkipRestOfLine( &p );
02171 continue;
02172 }
02173 if ( n )
02174 {
02175 saber->saberFlags2 |= SFL2_NO_DLIGHT2;
02176 }
02177 continue;
02178 }
02179
02180
02181 if ( !Q_stricmp( token, "noBlade2" ) )
02182 {
02183 if ( COM_ParseInt( &p, &n ) )
02184 {
02185 SkipRestOfLine( &p );
02186 continue;
02187 }
02188 if ( n )
02189 {
02190 saber->saberFlags2 |= SFL2_NO_BLADE2;
02191 }
02192 continue;
02193 }
02194
02195
02196 if ( !Q_stricmp( token, "trailStyle2" ) )
02197 {
02198 if ( COM_ParseInt( &p, &n ) )
02199 {
02200 SkipRestOfLine( &p );
02201 continue;
02202 }
02203 saber->trailStyle2 = n;
02204 continue;
02205 }
02206
02207
02208 if ( !Q_stricmp( token, "g2MarksShader2" ) )
02209 {
02210 if ( COM_ParseString( &p, &value ) )
02211 {
02212 SkipRestOfLine( &p );
02213 continue;
02214 }
02215 #ifdef QAGAME//cgame-only cares about this
02216 SkipRestOfLine(&p);
02217 #elif defined CGAME
02218 saber->g2MarksShader2 = trap_R_RegisterShader( value );
02219 #else
02220 SkipRestOfLine(&p);
02221 #endif
02222 continue;
02223 }
02224
02225
02226 if ( !Q_stricmp( token, "g2WeaponMarkShader2" ) )
02227 {
02228 if ( COM_ParseString( &p, &value ) )
02229 {
02230 SkipRestOfLine( &p );
02231 continue;
02232 }
02233 #ifdef QAGAME//cgame-only cares about this
02234 SkipRestOfLine(&p);
02235 #elif defined CGAME
02236 saber->g2WeaponMarkShader2 = trap_R_RegisterShader( value );
02237 #else
02238 SkipRestOfLine(&p);
02239 #endif
02240 continue;
02241 }
02242
02243
02244 if ( !Q_stricmp( token, "knockbackScale2" ) )
02245 {
02246 if ( COM_ParseFloat( &p, &f ) )
02247 {
02248 SkipRestOfLine( &p );
02249 continue;
02250 }
02251 saber->knockbackScale2 = f;
02252 continue;
02253 }
02254
02255
02256 if ( !Q_stricmp( token, "damageScale2" ) )
02257 {
02258 if ( COM_ParseFloat( &p, &f ) )
02259 {
02260 SkipRestOfLine( &p );
02261 continue;
02262 }
02263 saber->damageScale2 = f;
02264 continue;
02265 }
02266
02267
02268 if ( !Q_stricmp( token, "noDismemberment2" ) )
02269 {
02270 if ( COM_ParseInt( &p, &n ) )
02271 {
02272 SkipRestOfLine( &p );
02273 continue;
02274 }
02275 if ( n )
02276 {
02277 saber->saberFlags2 |= SFL2_NO_DISMEMBERMENT2;
02278 }
02279 continue;
02280 }
02281
02282
02283 if ( !Q_stricmp( token, "noIdleEffect2" ) )
02284 {
02285 if ( COM_ParseInt( &p, &n ) )
02286 {
02287 SkipRestOfLine( &p );
02288 continue;
02289 }
02290 if ( n )
02291 {
02292 saber->saberFlags2 |= SFL2_NO_IDLE_EFFECT2;
02293 }
02294 continue;
02295 }
02296
02297
02298 if ( !Q_stricmp( token, "alwaysBlock2" ) )
02299 {
02300 if ( COM_ParseInt( &p, &n ) )
02301 {
02302 SkipRestOfLine( &p );
02303 continue;
02304 }
02305 if ( n )
02306 {
02307 saber->saberFlags2 |= SFL2_ALWAYS_BLOCK2;
02308 }
02309 continue;
02310 }
02311
02312
02313 if ( !Q_stricmp( token, "noManualDeactivate2" ) )
02314 {
02315 if ( COM_ParseInt( &p, &n ) )
02316 {
02317 SkipRestOfLine( &p );
02318 continue;
02319 }
02320 if ( n )
02321 {
02322 saber->saberFlags2 |= SFL2_NO_MANUAL_DEACTIVATE2;
02323 }
02324 continue;
02325 }
02326
02327
02328 if ( !Q_stricmp( token, "transitionDamage2" ) )
02329 {
02330 if ( COM_ParseInt( &p, &n ) )
02331 {
02332 SkipRestOfLine( &p );
02333 continue;
02334 }
02335 if ( n )
02336 {
02337 saber->saberFlags2 |= SFL2_TRANSITION_DAMAGE2;
02338 }
02339 continue;
02340 }
02341
02342
02343 if ( !Q_stricmp( token, "splashRadius2" ) )
02344 {
02345 if ( COM_ParseFloat( &p, &f ) )
02346 {
02347 SkipRestOfLine( &p );
02348 continue;
02349 }
02350 saber->splashRadius2 = f;
02351 continue;
02352 }
02353
02354
02355 if ( !Q_stricmp( token, "splashDamage2" ) )
02356 {
02357 if ( COM_ParseInt( &p, &n ) )
02358 {
02359 SkipRestOfLine( &p );
02360 continue;
02361 }
02362 saber->splashDamage2 = n;
02363 continue;
02364 }
02365
02366
02367 if ( !Q_stricmp( token, "splashKnockback2" ) )
02368 {
02369 if ( COM_ParseFloat( &p, &f ) )
02370 {
02371 SkipRestOfLine( &p );
02372 continue;
02373 }
02374 saber->splashKnockback2 = f;
02375 continue;
02376 }
02377
02378
02379 if ( !Q_stricmp( token, "hit2Sound1" ) )
02380 {
02381 if ( COM_ParseString( &p, &value ) )
02382 {
02383 continue;
02384 }
02385 saber->hit2Sound[0] = BG_SoundIndex( (char *)value );
02386 continue;
02387 }
02388
02389
02390 if ( !Q_stricmp( token, "hit2Sound2" ) )
02391 {
02392 if ( COM_ParseString( &p, &value ) )
02393 {
02394 continue;
02395 }
02396 saber->hit2Sound[1] = BG_SoundIndex( (char *)value );
02397 continue;
02398 }
02399
02400
02401 if ( !Q_stricmp( token, "hit2Sound3" ) )
02402 {
02403 if ( COM_ParseString( &p, &value ) )
02404 {
02405 continue;
02406 }
02407 saber->hit2Sound[2] = BG_SoundIndex( (char *)value );
02408 continue;
02409 }
02410
02411
02412 if ( !Q_stricmp( token, "block2Sound1" ) )
02413 {
02414 if ( COM_ParseString( &p, &value ) )
02415 {
02416 continue;
02417 }
02418 saber->block2Sound[0] = BG_SoundIndex( (char *)value );
02419 continue;
02420 }
02421
02422
02423 if ( !Q_stricmp( token, "block2Sound2" ) )
02424 {
02425 if ( COM_ParseString( &p, &value ) )
02426 {
02427 continue;
02428 }
02429 saber->block2Sound[1] = BG_SoundIndex( (char *)value );
02430 continue;
02431 }
02432
02433
02434 if ( !Q_stricmp( token, "block2Sound3" ) )
02435 {
02436 if ( COM_ParseString( &p, &value ) )
02437 {
02438 continue;
02439 }
02440 saber->block2Sound[2] = BG_SoundIndex( (char *)value );
02441 continue;
02442 }
02443
02444
02445 if ( !Q_stricmp( token, "bounce2Sound1" ) )
02446 {
02447 if ( COM_ParseString( &p, &value ) )
02448 {
02449 continue;
02450 }
02451 saber->bounce2Sound[0] = BG_SoundIndex( (char *)value );
02452 continue;
02453 }
02454
02455
02456 if ( !Q_stricmp( token, "bounce2Sound2" ) )
02457 {
02458 if ( COM_ParseString( &p, &value ) )
02459 {
02460 continue;
02461 }
02462 saber->bounce2Sound[1] = BG_SoundIndex( (char *)value );
02463 continue;
02464 }
02465
02466
02467 if ( !Q_stricmp( token, "bounce2Sound3" ) )
02468 {
02469 if ( COM_ParseString( &p, &value ) )
02470 {
02471 continue;
02472 }
02473 saber->bounce2Sound[2] = BG_SoundIndex( (char *)value );
02474 continue;
02475 }
02476
02477
02478 if ( !Q_stricmp( token, "blockEffect2" ) )
02479 {
02480 if ( COM_ParseString( &p, &value ) )
02481 {
02482 continue;
02483 }
02484 #ifdef QAGAME//cgame-only cares about this
02485 SkipRestOfLine(&p);
02486 #elif defined CGAME
02487 saber->blockEffect2 = trap_FX_RegisterEffect( (char *)value );
02488 #else
02489 SkipRestOfLine(&p);
02490 #endif
02491 continue;
02492 }
02493
02494
02495 if ( !Q_stricmp( token, "hitPersonEffect2" ) )
02496 {
02497 if ( COM_ParseString( &p, &value ) )
02498 {
02499 continue;
02500 }
02501 #ifdef QAGAME//cgame-only cares about this
02502 SkipRestOfLine(&p);
02503 #elif defined CGAME
02504 saber->hitPersonEffect2 = trap_FX_RegisterEffect( (char *)value );
02505 #else
02506 SkipRestOfLine(&p);
02507 #endif
02508 continue;
02509 }
02510
02511
02512 if ( !Q_stricmp( token, "hitOtherEffect2" ) )
02513 {
02514 if ( COM_ParseString( &p, &value ) )
02515 {
02516 continue;
02517 }
02518 #ifdef QAGAME//cgame-only cares about this
02519 SkipRestOfLine(&p);
02520 #elif defined CGAME
02521 saber->hitOtherEffect2 = trap_FX_RegisterEffect( (char *)value );
02522 #else
02523 SkipRestOfLine(&p);
02524 #endif
02525 continue;
02526 }
02527
02528
02529 if ( !Q_stricmp( token, "bladeEffect2" ) )
02530 {
02531 if ( COM_ParseString( &p, &value ) )
02532 {
02533 continue;
02534 }
02535 #ifdef QAGAME//cgame-only cares about this
02536 SkipRestOfLine(&p);
02537 #elif defined CGAME
02538 saber->bladeEffect2 = trap_FX_RegisterEffect( (char *)value );
02539 #else
02540 SkipRestOfLine(&p);
02541 #endif
02542 continue;
02543 }
02544
02545
02546 if ( !Q_stricmp( token, "noClashFlare2" ) )
02547 {
02548 if ( COM_ParseInt( &p, &n ) )
02549 {
02550 SkipRestOfLine( &p );
02551 continue;
02552 }
02553 if ( n )
02554 {
02555 saber->saberFlags2 |= SFL2_NO_CLASH_FLARE2;
02556 }
02557 continue;
02558 }
02559
02560
02561
02562
02563 #ifdef _DEBUG
02564 Com_Printf( "WARNING: unknown keyword '%s' while parsing '%s'\n", token, useSaber );
02565 #endif
02566 SkipRestOfLine( &p );
02567 }
02568
02569
02570
02571 return qtrue;
02572 }
02573
02574 qboolean WP_SaberParseParm( const char *saberName, const char *parmname, char *saberData )
02575 {
02576 const char *token;
02577 const char *value;
02578 const char *p;
02579
02580 if ( !saberName || !saberName[0] )
02581 {
02582 return qfalse;
02583 }
02584
02585
02586 p = SaberParms;
02587 COM_BeginParseSession("saberinfo");
02588
02589
02590 while ( p )
02591 {
02592 token = COM_ParseExt( &p, qtrue );
02593 if ( token[0] == 0 )
02594 {
02595 return qfalse;
02596 }
02597
02598 if ( !Q_stricmp( token, saberName ) )
02599 {
02600 break;
02601 }
02602
02603 SkipBracedSection( &p );
02604 }
02605 if ( !p )
02606 {
02607 return qfalse;
02608 }
02609
02610 if ( BG_ParseLiteral( &p, "{" ) )
02611 {
02612 return qfalse;
02613 }
02614
02615
02616 while ( 1 )
02617 {
02618 token = COM_ParseExt( &p, qtrue );
02619 if ( !token[0] )
02620 {
02621 Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", saberName );
02622 return qfalse;
02623 }
02624
02625 if ( !Q_stricmp( token, "}" ) )
02626 {
02627 break;
02628 }
02629
02630 if ( !Q_stricmp( token, parmname ) )
02631 {
02632 if ( COM_ParseString( &p, &value ) )
02633 {
02634 continue;
02635 }
02636 strcpy( saberData, value );
02637 return qtrue;
02638 }
02639
02640 SkipRestOfLine( &p );
02641 continue;
02642 }
02643
02644 return qfalse;
02645 }
02646
02647 qboolean WP_SaberValidForPlayerInMP( const char *saberName )
02648 {
02649 char allowed [8]={0};
02650 if ( !WP_SaberParseParm( saberName, "notInMP", allowed ) )
02651 {
02652 return qtrue;
02653 }
02654 if ( !allowed[0] )
02655 {
02656 return qtrue;
02657 }
02658 else
02659 {
02660 return ((qboolean)(atoi(allowed)==0));
02661 }
02662 }
02663
02664 void WP_RemoveSaber( saberInfo_t *sabers, int saberNum )
02665 {
02666 if ( !sabers )
02667 {
02668 return;
02669 }
02670
02671 WP_SaberSetDefaults( &sabers[saberNum] );
02672
02673 strcpy(sabers[saberNum].name, "none");
02674 sabers[saberNum].model[0] = 0;
02675
02676
02677 BG_SI_Deactivate(&sabers[saberNum]);
02678 BG_SI_SetLength(&sabers[saberNum], 0.0f);
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688 }
02689
02690 void WP_SetSaber( int entNum, saberInfo_t *sabers, int saberNum, const char *saberName )
02691 {
02692 if ( !sabers )
02693 {
02694 return;
02695 }
02696 if ( Q_stricmp( "none", saberName ) == 0 || Q_stricmp( "remove", saberName ) == 0 )
02697 {
02698 if (saberNum != 0)
02699 {
02700 WP_RemoveSaber( sabers, saberNum );
02701 }
02702 return;
02703 }
02704
02705 if ( entNum < MAX_CLIENTS &&
02706 !WP_SaberValidForPlayerInMP( saberName ) )
02707 {
02708 WP_SaberParseParms( "Kyle", &sabers[saberNum] );
02709 }
02710 else
02711 {
02712 WP_SaberParseParms( saberName, &sabers[saberNum] );
02713 }
02714 if ((sabers[1].saberFlags&SFL_TWO_HANDED))
02715 {
02716 WP_RemoveSaber( sabers, 1 );
02717 return;
02718 }
02719 else if ((sabers[0].saberFlags&SFL_TWO_HANDED) &&
02720 sabers[1].model[0])
02721 {
02722 WP_RemoveSaber( sabers, 1 );
02723 return;
02724 }
02725 }
02726
02727 void WP_SaberSetColor( saberInfo_t *sabers, int saberNum, int bladeNum, char *colorName )
02728 {
02729 if ( !sabers )
02730 {
02731 return;
02732 }
02733 sabers[saberNum].blade[bladeNum].color = TranslateSaberColor( colorName );
02734 }
02735
02736 static char bgSaberParseTBuffer[MAX_SABER_DATA_SIZE];
02737
02738 void WP_SaberLoadParms( void )
02739 {
02740 int len, totallen, saberExtFNLen, mainBlockLen, fileCnt, i;
02741
02742 char *holdChar, *marker;
02743 char saberExtensionListBuf[2048];
02744 fileHandle_t f;
02745
02746 len = 0;
02747
02748
02749 totallen = mainBlockLen = len;
02750 marker = SaberParms+totallen;
02751 *marker = 0;
02752
02753
02754 fileCnt = trap_FS_GetFileList("ext_data/sabers", ".sab", saberExtensionListBuf, sizeof(saberExtensionListBuf) );
02755
02756 holdChar = saberExtensionListBuf;
02757 for ( i = 0; i < fileCnt; i++, holdChar += saberExtFNLen + 1 )
02758 {
02759 saberExtFNLen = strlen( holdChar );
02760
02761 len = trap_FS_FOpenFile(va( "ext_data/sabers/%s", holdChar), &f, FS_READ);
02762
02763 if ( len == -1 )
02764 {
02765 Com_Printf( "error reading file\n" );
02766 }
02767 else
02768 {
02769 if ( (totallen + len + 1) >= MAX_SABER_DATA_SIZE ) {
02770 Com_Error(ERR_DROP, "Saber extensions (*.sab) are too large" );
02771 }
02772
02773 trap_FS_Read(bgSaberParseTBuffer, len, f);
02774 bgSaberParseTBuffer[len] = 0;
02775
02776 len = COM_Compress( bgSaberParseTBuffer );
02777
02778 Q_strcat( marker, MAX_SABER_DATA_SIZE-totallen, bgSaberParseTBuffer );
02779 trap_FS_FCloseFile(f);
02780
02781
02782
02783 Q_strcat(marker, MAX_SABER_DATA_SIZE-totallen, "\n");
02784 len++;
02785
02786 totallen += len;
02787 marker = SaberParms+totallen;
02788 }
02789 }
02790 }
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803 void BG_BLADE_ActivateTrail ( bladeInfo_t *blade, float duration )
02804 {
02805 blade->trail.inAction = qtrue;
02806 blade->trail.duration = duration;
02807 }
02808
02809 void BG_BLADE_DeactivateTrail ( bladeInfo_t *blade, float duration )
02810 {
02811 blade->trail.inAction = qfalse;
02812 blade->trail.duration = duration;
02813 }
02814
02815 void BG_SI_Activate( saberInfo_t *saber )
02816 {
02817 int i;
02818
02819 for ( i = 0; i < saber->numBlades; i++ )
02820 {
02821 saber->blade[i].active = qtrue;
02822 }
02823 }
02824
02825 void BG_SI_Deactivate( saberInfo_t *saber )
02826 {
02827 int i;
02828
02829 for ( i = 0; i < saber->numBlades; i++ )
02830 {
02831 saber->blade[i].active = qfalse;
02832 }
02833 }
02834
02835
02836
02837
02838
02839
02840 void BG_SI_BladeActivate( saberInfo_t *saber, int iBlade, qboolean bActive )
02841 {
02842
02843 if ( iBlade < 0 || iBlade >= saber->numBlades )
02844 return;
02845
02846 saber->blade[iBlade].active = bActive;
02847 }
02848
02849 qboolean BG_SI_Active(saberInfo_t *saber)
02850 {
02851 int i;
02852
02853 for ( i = 0; i < saber->numBlades; i++ )
02854 {
02855 if ( saber->blade[i].active )
02856 {
02857 return qtrue;
02858 }
02859 }
02860 return qfalse;
02861 }
02862
02863 void BG_SI_SetLength( saberInfo_t *saber, float length )
02864 {
02865 int i;
02866
02867 for ( i = 0; i < saber->numBlades; i++ )
02868 {
02869 saber->blade[i].length = length;
02870 }
02871 }
02872
02873
02874 void BG_SI_SetDesiredLength(saberInfo_t *saber, float len, int bladeNum )
02875 {
02876 int i, startBlade = 0, maxBlades = saber->numBlades;
02877
02878 if ( bladeNum >= 0 && bladeNum < saber->numBlades)
02879 {
02880 startBlade = bladeNum;
02881 maxBlades = bladeNum+1;
02882 }
02883 for (i = startBlade; i < maxBlades; i++)
02884 {
02885 saber->blade[i].desiredLength = len;
02886 }
02887 }
02888
02889
02890 void BG_SI_SetLengthGradual(saberInfo_t *saber, int time)
02891 {
02892 int i;
02893 float amt, dLen;
02894
02895 for (i = 0; i < saber->numBlades; i++)
02896 {
02897 dLen = saber->blade[i].desiredLength;
02898
02899 if (dLen == -1)
02900 {
02901 dLen = saber->blade[i].lengthMax;
02902 }
02903
02904 if (saber->blade[i].length == dLen)
02905 {
02906 continue;
02907 }
02908
02909 if (saber->blade[i].length == saber->blade[i].lengthMax ||
02910 saber->blade[i].length == 0)
02911 {
02912 saber->blade[i].extendDebounce = time;
02913 if (saber->blade[i].length == 0)
02914 {
02915 saber->blade[i].length++;
02916 }
02917 else
02918 {
02919 saber->blade[i].length--;
02920 }
02921 }
02922
02923 amt = (time - saber->blade[i].extendDebounce)*0.01;
02924
02925 if (amt < 0.2f)
02926 {
02927 amt = 0.2f;
02928 }
02929
02930 if (saber->blade[i].length < dLen)
02931 {
02932 saber->blade[i].length += amt;
02933
02934 if (saber->blade[i].length > dLen)
02935 {
02936 saber->blade[i].length = dLen;
02937 }
02938 if (saber->blade[i].length > saber->blade[i].lengthMax)
02939 {
02940 saber->blade[i].length = saber->blade[i].lengthMax;
02941 }
02942 }
02943 else if (saber->blade[i].length > dLen)
02944 {
02945 saber->blade[i].length -= amt;
02946
02947 if (saber->blade[i].length < dLen)
02948 {
02949 saber->blade[i].length = dLen;
02950 }
02951 if (saber->blade[i].length < 0)
02952 {
02953 saber->blade[i].length = 0;
02954 }
02955 }
02956 }
02957 }
02958
02959 float BG_SI_Length(saberInfo_t *saber)
02960 {
02961 int len1 = 0;
02962 int i;
02963
02964 for ( i = 0; i < saber->numBlades; i++ )
02965 {
02966 if ( saber->blade[i].length > len1 )
02967 {
02968 len1 = saber->blade[i].length;
02969 }
02970 }
02971 return len1;
02972 }
02973
02974 float BG_SI_LengthMax(saberInfo_t *saber)
02975 {
02976 int len1 = 0;
02977 int i;
02978
02979 for ( i = 0; i < saber->numBlades; i++ )
02980 {
02981 if ( saber->blade[i].lengthMax > len1 )
02982 {
02983 len1 = saber->blade[i].lengthMax;
02984 }
02985 }
02986 return len1;
02987 }
02988
02989 void BG_SI_ActivateTrail ( saberInfo_t *saber, float duration )
02990 {
02991 int i;
02992
02993 for ( i = 0; i < saber->numBlades; i++ )
02994 {
02995
02996 BG_BLADE_ActivateTrail(&saber->blade[i], duration);
02997 }
02998 }
02999
03000 void BG_SI_DeactivateTrail ( saberInfo_t *saber, float duration )
03001 {
03002 int i;
03003
03004 for ( i = 0; i < saber->numBlades; i++ )
03005 {
03006
03007 BG_BLADE_DeactivateTrail(&saber->blade[i], duration);
03008 }
03009 }
03010
03011 #include "../namespace_end.h"