float UI_SaberBladeRadiusForSaber( const char *saberName, int bladeNum ) { char radiusString[8]={0}; float radius = 3.0f; WP_SaberParseParm( saberName, "saberRadius", radiusString ); if ( radiusString[0] ) { radius = atof( radiusString ); if ( radius < 0.0f ) { radius = 0.0f; } } WP_SaberParseParm( saberName, va("saberRadius%d", bladeNum+1), radiusString ); if ( radiusString[0] ) { radius = atof( radiusString ); if ( radius < 0.0f ) { radius = 0.0f; } } return radius; }
float UI_SaberBladeLengthForSaber( const char *saberName, int bladeNum ) { char lengthString[8]={0}; float length = 40.0f; WP_SaberParseParm( saberName, "saberLength", lengthString ); if ( lengthString[0] ) { length = atof( lengthString ); if ( length < 0.0f ) { length = 0.0f; } } WP_SaberParseParm( saberName, va("saberLength%d", bladeNum+1), lengthString ); if ( lengthString[0] ) { length = atof( lengthString ); if ( length < 0.0f ) { length = 0.0f; } } return length; }
qboolean UI_SaberShouldDrawBlade( const char *saberName, int bladeNum ) { int bladeStyle2Start = 0, noBlade = 0; char bladeStyle2StartString[8]={0}; char noBladeString[8]={0}; WP_SaberParseParm( saberName, "bladeStyle2Start", bladeStyle2StartString ); if ( bladeStyle2StartString[0] ) { bladeStyle2Start = atoi( bladeStyle2StartString ); } if ( bladeStyle2Start && bladeNum >= bladeStyle2Start ) {//use second blade style WP_SaberParseParm( saberName, "noBlade2", noBladeString ); if ( noBladeString[0] ) { noBlade = atoi( noBladeString ); } } else {//use first blade style WP_SaberParseParm( saberName, "noBlade", noBladeString ); if ( noBladeString[0] ) { noBlade = atoi( noBladeString ); } } return ((qboolean)(noBlade==0)); }
qboolean UI_IsSaberTwoHanded( const char *saberName ) { int twoHanded; char twoHandedString[8] = { 0 }; WP_SaberParseParm( saberName, "twoHanded", twoHandedString ); if ( !twoHandedString[0] ) {//not defined defaults to "no" return qfalse; } twoHanded = atoi( twoHandedString ); return ((qboolean)(twoHanded != 0)); }
int UI_SaberNumBladesForSaber( const char *saberName ) { int numBlades; char numBladesString[8] = { 0 }; WP_SaberParseParm( saberName, "numBlades", numBladesString ); numBlades = atoi( numBladesString ); if ( numBlades < 1 ) { numBlades = 1; } else if ( numBlades > 8 ) { numBlades = 8; } return numBlades; }
qboolean UI_SaberProperNameForSaber( const char *saberName, char *saberProperName, int destsize ) { char stringedSaberName[1024] = { 0 }; qboolean ret = WP_SaberParseParm( saberName, "name", stringedSaberName ); // if it's a stringed reference translate it if ( ret && stringedSaberName[0] == '@' ) trap->SE_GetStringTextString( &stringedSaberName[1], saberProperName, destsize ); else if ( !stringedSaberName[0] ) Q_strncpyz( saberProperName, va( S_COLOR_RED"<%s"S_COLOR_RED">", saberName ), destsize ); else // no stringed so just use it as it Q_strncpyz( saberProperName, stringedSaberName, destsize ); return ret; }
qboolean UI_SaberValidForPlayerInMP( const char *saberName ) { char allowed [8]={0}; if ( !WP_SaberParseParm( saberName, "notInMP", allowed ) ) {//not defined, default is yes return qtrue; } if ( !allowed[0] ) {//not defined, default is yes return qtrue; } else {//return value return ((qboolean)(atoi(allowed)==0)); } }
qboolean UI_SaberProperNameForSaber( const char *saberName, char *saberProperName ) { char stringedSaberName[1024]; qboolean ret = WP_SaberParseParm( saberName, "name", stringedSaberName ); // if it's a stringed reference translate it if( ret && stringedSaberName[0] == '@') { trap->SE_GetStringTextString(&stringedSaberName[1], saberProperName, 1024); } else { // no stringed so just use it as it strcpy( saberProperName, stringedSaberName ); } return ret; }
qboolean UI_SaberTypeForSaber( const char *saberName, char *saberType ) { return WP_SaberParseParm( saberName, "saberType", saberType ); }
qboolean UI_SaberSkinForSaber( const char *saberName, char *saberSkin ) { return WP_SaberParseParm( saberName, "customSkin", saberSkin ); }
qboolean UI_SaberModelForSaber( const char *saberName, char *saberModel ) { return WP_SaberParseParm( saberName, "saberModel", saberModel ); }