void HoldableItem::cacheStrings( void ) { G_FindConfigstringIndex( va( "$$Using$$ $$Item-%s$$", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); G_FindConfigstringIndex( va( "$$PickedUp$$ $$Item-%s$$", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); }
void Powerup::cacheStrings( void ) { G_FindConfigstringIndex( va( "$$Using$$ $$Item-%s$$", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); G_FindConfigstringIndex( va( "$$Item-%s$$ $$TimeRanOut$$", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); }
void Rune::cacheStrings( void ) { G_FindConfigstringIndex( va( "$$Using$$ $$Item-%s$$", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); G_FindConfigstringIndex( va( "$$Dropping$$ $$Item-%s$$", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); }
int G_StringIndex( const char* string ) { return G_FindConfigstringIndex( string, CS_STRINGS, MAX_CSSTRINGS, qtrue ); }
void Item::cacheStrings( void ) { G_FindConfigstringIndex( va( "$$PickedUp$$ %d $$Item-%s$$\n", (int)getAmount(), getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); G_FindConfigstringIndex( va( "$$PickedUp$$ %d $$Item-%s$$s\n", (int)getAmount(), getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); G_FindConfigstringIndex( va( "$$PickedUpThe$$ $$Item-%s$$\n", getName().c_str() ), CS_GENERAL_STRINGS, MAX_GENERAL_STRINGS, true ); }
/* ================ FinishSpawningItem Traces down to find where an item should rest, instead of letting them free fall from their spawn points ================ */ void FinishSpawningItem( gentity_t *ent ) { trace_t tr; vec3_t dest; vec3_t maxs; if ( ent->spawnflags & 1 ) { // suspended VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS ); VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS ); VectorCopy( ent->r.maxs, maxs ); } else { // Rafael // had to modify this so that items would spawn in shelves VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, 0 ); VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS ); VectorCopy( ent->r.maxs, maxs ); maxs[2] /= 2; } ent->r.contents = CONTENTS_TRIGGER | CONTENTS_ITEM; ent->touch = Touch_Item_Auto; ent->s.eType = ET_ITEM; ent->s.modelindex = ent->item - bg_itemlist; // store item number in modelindex ent->s.otherEntityNum2 = 0; // DHM - Nerve :: takes modelindex2's place in signaling a dropped item //----(SA) we don't use this (yet, anyway) so I'm taking it so you can specify a model for treasure items and clipboards // ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item if ( ent->model ) { ent->s.modelindex2 = G_ModelIndex( ent->model ); } // if clipboard, add the menu name string to the client's configstrings if ( ent->item->giType == IT_CLIPBOARD ) { if ( !ent->message ) { ent->s.density = G_FindConfigstringIndex( "clip_test", CS_CLIPBOARDS, MAX_CLIPBOARD_CONFIGSTRINGS, qtrue ); } else { ent->s.density = G_FindConfigstringIndex( ent->message, CS_CLIPBOARDS, MAX_CLIPBOARD_CONFIGSTRINGS, qtrue ); } ent->touch = Touch_Item; // no auto-pickup, only activate } else if ( ent->item->giType == IT_HOLDABLE ) { if ( ent->item->giTag >= HI_BOOK1 && ent->item->giTag <= HI_BOOK3 ) { G_FindConfigstringIndex( va( "hbook%d", ent->item->giTag - HI_BOOK1 ), CS_CLIPBOARDS, MAX_CLIPBOARD_CONFIGSTRINGS, qtrue ); } ent->touch = Touch_Item; // no auto-pickup, only activate } //----(SA) added if ( ent->item->giType == IT_TREASURE ) { ent->touch = Touch_Item; // no auto-pickup, only activate } //----(SA) end // using an item causes it to respawn ent->use = Use_Item; //----(SA) moved this up so it happens for suspended items too (and made it a function) G_SetAngle( ent, ent->s.angles ); if ( ent->spawnflags & 1 ) { // suspended G_SetOrigin( ent, ent->s.origin ); } else { VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 ); trap_Trace( &tr, ent->s.origin, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID ); if ( tr.startsolid ) { vec3_t temp; VectorCopy( ent->s.origin, temp ); temp[2] -= ITEM_RADIUS; VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 ); trap_Trace( &tr, temp, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID ); } #if 0 // drop to floor VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 ); trap_Trace( &tr, ent->s.origin, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID ); #endif if ( tr.startsolid ) { G_Printf( "FinishSpawningItem: %s startsolid at %s\n", ent->classname, vtos( ent->s.origin ) ); G_FreeEntity( ent ); return; } // allow to ride movers ent->s.groundEntityNum = tr.entityNum; G_SetOrigin( ent, tr.endpos ); } if ( ent->spawnflags & 2 ) { // spin ent->s.eFlags |= EF_SPINNING; } // team slaves and targeted items aren't present at start if ( ( ent->flags & FL_TEAMSLAVE ) || ent->targetname ) { ent->flags |= FL_NODRAW; //ent->s.eFlags |= EF_NODRAW; ent->r.contents = 0; return; } // health/ammo can potentially be multi-stage (multiple use) if ( ent->item->giType == IT_HEALTH || ent->item->giType == IT_AMMO || ent->item->giType == IT_POWERUP ) { int i; // having alternate models defined in bg_misc.c for a health or ammo item specify it as "multi-stage" // TTimo left-hand operand of comma expression has no effect // initial line: for(i=0;i<4,ent->item->world_model[i];i++) {} for ( i = 0; i < 4 && ent->item->world_model[i] ; i++ ) {} ent->s.density = i - 1; // store number of stages in 'density' for client (most will have '1') } // powerups don't spawn in for a while if ( ent->item->giType == IT_POWERUP && g_gametype.integer != GT_SINGLE_PLAYER ) { float respawn; respawn = 45 + crandom() * 15; ent->flags |= FL_NODRAW; //ent->s.eFlags |= EF_NODRAW; ent->r.contents = 0; ent->nextthink = level.time + respawn * 1000; ent->think = RespawnItem; return; } trap_LinkEntity( ent ); }
int G_CharacterIndex( const char *name ) { return G_FindConfigstringIndex (name, CS_CHARACTERS, MAX_CHARACTERS, qtrue); }
//TA: added ParticleSystemIndex int G_ParticleSystemIndex( char *name ) { return G_FindConfigstringIndex( name, CS_PARTICLE_SYSTEMS, MAX_GAME_PARTICLE_SYSTEMS, qtrue ); }
int G_SkinIndex( const char *name ) { return G_FindConfigstringIndex (name, CS_SKINS, MAX_CS_SKINS, qtrue); }
int G_BSPIndex( char *name ) { return G_FindConfigstringIndex (name, CS_BSP_MODELS, MAX_SUB_BSP, qtrue); }
int G_SoundIndex( const char *name ) { char stripped[MAX_QPATH]; COM_StripExtension(name, stripped); return G_FindConfigstringIndex (stripped, CS_SOUNDS, MAX_SOUNDS, qtrue); }
int G_LocationIndex( const char *name ) { return G_FindConfigstringIndex( name, CS_LOCATIONS, MAX_LOCATIONS, qtrue ); }
int G_ReverbEffectIndex( const char *name ) { return G_FindConfigstringIndex( name, CS_REVERB_EFFECTS+1, MAX_REVERB_EFFECTS-1, qtrue ); }
/** * searches for a the grading texture with the given name among the configstrings and returns the index * if it wasn't found it will add the texture to the configstrings, send these to the client and return the new index * * the first one at CS_GRADING_TEXTURES is always the global one, so we start searching from CS_GRADING_TEXTURES+1 */ int G_GradingTextureIndex( const char *name ) { return G_FindConfigstringIndex( name, CS_GRADING_TEXTURES+1, MAX_GRADING_TEXTURES-1, qtrue ); }
int G_ModelIndex( char *name ) { return G_FindConfigstringIndex (name, CS_MODELS, MAX_MODELS, qtrue); }
int G_ShaderIndex( char *name ) { return G_FindConfigstringIndex (name, CS_SHADERS, MAX_CS_SHADERS, qtrue); }
int G_SoundIndex( const char *name ) { return G_FindConfigstringIndex (name, CS_SOUNDS, MAX_SOUNDS, qtrue); }
void SP_CreateRain( gentity_t *ent ) { // Different Types Of Rain //------------------------- if (ent->spawnflags & 1) { G_FindConfigstringIndex("lightrain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } else if (ent->spawnflags & 2) { G_FindConfigstringIndex("rain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } else if (ent->spawnflags & 4) { G_FindConfigstringIndex("heavyrain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); // Automatically Get Heavy Fog //----------------------------- G_FindConfigstringIndex("heavyrainfog", CS_WORLD_FX, MAX_WORLD_FX, qtrue ); // Automatically Get Lightning & Thunder //--------------------------------------- ent->spawnflags |= 64; } else if (ent->spawnflags & 8) { G_EffectIndex( "world/acid_fizz" ); G_FindConfigstringIndex("acidrain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } // OUTSIDE SHAKE //=============== if (ent->spawnflags & 16) { G_FindConfigstringIndex("outsideShake", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } // MISTY FOG //=========== if (ent->spawnflags & 32) { G_FindConfigstringIndex("fog", CS_WORLD_FX, MAX_WORLD_FX, qtrue ); } // LIGHTNING //=========== if (ent->spawnflags & 64) { G_SoundIndex("sound/ambience/thunder1"); G_SoundIndex("sound/ambience/thunder2"); G_SoundIndex("sound/ambience/thunder3"); G_SoundIndex("sound/ambience/thunder4"); G_SoundIndex("sound/ambience/thunder_close1"); G_SoundIndex("sound/ambience/thunder_close2"); G_EffectIndex( "env/huge_lightning" ); ent->e_ThinkFunc = thinkF_fx_rain_think; ent->nextthink = level.time + Q_irand(4000, 8000); if (!G_SpawnVector( "flashcolor", "200 200 200", ent->pos3)) { VectorSet(ent->pos3, 200, 200, 200); } VectorClear(ent->pos2); // the "off" color G_SpawnInt("flashdelay", "12000", &ent->delay); G_SpawnInt("chanceflicker", "2", &ent->attackDebounceTime); G_SpawnInt("chancesound", "3", &ent->pushDebounceTime); G_SpawnInt("chanceeffect", "4", &ent->aimDebounceTime); } }