void Area_BreakableSpawn(ServerEntity_t *area) { if (area->v.health <= 0) { area->v.health = 1; } switch (area->local.style) { case BREAKABLE_GLASS: Server_PrecacheSound( PHYSICS_SOUND_GLASS0); Server_PrecacheSound( PHYSICS_SOUND_GLASS1); Server_PrecacheSound( PHYSICS_SOUND_GLASS2); Server_PrecacheModel(PHYSICS_MODEL_GLASS0); Server_PrecacheModel(PHYSICS_MODEL_GLASS1); Server_PrecacheModel(PHYSICS_MODEL_GLASS2); break; case BREAKABLE_WOOD: Server_PrecacheSound( PHYSICS_SOUND_WOOD0); Server_PrecacheSound( PHYSICS_SOUND_WOOD1); Server_PrecacheSound( PHYSICS_SOUND_WOOD2); Server_PrecacheModel(PHYSICS_MODEL_WOOD0); Server_PrecacheModel(PHYSICS_MODEL_WOOD1); Server_PrecacheModel(PHYSICS_MODEL_WOOD2); break; case BREAKABLE_ROCK: Server_PrecacheSound( PHYSICS_SOUND_ROCK0); Server_PrecacheSound( PHYSICS_SOUND_ROCK1); Server_PrecacheSound( PHYSICS_SOUND_ROCK2); Server_PrecacheModel(PHYSICS_MODEL_ROCK0); Server_PrecacheModel(PHYSICS_MODEL_ROCK1); Server_PrecacheModel(PHYSICS_MODEL_ROCK2); break; case BREAKABLE_METAL: Server_PrecacheSound( PHYSICS_SOUND_METAL0); Server_PrecacheSound( PHYSICS_SOUND_METAL1); Server_PrecacheSound( PHYSICS_SOUND_METAL2); Server_PrecacheModel(PHYSICS_MODEL_METAL0); Server_PrecacheModel(PHYSICS_MODEL_METAL1); Server_PrecacheModel(PHYSICS_MODEL_METAL2); break; default: g_engine->Con_Warning("area_breakable: Unknown style\n"); } // If we've been given a name, then set our use function. if (area->v.name) { area->v.use = Area_BreakableUse; } area->Physics.solid = SOLID_BSP; area->v.movetype = MOVETYPE_PUSH; area->v.takedamage = true; area->local.bleed = false; Entity_SetKilledFunction(area, Area_BreakableDie); Entity_SetModel(area, area->v.model); Entity_SetOrigin(area, area->v.origin); Entity_SetSizeVector(area, area->v.mins, area->v.maxs); area->v.oldorigin.x = (area->v.mins.x + area->v.maxs.x) * 0.5f; area->v.oldorigin.y = (area->v.mins.y + area->v.maxs.y) * 0.5f; area->v.oldorigin.z = (area->v.mins.z + area->v.maxs.z) * 0.5f; }
void Point_PropSpawn(ServerEntity_t *eEntity) { if(!eEntity->v.model) Entity_Remove(eEntity); eEntity->v.iHealth = 10; if(eEntity->v.iHealth) { switch(eEntity->local.style) { case BREAKABLE_GLASS: Server_PrecacheSound(PHYSICS_SOUND_GLASS0); Server_PrecacheSound(PHYSICS_SOUND_GLASS1); Server_PrecacheSound(PHYSICS_SOUND_GLASS2); Server_PrecacheModel(PHYSICS_MODEL_GLASS0); Server_PrecacheModel(PHYSICS_MODEL_GLASS1); Server_PrecacheModel(PHYSICS_MODEL_GLASS2); break; case BREAKABLE_WOOD: Server_PrecacheSound(PHYSICS_SOUND_WOOD0); Server_PrecacheSound(PHYSICS_SOUND_WOOD1); Server_PrecacheSound(PHYSICS_SOUND_WOOD2); Server_PrecacheModel(PHYSICS_MODEL_WOOD0); Server_PrecacheModel(PHYSICS_MODEL_WOOD1); Server_PrecacheModel(PHYSICS_MODEL_WOOD2); break; case BREAKABLE_ROCK: Server_PrecacheSound(PHYSICS_SOUND_ROCK0); Server_PrecacheSound(PHYSICS_SOUND_ROCK1); Server_PrecacheSound(PHYSICS_SOUND_ROCK2); Server_PrecacheModel("models/gibs/rock_gibs1.md2"); Server_PrecacheModel("models/gibs/rock_gibs2.md2"); Server_PrecacheModel("models/gibs/rock_gibs3.md2"); break; case BREAKABLE_METAL: Server_PrecacheSound(PHYSICS_SOUND_METAL0); Server_PrecacheSound(PHYSICS_SOUND_METAL1); Server_PrecacheSound(PHYSICS_SOUND_METAL2); Server_PrecacheModel(PHYSICS_MODEL_METAL0); Server_PrecacheModel(PHYSICS_MODEL_METAL1); Server_PrecacheModel(PHYSICS_MODEL_METAL2); break; default: Engine.Con_Warning("Prop with unknown style! (%i)\n",eEntity->local.style); } eEntity->v.bTakeDamage = true; eEntity->local.bBleed = false; Entity_SetKilledFunction(eEntity, Area_BreakableDie); } Server_PrecacheModel(eEntity->v.model); eEntity->v.movetype = MOVETYPE_BOUNCE; eEntity->v.TouchFunction = Point_PropTouch; eEntity->Physics.iSolid = SOLID_BBOX; eEntity->Physics.fGravity = cvServerGravity.value; eEntity->Physics.fMass = 0.5f; Entity_SetModel(eEntity,eEntity->v.model); Entity_SetOrigin(eEntity,eEntity->v.origin); Entity_SetSize(eEntity,-16.0f,-16.0f,-24.0f,16.0f,16.0f,32.0f); }