//-------------------------------------------- void WPN_AltMuzzleEffect(const char **holdBuf) { const char *tokenStr; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } // ONLY DO THIS ON THE GAME SIDE #ifndef _USRDLL int len = strlen(tokenStr); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: AltMuzzleEffect '%s' too long in external WEAPONS.DAT\n", tokenStr); } G_EffectIndex( tokenStr ); Q_strncpyz(weaponData[wpnParms.weaponNum].mAltMuzzleEffect,tokenStr,len); #endif }
//-------------------------------------------- void WPN_Ammo(const char **holdBuf) { const char *tokenStr; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } if (!Q_stricmp(tokenStr,"AMMO_NONE")) wpnParms.ammoNum = AMMO_NONE; else if (!Q_stricmp(tokenStr,"AMMO_FORCE")) wpnParms.ammoNum = AMMO_FORCE; else if (!Q_stricmp(tokenStr,"AMMO_BLASTER")) wpnParms.ammoNum = AMMO_BLASTER; else if (!Q_stricmp(tokenStr,"AMMO_POWERCELL")) wpnParms.ammoNum = AMMO_POWERCELL; else if (!Q_stricmp(tokenStr,"AMMO_METAL_BOLTS")) wpnParms.ammoNum = AMMO_METAL_BOLTS; else if (!Q_stricmp(tokenStr,"AMMO_ROCKETS")) wpnParms.ammoNum = AMMO_ROCKETS; else if (!Q_stricmp(tokenStr,"AMMO_EMPLACED")) wpnParms.ammoNum = AMMO_EMPLACED; else if (!Q_stricmp(tokenStr,"AMMO_THERMAL")) wpnParms.ammoNum = AMMO_THERMAL; else if (!Q_stricmp(tokenStr,"AMMO_TRIPMINE")) wpnParms.ammoNum = AMMO_TRIPMINE; else if (!Q_stricmp(tokenStr,"AMMO_DETPACK")) wpnParms.ammoNum = AMMO_DETPACK; else { gi.Printf(S_COLOR_YELLOW"WARNING: bad ammotype in external weapon data '%s'\n", tokenStr); wpnParms.ammoNum = 0; } }
//-------------------------------------------- void WPN_FuncName(const char **holdBuf) { const char *tokenStr; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } size_t len = strlen(tokenStr); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: FuncName '%s' too long in external WEAPONS.DAT\n", tokenStr); } for ( func_t* s=funcs ; s->name ; s++ ) { if ( !Q_stricmp(s->name, tokenStr) ) { // found it weaponData[wpnParms.weaponNum].func = (void*)s->func; return; } } gi.Printf(S_COLOR_YELLOW"WARNING: FuncName '%s' in external WEAPONS.DAT does not exist\n", tokenStr); }
//-------------------------------------------- void WPN_AltFuncName(const char **holdBuf) { const char *tokenStr; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } // ONLY DO THIS ON THE GAME SIDE #ifndef _USRDLL int len = strlen(tokenStr); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: AltFuncName '%s' too long in external WEAPONS.DAT\n", tokenStr); } for ( func_t* s=funcs ; s->name ; s++ ) { if ( !Q_stricmp(s->name, tokenStr) ) { // found it weaponData[wpnParms.weaponNum].altfunc = (void*)s->func; return; } } gi.Printf(S_COLOR_YELLOW"WARNING: AltFuncName %s in external WEAPONS.DAT does not exist\n", tokenStr); #endif }
static void IT_Type(const char **holdBuf) { int type; const char *tokenStr; if (COM_ParseString(holdBuf,&tokenStr)) { return; } if (!Q_stricmp(tokenStr,"IT_BAD")) type = IT_BAD; else if (!Q_stricmp(tokenStr,"IT_WEAPON")) type = IT_WEAPON; else if (!Q_stricmp(tokenStr,"IT_AMMO")) type = IT_AMMO; else if (!Q_stricmp(tokenStr,"IT_ARMOR")) type = IT_ARMOR; else if (!Q_stricmp(tokenStr,"IT_HEALTH")) type = IT_HEALTH; else if (!Q_stricmp(tokenStr,"IT_HOLDABLE")) type = IT_HOLDABLE; else if (!Q_stricmp(tokenStr,"IT_BATTERY")) type = IT_BATTERY; else if (!Q_stricmp(tokenStr,"IT_HOLOCRON")) type = IT_HOLOCRON; else { type = IT_BAD; gi.Printf("WARNING: bad itemname in external item data '%s'\n", tokenStr); } bg_itemlist[itemParms.itemNum].giType = (itemType_t) type; }
static void IT_ClassName( const char **holdBuf ) { int len; const char *tokenStr; if ( COM_ParseString( holdBuf, &tokenStr ) ) { return; } len = strlen( tokenStr ) + 1; if ( len > 32 ) { len = 32; gi.Printf( "WARNING: weaponclass too long in external ITEMS.DAT '%s'\n", tokenStr ); } bg_itemlist[itemNum].classname = G_NewString( tokenStr ); }
static void IT_WorldModel( const char **holdBuf ) { int len; const char *tokenStr; if ( COM_ParseString( holdBuf, &tokenStr ) ) { return; } len = strlen( tokenStr ) + 1; if ( len > 64 ) { len = 64; gi.Printf( "WARNING: world model too long in external ITEMS.DAT '%s'\n", tokenStr ); } bg_itemlist[itemNum].world_model = G_NewString( tokenStr ); }
static void IT_PickupSound( const char **holdBuf ) { int len; const char *tokenStr; if ( COM_ParseString( holdBuf, &tokenStr ) ) { return; } len = strlen( tokenStr ) + 1; if ( len > 32 ) { len = 32; gi.Printf("WARNING: Pickup Sound too long in external ITEMS.DAT '%s'\n", tokenStr); } bg_itemlist[itemNum].pickup_sound = G_NewString(tokenStr); }
//-------------------------------------------- void WPN_SelectFrc( const char **holdBuf ) { const char *tokenStr; int len; if ( COM_ParseString( holdBuf,&tokenStr )) { return; } len = strlen( tokenStr ); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: selectFrc too long in external WEAPONS.DAT '%s'\n", tokenStr); } }
//-------------------------------------------- void WPN_WeaponClass(const char **holdBuf) { int len; const char *tokenStr; if (COM_ParseString(holdBuf,&tokenStr)) { return; } len = strlen(tokenStr); len++; if (len > 32) { len = 32; gi.Printf(S_COLOR_YELLOW"WARNING: weaponclass too long in external WEAPONS.DAT '%s'\n", tokenStr); } Q_strncpyz(weaponData[wpnParms.weaponNum].classname,tokenStr,len); }
static void IT_Icon(const char **holdBuf) { int len; const char *tokenStr; if (COM_ParseString(holdBuf,&tokenStr)) { return; } len = strlen(tokenStr); len++; if (len > 32) { len = 32; gi.Printf("WARNING: icon too long in external ITEMS.DAT '%s'\n", tokenStr); } bg_itemlist[itemParms.itemNum].icon = G_NewString(tokenStr); }
//-------------------------------------------- void WPN_AltChargeSnd(const char **holdBuf) { const char *tokenStr; int len; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } len = strlen(tokenStr); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: altChargeSnd too long in external WEAPONS.DAT '%s'\n", tokenStr); } Q_strncpyz(weaponData[wpnParms.weaponNum].altChargeSnd,tokenStr,len); }
//-------------------------------------------- void WPN_MissileName(const char **holdBuf) { int len; const char *tokenStr; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } len = strlen(tokenStr); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: MissileName too long in external WEAPONS.DAT '%s'\n", tokenStr); } Q_strncpyz(weaponData[wpnParms.weaponNum].missileMdl,tokenStr,len); }
//-------------------------------------------- void WPN_MuzzleEffect(const char **holdBuf) { const char *tokenStr; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } size_t len = strlen(tokenStr); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: MuzzleEffect '%s' too long in external WEAPONS.DAT\n", tokenStr); } G_EffectIndex( tokenStr ); Q_strncpyz(weaponData[wpnParms.weaponNum].mMuzzleEffect,tokenStr,len); }
//-------------------------------------------- void WPN_AmmoIcon(const char **holdBuf) { const char *tokenStr; int len; if ( COM_ParseString(holdBuf,&tokenStr)) { return; } len = strlen(tokenStr); len++; if (len > 32) { len = 32; gi.Printf(S_COLOR_YELLOW"WARNING: ammoicon too long in external WEAPONS.DAT '%s'\n", tokenStr); } Q_strncpyz(ammoData[wpnParms.ammoNum].icon,tokenStr,len); }
//-------------------------------------------- void WPN_SelectFrc( const char **holdBuf ) { const char *tokenStr; int len; if ( COM_ParseString( holdBuf,&tokenStr )) { return; } len = strlen( tokenStr ); len++; if (len > 64) { len = 64; gi.Printf(S_COLOR_YELLOW"WARNING: selectFrc too long in external WEAPONS.DAT '%s'\n", tokenStr); } #ifdef _IMMERSION Q_strncpyz( weaponData[wpnParms.weaponNum].selectFrc,tokenStr,len); #endif }
static void IT_Name( const char **holdBuf ) { const char *tokenStr; if ( COM_ParseString( holdBuf, &tokenStr ) ) { return; } if ( !Q_stricmp( tokenStr, "ITM_NONE" ) ) { itemNum = ITM_NONE; } else if ( !Q_stricmp( tokenStr, "ITM_STUN_BATON_PICKUP" ) ) { itemNum = ITM_STUN_BATON_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SABER_PICKUP" ) ) { itemNum = ITM_SABER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BRYAR_PISTOL_PICKUP" ) ) { itemNum = ITM_BRYAR_PISTOL_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BLASTER_PICKUP" ) ) { itemNum = ITM_BLASTER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_DISRUPTOR_PICKUP" ) ) { itemNum = ITM_DISRUPTOR_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BOWCASTER_PICKUP" ) ) { itemNum = ITM_BOWCASTER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_REPEATER_PICKUP" ) ) { itemNum = ITM_REPEATER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_DEMP2_PICKUP" ) ) { itemNum = ITM_DEMP2_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FLECHETTE_PICKUP" ) ) { itemNum = ITM_FLECHETTE_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_ROCKET_LAUNCHER_PICKUP" ) ) { itemNum = ITM_ROCKET_LAUNCHER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_THERMAL_DET_PICKUP" ) ) { itemNum = ITM_THERMAL_DET_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_TRIP_MINE_PICKUP" ) ) { itemNum = ITM_TRIP_MINE_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_DET_PACK_PICKUP" ) ) { itemNum = ITM_DET_PACK_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BOT_LASER_PICKUP" ) ) { itemNum = ITM_BOT_LASER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_EMPLACED_GUN_PICKUP" ) ) { itemNum = ITM_EMPLACED_GUN_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_TURRET_PICKUP" ) ) { itemNum = ITM_TURRET_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_MELEE" ) ) { itemNum = ITM_MELEE; } else if ( !Q_stricmp( tokenStr, "ITM_ATST_MAIN_PICKUP" ) ) { itemNum = ITM_ATST_MAIN_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_ATST_SIDE_PICKUP" ) ) { itemNum = ITM_ATST_SIDE_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_TIE_FIGHTER_PICKUP" ) ) { itemNum = ITM_TIE_FIGHTER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_RAPID_FIRE_CONC_PICKUP" ) ) { itemNum = ITM_RAPID_FIRE_CONC_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_FORCE_PICKUP" ) ) { itemNum = ITM_AMMO_FORCE_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_BLASTER_PICKUP" ) ) { itemNum = ITM_AMMO_BLASTER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_POWERCELL_PICKUP" ) ) { itemNum = ITM_AMMO_POWERCELL_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_METAL_BOLTS_PICKUP" ) ) { itemNum = ITM_AMMO_METAL_BOLTS_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_ROCKETS_PICKUP" ) ) { itemNum = ITM_AMMO_ROCKETS_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_EMPLACED_PICKUP" ) ) { itemNum = ITM_AMMO_EMPLACED_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_THERMAL_PICKUP" ) ) { itemNum = ITM_AMMO_THERMAL_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_TRIPMINE_PICKUP" ) ) { itemNum = ITM_AMMO_TRIPMINE_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_AMMO_DETPACK_PICKUP" ) ) { itemNum = ITM_AMMO_DETPACK_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_HEAL_PICKUP" ) ) { itemNum = ITM_FORCE_HEAL_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_LEVITATION_PICKUP" ) ) { itemNum = ITM_FORCE_LEVITATION_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_SPEED_PICKUP" ) ) { itemNum = ITM_FORCE_SPEED_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_PUSH_PICKUP" ) ) { itemNum = ITM_FORCE_PUSH_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_PULL_PICKUP" ) ) { itemNum = ITM_FORCE_PULL_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_TELEPATHY_PICKUP" ) ) { itemNum = ITM_FORCE_TELEPATHY_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_GRIP_PICKUP" ) ) { itemNum = ITM_FORCE_GRIP_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_LIGHTNING_PICKUP" ) ) { itemNum = ITM_FORCE_LIGHTNING_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_FORCE_SABERTHROW_PICKUP" ) ) { itemNum = ITM_FORCE_SABERTHROW_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BATTERY_PICKUP" ) ) { itemNum = ITM_BATTERY_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SEEKER_PICKUP" ) ) { itemNum = ITM_SEEKER_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SHIELD_PICKUP" ) ) { itemNum = ITM_SHIELD_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BACTA_PICKUP" ) ) { itemNum = ITM_BACTA_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_DATAPAD_PICKUP" ) ) { itemNum = ITM_DATAPAD_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BINOCULARS_PICKUP" ) ) { itemNum = ITM_BINOCULARS_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SENTRY_GUN_PICKUP" ) ) { itemNum = ITM_SENTRY_GUN_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_LA_GOGGLES_PICKUP" ) ) { itemNum = ITM_LA_GOGGLES_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_BLASTER_PISTOL_PICKUP" ) ) { itemNum = ITM_BLASTER_PISTOL_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_MEDPAK_PICKUP" ) ) { itemNum = ITM_MEDPAK_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SHIELD_SM_PICKUP" ) ) { itemNum = ITM_SHIELD_SM_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SHIELD_LRG_PICKUP" ) ) { itemNum = ITM_SHIELD_LRG_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_GOODIE_KEY_PICKUP" ) ) { itemNum = ITM_GOODIE_KEY_PICKUP; } else if ( !Q_stricmp( tokenStr, "ITM_SECURITY_KEY_PICKUP" ) ) { itemNum = ITM_SECURITY_KEY_PICKUP; } else { itemNum = 0; gi.Printf( "WARNING: bad itemname in external item data '%s'\n", tokenStr ); } IT_SetDefaults(); }
qboolean NPC_ParseParms( const char *NPCName, gentity_t *NPC ) { const char *token; const char *value; const char *p; int n; float f; char *patch; char sound[MAX_QPATH]; char playerModel[MAX_QPATH]; char customSkin[MAX_QPATH]; clientInfo_t *ci = &NPC->client->clientInfo; renderInfo_t *ri = &NPC->client->renderInfo; gNPCstats_t *stats = NULL; qboolean md3Model = qtrue; char surfOff[1024]; char surfOn[1024]; strcpy(customSkin,"default"); if ( !NPCName || !NPCName[0]) { NPCName = "Player"; } if ( NPC->NPC ) { stats = &NPC->NPC->stats; /* NPC->NPC->allWeaponOrder[0] = WP_BRYAR_PISTOL; NPC->NPC->allWeaponOrder[1] = WP_SABER; NPC->NPC->allWeaponOrder[2] = WP_IMOD; NPC->NPC->allWeaponOrder[3] = WP_SCAVENGER_RIFLE; NPC->NPC->allWeaponOrder[4] = WP_TRICORDER; NPC->NPC->allWeaponOrder[6] = WP_NONE; NPC->NPC->allWeaponOrder[6] = WP_NONE; NPC->NPC->allWeaponOrder[7] = WP_NONE; */ // fill in defaults stats->aggression = 3; stats->aim = 3; stats->earshot = 1024; stats->evasion = 3; stats->hfov = 90; stats->intelligence = 3; stats->move = 3; stats->reactions = 3; stats->vfov = 60; stats->vigilance = 0.1f; stats->visrange = 1024; stats->health = 0; stats->moveType = MT_RUNJUMP; stats->yawSpeed = 90; stats->walkSpeed = 90; stats->runSpeed = 300; stats->acceleration = 15;//Increase/descrease speed this much per frame (20fps) } else { stats = NULL; } Q_strncpyz( ci->name, NPCName, sizeof( ci->name ) ); NPC->playerModel = -1; //Set defaults //FIXME: should probably put default torso and head models, but what about enemies //that don't have any- like Stasis? //Q_strncpyz( ri->headModelName, DEFAULT_HEADMODEL, sizeof(ri->headModelName), qtrue); //Q_strncpyz( ri->torsoModelName, DEFAULT_TORSOMODEL, sizeof(ri->torsoModelName), qtrue); //Q_strncpyz( ri->legsModelName, DEFAULT_LEGSMODEL, sizeof(ri->legsModelName), qtrue); memset( ri->headModelName, 0, sizeof( ri->headModelName ) ); memset( ri->torsoModelName, 0, sizeof( ri->torsoModelName ) ); memset( ri->legsModelName, 0, sizeof( ri->legsModelName ) ); //FIXME: should we have one for weapon too? memset( (char *)surfOff, 0, sizeof(surfOff) ); memset( (char *)surfOn, 0, sizeof(surfOn) ); /* ri->headYawRangeLeft = 50; ri->headYawRangeRight = 50; ri->headPitchRangeUp = 40; ri->headPitchRangeDown = 50; ri->torsoYawRangeLeft = 60; ri->torsoYawRangeRight = 60; ri->torsoPitchRangeUp = 30; ri->torsoPitchRangeDown = 70; */ ri->headYawRangeLeft = 80; ri->headYawRangeRight = 80; ri->headPitchRangeUp = 45; ri->headPitchRangeDown = 45; ri->torsoYawRangeLeft = 60; ri->torsoYawRangeRight = 60; ri->torsoPitchRangeUp = 30; ri->torsoPitchRangeDown = 50; VectorCopy(playerMins, NPC->mins); VectorCopy(playerMaxs, NPC->maxs); NPC->client->crouchheight = CROUCH_MAXS_2; NPC->client->standheight = DEFAULT_MAXS_2; NPC->client->dismemberProbHead = 100; NPC->client->dismemberProbArms = 100; NPC->client->dismemberProbHands = 100; NPC->client->dismemberProbWaist = 100; NPC->client->dismemberProbLegs = 100; if ( !Q_stricmp( "random", NPCName ) ) {//Randomly assemble a starfleet guy NPC_BuildRandom( NPC ); } else { p = NPCParms; COM_BeginParseSession(); // look for the right NPC while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { return qfalse; } if ( !Q_stricmp( token, NPCName ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { return qfalse; } if ( G_ParseLiteral( &p, "{" ) ) { return qfalse; } // parse the NPC info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { gi.Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", NPCName ); return qfalse; } if ( !Q_stricmp( token, "}" ) ) { break; } //===MODEL PROPERTIES=========================================================== // headmodel if ( !Q_stricmp( token, "headmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { ri->headModelName[0] = NULL; //Zero the head clamp range so the torso & legs don't lag behind ri->headYawRangeLeft = ri->headYawRangeRight = ri->headPitchRangeUp = ri->headPitchRangeDown = 0; } else { Q_strncpyz( ri->headModelName, value, sizeof(ri->headModelName), qtrue); } continue; } // torsomodel if ( !Q_stricmp( token, "torsomodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { ri->torsoModelName[0] = NULL; //Zero the torso clamp range so the legs don't lag behind ri->torsoYawRangeLeft = ri->torsoYawRangeRight = ri->torsoPitchRangeUp = ri->torsoPitchRangeDown = 0; } else { Q_strncpyz( ri->torsoModelName, value, sizeof(ri->torsoModelName), qtrue); } continue; } // legsmodel if ( !Q_stricmp( token, "legsmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( ri->legsModelName, value, sizeof(ri->legsModelName), qtrue); //Need to do this here to get the right index G_ParseAnimFileSet( ri->legsModelName, ri->legsModelName, &ci->animFileIndex ); continue; } // playerModel if ( !Q_stricmp( token, "playerModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( playerModel, value, sizeof(playerModel), qtrue); md3Model = qfalse; continue; } // customSkin if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( customSkin, value, sizeof(customSkin), qtrue); continue; } // surfOff if ( !Q_stricmp( token, "surfOff" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( surfOff[0] ) { strncat( (char *)surfOff, ",", sizeof(surfOff) ); strncat( (char *)surfOff, value, sizeof(surfOff) ); } else { Q_strncpyz( surfOff, value, sizeof(surfOff), qtrue); } continue; } // surfOn if ( !Q_stricmp( token, "surfOn" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( surfOn[0] ) { strncat( (char *)surfOn, ",", sizeof(surfOn) ); strncat( (char *)surfOn, value, sizeof(surfOn) ); } else { Q_strncpyz( surfOn, value, sizeof(surfOn), qtrue); } continue; } //headYawRangeLeft if ( !Q_stricmp( token, "headYawRangeLeft" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headYawRangeLeft = n; continue; } //headYawRangeRight if ( !Q_stricmp( token, "headYawRangeRight" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headYawRangeRight = n; continue; } //headPitchRangeUp if ( !Q_stricmp( token, "headPitchRangeUp" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headPitchRangeUp = n; continue; } //headPitchRangeDown if ( !Q_stricmp( token, "headPitchRangeDown" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headPitchRangeDown = n; continue; } //torsoYawRangeLeft if ( !Q_stricmp( token, "torsoYawRangeLeft" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoYawRangeLeft = n; continue; } //torsoYawRangeRight if ( !Q_stricmp( token, "torsoYawRangeRight" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoYawRangeRight = n; continue; } //torsoPitchRangeUp if ( !Q_stricmp( token, "torsoPitchRangeUp" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoPitchRangeUp = n; continue; } //torsoPitchRangeDown if ( !Q_stricmp( token, "torsoPitchRangeDown" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoPitchRangeDown = n; continue; } // Uniform XYZ scale if ( !Q_stricmp( token, "scale" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { NPC->s.modelScale[0] = NPC->s.modelScale[1] = NPC->s.modelScale[2] = n/100.0f; } continue; } //X scale if ( !Q_stricmp( token, "scaleX" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { NPC->s.modelScale[0] = n/100.0f; } continue; } //Y scale if ( !Q_stricmp( token, "scaleY" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { NPC->s.modelScale[1] = n/100.0f; } continue; } //Z scale if ( !Q_stricmp( token, "scaleZ" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { NPC->s.modelScale[2] = n/100.0f; } continue; } //===AI STATS===================================================================== // aggression if ( !Q_stricmp( token, "aggression" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->aggression = n; } continue; } // aim if ( !Q_stricmp( token, "aim" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->aim = n; } continue; } // earshot if ( !Q_stricmp( token, "earshot" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->earshot = f; } continue; } // evasion if ( !Q_stricmp( token, "evasion" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->evasion = n; } continue; } // hfov if ( !Q_stricmp( token, "hfov" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 30 || n > 180 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->hfov = n;// / 2; //FIXME: Why was this being done?! } continue; } // intelligence if ( !Q_stricmp( token, "intelligence" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->intelligence = n; } continue; } // move if ( !Q_stricmp( token, "move" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->move = n; } continue; } // reactions if ( !Q_stricmp( token, "reactions" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->reactions = n; } continue; } // shootDistance if ( !Q_stricmp( token, "saberColor" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->ps.saberColor = TranslateSaberColor( value ); } continue; } // shootDistance if ( !Q_stricmp( token, "shootDistance" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->shootDistance = f; } continue; } // shootDistance if ( !Q_stricmp( token, "health" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->health = n; } continue; } // vfov if ( !Q_stricmp( token, "vfov" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 30 || n > 180 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->vfov = n / 2; } continue; } // vigilance if ( !Q_stricmp( token, "vigilance" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->vigilance = f; } continue; } // visrange if ( !Q_stricmp( token, "visrange" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->visrange = f; } continue; } // race // if ( !Q_stricmp( token, "race" ) ) // { // if ( COM_ParseString( &p, &value ) ) // { // continue; // } // NPC->client->race = TranslateRaceName(value); // continue; // } // rank if ( !Q_stricmp( token, "rank" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->NPC ) { NPC->NPC->rank = TranslateRankName(value); } continue; } // fullName if ( !Q_stricmp( token, "fullName" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } NPC->fullName = G_NewString(value); continue; } // playerTeam if ( !Q_stricmp( token, "playerTeam" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } NPC->client->playerTeam = TranslateTeamName(value); continue; } // enemyTeam if ( !Q_stricmp( token, "enemyTeam" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } NPC->client->enemyTeam = TranslateTeamName(value); continue; } // class if ( !Q_stricmp( token, "class" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } NPC->client->NPC_class = TranslateClassName(value); continue; } // dismemberment probability for head if ( !Q_stricmp( token, "dismemberProbHead" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->client->dismemberProbHead = n; } continue; } // dismemberment probability for arms if ( !Q_stricmp( token, "dismemberProbArms" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->client->dismemberProbArms = n; } continue; } // dismemberment probability for hands if ( !Q_stricmp( token, "dismemberProbHands" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->client->dismemberProbHands = n; } continue; } // dismemberment probability for waist if ( !Q_stricmp( token, "dismemberProbWaist" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->client->dismemberProbWaist = n; } continue; } // dismemberment probability for legs if ( !Q_stricmp( token, "dismemberProbLegs" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->client->dismemberProbLegs = n; } continue; } //===MOVEMENT STATS============================================================ if ( !Q_stricmp( token, "width" ) ) { if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->mins[0] = NPC->mins[1] = -n; NPC->maxs[0] = NPC->maxs[1] = n; continue; } if ( !Q_stricmp( token, "height" ) ) { if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->mins[2] = DEFAULT_MINS_2;//Cannot change NPC->maxs[2] = NPC->client->standheight = n + DEFAULT_MINS_2; NPC->radius = n; continue; } if ( !Q_stricmp( token, "crouchheight" ) ) { if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->client->crouchheight = n + DEFAULT_MINS_2; continue; } if ( !Q_stricmp( token, "movetype" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->NPC ) { stats->moveType = (movetype_t)MoveTypeNameToEnum(value); } continue; } // yawSpeed if ( !Q_stricmp( token, "yawSpeed" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n <= 0) { gi.Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->yawSpeed = ((float)(n)); } continue; } // walkSpeed if ( !Q_stricmp( token, "walkSpeed" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->walkSpeed = n; } continue; } //runSpeed if ( !Q_stricmp( token, "runSpeed" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->runSpeed = n; } continue; } //acceleration if ( !Q_stricmp( token, "acceleration" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->acceleration = n; } continue; } //===MISC=============================================================================== // default behavior if ( !Q_stricmp( token, "behavior" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < BS_DEFAULT || n >= NUM_BSTATES ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->NPC->defaultBehavior = (bState_t)(n); } continue; } // snd if ( !Q_stricmp( token, "snd" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->svFlags&SVF_NO_BASIC_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci->customBasicSoundDir = G_NewString( sound ); } continue; } // sndcombat if ( !Q_stricmp( token, "sndcombat" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->svFlags&SVF_NO_COMBAT_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci->customCombatSoundDir = G_NewString( sound ); } continue; } // sndextra if ( !Q_stricmp( token, "sndextra" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci->customExtraSoundDir = G_NewString( sound ); } continue; } // sndjedi if ( !Q_stricmp( token, "sndjedi" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci->customJediSoundDir = G_NewString( sound ); } continue; } gi.Printf( "WARNING: unknown keyword '%s' while parsing '%s'\n", token, NPCName ); SkipRestOfLine( &p ); } } ci->infoValid = qfalse; /* Ghoul2 Insert Start */ if ( !md3Model ) { NPC->weaponModel = -1; G_SetG2PlayerModel( NPC, playerModel, customSkin, surfOff, surfOn ); } /* Ghoul2 Insert End */ if( NPCsPrecached ) {//Spawning in after initial precache, our models are precached, we just need to set our clientInfo CG_RegisterClientModels( NPC->s.number ); CG_RegisterNPCCustomSounds( ci ); CG_RegisterNPCEffects( NPC->client->playerTeam ); } return qtrue; }
static void IT_Tag( const char **holdBuf ) { int tag; const char *tokenStr; if ( COM_ParseString( holdBuf, &tokenStr ) ) { return; } if ( !Q_stricmp( tokenStr, "WP_NONE" ) ) { tag = WP_NONE; } else if ( !Q_stricmp( tokenStr,"WP_STUN_BATON" ) ) { tag = WP_STUN_BATON; } else if ( !Q_stricmp( tokenStr,"WP_SABER" ) ) { tag = WP_SABER; } else if ( !Q_stricmp( tokenStr,"WP_BRYAR_PISTOL" ) ) { tag = WP_BRYAR_PISTOL; } else if ( !Q_stricmp( tokenStr,"WP_BLASTER" ) ) { tag = WP_BLASTER; } else if ( !Q_stricmp( tokenStr,"WP_DISRUPTOR" ) ) { tag = WP_DISRUPTOR; } else if ( !Q_stricmp( tokenStr,"WP_BOWCASTER" ) ) { tag = WP_BOWCASTER; } else if ( !Q_stricmp( tokenStr,"WP_REPEATER" ) ) { tag = WP_REPEATER; } else if ( !Q_stricmp( tokenStr,"WP_DEMP2" ) ) { tag = WP_DEMP2; } else if ( !Q_stricmp( tokenStr,"WP_FLECHETTE" ) ) { tag = WP_FLECHETTE; } else if ( !Q_stricmp( tokenStr,"WP_ROCKET_LAUNCHER" ) ) { tag = WP_ROCKET_LAUNCHER; } else if ( !Q_stricmp( tokenStr,"WP_THERMAL" ) ) { tag = WP_THERMAL; } else if ( !Q_stricmp( tokenStr,"WP_TRIP_MINE" ) ) { tag = WP_TRIP_MINE; } else if ( !Q_stricmp( tokenStr,"WP_DET_PACK" ) ) { tag = WP_DET_PACK; } else if ( !Q_stricmp( tokenStr,"WP_BOT_LASER" ) ) { tag = WP_BOT_LASER; } else if ( !Q_stricmp( tokenStr,"WP_EMPLACED_GUN" ) ) { tag = WP_EMPLACED_GUN; } else if ( !Q_stricmp( tokenStr,"WP_MELEE" ) ) { tag = WP_MELEE; } else if ( !Q_stricmp( tokenStr,"WP_TURRET" ) ) { tag = WP_TURRET; } else if ( !Q_stricmp( tokenStr,"WP_ATST_MAIN" ) ) { tag = WP_ATST_MAIN; } else if ( !Q_stricmp( tokenStr,"WP_ATST_SIDE" ) ) { tag = WP_ATST_SIDE; } else if ( !Q_stricmp( tokenStr,"WP_TIE_FIGHTER" ) ) { tag = WP_TIE_FIGHTER; } else if ( !Q_stricmp( tokenStr,"WP_RAPID_FIRE_CONC" ) ) { tag = WP_RAPID_FIRE_CONC; } else if ( !Q_stricmp( tokenStr,"WP_BLASTER_PISTOL" ) ) { tag = WP_BLASTER_PISTOL; } else if ( !Q_stricmp( tokenStr,"AMMO_FORCE" ) ) { tag = AMMO_FORCE; } else if ( !Q_stricmp( tokenStr,"AMMO_BLASTER" ) ) { tag = AMMO_BLASTER; } else if ( !Q_stricmp( tokenStr,"AMMO_POWERCELL" ) ) { tag = AMMO_POWERCELL; } else if ( !Q_stricmp( tokenStr,"AMMO_METAL_BOLTS" ) ) { tag = AMMO_METAL_BOLTS; } else if ( !Q_stricmp( tokenStr,"AMMO_ROCKETS" ) ) { tag = AMMO_ROCKETS; } else if ( !Q_stricmp( tokenStr,"AMMO_EMPLACED" ) ) { tag = AMMO_EMPLACED; } else if ( !Q_stricmp( tokenStr,"AMMO_THERMAL" ) ) { tag = AMMO_THERMAL; } else if ( !Q_stricmp( tokenStr,"AMMO_TRIPMINE" ) ) { tag = AMMO_TRIPMINE; } else if ( !Q_stricmp( tokenStr,"AMMO_DETPACK" ) ) { tag = AMMO_DETPACK; } else if ( !Q_stricmp( tokenStr,"FP_HEAL" ) ) { tag = FP_HEAL; } else if ( !Q_stricmp( tokenStr,"FP_LEVITATION" ) ) { tag = FP_LEVITATION; } else if ( !Q_stricmp( tokenStr,"FP_SPEED" ) ) { tag = FP_SPEED; } else if ( !Q_stricmp( tokenStr,"FP_PUSH" ) ) { tag = FP_PUSH; } else if ( !Q_stricmp( tokenStr,"FP_PULL" ) ) { tag = FP_PULL; } else if ( !Q_stricmp( tokenStr,"FP_TELEPATHY" ) ) { tag = FP_TELEPATHY; } else if ( !Q_stricmp( tokenStr,"FP_GRIP" ) ) { tag = FP_GRIP; } else if ( !Q_stricmp( tokenStr,"FP_LIGHTNING" ) ) { tag = FP_LIGHTNING; } else if ( !Q_stricmp( tokenStr,"FP_SABERTHROW" ) ) { tag = FP_SABERTHROW; } else if ( !Q_stricmp( tokenStr,"ITM_BATTERY_PICKUP" ) ) { tag = ITM_BATTERY_PICKUP; } else if ( !Q_stricmp( tokenStr,"INV_SEEKER" ) ) { tag = INV_SEEKER; } else if ( !Q_stricmp( tokenStr,"ITM_SHIELD_PICKUP" ) ) { tag = ITM_SHIELD_PICKUP; } else if ( !Q_stricmp( tokenStr,"INV_BACTA_CANISTER" ) ) { tag = INV_BACTA_CANISTER; } else if ( !Q_stricmp( tokenStr,"ITM_DATAPAD_PICKUP" ) ) { tag = ITM_DATAPAD_PICKUP; } else if ( !Q_stricmp( tokenStr,"INV_ELECTROBINOCULARS" ) ) { tag = INV_ELECTROBINOCULARS; } else if ( !Q_stricmp( tokenStr,"INV_SENTRY" ) ) { tag = INV_SENTRY; } else if ( !Q_stricmp( tokenStr,"INV_LIGHTAMP_GOGGLES" ) ) { tag = INV_LIGHTAMP_GOGGLES; } else if ( !Q_stricmp( tokenStr,"INV_GOODIE_KEY" ) ) { tag = INV_GOODIE_KEY; } else if ( !Q_stricmp( tokenStr,"INV_SECURITY_KEY" ) ) { tag = INV_SECURITY_KEY; } else if ( !Q_stricmp( tokenStr,"ITM_MEDPAK_PICKUP" ) ) { tag = ITM_MEDPAK_PICKUP; } else if ( !Q_stricmp( tokenStr,"ITM_SHIELD_SM_PICKUP" ) ) { tag = ITM_SHIELD_SM_PICKUP; } else if ( !Q_stricmp( tokenStr,"ITM_SHIELD_LRG_PICKUP" ) ) { tag = ITM_SHIELD_LRG_PICKUP; } else { tag = WP_BRYAR_PISTOL; gi.Printf( "WARNING: bad tagname in external item data '%s'\n", tokenStr ); } bg_itemlist[itemNum].giTag = tag; }
static void IT_Tag(const char **holdBuf) { int tag; const char *tokenStr; if (COM_ParseString(holdBuf,&tokenStr)) { return; } if (!Q_stricmp(tokenStr,"WP_NONE")) tag = WP_NONE; else if (!Q_stricmp(tokenStr,"WP_STUN_BATON")) tag = WP_STUN_BATON; else if (!Q_stricmp(tokenStr,"WP_SABER")) tag = WP_SABER; else if (!Q_stricmp(tokenStr,"WP_BLASTER_PISTOL")) tag = WP_BLASTER_PISTOL; else if (!Q_stricmp(tokenStr,"WP_BRYAR_PISTOL")) tag = WP_BRYAR_PISTOL; else if (!Q_stricmp(tokenStr,"WP_BLASTER")) tag = WP_BLASTER; else if (!Q_stricmp(tokenStr,"WP_DISRUPTOR")) tag = WP_DISRUPTOR; else if (!Q_stricmp(tokenStr,"WP_BOWCASTER")) tag = WP_BOWCASTER; else if (!Q_stricmp(tokenStr,"WP_REPEATER")) tag = WP_REPEATER; else if (!Q_stricmp(tokenStr,"WP_DEMP2")) tag = WP_DEMP2; else if (!Q_stricmp(tokenStr,"WP_FLECHETTE")) tag = WP_FLECHETTE; else if (!Q_stricmp(tokenStr,"WP_ROCKET_LAUNCHER")) tag = WP_ROCKET_LAUNCHER; else if (!Q_stricmp(tokenStr,"WP_CONCUSSION")) tag = WP_CONCUSSION; else if (!Q_stricmp(tokenStr,"WP_THERMAL")) tag = WP_THERMAL; else if (!Q_stricmp(tokenStr,"WP_TRIP_MINE")) tag = WP_TRIP_MINE; else if (!Q_stricmp(tokenStr,"WP_DET_PACK")) tag = WP_DET_PACK; // else if (!Q_stricmp(tokenStr,"WP_TRICORDER")) // tag = WP_TRICORDER; else if (!Q_stricmp(tokenStr,"WP_BOT_LASER")) tag = WP_BOT_LASER; else if (!Q_stricmp(tokenStr,"WP_EMPLACED_GUN")) tag = WP_EMPLACED_GUN; else if (!Q_stricmp(tokenStr,"WP_MELEE")) tag = WP_MELEE; else if (!Q_stricmp(tokenStr,"WP_TURRET")) tag = WP_TURRET; else if (!Q_stricmp(tokenStr,"WP_ATST_MAIN")) tag = WP_ATST_MAIN; else if (!Q_stricmp(tokenStr,"WP_ATST_SIDE")) tag = WP_ATST_SIDE; else if (!Q_stricmp(tokenStr,"WP_TIE_FIGHTER")) tag = WP_TIE_FIGHTER; else if (!Q_stricmp(tokenStr,"WP_RAPID_FIRE_CONC")) tag = WP_RAPID_FIRE_CONC; else if (!Q_stricmp(tokenStr,"WP_BLASTER_PISTOL")) tag = WP_BLASTER_PISTOL; else if (!Q_stricmp(tokenStr,"WP_JAWA")) tag = WP_JAWA; else if (!Q_stricmp(tokenStr,"WP_TUSKEN_RIFLE")) tag = WP_TUSKEN_RIFLE; else if (!Q_stricmp(tokenStr,"WP_TUSKEN_STAFF")) tag = WP_TUSKEN_STAFF; else if (!Q_stricmp(tokenStr,"WP_SCEPTER")) tag = WP_SCEPTER; else if (!Q_stricmp(tokenStr,"WP_NOGHRI_STICK")) tag = WP_NOGHRI_STICK; else if (!Q_stricmp(tokenStr,"AMMO_FORCE")) tag = AMMO_FORCE; else if (!Q_stricmp(tokenStr,"AMMO_BLASTER")) tag = AMMO_BLASTER; else if (!Q_stricmp(tokenStr,"AMMO_POWERCELL")) tag = AMMO_POWERCELL; else if (!Q_stricmp(tokenStr,"AMMO_METAL_BOLTS")) tag = AMMO_METAL_BOLTS; else if (!Q_stricmp(tokenStr,"AMMO_ROCKETS")) tag = AMMO_ROCKETS; else if (!Q_stricmp(tokenStr,"AMMO_EMPLACED")) tag = AMMO_EMPLACED; else if (!Q_stricmp(tokenStr,"AMMO_THERMAL")) tag = AMMO_THERMAL; else if (!Q_stricmp(tokenStr,"AMMO_TRIPMINE")) tag = AMMO_TRIPMINE; else if (!Q_stricmp(tokenStr,"AMMO_DETPACK")) tag = AMMO_DETPACK; else if (!Q_stricmp(tokenStr,"FP_HEAL")) { tag = FP_HEAL; } else if (!Q_stricmp(tokenStr,"FP_LEVITATION")) { tag = FP_LEVITATION; } else if (!Q_stricmp(tokenStr,"FP_SPEED")) { tag = FP_SPEED; } else if (!Q_stricmp(tokenStr,"FP_PUSH")) { tag = FP_PUSH; } else if (!Q_stricmp(tokenStr,"FP_PULL")) { tag = FP_PULL; } else if (!Q_stricmp(tokenStr,"FP_TELEPATHY")) { tag = FP_TELEPATHY; } else if (!Q_stricmp(tokenStr,"FP_GRIP")) { tag = FP_GRIP; } else if (!Q_stricmp(tokenStr,"FP_LIGHTNING")) { tag = FP_LIGHTNING; } else if (!Q_stricmp(tokenStr,"FP_SABERTHROW")) { tag = FP_SABERTHROW; } else if (!Q_stricmp(tokenStr,"ITM_BATTERY_PICKUP")) { tag = ITM_BATTERY_PICKUP; } else if (!Q_stricmp(tokenStr,"INV_SEEKER")) { tag = INV_SEEKER; } else if (!Q_stricmp(tokenStr,"ITM_SHIELD_PICKUP")) { tag = ITM_SHIELD_PICKUP; } else if (!Q_stricmp(tokenStr,"INV_BACTA_CANISTER")) { tag = INV_BACTA_CANISTER; } else if (!Q_stricmp(tokenStr,"ITM_DATAPAD_PICKUP")) { tag = ITM_DATAPAD_PICKUP; } else if (!Q_stricmp(tokenStr,"INV_ELECTROBINOCULARS")) { tag = INV_ELECTROBINOCULARS; } else if (!Q_stricmp(tokenStr,"INV_SENTRY")) { tag = INV_SENTRY; } else if (!Q_stricmp(tokenStr,"INV_LIGHTAMP_GOGGLES")) { tag = INV_LIGHTAMP_GOGGLES; } else if (!Q_stricmp(tokenStr,"INV_GOODIE_KEY")) { tag = INV_GOODIE_KEY; } else if (!Q_stricmp(tokenStr,"INV_SECURITY_KEY")) { tag = INV_SECURITY_KEY; } else if (!Q_stricmp(tokenStr,"ITM_MEDPAK_PICKUP")) { tag = ITM_MEDPAK_PICKUP; } else if (!Q_stricmp(tokenStr,"ITM_SHIELD_SM_PICKUP")) { tag = ITM_SHIELD_SM_PICKUP; } else if (!Q_stricmp(tokenStr,"ITM_SHIELD_LRG_PICKUP")) { tag = ITM_SHIELD_LRG_PICKUP; } else { tag = WP_BRYAR_PISTOL; //This error was slipping through too much, causing runaway exceptions and shutting down, so now it's a real error when not in Final #ifndef FINAL_BUILD G_Error("ERROR: bad tagname in external item data '%s'\n", tokenStr); #else gi.Printf("WARNING: bad tagname in external item data '%s'\n", tokenStr); #endif } bg_itemlist[itemParms.itemNum].giTag = tag; }
qboolean WP_SaberParseParms( const char *SaberName, saberInfo_t *saber, qboolean setColors ) { const char *token; const char *value; const char *p; float f; int n; if ( !saber ) { return qfalse; } //Set defaults so that, if it fails, there's at least something there WP_SaberSetDefaults( saber, setColors ); if ( !SaberName || !SaberName[0] ) { return qfalse; } saber->name = G_NewString( SaberName ); //try to parse it out p = SaberParms; COM_BeginParseSession(); // look for the right saber while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { return qfalse; } if ( !Q_stricmp( token, SaberName ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { return qfalse; } if ( G_ParseLiteral( &p, "{" ) ) { return qfalse; } // parse the saber info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { gi.Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", SaberName ); return qfalse; } if ( !Q_stricmp( token, "}" ) ) { break; } //saber fullName if ( !Q_stricmp( token, "name" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->fullName = G_NewString( value ); continue; } //saber type if ( !Q_stricmp( token, "saberType" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } int saberType = GetIDForString( SaberTable, value ); if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS ) { saber->type = (saberType_t)saberType; } continue; } //saber hilt if ( !Q_stricmp( token, "saberModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->model = G_NewString( value ); continue; } if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->skin = G_NewString( value ); continue; } //on sound if ( !Q_stricmp( token, "soundOn" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundOn = G_SoundIndex( G_NewString( value ) ); continue; } //loop sound if ( !Q_stricmp( token, "soundLoop" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundLoop = G_SoundIndex( G_NewString( value ) ); continue; } //off sound if ( !Q_stricmp( token, "soundOff" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundOff = G_SoundIndex( G_NewString( value ) ); continue; } if ( !Q_stricmp( token, "numBlades" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n >= MAX_BLADES ) { G_Error( "WP_SaberParseParms: saber %s has illegal number of blades (%d) max: %d", SaberName, n, MAX_BLADES ); continue; } saber->numBlades = n; continue; } // saberColor if ( !Q_stricmpn( token, "saberColor", 10 ) ) { if ( !setColors ) {//don't actually want to set the colors //read the color out anyway just to advance the *p pointer COM_ParseString( &p, &value ); continue; } else { if (strlen(token)==10) { n = -1; } else if (strlen(token)==11) { n = atoi(&token[10])-1; if (n > 7 || n < 1 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, SaberName ); //read the color out anyway just to advance the *p pointer COM_ParseString( &p, &value ); continue; } } else { gi.Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, SaberName ); //read the color out anyway just to advance the *p pointer COM_ParseString( &p, &value ); continue; } if ( COM_ParseString( &p, &value ) ) //read the color { continue; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same color by default saber_colors_t color = TranslateSaberColor( value ); for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].color = color; } } else { saber->blade[n].color = TranslateSaberColor( value ); } continue; } } //saber length if ( !Q_stricmpn( token, "saberLength", 11 ) ) { if (strlen(token)==11) { n = -1; } else if (strlen(token)==12) { n = atoi(&token[11])-1; if (n > 7 || n < 1 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, SaberName ); continue; } } else { gi.Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, SaberName ); continue; } if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same length by default for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].lengthMax = f; } } else { saber->blade[n].lengthMax = f; } continue; } //blade radius if ( !Q_stricmpn( token, "saberRadius", 11 ) ) { if (strlen(token)==11) { n = -1; } else if (strlen(token)==12) { n = atoi(&token[11])-1; if (n > 7 || n < 1 ) { gi.Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, SaberName ); continue; } } else { gi.Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, SaberName ); continue; } if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same length by default for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].radius = f; } } else { saber->blade[n].radius = f; } continue; } //locked saber style if ( !Q_stricmp( token, "saberStyle" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->style = TranslateSaberStyle( value ); continue; } //maxChain if ( !Q_stricmp( token, "maxChain" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->maxChain = n; continue; } //lockable if ( !Q_stricmp( token, "lockable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->lockable = ((qboolean)(n!=0)); continue; } //throwable if ( !Q_stricmp( token, "throwable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->throwable = ((qboolean)(n!=0)); continue; } //disarmable if ( !Q_stricmp( token, "disarmable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->disarmable = ((qboolean)(n!=0)); continue; } //active blocking if ( !Q_stricmp( token, "blocking" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->activeBlocking = ((qboolean)(n!=0)); continue; } //twoHanded if ( !Q_stricmp( token, "twoHanded" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->twoHanded = ((qboolean)(n!=0)); continue; } //force power restrictions if ( !Q_stricmp( token, "forceRestrict" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } int fp = GetIDForString( FPTable, value ); if ( fp >= FP_FIRST && fp < NUM_FORCE_POWERS ) { saber->forceRestrictions |= (1<<fp); } continue; } //lockBonus if ( !Q_stricmp( token, "lockBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->lockBonus = n; continue; } //parryBonus if ( !Q_stricmp( token, "parryBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->parryBonus = n; continue; } //breakParryBonus if ( !Q_stricmp( token, "breakParryBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->breakParryBonus = n; continue; } //disarmBonus if ( !Q_stricmp( token, "disarmBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->disarmBonus = n; continue; } //single blade saber style if ( !Q_stricmp( token, "singleBladeStyle" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->singleBladeStyle = TranslateSaberStyle( value ); continue; } //single blade throwable if ( !Q_stricmp( token, "singleBladeThrowable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->singleBladeThrowable = ((qboolean)(n!=0)); continue; } //broken replacement saber1 (right hand) if ( !Q_stricmp( token, "brokenSaber1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->brokenSaber1 = G_NewString( value ); continue; } //broken replacement saber2 (left hand) if ( !Q_stricmp( token, "brokenSaber2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->brokenSaber2 = G_NewString( value ); continue; } //spins and does damage on return from saberthrow if ( !Q_stricmp( token, "returnDamage" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->returnDamage = ((qboolean)(n!=0)); continue; } if ( !Q_stricmp( token, "notInMP" ) ) {//ignore this SkipRestOfLine( &p ); continue; } gi.Printf( "WARNING: unknown keyword '%s' while parsing '%s'\n", token, SaberName ); SkipRestOfLine( &p ); } //FIXME: precache the saberModel(s)? if ( saber->type == SABER_SITH_SWORD ) {//precache all the sith sword sounds Saber_SithSwordPrecache(); } return qtrue; }
void WPN_WeaponType( const char **holdBuf) { int weaponNum; const char *tokenStr; if (COM_ParseString(holdBuf,&tokenStr)) { return; } // FIXME : put this in an array (maybe a weaponDataInternal array???) if (!Q_stricmp(tokenStr,"WP_NONE")) weaponNum = WP_NONE; else if (!Q_stricmp(tokenStr,"WP_SABER")) weaponNum = WP_SABER; else if (!Q_stricmp(tokenStr,"WP_BLASTER_PISTOL")) weaponNum = WP_BLASTER_PISTOL; else if (!Q_stricmp(tokenStr,"WP_BRYAR_PISTOL")) weaponNum = WP_BRYAR_PISTOL; else if (!Q_stricmp(tokenStr,"WP_BLASTER")) weaponNum = WP_BLASTER; else if (!Q_stricmp(tokenStr,"WP_DISRUPTOR")) weaponNum = WP_DISRUPTOR; else if (!Q_stricmp(tokenStr,"WP_BOWCASTER")) weaponNum = WP_BOWCASTER; else if (!Q_stricmp(tokenStr,"WP_REPEATER")) weaponNum = WP_REPEATER; else if (!Q_stricmp(tokenStr,"WP_DEMP2")) weaponNum = WP_DEMP2; else if (!Q_stricmp(tokenStr,"WP_FLECHETTE")) weaponNum = WP_FLECHETTE; else if (!Q_stricmp(tokenStr,"WP_ROCKET_LAUNCHER")) weaponNum = WP_ROCKET_LAUNCHER; else if (!Q_stricmp(tokenStr,"WP_CONCUSSION")) weaponNum = WP_CONCUSSION; else if (!Q_stricmp(tokenStr,"WP_THERMAL")) weaponNum = WP_THERMAL; else if (!Q_stricmp(tokenStr,"WP_TRIP_MINE")) weaponNum = WP_TRIP_MINE; else if (!Q_stricmp(tokenStr,"WP_DET_PACK")) weaponNum = WP_DET_PACK; else if (!Q_stricmp(tokenStr,"WP_STUN_BATON")) weaponNum = WP_STUN_BATON; else if (!Q_stricmp(tokenStr,"WP_BOT_LASER")) weaponNum = WP_BOT_LASER; else if (!Q_stricmp(tokenStr,"WP_EMPLACED_GUN")) weaponNum = WP_EMPLACED_GUN; else if (!Q_stricmp(tokenStr,"WP_MELEE")) weaponNum = WP_MELEE; else if (!Q_stricmp(tokenStr,"WP_TURRET")) weaponNum = WP_TURRET; else if (!Q_stricmp(tokenStr,"WP_ATST_MAIN")) weaponNum = WP_ATST_MAIN; else if (!Q_stricmp(tokenStr,"WP_ATST_SIDE")) weaponNum = WP_ATST_SIDE; else if (!Q_stricmp(tokenStr,"WP_TIE_FIGHTER")) weaponNum = WP_TIE_FIGHTER; else if (!Q_stricmp(tokenStr,"WP_RAPID_FIRE_CONC")) weaponNum = WP_RAPID_FIRE_CONC; else if (!Q_stricmp(tokenStr,"WP_JAWA")) weaponNum = WP_JAWA; else if (!Q_stricmp(tokenStr,"WP_TUSKEN_RIFLE")) weaponNum = WP_TUSKEN_RIFLE; else if (!Q_stricmp(tokenStr,"WP_TUSKEN_STAFF")) weaponNum = WP_TUSKEN_STAFF; else if (!Q_stricmp(tokenStr,"WP_SCEPTER")) weaponNum = WP_SCEPTER; else if (!Q_stricmp(tokenStr,"WP_NOGHRI_STICK")) weaponNum = WP_NOGHRI_STICK; else { weaponNum = 0; gi.Printf(S_COLOR_YELLOW"WARNING: bad weapontype in external weapon data '%s'\n", tokenStr); } wpnParms.weaponNum = weaponNum; }
qboolean UI_SaberParseParm( const char *saberName, const char *parmname, char *saberData ) { const char *token; const char *value; const char *p; if ( !saberName || !saberName[0] ) { return qfalse; } //try to parse it out p = SaberParms; COM_BeginParseSession(); // look for the right saber while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { return qfalse; } if ( !Q_stricmp( token, saberName ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { return qfalse; } if ( UI_ParseLiteral( &p, "{" ) ) { return qfalse; } // parse the saber info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { ui.Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", saberName ); return qfalse; } if ( !Q_stricmp( token, "}" ) ) { break; } if ( !Q_stricmp( token, parmname ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } strcpy( saberData, value ); return qtrue; } SkipRestOfLine( &p ); continue; } return qfalse; }
qboolean BG_ParseRankNames( char* fileName, rankNames_t rankNames[] ) { fileHandle_t f; int file_len; char charText[20000]; char* textPtr; char* token; int i = 0; file_len = trap_FS_FOpenFile( fileName, &f, FS_READ ); if ( file_len<= 0 ) { return qfalse; } if ( file_len >= ( sizeof(charText) - 1) ) { Com_Printf( S_COLOR_RED "File length of %s is too long.\n", fileName ); } memset( &charText, 0, sizeof( charText ) ); memset( rankNames, 0, sizeof( rankNames ) ); trap_FS_Read( charText, file_len, f ); charText[file_len] = 0; trap_FS_FCloseFile( f ); COM_BeginParseSession(); textPtr = charText; token = COM_Parse( &textPtr ); if ( !token[0] ) { Com_Printf( S_COLOR_RED "No data found in buffer: %s\n", fileName ); return qfalse; } if ( Q_stricmpn( token, "{", 1 ) ) { Com_Printf( S_COLOR_RED "No beginning { found in %s\n", fileName ); return qfalse; } //Parse out the default cell. Default has no names anyway, //but in case a n00bie modder put names in anyway. SkipBracedSection( &textPtr ); while( 1 ) { //lastPtr = textPtr; token = COM_Parse( &textPtr ); if( !token[0] ) { break; } if ( i >= MAX_RANKS ) { break; } //If we hit an open brace (ie, assuming we hit the start of a new rank cell) if ( !Q_stricmpn( token, "{", 1 ) ) { while ( 1 ) { token = COM_Parse( &textPtr ); if( !token[0] ) { break; } //We hit a MenuTexture entry, since this uses { symbols, we'll skip these to stop errors. if ( !Q_stricmpn( token, "MenuTexture", 11 ) ) { SkipRestOfLine( &textPtr ); continue; } if ( !Q_stricmpn( token, "ConsoleName", 11) ) { if ( COM_ParseString( &textPtr, &token ) ) { continue; } Q_strncpyz( rankNames[i].consoleName, token, sizeof( rankNames[i].consoleName ) ); continue; } else if ( !Q_stricmpn( token, "FormalName", 10) ) { if ( COM_ParseString( &textPtr, &token ) ) { continue; } Q_strncpyz( rankNames[i].formalName, token, sizeof( rankNames[i].formalName ) ); continue; } //We hit the end of the cell. else if ( !Q_stricmpn( token, "}", 1 ) ) { break; } } //Error check. If we didn't get both a formal and console name, pwn the caller. ;P if ( !rankNames[i].consoleName[0] || !rankNames[i].formalName[0] ) { Com_Printf( S_COLOR_RED "One or more rank names were not found in rank#: %i\n", i ); return qfalse; } else { i++; } } } return qtrue; }
void NPC_PrecacheAnimationCFG( const char *NPC_type ) { char filename[MAX_QPATH]; const char *token; const char *value; const char *p; int junk; if ( !Q_stricmp( "random", NPC_type ) ) {//sorry, can't precache a random just yet return; } p = NPCParms; COM_BeginParseSession(); // look for the right NPC while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { return; } if ( !Q_stricmp( token, NPC_type ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { return; } if ( G_ParseLiteral( &p, "{" ) ) { return; } // parse the NPC info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { gi.Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", NPC_type ); return; } if ( !Q_stricmp( token, "}" ) ) { break; } // legsmodel if ( !Q_stricmp( token, "legsmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //must copy data out of this pointer into a different part of memory because the funcs we're about to call will call COM_ParseExt Q_strncpyz( filename, value, sizeof( filename ), qtrue ); G_ParseAnimFileSet( filename, filename, &junk ); return; } // playerModel if ( !Q_stricmp( token, "playerModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } char animName[MAX_QPATH]; char *GLAName; char *slash = NULL; char *strippedName; int handle = gi.G2API_PrecacheGhoul2Model( va( "models/players/%s/model.glm", value ) ); if ( handle > 0 )//FIXME: isn't 0 a valid handle? { GLAName = gi.G2API_GetAnimFileNameIndex( handle ); if ( GLAName ) { Q_strncpyz( animName, GLAName, sizeof( animName ), qtrue ); slash = strrchr( animName, '/' ); if ( slash ) { *slash = 0; } strippedName = COM_SkipPath( animName ); //must copy data out of this pointer into a different part of memory because the funcs we're about to call will call COM_ParseExt Q_strncpyz( filename, value, sizeof( filename ), qtrue ); G_ParseAnimFileSet( value, strippedName, &junk );//qfalse ); //FIXME: still not precaching the animsounds.cfg? return; } } } } }
/* void NPC_Precache ( char *NPCName ) Precaches NPC skins, tgas and md3s. */ void NPC_Precache ( gentity_t *spawner ) { clientInfo_t ci={0}; renderInfo_t ri={0}; team_t playerTeam = TEAM_FREE; const char *token; const char *value; const char *p; char *patch; char sound[MAX_QPATH]; qboolean md3Model = qfalse; char playerModel[MAX_QPATH]; char customSkin[MAX_QPATH]; if ( !Q_stricmp( "random", spawner->NPC_type ) ) {//sorry, can't precache a random just yet return; } strcpy(customSkin,"default"); p = NPCParms; COM_BeginParseSession(); // look for the right NPC while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { return; } if ( !Q_stricmp( token, spawner->NPC_type ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { return; } if ( G_ParseLiteral( &p, "{" ) ) { return; } // parse the NPC info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { gi.Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", spawner->NPC_type ); return; } if ( !Q_stricmp( token, "}" ) ) { break; } // headmodel if ( !Q_stricmp( token, "headmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { } else { Q_strncpyz( ri.headModelName, value, sizeof(ri.headModelName), qtrue); } md3Model = qtrue; continue; } // torsomodel if ( !Q_stricmp( token, "torsomodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { } else { Q_strncpyz( ri.torsoModelName, value, sizeof(ri.torsoModelName), qtrue); } md3Model = qtrue; continue; } // legsmodel if ( !Q_stricmp( token, "legsmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( ri.legsModelName, value, sizeof(ri.legsModelName), qtrue); md3Model = qtrue; continue; } // playerModel if ( !Q_stricmp( token, "playerModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( playerModel, value, sizeof(playerModel), qtrue); md3Model = qfalse; continue; } // customSkin if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( customSkin, value, sizeof(customSkin), qtrue); continue; } // playerTeam if ( !Q_stricmp( token, "playerTeam" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } playerTeam = TranslateTeamName(value); continue; } // snd if ( !Q_stricmp( token, "snd" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->svFlags&SVF_NO_BASIC_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci.customBasicSoundDir = G_NewString( sound ); } continue; } // sndcombat if ( !Q_stricmp( token, "sndcombat" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->svFlags&SVF_NO_COMBAT_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci.customCombatSoundDir = G_NewString( sound ); } continue; } // sndextra if ( !Q_stricmp( token, "sndextra" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci.customExtraSoundDir = G_NewString( sound ); } continue; } // sndjedi if ( !Q_stricmp( token, "sndjedi" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } ci.customJediSoundDir = G_NewString( sound ); } continue; } } if ( md3Model ) { CG_RegisterClientRenderInfo( &ci, &ri ); } else { char skinName[MAX_QPATH]; //precache ghoul2 model gi.G2API_PrecacheGhoul2Model( va( "models/players/%s/model.glm", playerModel ) ); //precache skin Com_sprintf( skinName, sizeof( skinName ), "models/players/%s/model_%s.skin", playerModel, customSkin ); // lets see if it's out there gi.RE_RegisterSkin( skinName ); } //precache this NPC's possible weapons NPC_PrecacheWeapons( playerTeam, spawner->spawnflags, spawner->NPC_type ); CG_RegisterNPCCustomSounds( &ci ); CG_RegisterNPCEffects( playerTeam ); //FIXME: Look for a "sounds" directory and precache death, pain, alert sounds }
qboolean WP_SaberParseParms( const char *SaberName, saberInfo_t *saber ) { const char *token; const char *value; const char *p; char useSaber[1024]; float f; int n; qboolean triedDefault = qfalse; if ( !saber ) { return qfalse; } //Set defaults so that, if it fails, there's at least something there WP_SaberSetDefaults( saber ); if ( !SaberName || !SaberName[0] ) { strcpy(useSaber, DEFAULT_SABER); //default triedDefault = qtrue; } else { strcpy(useSaber, SaberName); } //try to parse it out p = SaberParms; COM_BeginParseSession("saberinfo"); // look for the right saber while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { if (!triedDefault) { //fall back to default and restart, should always be there p = SaberParms; COM_BeginParseSession("saberinfo"); strcpy(useSaber, DEFAULT_SABER); triedDefault = qtrue; } else { return qfalse; } } if ( !Q_stricmp( token, useSaber ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { //even the default saber isn't found? return qfalse; } //got the name we're using for sure strcpy(saber->name, useSaber); if ( BG_ParseLiteral( &p, "{" ) ) { return qfalse; } // parse the saber info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", useSaber ); return qfalse; } if ( !Q_stricmp( token, "}" ) ) { break; } //saber fullName if ( !Q_stricmp( token, "name" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } strcpy(saber->fullName, value); continue; } //saber type if ( !Q_stricmp( token, "saberType" ) ) { int saberType; if ( COM_ParseString( &p, &value ) ) { continue; } saberType = GetIDForString( SaberTable, value ); if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS ) { saber->type = (saberType_t)saberType; } continue; } //saber hilt if ( !Q_stricmp( token, "saberModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } strcpy(saber->model, value); continue; } if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->skin = trap_R_RegisterSkin(value); continue; } //on sound if ( !Q_stricmp( token, "soundOn" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundOn = BG_SoundIndex( (char *)value ); continue; } //loop sound if ( !Q_stricmp( token, "soundLoop" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundLoop = BG_SoundIndex( (char *)value ); continue; } //off sound if ( !Q_stricmp( token, "soundOff" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundOff = BG_SoundIndex( (char *)value ); continue; } if ( !Q_stricmp( token, "numBlades" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n >= MAX_BLADES ) { Com_Error(ERR_DROP, "WP_SaberParseParms: saber %s has illegal number of blades (%d) max: %d", useSaber, n, MAX_BLADES ); continue; } saber->numBlades = n; continue; } // saberColor if ( !Q_stricmpn( token, "saberColor", 10 ) ) { if (strlen(token)==10) { n = -1; } else if (strlen(token)==11) { n = atoi(&token[10])-1; if (n > 7 || n < 1 ) { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber ); #endif continue; } } else { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber ); #endif continue; } if ( COM_ParseString( &p, &value ) ) //read the color { continue; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same color by default saber_colors_t color = TranslateSaberColor( value ); for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].color = color; } } else { saber->blade[n].color = TranslateSaberColor( value ); } continue; } //saber length if ( !Q_stricmpn( token, "saberLength", 11 ) ) { if (strlen(token)==11) { n = -1; } else if (strlen(token)==12) { n = atoi(&token[11])-1; if (n > 7 || n < 1 ) { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber ); #endif continue; } } else { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber ); #endif continue; } if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same length by default for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].lengthMax = f; } } else { saber->blade[n].lengthMax = f; } continue; } //blade radius if ( !Q_stricmpn( token, "saberRadius", 11 ) ) { if (strlen(token)==11) { n = -1; } else if (strlen(token)==12) { n = atoi(&token[11])-1; if (n > 7 || n < 1 ) { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber ); #endif continue; } } else { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber ); #endif continue; } if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same length by default for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].radius = f; } } else { saber->blade[n].radius = f; } continue; } //locked saber style if ( !Q_stricmp( token, "saberStyle" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->style = TranslateSaberStyle( value ); continue; } //maxChain if ( !Q_stricmp( token, "maxChain" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->maxChain = n; continue; } //lockable if ( !Q_stricmp( token, "lockable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->lockable = ((qboolean)(n!=0)); continue; } //throwable if ( !Q_stricmp( token, "throwable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->throwable = ((qboolean)(n!=0)); continue; } //disarmable if ( !Q_stricmp( token, "disarmable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->disarmable = ((qboolean)(n!=0)); continue; } //active blocking if ( !Q_stricmp( token, "blocking" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->activeBlocking = ((qboolean)(n!=0)); continue; } //twoHanded if ( !Q_stricmp( token, "twoHanded" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->twoHanded = ((qboolean)(n!=0)); continue; } //force power restrictions if ( !Q_stricmp( token, "forceRestrict" ) ) { int fp; if ( COM_ParseString( &p, &value ) ) { continue; } fp = GetIDForString( FPTable, value ); if ( fp >= FP_FIRST && fp < NUM_FORCE_POWERS ) { saber->forceRestrictions |= (1<<fp); } continue; } //lockBonus if ( !Q_stricmp( token, "lockBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->lockBonus = n; continue; } //parryBonus if ( !Q_stricmp( token, "parryBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->parryBonus = n; continue; } //breakParryBonus if ( !Q_stricmp( token, "breakParryBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->breakParryBonus = n; continue; } //disarmBonus if ( !Q_stricmp( token, "disarmBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->disarmBonus = n; continue; } //single blade saber style if ( !Q_stricmp( token, "singleBladeStyle" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->singleBladeStyle = TranslateSaberStyle( value ); continue; } //single blade throwable if ( !Q_stricmp( token, "singleBladeThrowable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->singleBladeThrowable = ((qboolean)(n!=0)); continue; } //broken replacement saber1 (right hand) if ( !Q_stricmp( token, "brokenSaber1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //saber->brokenSaber1 = G_NewString( value ); continue; } //broken replacement saber2 (left hand) if ( !Q_stricmp( token, "brokenSaber2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //saber->brokenSaber2 = G_NewString( value ); continue; } //spins and does damage on return from saberthrow if ( !Q_stricmp( token, "returnDamage" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->returnDamage = ((qboolean)(n!=0)); continue; } //stops the saber from drawing marks on the world (good for real-sword type mods) if ( !Q_stricmp( token, "noWallMarks" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noWallMarks = ((qboolean)(n!=0)); continue; } //stops the saber from drawing a dynamic light (good for real-sword type mods) if ( !Q_stricmp( token, "noDlight" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noDlight = ((qboolean)(n!=0)); continue; } //stops the saber from drawing a blade (good for real-sword type mods) if ( !Q_stricmp( token, "noBlade" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noBlade = ((qboolean)(n!=0)); continue; } //default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods) if ( !Q_stricmp( token, "trailStyle" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->trailStyle = n; continue; } //if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark" if ( !Q_stricmp( token, "g2MarksShader" ) ) { if ( COM_ParseString( &p, &value ) ) { SkipRestOfLine( &p ); continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->g2MarksShader = trap_R_RegisterShader( value ); #endif continue; } //if non-zero, uses damage done to calculate an appropriate amount of knockback if ( !Q_stricmp( token, "knockbackScale" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } saber->knockbackScale = f; continue; } //scale up or down the damage done by the saber if ( !Q_stricmp( token, "damageScale" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } saber->damageScale = f; continue; } //if non-zero, the saber never does dismemberment (good for pointed/blunt melee weapons) if ( !Q_stricmp( token, "noDismemberment" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noDismemberment = ((qboolean)(n!=0)); continue; } //if non-zero, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods) if ( !Q_stricmp( token, "noIdleEffect" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noIdleEffect = ((qboolean)(n!=0)); continue; } //spin sound (when thrown) if ( !Q_stricmp( token, "spinSound" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->spinSound = BG_SoundIndex( (char *)value ); continue; } //swing sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "swingSound1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->swingSound[0] = BG_SoundIndex( (char *)value ); continue; } //swing sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "swingSound2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->swingSound[1] = BG_SoundIndex( (char *)value ); continue; } //swing sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "swingSound3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->swingSound[2] = BG_SoundIndex( (char *)value ); continue; } //hit sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "hitSound1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->hitSound[0] = BG_SoundIndex( (char *)value ); continue; } //hit sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "hitSound2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->hitSound[1] = BG_SoundIndex( (char *)value ); continue; } //hit sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "hitSound3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->hitSound[2] = BG_SoundIndex( (char *)value ); continue; } //block sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "blockSound1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->blockSound[0] = BG_SoundIndex( (char *)value ); continue; } //block sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "blockSound2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->blockSound[1] = BG_SoundIndex( (char *)value ); continue; } //block sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "blockSound3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->blockSound[2] = BG_SoundIndex( (char *)value ); continue; } //block effect - when saber/sword hits another saber/sword if ( !Q_stricmp( token, "blockEffect" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->blockEffect = trap_FX_RegisterEffect( (char *)value ); #endif continue; } //hit person effect - when saber/sword hits a person if ( !Q_stricmp( token, "hitPersonEffect" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->hitPersonEffect = trap_FX_RegisterEffect( (char *)value ); #endif continue; } //hit other effect - when saber/sword hits sopmething else damagable if ( !Q_stricmp( token, "hitOtherEffect" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->hitOtherEffect = trap_FX_RegisterEffect( (char *)value ); #endif continue; } //if non-zero, the saber will not do the big, white clash flare with other sabers if ( !Q_stricmp( token, "noClashFlare" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noClashFlare = ((qboolean)(n!=0)); continue; } if ( !Q_stricmp( token, "notInMP" ) ) {//ignore this SkipRestOfLine( &p ); continue; } //FIXME: saber sounds (on, off, loop) #ifdef _DEBUG Com_Printf( "WARNING: unknown keyword '%s' while parsing '%s'\n", token, useSaber ); #endif SkipRestOfLine( &p ); } //FIXME: precache the saberModel(s)? return qtrue; }