void Area_ButtonSpawn(ServerEntity_t *eArea) { float fDist; PLVector3D vMoveDir; if(!eArea->v.spawnflags) eArea->v.spawnflags = 0; if(eArea->local.cSoundStart) Server_PrecacheSound(eArea->local.cSoundStart); if (eArea->local.sound_stop) Server_PrecacheSound(eArea->local.sound_stop); if(eArea->local.cSoundMoving) Server_PrecacheSound(eArea->local.cSoundMoving); if(eArea->local.cSoundReturn) Server_PrecacheSound(eArea->local.cSoundReturn); eArea->v.movetype = MOVETYPE_PUSH; eArea->Physics.solid = SOLID_BSP; // [18/5/2013] Changed to use ! check instead since it's safer here ~hogsy if(eArea->local.lip == 0) { eArea->local.lip = 4; } eArea->local.value = 0; eArea->local.flags = STATE_BOTTOM; Entity_SetModel(eArea,eArea->v.model); Entity_SetOrigin(eArea,eArea->v.origin); Entity_SetSizeVector(eArea,eArea->v.mins,eArea->v.maxs); eArea->local.pos1 = eArea->v.origin; Area_SetMoveDirection(eArea->v.angles,eArea->v.movedir); vMoveDir.x = std::fabs(eArea->v.movedir.x); vMoveDir.y = std::fabs(eArea->v.movedir.y); vMoveDir.z = std::fabs(eArea->v.movedir.z); fDist = vMoveDir.x*eArea->v.size.x+ vMoveDir.y*eArea->v.size.y+ vMoveDir.z*eArea->v.size.z- eArea->local.lip; Math_VectorMake(eArea->local.pos1,fDist,eArea->v.movedir,&eArea->local.pos2); if(eArea->v.spawnflags != 32) { // Toggle eArea->v.TouchFunction = Area_ButtonTouch; } if (eArea->local.damage) { Entity_SetBlockedFunction(eArea, Area_ButtonBlocked); } eArea->v.use = Area_ButtonUse; }
void Area_PlatformSpawn(ServerEntity_t *area) { if(!area->v.spawnflags) { area->v.spawnflags = 0; } if(area->local.cSoundStart) { Server_PrecacheSound(area->local.cSoundStart); } if (area->local.sound_stop) { Server_PrecacheSound(area->local.sound_stop); } if(area->local.cSoundMoving) { Server_PrecacheSound(area->local.cSoundMoving); } if(area->local.cSoundReturn) { Server_PrecacheSound(area->local.cSoundReturn); } area->v.movetype = MOVETYPE_PUSH; area->Physics.solid = SOLID_BSP; if(area->local.count == 0) { area->local.count = 100; } if(area->local.wait == 0) { area->local.wait = 3; } if(area->local.damage == 0) { area->local.damage = 20; } area->local.value = 0; area->local.flags = STATE_BOTTOM; Entity_SetModel(area,area->v.model); Entity_SetOrigin(area,area->v.origin); Entity_SetSizeVector(area,area->v.mins,area->v.maxs); area->local.pos1 = area->v.origin; Area_SetMoveDirection(area->v.angles, area->v.movedir); float dist = (float)area->local.count; Math_VectorMake(area->local.pos1, dist, area->v.movedir, &area->local.pos2); if(area->v.spawnflags != 32) { // Toggle area->v.TouchFunction = Area_PlatformTouch; } if (area->local.damage) { Entity_SetBlockedFunction(area, Area_PlatformBlocked); } area->v.use = Area_PlatformUse; }
void Point_EffectSpawn(ServerEntity_t *eEntity) { if(eEntity->v.noise) Server_PrecacheSound(eEntity->v.noise); eEntity->v.use = Point_EffectUse; Entity_SetOrigin(eEntity,eEntity->v.origin); }
void Point_LightSpawn(ServerEntity_t *eLight) { if(eLight->v.noise) Server_PrecacheSound(eLight->v.noise); if(eLight->v.message) Engine.LightStyle(eLight->local.style,eLight->v.message); eLight->v.use = Point_LightUse; if(eLight->v.spawnflags & LIGHT_OFF) Engine.LightStyle(eLight->local.style,"a"); }
void Point_AmbientSpawn(ServerEntity_t *eEntity) { int iAttenuation; if(!eEntity->local.volume) eEntity->local.volume = 255; if(!eEntity->v.noise) { Engine.Con_Warning("No sound set for point_ambient! (%i %i %i)\n", (int)eEntity->v.origin[0], (int)eEntity->v.origin[1], (int)eEntity->v.origin[2]); Entity_Remove(eEntity); return; } switch(eEntity->local.style) { case AMBIENT_RADIUS_EVERYWHERE: iAttenuation = ATTN_NONE; break; case AMBIENT_RADIUS_SMALL: iAttenuation = ATTN_IDLE; break; case AMBIENT_RADIUS_MEDIUM: iAttenuation = ATTN_STATIC; break; case AMBIENT_RADIUS_LARGE: iAttenuation = ATTN_NORM; break; default: iAttenuation = ATTN_NORM; } Server_PrecacheSound(eEntity->v.noise); Engine.Server_AmbientSound(eEntity->v.origin,eEntity->v.noise,eEntity->local.volume,iAttenuation); }
void Point_SoundSpawn(ServerEntity_t *eEntity) { if(!eEntity->v.noise) { Engine.Con_Warning("No noise not set for %i (%i %i %i)!\n", eEntity->v.cClassname, (int)eEntity->v.origin[0], (int)eEntity->v.origin[1], (int)eEntity->v.origin[2]); Entity_Remove(eEntity); return; } else if(!eEntity->local.volume) eEntity->local.volume = 255; Server_PrecacheSound(eEntity->v.noise); Entity_SetOrigin(eEntity,eEntity->v.origin); eEntity->v.use = Point_SoundUse; }
void Point_LightstyleSpawn(ServerEntity_t *eEntity) { if(eEntity->v.noise) Server_PrecacheSound(eEntity->v.noise); if(!eEntity->v.message) eEntity->v.message = "a"; if(!eEntity->local.style) { Engine.Con_Warning("No style set for point_lightstyle! (%i %i %i)\n", (int)eEntity->v.origin[0], (int)eEntity->v.origin[1], (int)eEntity->v.origin[2]); Entity_Remove(eEntity); return; } eEntity->v.use = Point_LightstyleUse; Entity_SetOrigin(eEntity,eEntity->v.origin); }
/* style 0 Mikiko 1 Superfly */ void Bot_Spawn(ServerEntity_t *eBot) { int iSpawnType; ServerEntity_t *eSpawnPoint; // Don't spawn bots unless it's allowed by admin. if(!cvServerBots.value) return; plClearVector3D(&eBot->v.velocity); switch(eBot->local.style) { case BOT_DEFAULT: iSpawnType = INFO_PLAYER_DEATHMATCH; eBot->v.model = cvServerPlayerModel.string; strncpy(eBot->v.netname, BotNames[(rand() % plArrayElements(BotNames))], 64); eBot->Monster.type = MONSTER_PLAYER; break; #ifdef GAME_OPENKATANA case BOT_COMPANION: iSpawnType = INFO_PLAYER_SUPERFLY; Server_PrecacheModel("models/sprfly.md2"); // TODO: Placeholder! Server_PrecacheSound("player/superfly/superflydeath1.wav"); // TODO: Placeholder! Server_PrecacheSound("player/superfly/superflydeath2.wav"); // TODO: Placeholder! Server_PrecacheSound("player/superfly/superflydeath3.wav"); // TODO: Placeholder! Server_PrecacheSound("player/superfly/superflydeath4.wav"); // TODO: Placeholder! eBot->v.model = "models/sprfly.md2"; // TODO: Placeholder! eBot->v.netname = "Companion Bot"; // TODO: give a proper name?? eBot->Monster.type = MONSTER_SUPERFLY; break; #endif default: Engine.Con_Warning("Attempted to spawn unknown bot type! (%i) (%i %i %i)\n", eBot->local.style, (int)eBot->v.origin.x, (int)eBot->v.origin.y, (int)eBot->v.origin.z); Entity_Remove(eBot); return; } eBot->v.classname = "bot"; eBot->v.health = 100; eBot->local.maxhealth = cvServerMaxHealth.iValue; eBot->v.movetype = MOVETYPE_STEP; eBot->v.takedamage = true; Entity_SetPhysics(eBot, SOLID_SLIDEBOX, 1.4f, 4.0f); eBot->local.bleed = true; eBot->Monster.Frame = Bot_Frame; eBot->Monster.Pain = Bot_Pain; // Default bots are purely for MP, so they spawn at player spawns. if(eBot->local.style == BOT_DEFAULT) { // Must be set after teams are set up. eSpawnPoint = Player_GetSpawnEntity(eBot, iSpawnType); if(!eSpawnPoint) { Engine.Con_Warning("%s failed to find spawnpoint!\n",eBot->v.netname); Entity_Remove(eBot); return; } Entity_SetOrigin(eBot,eSpawnPoint->v.origin); SetAngle(eBot,eSpawnPoint->v.angles); } Entity_SetKilledFunction(eBot, Bot_Die); eBot->Monster.Pain = Bot_Pain; eBot->Monster.Frame = Bot_Frame; Entity_SetModel(eBot,eBot->v.model); Entity_SetSize(eBot,-16.0f,-16.0f,-24.0f,16.0f,16.0f,32.0f); AI_SetState(eBot, AI_STATE_AWAKE); AI_SetThink(eBot, AI_THINK_IDLE); // Make sure we're not in the air. Entity_DropToFloor(eBot); }
void WEAPON_TRIDENT_Precache (void) { Server_PrecacheModel("models/trident.md2"); Server_PrecacheSound("weapons/trident/tridentdraw.wav"); }
void Server_Spawn(ServerEntity_t *seEntity) { Server.eWorld = seEntity; // Set defaults. Server.dWaypointSpawnDelay = ((double)cvServerWaypointDelay.value); Server.round_started = Server.players_spawned = false; Server.iMonsters = 0; Server.skycam = false; // Set these to their defaults. bIsDeathmatch = false; bIsCooperative = false; bIsMultiplayer = false; if (cvServerGameMode.iValue != MODE_SINGLEPLAYER) { bIsMultiplayer = true; if (cvServerGameMode.iValue == MODE_DEATHMATCH) bIsDeathmatch = true; else if (cvServerGameMode.iValue == MODE_COOPERATIVE) bIsCooperative = true; } else // Round has always immediately started in single player. Server.round_started = true; // Initialize waypoints. Waypoint_Initialize(); Item_Precache(); Weapon_Precache(); Server_PrecacheSound("misc/deny.wav"); Server_PrecacheSound(BASE_SOUND_TALK0); Server_PrecacheSound(BASE_SOUND_TALK1); Server_PrecacheSound(BASE_SOUND_TALK2); Server_PrecacheSound("misc/gib1.wav"); #ifndef GAME_ADAMAS // Physics Server_PrecacheSound(PHYSICS_SOUND_SPLASH); Server_PrecacheSound(PHYSICS_SOUND_BODY); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET0); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET1); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET2); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET3); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET4); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET5); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET6); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET7); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET8); Server_PrecacheSound(PHYSICS_SOUND_RICOCHET9); Server_PrecacheSound("fx/explosion1.wav"); Server_PrecacheSound("fx/explosion2.wav"); Server_PrecacheSound("fx/explosion3.wav"); Server_PrecacheSound("fx/explosion4.wav"); Server_PrecacheSound("fx/explosion5.wav"); Server_PrecacheSound("fx/explosion6.wav"); Server_PrecacheSound(PHYSICS_SOUND_CONCRETESTEP0); Server_PrecacheSound(PHYSICS_SOUND_CONCRETESTEP1); Server_PrecacheSound(PHYSICS_SOUND_CONCRETESTEP2); Server_PrecacheSound(PHYSICS_SOUND_CONCRETESTEP3); Server_PrecacheModel(PHYSICS_MODEL_GIB0); Server_PrecacheModel(PHYSICS_MODEL_GIB1); Server_PrecacheModel(PHYSICS_MODEL_GIB2); Server_PrecacheModel(PHYSICS_MODEL_GIB3); // Effects Server_PrecacheSound(SOUND_EXPLODE_UNDERWATER0); Server_PrecacheSound(SOUND_EXPLODE0); Server_PrecacheSound(SOUND_EXPLODE1); Server_PrecacheSound(SOUND_EXPLODE2); #endif // Player Server_PrecacheModel(cvServerPlayerModel.string); #ifdef GAME_OPENKATANA // Player Server_PrecacheSound(PLAYER_SOUND_JUMP0); Server_PrecacheSound(PLAYER_SOUND_JUMP1); Server_PrecacheSound(PLAYER_SOUND_JUMP2); Server_PrecacheSound(PLAYER_SOUND_JUMP3); Server_PrecacheSound(PLAYER_SOUND_PAIN0); Server_PrecacheSound(PLAYER_SOUND_PAIN1); Server_PrecacheSound(PLAYER_SOUND_PAIN2); Server_PrecacheSound(PLAYER_SOUND_PAIN3); Server_PrecacheSound(PLAYER_SOUND_PAIN4); Server_PrecacheSound(PLAYER_SOUND_PAIN5); Server_PrecacheSound(PLAYER_SOUND_PAIN6); Server_PrecacheSound(PLAYER_SOUND_PAIN7); Server_PrecacheSound(PLAYER_SOUND_PAIN8); Server_PrecacheSound(PLAYER_SOUND_PAIN9); Server_PrecacheSound(PLAYER_SOUND_PAIN10); Server_PrecacheSound(PLAYER_SOUND_PAIN11); Server_PrecacheSound(PLAYER_SOUND_DEATH0); Server_PrecacheSound(PLAYER_SOUND_DEATH1); Server_PrecacheSound(PLAYER_SOUND_DEATH2); Server_PrecacheModel("models/blip.md2"); #endif #ifdef DEBUG_WAYPOINT Server_PrecacheModel(WAYPOINT_MODEL_BASE); Server_PrecacheModel(WAYPOINT_MODEL_CLIMB); Server_PrecacheModel(WAYPOINT_MODEL_ITEM); Server_PrecacheModel(WAYPOINT_MODEL_JUMP); Server_PrecacheModel(WAYPOINT_MODEL_SPAWN); Server_PrecacheModel(WAYPOINT_MODEL_SWIM); Server_PrecacheModel(WAYPOINT_MODEL_WEAPON); #endif // Precache any multiplayer content. if(bIsMultiplayer) { #ifdef GAME_OPENKATANA Server_PrecacheSound("items/respawn.wav"); #endif } Server_WorldLightStyle(0, "m"); Server_WorldLightStyle(1, "mmnmmommommnonmmonqnmmo"); Server_WorldLightStyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); Server_WorldLightStyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); Server_WorldLightStyle(4, "mamamamamama"); Server_WorldLightStyle(5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); Server_WorldLightStyle(6, "nmonqnmomnmomomno"); Server_WorldLightStyle(7, "mmmaaaabcdefgmmmmaaaammmaamm"); Server_WorldLightStyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); Server_WorldLightStyle(9, "aaaaaaaazzzzzzzz"); Server_WorldLightStyle(10, "mmamammmmammamamaaamammma"); Server_WorldLightStyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); Server_WorldLightStyle(32, "a"); }
void Area_DoorSpawn(ServerEntity_t *door) { PLVector3D movedir; if (door->local.cSoundStart) { Server_PrecacheSound(door->local.cSoundStart); } if (door->local.sound_stop) { Server_PrecacheSound(door->local.sound_stop); } if (door->local.cSoundMoving) { Server_PrecacheSound(door->local.cSoundMoving); } if (door->local.cSoundReturn) { Server_PrecacheSound(door->local.cSoundReturn); } door->v.movetype = MOVETYPE_PUSH; Entity_SetPhysics(door, SOLID_BSP, 1.0f, 1.0f); Entity_SetModel(door, door->v.model); Entity_SetOrigin(door, door->v.origin); Entity_SetSizeVector(door, door->v.mins, door->v.maxs); if (door->local.lip == 0) { door->local.lip = 4; } door->local.pos1 = door->v.origin; Area_SetMoveDirection(door->v.angles, door->v.movedir); movedir.x = std::fabs(door->v.movedir.x); movedir.y = std::fabs(door->v.movedir.y); movedir.z = std::fabs(door->v.movedir.z); float movedist = movedir.x * door->v.size.x + movedir.y * door->v.size.y + movedir.z * door->v.size.z - door->local.lip; #if 0 Math_VectorMake(door->local.pos1, movedist, door->v.movedir, door->local.pos2); #else door->local.pos2 = door->local.pos1 + (door->v.movedir * movedist); #endif door->local.flags = STATE_BOTTOM; // Set the spawn flags up. if (door->v.spawnflags & DOOR_FLAG_TRIGGERUSE) { door->v.use = Area_DoorUse; } if (door->v.spawnflags & DOOR_FLAG_TRIGGERTOUCH) { door->v.TouchFunction = Area_DoorTouch; } if (door->v.spawnflags & DOOR_FLAG_TRIGGERAUTO) { } if (door->v.spawnflags & DOOR_FLAG_TRIGGERDAMAGE) { // Give it at least one HP. if (!door->v.health) { door->v.health = 1; } door->v.takedamage = true; // TODO: add handler for this! // Entity_SetDamagedFunction(door, Area_DoorTouch); } if (door->local.damage) { Entity_SetBlockedFunction(door, Area_DoorBlocked); } }
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); }