From bc74e8dbc2b91ebf2175acac04f0031f90d3be97 Mon Sep 17 00:00:00 2001 From: Knightmare66 Date: Fri, 4 Sep 2020 03:39:59 -0400 Subject: [PATCH] Implemented entity class IDs in missionpack DLL. --- missionpack/dm_tag.c | 2 + missionpack/g_camera.c | 32 +- missionpack/g_chase.c | 7 +- missionpack/g_crane.c | 346 +++++++++++---------- missionpack/g_func.c | 106 ++++--- missionpack/g_items.c | 54 ++-- missionpack/g_local.h | 2 +- missionpack/g_lock.c | 49 +-- missionpack/g_mappack.c | 8 +- missionpack/g_misc.c | 142 +++++++-- missionpack/g_misc_q1.c | 26 +- missionpack/g_newai.c | 2 + missionpack/g_newdm.c | 1 + missionpack/g_newfnc.c | 43 +-- missionpack/g_newtarg.c | 606 ++++++++++++++++++++----------------- missionpack/g_newtrig.c | 27 +- missionpack/g_newweap.c | 27 +- missionpack/g_sound.c | 3 + missionpack/g_spawn.c | 2 +- missionpack/g_sphere.c | 133 ++++---- missionpack/g_target.c | 31 +- missionpack/g_tracktrain.c | 8 +- missionpack/g_trigger.c | 121 ++++++-- missionpack/g_turret.c | 6 +- missionpack/g_utils.c | 17 +- missionpack/g_vehicle.c | 10 +- missionpack/g_weapon.c | 20 +- missionpack/g_weapon_q1.c | 12 +- missionpack/laz_misc.h | 81 +++-- missionpack/m_berserk.c | 1 + missionpack/m_boss2.c | 2 + missionpack/m_boss3.c | 3 + missionpack/m_boss31.c | 12 +- missionpack/m_boss32.c | 18 +- missionpack/m_boss5.c | 2 + missionpack/m_brain.c | 16 +- missionpack/m_brainbeta.c | 16 +- missionpack/m_carrier.c | 1 + missionpack/m_chick.c | 2 + missionpack/m_dog.c | 2 + missionpack/m_flipper.c | 1 + missionpack/m_float.c | 1 + missionpack/m_flyer.c | 22 +- missionpack/m_gekk.c | 26 +- missionpack/m_gladb.c | 21 +- missionpack/m_gladiator.c | 22 +- missionpack/m_gunner.c | 1 + missionpack/m_hover.c | 6 +- missionpack/m_infantry.c | 1 + missionpack/m_medic.c | 6 +- missionpack/m_mutant.c | 1 + missionpack/m_parasite.c | 1 + missionpack/m_q1dog.c | 2 + missionpack/m_q1enforcer.c | 2 + missionpack/m_q1fiend.c | 2 + missionpack/m_q1grunt.c | 2 + missionpack/m_q1hknight.c | 2 + missionpack/m_q1knight.c | 2 + missionpack/m_q1ogre.c | 2 + missionpack/m_q1rotfish.c | 2 + missionpack/m_q1scrag.c | 2 + missionpack/m_q1shalrath.c | 2 + missionpack/m_q1shambler.c | 2 + missionpack/m_q1tarbaby.c | 2 + missionpack/m_q1zombie.c | 2 + missionpack/m_soldier.c | 47 ++- missionpack/m_stalker.c | 1 + missionpack/m_supertank.c | 1 + missionpack/m_tank.c | 1 + missionpack/m_turret.c | 2 + missionpack/m_widow.c | 1 + missionpack/m_widow2.c | 5 +- missionpack/p_client.c | 29 +- missionpack/p_weapon.c | 2 + missionpack/z_acannon.c | 1 + missionpack/z_boss.c | 1 + missionpack/z_handler.c | 1 + missionpack/z_hound.c | 2 + missionpack/z_item.c | 21 ++ missionpack/z_sentien.c | 2 + missionpack/z_trigger.c | 3 +- missionpack/z_weapon.c | 12 +- 82 files changed, 1433 insertions(+), 833 deletions(-) diff --git a/missionpack/dm_tag.c b/missionpack/dm_tag.c index baf2fbc..034b7fe 100644 --- a/missionpack/dm_tag.c +++ b/missionpack/dm_tag.c @@ -211,6 +211,7 @@ void Tag_DropToken (edict_t *ent, gitem_t *item) // tag_token->classname = item->classname; tag_token->classname = "dm_tag_token"; // Knightmare- classname of the tag token item is NULL! + tag_token->class_id = ENTITY_TAGTOKEN; tag_token->item = item; tag_token->spawnflags = DROPPED_ITEM; tag_token->s.effects = EF_ROTATE | EF_TAGTRAIL; @@ -324,6 +325,7 @@ void SP_dm_tag_token (edict_t *self) tag_count = 0; self->classname = "dm_tag_token"; + self->class_id = ENTITY_TAGTOKEN; self->model = "models/items/tagtoken/tris.md2"; self->count = 1; SpawnItem (self, FindItem ("Tag Token")); diff --git a/missionpack/g_camera.c b/missionpack/g_camera.c index 49d6609..66b4db2 100644 --- a/missionpack/g_camera.c +++ b/missionpack/g_camera.c @@ -122,6 +122,7 @@ void camera_on (edict_t *ent) faker->viewheight = ent->viewheight; faker->inuse = true; faker->classname = "camplayer"; + faker->class_id = ENTITY_CAMPLAYER; faker->mass = ent->mass; faker->solid = SOLID_BBOX; faker->deadflag = DEAD_NO; @@ -196,12 +197,14 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor) next = G_Find(NULL,FOFS(targetname),monitor->target); if (!next) return NULL; - if (!next->count) { + if (!next->count) + { if (camera) { next = camera; next++; - } else + } + else next = g_edicts; for ( ; next < &g_edicts[globals.num_edicts] ; next++) @@ -238,7 +241,9 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor) if (!Q_stricmp (next->targetname, monitor->target)) goto found_one; } - } else { + } + else + { int which, start; if (camera) { @@ -249,9 +254,12 @@ edict_t *G_FindNextCamera (edict_t *camera, edict_t *monitor) which = 1; start = which; next = g_edicts+1; - while (1) { - if (next->targetname) { - if (!Q_stricmp(next->targetname,monitor->target)) { + while (1) + { + if (next->targetname) + { + if (!Q_stricmp(next->targetname,monitor->target)) + { if (next->count == which) { if (!next->inuse || (next->deadflag == DEAD_DEAD) || (!Q_stricmp (next->classname,"turret_breach") && (next->spawnflags & 16)) ) @@ -337,10 +345,14 @@ edict_t *G_FindPrevCamera (edict_t *camera, edict_t *monitor) which = monitor->count; start = which; prev = g_edicts+1; - while (1) { - if (prev->targetname) { - if (!Q_stricmp(prev->targetname,monitor->target)) { - if (prev->count == which) { + while (1) + { + if (prev->targetname) + { + if (!Q_stricmp(prev->targetname,monitor->target)) + { + if (prev->count == which) + { if (!prev->inuse || (prev->deadflag == DEAD_DEAD) || (!Q_stricmp (prev->classname,"turret_breach") && (prev->spawnflags & 16))) { diff --git a/missionpack/g_chase.c b/missionpack/g_chase.c index 72391da..bdb614e 100644 --- a/missionpack/g_chase.c +++ b/missionpack/g_chase.c @@ -12,7 +12,8 @@ void UpdateChaseCam(edict_t *ent) // is our chase target gone? if (!ent->client->chase_target->inuse - || ent->client->chase_target->client->resp.spectator) { + || ent->client->chase_target->client->resp.spectator) + { edict_t *old = ent->client->chase_target; ChaseNext(ent); if (ent->client->chase_target == old) { @@ -79,7 +80,8 @@ void UpdateChaseCam(edict_t *ent) ent->client->ps.viewangles[ROLL] = 40; ent->client->ps.viewangles[PITCH] = -15; ent->client->ps.viewangles[YAW] = targ->client->killer_yaw; - } else { + } + else { VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); VectorCopy(targ->client->v_angle, ent->client->v_angle); } @@ -153,4 +155,3 @@ void GetChaseTarget(edict_t *ent) } gi.centerprintf(ent, "No other players to chase."); } - diff --git a/missionpack/g_crane.c b/missionpack/g_crane.c index 9d4d3b4..03d3f41 100644 --- a/missionpack/g_crane.c +++ b/missionpack/g_crane.c @@ -26,12 +26,12 @@ void moving_speaker_think (edict_t *self) owner = self->owner; - if(!owner) //paranoia + if (!owner) //paranoia { G_FreeEdict(self); return; } - if(!owner->inuse) + if (!owner->inuse) { G_FreeEdict(self); return; @@ -48,25 +48,25 @@ void moving_speaker_think (edict_t *self) // If parent is spinning, add appropriate velocities VectorSubtract(self->s.origin, owner->s.origin, offset); - if(owner->avelocity[PITCH] != 0) + if (owner->avelocity[PITCH] != 0) { self->velocity[2] -= offset[0] * owner->avelocity[PITCH] * M_PI / 180; self->velocity[0] += offset[2] * owner->avelocity[PITCH] * M_PI / 180; } - if(owner->avelocity[YAW] != 0) + if (owner->avelocity[YAW] != 0) { self->velocity[0] -= offset[1] * owner->avelocity[YAW] * M_PI / 180.; self->velocity[1] += offset[0] * owner->avelocity[YAW] * M_PI / 180.; } - if(owner->avelocity[ROLL] != 0) + if (owner->avelocity[ROLL] != 0) { self->velocity[1] -= offset[2] * owner->avelocity[ROLL] * M_PI / 180; self->velocity[2] += offset[1] * owner->avelocity[ROLL] * M_PI / 180; } */ - if(self->spawnflags & 15) + if (self->spawnflags & 15) { - if((self->spawnflags & 8) && ( + if ((self->spawnflags & 8) && ( (!self->owner->groundentity) || // not on the ground (!self->owner->activator) || // not "activated" by anything (!self->owner->activator->client) ) // not activated by client @@ -78,14 +78,14 @@ void moving_speaker_think (edict_t *self) { moved = false; VectorSubtract(self->s.origin,owner->s.origin,offset); - if((self->spawnflags & 1) && (fabs(offset[0] - self->offset[0]) > 0.125) ) + if ((self->spawnflags & 1) && (fabs(offset[0] - self->offset[0]) > 0.125) ) moved = true; - if((self->spawnflags & 2) && (fabs(offset[1] - self->offset[1]) > 0.125) ) + if ((self->spawnflags & 2) && (fabs(offset[1] - self->offset[1]) > 0.125) ) moved = true; - if((self->spawnflags & 4) && (fabs(offset[2] - self->offset[2]) > 0.125) ) + if ((self->spawnflags & 4) && (fabs(offset[2] - self->offset[2]) > 0.125) ) moved = true; } - if(moved) { + if (moved) { self->s.sound = self->owner->noise_index; #ifdef LOOP_SOUND_ATTENUATION self->s.attenuation = self->attenuation; @@ -178,7 +178,7 @@ void Cargo_Float_Up (edict_t *cargo) { cargo->velocity[2] += sv_gravity->value * FRAMETIME; cargo->velocity[0] = cargo->velocity[1] = 0; - if(cargo->absmax[2] + cargo->velocity[2]*FRAMETIME >= + if (cargo->absmax[2] + cargo->velocity[2]*FRAMETIME >= cargo->crane_hook->absmin[2]-CARGO_BUFFER) { cargo->attracted = false; @@ -188,14 +188,14 @@ void Cargo_Float_Up (edict_t *cargo) gi.linkentity(cargo); } -void SetCableLength(edict_t *cable) +void SetCableLength (edict_t *cable) { int frame; float length; length = cable->s.origin[2] - cable->crane_hook->absmax[2]; frame = (int)(length/CABLE_SEGMENT); - if((frame+1)*CABLE_SEGMENT < length) frame++; + if ((frame+1)*CABLE_SEGMENT < length) frame++; frame = max(0,min(frame,19)); cable->s.frame = frame; } @@ -215,21 +215,21 @@ void SetSpotlightLength(edict_t *hook) hook->crane_light->s.origin[2] = tr.endpos[2] + 1; } -void Cable_Think(edict_t *cable) +void Cable_Think (edict_t *cable) { SetCableLength(cable); cable->nextthink = level.time + FRAMETIME; gi.linkentity(cable); } -void crane_light_off(edict_t *light) +void crane_light_off (edict_t *light) { light->svflags |= SVF_NOCLIENT; } void Crane_Move_Done (edict_t *ent) { - if(!Q_stricmp(ent->classname,"crane_hook")) + if (!Q_stricmp(ent->classname,"crane_hook")) { edict_t *cable; edict_t *light; @@ -237,7 +237,7 @@ void Crane_Move_Done (edict_t *ent) ent->s.origin[0] = ent->crane_hoist->s.origin[0] + ent->offset[0]; ent->s.origin[1] = ent->crane_hoist->s.origin[1] + ent->offset[1]; // ... and force cargo to correct elevation ... - if(ent->crane_cargo) + if (ent->crane_cargo) { ent->crane_cargo->s.origin[2] += ent->absmin[2] - CARGO_BUFFER - ent->crane_cargo->absmax[2]; @@ -251,7 +251,7 @@ void Crane_Move_Done (edict_t *ent) SetCableLength(cable); gi.linkentity(cable); light = ent->crane_light; - if(light) + if (light) { VectorClear(light->velocity); light->think = crane_light_off; @@ -260,8 +260,8 @@ void Crane_Move_Done (edict_t *ent) } } // Lazarus: ACK! If crate is being carried, it's NOT a MOVETYPE_PUSHABLE!!!! -// if(ent->movetype == MOVETYPE_PUSHABLE) - if(!Q_stricmp(ent->classname,"func_pushable")) +// if (ent->movetype == MOVETYPE_PUSHABLE) + if (!Q_stricmp(ent->classname,"func_pushable")) { edict_t *e; @@ -283,17 +283,17 @@ void Crane_Move_Done (edict_t *ent) gi.linkentity(ent); } -void Crane_Stop(edict_t *control) +void Crane_Stop (edict_t *control) { - if(control->crane_beam->crane_onboard_control) + if (control->crane_beam->crane_onboard_control) Crane_Move_Done(control->crane_beam->crane_onboard_control); Crane_Move_Done(control->crane_beam); Crane_Move_Done(control->crane_hoist); Crane_Move_Done(control->crane_hook); - if(control->crane_hook->crane_cargo) Crane_Move_Done(control->crane_hook->crane_cargo); + if (control->crane_hook->crane_cargo) Crane_Move_Done(control->crane_hook->crane_cargo); } -qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) +qboolean Crane_Hook_Bonk (edict_t *hook, int axis, int dir, vec3_t bonk) { float fraction, cargo_fraction; int i1,i2; @@ -327,7 +327,7 @@ qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) cargo = hook->crane_cargo; VectorAdd(hook->s.origin,hook->origin_offset,origin); VectorCopy(origin,start); - if(dir > 0) + if (dir > 0) start[axis] = origin[axis] + hook->size[axis]/2; else start[axis] = origin[axis] - hook->size[axis]/2; @@ -340,7 +340,7 @@ qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) maxs[i2] = hook->size[i2]/2; VectorMA(start, WORLD_SIZE, forward, end); // was 8192 tr = gi.trace(start,mins,maxs,end,cargo,MASK_PLAYERSOLID); - if(tr.fraction < fraction && tr.ent != hook->crane_beam && + if (tr.fraction < fraction && tr.ent != hook->crane_beam && tr.ent != hook->crane_hoist && tr.ent != cargo ) { VectorCopy(tr.endpos,bonk); @@ -350,11 +350,11 @@ qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) VectorCopy(end,bonk); } - if(cargo) + if (cargo) { VectorAdd(cargo->s.origin,cargo->origin_offset,cargo_origin); VectorCopy(cargo_origin,start); - if(dir > 0) + if (dir > 0) start[axis] = cargo_origin[axis] + cargo->size[axis]/2; else start[axis] = cargo_origin[axis] - cargo->size[axis]/2; @@ -367,7 +367,7 @@ qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) maxs[i2] = cargo->size[i2]/2-1; VectorMA(start, WORLD_SIZE, forward, end); // was 8192 tr=gi.trace(start, mins, maxs, end, cargo, MASK_PLAYERSOLID ); - if(tr.fraction < cargo_fraction && tr.ent != hook->crane_beam && + if (tr.fraction < cargo_fraction && tr.ent != hook->crane_beam && tr.ent != hook->crane_hoist && tr.ent != hook ) { VectorCopy(tr.endpos,cargo_bonk); @@ -376,10 +376,10 @@ qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) } else { VectorCopy(end,cargo_bonk); } - if(cargo_fraction < 1) + if (cargo_fraction < 1) { fraction = cargo_fraction; - if(dir > 0) + if (dir > 0) { cargo_bonk[axis] += hook->absmax[axis] - cargo->absmax[axis]; bonk[axis] = min(bonk[axis],cargo_bonk[axis]); @@ -392,7 +392,7 @@ qboolean Crane_Hook_Bonk(edict_t *hook, int axis, int dir, vec3_t bonk) } } - if(fraction < 1) + if (fraction < 1) return true; else return false; @@ -442,15 +442,15 @@ void Crane_Move_Final (edict_t *ent) { float bonk_distance; - if(ent->crane_control->activator->client->use) + if (ent->crane_control->activator->client->use) { // Use key is still pressed bonk_distance = ent->crane_control->crane_increment * (ent->crane_bonk - ent->absmin[ent->crane_dir]); - if(ent->moveinfo.remaining_distance > 0) + if (ent->moveinfo.remaining_distance > 0) bonk_distance -= ent->moveinfo.remaining_distance; bonk_distance = min(bonk_distance,STEPSIZE); - if(bonk_distance > 0) + if (bonk_distance > 0) { ent->moveinfo.remaining_distance += bonk_distance; Crane_Move_Begin(ent); @@ -465,12 +465,12 @@ void Crane_Move_Final (edict_t *ent) } VectorScale (ent->moveinfo.dir, ent->moveinfo.remaining_distance / FRAMETIME, ent->velocity); - if(!Q_stricmp(ent->classname,"crane_hook")) + if (!Q_stricmp(ent->classname, "crane_hook")) { VectorCopy(ent->velocity,ent->crane_cable->velocity); ent->crane_cable->velocity[2] = 0; gi.linkentity(ent); - if(ent->crane_light != NULL) + if (ent->crane_light != NULL) { VectorCopy(ent->velocity,ent->crane_light->velocity); ent->crane_light->velocity[2] = 0; @@ -494,9 +494,9 @@ void Crane_Move_Begin (edict_t *ent) VectorScale (ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity); frames = floor((ent->moveinfo.remaining_distance / ent->moveinfo.speed) / FRAMETIME); ent->moveinfo.remaining_distance -= frames * ent->moveinfo.speed * FRAMETIME; - if(!Q_stricmp(ent->classname,"crane_hook")) + if (!Q_stricmp(ent->classname, "crane_hook")) { - if((ent->crane_light) && (ent->crane_cargo==NULL)) + if ((ent->crane_light) && (ent->crane_cargo==NULL)) { SetSpotlightLength(ent); ent->crane_light->svflags &= ~SVF_NOCLIENT; @@ -504,7 +504,7 @@ void Crane_Move_Begin (edict_t *ent) VectorCopy(ent->velocity,ent->crane_cable->velocity); ent->crane_cable->velocity[2] = 0; gi.linkentity(ent->crane_cable); - if(ent->crane_light != NULL) + if (ent->crane_light != NULL) { VectorCopy(ent->velocity,ent->crane_light->velocity); ent->crane_light->velocity[2] = 0; @@ -543,7 +543,7 @@ void G_FindCraneParts() control = e; beam = G_Find(NULL,FOFS(targetname),control->target); - if(!beam) + if (!beam) { gi.dprintf("Crane_control with no target\n"); G_FreeEdict(control); @@ -551,7 +551,7 @@ void G_FindCraneParts() } // get path_corner locations to determine movement direction p1 = G_Find(NULL,FOFS(targetname),beam->pathtarget); - if(!p1->target) + if (!p1->target) { gi.dprintf("Only 1 path_corner in pathtarget sequence for crane_beam\n" "(2 are required)\n"); @@ -562,11 +562,11 @@ void G_FindCraneParts() } p2 = G_Find(NULL,FOFS(targetname),p1->target); VectorSubtract(p1->s.origin,p2->s.origin,dist); - if(fabs(dist[0]) > fabs(dist[1])) + if (fabs(dist[0]) > fabs(dist[1])) { VectorSet(beam->movedir, 1.0,0.0,0.0); direction = 0; - if(p1->s.origin[0] < p2->s.origin[0]) + if (p1->s.origin[0] < p2->s.origin[0]) { VectorCopy(p1->s.origin,beam->pos1); VectorCopy(p2->s.origin,beam->pos2); @@ -581,7 +581,7 @@ void G_FindCraneParts() { VectorSet(beam->movedir, 0.0,1.0,0.0); direction = 1; - if(p1->s.origin[1] < p2->s.origin[1]) + if (p1->s.origin[1] < p2->s.origin[1]) { VectorCopy(p1->s.origin,beam->pos1); VectorCopy(p2->s.origin,beam->pos2); @@ -593,7 +593,7 @@ void G_FindCraneParts() } } hoist = G_Find(NULL,FOFS(targetname),beam->target); - if(!hoist) + if (!hoist) { gi.dprintf("Crane_beam with no target\n"); G_FreeEdict(control); @@ -602,7 +602,7 @@ void G_FindCraneParts() } // get path_corner locations to determine movement direction p1 = G_Find(NULL,FOFS(targetname),hoist->pathtarget); - if(!p1->target) + if (!p1->target) { gi.dprintf("Only 1 path_corner in pathtarget sequence for crane_hoist\n" "(2 are required)\n"); @@ -614,10 +614,10 @@ void G_FindCraneParts() } p2 = G_Find(NULL,FOFS(targetname),p1->target); VectorSubtract(p1->s.origin,p2->s.origin,dist); - if(fabs(dist[0]) > fabs(dist[1])) + if (fabs(dist[0]) > fabs(dist[1])) { VectorSet(hoist->movedir, 1.0,0.0,0.0); - if(p1->s.origin[0] < p2->s.origin[0]) + if (p1->s.origin[0] < p2->s.origin[0]) { VectorCopy(p1->s.origin,hoist->pos1); VectorCopy(p2->s.origin,hoist->pos2); @@ -631,7 +631,7 @@ void G_FindCraneParts() else { VectorSet(hoist->movedir, 0.0,1.0,0.0); - if(p1->s.origin[1] < p2->s.origin[1]) + if (p1->s.origin[1] < p2->s.origin[1]) { VectorCopy(p1->s.origin,hoist->pos1); VectorCopy(p2->s.origin,hoist->pos2); @@ -644,23 +644,23 @@ void G_FindCraneParts() } // correct spawnflags for beam and hoist speakers - if(beam->speaker) + if (beam->speaker) { - if(direction) + if (direction) beam->speaker->spawnflags = 2; else beam->speaker->spawnflags = 1; } - if(hoist->speaker) + if (hoist->speaker) { - if(direction) + if (direction) hoist->speaker->spawnflags = 1; else hoist->speaker->spawnflags = 2; } hook = G_Find(NULL,FOFS(targetname),hoist->target); - if(!hook) + if (!hook) { gi.dprintf("Crane hoist with no target\n"); G_FreeEdict(control); @@ -673,7 +673,7 @@ void G_FindCraneParts() // be moving unless control is on, then with control off // we set hook speaker spawnflag to require hook to be // moving to play - if(hook->speaker) + if (hook->speaker) hook->speaker->spawnflags = 1 - (control->spawnflags & 1); // Get offset from hook origin to hoist origin, so we can @@ -682,7 +682,7 @@ void G_FindCraneParts() // get path_corner locations to determine movement direction p1 = G_Find(NULL,FOFS(targetname),hook->pathtarget); - if(!p1->target) + if (!p1->target) { gi.dprintf("Only 1 path_corner in pathtarget sequence for crane_hook\n" "(2 are required)\n"); @@ -695,7 +695,7 @@ void G_FindCraneParts() } p2 = G_Find(NULL,FOFS(targetname),p1->target); VectorSet(hook->movedir,0.0,0.0,1.0); - if(p1->s.origin[2] < p2->s.origin[2]) + if (p1->s.origin[2] < p2->s.origin[2]) { VectorCopy(p1->s.origin,hook->pos1); VectorCopy(p2->s.origin,hook->pos2); @@ -710,11 +710,11 @@ void G_FindCraneParts() control->crane_beam = beam; control->crane_hoist = hoist; control->crane_hook = hook; - if(!beam->crane_control) beam->crane_control = control; - if(control->team) + if (!beam->crane_control) beam->crane_control = control; + if (control->team) { beam->crane_control = control; - if(beam->flags & FL_TEAMSLAVE) + if (beam->flags & FL_TEAMSLAVE) beam->crane_onboard_control = beam->teammaster; else beam->crane_onboard_control = beam->teamchain; @@ -729,14 +729,14 @@ void G_FindCraneParts() hook->crane_control = beam->crane_control; hook->crane_beam = beam; hook->crane_hoist = hoist; - if(control->spawnflags & 4) + if (control->spawnflags & 4) { beam->dmg = 0; hoist->dmg = 0; hook->dmg = 0; } - if(hook->crane_cable == NULL) + if (hook->crane_cable == NULL) { int frame; float length; @@ -757,7 +757,7 @@ void G_FindCraneParts() length = hoist->absmax[2]-1 - hook->absmax[2]; frame = (int)(length/CABLE_SEGMENT); - if((frame+1)*CABLE_SEGMENT < length) frame++; + if ((frame+1)*CABLE_SEGMENT < length) frame++; frame = max(0,min(frame,19)); cable->s.frame = frame; cable->solid = SOLID_NOT; @@ -776,7 +776,7 @@ void G_FindCraneParts() } control->crane_cable = hook->crane_cable; - if((hook->spawnflags & 1) && (hook->crane_light == NULL)) + if ((hook->spawnflags & 1) && (hook->crane_light == NULL)) { light = G_Spawn(); light->s.origin[0] = (hook->absmin[0] + hook->absmax[0])/2; @@ -800,18 +800,18 @@ void G_FindCraneParts() // If control is NOT onboard, move beam speaker (if any) to end of // beam closest to control - if(!beam->crane_onboard_control && beam->speaker) + if (!beam->crane_onboard_control && beam->speaker) { - if(beam->movedir[0] > 0) + if (beam->movedir[0] > 0) { - if(control->absmin[1]+control->absmax[1] < beam->absmin[1]+beam->absmax[1]) + if (control->absmin[1]+control->absmax[1] < beam->absmin[1]+beam->absmax[1]) beam->speaker->s.origin[1] = beam->absmin[1]; else beam->speaker->s.origin[1] = beam->absmax[1]; } else { - if(control->absmin[0]+control->absmax[0] < beam->absmin[0]+beam->absmax[0]) + if (control->absmin[0]+control->absmax[0] < beam->absmin[0]+beam->absmax[0]) beam->speaker->s.origin[0] = beam->absmin[0]; else beam->speaker->s.origin[0] = beam->absmax[0]; @@ -828,11 +828,11 @@ void Crane_AdjustSpeed(edict_t *ent) // Adjust speed so that travel time is an integral multiple // of FRAMETIME - if(ent->moveinfo.remaining_distance > 0) + if (ent->moveinfo.remaining_distance > 0) { ent->moveinfo.speed = ent->speed; frames = floor((ent->moveinfo.remaining_distance / ent->moveinfo.speed) / FRAMETIME); - if(frames < 1) frames = 1; + if (frames < 1) frames = 1; ent->moveinfo.speed = ent->moveinfo.remaining_distance/(frames*FRAMETIME); } } @@ -849,16 +849,16 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) vec3_t end, forward, start, pt; vec3_t bonk, mins, maxs; - if(!(control->spawnflags & 1)) + if (!(control->spawnflags & 1)) { - if(control->message) + if (control->message) gi.centerprintf(activator,"%s\n",control->message); else gi.centerprintf(activator,"No power\n"); return; } - if(control->busy) return; + if (control->busy) return; // First make sure player (activator) is on the panel side of the // control panel @@ -866,25 +866,25 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) switch (control->style) { case 0: - if(activator->s.origin[0] > control->absmax[0]) return; + if (activator->s.origin[0] > control->absmax[0]) return; center[0] = control->absmin[0]; center[1] = (control->absmin[1] + control->absmax[1])/2; center[2] = (control->absmin[2] + control->absmax[2])/2; break; case 1: - if(activator->s.origin[1] > control->absmax[1]) return; + if (activator->s.origin[1] > control->absmax[1]) return; center[0] = (control->absmin[0] + control->absmax[0])/2; center[1] = control->absmin[1]; center[2] = (control->absmin[2] + control->absmax[2])/2; break; case 2: - if(activator->s.origin[0] < control->absmin[0]) return; + if (activator->s.origin[0] < control->absmin[0]) return; center[0] = control->absmax[0]; center[1] = (control->absmin[1] + control->absmax[1])/2; center[2] = (control->absmin[2] + control->absmax[2])/2; break; case 3: - if(activator->s.origin[1] < control->absmin[1]) return; + if (activator->s.origin[1] < control->absmin[1]) return; center[0] = (control->absmin[0] + control->absmax[0])/2; center[1] = control->absmax[1]; center[2] = (control->absmin[2] + control->absmax[2])/2; @@ -892,27 +892,27 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } // now check distance from player to panel VectorSubtract(activator->s.origin,center,v); - if(VectorLength(v) > 64) return; + if (VectorLength(v) > 64) return; beam = control->crane_beam; cable = control->crane_cable; hoist = control->crane_hoist; hook = control->crane_hook; cargo = hook->crane_cargo; //crashes here - if(cargo) cargo->gravity = 0.0; // reset after making it float up, + if (cargo) cargo->gravity = 0.0; // reset after making it float up, // otherwise things get jammed up control->activator = activator; // if any part of crane is currently moving, do nothing. - if(VectorLength(control->velocity) > 0.) return; - if(VectorLength(beam->velocity) > 0.) return; - if(VectorLength(hoist->velocity) > 0.) return; - if(VectorLength(hook->velocity) > 0.) return; + if (VectorLength(control->velocity) > 0.) return; + if (VectorLength(beam->velocity) > 0.) return; + if (VectorLength(hoist->velocity) > 0.) return; + if (VectorLength(hook->velocity) > 0.) return; // now find which row and column of buttons corresponds to "point" row = (2*(point[2] - control->absmin[2]))/(control->absmax[2]-control->absmin[2]); - if(row < 0) row = 0; - if(row > 1) row = 1; + if (row < 0) row = 0; + if (row > 1) row = 1; switch (control->style) { case 1: @@ -928,18 +928,18 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) column = (4*(point[1]-control->absmax[1]))/(control->absmin[1]-control->absmax[1]); break; } - if(column < 0) column = 0; - if(column > 3) column = 3; + if (column < 0) column = 0; + if (column > 3) column = 3; // adjust for controller facing beam movement direction - if( beam->movedir[0] > 0 && (control->style == 0 || control->style == 2)) { - if(column == 0 || column == 1) { + if ( beam->movedir[0] > 0 && (control->style == 0 || control->style == 2)) { + if (column == 0 || column == 1) { column = 1-column; row = 1-row; } } - if( beam->movedir[1] > 0 && (control->style == 1 || control->style == 3)) { - if(column == 0 || column == 1) { + if ( beam->movedir[1] > 0 && (control->style == 1 || control->style == 3)) { + if (column == 0 || column == 1) { column = 1-column; row = 1-row; } @@ -951,10 +951,10 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) //================== // move hoist //================== - if(row) + if (row) { // hoist away - if(control->style == 0 || control->style == 1) + if (control->style == 0 || control->style == 1) control->crane_increment = 1; else control->crane_increment = -1; @@ -962,18 +962,18 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) else { // hoist toward - if(control->style == 0 || control->style == 1) + if (control->style == 0 || control->style == 1) control->crane_increment = -1; else control->crane_increment = 1; } - if(hoist->movedir[0] > 0) + if (hoist->movedir[0] > 0) { // hoist travels in X dir = 0; - if(control->crane_increment > 0) + if (control->crane_increment > 0) { - if(Crane_Hook_Bonk(hook,0,1,bonk)) + if (Crane_Hook_Bonk(hook,0,1,bonk)) { bonk[0] += hoist->absmax[0] - hook->absmax[0]; hoist->crane_bonk = min(bonk[0],hoist->pos2[0]); @@ -984,7 +984,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } else { - if(Crane_Hook_Bonk(hook,0,-1,bonk)) + if (Crane_Hook_Bonk(hook,0,-1,bonk)) { bonk[0] += hoist->absmin[0] - hook->absmin[0]; hoist->crane_bonk = max(bonk[0],hoist->pos1[0]); @@ -997,9 +997,9 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) { // travels in Y dir = 1; - if(control->crane_increment > 0) + if (control->crane_increment > 0) { - if(Crane_Hook_Bonk(hook,1,1,bonk)) + if (Crane_Hook_Bonk(hook,1,1,bonk)) { bonk[1] += hoist->absmax[1] - hook->absmax[1]; hoist->crane_bonk = min(bonk[1],hoist->pos2[1]); @@ -1011,7 +1011,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } else { - if(Crane_Hook_Bonk(hook,1,-1,bonk)) + if (Crane_Hook_Bonk(hook,1,-1,bonk)) { bonk[1] += hoist->absmin[1] - hook->absmin[1]; hoist->crane_bonk = max(bonk[1],hoist->pos1[1]); @@ -1023,7 +1023,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) hoist->crane_dir = dir; hoist->moveinfo.remaining_distance = control->crane_increment * (hoist->crane_bonk - hoist->absmin[dir]); - if(hoist->moveinfo.remaining_distance <= 0) return; + if (hoist->moveinfo.remaining_distance <= 0) return; hoist->moveinfo.remaining_distance = min(hoist->moveinfo.remaining_distance,STEPSIZE); Crane_AdjustSpeed(hoist); @@ -1045,7 +1045,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) cable->crane_control = control; memcpy(&cable->moveinfo,&hoist->moveinfo,sizeof(moveinfo_t)); - if(cargo) + if (cargo) { cargo->movetype = MOVETYPE_PUSH; cargo->crane_dir = dir; @@ -1056,14 +1056,14 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } Crane_Move_Begin(hoist); Crane_Move_Begin(hook); - if(cargo) Crane_Move_Begin(cargo); + if (cargo) Crane_Move_Begin(cargo); break; case 1: //================== // move beam //================== // first re-parent associated speaker, if any - if(beam->speaker && control == beam->crane_onboard_control) + if (beam->speaker && control == beam->crane_onboard_control) { beam->speaker->owner = control; VectorAdd(control->absmin,control->absmax,beam->speaker->s.origin); @@ -1071,10 +1071,10 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) VectorSubtract(beam->speaker->s.origin,control->s.origin,beam->speaker->offset); control->noise_index = beam->noise_index; } - if(row) + if (row) { // left arrow - if(control->style == 0 || control->style == 3) + if (control->style == 0 || control->style == 3) control->crane_increment = 1; else control->crane_increment = -1; @@ -1082,18 +1082,18 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) else { // right arrow - if(control->style == 0 || control->style == 3) + if (control->style == 0 || control->style == 3) control->crane_increment = -1; else control->crane_increment = 1; } - if(beam->movedir[0] > 0) + if (beam->movedir[0] > 0) { // travels in X dir = 0; - if(control->crane_increment > 0) + if (control->crane_increment > 0) { - if(Crane_Hook_Bonk(hook,0,1,bonk)) + if (Crane_Hook_Bonk(hook,0,1,bonk)) { bonk[0] += beam->absmax[0] - hook->absmax[0]; beam->crane_bonk = min(bonk[0],beam->pos2[0]); @@ -1104,7 +1104,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } else { - if(Crane_Hook_Bonk(hook,0,-1,bonk)) + if (Crane_Hook_Bonk(hook,0,-1,bonk)) { bonk[0] += beam->absmin[0] - hook->absmin[0]; beam->crane_bonk = max(bonk[0],beam->pos1[0]); @@ -1117,9 +1117,9 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) { // travels in Y dir = 1; - if(control->crane_increment > 0) + if (control->crane_increment > 0) { - if(Crane_Hook_Bonk(hook,1,1,bonk)) + if (Crane_Hook_Bonk(hook,1,1,bonk)) { bonk[1] += beam->absmax[1] - hook->absmax[1]; beam->crane_bonk = min(bonk[1],beam->pos2[1]); @@ -1130,7 +1130,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } else { - if(Crane_Hook_Bonk(hook,1,-1,bonk)) + if (Crane_Hook_Bonk(hook,1,-1,bonk)) { bonk[1] += beam->absmin[1] - hook->absmin[1]; beam->crane_bonk = max(bonk[1],beam->pos1[1]); @@ -1143,7 +1143,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) beam->moveinfo.remaining_distance = control->crane_increment * (beam->crane_bonk - beam->absmin[dir]); // gi.dprintf("remaining distance = %g\n",beam->moveinfo.remaining_distance); - if(beam->moveinfo.remaining_distance <= 0) return; + if (beam->moveinfo.remaining_distance <= 0) return; beam->moveinfo.remaining_distance = min(beam->moveinfo.remaining_distance,STEPSIZE); Crane_AdjustSpeed(beam); @@ -1170,7 +1170,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) cable->crane_control = control; memcpy(&cable->moveinfo,&beam->moveinfo,sizeof(moveinfo_t)); - if(beam->crane_onboard_control) + if (beam->crane_onboard_control) { beam->crane_onboard_control->crane_dir = dir; beam->crane_onboard_control->crane_bonk = beam->crane_bonk + @@ -1180,7 +1180,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) memcpy(&beam->crane_onboard_control->moveinfo,&beam->moveinfo,sizeof(moveinfo_t)); } - if(cargo) + if (cargo) { cargo->movetype = MOVETYPE_PUSH; cargo->crane_dir = dir; @@ -1191,20 +1191,20 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) Crane_Move_Begin(beam); Crane_Move_Begin(hoist); Crane_Move_Begin(hook); - if(beam->crane_onboard_control) + if (beam->crane_onboard_control) Crane_Move_Begin(beam->crane_onboard_control); - if(cargo) Crane_Move_Begin(cargo); + if (cargo) Crane_Move_Begin(cargo); break; case 2: //================== // hook up/down //================== hook->crane_dir = dir = 2; - if(row) + if (row) { // hook up control->crane_increment = 1; - if(Crane_Hook_Bonk(hook,2,1,bonk)) + if (Crane_Hook_Bonk(hook,2,1,bonk)) hook->crane_bonk = min(bonk[2],hook->pos2[2]); else hook->crane_bonk = hook->pos2[2]; @@ -1213,27 +1213,27 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) else { // hook down - if(cargo) + if (cargo) { pt[0] = (cargo->absmin[0] + cargo->absmax[0])/2; pt[1] = (cargo->absmin[1] + cargo->absmax[1])/2; pt[2] = cargo->absmin[2] - 0.125; content = gi.pointcontents(pt); - if(content & MASK_SOLID) + if (content & MASK_SOLID) { BeepBeep(activator); return; } } control->crane_increment = -1; - if(Crane_Hook_Bonk(hook,2,-1,bonk)) + if (Crane_Hook_Bonk(hook,2,-1,bonk)) hook->crane_bonk = max(bonk[2],hook->pos1[2]); else hook->crane_bonk = hook->pos1[2]; } hook->moveinfo.remaining_distance = control->crane_increment * (hook->crane_bonk - hook->absmin[hook->crane_dir]); - if(hook->moveinfo.remaining_distance <= 0) + if (hook->moveinfo.remaining_distance <= 0) { BeepBeep(activator); return; @@ -1242,7 +1242,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) Crane_AdjustSpeed(hook); VectorSet(hook->moveinfo.dir,0.,0.,(float)(control->crane_increment)); hook->crane_control = control; - if(cargo) + if (cargo) { cargo->movetype = MOVETYPE_PUSH; cargo->crane_dir = dir; @@ -1255,17 +1255,17 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) cable->nextthink = level.time + FRAMETIME; Crane_Move_Begin(hook); - if(cargo) Crane_Move_Begin(cargo); + if (cargo) Crane_Move_Begin(cargo); break; case 3: //================== // hook/unhook //================== - if(row) + if (row) { // pickup cargo - if(hook->crane_cargo) + if (hook->crane_cargo) { // already carrying something BeepBeep(activator); @@ -1282,16 +1282,16 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) VectorScale(maxs,0.3333,maxs); // end 06/03/00 change tr=gi.trace(start, mins, maxs, end, hook, MASK_SOLID); - if((tr.fraction < 1) && (tr.ent) && (tr.ent->classname) && + if ((tr.fraction < 1) && (tr.ent) && (tr.ent->classname) && (tr.ent->movetype == MOVETYPE_PUSHABLE) ) { Z = hook->absmin[2] - tr.ent->absmax[2]; - if(Z > MAX_PICKUP_DISTANCE) + if (Z > MAX_PICKUP_DISTANCE) { gi.centerprintf(activator,"Too far\n"); return; } - if(CrateOnTop(NULL,tr.ent)) + if (CrateOnTop(NULL,tr.ent)) { BeepBeep(activator); gi.dprintf("Too heavy\n"); @@ -1299,7 +1299,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) } // run a trace from top of cargo up... if first entity hit is NOT // the hook, we can't get there from here. - if( Z > 0 ) + if ( Z > 0 ) { trace_t tr2; @@ -1314,7 +1314,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) VectorCopy(start,end); end[2] += Z + 1; tr2=gi.trace(start, mins, maxs, end, hook, MASK_SOLID); - if((tr2.fraction < 1) && tr2.ent && (tr2.ent != hook)) + if ((tr2.fraction < 1) && tr2.ent && (tr2.ent != hook)) { gi.centerprintf(activator,"Blocked!\n"); return; @@ -1328,7 +1328,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) cargo->movetype = MOVETYPE_PUSH; cargo->touch = NULL; // Make cargo float up to the hook - if(Z > 0) + if (Z > 0) { control->busy = true; cargo->attracted = true; @@ -1353,7 +1353,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) { // drop cargo - if(hook->crane_cargo) + if (hook->crane_cargo) { hook->crane_cargo->gravity = 1.0; hook->crane_cargo->movetype = MOVETYPE_PUSHABLE; @@ -1372,7 +1372,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point) void Use_Crane_Control (edict_t *ent, edict_t *other, edict_t *activator) { ent->spawnflags ^= 1; - if(ent->crane_hook && ent->crane_hook->speaker) //crashes here + if (ent->crane_hook && ent->crane_hook->speaker) //crashes here ent->crane_hook->speaker->spawnflags = 1 - (ent->spawnflags & 1); } @@ -1384,6 +1384,9 @@ void SP_crane_control (edict_t *self) G_FreeEdict (self); return; } + + self->class_id = ENTITY_CRANE_CONTROL; + self->classname = "crane_control"; self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; @@ -1398,6 +1401,8 @@ void SP_crane_hook (edict_t *self) vec3_t origin; edict_t *speaker; + self->class_id = ENTITY_CRANE_HOOK; + gi.setmodel (self, self->model); VectorAdd(self->absmin,self->absmax,origin); VectorScale(origin,0.5,origin); @@ -1411,7 +1416,7 @@ void SP_crane_hook (edict_t *self) self->classname = "crane_hook"; self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; - if(st.noise) + if (st.noise) self->noise_index = gi.soundindex(st.noise); else self->noise_index = 0; @@ -1421,11 +1426,11 @@ void SP_crane_hook (edict_t *self) self->attenuation = ATTN_IDLE; #endif - if(!self->speed) self->speed = 160; + if (!self->speed) self->speed = 160; self->moveinfo.speed = self->speed; gi.linkentity (self); - if(self->noise_index && !VectorLength(self->s.origin) ) + if (self->noise_index && !VectorLength(self->s.origin) ) { speaker = G_Spawn(); speaker->classname = "moving_speaker"; @@ -1450,6 +1455,8 @@ void SP_crane_hoist (edict_t *self) vec3_t origin; edict_t *speaker; + self->class_id = ENTITY_CRANE_HOIST; + gi.setmodel (self, self->model); VectorAdd(self->absmin,self->absmax,origin); VectorScale(origin,0.5,origin); @@ -1469,9 +1476,9 @@ void SP_crane_hoist (edict_t *self) self->classname = "crane_hoist"; self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; - if(!self->speed) self->speed = 160; + if (!self->speed) self->speed = 160; self->moveinfo.speed = self->speed; - if(st.noise) + if (st.noise) self->noise_index = gi.soundindex(st.noise); else self->noise_index = 0; @@ -1483,7 +1490,7 @@ void SP_crane_hoist (edict_t *self) gi.linkentity (self); - if(self->noise_index && !VectorLength(self->s.origin) ) + if (self->noise_index && !VectorLength(self->s.origin) ) { speaker = G_Spawn(); speaker->classname = "moving_speaker"; @@ -1507,6 +1514,8 @@ void SP_crane_beam (edict_t *self) vec3_t origin; edict_t *speaker; + self->class_id = ENTITY_CRANE_BEAM; + gi.setmodel (self, self->model); VectorAdd(self->absmin,self->absmax,origin); VectorScale(origin,0.5,origin); @@ -1533,9 +1542,9 @@ void SP_crane_beam (edict_t *self) self->solid = SOLID_BSP; self->movetype = MOVETYPE_PUSH; - if(!self->speed) self->speed = 160; + if (!self->speed) self->speed = 160; self->moveinfo.speed = self->speed; - if(st.noise) + if (st.noise) self->noise_index = gi.soundindex(st.noise); else self->noise_index = 0; @@ -1547,7 +1556,7 @@ void SP_crane_beam (edict_t *self) gi.linkentity (self); - if(self->noise_index && !VectorLength(self->s.origin) ) + if (self->noise_index && !VectorLength(self->s.origin) ) { speaker = G_Spawn(); speaker->classname = "moving_speaker"; @@ -1579,9 +1588,9 @@ void crane_reset_go (edict_t *temp) Crane_Move_Begin(control->crane_beam); Crane_Move_Begin(control->crane_hoist); Crane_Move_Begin(control->crane_hook); - if(control->crane_beam->crane_onboard_control) + if (control->crane_beam->crane_onboard_control) Crane_Move_Begin(control->crane_beam->crane_onboard_control); - if(control->crane_hook->crane_cargo) Crane_Move_Begin(control->crane_hook->crane_cargo); + if (control->crane_hook->crane_cargo) Crane_Move_Begin(control->crane_hook->crane_cargo); G_FreeEdict(temp); } @@ -1596,7 +1605,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) crane = G_Find (NULL, FOFS(targetname), self->target); - if(!crane) + if (!crane) { gi.dprintf("Cannot find target of crane_reset at %s\n",vtos(self->s.origin)); return; @@ -1604,9 +1613,9 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) control = crane->crane_control; control->activator = activator; //crashes here - if(!(control->spawnflags & 1)) + if (!(control->spawnflags & 1)) { - if(control->message) + if (control->message) gi.centerprintf(activator,"%s\n",control->message); else gi.centerprintf(activator,"No power\n"); @@ -1623,18 +1632,18 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) d1 = VectorLength(v1); d2 = VectorLength(v2); - if(d2 < d1) + if (d2 < d1) control->crane_increment = 1; else control->crane_increment = -1; - if(beam->movedir[0] > 0) + if (beam->movedir[0] > 0) { // travels in X dir = 0; - if(control->crane_increment > 0) + if (control->crane_increment > 0) { - if(Crane_Hook_Bonk(hook,0,1,bonk)) + if (Crane_Hook_Bonk(hook,0,1,bonk)) { bonk[0] += beam->absmax[0] - hook->absmax[0]; beam->crane_bonk = min(bonk[0],beam->pos2[0]); @@ -1645,7 +1654,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) } else { - if(Crane_Hook_Bonk(hook,0,-1,bonk)) + if (Crane_Hook_Bonk(hook,0,-1,bonk)) { bonk[0] += beam->absmin[0] - hook->absmin[0]; beam->crane_bonk = max(bonk[0],beam->pos1[0]); @@ -1658,9 +1667,9 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) { // travels in Y dir = 1; - if(control->crane_increment > 0) + if (control->crane_increment > 0) { - if(Crane_Hook_Bonk(hook,1,1,bonk)) + if (Crane_Hook_Bonk(hook,1,1,bonk)) { bonk[1] += beam->absmax[1] - hook->absmax[1]; beam->crane_bonk = min(bonk[1],beam->pos2[1]); @@ -1671,7 +1680,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) } else { - if(Crane_Hook_Bonk(hook,1,-1,bonk)) + if (Crane_Hook_Bonk(hook,1,-1,bonk)) { bonk[1] += beam->absmin[1] - hook->absmin[1]; beam->crane_bonk = max(bonk[1],beam->pos1[1]); @@ -1681,7 +1690,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) } } - if(beam->speaker && beam->crane_onboard_control) + if (beam->speaker && beam->crane_onboard_control) { beam->speaker->owner = beam->crane_onboard_control; VectorAdd(beam->crane_onboard_control->absmin, @@ -1696,7 +1705,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) beam->crane_dir = dir; beam->moveinfo.remaining_distance = control->crane_increment * (beam->crane_bonk - beam->absmin[dir]); - if(beam->moveinfo.remaining_distance <= 0) return; + if (beam->moveinfo.remaining_distance <= 0) return; Crane_AdjustSpeed(beam); @@ -1721,7 +1730,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) cable->crane_control = control; memcpy(&cable->moveinfo,&beam->moveinfo,sizeof(moveinfo_t)); - if(beam->crane_onboard_control) + if (beam->crane_onboard_control) { beam->crane_onboard_control->crane_dir = dir; beam->crane_onboard_control->crane_bonk = beam->crane_bonk + @@ -1731,7 +1740,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) memcpy(&beam->crane_onboard_control->moveinfo,&beam->moveinfo,sizeof(moveinfo_t)); } - if(cargo) + if (cargo) { cargo->crane_dir = dir; cargo->crane_bonk = beam->crane_bonk + cargo->absmin[dir] - beam->absmin[dir]; @@ -1745,7 +1754,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator) gi.linkentity(delay); self->count--; - if(self->count == 0) + if (self->count == 0) { self->think = G_FreeEdict; self->nextthink = level.time + 1; @@ -1766,6 +1775,9 @@ void SP_crane_reset (edict_t *self) G_FreeEdict (self); return; } + + self->class_id = ENTITY_CRANE_RESET; + self->use = crane_reset_use; } diff --git a/missionpack/g_func.c b/missionpack/g_func.c index 6a13efe..cbd4c14 100644 --- a/missionpack/g_func.c +++ b/missionpack/g_func.c @@ -1448,7 +1448,7 @@ void SP_func_plat2 (edict_t *ent) } - //PMM Added to kill things it's being blocked by + // PMM Added to kill things it's being blocked by if (!ent->dmg) ent->dmg = 2; @@ -1497,7 +1497,7 @@ void SP_func_plat2 (edict_t *ent) } } - ent->postthink = train_move_children; //supports movewith + ent->postthink = train_move_children; // supports movewith gi.linkentity (ent); @@ -3248,12 +3248,14 @@ void train_move_children (edict_t *self) vec3_t parent_angle_change, offset; qboolean is_monster; + if (!self->inuse) + return; if (!self->classname) return; if (!self->targetname) return; - ent = g_edicts+1; // Skip the worldspawn + ent = g_edicts+1; // Skip the worldspawn for (i = 1; i < globals.num_edicts; i++, ent++) { if (!ent->classname) @@ -3261,8 +3263,9 @@ void train_move_children (edict_t *self) if (!ent->movewith) continue; if (!ent->inuse) - return; - if (!strcmp(ent->movewith, self->targetname)) + // break; + continue; + if ( !strcmp(ent->movewith, self->targetname) ) { ent->movewith_ent = self; // Backup and set movetype to push @@ -3281,7 +3284,8 @@ void train_move_children (edict_t *self) VectorCopy (ent->s.angles, ent->child_attach_angles); // Knightmare- backup turret's old angle offset - if (!strcmp(ent->classname, "monster_turret") && ent->offset) + // if ( !strcmp(ent->classname, "monster_turret") && ent->offset ) + if ( (ent->class_id == ENTITY_MONSTER_TURRET) && ent->offset ) VectorCopy (ent->offset, ent->old_offset); ent->movewith_set = 1; @@ -3315,12 +3319,16 @@ void train_move_children (edict_t *self) */ // For all but buttons, doors, and plats, move origin and match velocities - if ( strcmp(ent->classname, "func_door") && strcmp(ent->classname, "func_button") - // && strcmp(ent->classname, "func_door_secret") && strcmp(ent->classname, "func_door_secret2") - && (ent->class_id != ENTITY_FUNC_DOOR_SECRET) && (ent->class_id != ENTITY_FUNC_DOOR_SECRET2) + /* if ( strcmp(ent->classname, "func_door") && strcmp(ent->classname, "func_button") + && strcmp(ent->classname, "func_door_secret") && strcmp(ent->classname, "func_door_secret2") && strcmp(ent->classname, "func_plat") && strcmp(ent->classname, "func_plat2") && strcmp(ent->classname, "func_water") && strcmp(ent->classname, "turret_wall") - && (strcmp(ent->classname, "monster_turret") || !(ent->spawnflags & 128)) ) + && (strcmp(ent->classname, "monster_turret") || !(ent->spawnflags & 128)) )*/ + if ( (ent->class_id != ENTITY_FUNC_DOOR) && (ent->class_id != ENTITY_FUNC_BUTTON) + && (ent->class_id != ENTITY_FUNC_DOOR_SECRET) && (ent->class_id != ENTITY_FUNC_DOOR_SECRET2) + && (ent->class_id != ENTITY_FUNC_PLAT) && (ent->class_id != ENTITY_FUNC_PLAT2) + && (ent->class_id != ENTITY_FUNC_WATER) && (ent->class_id != ENTITY_TURRET_WALL) + && ( (ent->class_id != ENTITY_MONSTER_TURRET) || !(ent->spawnflags & 128) ) ) { VectorMA (self->s.origin, ent->movewith_offset[0], forward, ent->s.origin); VectorMA (ent->s.origin, ent->movewith_offset[1], right, ent->s.origin); @@ -3349,7 +3357,8 @@ void train_move_children (edict_t *self) // Match angular velocities if (self->turn_rider) { - if (!strcmp(ent->classname, "func_rotating")) + // if (!strcmp(ent->classname, "func_rotating")) + if (ent->class_id == ENTITY_FUNC_ROTATING) { /* if (ent->movedir[0] > 0) ent->s.angles[1] = self->s.angles[1]; @@ -3387,9 +3396,11 @@ void train_move_children (edict_t *self) // their own. if (!ent->do_not_rotate) { - if ( !strcmp(ent->classname, "turret_breach") || !strcmp(ent->classname, "turret_base") ) + // if ( !strcmp(ent->classname, "turret_breach") || !strcmp(ent->classname, "turret_base") ) + if ( (ent->class_id == ENTITY_TURRET_BREACH) || (ent->class_id == ENTITY_TURRET_BASE) ) VectorCopy (self->avelocity, ent->avelocity); - else if (!strcmp(ent->classname, "func_door_rotating")) + // else if (!strcmp(ent->classname, "func_door_rotating")) + else if (ent->class_id == ENTITY_FUNC_DOOR_ROTATING) { VectorCopy (self->avelocity, ent->avelocity); // VectorCopy (parent_angle_change, ent->pos1); @@ -3404,7 +3415,7 @@ void train_move_children (edict_t *self) VectorCopy (ent->s.origin, ent->moveinfo.end_origin); VectorCopy (ent->pos2, ent->moveinfo.end_angles); } - //don't move child's angles if not moving self + // don't move child's angles if not moving self else if (ent->solid == SOLID_BSP) //&& (VectorLength(self->velocity) || VectorLength(self->avelocity)) ) { // Brush models always start out with angles=0,0,0 (after G_SetMoveDir). // Use more accuracy here. @@ -3430,7 +3441,8 @@ void train_move_children (edict_t *self) else if (is_monster) { // Knightmare- adjust monster_turret's aiming angles for yaw movement - if (!strcmp(ent->classname, "monster_turret") && amove[YAW] != 0) + // if (!strcmp(ent->classname, "monster_turret") && (amove[YAW] != 0) ) + if ( (ent->class_id == ENTITY_MONSTER_TURRET) && (amove[YAW] != 0) ) { if (ent->offset && ent->old_offset && (ent->offset[1] != -1 && ent->offset[1] != -2)) { @@ -3456,17 +3468,22 @@ void train_move_children (edict_t *self) } // Special cases: // Func_door/func_button and trigger fields - if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button") - // || !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2") - || (ent->class_id == ENTITY_FUNC_DOOR_SECRET) || (ent->class_id == ENTITY_FUNC_DOOR_SECRET2) + /* if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button") + || !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2") || !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2") || !strcmp(ent->classname, "func_water") || !strcmp(ent->classname, "turret_wall") - || (!strcmp(ent->classname, "monster_turret") && ent->spawnflags & 128) ) + || ( !strcmp(ent->classname, "monster_turret") && (ent->spawnflags & 128) ) )*/ + if ( (ent->class_id == ENTITY_FUNC_DOOR) || (ent->class_id == ENTITY_FUNC_BUTTON) + || (ent->class_id == ENTITY_FUNC_DOOR_SECRET) || (ent->class_id == ENTITY_FUNC_DOOR_SECRET2) + || (ent->class_id == ENTITY_FUNC_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2) + || (ent->class_id == ENTITY_FUNC_WATER) || (ent->class_id == ENTITY_TURRET_WALL) + || ( (ent->class_id == ENTITY_MONSTER_TURRET) && (ent->spawnflags & 128) ) ) { VectorAdd (ent->s.angles, ent->org_angles, angles); G_SetMovedir (angles, ent->movedir); // Knightmare- these entities need special calculations - if (!strcmp(ent->classname, "monster_turret") || !strcmp(ent->classname, "turret_wall")) + // if (!strcmp(ent->classname, "monster_turret") || !strcmp(ent->classname, "turret_wall")) + if ( (ent->class_id == ENTITY_MONSTER_TURRET) || (ent->class_id == ENTITY_TURRET_WALL) ) { vec3_t eforward, tangles; @@ -3520,7 +3537,8 @@ void train_move_children (edict_t *self) VectorAdd (ent->pos1, eforward, ent->pos2); } } - else if (!strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")) + // else if (!strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")) + else if ( (ent->class_id == ENTITY_FUNC_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2) ) { VectorMA (self->s.origin, ent->movewith_offset[0], forward, ent->pos1); VectorMA (ent->pos1, ent->movewith_offset[1], right, ent->pos1); @@ -3550,7 +3568,8 @@ void train_move_children (edict_t *self) // movement routines VectorCopy (self->velocity, ent->velocity); // Sanity insurance: - if (!strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")) + // if (!strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")) + if ( (ent->class_id == ENTITY_FUNC_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2) ) { // top and bottom states are reversed for plats if (ent->moveinfo.state == STATE_BOTTOM) VectorCopy (ent->pos2, ent->s.origin); @@ -3571,13 +3590,18 @@ void train_move_children (edict_t *self) if (amove[YAW]) { // Cross fingers here... move bounding boxes of doors and buttons - if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button") - // || !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2") - || (ent->class_id == ENTITY_FUNC_DOOR_SECRET) || (ent->class_id == ENTITY_FUNC_DOOR_SECRET2) + /* if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button") + || !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2") || !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2") || !strcmp(ent->classname, "func_water") || (ent->solid == SOLID_TRIGGER) || !strcmp(ent->classname, "turret_wall") - || (!strcmp(ent->classname, "monster_turret") && ent->spawnflags & 128) ) + || ( !strcmp(ent->classname, "monster_turret") && (ent->spawnflags & 128) ) )*/ + if ( (ent->class_id == ENTITY_FUNC_DOOR) || (ent->class_id == ENTITY_FUNC_BUTTON) + || (ent->class_id == ENTITY_FUNC_DOOR_SECRET) || (ent->class_id == ENTITY_FUNC_DOOR_SECRET2) + || (ent->class_id == ENTITY_FUNC_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2) + || (ent->class_id == ENTITY_FUNC_WATER) || (ent->solid == SOLID_TRIGGER) + || (ent->class_id == ENTITY_TURRET_WALL) + || ( (ent->class_id == ENTITY_MONSTER_TURRET) && (ent->spawnflags & 128) ) ) { float ca, sa, yaw; vec3_t p00, p01, p10, p11; @@ -3614,7 +3638,8 @@ void train_move_children (edict_t *self) } // FMOD - if (!Q_stricmp(ent->classname, "target_playback")) + // if (!Q_stricmp(ent->classname, "target_playback")) + if (ent->class_id == ENTITY_TARGET_PLAYBACK) FMOD_UpdateSpeakerPos(ent); // Correct func_door_rotating start/end positions @@ -4582,10 +4607,10 @@ void func_train_find (edict_t *self) VectorAdd (dir, e->s.origin, e->s.origin); VectorCopy (e->s.origin, e->s.old_origin); - //This is now the child's original position + // This is now the child's original position if ( (e->solid == SOLID_BSP) && strcmp(e->classname, "func_rotating") && strcmp(e->classname, "func_door_rotating")) - ReInitialize_Entity(e); + ReInitialize_Entity (e); gi.linkentity (e); } } @@ -5159,10 +5184,11 @@ void door_secret_done (edict_t *self) { if (!(self->targetname) || (self->spawnflags & SECRET_ALWAYS_SHOOT)) { - self->health = 0; + // self->health = 0; + self->health = self->max_health; // Knightmare- restore max health self->takedamage = DAMAGE_YES; } - self->moveinfo.state = STATE_LOWEST; + self->moveinfo.state = STATE_LOWEST; // Knightmare added // added sound self->s.sound = 0; @@ -5240,11 +5266,14 @@ void SP_func_door_secret (edict_t *ent) ent->use = door_secret_use; ent->blocked = door_secret_blocked; // Knightmare- this was missing - ent->moveinfo.state = STATE_LOWEST; + ent->moveinfo.state = STATE_LOWEST; // Knightmare added if (!(ent->targetname) || (ent->spawnflags & SECRET_ALWAYS_SHOOT)) { - ent->health = 0; + if (!ent->health) { + ent->health = 1; // Knightmare- was 0 + } + ent->max_health = ent->health; // Knightmare- store health value ent->takedamage = DAMAGE_YES; ent->die = door_secret_die; } @@ -5262,7 +5291,9 @@ void SP_func_door_secret (edict_t *ent) // calculate positions VectorCopy (ent->s.origin, ent->pos0); AngleVectors (ent->s.angles, forward, right, up); - VectorClear (ent->s.angles); +// VectorClear (ent->s.angles); + VectorCopy (ent->s.angles, ent->move_angles); // Knightmare- backup angles to move_angles + G_SetMovedir (ent->s.angles, ent->movedir); // Knightmare- don't just clear angles, set movedir as well // ent->side = 1.0 - (ent->spawnflags & SECRET_1ST_LEFT); if (ent->spawnflags & SECRET_1ST_LEFT) @@ -6013,7 +6044,7 @@ void SP_func_door_swinging (edict_t *self) { int pivot; - self->class_id = ENTITY_FUNC_PIVOT; + self->class_id = ENTITY_FUNC_DOOR_SWINGING; pivot = self->spawnflags & 1; // 1 means "start open" for normal doors, so turn it self->spawnflags &= ~1; // off temporarily until normal door initialization @@ -6106,8 +6137,11 @@ void SP_func_bobbingwater(edict_t *self) { vec3_t abs_movedir; + self->class_id = ENTITY_FUNC_BOBBINGWATER; + if (!VectorLength(self->movedir)) G_SetMovedir (self->s.angles, self->movedir); + self->movetype = MOVETYPE_PUSH; self->solid = SOLID_BSP; gi.setmodel (self, self->model); @@ -6312,6 +6346,8 @@ void pivot_init (edict_t *ent) void SP_func_pivot (edict_t *ent) { + ent->class_id = ENTITY_FUNC_PIVOT; + ent->solid = SOLID_BSP; ent->movetype = MOVETYPE_PUSH; diff --git a/missionpack/g_items.c b/missionpack/g_items.c index f16b531..4ca8458 100644 --- a/missionpack/g_items.c +++ b/missionpack/g_items.c @@ -273,7 +273,7 @@ void DoRespawn (edict_t *ent) //===== //ROGUE - if(randomrespawn && randomrespawn->value) + if (randomrespawn && randomrespawn->value) { edict_t *newEnt; @@ -281,7 +281,7 @@ void DoRespawn (edict_t *ent) // if we've changed entities, then do some sleight of hand. // otherwise, the old entity will respawn - if(newEnt) + if (newEnt) { G_FreeEdict (ent); ent = newEnt; @@ -327,15 +327,15 @@ qboolean Pickup_Powerup (edict_t *ent, edict_t *other) return false; #ifdef JETPACK_MOD - if( !Q_stricmp(ent->classname,"item_jetpack") ) + if ( !Q_stricmp(ent->classname,"item_jetpack") ) { gitem_t *fuel; - if( quantity >= 1 ) + if ( quantity >= 1 ) return false; fuel = FindItem("Fuel"); - if(ent->count < 0) + if (ent->count < 0) { other->client->jetpack_infinite = true; Add_Ammo(other,fuel,100000); @@ -366,7 +366,7 @@ qboolean Pickup_Powerup (edict_t *ent, edict_t *other) #ifdef JETPACK_MOD // DON'T Instant-use Jetpack - if(ent->item->use == Use_Jet) return true; + if (ent->item->use == Use_Jet) return true; #endif if ( ((int)dmflags->value & DF_INSTANT_ITEMS) @@ -382,7 +382,7 @@ qboolean Pickup_Powerup (edict_t *ent, edict_t *other) ent->item->use (other, ent->item); } //PGM - /* if(ent->item->use) + /* if (ent->item->use) ent->item->use (other, ent->item); else gi.dprintf("Powerup has no use function!\n");*/ @@ -403,14 +403,14 @@ void Drop_General (edict_t *ent, gitem_t *item) #ifdef JETPACK_MOD void Drop_Jetpack (edict_t *ent, gitem_t *item) { - if(ent->client->jetpack) + if (ent->client->jetpack) gi.cprintf(ent,PRINT_HIGH,"Cannot drop jetpack in use\n"); else { edict_t *dropped; dropped = Drop_Item (ent, item); - if(ent->client->jetpack_infinite) + if (ent->client->jetpack_infinite) { dropped->count = -1; ent->client->pers.inventory[fuel_index] = 0; @@ -419,7 +419,7 @@ void Drop_Jetpack (edict_t *ent, gitem_t *item) else { dropped->count = ent->client->pers.inventory[fuel_index]; - if(dropped->count > 500) + if (dropped->count > 500) dropped->count = 500; ent->client->pers.inventory[fuel_index] -= dropped->count; } @@ -836,7 +836,7 @@ void Use_Compass (edict_t *ent, gitem_t *item) int ang; ang = (int)(ent->client->v_angle[1]); - if(ang<0) + if (ang<0) ang += 360; gi.cprintf(ent, PRINT_HIGH, "Origin: %0.0f,%0.0f,%0.0f Dir: %d\n", ent->s.origin[0], ent->s.origin[1], @@ -885,10 +885,10 @@ void Use_Doppleganger (edict_t *ent, gitem_t *item) VectorMA(ent->s.origin, 48, forward, createPt); - if(!FindSpawnPoint(createPt, ent->mins, ent->maxs, spawnPt, 32)) + if (!FindSpawnPoint(createPt, ent->mins, ent->maxs, spawnPt, 32)) return; - if(!CheckGroundSpawnPoint(spawnPt, ent->mins, ent->maxs, 64, -1)) + if (!CheckGroundSpawnPoint(spawnPt, ent->mins, ent->maxs, 64, -1)) return; ent->client->pers.inventory[ITEM_INDEX(item)]--; @@ -902,7 +902,7 @@ qboolean Pickup_Doppleganger (edict_t *ent, edict_t *other) { int quantity; - //if(!(deathmatch->value)) // item is DM only + //if (!(deathmatch->value)) // item is DM only //return false; quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)]; @@ -922,7 +922,7 @@ qboolean Pickup_Sphere (edict_t *ent, edict_t *other) { int quantity; - if(other->client && other->client->owned_sphere) + if (other->client && other->client->owned_sphere) { // gi.cprintf(other, PRINT_HIGH, "Only one sphere to a customer!\n"); // return false; @@ -944,7 +944,7 @@ qboolean Pickup_Sphere (edict_t *ent, edict_t *other) if (((int)dmflags->value & DF_INSTANT_ITEMS)) { //PGM - if(ent->item->use) + if (ent->item->use) ent->item->use (other, ent->item); else gi.dprintf("Powerup has no use function!\n"); @@ -957,7 +957,7 @@ qboolean Pickup_Sphere (edict_t *ent, edict_t *other) void Use_Defender (edict_t *ent, gitem_t *item) { - if(ent->client && ent->client->owned_sphere) + if (ent->client && ent->client->owned_sphere) { gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n"); return; @@ -971,7 +971,7 @@ void Use_Defender (edict_t *ent, gitem_t *item) void Use_Hunter (edict_t *ent, gitem_t *item) { - if(ent->client && ent->client->owned_sphere) + if (ent->client && ent->client->owned_sphere) { gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n"); return; @@ -985,7 +985,7 @@ void Use_Hunter (edict_t *ent, gitem_t *item) void Use_Vengeance (edict_t *ent, gitem_t *item) { - if(ent->client && ent->client->owned_sphere) + if (ent->client && ent->client->owned_sphere) { gi.cprintf(ent, PRINT_HIGH, "Only one sphere at a time!\n"); return; @@ -2144,7 +2144,7 @@ void Item_TriggeredSpawn (edict_t *self, edict_t *other, edict_t *activator) void SetTriggeredSpawn (edict_t *ent) { // don't do anything on key_power_cubes. - if(!strcmp(ent->classname, "key_power_cube")) + if (!strcmp(ent->classname, "key_power_cube")) return; ent->think = NULL; @@ -4877,6 +4877,7 @@ void SP_item_health (edict_t *self) G_FreeEdict (self); return; } + self->class_id = ENTITY_ITEM_HEALTH; self->model = "models/items/healing/medium/tris.md2"; self->count = 10; @@ -4893,6 +4894,7 @@ void SP_item_health_small (edict_t *self) G_FreeEdict (self); return; } + self->class_id = ENTITY_ITEM_HEALTH_SMALL; self->model = "models/items/healing/stimpack/tris.md2"; self->count = sk_health_bonus_value->value; // Knightmare- made this cvar @@ -4910,6 +4912,7 @@ void SP_item_health_large (edict_t *self) G_FreeEdict (self); return; } + self->class_id = ENTITY_ITEM_HEALTH_LARGE; self->model = "models/items/healing/large/tris.md2"; self->count = 25; @@ -4926,6 +4929,7 @@ void SP_item_health_mega (edict_t *self) G_FreeEdict (self); return; } + self->class_id = ENTITY_ITEM_HEALTH_MEGA; self->model = "models/items/mega_h/tris.md2"; self->count = 100; @@ -4942,6 +4946,7 @@ void SP_item_foodcube (edict_t *self) G_FreeEdict (self); return; } + self->class_id = ENTITY_ITEM_FOODCUBE; self->model = "models/objects/trapfx/tris.md2"; SpawnItem (self, FindItem ("Health")); @@ -4958,7 +4963,6 @@ void InitItems (void) } - /* =============== SetItemNames @@ -5020,7 +5024,7 @@ void SetItemNames (void) //============================================================================== void Use_Jet ( edict_t *ent, gitem_t *item ) { - if(ent->client->jetpack) + if (ent->client->jetpack) { // Currently on... turn it off and store remaining time ent->client->jetpack = false; @@ -5044,7 +5048,7 @@ void Use_Jet ( edict_t *ent, gitem_t *item ) // Currently off. Turn it on, and add time, if any, remaining // from last jetpack. - if( ent->client->pers.inventory[ITEM_INDEX(item)] ) + if ( ent->client->pers.inventory[ITEM_INDEX(item)] ) { ent->client->jetpack = true; // Lazarus: Never remove jetpack from inventory (unless dropped) @@ -5053,7 +5057,7 @@ void Use_Jet ( edict_t *ent, gitem_t *item ) ent->client->jetpack_framenum = level.framenum; ent->client->jetpack_activation = level.framenum; } - else if(ent->client->pers.inventory[fuel_index] > 0) + else if (ent->client->pers.inventory[fuel_index] > 0) { ent->client->jetpack = true; ent->client->jetpack_framenum = level.framenum; @@ -5070,7 +5074,7 @@ void Use_Jet ( edict_t *ent, gitem_t *item ) // Lazarus: Stasis field generator void Use_Stasis ( edict_t *ent, gitem_t *item ) { - if(ent->client->jetpack) + if (ent->client->jetpack) { gi.dprintf("Cannot use stasis generator while using jetpack\n"); return; diff --git a/missionpack/g_local.h b/missionpack/g_local.h index d5c2a64..e04f7e0 100644 --- a/missionpack/g_local.h +++ b/missionpack/g_local.h @@ -2352,7 +2352,7 @@ struct edict_s char *deathtarget; char *combattarget; edict_t *target_ent; - edict_t *movewith_ent; //Knightmare- movewith entity + edict_t *movewith_ent; // Knightmare- movewith entity edict_t *movewith_next; edict_t *from; edict_t *to; diff --git a/missionpack/g_lock.c b/missionpack/g_lock.c index 25cdacf..9fe75cb 100644 --- a/missionpack/g_lock.c +++ b/missionpack/g_lock.c @@ -4,6 +4,8 @@ void SP_target_lock_digit (edict_t *self) { + self->class_id = ENTITY_TARGET_LOCK_DIGIT; + self->movetype = MOVETYPE_PUSH; gi.setmodel (self, self->model); self->solid = SOLID_BSP; @@ -28,7 +30,7 @@ void target_lock_use (edict_t *self, edict_t *other, edict_t *activator) n = e->count - 1; current[n] = '0' + e->s.frame; } - if(strcmp(current,self->key_message)==0) + if (strcmp(current,self->key_message)==0) { copy_message = self->message; self->message = NULL; @@ -37,10 +39,10 @@ void target_lock_use (edict_t *self, edict_t *other, edict_t *activator) } else { - if(self->message) gi.centerprintf(activator,self->message); - if(self->pathtarget) { + if (self->message) gi.centerprintf(activator,self->message); + if (self->pathtarget) { e = G_Find(NULL,FOFS(targetname),self->pathtarget); - if(e) e->use(e,other,activator); + if (e) e->use(e,other,activator); } else { BeepBeep(activator); @@ -50,7 +52,7 @@ void target_lock_use (edict_t *self, edict_t *other, edict_t *activator) void lock_digit_increment (edict_t *digit, edict_t *activator) { - if(digit->s.frame == 9) + if (digit->s.frame == 9) digit->s.frame = 0; else digit->s.frame++; @@ -110,6 +112,9 @@ void SP_target_lock (edict_t *self) G_FreeEdict(self); return; } + + self->class_id = ENTITY_TARGET_LOCK; + if (self->spawnflags & 2) game.lock_hud = true; if (!self->key_message) self->key_message = "000000000"; @@ -128,9 +133,9 @@ void lock_code_use (edict_t *self, edict_t *other, edict_t *activator) { int i, L; char message[64]; - if(self->spawnflags & 1) + if (self->spawnflags & 1) { - if(!strlen(game.lock_code)) + if (!strlen(game.lock_code)) { gi.dprintf("Lock has not been properly initialized.\n"); return; @@ -145,7 +150,7 @@ void lock_code_use (edict_t *self, edict_t *other, edict_t *activator) { edict_t *lock; lock = G_Find(NULL,FOFS(targetname),self->target); - if(!lock) + if (!lock) gi.dprintf("Target of target_lock_code does not exist\n"); else { @@ -160,7 +165,9 @@ void lock_code_use (edict_t *self, edict_t *other, edict_t *activator) void SP_target_lock_code (edict_t *self) { - if(!self->target && !(self->spawnflags & 1)) + self->class_id = ENTITY_TARGET_LOCK_CODE; + + if (!self->target && !(self->spawnflags & 1)) { gi.dprintf("non-crosslevel target_lock_code w/o target\n"); G_FreeEdict(self); @@ -171,28 +178,28 @@ void SP_target_lock_code (edict_t *self) void lock_clue_use (edict_t *self, edict_t *other, edict_t *activator) { int i, L; - if(self->spawnflags & 1) + if (self->spawnflags & 1) { - if(!strlen(game.lock_code)) + if (!strlen(game.lock_code)) { gi.dprintf("Lock has not been properly initialized.\n"); return; } L = (int)strlen(game.lock_code); for(i=0; imessage[i] != '?') game.lock_revealed |= 1<message[i] != '?') game.lock_revealed |= 1<target); - if(!lock) + if (!lock) gi.dprintf("Target of target_lock_clue does not exist\n"); else { L = min(8, (int)strlen(lock->key_message)); for(i=0; imessage[i] != '?') game.lock_revealed |= 1<message[i] != '?') game.lock_revealed |= 1<team) + if (!self->team) return; unrevealed_count = 0; @@ -212,16 +219,16 @@ void lock_clue_think(edict_t *self) if (!e->count) continue; n = e->count - 1; - if(game.lock_revealed & 1<s.frame = game.lock_code[n] - '0'; else { e->s.frame++; // spin unknown digits - if(e->s.frame > 9) e->s.frame = 0; + if (e->s.frame > 9) e->s.frame = 0; unrevealed_count++; } } - if(unrevealed_count) + if (unrevealed_count) { self->nextthink = level.time + FRAMETIME; gi.linkentity(self); @@ -233,7 +240,7 @@ void lock_clue_initialize(edict_t *self) // show the same numbers across the board. edict_t *e; - if(self->team) + if (self->team) { for (e = self->teammaster; e; e = e->teamchain) { @@ -248,7 +255,9 @@ void lock_clue_initialize(edict_t *self) } void SP_target_lock_clue (edict_t *self) { - if(!self->target && !(self->spawnflags & 1)) + self->class_id = ENTITY_TARGET_LOCK_CLUE; + + if (!self->target && !(self->spawnflags & 1)) { gi.dprintf("non-crosslevel target_lock_clue w/o target\n"); G_FreeEdict(self); diff --git a/missionpack/g_mappack.c b/missionpack/g_mappack.c index 04d51b7..4a64ca6 100644 --- a/missionpack/g_mappack.c +++ b/missionpack/g_mappack.c @@ -23,6 +23,8 @@ void torch_think (edict_t *self) void SP_light_torch (edict_t *self) // New function by Beel. { + self->class_id = ENTITY_LIGHT_TORCH; + self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; self->s.modelindex = gi.modelindex ("models/torch/tris.md2"); @@ -64,6 +66,8 @@ void bigflame_think (edict_t *self) void SP_light_flame (edict_t *self) // New function by Beel. (small flame) { + self->class_id = ENTITY_LIGHT_FLAME; + self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; VectorSet (self->mins, -8, -8, 0); @@ -336,7 +340,7 @@ void SP_model_spawn (edict_t *ent) { char modelname[256]; - //paranoia check + // paranoia check if ((!ent->usermodel) && (!ent->spawnflags & NO_MODEL) && !(ent->spawnflags & PLAYER_MODEL)) { gi.dprintf("%s without a model and without NO_MODEL spawnflag at %s\n", ent->classname, vtos(ent->s.origin)); @@ -344,6 +348,8 @@ void SP_model_spawn (edict_t *ent) return; } + ent->class_id = ENTITY_MODEL_SPAWN; + switch (ent->solidstate) { case 1 : ent->solid = SOLID_NOT; ent->movetype = MOVETYPE_NONE; break; diff --git a/missionpack/g_misc.c b/missionpack/g_misc.c index 7c49736..6096a20 100644 --- a/missionpack/g_misc.c +++ b/missionpack/g_misc.c @@ -39,6 +39,8 @@ Usually enclosed in the middle of a door. */ void SP_func_areaportal (edict_t *ent) { + ent->class_id = ENTITY_FUNC_AREAPORTAL; + ent->use = Use_Areaportal; ent->count = 0; // always start closed; } @@ -309,6 +311,7 @@ void ThrowGib (edict_t *self, char *gibname, int damage, int type) //PGM gib->s.renderfx |= RF_IR_VISIBLE; //PGM + self->class_id = ENTITY_GIB; gi.linkentity (gib); } @@ -464,6 +467,7 @@ void ThrowHead (edict_t *self, char *gibname, int damage, int type) //PGM self->s.renderfx |= RF_IR_VISIBLE; //PGM + self->class_id = ENTITY_GIBHEAD; gi.linkentity (self); } @@ -606,6 +610,8 @@ void ThrowDebris (edict_t *self, char *modelname, float speed, vec3_t origin, in chunk->s.skinnum = skin; chunk->s.effects |= effects; + chunk->class_id = ENTITY_DEBRIS; + gi.linkentity (chunk); } @@ -785,6 +791,8 @@ void SP_path_corner (edict_t *self) return; } + self->class_id = ENTITY_PATH_CORNER; + self->solid = SOLID_TRIGGER; self->touch = path_corner_touch; VectorSet (self->mins, -8, -8, -8); @@ -880,6 +888,9 @@ void SP_point_combat (edict_t *self) G_FreeEdict (self); return; } + + self->class_id = ENTITY_POINT_COMBAT; + self->solid = SOLID_TRIGGER; self->touch = point_combat_touch; VectorSet (self->mins, -8, -8, -16); @@ -902,6 +913,7 @@ void SP_viewthing(edict_t *ent) { gi.dprintf ("viewthing spawned\n"); + ent->class_id = ENTITY_VIEWTHING; ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.renderfx = RF_FRAMELERP; @@ -929,6 +941,8 @@ Used as a positional target for lightning. */ void SP_info_notnull (edict_t *self) { + self->class_id = ENTITY_INFO_NOTNULL; + VectorCopy (self->s.origin, self->absmin); VectorCopy (self->s.origin, self->absmax); }; @@ -973,6 +987,8 @@ void SP_light (edict_t *self) return; } + self->class_id = ENTITY_LIGHT; + if (self->style >= 32) { self->use = light_use; @@ -1142,6 +1158,8 @@ void SP_func_object (edict_t *self) self->clipmask = MASK_MONSTERSOLID; + self->class_id = ENTITY_FUNC_OBJECT; + gi.linkentity (self); } @@ -1367,14 +1385,14 @@ void func_explosive_explode (edict_t *self) G_UseTargets (self, self->activator); - //Knightmare- support for deathtarget + // Knightmare- support for deathtarget if (self->deathtarget) { self->target = self->deathtarget; G_UseTargets (self, self->activator); } - //Knightmare- support for destroytarget + // Knightmare- support for destroytarget if (self->destroytarget) { self->target = self->destroytarget; @@ -1528,6 +1546,8 @@ void SP_func_explosive (edict_t *self) return; } + self->class_id = ENTITY_FUNC_EXPLOSIVE; + self->movetype = MOVETYPE_PUSH; PrecacheDebris(self->gib_type); @@ -1589,7 +1609,7 @@ void SP_func_explosive (edict_t *self) gi.linkentity (self); } -void PrecacheDebris(int type) +void PrecacheDebris (int type) { int i; @@ -1698,7 +1718,7 @@ void func_breakaway_hit (edict_t *self, edict_t *other, cplane_t *plane, csurfac } if (plane && plane->normal) { - //roll in direction of movement + // roll in direction of movement if (!(self->spawnflags & BREAKAWAY_TARGET_ANGLE)) { vectoangles (self->velocity, self->avelocity); @@ -1839,7 +1859,7 @@ void func_breakaway_die (edict_t *self, edict_t *inflictor, edict_t *attacker, i self->takedamage = DAMAGE_NO; self->die = NULL; if (self->delay > 0) - { //Knightmare- clean up child movement stuff here + { // Knightmare- clean up child movement stuff here VectorClear(self->avelocity); self->movewith = ""; self->movewith_set = 0; @@ -1852,7 +1872,7 @@ void func_breakaway_die (edict_t *self, edict_t *inflictor, edict_t *attacker, i func_breakaway_fall (self); } -void func_breakaway_use(edict_t *self, edict_t *other, edict_t *activator) +void func_breakaway_use (edict_t *self, edict_t *other, edict_t *activator) { func_breakaway_die (self, self, other, self->speed, vec3_origin); } @@ -1910,6 +1930,8 @@ void func_breakaway_activate(edict_t *self, edict_t *other, edict_t *activator) void SP_func_breakaway (edict_t *self) { + self->class_id = ENTITY_FUNC_BREAKAWAY; + self->movetype = MOVETYPE_PUSH; gi.setmodel (self, self->model); G_SetMovedir (self->s.angles, self->movedir); @@ -1937,7 +1959,7 @@ void SP_func_breakaway (edict_t *self) { if (!self->duration) self->duration = 5.0; - //must stop rotating AFTER becoming solid + // must stop rotating AFTER becoming solid if (self->duration <= self->wait) self->duration = self->wait + FRAMETIME; } @@ -1976,9 +1998,9 @@ void SP_func_breakaway (edict_t *self) self->takedamage = DAMAGE_YES; } - self->postthink = train_move_children; //supports movewith + self->postthink = train_move_children; // supports movewith - //touch function for impact damage + // touch function for impact damage self->touch = func_breakaway_touch; gi.linkentity (self); @@ -2226,6 +2248,8 @@ void SP_misc_explobox (edict_t *self) //PGM self->common_name = "Exploding Barrel"; + self->class_id = ENTITY_MISC_EXPLOBOX; + gi.linkentity (self); } @@ -2237,7 +2261,7 @@ void SP_misc_explobox (edict_t *self) /*QUAKED misc_blackhole (1 .5 0) (-8 -8 -8) (8 8 8) */ -//David Hyde's prethink function +// David Hyde's prethink function void misc_blackhole_transparent (edict_t *ent) { // Lazarus: This avoids the problem mentioned below. @@ -2270,6 +2294,8 @@ void misc_blackhole_think (edict_t *self) void SP_misc_blackhole (edict_t *ent) { + ent->class_id = ENTITY_MISC_BLACKHOLE; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_NOT; VectorSet (ent->mins, -64, -64, 0); @@ -2299,8 +2325,10 @@ void misc_eastertank_think (edict_t *self) void SP_misc_eastertank (edict_t *ent) { + ent->class_id = ENTITY_MISC_EASTERTANK; + ent->movetype = MOVETYPE_NONE; - if (ent->spawnflags & 1) //Knightmare- not solid flag + if (ent->spawnflags & 1) // Knightmare- not solid flag ent->solid = SOLID_NOT; else ent->solid = SOLID_BBOX; @@ -2308,7 +2336,7 @@ void SP_misc_eastertank (edict_t *ent) VectorSet (ent->maxs, 32, 32, 32); ent->s.modelindex = gi.modelindex ("models/monsters/tank/tris.md2"); ent->s.frame = 254; - if (ent->spawnflags & 2) //Knightmare- commander skin + if (ent->spawnflags & 2) // Knightmare- commander skin ent->s.skinnum = 2; ent->think = misc_eastertank_think; ent->nextthink = level.time + 2 * FRAMETIME; @@ -2332,6 +2360,8 @@ void misc_easterchick_think (edict_t *self) void SP_misc_easterchick (edict_t *ent) { + ent->class_id = ENTITY_MISC_EASTERCHICK; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet (ent->mins, -32, -32, 0); @@ -2360,6 +2390,8 @@ void misc_easterchick2_think (edict_t *self) void SP_misc_easterchick2 (edict_t *ent) { + ent->class_id = ENTITY_MISC_EASTERCHICK2; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet (ent->mins, -32, -32, 0); @@ -2403,6 +2435,8 @@ void commander_body_drop (edict_t *self) void SP_monster_commander_body (edict_t *self) { + self->class_id = ENTITY_MONSTER_COMMANDER_BODY; + self->movetype = MOVETYPE_NONE; self->solid = SOLID_BBOX; self->model = "models/monsters/commandr/tris.md2"; @@ -2435,6 +2469,8 @@ void misc_banner_think (edict_t *ent) void SP_misc_banner (edict_t *ent) { + ent->class_id = ENTITY_MISC_BANNER; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_NOT; ent->s.modelindex = gi.modelindex ("models/objects/banner/tris.md2"); @@ -2524,6 +2560,7 @@ void SP_misc_deadsoldier (edict_t *ent) ent->s.skinnum = ent->style; } ent->common_name = "Dead Marine"; + ent->class_id = ENTITY_MISC_DEADSOLDIER; gi.linkentity (ent); } @@ -2700,14 +2737,14 @@ void SP_misc_crashviper (edict_t *ent) ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_NOT; - //Mappack + // Mappack if (ent->spawnflags & 2) { ent->s.modelindex = gi.modelindex ("models/ships/viper/tris.md2"); VectorSet (ent->mins, -16, -16, 0); VectorSet (ent->maxs, 16, 16, 32); - } //Mappack + } // Mappack else { ent->s.modelindex = gi.modelindex ("models/ships/bigviper/tris.md2"); @@ -2730,7 +2767,7 @@ void SP_misc_crashviper (edict_t *ent) else ent->smooth_movement = 0; - //Knightmare- change both rotate flags to spline flag + // Knightmare- change both rotate flags to spline flag if ((ent->spawnflags & TRAIN_ROTATE) && (ent->spawnflags &TRAIN_ROT_CONST)) { ent->spawnflags &= ~TRAIN_ROTATE; @@ -2738,7 +2775,7 @@ void SP_misc_crashviper (edict_t *ent) ent->spawnflags |= TRAIN_SPLINE; } - //Mappack + // Mappack if (!ent->accel) ent->moveinfo.accel = ent->speed; else @@ -2748,7 +2785,7 @@ void SP_misc_crashviper (edict_t *ent) else ent->moveinfo.decel = ent->decel; ent->moveinfo.speed = ent->speed; - //Mappack + // Mappack // ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = ent->speed; @@ -2767,6 +2804,8 @@ This is a large stationary viper as seen in Paul's intro */ void SP_misc_bigviper (edict_t *ent) { + ent->class_id = ENTITY_MISC_BIGVIPER; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet (ent->mins, -176, -120, -24); @@ -2922,6 +2961,7 @@ void SP_misc_viper_bomb (edict_t *self) self->use = misc_viper_bomb_use; self->svflags |= SVF_NOCLIENT; self->common_name = "Bomb"; + self->class_id = ENTITY_MISC_VIPER_BOMB; gi.linkentity (self); } @@ -2974,6 +3014,7 @@ void SP_misc_viper_missile (edict_t *self) self->use = misc_viper_missile_use; self->svflags |= SVF_NOCLIENT; self->common_name = "Missile Shooter"; + self->class_id = ENTITY_MISC_VIPER_MISSILE; gi.linkentity (self); } @@ -3290,6 +3331,8 @@ void SP_misc_transport (edict_t *ent) return; } + ent->class_id = ENTITY_MISC_TRANSPORT; + if (!ent->speed) ent->speed = 300; @@ -3358,6 +3401,8 @@ void misc_satellite_dish_use (edict_t *self, edict_t *other, edict_t *activator) void SP_misc_satellite_dish (edict_t *ent) { + ent->class_id = ENTITY_MISC_SATELLITE_DISH; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; VectorSet (ent->mins, -64, -64, 0); @@ -3372,6 +3417,8 @@ void SP_misc_satellite_dish (edict_t *ent) */ void SP_light_mine1 (edict_t *ent) { + ent->class_id = ENTITY_LIGHT_MINE1; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.modelindex = gi.modelindex ("models/objects/minelite/light1/tris.md2"); @@ -3384,6 +3431,8 @@ void SP_light_mine1 (edict_t *ent) */ void SP_light_mine2 (edict_t *ent) { + ent->class_id = ENTITY_LIGHT_MINE2; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->s.modelindex = gi.modelindex ("models/objects/minelite/light2/tris.md2"); @@ -3397,6 +3446,8 @@ Intended for use with the target_spawner */ void SP_misc_gib_arm (edict_t *ent) { + ent->class_id = ENTITY_MISC_GIB_ARM; + gi.setmodel (ent, "models/objects/gibs/arm/tris.md2"); ent->solid = SOLID_NOT; ent->s.effects |= EF_GIB; @@ -3418,6 +3469,8 @@ Intended for use with the target_spawner */ void SP_misc_gib_leg (edict_t *ent) { + ent->class_id = ENTITY_MISC_GIB_LEG; + gi.setmodel (ent, "models/objects/gibs/leg/tris.md2"); ent->solid = SOLID_NOT; ent->s.effects |= EF_GIB; @@ -3439,6 +3492,8 @@ Intended for use with the target_spawner */ void SP_misc_gib_head (edict_t *ent) { + ent->class_id = ENTITY_MISC_GIB_HEAD; + gi.setmodel (ent, "models/objects/gibs/head/tris.md2"); ent->solid = SOLID_NOT; ent->s.effects |= EF_GIB; @@ -3464,6 +3519,8 @@ used with target_string (must be on same "team") void SP_target_character (edict_t *self) { + self->class_id = ENTITY_TARGET_CHARACTER; + self->movetype = MOVETYPE_PUSH; gi.setmodel (self, self->model); self->solid = SOLID_BSP; @@ -3511,6 +3568,8 @@ void SP_target_string (edict_t *self) if (!self->message) self->message = ""; self->use = target_string_use; + + self->class_id = ENTITY_TARGET_STRING; } @@ -3696,6 +3755,8 @@ void SP_func_clock (edict_t *self) self->use = func_clock_use; else self->nextthink = level.time + 1; + + self->class_id = ENTITY_FUNC_CLOCK; } /*================================================================== @@ -4083,6 +4144,8 @@ void SP_misc_teleporter (edict_t *ent) ent->s.renderfx |= RF_IR_VISIBLE; ent->common_name = "Teleporter"; + ent->class_id = ENTITY_MISC_TELEPORTER; + gi.linkentity (ent); trig = G_Spawn (); @@ -4094,13 +4157,13 @@ void SP_misc_teleporter (edict_t *ent) trig->solid = SOLID_TRIGGER; trig->target = ent->target; trig->owner = ent; + // Lazarus trig->movewith = ent->movewith; VectorCopy (ent->s.origin, trig->s.origin); VectorSet (trig->mins, -8, -8, 8); VectorSet (trig->maxs, 8, 8, 24); gi.linkentity (trig); - } void trigger_teleporter_use (edict_t *self, edict_t *other, edict_t *activator) @@ -4154,6 +4217,8 @@ void SP_trigger_teleporter (edict_t *self) else self->solid = SOLID_TRIGGER; + self->class_id = ENTITY_TRIGGER_TELEPORTER; + gi.linkentity (self); } @@ -4217,6 +4282,9 @@ void SP_misc_teleporter_dest (edict_t *ent) ent->s.renderfx |= RF_IR_VISIBLE; // Knightmare added- make IR visible VectorSet (ent->mins, -32, -32, -24); VectorSet (ent->maxs, 32, 32, -16); + + ent->class_id = ENTITY_MISC_TELEPORTER_DEST; + gi.linkentity (ent); } @@ -4233,6 +4301,8 @@ void amb4_think (edict_t *ent) void SP_misc_amb4 (edict_t *ent) { + ent->class_id = ENTITY_MISC_AMB4; + ent->think = amb4_think; ent->nextthink = level.time + 1; amb4sound = gi.soundindex ("world/amb4.wav"); @@ -4254,6 +4324,8 @@ toggles visible/not visible. starts visible. */ void SP_misc_nuke_core (edict_t *ent) { + ent->class_id = ENTITY_MISC_NUKE_CORE; + gi.setmodel (ent, "models/objects/core/tris.md2"); ent->s.renderfx |= RF_IR_VISIBLE; gi.linkentity (ent); @@ -4289,10 +4361,12 @@ void use_nuke (edict_t *self, edict_t *other, edict_t *activator) void SP_misc_nuke (edict_t *ent) { + ent->class_id = ENTITY_MISC_NUKE; + ent->use = use_nuke; } -//Knightmare- moved Xatrix rotating light and repair object here +// Knightmare- moved Xatrix rotating light and repair object here /*QUAKED rotating_light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF ALARM "health" if set, the light may be killed. @@ -4400,8 +4474,9 @@ void SP_rotating_light (edict_t *self) self->moveinfo.sound_start = gi.soundindex ("misc/alarm.wav"); } - gi.linkentity (self); + self->class_id = ENTITY_ROTATING_LIGHT; + gi.linkentity (self); } /*QUAKED func_object_repair (1 .5 0) (-8 -8 -8) (8 8 8) @@ -4458,6 +4533,8 @@ void object_repair_sparks (edict_t *ent) void SP_object_repair (edict_t *ent) { + ent->class_id = ENTITY_OBJECT_REPAIR; + ent->movetype = MOVETYPE_NONE; ent->solid = SOLID_BBOX; ent->classname = "object_repair"; @@ -4496,6 +4573,13 @@ void misc_sick_guard_think (edict_t *ent) void SP_misc_sick_guard (edict_t *self) { + self->class_id = ENTITY_MISC_SICK_GUARD; + + // precache + gi.soundindex ("monsters/sick_guard/patient1b.wav"); + gi.soundindex ("monsters/sick_guard/patient2.wav"); + gi.soundindex ("monsters/sick_guard/patient3.wav"); + self->movetype = MOVETYPE_NONE; self->solid = SOLID_BBOX; VectorSet (self->mins, -24, -32, -26); @@ -4519,11 +4603,11 @@ model="models/monsters/gekk_writhe/" */ void misc_gekk_writhe_think (edict_t *self) { - if (++self->s.frame < FRAME_death4_35) //was FRAME_death4_07 + if (++self->s.frame < FRAME_death4_35) // was FRAME_death4_07 self->nextthink = level.time + FRAMETIME; else { - self->s.frame = FRAME_death4_01; //was FRAME_death4_03 + self->s.frame = FRAME_death4_01; // was FRAME_death4_03 self->nextthink = level.time + FRAMETIME; } } @@ -4549,6 +4633,8 @@ void misc_gekk_writhe_use (edict_t *self, edict_t *other, edict_t *activator) void SP_misc_gekk_writhe (edict_t *self) { + self->class_id = ENTITY_MISC_GEKK_WRITHE; + self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; VectorSet (self->mins, -24, -24, -24); @@ -4627,6 +4713,8 @@ void light_flame_spawn (edict_t *self) void SP_light_flame1 (edict_t *self) { + self->class_id = ENTITY_LIGHT_FLAME_CM; + self->s.modelindex = gi.modelindex ("sprites/s_flame1.sp2"); VectorSet(self->mins,-48,-48,-32); VectorSet(self->maxs, 48, 48, 64); @@ -4635,6 +4723,8 @@ void SP_light_flame1 (edict_t *self) void SP_light_flame1s (edict_t *self) { + self->class_id = ENTITY_LIGHT_FLAME_CM; + self->s.modelindex = gi.modelindex ("sprites/s_flame1s.sp2"); VectorSet(self->mins,-16,-16,-16); VectorSet(self->maxs, 16, 16, 32); @@ -4643,6 +4733,8 @@ void SP_light_flame1s (edict_t *self) void SP_light_flame2 (edict_t *self) { + self->class_id = ENTITY_LIGHT_FLAME_CM; + self->s.modelindex = gi.modelindex ("sprites/s_flame2.sp2"); VectorSet(self->mins,-48,-48,-32); VectorSet(self->maxs, 48, 48, 64); @@ -4651,6 +4743,8 @@ void SP_light_flame2 (edict_t *self) void SP_light_flame2s (edict_t *self) { + self->class_id = ENTITY_LIGHT_FLAME_CM; + self->s.modelindex = gi.modelindex ("sprites/s_flame2s.sp2"); VectorSet(self->mins,-16,-16,-16); VectorSet(self->maxs, 16, 16, 32); @@ -4693,6 +4787,8 @@ void SP_monster_coco_monkey (edict_t *self) self->think = monster_coco_monkey_think; self->common_name = "Coconut Monkey"; + self->class_id = ENTITY_MONSTER_COCO_MONKEY; + gi.linkentity (self); } @@ -4729,6 +4825,8 @@ void misc_light_use (edict_t *self, edict_t *other, edict_t *activator) void SP_misc_light (edict_t *self) { + self->class_id = ENTITY_MISC_LIGHT; + self->use = misc_light_use; if (self->movewith) self->movetype = MOVETYPE_PUSH; diff --git a/missionpack/g_misc_q1.c b/missionpack/g_misc_q1.c index 655c08b..ca078d2 100644 --- a/missionpack/g_misc_q1.c +++ b/missionpack/g_misc_q1.c @@ -30,6 +30,9 @@ frame="192" */ void SP_misc_q1_zombie_crucified (edict_t *self) { + // precache + gi.soundindex ("q1zombie/idle_w2.wav"); + self->movetype = MOVETYPE_NONE; self->solid = SOLID_NOT; VectorSet (self->mins, -16, -16, -24); @@ -38,6 +41,7 @@ void SP_misc_q1_zombie_crucified (edict_t *self) self->s.frame = 192; self->common_name = "Crucified Zombie"; + self->class_id = ENTITY_MISC_Q1_ZOMBIE_CRUCIFIED; gi.linkentity (self); @@ -157,6 +161,7 @@ void make_bubbles (edict_t *self) bubble->count = 0; bubble->common_name = "Bubble"; + bubble->class_id = ENTITY_Q1_BUBBLE; gi.linkentity (bubble); @@ -174,6 +179,9 @@ void SP_misc_q1_air_bubbles (edict_t *self) G_FreeEdict (self); return; } + + self->class_id = ENTITY_MISC_Q1_BUBBLE_SPAWNER; + gi.modelindex ("sprites/s_bubble.sp2"); self->nextthink = level.time + 1; self->think = make_bubbles; @@ -197,6 +205,7 @@ void SP_misc_q1_globe(edict_t *self) self->s.sound = 0; self->common_name = "Globe Light"; + self->class_id = ENTITY_MISC_Q1_GLOBE; gi.linkentity (self); } @@ -230,6 +239,7 @@ void SP_misc_q1_small_flame (edict_t *ent) ent->think = q1_small_flame_think; ent->common_name = "Small Flame"; + ent->class_id = ENTITY_MISC_Q1_FLAME_SMALL; gi.linkentity (ent); } @@ -264,6 +274,7 @@ void SP_misc_q1_large_flame (edict_t *ent) ent->s.renderfx = RF_FULLBRIGHT | RF_NOSHADOW; ent->common_name = "Large Flame"; + ent->class_id = ENTITY_MISC_Q1_FLAME_LARGE; gi.linkentity (ent); } @@ -297,6 +308,7 @@ void SP_misc_q1_torch (edict_t *ent) ent->think = q1_torch_think; ent->common_name = "Torch"; + ent->class_id = ENTITY_MISC_Q1_TORCH; gi.linkentity (ent); } @@ -335,9 +347,12 @@ damage 9 for spike, 15 for superspike, 15 for laser */ void SP_target_q1_trap (edict_t *self) { + self->class_id = ENTITY_TARGET_Q1_TRAPSHOOTER; + self->use = q1_use_target_trapshooter; G_SetMovedir (self->s.angles, self->movedir); - if (self->spawnflags & 2) { + if (self->spawnflags & 2) + { self->noise_index = gi.soundindex ("q1enforcer/enfire.wav"); gi.soundindex("q1enforcer/enfstop.wav"); if (!self->speed) @@ -488,6 +503,10 @@ model="models/objects/q1explo/big/" */ void SP_misc_q1_explobox (edict_t *self) { + // precache + gi.modelindex ("sprites/s_explod.sp2"); + gi.soundindex ("q1weap/rocket/r_exp3.wav"); + self->solid = SOLID_BBOX; //self->solid = SOLID_NOT; self->movetype = MOVETYPE_NONE; @@ -523,6 +542,7 @@ void SP_misc_q1_explobox (edict_t *self) self->nextthink = level.time + 2 * FRAMETIME; self->common_name = "Exploding Box"; + self->class_id = ENTITY_MISC_Q1_EXPLOBOX; gi.linkentity (self); } @@ -571,6 +591,7 @@ void q1_fireball_fly (edict_t *self) lavaball->classname = "lavaball"; lavaball->common_name = "Lavaball"; + lavaball->class_id = ENTITY_Q1_FIREBALL; gi.linkentity (lavaball); @@ -583,12 +604,15 @@ model="models/monsters/q1chthon/lavaball/" */ void SP_misc_q1_fireball (edict_t *self) { + // precache gi.modelindex ("models/monsters/q1chthon/lavaball/tris.md2"); + self->nextthink = level.time + (4 + (random() * 3.0)); self->think = q1_fireball_fly; self->classname = "fireball"; self->common_name = "Lavaball Spawner"; + self->class_id = ENTITY_MISC_Q1_FIREBALL_SPAWNER; gi.linkentity(self); } diff --git a/missionpack/g_newai.c b/missionpack/g_newai.c index c9ac034..d2f94a5 100644 --- a/missionpack/g_newai.c +++ b/missionpack/g_newai.c @@ -1099,6 +1099,8 @@ void SP_hint_path (edict_t *self) return; } + self->class_id = ENTITY_HINT_PATH; + // Lazarus: Corrections for mappers that can't follow instructions :-) if (!self->targetname) self->spawnflags |= HINT_ENDPOINT; diff --git a/missionpack/g_newdm.c b/missionpack/g_newdm.c index 39e228a..2c35491 100644 --- a/missionpack/g_newdm.c +++ b/missionpack/g_newdm.c @@ -361,6 +361,7 @@ void fire_doppleganger (edict_t *ent, vec3_t start, vec3_t aimdir) base->think = doppleganger_timeout; base->classname = "doppleganger"; + base->class_id = ENTITY_DOPPLEGANGER; gi.linkentity (base); diff --git a/missionpack/g_newfnc.c b/missionpack/g_newfnc.c index 3e63ae0..b9c6716 100644 --- a/missionpack/g_newfnc.c +++ b/missionpack/g_newfnc.c @@ -182,7 +182,7 @@ void fd_secret_done (edict_t *self) if (!self->targetname || self->spawnflags & SEC_YES_SHOOT) { // self->health = 1; - self->health = self->max_health; + self->health = self->max_health; // Knightmare- restore max health self->takedamage = DAMAGE_YES; self->die = fd_secret_killed; } @@ -239,8 +239,8 @@ void secret_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s { gi.centerprintf (other, self->message); gi.sound (other, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0); -// fixme - put this sound back?? -// gi.sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM); + // fixme - put this sound back?? + // gi.sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM); } } @@ -290,14 +290,17 @@ void SP_func_door_secret2 (edict_t *ent) ent->moveinfo.sound_end = 0; } + if (ent->attenuation <= 0) + ent->attenuation = ATTN_STATIC; + if (!ent->dmg) ent->dmg = 2; - AngleVectors(ent->s.angles, forward, right, up); - VectorCopy(ent->s.origin, ent->pos0); - VectorCopy(ent->s.angles, ent->move_angles); - + AngleVectors (ent->s.angles, forward, right, up); + VectorCopy (ent->s.origin, ent->pos0); + VectorCopy (ent->s.angles, ent->move_angles); G_SetMovedir (ent->s.angles, ent->movedir); + ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; gi.setmodel (ent, ent->model); @@ -321,24 +324,24 @@ void SP_func_door_secret2 (edict_t *ent) } if (ent->spawnflags & SEC_MOVE_FORWARD) - VectorScale(forward, ent->length, forward); + VectorScale (forward, ent->length, forward); else - VectorScale(forward, ent->length * -1 , forward); + VectorScale (forward, ent->length * -1 , forward); if (ent->spawnflags & SEC_MOVE_RIGHT) - VectorScale(right, ent->width, right); + VectorScale (right, ent->width, right); else - VectorScale(right, ent->width * -1, right); + VectorScale (right, ent->width * -1, right); if (ent->spawnflags & SEC_1ST_DOWN) { - VectorAdd(ent->s.origin, forward, ent->pos1); // was ent->moveinfo.start_origin - VectorAdd(ent->pos1, right, ent->pos2); // was ent->moveinfo.end_origin + VectorAdd (ent->s.origin, forward, ent->pos1); // was ent->moveinfo.start_origin + VectorAdd (ent->pos1, right, ent->pos2); // was ent->moveinfo.end_origin } else { - VectorAdd(ent->s.origin, right, ent->pos1); // was ent->moveinfo.start_origin - VectorAdd(ent->pos1, forward, ent->pos2); // was ent->moveinfo.end_origin + VectorAdd (ent->s.origin, right, ent->pos1); // was ent->moveinfo.start_origin + VectorAdd (ent->pos1, forward, ent->pos2); // was ent->moveinfo.end_origin } ent->touch = secret_touch; @@ -355,13 +358,13 @@ void SP_func_door_secret2 (edict_t *ent) if (!ent->health) { ent->health = 1; } - ent->max_health = ent->health; + ent->max_health = ent->health; // Knightmare- store health value ent->takedamage = DAMAGE_YES; ent->die = fd_secret_killed; } if (!ent->wait) ent->wait = 5; // 5 seconds before closing - ent->postthink = train_move_children; //Knightmare- now supports movewith + ent->postthink = train_move_children; // Knightmare- now supports movewith gi.linkentity(ent); } @@ -383,7 +386,7 @@ void force_wall_think(edict_t *self) } self->think = force_wall_think; - self->nextthink = level.time + 0.1; + self->nextthink = level.time + FRAMETIME; } void force_wall_use (edict_t *self, edict_t *other, edict_t *activator) @@ -516,7 +519,9 @@ void SP_func_dm_wall (edict_t *self) { qboolean spawn = false; - //if it was lower than this something went very wrong. + self->class_id = ENTITY_FUNC_DM_WALL; + + // if it was lower than this something went very wrong. if (self->count > 2) { if (self->count > game.maxclients) diff --git a/missionpack/g_newtarg.c b/missionpack/g_newtarg.c index c44a80a..8fc74cb 100644 --- a/missionpack/g_newtarg.c +++ b/missionpack/g_newtarg.c @@ -118,6 +118,8 @@ void target_steam_start (edict_t *self) void SP_target_steam (edict_t *self) { + self->class_id = ENTITY_TARGET_STEAM; + self->plat2flags = self->speed; if (self->target) @@ -192,7 +194,7 @@ killtarget - entity to be pissed off at */ void SP_target_anger (edict_t *self) { - if(deathmatch->value) + if (deathmatch->value) { G_FreeEdict(self); return; @@ -210,6 +212,8 @@ void SP_target_anger (edict_t *self) return; } + self->class_id = ENTITY_TARGET_ANGER; + self->use = target_anger_use; self->svflags = SVF_NOCLIENT; } @@ -217,30 +221,30 @@ void SP_target_anger (edict_t *self) // target_monsterbattle serves the same purpose as target_anger, but // ends up turning a dmgteam group of monsters against another dmgteam -void use_target_monsterbattle(edict_t *self, edict_t *other, edict_t *activator) +void use_target_monsterbattle (edict_t *self, edict_t *other, edict_t *activator) { edict_t *grouch, *grouchmate; edict_t *target, *targetmate; grouch = G_Find(NULL,FOFS(targetname),self->target); - if(!grouch) return; - if(!grouch->inuse) return; + if (!grouch) return; + if (!grouch->inuse) return; target = G_Find(NULL,FOFS(targetname),self->killtarget); - if(!target) return; - if(!target->inuse) return; - if(grouch->dmgteam) + if (!target) return; + if (!target->inuse) return; + if (grouch->dmgteam) { grouchmate = G_Find(NULL,FOFS(dmgteam),grouch->dmgteam); - while(grouchmate) + while (grouchmate) { grouchmate->monsterinfo.aiflags2 |= AI2_FREEFORALL; grouchmate = G_Find(grouchmate,FOFS(dmgteam),grouch->dmgteam); } } - if(target->dmgteam) + if (target->dmgteam) { targetmate = G_Find(NULL,FOFS(dmgteam),target->dmgteam); - while(targetmate) + while (targetmate) { targetmate->monsterinfo.aiflags2 |= AI2_FREEFORALL; targetmate = G_Find(targetmate,FOFS(dmgteam),target->dmgteam); @@ -251,31 +255,34 @@ void use_target_monsterbattle(edict_t *self, edict_t *other, edict_t *activator) FoundTarget(grouch); self->count--; - if(self->count == 0) + if (self->count == 0) { self->think = G_FreeEdict; self->nextthink = level.time + 1; } } -void SP_target_monsterbattle(edict_t *self) +void SP_target_monsterbattle (edict_t *self) { - if(deathmatch->value) + if (deathmatch->value) { G_FreeEdict(self); return; } - if(!self->target) + if (!self->target) { gi.dprintf("target_monsterbattle with no target set at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } - if(!self->killtarget) + if (!self->killtarget) { gi.dprintf("target_monsterbattle with no killtarget set at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } + + self->class_id = ENTITY_TARGET_MONSTERBATTLE; + self->use = use_target_monsterbattle; } @@ -290,7 +297,7 @@ void target_spawn_use (edict_t *self, edict_t *other, edict_t *activator) edict_t *newEnt; newEnt = CreateMonster (self->s.origin, self->s.angles, "monster_infantry"); - if(newEnt) + if (newEnt) newEnt->enemy = other; } */ @@ -335,13 +342,13 @@ void target_killplayers_use (edict_t *self, edict_t *other, edict_t *activator) if (!ent->takedamage) continue; - for(i=0;iinuse) + if (!player->inuse) continue; - if(visible(player, ent)) + if (visible(player, ent)) { T_Damage (ent, self, self, vec3_origin, ent->s.origin, vec3_origin, ent->health, 0, DAMAGE_NO_PROTECTION, MOD_TELEFRAG); @@ -357,6 +364,8 @@ When triggered, this will kill all the players on the map. */ void SP_target_killplayers (edict_t *self) { + self->class_id = ENTITY_TARGET_KILLPLAYERS; + self->use = target_killplayers_use; self->svflags = SVF_NOCLIENT; } @@ -372,7 +381,7 @@ void blacklight_think (edict_t *self) self->nextthink = level.time + 0.1; } -void SP_target_blacklight(edict_t *ent) +void SP_target_blacklight (edict_t *ent) { if (deathmatch->value) { // auto-remove for deathmatch @@ -380,6 +389,8 @@ void SP_target_blacklight(edict_t *ent) return; } + ent->class_id = ENTITY_TARGET_BLACKLIGHT; + VectorClear (ent->mins); VectorClear (ent->maxs); @@ -403,7 +414,7 @@ void orb_think (edict_t *self) self->nextthink = level.time + 0.1; } -void SP_target_orb(edict_t *ent) +void SP_target_orb (edict_t *ent) { if (deathmatch->value) { // auto-remove for deathmatch @@ -411,6 +422,8 @@ void SP_target_orb(edict_t *ent) return; } + ent->class_id = ENTITY_TARGET_ORB; + VectorClear (ent->mins); VectorClear (ent->maxs); @@ -447,12 +460,15 @@ void target_command_use (edict_t *self, edict_t *activator, edict_t *other) void SP_target_command (edict_t *self) { - if(!self->message) + if (!self->message) { gi.dprintf("target_command with no command, target name is %s at %s", self->targetname, vtos(self->s.origin)); G_FreeEdict (self); return; } + + self->class_id = ENTITY_TARGET_COMMAND; + self->use = target_command_use; self->svflags = SVF_NOCLIENT; gi.linkentity (self); @@ -525,14 +541,14 @@ void target_set_effect_use (edict_t *self, edict_t *activator, edict_t *other) edict_t *target; target = G_Find (NULL, FOFS(targetname), self->target); - while(target) + while (target) { - if(self->style == 1) + if (self->style == 1) { target->s.effects &= ~self->effects; target->s.renderfx &= ~self->renderfx; } - else if(self->style == 2) + else if (self->style == 2) { target->s.effects ^= self->effects; target->s.renderfx ^= self->renderfx; @@ -553,12 +569,15 @@ void target_set_effect_use (edict_t *self, edict_t *activator, edict_t *other) void SP_target_set_effect (edict_t *self) { - if(!self->target) + if (!self->target) { gi.dprintf("target_set_effect w/o a target at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } + + self->class_id = ENTITY_TARGET_SET_EFFECT; + self->use = target_set_effect_use; self->svflags = SVF_NOCLIENT; gi.linkentity (self); @@ -593,6 +612,8 @@ void SP_target_global_text (edict_t *self) return; } + self->class_id = ENTITY_TARGET_GLOBAL_TEXT; + self->use = target_global_text_use; self->svflags = SVF_NOCLIENT; gi.linkentity (self); @@ -729,7 +750,7 @@ void target_effect_steam (edict_t *self, edict_t *activator) static int nextid; int wait; - if(self->wait) + if (self->wait) wait = self->wait*1000; else wait = 0; @@ -795,9 +816,9 @@ void target_effect_trail (edict_t *self, edict_t *activator) { edict_t *target; - if(!self->target) return; + if (!self->target) return; target = G_Find(NULL,FOFS(targetname),self->target); - if(!target) return; + if (!target) return; gi.WriteByte(svc_temp_entity); gi.WriteByte(self->style); @@ -815,7 +836,7 @@ void target_effect_trail (edict_t *self, edict_t *activator) // Lazarus reflections if (level.num_reflectors) { - if((self->style == TE_RAILTRAIL) || (self->style == TE_BUBBLETRAIL) || + if ((self->style == TE_RAILTRAIL) || (self->style == TE_BUBBLETRAIL) || (self->style == TE_BFG_LASER) || (self->style == TE_DEBUGTRAIL) || (self->style == TE_BUBBLETRAIL2)) ReflectTrail(self->style,self->s.origin,target->s.origin); @@ -954,27 +975,27 @@ void target_effect_widowbeam(edict_t *self, edict_t *activator) void target_effect_use(edict_t *self, edict_t *other, edict_t *activator) { - if(self->spawnflags & 1) { + if (self->spawnflags & 1) { // currently looped on - turn it off self->spawnflags &= ~1; self->spawnflags |= 2; self->nextthink = 0; return; } - if(self->spawnflags & 2) { + if (self->spawnflags & 2) { // currently looped off - turn it on self->spawnflags &= ~2; self->spawnflags |= 1; self->nextthink = level.time + self->wait; } - if(self->spawnflags & 4) { + if (self->spawnflags & 4) { // "if_moving" set. If movewith target isn't moving, // don't play edict_t *mover; - if(!self->movewith) return; + if (!self->movewith) return; mover = G_Find(NULL,FOFS(targetname),self->movewith); - if(!mover) return; - if(!VectorLength(mover->velocity)) return; + if (!mover) return; + if (!VectorLength(mover->velocity)) return; } self->play(self,activator); } @@ -989,7 +1010,7 @@ void SP_target_effect (edict_t *self) { self->class_id = ENTITY_TARGET_EFFECT; - if(self->movewith) + if (self->movewith) self->movetype = MOVETYPE_PUSH; else self->movetype = MOVETYPE_NONE; @@ -1002,11 +1023,11 @@ void SP_target_effect (edict_t *self) case TE_STEAM: self->play = target_effect_steam; G_SetMovedir (self->s.angles, self->movedir); - if(!self->count) + if (!self->count) self->count = 32; - if(!self->sounds) + if (!self->sounds) self->sounds = 8; - if(!self->speed) + if (!self->speed) self->speed = 75; break; case TE_SPLASH: @@ -1014,7 +1035,7 @@ void SP_target_effect (edict_t *self) case TE_WELDING_SPARKS: self->play = target_effect_splash; G_SetMovedir (self->s.angles, self->movedir); - if(!self->count) + if (!self->count) self->count = 32; break; case TE_RAILTRAIL: @@ -1027,7 +1048,7 @@ void SP_target_effect (edict_t *self) case TE_HEATBEAM: case TE_MONSTER_HEATBEAM: case TE_BUBBLETRAIL2: - if(!self->target) + if (!self->target) { gi.dprintf("%s at %s with style=%d needs a target\n",self->classname,vtos(self->s.origin),self->style); G_FreeEdict(self); @@ -1035,7 +1056,7 @@ void SP_target_effect (edict_t *self) self->play = target_effect_trail; break; case TE_LIGHTNING: - if(!self->target) + if (!self->target) { gi.dprintf("%s at %s with style=%d needs a target\n",self->classname,vtos(self->s.origin),self->style); G_FreeEdict(self); @@ -1083,9 +1104,9 @@ void SP_target_effect (edict_t *self) self->play = target_effect_explosion; break; case TE_TUNNEL_SPARKS: - if(!self->count) + if (!self->count) self->count = 32; - if(!self->sounds) + if (!self->sounds) self->sounds = 116; // Light blue, same color used by Xatrix self->play = target_effect_tunnel_sparks; break; @@ -1098,7 +1119,7 @@ void SP_target_effect (edict_t *self) } self->use = target_effect_use; self->think = target_effect_think; - if(self->spawnflags & 1) + if (self->spawnflags & 1) self->nextthink = level.time + 1; } @@ -1148,6 +1169,8 @@ void target_movewith_use (edict_t *self, edict_t *activator, edict_t *other) void SP_target_movewith (edict_t *self) { + self->class_id = ENTITY_TARGET_MOVEWITH; + if (!self->targetname) gi.dprintf("target_movewith without a targetname at %s\n", vtos(self->s.origin)); if (!self->target) @@ -1184,91 +1207,91 @@ void target_change_use (edict_t *self, edict_t *activator, edict_t *other) int newteams=0; edict_t *target_ent; - if(!self->target) + if (!self->target) return; L = (int)strlen(self->target); buffer = (char *)gi.TagMalloc(L+1, TAG_LEVEL); strcpy(buffer, self->target); newtarget = strstr(buffer,","); - if(newtarget) + if (newtarget) { *newtarget = 0; newtarget++; } target = buffer; target_ent = G_Find(NULL,FOFS(targetname),target); - while(target_ent) + while (target_ent) { - if(newtarget && strlen(newtarget)) + if (newtarget && strlen(newtarget)) target_ent->target = G_CopyString(newtarget); - if(self->newtargetname && strlen(self->newtargetname)) + if (self->newtargetname && strlen(self->newtargetname)) target_ent->targetname = G_CopyString(self->newtargetname); - if(self->team && strlen(self->team)) + if (self->team && strlen(self->team)) { target_ent->team = G_CopyString(self->team); newteams++; } - if(VectorLength(self->s.angles)) + if (VectorLength(self->s.angles)) { VectorCopy (self->s.angles, target_ent->s.angles); - if(target_ent->solid == SOLID_BSP) + if (target_ent->solid == SOLID_BSP) G_SetMovedir (target_ent->s.angles, target_ent->movedir); } - if(self->deathtarget && strlen(self->deathtarget)) + if (self->deathtarget && strlen(self->deathtarget)) target_ent->deathtarget = G_CopyString(self->deathtarget); - if(self->pathtarget && strlen(self->pathtarget)) + if (self->pathtarget && strlen(self->pathtarget)) target_ent->pathtarget = G_CopyString(self->pathtarget); - if(self->killtarget && strlen(self->killtarget)) + if (self->killtarget && strlen(self->killtarget)) target_ent->killtarget = G_CopyString(self->killtarget); - if(self->message && strlen(self->message)) + if (self->message && strlen(self->message)) target_ent->message = G_CopyString(self->message); - if(self->delay > 0) + if (self->delay > 0) target_ent->delay = self->delay; - if(self->dmg > 0) + if (self->dmg > 0) target_ent->dmg = self->dmg; - if(self->health > 0) + if (self->health > 0) target_ent->health = self->health; - if(self->mass > 0) + if (self->mass > 0) target_ent->mass = self->mass; - if(self->pitch_speed > 0) + if (self->pitch_speed > 0) target_ent->pitch_speed = self->pitch_speed; - if(self->random > 0) + if (self->random > 0) target_ent->random = self->random; - if(self->roll_speed > 0) + if (self->roll_speed > 0) target_ent->roll_speed = self->roll_speed; - if(self->wait > 0) + if (self->wait > 0) target_ent->wait = self->wait; - if(self->yaw_speed > 0) + if (self->yaw_speed > 0) target_ent->yaw_speed = self->yaw_speed; - if(self->noise_index) + if (self->noise_index) { - if(target_ent->s.sound == target_ent->noise_index) + if (target_ent->s.sound == target_ent->noise_index) target_ent->s.sound = target_ent->noise_index = self->noise_index; else target_ent->noise_index = self->noise_index; } #ifdef LOOP_SOUND_ATTENUATION - if(self->attenuation) + if (self->attenuation) { - if(target_ent->s.attenuation == target_ent->attenuation) + if (target_ent->s.attenuation == target_ent->attenuation) target_ent->s.attenuation = target_ent->attenuation = self->attenuation; else target_ent->attenuation = self->attenuation; } #endif - if(self->spawnflags) + if (self->spawnflags) { target_ent->spawnflags = self->spawnflags; // special cases: - if(!Q_stricmp(target_ent->classname,"model_train")) + if (!Q_stricmp(target_ent->classname,"model_train")) { - if(target_ent->spawnflags & 32) + if (target_ent->spawnflags & 32) { target_ent->spawnflags &= ~32; target_ent->spawnflags |= 8; } - if(target_ent->spawnflags & 64) + if (target_ent->spawnflags & 64) { target_ent->spawnflags &= ~64; target_ent->spawnflags |= 16; @@ -1279,12 +1302,14 @@ void target_change_use (edict_t *self, edict_t *activator, edict_t *other) target_ent = G_Find(target_ent,FOFS(targetname),target); } gi.TagFree(buffer); - if(newteams) + if (newteams) G_FindTeams(); } void SP_target_change (edict_t *self) { + self->class_id = ENTITY_TARGET_CHANGE; + if (!self->targetname) gi.dprintf("target_change without a targetname at %s\n", vtos(self->s.origin)); if (!self->target) @@ -1312,14 +1337,14 @@ void target_rotation_use (edict_t *self, edict_t *activator, edict_t *other) char *p1, *p2; char targetname[256]; - if(self->spawnflags & 2) { + if (self->spawnflags & 2) { // random pick pick = self->sounds * random(); - if(pick == self->sounds) pick--; + if (pick == self->sounds) pick--; } else { pick = self->mass; - if(pick == self->sounds) { - if(self->spawnflags & 1) // no loop + if (pick == self->sounds) { + if (self->spawnflags & 1) // no loop return; else pick = 0; @@ -1330,21 +1355,21 @@ void target_rotation_use (edict_t *self, edict_t *activator, edict_t *other) p2 = targetname; memset(targetname,0,sizeof(targetname)); // skip over pick commas - for(i=0; iinuse && target->use) + while (target) { + if (target->inuse && target->use) target->use(target,other,activator); target = G_Find(target,FOFS(targetname),targetname); } @@ -1400,23 +1425,27 @@ void SP_target_rotation (edict_t *self) { char *p; - if(!self->target) + if (!self->target) { gi.dprintf("target_rotation without a target at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } - if( (self->spawnflags & 3) == 3) + + self->class_id = ENTITY_TARGET_ROTATION; + + if ( (self->spawnflags & 3) == 3) { gi.dprintf("target_rotation at %s: NO_LOOP and RANDOM are mutually exclusive.\n"); self->spawnflags = 2; } + self->use = target_rotation_use; self->svflags = SVF_NOCLIENT; self->mass = 0; // index of currently selected target self->sounds = 0; // number of comma-delimited targets in target string p = self->target; - while( (p = strstr(p,",")) != NULL) + while ( (p = strstr(p,",")) != NULL) { self->sounds++; p++; @@ -1476,6 +1505,8 @@ void target_cd_use (edict_t *self, edict_t *activator, edict_t *other) void SP_target_cd (edict_t *self) { + self->class_id = ENTITY_TARGET_CD; + if (!self->targetname) gi.dprintf("target_cd without a targetname at %s\n", vtos(self->s.origin)); if (!self->sounds) @@ -1505,12 +1536,14 @@ void use_target_skill (edict_t *self, edict_t *other, edict_t *activator) { level.next_skill = self->style + 1; self->count--; - if(self->count == 0) + if (self->count == 0) G_FreeEdict(self); } void SP_target_skill (edict_t *self) { + self->class_id = ENTITY_TARGET_SKILL; + self->use = use_target_skill; } @@ -1535,13 +1568,14 @@ void target_sky_use (edict_t *self, edict_t *activator, edict_t *other) void SP_target_sky (edict_t *self) { - - if(!st.sky || !*st.sky) + if (!st.sky || !*st.sky) { gi.dprintf("Target_sky with no sky string at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } + self->class_id = ENTITY_TARGET_SKY; + self->pathtarget = gi.TagMalloc(strlen(st.sky)+1,TAG_LEVEL); strcpy(self->pathtarget, st.sky); @@ -1562,7 +1596,7 @@ void SP_target_sky (edict_t *self) =============================================================================*/ void use_target_fade (edict_t *self, edict_t *other, edict_t *activator) { - if(!activator->client) + if (!activator->client) return; activator->client->fadestart= level.framenum; @@ -1575,7 +1609,7 @@ void use_target_fade (edict_t *self, edict_t *other, edict_t *activator) activator->client->fadealpha = self->alpha; self->count--; - if(self->count == 0) + if (self->count == 0) { self->think = G_FreeEdict; self->nextthink = level.time + 1; @@ -1584,15 +1618,17 @@ void use_target_fade (edict_t *self, edict_t *other, edict_t *activator) void SP_target_fade (edict_t *self) { + self->class_id = ENTITY_TARGET_FADE; + self->use = use_target_fade; - if(self->fadein < 0) + if (self->fadein < 0) self->fadein = 0; - if(self->holdtime < 0) + if (self->holdtime < 0) { self->count = 1; self->holdtime = 10000; } - if(self->fadeout < 0) + if (self->fadeout < 0) self->fadeout = 0; } @@ -1721,7 +1757,7 @@ void target_rocks_use (edict_t *self, edict_t *activator, edict_t *other) if (count > 16) count = 16; VectorSet(size,8,8,8); - while(count--) + while (count--) { chunkorigin[0] = self->s.origin[0] + crandom() * source[0]; chunkorigin[1] = self->s.origin[1] + crandom() * source[1]; @@ -1735,7 +1771,7 @@ void target_rocks_use (edict_t *self, edict_t *activator, edict_t *other) if (count > 16) count = 16; VectorSet(size,4,4,4); - while(count--) + while (count--) { chunkorigin[0] = self->s.origin[0] + crandom() * source[0]; chunkorigin[1] = self->s.origin[1] + crandom() * source[1]; @@ -1760,6 +1796,8 @@ void target_rocks_use (edict_t *self, edict_t *activator, edict_t *other) void SP_target_rocks (edict_t *self) { + self->class_id = ENTITY_TARGET_ROCKS; + if (!self->targetname) gi.dprintf("target_rocks without a targetname at %s\n", vtos(self->s.origin)); if (!self->mass) @@ -1812,20 +1850,20 @@ void clone (edict_t *self) self->nextthink = 0; source = G_Find (NULL, FOFS(targetname), self->source); - if(!source) + if (!source) { gi.dprintf("%s at %s, source not found\n", self->classname, vtos(self->s.origin)); G_FreeEdict(self); return; } - if(!source->classname) + if (!source->classname) { gi.dprintf("%s at %s, source at %s has no classname\n", self->classname, vtos(self->s.origin), vtos(source->s.origin)); G_FreeEdict(self); return; } - if(!source->s.modelindex) + if (!source->s.modelindex) { gi.dprintf("%s at %s, source %s at %s not a model entity\n", self->classname, vtos(self->s.origin), source->classname, vtos(source->s.origin)); @@ -1896,16 +1934,16 @@ void clone (edict_t *self) ent->yaw_speed = source->yaw_speed; ent->roll_speed = source->roll_speed; - if(VectorLength(ent->s.angles) != 0) + if (VectorLength(ent->s.angles) != 0) { - if(ent->s.angles[YAW] == 90 || ent->s.angles[YAW] == 270) + if (ent->s.angles[YAW] == 90 || ent->s.angles[YAW] == 270) { // We're correct for these angles, not even gonna bother with others vec_t temp; temp = ent->size[0]; ent->size[0] = ent->size[1]; ent->size[1] = temp; temp = ent->mins[0]; - if(ent->s.angles[YAW] == 90) + if (ent->s.angles[YAW] == 90) { ent->mins[0] = -ent->maxs[1]; ent->maxs[1] = ent->maxs[0]; @@ -1924,11 +1962,11 @@ void clone (edict_t *self) ent->movedir[PITCH] += ent->s.angles[PITCH]; ent->movedir[YAW] += ent->s.angles[YAW]; ent->movedir[ROLL] += ent->s.angles[ROLL]; - if(ent->movedir[PITCH] > 360) + if (ent->movedir[PITCH] > 360) ent->movedir[PITCH] -= 360; - if(ent->movedir[YAW] > 360) + if (ent->movedir[YAW] > 360) ent->movedir[YAW] -= 360; - if(ent->movedir[ROLL] > 360) + if (ent->movedir[ROLL] > 360) ent->movedir[ROLL] -= 360; AngleVectors(ent->movedir,ent->movedir,NULL,NULL); } @@ -1997,6 +2035,9 @@ void SP_target_clone (edict_t *self) G_FreeEdict(self); return; } + + self->class_id = ENTITY_TARGET_CLONE; + self->svflags |= SVF_NOCLIENT; self->use = target_clone_use; gi.linkentity (self); @@ -2039,7 +2080,7 @@ void SP_target_clone (edict_t *self) #define ATTRACTOR_SINGLE 32 #define ATTRACTOR_PATHTARGET 64 -void target_attractor_think_single(edict_t *self) +void target_attractor_think_single (edict_t *self) { edict_t *ent, *target, *previous_target; trace_t tr; @@ -2056,68 +2097,68 @@ void target_attractor_think_single(edict_t *self) target = NULL; best_dist = WORLD_SIZE; // was 8192 - if(self->spawnflags & ATTRACTOR_PLAYER) + if (self->spawnflags & ATTRACTOR_PLAYER) { - for(i=1, ent=&g_edicts[i]; i<=game.maxclients; i++, ent++) + for (i=1, ent=&g_edicts[i]; i<=game.maxclients; i++, ent++) { - if(!ent->inuse) continue; - if(ent->health <= 0) continue; + if (!ent->inuse) continue; + if (ent->health <= 0) continue; num_targets++; VectorSubtract(self->s.origin,ent->s.origin,dir); dist = VectorLength(dir); - if(dist > self->moveinfo.distance) continue; - if(self->spawnflags & ATTRACTOR_SIGHT) + if (dist > self->moveinfo.distance) continue; + if (self->spawnflags & ATTRACTOR_SIGHT) { tr = gi.trace(self->s.origin,vec3_origin,vec3_origin,ent->s.origin,NULL,MASK_OPAQUE | MASK_SHOT); - if(tr.ent != ent) continue; + if (tr.ent != ent) continue; } - if(dist < best_dist) + if (dist < best_dist) { best_dist = dist; target = ent; } } } - if(self->spawnflags & ATTRACTOR_MONSTER) + if (self->spawnflags & ATTRACTOR_MONSTER) { - for(i=1, ent=&g_edicts[i]; i<=globals.num_edicts; i++, ent++) + for (i=1, ent=&g_edicts[i]; i<=globals.num_edicts; i++, ent++) { - if(!ent->inuse) continue; - if(ent->health <= 0) continue; - if(!(ent->svflags & SVF_MONSTER)) continue; + if (!ent->inuse) continue; + if (ent->health <= 0) continue; + if (!(ent->svflags & SVF_MONSTER)) continue; num_targets++; VectorSubtract(self->s.origin,ent->s.origin,dir); dist = VectorLength(dir); - if(dist > self->moveinfo.distance) continue; - if(self->spawnflags & ATTRACTOR_SIGHT) + if (dist > self->moveinfo.distance) continue; + if (self->spawnflags & ATTRACTOR_SIGHT) { tr = gi.trace(self->s.origin,vec3_origin,vec3_origin,ent->s.origin,NULL,MASK_OPAQUE | MASK_SHOT); - if(tr.ent != ent) continue; + if (tr.ent != ent) continue; } - if(dist < best_dist) + if (dist < best_dist) { best_dist = dist; target = ent; } } } - if(!(self->spawnflags & (ATTRACTOR_PLAYER | ATTRACTOR_MONSTER))) + if (!(self->spawnflags & (ATTRACTOR_PLAYER | ATTRACTOR_MONSTER))) { ent = G_Find(NULL,FOFS(targetname),self->target); - while(ent) + while (ent) { - if(!ent->inuse) continue; + if (!ent->inuse) continue; num_targets++; VectorAdd(ent->s.origin,ent->origin_offset,targ_org); VectorSubtract(self->s.origin,targ_org,dir); dist = VectorLength(dir); - if(dist > self->moveinfo.distance) continue; - if(self->spawnflags & ATTRACTOR_SIGHT) + if (dist > self->moveinfo.distance) continue; + if (self->spawnflags & ATTRACTOR_SIGHT) { tr = gi.trace(self->s.origin,vec3_origin,vec3_origin,targ_org,NULL,MASK_OPAQUE | MASK_SHOT); - if(tr.ent != ent) continue; + if (tr.ent != ent) continue; } - if(dist < best_dist) + if (dist < best_dist) { best_dist = dist; target = ent; @@ -2126,18 +2167,18 @@ void target_attractor_think_single(edict_t *self) } } self->target_ent = target; - if(!target) + if (!target) { - if(num_targets > 0) self->nextthink = level.time + FRAMETIME; + if (num_targets > 0) self->nextthink = level.time + FRAMETIME; return; } - if(target != previous_target) + if (target != previous_target) self->moveinfo.speed = 0; - if(self->moveinfo.speed != self->speed) + if (self->moveinfo.speed != self->speed) { - if(self->speed > 0) + if (self->speed > 0) self->moveinfo.speed = min(self->speed, self->moveinfo.speed + self->accel); else self->moveinfo.speed = max(self->speed, self->moveinfo.speed + self->accel); @@ -2146,16 +2187,16 @@ void target_attractor_think_single(edict_t *self) VectorAdd(target->s.origin,target->origin_offset,targ_org); VectorSubtract(self->s.origin,targ_org,dir); dist = VectorLength(dir); - if(readout->value) gi.dprintf("distance=%g, pull speed=%g\n",dist,self->moveinfo.speed); + if (readout->value) gi.dprintf("distance=%g, pull speed=%g\n",dist,self->moveinfo.speed); - if((self->pathtarget) && (self->spawnflags & ATTRACTOR_PATHTARGET)) + if ((self->pathtarget) && (self->spawnflags & ATTRACTOR_PATHTARGET)) { - if(dist == 0) + if (dist == 0) { // fire pathtarget when close ent = G_Find(NULL,FOFS(targetname),self->pathtarget); - while(ent) { - if(ent->use) + while (ent) { + if (ent->use) ent->use(ent,self,self); ent = G_Find(ent,FOFS(targetname),self->pathtarget); } @@ -2165,15 +2206,16 @@ void target_attractor_think_single(edict_t *self) VectorNormalize(dir); speed = VectorNormalize(target->velocity); speed = max(fabs(self->moveinfo.speed),speed); - if(self->moveinfo.speed < 0) speed = -speed; - if(speed > dist*10) { + if (self->moveinfo.speed < 0) speed = -speed; + if (speed > dist*10) + { speed = dist*10; VectorScale(dir,speed,target->velocity); // if NO_GRAVITY is NOT set, and target would normally be affected by gravity, // counteract gravity during the last move - if( !(self->spawnflags & ATTRACTOR_NO_GRAVITY) ) + if ( !(self->spawnflags & ATTRACTOR_NO_GRAVITY) ) { - if( (target->movetype == MOVETYPE_BOUNCE ) || + if ( (target->movetype == MOVETYPE_BOUNCE ) || (target->movetype == MOVETYPE_PUSHABLE) || (target->movetype == MOVETYPE_STEP ) || (target->movetype == MOVETYPE_TOSS ) || @@ -2182,16 +2224,17 @@ void target_attractor_think_single(edict_t *self) target->velocity[2] += target->gravity * sv_gravity->value * FRAMETIME; } } - } else + } + else VectorScale(dir,speed,target->velocity); // Add attractor velocity in case it's a movewith deal VectorAdd(target->velocity,self->velocity,target->velocity); - if(target->client) + if (target->client) { float scale; - if(target->groundentity || target->waterlevel > 1) + if (target->groundentity || target->waterlevel > 1) { - if(target->groundentity) + if (target->groundentity) scale = 0.75; else scale = 0.375; @@ -2205,17 +2248,17 @@ void target_attractor_think_single(edict_t *self) } // If target is on the ground and attractor is overhead, give 'em a little nudge. // This is only really necessary for players - if(target->groundentity && (self->s.origin[2] > target->absmax[2])) + if (target->groundentity && (self->s.origin[2] > target->absmax[2])) { target->s.origin[2] += 1; target->groundentity = NULL; } - if(self->sounds) + if (self->sounds) { vec3_t new_origin; - if(target->client) + if (target->client) VectorCopy(target->s.origin,new_origin); else VectorMA(targ_org,FRAMETIME,target->velocity,new_origin); @@ -2240,11 +2283,11 @@ void target_attractor_think_single(edict_t *self) } - if(self->spawnflags & ATTRACTOR_NO_GRAVITY) + if (self->spawnflags & ATTRACTOR_NO_GRAVITY) target->gravity_debounce_time = level.time + 2*FRAMETIME; gi.linkentity(target); - if(!num_targets) + if (!num_targets) { // shut 'er down self->spawnflags &= ~ATTRACTOR_ON; @@ -2255,7 +2298,7 @@ void target_attractor_think_single(edict_t *self) } } -void target_attractor_think(edict_t *self) +void target_attractor_think (edict_t *self) { edict_t *ent, *target; trace_t tr; @@ -2268,9 +2311,9 @@ void target_attractor_think(edict_t *self) if ( !(self->spawnflags & ATTRACTOR_ON) ) return; - if(self->moveinfo.speed != self->speed) + if (self->moveinfo.speed != self->speed) { - if(self->speed > 0) + if (self->speed > 0) self->moveinfo.speed = min(self->speed, self->moveinfo.speed + self->accel); else self->moveinfo.speed = max(self->speed, self->moveinfo.speed + self->accel); @@ -2278,20 +2321,20 @@ void target_attractor_think(edict_t *self) target = NULL; ent_start = 1; - while(true) + while (true) { - if(self->spawnflags & (ATTRACTOR_PLAYER | ATTRACTOR_MONSTER)) + if (self->spawnflags & (ATTRACTOR_PLAYER | ATTRACTOR_MONSTER)) { target = NULL; - for(i=ent_start, ent=&g_edicts[ent_start];ispawnflags & ATTRACTOR_PLAYER) && ent->client && ent->inuse) + if ((self->spawnflags & ATTRACTOR_PLAYER) && ent->client && ent->inuse) { target = ent; ent_start = i+1; continue; } - if((self->spawnflags & ATTRACTOR_MONSTER) && (ent->svflags & SVF_MONSTER) && (ent->inuse)) + if ((self->spawnflags & ATTRACTOR_MONSTER) && (ent->svflags & SVF_MONSTER) && (ent->inuse)) { target = ent; ent_start = i+1; @@ -2300,34 +2343,34 @@ void target_attractor_think(edict_t *self) } else target = G_Find(target,FOFS(targetname),self->target); - if(!target) break; - if(!target->inuse) continue; - if( ((target->client) || (target->svflags & SVF_MONSTER)) && (target->health <= 0)) continue; + if (!target) break; + if (!target->inuse) continue; + if ( ((target->client) || (target->svflags & SVF_MONSTER)) && (target->health <= 0)) continue; num_targets++; VectorAdd(target->s.origin,target->origin_offset,targ_org); VectorSubtract(self->s.origin,targ_org,dir); dist = VectorLength(dir); - if(self->spawnflags & ATTRACTOR_SIGHT) + if (self->spawnflags & ATTRACTOR_SIGHT) { tr = gi.trace(self->s.origin,vec3_origin,vec3_origin,target->s.origin,NULL,MASK_OPAQUE | MASK_SHOT); - if(tr.ent != target) continue; + if (tr.ent != target) continue; } - if(readout->value) gi.dprintf("distance=%g, pull speed=%g\n",dist,self->moveinfo.speed); - if(dist > self->moveinfo.distance) + if (readout->value) gi.dprintf("distance=%g, pull speed=%g\n",dist,self->moveinfo.speed); + if (dist > self->moveinfo.distance) continue; - if((self->pathtarget) && (self->spawnflags & ATTRACTOR_PATHTARGET)) + if ((self->pathtarget) && (self->spawnflags & ATTRACTOR_PATHTARGET)) { - if(dist == 0) + if (dist == 0) { // fire pathtarget when close ent = G_Find(NULL,FOFS(targetname),self->pathtarget); - while(ent) + while (ent) { - if(ent->use) + if (ent->use) ent->use(ent,self,self); ent = G_Find(ent,FOFS(targetname),self->pathtarget); } @@ -2337,15 +2380,16 @@ void target_attractor_think(edict_t *self) VectorNormalize(dir); speed = VectorNormalize(target->velocity); speed = max(fabs(self->moveinfo.speed),speed); - if(self->moveinfo.speed < 0) speed = -speed; - if(speed > dist*10) { + if (self->moveinfo.speed < 0) speed = -speed; + if (speed > dist*10) + { speed = dist*10; VectorScale(dir,speed,target->velocity); // if NO_GRAVITY is NOT set, and target would normally be affected by gravity, // counteract gravity during the last move - if( !(self->spawnflags & ATTRACTOR_NO_GRAVITY) ) + if ( !(self->spawnflags & ATTRACTOR_NO_GRAVITY) ) { - if( (target->movetype == MOVETYPE_BOUNCE ) || + if ( (target->movetype == MOVETYPE_BOUNCE ) || (target->movetype == MOVETYPE_PUSHABLE) || (target->movetype == MOVETYPE_STEP ) || (target->movetype == MOVETYPE_TOSS ) || @@ -2359,12 +2403,12 @@ void target_attractor_think(edict_t *self) VectorScale(dir,speed,target->velocity); // Add attractor velocity in case it's a movewith deal VectorAdd(target->velocity,self->velocity,target->velocity); - if(target->client) + if (target->client) { float scale; - if(target->groundentity || target->waterlevel > 1) + if (target->groundentity || target->waterlevel > 1) { - if(target->groundentity) + if (target->groundentity) scale = 0.75; else scale = 0.375; @@ -2378,16 +2422,16 @@ void target_attractor_think(edict_t *self) } // If target is on the ground and attractor is overhead, give 'em a little nudge. // This is only really necessary for players - if(target->groundentity && (self->s.origin[2] > target->absmax[2])) + if (target->groundentity && (self->s.origin[2] > target->absmax[2])) { target->s.origin[2] += 1; target->groundentity = NULL; } - if(self->spawnflags & ATTRACTOR_NO_GRAVITY) + if (self->spawnflags & ATTRACTOR_NO_GRAVITY) target->gravity_debounce_time = level.time + 2*FRAMETIME; gi.linkentity(target); } - if(!num_targets) + if (!num_targets) { // shut 'er down self->spawnflags &= ~ATTRACTOR_ON; @@ -2400,7 +2444,7 @@ void target_attractor_think(edict_t *self) void use_target_attractor(edict_t *self, edict_t *other, edict_t *activator) { - if(self->spawnflags & ATTRACTOR_ON) + if (self->spawnflags & ATTRACTOR_ON) { self->count--; if (self->count == 0) @@ -2423,7 +2467,7 @@ void use_target_attractor(edict_t *self, edict_t *other, edict_t *activator) #ifdef LOOP_SOUND_ATTENUATION self->s.attenuation = self->attenuation; #endif - if(self->spawnflags & ATTRACTOR_SINGLE) + if (self->spawnflags & ATTRACTOR_SINGLE) self->think = target_attractor_think_single; else self->think = target_attractor_think; @@ -2433,9 +2477,9 @@ void use_target_attractor(edict_t *self, edict_t *other, edict_t *activator) } } -void SP_target_attractor(edict_t *self) +void SP_target_attractor (edict_t *self) { - if(!self->target && !(self->spawnflags & ATTRACTOR_PLAYER) && + if (!self->target && !(self->spawnflags & ATTRACTOR_PLAYER) && !(self->spawnflags & ATTRACTOR_MONSTER)) { gi.dprintf("target_attractor without a target at %s\n",vtos(self->s.origin)); @@ -2444,9 +2488,9 @@ void SP_target_attractor(edict_t *self) } self->class_id = ENTITY_TARGET_ATTRACTOR; - if(self->sounds) + if (self->sounds) { -// if((self->spawnflags & ATTRACTOR_PLAYER) || (self->spawnflags & ATTRACTOR_MONSTER)) { +// if ((self->spawnflags & ATTRACTOR_PLAYER) || (self->spawnflags & ATTRACTOR_MONSTER)) { self->spawnflags |= (ATTRACTOR_SIGHT | ATTRACTOR_SINGLE); // } else { // gi.dprintf("Target_attractor sounds key is only valid\n" @@ -2455,42 +2499,42 @@ void SP_target_attractor(edict_t *self) } if (self->distance) st.distance = self->distance; - if(st.distance) + if (st.distance) self->moveinfo.distance = st.distance; else self->moveinfo.distance = WORLD_SIZE; // was 8192 self->solid = SOLID_NOT; - if(self->movewith) + if (self->movewith) self->movetype = MOVETYPE_PUSH; else self->movetype = MOVETYPE_NONE; self->use = use_target_attractor; - if(st.noise) + if (st.noise) self->noise_index = gi.soundindex(st.noise); else self->noise_index = 0; - if(!self->speed) + if (!self->speed) self->speed = 100; - if(!self->accel) + if (!self->accel) self->accel = self->speed; else { self->accel *= 0.1; - if(self->accel > self->speed) + if (self->accel > self->speed) self->accel = self->speed; } - if(self->spawnflags & ATTRACTOR_ON) + if (self->spawnflags & ATTRACTOR_ON) { - if(self->spawnflags & ATTRACTOR_SINGLE) + if (self->spawnflags & ATTRACTOR_SINGLE) self->think = target_attractor_think_single; else self->think = target_attractor_think; - if(self->sounds) + if (self->sounds) self->nextthink = level.time + 2*FRAMETIME; else self->think(self); @@ -2541,11 +2585,11 @@ void target_monitor_off (edict_t *self) edict_t *player; player = self->child; - if(!player) return; + if (!player) return; - if(self->spawnflags & SF_MONITOR_EYEBALL) + if (self->spawnflags & SF_MONITOR_EYEBALL) { - if(self->target_ent) + if (self->target_ent) self->target_ent->svflags &= ~SVF_NOCLIENT; } faker = player->client->camplayer; @@ -2579,11 +2623,11 @@ void target_monitor_off (edict_t *self) KillBox(player); gi.linkentity(player); - if(self->noise_index) + if (self->noise_index) gi.sound (player, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0); // if we were previously in third person view, restore it - if(tpp->value) + if (tpp->value) Cmd_Chasecam_Toggle (player); self->child = NULL; @@ -2604,9 +2648,9 @@ void target_monitor_move (edict_t *self) trace_t trace; vec3_t forward, o, goal; - if(!self->target_ent || !self->target_ent->inuse) + if (!self->target_ent || !self->target_ent->inuse) { - if(self->wait) + if (self->wait) { self->think = target_monitor_off; self->nextthink = self->monsterinfo.attack_finished; @@ -2614,7 +2658,7 @@ void target_monitor_move (edict_t *self) return; } - if( (self->monsterinfo.attack_finished > 0) && + if ( (self->monsterinfo.attack_finished > 0) && (level.time > self->monsterinfo.attack_finished)) { target_monitor_off(self); @@ -2662,24 +2706,24 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator) edict_t *monster; gclient_t *cl; - if(!activator->client) + if (!activator->client) return; - if(self->child) + if (self->child) { - if(self->wait < 0) + if (self->wait < 0) target_monitor_off(self); return; } - if(self->target) + if (self->target) self->target_ent = G_Find(NULL,FOFS(targetname),self->target); // if this is a CHASE_CAM target_monitor and the target no longer // exists, remove this target_monitor and exit - if(self->spawnflags & SF_MONITOR_CHASECAM) + if (self->spawnflags & SF_MONITOR_CHASECAM) { - if(!self->target_ent || !self->target_ent->inuse) + if (!self->target_ent || !self->target_ent->inuse) { G_FreeEdict(self); return; @@ -2719,9 +2763,9 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator) faker->target_ent = activator; gi.linkentity (faker); - if(self->target_ent && self->target_ent->inuse) + if (self->target_ent && self->target_ent->inuse) { - if(self->spawnflags & SF_MONITOR_EYEBALL) + if (self->spawnflags & SF_MONITOR_EYEBALL) VectorCopy(self->target_ent->s.angles,activator->client->ps.viewangles); else { @@ -2748,7 +2792,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator) activator->svflags |= SVF_NOCLIENT; activator->solid = SOLID_NOT; activator->viewheight = 0; - if(activator->client->chasetoggle) + if (activator->client->chasetoggle) { Cmd_Chasecam_Toggle (activator); activator->client->chasetoggle = 1; @@ -2766,16 +2810,16 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator) gi.linkentity(faker); // check to see if player is the enemy of any monster. - for(i=maxclients->value+1, monster=g_edicts+i; iinuse) continue; - if(!(monster->svflags & SVF_MONSTER)) continue; - if(monster->enemy == activator) + for (i=maxclients->value+1, monster=g_edicts+i; iinuse) continue; + if (!(monster->svflags & SVF_MONSTER)) continue; + if (monster->enemy == activator) { monster->enemy = NULL; monster->oldenemy = NULL; - if(monster->goalentity == activator) + if (monster->goalentity == activator) monster->goalentity = NULL; - if(monster->movetarget == activator) + if (monster->movetarget == activator) monster->movetarget = NULL; monster->monsterinfo.attack_finished = level.time + 1; FindTarget(monster); @@ -2785,17 +2829,17 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator) activator->target_ent = self; self->child = activator; - if(self->noise_index) + if (self->noise_index) gi.sound (activator, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0); - if(self->spawnflags & SF_MONITOR_CHASECAM) + if (self->spawnflags & SF_MONITOR_CHASECAM) { - if(self->wait > 0) + if (self->wait > 0) self->monsterinfo.attack_finished = level.time + self->wait; else self->monsterinfo.attack_finished = 0; - if(self->spawnflags & SF_MONITOR_EYEBALL) + if (self->spawnflags & SF_MONITOR_EYEBALL) { self->viewheight = self->target_ent->viewheight; self->target_ent->svflags |= SVF_NOCLIENT; @@ -2804,7 +2848,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator) self->think = target_monitor_move; self->think(self); } - else if(self->wait > 0) + else if (self->wait > 0) { self->think = target_monitor_off; self->nextthink = level.time + self->wait; @@ -2815,11 +2859,13 @@ void SP_target_monitor (edict_t *self) { char buffer[MAX_QPATH]; - if(!self->wait) + self->class_id = ENTITY_TARGET_MONITOR; + + if (!self->wait) self->wait = 3; self->use = use_target_monitor; self->movetype = MOVETYPE_NOCLIP; - if(st.noise) + if (st.noise) { if (!strstr (st.noise, ".wav")) Com_sprintf (buffer, sizeof(buffer), "%s.wav", st.noise); @@ -2828,12 +2874,12 @@ void SP_target_monitor (edict_t *self) self->noise_index = gi.soundindex (buffer); } - if(self->spawnflags & SF_MONITOR_EYEBALL) + if (self->spawnflags & SF_MONITOR_EYEBALL) self->spawnflags |= SF_MONITOR_CHASECAM; - if(self->spawnflags & SF_MONITOR_CHASECAM) + if (self->spawnflags & SF_MONITOR_CHASECAM) { // chase cam - if(self->spawnflags & SF_MONITOR_EYEBALL) + if (self->spawnflags & SF_MONITOR_EYEBALL) { self->moveinfo.distance = 0; self->viewheight = 0; @@ -2842,26 +2888,26 @@ void SP_target_monitor (edict_t *self) { if (self->distance) st.distance = self->distance; - if(st.distance) + if (st.distance) self->moveinfo.distance = st.distance; else self->moveinfo.distance = 128; if (self->height) st.height = self->height; - if(st.height) + if (st.height) self->viewheight = st.height; else self->viewheight = 16; } // MUST have target - if(!self->target) + if (!self->target) { gi.dprintf("CHASECAM target_monitor with no target at %s\n",vtos(self->s.origin)); self->spawnflags &= ~(SF_MONITOR_CHASECAM | SF_MONITOR_EYEBALL); } - else if(self->movewith) + else if (self->movewith) { gi.dprintf("CHASECAM target_monitor cannot use 'movewith'\n"); self->spawnflags &= ~(SF_MONITOR_CHASECAM | SF_MONITOR_EYEBALL); @@ -2884,15 +2930,15 @@ void SP_target_monitor (edict_t *self) =====================================================================================*/ void target_animate (edict_t *ent) { - if( (ent->s.frame < ent->monsterinfo.currentmove->firstframe) || + if ( (ent->s.frame < ent->monsterinfo.currentmove->firstframe) || (ent->s.frame >= ent->monsterinfo.currentmove->lastframe ) ) { - if(ent->monsterinfo.currentmove->endfunc) + if (ent->monsterinfo.currentmove->endfunc) { ent->think = ent->monsterinfo.currentmove->endfunc; ent->nextthink = level.time + FRAMETIME; } - else if(ent->svflags & SVF_MONSTER) + else if (ent->svflags & SVF_MONSTER) { // Hopefully we don't get here, but if we DO then we definitely // need for monsters/actors to turn their brains back on. @@ -2916,28 +2962,28 @@ void target_animation_use (edict_t *self, edict_t *other, edict_t *activator) { edict_t *target = NULL; - if(level.time < self->touch_debounce_time) + if (level.time < self->touch_debounce_time) return; - if(self->spawnflags & 1) + if (self->spawnflags & 1) { - if(activator && activator->client) + if (activator && activator->client) return; - if(self->message && Q_stricmp(self->message, activator->classname)) + if (self->message && Q_stricmp(self->message, activator->classname)) return; - if(!self->target) + if (!self->target) target = activator; } - if(!target) + if (!target) { - if(!self->target) + if (!self->target) return; target = G_Find(NULL,FOFS(targetname),self->target); - if(!target) + if (!target) return; } // Don't allow target to be animated if ALREADY under influence of // another target_animation - if(target->think == target_animate) + if (target->think == target_animate) return; self->monsterinfo.currentmove->firstframe = self->startframe; self->monsterinfo.currentmove->lastframe = self->startframe + self->framenumbers - 1; @@ -2951,7 +2997,7 @@ void target_animation_use (edict_t *self, edict_t *other, edict_t *activator) gi.linkentity(target); self->count--; - if(self->count == 0) + if (self->count == 0) G_FreeEdict(self); else self->touch_debounce_time = level.time + (self->framenumbers+1)*FRAMETIME; @@ -2960,7 +3006,10 @@ void target_animation_use (edict_t *self, edict_t *other, edict_t *activator) void SP_target_animation (edict_t *self) { mmove_t *move; - if(!self->target && !(self->spawnflags & 1)) + + self->class_id = ENTITY_TARGET_ANIMATION; + + if (!self->target && !(self->spawnflags & 1)) { gi.dprintf("target_animation w/o a target at %s\n",vtos(self->s.origin)); G_FreeEdict(self); @@ -2998,13 +3047,14 @@ void SP_target_animation (edict_t *self) self->framenumbers = 12; break; default: - if(!self->framenumbers) + if (!self->framenumbers) self->framenumbers = 1; } self->use = target_animation_use; move = gi.TagMalloc(sizeof(mmove_t), TAG_LEVEL); self->monsterinfo.currentmove = move; } + /*=================================================================================== TARGET_FAILURE - Halts the game, fades the screen to black and displays a message explaining to the player how he screwed up. @@ -3036,7 +3086,7 @@ void target_failure_player_die (edict_t *player) player->client->zooming = 0; player->client->zoomed = false; SetSensitivities(player,true); - if(player->client->spycam) + if (player->client->spycam) camera_off(player); VectorClear (player->avelocity); player->takedamage = DAMAGE_NO; @@ -3079,7 +3129,7 @@ void target_failure_fade_lights (edict_t *self) lightvalue[0] = values[self->flags]; lightvalue[1] = 0; gi.configstring(CS_LIGHTS+0, lightvalue); - if(self->flags) + if (self->flags) { self->flags--; self->nextthink = level.time + 0.2; @@ -3096,16 +3146,16 @@ void target_failure_fade_lights (edict_t *self) void Use_Target_Text(edict_t *self, edict_t *other, edict_t *activator); void use_target_failure (edict_t *self, edict_t *other, edict_t *activator) { - if(!activator->client) + if (!activator->client) return; - if(self->target_ent) + if (self->target_ent) return; if (self->message && strlen(self->message)) Use_Target_Text (self,other,activator); - if(self->noise_index) + if (self->noise_index) gi.sound (activator, CHAN_VOICE|CHAN_RELIABLE, self->noise_index, 1, ATTN_NORM, 0); self->target_ent = activator; @@ -3139,6 +3189,8 @@ void SP_target_failure (edict_t *self) G_FreeEdict (self); return; } + self->class_id = ENTITY_TARGET_FAILURE; + self->use = use_target_failure; if (st.noise) self->noise_index = gi.soundindex(st.noise); @@ -3152,7 +3204,7 @@ void SP_target_failure (edict_t *self) // target_locator can be used to move entities to a random selection // from a series of path_corners. Move takes place at level start ONLY. // -void target_locator_init(edict_t *self) +void target_locator_init (edict_t *self) { int num_points=0; int i, N, nummoves; @@ -3163,7 +3215,7 @@ void target_locator_init(edict_t *self) move = NULL; move = G_Find(move,FOFS(targetname),self->target); - if(!move) + if (!move) { gi.dprintf("Target of target_locator (%s) not found.\n", self->target); @@ -3171,7 +3223,7 @@ void target_locator_init(edict_t *self) return; } target = G_Find(NULL,FOFS(targetname),self->pathtarget); - if(!target) + if (!target) { gi.dprintf("Pathtarget of target_locator (%s) not found.\n", self->pathtarget); @@ -3183,13 +3235,13 @@ void target_locator_init(edict_t *self) tgt0 = target; next = NULL; target->spawnflags &= 0x7FFE; - while(next != tgt0) + while (next != tgt0) { - if(target->target) + if (target->target) { next = G_Find(NULL,FOFS(targetname),target->target); - if((!next) || (next==tgt0)) tgtlast = target; - if(!next) + if ((!next) || (next==tgt0)) tgtlast = target; + if (!next) { gi.dprintf("Target %s of path_corner at %s not found.\n", target->target,vtos(target->s.origin)); @@ -3205,22 +3257,22 @@ void target_locator_init(edict_t *self) tgtlast = target; } } - if(!num_points) num_points=1; + if (!num_points) num_points=1; nummoves = 1; - while(move) + while (move) { - if(nummoves > num_points) break; // more targets than path_corners + if (nummoves > num_points) break; // more targets than path_corners N = rand() % num_points; i = 0; next = tgt0; looped = false; - while(i<=N) + while (i<=N) { target = next; - if(!(target->spawnflags & 1)) i++; - if(target==tgtlast) + if (!(target->spawnflags & 1)) i++; + if (target==tgtlast) { // We've looped thru all path_corners, but not // reached the target number yet. This can only @@ -3228,14 +3280,14 @@ void target_locator_init(edict_t *self) // next available path_corner. looped = true; } - if(looped && !(target->spawnflags & 1)) i = N+1; + if (looped && !(target->spawnflags & 1)) i = N+1; next = G_Find(NULL,FOFS(targetname),target->target); } target->spawnflags |= 1; // Assumptions here: SOLID_BSP entities are assumed to be brush models, // all others are point ents - if(move->solid == SOLID_BSP) + if (move->solid == SOLID_BSP) { vec3_t origin; VectorAdd(move->absmin,move->absmax,origin); @@ -3254,21 +3306,25 @@ void target_locator_init(edict_t *self) // All done, go away G_FreeEdict(self); } -void SP_target_locator(edict_t *self) + +void SP_target_locator (edict_t *self) { - if(!self->target) + if (!self->target) { gi.dprintf("target_locator w/o target at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } - if(!self->pathtarget) + if (!self->pathtarget) { gi.dprintf("target_locator w/o pathtarget at %s\n",vtos(self->s.origin)); G_FreeEdict(self); return; } + + self->class_id = ENTITY_TARGET_LOCATOR; + self->think = target_locator_init; self->nextthink = level.time + 2*FRAMETIME; gi.linkentity(self); -} \ No newline at end of file +} diff --git a/missionpack/g_newtrig.c b/missionpack/g_newtrig.c index 55f68b5..c0cf360 100644 --- a/missionpack/g_newtrig.c +++ b/missionpack/g_newtrig.c @@ -33,7 +33,7 @@ NO_EFFECTS: will not give a teleport effect when touched SOUND: play a custom sound when touched "noise" (path/file.wav) */ -void trigger_teleport_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) +void trigger_teleport_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { edict_t *dest; edict_t *tempent; //for teleport effect @@ -43,15 +43,15 @@ void trigger_teleport_touch(edict_t *self, edict_t *other, cplane_t *plane, csur tempent = G_Spawn(); VectorCopy (other->s.origin, tempent->s.origin); - if((self->spawnflags & TELEPORT_PLAYER_ONLY) && !(other->client)) + if ((self->spawnflags & TELEPORT_PLAYER_ONLY) && !(other->client)) return; - if(!other->client && (!other->svflags & SVF_MONSTER)) + if (!other->client && (!other->svflags & SVF_MONSTER)) return; - if(self->delay) + if (self->delay) return; dest = G_Find (NULL, FOFS(targetname), self->target); - if(!dest) + if (!dest) { gi.dprintf("Teleport Destination not found!\n"); return; @@ -75,7 +75,7 @@ void trigger_teleport_touch(edict_t *self, edict_t *other, cplane_t *plane, csur // clear the velocity and hold them in place briefly VectorClear (other->velocity); - if(other->client) + if (other->client) { other->client->ps.pmove.pm_time = 160>>3; // hold time other->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT; @@ -107,7 +107,7 @@ void trigger_teleport_touch(edict_t *self, edict_t *other, cplane_t *plane, csur void trigger_teleport_use (edict_t *self, edict_t *other, edict_t *activator) { - if(self->solid == SOLID_NOT) + if (self->solid == SOLID_NOT) self->solid = SOLID_TRIGGER; else self->solid = SOLID_NOT; @@ -138,7 +138,7 @@ void SP_trigger_teleport (edict_t *self) if (self->targetname) { self->use = trigger_teleport_use; - if(!(self->spawnflags & TELEPORT_START_ON)) + if (!(self->spawnflags & TELEPORT_START_ON)) self->delay = 1; } @@ -152,6 +152,9 @@ void SP_trigger_teleport (edict_t *self) G_SetMovedir (self->s.angles, self->movedir); gi.setmodel (self, self->model); + + self->class_id = ENTITY_TRIGGER_TELEPORT; + gi.linkentity (self); } @@ -174,7 +177,7 @@ void trigger_disguise_touch(edict_t *self, edict_t *other, cplane_t *plane, csur { if (other->client) { - if(self->spawnflags & 4) + if (self->spawnflags & 4) other->flags &= ~FL_DISGUISED; else other->flags |= FL_DISGUISED; @@ -183,7 +186,7 @@ void trigger_disguise_touch(edict_t *self, edict_t *other, cplane_t *plane, csur void trigger_disguise_use (edict_t *self, edict_t *other, edict_t *activator) { - if(self->solid == SOLID_NOT) + if (self->solid == SOLID_NOT) self->solid = SOLID_TRIGGER; else self->solid = SOLID_NOT; @@ -193,7 +196,9 @@ void trigger_disguise_use (edict_t *self, edict_t *other, edict_t *activator) void SP_trigger_disguise (edict_t *self) { - if(self->spawnflags & 2) + self->class_id = ENTITY_TRIGGER_DISGUISE; + + if (self->spawnflags & 2) self->solid = SOLID_TRIGGER; else self->solid = SOLID_NOT; diff --git a/missionpack/g_newweap.c b/missionpack/g_newweap.c index af72bdd..3e92475 100644 --- a/missionpack/g_newweap.c +++ b/missionpack/g_newweap.c @@ -78,6 +78,7 @@ void fire_flechette (edict_t *self, vec3_t start, vec3_t dir, int damage, int sp flechette = G_Spawn(); flechette->classname = "flechette"; + flechette->class_id = ENTITY_FLECHETTE; VectorCopy (start, flechette->s.origin); VectorCopy (start, flechette->s.old_origin); vectoangles2 (dir, flechette->s.angles); @@ -555,7 +556,7 @@ void prox_land (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) Prox_Explode(ent); return; } - //Knightmare- stick to bmodels + // Knightmare- stick to bmodels if (other->solid == SOLID_BSP && other->movetype != MOVETYPE_CONVEYOR && (other->movetype == MOVETYPE_PUSH || other->movetype == MOVETYPE_PUSHABLE)) { @@ -712,6 +713,7 @@ void fire_prox (edict_t *self, vec3_t start, vec3_t aimdir, int damage_multiplie prox->think = Prox_Explode; prox->dmg = sk_prox_damage->value*damage_multiplier; prox->classname = "prox"; + prox->class_id = ENTITY_MINE_PROX; prox->svflags |= SVF_DAMAGEABLE; prox->flags |= FL_MECHANICAL; @@ -1622,19 +1624,19 @@ void Nuke_Think(edict_t *ent) if ((ent->wait - level.time) <= (sk_nuke_life->value/2.0)) { -// ent->s.sound = gi.soundindex ("weapons/nukewarn.wav"); -// gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); + // ent->s.sound = gi.soundindex ("weapons/nukewarn.wav"); + // gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, attenuation, 0); -// gi.sound (ent, CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); -// gi.dprintf ("time %2.2f\n", ent->wait-level.time); + // gi.sound (ent, CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); + // gi.dprintf ("time %2.2f\n", ent->wait-level.time); ent->timestamp = level.time + 0.3; } else { gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, attenuation, 0); -// gi.sound (ent, CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); + // gi.sound (ent, CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); ent->timestamp = level.time + 0.5; -// gi.dprintf ("time %2.2f\n", ent->wait-level.time); + // gi.dprintf ("time %2.2f\n", ent->wait-level.time); } } } @@ -1643,8 +1645,8 @@ void Nuke_Think(edict_t *ent) if (ent->timestamp <= level.time) { gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, attenuation, 0); -// gi.sound (ent, CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); -// gi.dprintf ("time %2.2f\n", ent->wait-level.time); + // gi.sound (ent, CHAN_VOICE, gi.soundindex ("weapons/nukewarn2.wav"), 1, ATTN_NORM, 0); + // gi.dprintf ("time %2.2f\n", ent->wait-level.time); ent->timestamp = level.time + 1.0; } ent->nextthink = level.time + FRAMETIME; @@ -1711,6 +1713,7 @@ void fire_nuke (edict_t *self, vec3_t start, vec3_t aimdir, int speed) // gi.dprintf ("nuke modifier = %d, damage = %d, radius = %f\n", damage_modifier, nuke->dmg, nuke->dmg_radius); nuke->classname = "nuke"; + nuke->class_id = ENTITY_NUKE; nuke->die = nuke_die; gi.linkentity (nuke); @@ -1954,6 +1957,7 @@ void fire_nbomb (edict_t *self, vec3_t start, vec3_t aimdir, int speed) // gi.dprintf ("nbomb modifier = %d, damage = %d, radius = %f\n", damage_modifier, nbomb->dmg, nbomb->dmg_radius); nbomb->classname = "nbomb"; + nbomb->class_id = ENTITY_NBOMB; nbomb->die = nbomb_die; gi.linkentity (nbomb); @@ -2304,6 +2308,7 @@ void fire_tesla (edict_t *self, vec3_t start, vec3_t aimdir, int damage_multipli tesla->dmg = sk_tesla_damage->value * damage_multiplier; // tesla->dmg = 0; tesla->classname = "tesla"; + tesla->class_id = ENTITY_MINE_TESLA; tesla->svflags |= SVF_DAMAGEABLE; tesla->clipmask = MASK_SHOT|CONTENTS_SLIME|CONTENTS_LAVA; tesla->flags |= FL_MECHANICAL; @@ -2645,6 +2650,7 @@ void fire_blaster2 (edict_t *self, vec3_t start, vec3_t dir, int damage, int spe bolt->think = G_FreeEdict; bolt->dmg = damage; bolt->classname = "bolt2"; + bolt->class_id = ENTITY_BOLT2; gi.linkentity (bolt); if (self->client) @@ -2948,6 +2954,7 @@ void fire_tracker (edict_t *self, vec3_t start, vec3_t dir, int damage, int spee tracker->owner = self; tracker->dmg = damage; tracker->classname = "tracker"; + tracker->class_id = ENTITY_TRACKER; gi.linkentity (tracker); if (enemy) @@ -3000,4 +3007,4 @@ void SP_tracker (edict_t *tracker) tracker->think = tracker_delayed_start; tracker->nextthink = level.time + FRAMETIME; gi.linkentity(tracker); -} \ No newline at end of file +} diff --git a/missionpack/g_sound.c b/missionpack/g_sound.c index 29afa28..260b828 100644 --- a/missionpack/g_sound.c +++ b/missionpack/g_sound.c @@ -1401,6 +1401,9 @@ void SP_target_playback (edict_t *ent) G_FreeEdict(ent); return; } + + ent->class_id = ENTITY_TARGET_PLAYBACK; + GameDirRelativePath(st.noise, filename, sizeof(filename)); ent->message = gi.TagMalloc(strlen(filename)+1,TAG_LEVEL); strcpy(ent->message, filename); diff --git a/missionpack/g_spawn.c b/missionpack/g_spawn.c index df1a9de..a57195e 100644 --- a/missionpack/g_spawn.c +++ b/missionpack/g_spawn.c @@ -1791,7 +1791,7 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint) || !strcmp(ent->classname, "misc_banner") ) ent->s.renderfx &= ~RF_IR_VISIBLE; - //David Hyde's code for the origin offset + // David Hyde's code for the origin offset VectorAdd(ent->absmin, ent->absmax, ent->origin_offset); VectorScale(ent->origin_offset, 0.5, ent->origin_offset); VectorSubtract(ent->origin_offset, ent->s.origin, ent->origin_offset); diff --git a/missionpack/g_sphere.c b/missionpack/g_sphere.c index 0618919..fa0c65a 100644 --- a/missionpack/g_sphere.c +++ b/missionpack/g_sphere.c @@ -33,7 +33,7 @@ void hunter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s // ================= void sphere_think_explode (edict_t *self) { - if(self->owner && self->owner->client && !(self->spawnflags & SPHERE_DOPPLEGANGER)) + if (self->owner && self->owner->client && !(self->spawnflags & SPHERE_DOPPLEGANGER)) { self->owner->client->owned_sphere = NULL; } @@ -45,7 +45,7 @@ void sphere_think_explode (edict_t *self) // ================= void sphere_explode (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { -// if(self->owner && self->owner->client) +// if (self->owner && self->owner->client) // gi.cprintf(self->owner, PRINT_HIGH, "Sphere timed out\n"); // gi.dprintf("player died, blowing up\n"); sphere_think_explode (self); @@ -56,7 +56,7 @@ void sphere_explode (edict_t *self, edict_t *inflictor, edict_t *attacker, int d // ================= void sphere_if_idle_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { - if(!self->enemy) + if (!self->enemy) { // gi.dprintf("player died, blowing up\n"); sphere_think_explode(self); @@ -74,7 +74,7 @@ void sphere_fly (edict_t *self) vec3_t dest; vec3_t dir; - if(level.time >= self->wait) + if (level.time >= self->wait) { // gi.dprintf("fly: timed out\n"); sphere_think_explode(self); @@ -84,9 +84,9 @@ void sphere_fly (edict_t *self) VectorCopy (self->owner->s.origin, dest); dest[2] = self->owner->absmax[2] + 4; - if(level.time == (float)(int)level.time) + if (level.time == (float)(int)level.time) { - if(!visible(self, self->owner)) + if (!visible(self, self->owner)) { VectorCopy(dest, self->s.origin); gi.linkentity(self); @@ -106,20 +106,20 @@ void sphere_chase (edict_t *self, int stupidChase) vec3_t dir; float dist; - if(level.time >= self->wait || (self->enemy && self->enemy->health < 1)) + if (level.time >= self->wait || (self->enemy && self->enemy->health < 1)) { sphere_think_explode(self); return; } VectorCopy (self->enemy->s.origin, dest); - if(self->enemy->client) + if (self->enemy->client) dest[2] += self->enemy->viewheight; - if(visible(self, self->enemy) || stupidChase) + if (visible(self, self->enemy) || stupidChase) { // if moving, hunter sphere uses active sound - if(!stupidChase) + if (!stupidChase) self->s.sound = gi.soundindex ("spheres/h_active.wav"); VectorSubtract (dest, self->s.origin, dir); @@ -143,11 +143,11 @@ void sphere_chase (edict_t *self, int stupidChase) VectorSubtract(self->monsterinfo.saved_goal, self->s.origin, dir); dist = VectorNormalize(dir); - if(dist > 1) + if (dist > 1) { vectoangles2(dir, self->s.angles); - if(dist > 500) + if (dist > 500) VectorScale(dir, 500, self->velocity); else if (dist < 20) VectorScale(dir, (dist / FRAMETIME), self->velocity); @@ -155,7 +155,7 @@ void sphere_chase (edict_t *self, int stupidChase) VectorScale(dir, dist, self->velocity); // if moving, hunter sphere uses active sound - if(!stupidChase) + if (!stupidChase) self->s.sound = gi.soundindex ("spheres/h_active.wav"); } else @@ -165,7 +165,7 @@ void sphere_chase (edict_t *self, int stupidChase) vectoangles2(dir, self->s.angles); // if not moving, hunter sphere uses lurk sound - if(!stupidChase) + if (!stupidChase) self->s.sound = gi.soundindex ("spheres/h_lurk.wav"); VectorClear(self->velocity); @@ -184,7 +184,7 @@ void sphere_fire (edict_t *self, edict_t *enemy) vec3_t dest; vec3_t dir; - if(level.time >= self->wait || !enemy) + if (level.time >= self->wait || !enemy) { sphere_think_explode(self); return; @@ -207,7 +207,7 @@ void sphere_fire (edict_t *self, edict_t *enemy) // ================= void sphere_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf, int mod) { - if(self->spawnflags & SPHERE_DOPPLEGANGER) + if (self->spawnflags & SPHERE_DOPPLEGANGER) { if (other == self->teammaster) return; @@ -248,7 +248,7 @@ void sphere_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s // ================= void vengeance_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { - if(self->spawnflags & SPHERE_DOPPLEGANGER) + if (self->spawnflags & SPHERE_DOPPLEGANGER) sphere_touch (self, other, plane, surf, MOD_DOPPLE_VENGEANCE); else sphere_touch (self, other, plane, surf, MOD_VENGEANCE_SPHERE); @@ -261,14 +261,14 @@ void hunter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s edict_t *owner; // don't blow up if you hit the world.... sheesh. - if(other==world) + if (other==world) return; - if(self->owner) + if (self->owner) { // if owner is flying with us, make sure they stop too. owner=self->owner; - if(owner->flags & FL_SAM_RAIMI) + if (owner->flags & FL_SAM_RAIMI) { VectorClear(owner->velocity); owner->movetype = MOVETYPE_NONE; @@ -276,7 +276,7 @@ void hunter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s } } - if(self->spawnflags & SPHERE_DOPPLEGANGER) + if (self->spawnflags & SPHERE_DOPPLEGANGER) sphere_touch (self, other, plane, surf, MOD_DOPPLE_HUNTER); else sphere_touch (self, other, plane, surf, MOD_HUNTER_SPHERE); @@ -289,19 +289,19 @@ void defender_shoot (edict_t *self, edict_t *enemy) vec3_t dir; vec3_t start; - if(!(enemy->inuse) || enemy->health <= 0) + if (!(enemy->inuse) || enemy->health <= 0) return; - if(enemy == self->owner) + if (enemy == self->owner) return; VectorSubtract (enemy->s.origin, self->s.origin, dir); VectorNormalize (dir); - if(self->monsterinfo.attack_finished > level.time) + if (self->monsterinfo.attack_finished > level.time) return; - if(!visible(self, self->enemy)) + if (!visible(self, self->enemy)) return; VectorCopy(self->s.origin, start); @@ -336,18 +336,18 @@ void hunter_pain (edict_t *self, edict_t *other, float kick, int damage) float dist; vec3_t dir; - if(self->enemy) + if (self->enemy) return; owner = self->owner; - if(!(self->spawnflags & SPHERE_DOPPLEGANGER)) + if (!(self->spawnflags & SPHERE_DOPPLEGANGER)) { - if(owner && (owner->health > 0)) + if (owner && (owner->health > 0)) return; //PMM - if(other == owner) + if (other == owner) { // if ((g_showlogic) && (g_showlogic->value)) // gi.dprintf ("hunter: won't get mad at my owner!\n"); @@ -361,34 +361,34 @@ void hunter_pain (edict_t *self, edict_t *other, float kick, int damage) self->wait = level.time + MINIMUM_FLY_TIME; } - if((self->wait - level.time) < MINIMUM_FLY_TIME) + if ((self->wait - level.time) < MINIMUM_FLY_TIME) self->wait = level.time + MINIMUM_FLY_TIME; self->s.effects |= EF_BLASTER | EF_TRACKER; self->touch = hunter_touch; self->enemy = other; -// if(g_showlogic && g_showlogic->value) +// if (g_showlogic && g_showlogic->value) // gi.dprintf("hunter_pain: mad at %s\n", other->classname); // if we're not owned by a player, no sam raimi // if we're spawned by a doppleganger, no sam raimi - if((self->spawnflags & SPHERE_DOPPLEGANGER) || !(owner && owner->client)) + if ((self->spawnflags & SPHERE_DOPPLEGANGER) || !(owner && owner->client)) return; // sam raimi cam is disabled if FORCE_RESPAWN is set. // sam raimi cam is also disabled if huntercam->value is 0. - if(!((int)dmflags->value & DF_FORCE_RESPAWN) && (huntercam && (huntercam->value))) + if (!((int)dmflags->value & DF_FORCE_RESPAWN) && (huntercam && (huntercam->value))) { VectorSubtract(other->s.origin, self->s.origin, dir); dist=VectorLength(dir); - if(owner && (dist >= 192)) + if (owner && (dist >= 192)) { // detach owner from body and send him flying owner->movetype = MOVETYPE_FLYMISSILE; // gib like we just died, even though we didn't, really. - body_gib(owner); + body_gib (owner); // move the sphere to the owner's current viewpoint. // we know it's a valid spot (or will be momentarily) @@ -427,7 +427,7 @@ void hunter_pain (edict_t *self, edict_t *other, float kick, int damage) void defender_pain (edict_t *self, edict_t *other, float kick, int damage) { //PMM - if(other == self->owner) + if (other == self->owner) { // if ((g_showlogic) && (g_showlogic->value)) // gi.dprintf ("defender: won't get mad at my owner!\n"); @@ -441,16 +441,16 @@ void defender_pain (edict_t *self, edict_t *other, float kick, int damage) // ================= void vengeance_pain (edict_t *self, edict_t *other, float kick, int damage) { - if(self->enemy) + if (self->enemy) return; - if(!(self->spawnflags & SPHERE_DOPPLEGANGER)) + if (!(self->spawnflags & SPHERE_DOPPLEGANGER)) { - if(self->owner->health >= sk_vengeance_health_threshold->value) + if (self->owner->health >= sk_vengeance_health_threshold->value) return; //PMM - if(other == self->owner) + if (other == self->owner) { // if ((g_showlogic) && (g_showlogic->value)) // gi.dprintf ("vengeance: won't get mad at my owner!\n"); @@ -463,7 +463,7 @@ void vengeance_pain (edict_t *self, edict_t *other, float kick, int damage) self->wait = level.time + MINIMUM_FLY_TIME; } - if((self->wait - level.time) < MINIMUM_FLY_TIME) + if ((self->wait - level.time) < MINIMUM_FLY_TIME) self->wait = level.time + MINIMUM_FLY_TIME; self->s.effects |= EF_ROCKET; self->touch = vengeance_touch; @@ -478,7 +478,7 @@ void vengeance_pain (edict_t *self, edict_t *other, float kick, int damage) // =================== void defender_think (edict_t *self) { - if(!self->owner) + if (!self->owner) { // gi.dprintf("think: no owner\n"); G_FreeEdict(self); @@ -492,25 +492,25 @@ void defender_think (edict_t *self) return; } - if(self->owner->health <=0) + if (self->owner->health <=0) { sphere_think_explode(self); return; } -// if(level.time - self->timestamp > 1) +// if (level.time - self->timestamp > 1) // { // gi.sound (self, CHAN_VOICE, gi.soundindex ("powerup/dsphere.wav"), 0.6, ATTN_NORM, 0); // self->timestamp = level.time; // } self->s.frame++; - if(self->s.frame>19) + if (self->s.frame>19) self->s.frame = 0; - if(self->enemy) + if (self->enemy) { - if(self->enemy->health > 0) + if (self->enemy->health > 0) { // gi.dprintf( "shooting at %s\n", self->enemy->classname); defender_shoot (self, self->enemy); @@ -526,7 +526,7 @@ void defender_think (edict_t *self) sphere_fly (self); - if(self->inuse) + if (self->inuse) self->nextthink = level.time + 0.1; } @@ -545,16 +545,16 @@ void hunter_think (edict_t *self) } owner = self->owner; - if(!owner && !(self->spawnflags & SPHERE_DOPPLEGANGER)) + if (!owner && !(self->spawnflags & SPHERE_DOPPLEGANGER)) { // gi.dprintf("think: no owner\n"); G_FreeEdict(self); return; } - if(owner) + if (owner) self->ideal_yaw = owner->s.angles[YAW]; - else if(self->enemy) // fired by doppleganger + else if (self->enemy) // fired by doppleganger { VectorSubtract(self->enemy->s.origin, self->s.origin, dir); vectoangles2(dir, ang); @@ -563,20 +563,20 @@ void hunter_think (edict_t *self) M_ChangeYaw(self); -// if(level.time - self->timestamp > 1) +// if (level.time - self->timestamp > 1) // { // gi.sound (self, CHAN_VOICE, gi.soundindex ("powerup/hsphere.wav"), 0.5, ATTN_NORM, 0); // self->timestamp = level.time; // } - if(self->enemy) + if (self->enemy) { sphere_chase (self, 0); // deal with sam raimi cam - if(owner && (owner->flags & FL_SAM_RAIMI)) + if (owner && (owner->flags & FL_SAM_RAIMI)) { - if(self->inuse) + if (self->inuse) { owner->movetype = MOVETYPE_FLYMISSILE; // VectorCopy(self->s.angles, owner->s.angles); @@ -611,7 +611,7 @@ void hunter_think (edict_t *self) sphere_fly (self); } - if(self->inuse) + if (self->inuse) self->nextthink = level.time + 0.1; } @@ -626,20 +626,20 @@ void vengeance_think (edict_t *self) return; } - if(!(self->owner) && !(self->spawnflags & SPHERE_DOPPLEGANGER)) + if (!(self->owner) && !(self->spawnflags & SPHERE_DOPPLEGANGER)) { // gi.dprintf("think: no owner\n"); G_FreeEdict(self); return; } -// if(level.time - self->timestamp > 1) +// if (level.time - self->timestamp > 1) // { // gi.sound (self, CHAN_VOICE, gi.soundindex ("powerup/vsphere.wav"), 0.5, ATTN_NORM, 0); // self->timestamp = level.time; // } - if(self->enemy) + if (self->enemy) { // sphere_fire (self, self->owner->enemy); sphere_chase (self, 1); @@ -647,7 +647,7 @@ void vengeance_think (edict_t *self) else sphere_fly (self); - if(self->inuse) + if (self->inuse) self->nextthink = level.time + 0.1; } @@ -671,7 +671,7 @@ edict_t *Sphere_Spawn (edict_t *owner, int spawnflags) sphere->s.renderfx = RF_FULLBRIGHT | RF_IR_VISIBLE; sphere->movetype = MOVETYPE_FLYMISSILE; - if(spawnflags & SPHERE_DOPPLEGANGER) + if (spawnflags & SPHERE_DOPPLEGANGER) sphere->teammaster = owner->teammaster; else sphere->owner = owner; @@ -686,6 +686,7 @@ edict_t *Sphere_Spawn (edict_t *owner, int spawnflags) switch(spawnflags & SPHERE_TYPE) { case SPHERE_DEFENDER: + sphere->class_id = ENTITY_SPHERE_DEFENDER; sphere->s.modelindex = gi.modelindex("models/items/defender/tris.md2"); sphere->s.modelindex2 = gi.modelindex("models/items/shell/tris.md2"); sphere->s.sound = gi.soundindex ("spheres/d_idle.wav"); @@ -695,6 +696,7 @@ edict_t *Sphere_Spawn (edict_t *owner, int spawnflags) sphere->think = defender_think; break; case SPHERE_HUNTER: + sphere->class_id = ENTITY_SPHERE_HUNTER; sphere->s.modelindex = gi.modelindex("models/items/hunter/tris.md2"); sphere->s.sound = gi.soundindex ("spheres/h_idle.wav"); sphere->wait = level.time + sk_hunter_time->value; @@ -703,6 +705,7 @@ edict_t *Sphere_Spawn (edict_t *owner, int spawnflags) sphere->think = hunter_think; break; case SPHERE_VENGEANCE: + sphere->class_id = ENTITY_SPHERE_VENGEANCE; sphere->s.modelindex = gi.modelindex("models/items/vengnce/tris.md2"); sphere->s.sound = gi.soundindex ("spheres/v_idle.wav"); sphere->wait = level.time + sk_vengeance_time->value; @@ -730,21 +733,21 @@ edict_t *Sphere_Spawn (edict_t *owner, int spawnflags) // ================= void Own_Sphere (edict_t *self, edict_t *sphere) { - if(!sphere) + if (!sphere) return; // ownership only for players - if(self->client) + if (self->client) { // if they don't have one - if(!(self->client->owned_sphere)) + if (!(self->client->owned_sphere)) { self->client->owned_sphere = sphere; } // they already have one, take care of the old one else { - if(self->client->owned_sphere->inuse) + if (self->client->owned_sphere->inuse) { G_FreeEdict(self->client->owned_sphere); self->client->owned_sphere = sphere; diff --git a/missionpack/g_target.c b/missionpack/g_target.c index 185ede6..8bf2664 100644 --- a/missionpack/g_target.c +++ b/missionpack/g_target.c @@ -14,6 +14,8 @@ void Use_Target_Tent (edict_t *ent, edict_t *other, edict_t *activator) void SP_target_temp_entity (edict_t *ent) { + ent->class_id = ENTITY_TARGET_TEMP_ENTITY; + ent->use = Use_Target_Tent; } @@ -88,6 +90,8 @@ void Use_Target_Speaker (edict_t *ent, edict_t *other, edict_t *activator) void SP_target_speaker (edict_t *ent) { + ent->class_id = ENTITY_TARGET_SPEAKER; + if (!(ent->spawnflags & 8)) { if (!st.noise) @@ -109,7 +113,6 @@ void SP_target_speaker (edict_t *ent) strcpy(ent->message,st.noise); } } - ent->class_id = ENTITY_TARGET_SPEAKER; ent->noise_index = gi.soundindex (ent->message); ent->spawnflags &= ~8; @@ -158,7 +161,7 @@ void Use_Target_Help (edict_t *ent, edict_t *other, edict_t *activator) /*QUAKED target_help (1 0 1) (-16 -16 -24) (16 16 24) help1 When fired, the "message" key becomes the current personal computer string, and the message light will be set on all clients status bars. */ -void SP_target_help(edict_t *ent) +void SP_target_help (edict_t *ent) { if (deathmatch->value) { // auto-remove for deathmatch @@ -172,6 +175,9 @@ void SP_target_help(edict_t *ent) G_FreeEdict (ent); return; } + + ent->class_id = ENTITY_TARGET_HELP; + ent->use = Use_Target_Help; } @@ -199,6 +205,8 @@ void SP_target_secret (edict_t *ent) return; } + ent->class_id = ENTITY_TARGET_SECRET; + ent->use = use_target_secret; if (!st.noise) st.noise = "misc/secret.wav"; @@ -237,6 +245,7 @@ void SP_target_goal (edict_t *ent) G_FreeEdict (ent); return; } + ent->class_id = ENTITY_TARGET_GOAL; ent->use = use_target_goal; if (!st.noise) @@ -311,6 +320,8 @@ void use_target_explosion (edict_t *self, edict_t *other, edict_t *activator) void SP_target_explosion (edict_t *ent) { + ent->class_id = ENTITY_TARGET_EXPLOSION; + ent->use = use_target_explosion; ent->svflags = SVF_NOCLIENT; } @@ -504,6 +515,8 @@ void SP_target_changelevel (edict_t *ent) return; } + ent->class_id = ENTITY_TARGET_CHANGELEVEL; + if ((deathmatch->value || coop->value) && (ent->spawnflags & 2)) { gi.dprintf("target_changelevel at %s\nLANDMARK only valid in single-player\n", @@ -554,6 +567,8 @@ void use_target_splash (edict_t *self, edict_t *other, edict_t *activator) void SP_target_splash (edict_t *self) { + self->class_id = ENTITY_TARGET_SPLASH; + self->use = use_target_splash; G_SetMovedir (self->s.angles, self->movedir); @@ -611,6 +626,8 @@ void use_target_spawner (edict_t *self, edict_t *other, edict_t *activator) void SP_target_spawner (edict_t *self) { + self->class_id = ENTITY_TARGET_SPEAKER; + self->use = use_target_spawner; self->svflags = SVF_NOCLIENT; if (self->speed) @@ -963,6 +980,8 @@ void SP_target_blaster (edict_t *self) self->use = use_target_blaster; } + self->class_id = ENTITY_TARGET_BLASTER; + gi.linkentity(self); self->svflags = SVF_NOCLIENT; } @@ -981,6 +1000,8 @@ void trigger_crosslevel_trigger_use (edict_t *self, edict_t *other, edict_t *act void SP_target_crosslevel_trigger (edict_t *self) { + self->class_id = ENTITY_TARGET_CROSSLEVEL_TRIGGER; + self->svflags = SVF_NOCLIENT; self->use = trigger_crosslevel_trigger_use; } @@ -1002,6 +1023,8 @@ void target_crosslevel_target_think (edict_t *self) void SP_target_crosslevel_target (edict_t *self) { + self->class_id = ENTITY_TARGET_CROSSLEVEL_TARGET; + if (! self->delay) self->delay = 1; self->svflags = SVF_NOCLIENT; @@ -1858,6 +1881,8 @@ void target_lightramp_use (edict_t *self, edict_t *other, edict_t *activator) void SP_target_lightramp (edict_t *self) { + self->class_id = ENTITY_TARGET_LIGHTRAMP; + // DWH: CUSTOM spawnflag allows custom light switching, speed is ignored if (self->spawnflags & LIGHTRAMP_CUSTOM) { @@ -1988,6 +2013,8 @@ void target_earthquake_use (edict_t *self, edict_t *other, edict_t *activator) void SP_target_earthquake (edict_t *self) { + self->class_id = ENTITY_TARGET_EARTHQUAKE; + if (!self->targetname) gi.dprintf("untargeted %s at %s\n", self->classname, vtos(self->s.origin)); diff --git a/missionpack/g_tracktrain.c b/missionpack/g_tracktrain.c index cd489ef..41c223e 100644 --- a/missionpack/g_tracktrain.c +++ b/missionpack/g_tracktrain.c @@ -892,7 +892,7 @@ void tracktrain_think (edict_t *self) VectorClear (self->avelocity); self->nextthink = 0; // if (self->movewith_next && (self->movewith_next->movewith_ent == self)) - // set_child_movement(self); + // set_child_movement (self); gi.linkentity(self); return; } @@ -1015,7 +1015,7 @@ void tracktrain_think (edict_t *self) } } //if (self->movewith_next && (self->movewith_next->movewith_ent == self)) - // set_child_movement(self); + // set_child_movement (self); if ( (time < 1.5*FRAMETIME) && !(self->spawnflags & SF_TRACKTRAIN_DISABLED)) self->think = tracktrain_reach_dest; @@ -1801,7 +1801,7 @@ void func_tracktrain_find (edict_t *self) ent->enemy = self; ent->nextthink = level.time + FRAMETIME; - VectorCopy (self->s.origin, daoldorigin); //Knightmare- copy old orgin for reference + VectorCopy (self->s.origin, daoldorigin); // Knightmare- copy old orgin for reference VectorCopy (ent->s.origin, self->s.origin); self->s.origin[2] += self->viewheight; @@ -1977,7 +1977,7 @@ void SP_func_tracktrain (edict_t *self) self->turn_rider = 1; VectorClear (self->s.angles); - self->postthink = train_move_children; //Knightmare- supports movewith + self->postthink = train_move_children; // Knightmare- supports movewith if (self->target) { diff --git a/missionpack/g_trigger.c b/missionpack/g_trigger.c index 52c89ad..d2c0fd9 100644 --- a/missionpack/g_trigger.c +++ b/missionpack/g_trigger.c @@ -157,6 +157,8 @@ void trigger_enable (edict_t *self, edict_t *other, edict_t *activator) void SP_trigger_multiple (edict_t *ent) { + ent->class_id = ENTITY_TRIGGER_MULTIPLE; + if (ent->sounds == 1) ent->noise_index = gi.soundindex ("misc/secret.wav"); else if (ent->sounds == 2) @@ -226,6 +228,8 @@ void SP_trigger_once(edict_t *ent) ent->wait = -1; SP_trigger_multiple (ent); + + ent->class_id = ENTITY_TRIGGER_ONCE; } //Knightmare @@ -284,7 +288,7 @@ count - how many times it can be used before being auto-killtargeted void trigger_relay_use (edict_t *self, edict_t *other, edict_t *activator) { G_UseTargets (self, activator); - //Knightmare- decrement count and auto-killtarget + // Knightmare- decrement count and auto-killtarget self->count--; if (self->count == 0) { @@ -296,6 +300,8 @@ void trigger_relay_use (edict_t *self, edict_t *other, edict_t *activator) void SP_trigger_relay (edict_t *self) { + self->class_id = ENTITY_TRIGGER_RELAY; + // DWH - gives trigger_relay same message-displaying, sound-playing capabilities // as trigger_multiple and trigger_once if (self->sounds == 1) @@ -306,6 +312,7 @@ void SP_trigger_relay (edict_t *self) self->noise_index = -1; if (!self->count) self->count=-1; // end DWH + self->use = trigger_relay_use; } @@ -474,11 +481,34 @@ void SP_trigger_key (edict_t *self) gi.dprintf("%s at %s has no target\n", self->classname, vtos(self->s.origin)); return; } - //Knightmare- don't load these sounds if it is silent + + self->class_id = ENTITY_TRIGGER_KEY; + + // Knightmare- don't load these sounds if it is silent if (!(self->spawnflags & 4)) { - gi.soundindex ("misc/keytry.wav"); - gi.soundindex ("misc/keyuse.wav"); + int index; + + index = ITEM_INDEX(self->item); + if (self->item->flags & IT_Q1) + { + if (index == key_q1_med_gold_index || index == key_q1_med_silver_index) { + gi.soundindex ("q1world/doors/medtry.wav"); + gi.soundindex ("q1world/doors/meduse.wav"); + } + else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index) { + gi.soundindex ("q1world/doors/runetry.wav"); + gi.soundindex ("q1world/doors/runeuse.wav"); + } + else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index) { + gi.soundindex ("q1world/doors/basetry.wav"); + gi.soundindex ("q1world/doors/baseuse.wav"); + } + } + else { + gi.soundindex ("misc/keytry.wav"); + gi.soundindex ("misc/keyuse.wav"); + } } self->use = trigger_key_use; } @@ -538,6 +568,8 @@ void trigger_counter_use (edict_t *self, edict_t *other, edict_t *activator) void SP_trigger_counter (edict_t *self) { + self->class_id = ENTITY_TRIGGER_COUNTER; + self->wait = -1; if (!self->count) self->count = 2; @@ -559,6 +591,8 @@ This trigger will always fire. It is activated by the world. */ void SP_trigger_always (edict_t *ent) { + ent->class_id = ENTITY_TRIGGER_ALWAYS; + // we must have some delay to make sure our use targets are present if (ent->delay < 0.2) ent->delay = 0.2; @@ -648,7 +682,10 @@ SILENT - Doesn't make wind noise void SP_trigger_push (edict_t *self) { + self->class_id = ENTITY_TRIGGER_PUSH; + InitTrigger (self); + if (self->spawnflags & PUSH_CUSTOM_SND) { if (st.noise) @@ -706,6 +743,7 @@ SILENT - Doesn't make wind noise void SP_trigger_push_bbox (edict_t *self) { InitTriggerBbox (self); + if (self->spawnflags & PUSH_CUSTOM_SND) { if (st.noise) @@ -808,6 +846,8 @@ void hurt_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *sur void SP_trigger_hurt (edict_t *self) { + self->class_id = ENTITY_TRIGGER_HURT; + InitTrigger (self); self->noise_index = gi.soundindex ("world/electro.wav"); @@ -848,6 +888,8 @@ void SP_trigger_hurt_bbox (edict_t *self) { InitTriggerBbox (self); + self->class_id = ENTITY_TRIGGER_HURT; + self->noise_index = gi.soundindex ("world/electro.wav"); self->touch = hurt_touch; @@ -905,9 +947,10 @@ void SP_trigger_gravity (edict_t *self) G_FreeEdict (self); return; } - InitTrigger (self); + self->class_id = ENTITY_TRIGGER_GRAVITY; + //PGM // self->gravity = atoi(st.gravity); self->gravity = atof(st.gravity); @@ -949,6 +992,8 @@ void SP_trigger_gravity_bbox (edict_t *self) InitTriggerBbox (self); + self->class_id = ENTITY_TRIGGER_GRAVITY; + //PGM // self->gravity = atoi(st.gravity); self->gravity = atof(st.gravity); @@ -1005,6 +1050,8 @@ void trigger_monsterjump_touch (edict_t *self, edict_t *other, cplane_t *plane, void SP_trigger_monsterjump (edict_t *self) { + self->class_id = ENTITY_TRIGGER_MONSTERJUMP; + if (!self->speed) self->speed = 200; @@ -1014,13 +1061,17 @@ void SP_trigger_monsterjump (edict_t *self) st.height = 200; if (self->s.angles[YAW] == 0) self->s.angles[YAW] = 360; + InitTrigger (self); + self->touch = trigger_monsterjump_touch; self->movedir[2] = st.height; } void SP_trigger_monsterjump_bbox (edict_t *self) { + self->class_id = ENTITY_TRIGGER_MONSTERJUMP; + if (!self->speed) self->speed = 200; if (self->height) @@ -1060,6 +1111,8 @@ void trigger_mass_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac void SP_trigger_mass (edict_t *self) { + self->class_id = ENTITY_TRIGGER_MASS; + // Fires its target if touched by an entity weighing at least // self->mass if (self->sounds == 1) @@ -1107,6 +1160,8 @@ tright Max b-box coords XYZ. Default = 16 16 16 void SP_trigger_mass_bbox (edict_t *self) { + self->class_id = ENTITY_TRIGGER_MASS; + // Fires its target if touched by an entity weighing at least // self->mass if (self->sounds == 1) @@ -1194,6 +1249,9 @@ void SP_trigger_inside (edict_t *self) G_FreeEdict(self); return; } + + self->class_id = ENTITY_TRIGGER_INSIDE; + self->movetype = MOVETYPE_NONE; self->svflags |= SVF_NOCLIENT; self->solid = SOLID_TRIGGER; @@ -1238,6 +1296,8 @@ void SP_trigger_inside_bbox (edict_t *self) } InitTriggerBbox (self); + self->class_id = ENTITY_TRIGGER_INSIDE; + if (!self->wait) self->wait = 0.2; @@ -1250,7 +1310,7 @@ void SP_trigger_inside_bbox (edict_t *self) // TRIGGER_SCALES - coupled with target_characters, displays the weight of all // entities that are "standing on" the trigger. //================================================================================== -float weight_on_top(edict_t *ent) +float weight_on_top (edict_t *ent) { float weight; int i; @@ -1324,6 +1384,8 @@ void SP_trigger_scales (edict_t *self) G_FreeEdict(self); return; } + self->class_id = ENTITY_TRIGGER_SCALES; + self->movetype = MOVETYPE_NONE; self->svflags |= SVF_NOCLIENT; self->solid = SOLID_TRIGGER; @@ -1345,9 +1407,10 @@ void SP_trigger_scales_bbox (edict_t *self) G_FreeEdict(self); return; } - InitTriggerBbox (self); + self->class_id = ENTITY_TRIGGER_SCALES; + self->think = trigger_scales_think; self->nextthink = level.time + 1.0; self->mass = 0; @@ -1494,6 +1557,8 @@ void SP_trigger_look (edict_t *self) { InitTriggerBbox (self); + self->class_id = ENTITY_TRIGGER_LOOK; + if (self->sounds == 1) self->noise_index = gi.soundindex ("misc/secret.wav"); else if (self->sounds == 2) @@ -1570,6 +1635,9 @@ void SP_trigger_speaker (edict_t *self) gi.dprintf("trigger_speaker with no noise set at %s\n", vtos(self->s.origin)); return; } + + self->class_id = ENTITY_TRIGGER_SPEAKER; + if (!strstr (st.noise, ".wav")) Com_sprintf (buffer, sizeof(buffer), "%s.wav", st.noise); else @@ -1603,7 +1671,7 @@ void SP_trigger_speaker (edict_t *self) //============================================================================== void WriteEdict (FILE *f, edict_t *ent); -qboolean HasSpawnFunction(edict_t *ent) +qboolean HasSpawnFunction (edict_t *ent) { spawn_t *s; gitem_t *item; @@ -1637,11 +1705,11 @@ void WriteTransitionEdict (FILE *f, edict_t *changelevel, edict_t *ent) void *p; memcpy(&e,ent,sizeof(edict_t)); - if (!Q_stricmp(e.classname,"target_laser") || - !Q_stricmp(e.classname,"target_blaster") ) + if (!Q_stricmp(e.classname, "target_laser") || + !Q_stricmp(e.classname, "target_blaster") ) vectoangles(e.movedir,e.s.angles); - if (!Q_stricmp(e.classname,"target_speaker")) + if (!Q_stricmp(e.classname, "target_speaker")) e.spawnflags |= 8; // indicates that "message" contains noise if (changelevel->s.angles[YAW]) @@ -1759,7 +1827,7 @@ entlist_t DoNotMove[] = { {"target_lock_digit"}, {"target_rotation"}, {"target_secret"}, - {"target_speaker"}, //Knightmare- don't move speakers + {"target_speaker"}, // Knightmare- don't move speakers {"target_splash"}, {"target_steam"}, {"target_string"}, @@ -1936,6 +2004,8 @@ void SP_trigger_transition (edict_t *self) gi.dprintf("trigger_transition w/o a targetname\n"); G_FreeEdict(self); } + self->class_id = ENTITY_TRIGGER_TRANSITION; + self->solid = SOLID_NOT; self->movetype = MOVETYPE_NONE; gi.setmodel (self, self->model); @@ -1949,6 +2019,8 @@ void SP_trigger_transition_bbox (edict_t *self) gi.dprintf("trigger_transition_bbox w/o a targetname\n"); G_FreeEdict(self); } + self->class_id = ENTITY_TRIGGER_TRANSITION; + self->solid = SOLID_NOT; self->movetype = MOVETYPE_NONE; if ( (!VectorLength(self->bleft)) && (!VectorLength(self->tright)) ) @@ -2073,7 +2145,7 @@ void trigger_switch_usetargets (edict_t *ent, edict_t *activator) case ENTITY_FUNC_FORCE_WALL: case ENTITY_FUNC_WALL: if (t->solid == SOLID_BSP) - on=1; + on = 1; break; case ENTITY_FUNC_PENDULUM: case ENTITY_FUNC_TRAIN: @@ -2088,33 +2160,33 @@ void trigger_switch_usetargets (edict_t *ent, edict_t *activator) case ENTITY_TARGET_MAL_LASER: case ENTITY_TARGET_PRECIPITATION: if (t->spawnflags & 1) - on=1; + on = 1; break; case ENTITY_FUNC_REFLECT: if (!(t->spawnflags & 1)) - on=1; + on = 1; break; case ENTITY_FUNC_ROTATING: on = VectorCompare (t->avelocity, vec3_origin); break; case ENTITY_FUNC_TIMER: if (t->nextthink) - on=1; + on = 1; break; case ENTITY_FUNC_TRACKTRAIN: if (!(t->spawnflags & 128)) - on=1; + on = 1; break; case ENTITY_MODEL_TURRET: case ENTITY_TURRET_BREACH: if (t->spawnflags & 16) - on=1; + on = 1; break; case ENTITY_TARGET_EFFECT: if (t->spawnflags & 3) { if (t->spawnflags & 1) - on=1; + on = 1; } else on = -1; @@ -2123,23 +2195,23 @@ void trigger_switch_usetargets (edict_t *ent, edict_t *activator) if (t->spawnflags & 3) { if (t->s.sound) - on=1; + on = 1; } else - on=-1; + on = -1; break; default: - on=-1; + on = -1; } if (ent->spawnflags & TRIGGER_TARGET_OFF) { // Only use target if it is currently ON - if (on==1) + if (on == 1) t->use (t, ent, activator); } - else if (on==0) + else if (on == 0) { // Only use target if it is currently OFF t->use (t, ent, activator); @@ -2215,6 +2287,7 @@ void use_trigger_switch (edict_t *ent, edict_t *other, edict_t *activator) void SP_trigger_switch (edict_t *ent) { ent->class_id = ENTITY_TRIGGER_SWITCH; + if (ent->sounds == 1) ent->noise_index = gi.soundindex ("misc/secret.wav"); else if (ent->sounds == 2) diff --git a/missionpack/g_turret.c b/missionpack/g_turret.c index d42e3a0..1649ede 100644 --- a/missionpack/g_turret.c +++ b/missionpack/g_turret.c @@ -1313,7 +1313,7 @@ void turret_breach_finish_init (edict_t *self) // Knightmare- if we've been moved by a func_train before initializing, // shift firing point by the distance moved if (VectorLength(self->aim_point)) - VectorAdd(self->move_origin, self->aim_point, self->move_origin); + VectorAdd (self->move_origin, self->aim_point, self->move_origin); G_FreeEdict(self->target_ent); @@ -1326,7 +1326,7 @@ void turret_breach_finish_init (edict_t *self) // Knightmare- if we've been moved by a func_train before initializing, // shift firing point by the distance moved if (VectorLength(self->aim_point)) - VectorAdd(self->muzzle2, self->aim_point, self->muzzle2); + VectorAdd (self->muzzle2, self->aim_point, self->muzzle2); self->moreflags |= FL2_TURRET_DOUBLE; if (self->style > 0) @@ -2178,6 +2178,8 @@ void SP_turret_invisible_brain (edict_t *self) self->nextthink = level.time + FRAMETIME; } + self->class_id = ENTITY_TURRET_INVISIBLE_BRAIN; + self->movetype = MOVETYPE_PUSH; gi.linkentity (self); } diff --git a/missionpack/g_utils.c b/missionpack/g_utils.c index 8a25baa..77a57c0 100644 --- a/missionpack/g_utils.c +++ b/missionpack/g_utils.c @@ -693,7 +693,22 @@ Marks the edict as free void G_FreeEdict (edict_t *ed) { - if (ed->speaker) //recursively remove train's speaker entity + // Lazarus - if part of a movewith chain, remove from + // the chain and repair broken links +/* if (ed->movewith) + { + edict_t *e; + edict_t *parent = NULL; + int i; + + for (i=1; imovewith_next == ed) parent = e; + } + if (parent) parent->movewith_next = ed->movewith_next; + }*/ + + if (ed->speaker) // recursively remove train's speaker entity G_FreeEdict(ed->speaker); // Knightmare- stop target_playback diff --git a/missionpack/g_vehicle.c b/missionpack/g_vehicle.c index ad2e471..c3fa78a 100644 --- a/missionpack/g_vehicle.c +++ b/missionpack/g_vehicle.c @@ -411,7 +411,7 @@ void vehicle_think (edict_t *self) } } // if(self->movewith_next && (self->movewith_next->movewith_ent == self)) -// set_child_movement(self); +// set_child_movement (self); } void turn_vehicle (edict_t *self) @@ -422,13 +422,16 @@ void turn_vehicle (edict_t *self) } void SP_func_vehicle (edict_t *self) { + self->class_id = ENTITY_FUNC_VEHICLE; + self->ideal_yaw = self->s.angles[YAW]; VectorClear (self->s.angles); self->solid = SOLID_BSP; gi.setmodel (self, self->model); // usermodel (for alias model vehicles) goes on modelindex2 - if (self->usermodel && strlen(self->usermodel)) { + if (self->usermodel && strlen(self->usermodel)) + { char modelname[256]; // check for "models/" already in path if ( !strncmp(self->usermodel, "models/", 7) ) @@ -476,6 +479,7 @@ void SP_func_vehicle (edict_t *self) if (self->health) { self->die = func_vehicle_explode; self->takedamage = DAMAGE_YES; - } else + } + else self->takedamage = DAMAGE_NO; } diff --git a/missionpack/g_weapon.c b/missionpack/g_weapon.c index 01b6485..f528b8b 100644 --- a/missionpack/g_weapon.c +++ b/missionpack/g_weapon.c @@ -416,6 +416,7 @@ void fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int spee if (hyper) bolt->spawnflags = 1; bolt->classname = "bolt"; + bolt->class_id = ENTITY_BOLT; gi.linkentity (bolt); if (self->client) @@ -460,6 +461,7 @@ void fire_blueblaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int bolt->think = G_FreeEdict; bolt->dmg = damage; bolt->classname = "bolt"; + bolt->class_id = ENTITY_BOLT; gi.linkentity (bolt); if (self->client) @@ -609,7 +611,6 @@ void Grenade_Evade (edict_t *monster) } } -//static void Grenade_Explode (edict_t *ent) void Grenade_Explode (edict_t *ent) { vec3_t origin; @@ -761,6 +762,7 @@ void fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int s grenade->dmg = damage; grenade->dmg_radius = damage_radius; grenade->classname = "grenade"; + grenade->class_id = ENTITY_GRENADE; gi.linkentity (grenade); } @@ -801,6 +803,7 @@ void fire_grenade2 (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int grenade->dmg = damage; grenade->dmg_radius = damage_radius; grenade->classname = "hgrenade"; + grenade->class_id = ENTITY_HANDGRENADE; if (held) grenade->spawnflags = 3; else @@ -1062,6 +1065,7 @@ void fire_missile (edict_t *self, vec3_t start, vec3_t dir, int damage, int spee missile->enemy = home_target; missile->classname = "homing rocket"; + missile->class_id = ENTITY_ROCKET; missile->nextthink = level.time + FRAMETIME; missile->think = homing_think; missile->starttime = level.time + 0.3; // play homing sound on 3rd frame @@ -1076,6 +1080,7 @@ void fire_missile (edict_t *self, vec3_t start, vec3_t dir, int damage, int spee else { missile->classname = "missile"; + missile->class_id = ENTITY_ROCKET; missile->nextthink = level.time + 8000.0f/speed; missile->think = G_FreeEdict; Rocket_Evade (missile, dir, speed); @@ -1389,8 +1394,8 @@ void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed vec3_t right, up; vec3_t lateral_speed; - AngleVectors(self->s.angles,NULL,right,up); - VectorCopy(self->velocity,lateral_speed); + AngleVectors (self->s.angles, NULL, right, up); + VectorCopy (self->velocity, lateral_speed); lateral_speed[0] *= fabs(right[0]); lateral_speed[1] *= fabs(right[1]); lateral_speed[2] *= fabs(up[2]); @@ -1420,6 +1425,7 @@ void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed } else rocket->classname = "rocket"; + rocket->class_id = ENTITY_ROCKET; rocket->owner = self; rocket->touch = rocket_touch; @@ -1983,6 +1989,7 @@ void fire_ionripper (edict_t *self, vec3_t start, vec3_t dir, int damage, int sp ion = G_Spawn (); ion->classname = "ion"; + ion->class_id = ENTITY_ION; VectorCopy (start, ion->s.origin); VectorCopy (start, ion->s.old_origin); vectoangles (dir, ion->s.angles); @@ -1993,7 +2000,7 @@ void fire_ionripper (edict_t *self, vec3_t start, vec3_t dir, int damage, int sp ion->solid = SOLID_BBOX; ion->s.effects |= effect; - ion->s.renderfx |= RF_FULLBRIGHT | RF_NOSHADOW; //Knightmare- no shadow + ion->s.renderfx |= RF_FULLBRIGHT | RF_NOSHADOW; // Knightmare- no shadow VectorClear (ion->mins); VectorClear (ion->maxs); @@ -2210,6 +2217,8 @@ void fire_rocket_heat (edict_t *self, vec3_t start, vec3_t dir, int damage, int edict_t *heat; heat = G_Spawn(); + heat->classname = "rocket"; + heat->class_id = ENTITY_ROCKET; VectorCopy (start, heat->s.origin); VectorCopy (dir, heat->movedir); vectoangles (dir, heat->s.angles); @@ -2293,6 +2302,7 @@ void fire_plasma (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed plasma = G_Spawn(); plasma->classname = "plasma"; + plasma->class_id = ENTITY_PLASMA; VectorCopy (start, plasma->s.origin); VectorCopy (dir, plasma->movedir); vectoangles (dir, plasma->s.angles); @@ -2651,6 +2661,7 @@ void fire_trap (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int spee trap->dmg = damage; trap->dmg_radius = damage_radius; trap->classname = "htrap"; + trap->class_id = ENTITY_TRAP; // RAFAEL 16-APR-98 trap->s.sound = gi.soundindex ("weapons/traploop.wav"); // END 16-APR-98 @@ -3295,6 +3306,7 @@ edict_t *Spawn_Goop (edict_t *ent, vec3_t start) VectorCopy (start, goop->s.origin); goop->classname = "goop"; + goop->class_id = ENTITY_GOOP; goop->s.effects |= EF_BLUEHYPERBLASTER | EF_ANIM_ALLFAST; // bat to get rid of the blue flag effect diff --git a/missionpack/g_weapon_q1.c b/missionpack/g_weapon_q1.c index f824d8f..8073aa5 100644 --- a/missionpack/g_weapon_q1.c +++ b/missionpack/g_weapon_q1.c @@ -100,6 +100,7 @@ void q1_fire_nail (edict_t *self, vec3_t start, vec3_t dir, int damage, int spee nail->spawnflags = 1; nail->common_name = "Nail"; + nail->class_id = ENTITY_Q1_NAIL; gi.linkentity (nail); @@ -197,6 +198,7 @@ void q1_fire_laser (edict_t *self, vec3_t start, vec3_t dir, int damage, int spe laser->classname = "laser"; laser->common_name = "Laser"; + laser->class_id = ENTITY_Q1_LASER; gi.linkentity (laser); @@ -309,6 +311,7 @@ void q1_fire_flame (edict_t *self, vec3_t start, vec3_t dir, float leftrightoff) bolt->classname = "bolt"; bolt->common_name = "Hell Knight Flame"; + bolt->class_id = ENTITY_Q1_HKNIGHT_FLAME; gi.linkentity (bolt); @@ -441,6 +444,7 @@ void q1_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, in grenade->classname = "grenade"; grenade->common_name = "Quake Grenade"; + grenade->class_id = ENTITY_Q1_GRENADE; gi.linkentity (grenade); } @@ -569,6 +573,7 @@ void q1_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int sp q1rocket_trail (rocket, start, dir); rocket->common_name = "Quake Rocket"; + rocket->class_id = ENTITY_Q1_ROCKET; gi.linkentity (rocket); } @@ -752,6 +757,7 @@ void q1_fire_firepod (edict_t *self, vec3_t dir) pod->owner = self; pod->common_name = "Firepod"; + pod->class_id = ENTITY_Q1_FIREPOD; gi.linkentity (pod); @@ -850,6 +856,7 @@ void q1_fire_lavaball (edict_t *self, vec3_t start, vec3_t dir, int damage, int lavaball->classname = "chthon_lavaball"; lavaball->common_name = "Chthon Lavaball"; + lavaball->class_id = ENTITY_Q1_LAVABALL; gi.linkentity (lavaball); } @@ -931,6 +938,7 @@ void q1_fire_acidspit (edict_t *self, vec3_t start, vec3_t dir, int damage, int acidbolt->classname = "acidbolt"; acidbolt->common_name = "Acid Bolt"; + acidbolt->class_id = ENTITY_Q1_ACIDBOLT; gi.linkentity (acidbolt); } @@ -1004,11 +1012,13 @@ void q1_fire_gib (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int sp gib->owner = self; gib->touch = q1_zombiegib_touch; gib->nextthink = level.time + 2.5; - gib->think = G_FreeEdict; +// gib->think = G_FreeEdict; + gib->think = gib_fade; // use gib_fade() instead of directly removing gib->dmg = damage; gib->classname = "gib"; gib->common_name = "Gib Projectile"; + gib->class_id = ENTITY_Q1_ZOMBIE_GIB; gi.linkentity (gib); } diff --git a/missionpack/laz_misc.h b/missionpack/laz_misc.h index 29cd73e..bd84369 100644 --- a/missionpack/laz_misc.h +++ b/missionpack/laz_misc.h @@ -304,68 +304,85 @@ ENTITY_MONSTER_COCO_MONKEY, ENTITY_MONSTER_PIERRE_MONKEY1, ENTITY_MONSTER_PIERRE_MONKEY2, ENTITY_MONSTER_PIERRE_MONKEY3, -ENTITY_FLAME1, -ENTITY_FLAME1_S, -ENTITY_FLAME2, -ENTITY_FLAME2_S, -ENTITY_SICK_GUARD, -ENTITY_GEKK_WRITHE, +ENTITY_LIGHT_TORCH, +ENTITY_LIGHT_FLAME, +ENTITY_LIGHT_FLAME_CM, +ENTITY_MISC_SICK_GUARD, +ENTITY_MISC_GEKK_WRITHE, +ENTITY_TARGET_COMMAND, +ENTITY_TARGET_GLOBAL_TEXT, // Xatrix +ENTITY_MONSTER_GEKK, ENTITY_MONSTER_BRAIN_BETA, ENTITY_MONSTER_CHICK_HEAT, ENTITY_MONSTER_GLADIATOR_BETA, ENTITY_MONSTER_SOLDIER_RIPPER, ENTITY_MONSTER_SOLDIER_HYPERGUN, ENTITY_MONSTER_SOLDIER_LASER, -ENTITY_MONSTER_BOSS5, +ENTITY_MONSTER_SUPERTANK_BETA, ENTITY_ION, ENTITY_PLASMA, ENTITY_TRAP, ENTITY_LOOGIE, +ENTITY_MISC_VIPER_MISSILE, +ENTITY_MISC_TRANSPORT, ENTITY_MISC_AMB4, ENTITY_ROTATING_LIGHT, ENTITY_OBJECT_REPAIR, +ENTITY_ITEM_FOODCUBE, // Rogue +ENTITY_INFO_PLAYER_COOP_LAVA, ENTITY_FUNC_DM_WALL, +ENTITY_TRIGGER_TELEPORT, +ENTITY_TARGET_STEAM, +ENTITY_TARGET_KILLPLAYERS, +ENTITY_TARGET_BLACKLIGHT, +ENTITY_TARGET_ORB, +ENTITY_TURRET_INVISIBLE_BRAIN, ENTITY_MONSTER_MEDIC_COMMANDER, ENTITY_MONSTER_DAEDALUS, ENTITY_MONSTER_FLYER_KAMIKAZE, ENTITY_STALKER, -ENTITY_MONSTER_TURRET, ENTITY_MONSTER_CARRIER, ENTITY_MONSTER_WIDOW, ENTITY_MONSTER_WIDOW2, +ENTITY_MONSTER_TURRET, +ENTITY_TURRET_WALL, ENTITY_BOLT2, ENTITY_FLECHETTE, -ENTITY_DISRUPTOR, +ENTITY_TRACKER, ENTITY_MINE_PROX, ENTITY_MINE_TESLA, -ENTITY_AM_BOMB, +ENTITY_FLAMEBURST, +ENTITY_INCENDIARY_GRENADE, +ENTITY_NUKE, ENTITY_SPHERE_DEFENDER, ENTITY_SPHERE_VENGEANCE, ENTITY_SPHERE_HUNTER, ENTITY_DOPPLEGANGER, ENTITY_TAGTOKEN, -ENTITY_NUKE_CORE, -ENTITY_NUKE, +ENTITY_MISC_NUKE_CORE, +ENTITY_MISC_NUKE, // Zaero ENTITY_FUNC_BARRIER, +ENTITY_TRIGGER_LASER, ENTITY_MONSTER_SENTIEN, ENTITY_MONSTER_HANDLER, ENTITY_MONSTER_HOUND, ENTITY_MONSTER_ZBOSS, -ENTITY_Z_SECURITYCAMERA, -ENTITY_Z_CRATE, -ENTITY_Z_SEAT, -ENTITY_Z_COMMDISH, -ENTITY_Z_PLASMASHEILD, +ENTITY_MONSTER_AUTOCANNON, +ENTITY_MISC_SECURITYCAMERA, +ENTITY_MISC_CRATE, +ENTITY_MISC_SEAT, +ENTITY_MISC_COMMDISH, +ENTITY_Z_PLASMASHIELD, ENTITY_Z_FLARE, ENTITY_Z_TBOMB, +ENTITY_Z_EMPNUKECENTER, // LMSP ENTITY_MONSTER_SOLDIER_PLASMA_BOUNCE, ENTITY_MONSTER_SOLDIER_PLASMA_SPREAD, -ENTITY_GOOP_BOUNCE, -ENTITY_GOOP_SPREAD, +ENTITY_GOOP, // Q1 ENTITY_MONSTER_Q1_CHTHON, ENTITY_MONSTER_Q1_DOG, @@ -384,21 +401,23 @@ ENTITY_MONSTER_Q1_ZOMBIE, ENTITY_MONSTER_Q1_SHUB, ENTITY_Q1_TELEPORT_TRAIN, ENTITY_Q1_NAIL, -ENTITY_Q1_GRENADE, -ENTITY_Q1_ROCKET, -ENTITY_Q1_ACIDBOLT, ENTITY_Q1_LASER, ENTITY_Q1_HKNIGHT_FLAME, +ENTITY_Q1_GRENADE, +ENTITY_Q1_ROCKET, ENTITY_Q1_FIREPOD, ENTITY_Q1_LAVABALL, -ENTITY_Q1_ZOMBIEGIB, -ENTITY_Q1_ZOMBIE_CRUCIFIED, +ENTITY_Q1_ACIDBOLT, +ENTITY_Q1_ZOMBIE_GIB, +ENTITY_MISC_Q1_ZOMBIE_CRUCIFIED, ENTITY_Q1_BUBBLE, -ENTITY_Q1_GLOBE, -ENTITY_Q1_FLAME_LARGE, -ENTITY_Q1_FLAME_SMALL, -ENTITY_Q1_TORCH, -ENTITY_Q1_TRAPSHOOTER, -ENTITY_Q1_EXPLOBOX, -ENTITY_Q1_FIREBALL +ENTITY_MISC_Q1_BUBBLE_SPAWNER, +ENTITY_MISC_Q1_GLOBE, +ENTITY_MISC_Q1_FLAME_SMALL, +ENTITY_MISC_Q1_FLAME_LARGE, +ENTITY_MISC_Q1_TORCH, +ENTITY_TARGET_Q1_TRAPSHOOTER, +ENTITY_MISC_Q1_EXPLOBOX, +ENTITY_Q1_FIREBALL, +ENTITY_MISC_Q1_FIREBALL_SPAWNER } entity_id; diff --git a/missionpack/m_berserk.c b/missionpack/m_berserk.c index 0acd2e2..5b93637 100644 --- a/missionpack/m_berserk.c +++ b/missionpack/m_berserk.c @@ -590,6 +590,7 @@ void SP_monster_berserk (edict_t *self) self->monsterinfo.flies = 0.20; self->common_name = "Berserker"; + self->class_id = ENTITY_MONSTER_BERSERK; gi.linkentity (self); diff --git a/missionpack/m_boss2.c b/missionpack/m_boss2.c index 7d19f14..4597faa 100644 --- a/missionpack/m_boss2.c +++ b/missionpack/m_boss2.c @@ -927,7 +927,9 @@ void SP_monster_boss2 (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Hornet"; + self->class_id = ENTITY_MONSTER_BOSS2; flymonster_start (self); } diff --git a/missionpack/m_boss3.c b/missionpack/m_boss3.c index 9dec143..ac21384 100644 --- a/missionpack/m_boss3.c +++ b/missionpack/m_boss3.c @@ -53,5 +53,8 @@ void SP_monster_boss3_stand (edict_t *self) self->use = Use_Boss3; self->think = Think_Boss3Stand; self->nextthink = level.time + FRAMETIME; + + self->class_id = ENTITY_MONSTER_BOSS3_STAND; + gi.linkentity (self); } diff --git a/missionpack/m_boss31.c b/missionpack/m_boss31.c index d85f442..50bc630 100644 --- a/missionpack/m_boss31.c +++ b/missionpack/m_boss31.c @@ -400,7 +400,7 @@ void jorg_pain (edict_t *self, edict_t *other, float kick, int damage) if (self->health < (self->max_health / 2)) { self->s.skinnum |= 1; - if (!(self->fogclip & 2)) // custom bloodtype flag check + if ( !(self->fogclip & 2) ) // custom bloodtype flag check self->blood_type = 3; // sparks and blood } @@ -709,7 +709,7 @@ void jorg_dead (edict_t *self) void jorg_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) { self->s.skinnum |= 1; - if (!(self->fogclip & 2)) // custom bloodtype flag check + if ( !(self->fogclip & 2) ) // custom bloodtype flag check self->blood_type = 3; // sparks and blood self->s.sound = 0; self->monsterinfo.power_armor_type = POWER_ARMOR_NONE; @@ -920,6 +920,12 @@ void SP_monster_jorg (edict_t *self) gi.linkentity (self); self->monsterinfo.currentmove = &jorg_move_stand; + if (self->health < 0) + { + mmove_t *deathmoves[] = {&jorg_move_death, + NULL}; + M_SetDeath(self,(mmove_t **)&deathmoves); + } self->monsterinfo.scale = MODEL_SCALE; // Lazarus @@ -931,7 +937,9 @@ void SP_monster_jorg (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Jorg"; + self->class_id = ENTITY_MONSTER_JORG; walkmonster_start(self); //PMM diff --git a/missionpack/m_boss32.c b/missionpack/m_boss32.c index cbba972..3dad021 100644 --- a/missionpack/m_boss32.c +++ b/missionpack/m_boss32.c @@ -883,7 +883,7 @@ qboolean Makron_blocked (edict_t *self, float dist) /*QUAKED monster_makron (1 .5 0) (-30 -30 0) (30 30 90) Ambush Trigger_Spawn Sight GoodGuy NoGib */ -//Knightmare- direct spawn function, sets nojump flag +// Knightmare- direct spawn function, sets nojump flag void SP_monster_makron (edict_t *self) { self->fogclip |= 1; @@ -932,7 +932,7 @@ void SP_monster_makron_put (edict_t *self) self->monsterinfo.dodge = NULL; self->monsterinfo.attack = makron_attack; self->monsterinfo.melee = NULL; - //Knightmare- don't jump flag + // Knightmare- don't jump flag if (self->fogclip & 1) self->monsterinfo.sight = NULL; else @@ -956,16 +956,23 @@ void SP_monster_makron_put (edict_t *self) } self->common_name = "Makron"; + self->class_id = ENTITY_MONSTER_MAKRON; gi.linkentity (self); - //Knightmare- nojump flag + // Knightmare- nojump flag if (self->fogclip & 1) self->monsterinfo.currentmove = &makron_move_stand; else self->monsterinfo.currentmove = &makron_move_sight; + if (self->health < 0) + { + mmove_t *deathmoves[] = {&makron_move_death2, + &makron_move_death3, + NULL}; + M_SetDeath(self,(mmove_t **)&deathmoves); + } self->monsterinfo.scale = MODEL_SCALE; - walkmonster_start(self); //PMM //self->monsterinfo.aiflags |= AI_IGNORE_SHOTS; @@ -983,9 +990,10 @@ void MakronSpawn (edict_t *self) { vec3_t vec; edict_t *player; + SP_monster_makron_put (self); - //Knightmare- gross hack for map6 of COS3- don't jump + // Knightmare- gross hack for map6 of COS3- don't jump if (Q_stricmp(level.mapname, "grinsp3f") == 0) return; // jump at player diff --git a/missionpack/m_boss5.c b/missionpack/m_boss5.c index 449b5c1..934a2f7 100644 --- a/missionpack/m_boss5.c +++ b/missionpack/m_boss5.c @@ -716,7 +716,9 @@ void SP_monster_boss5 (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = 400; } + self->common_name = "Beta Class Supertank"; + self->class_id = ENTITY_MONSTER_SUPERTANK_BETA; walkmonster_start(self); diff --git a/missionpack/m_brain.c b/missionpack/m_brain.c index da2b8bf..f554be9 100644 --- a/missionpack/m_brain.c +++ b/missionpack/m_brain.c @@ -130,7 +130,7 @@ mmove_t brain_move_idle = {FRAME_stand31, FRAME_stand60, brain_frames_idle, brai void brain_idle (edict_t *self) { - if(!(self->spawnflags & SF_MONSTER_AMBUSH)) //Knightmare- play all 3 idle sounds + if (!(self->spawnflags & SF_MONSTER_AMBUSH)) //Knightmare- play all 3 idle sounds { float r = random(); @@ -595,7 +595,7 @@ void brain_dead (edict_t *self) M_FlyCheck (self); // Lazarus monster fade - if(world->effects & FX_WORLDSPAWN_CORPSEFADE) + if (world->effects & FX_WORLDSPAWN_CORPSEFADE) { self->think=FadeDieSink; self->nextthink=level.time+corpse_fadetime->value; @@ -699,11 +699,11 @@ void SP_monster_brain (edict_t *self) VectorSet (self->mins, -16, -16, -24); VectorSet (self->maxs, 16, 16, 32); - if(!self->health) + if (!self->health) self->health = 300; - if(!self->gib_health) + if (!self->gib_health) self->gib_health = -150; - if(!self->mass) + if (!self->mass) self->mass = 400; self->pain = brain_pain; @@ -725,7 +725,7 @@ void SP_monster_brain (edict_t *self) self->monsterinfo.idle = brain_idle; // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -739,9 +739,11 @@ void SP_monster_brain (edict_t *self) self->monsterinfo.power_armor_power = 100; } - if(!self->monsterinfo.flies) + if (!self->monsterinfo.flies) self->monsterinfo.flies = 0.10; + self->common_name = "Brain"; + self->class_id = ENTITY_MONSTER_BRAIN; if (!self->blood_type) self->blood_type = 3; //sparks and blood diff --git a/missionpack/m_brainbeta.c b/missionpack/m_brainbeta.c index 66ad0fc..c6dc7a7 100644 --- a/missionpack/m_brainbeta.c +++ b/missionpack/m_brainbeta.c @@ -130,7 +130,7 @@ mmove_t brainbeta_move_idle = {FRAME_stand31, FRAME_stand60, brainbeta_frames_id void brainbeta_idle (edict_t *self) { - if(!(self->spawnflags & SF_MONSTER_AMBUSH)) //Knightmare- play all 3 idle sounds + if (!(self->spawnflags & SF_MONSTER_AMBUSH)) //Knightmare- play all 3 idle sounds { float r = random(); @@ -841,7 +841,7 @@ void brainbeta_dead (edict_t *self) M_FlyCheck (self); // Lazarus monster fade - if(world->effects & FX_WORLDSPAWN_CORPSEFADE) + if (world->effects & FX_WORLDSPAWN_CORPSEFADE) { self->think=FadeDieSink; self->nextthink=level.time+corpse_fadetime->value; @@ -948,11 +948,11 @@ void SP_monster_brain_beta (edict_t *self) VectorSet (self->mins, -16, -16, -24); VectorSet (self->maxs, 16, 16, 32); - if(!self->health) + if (!self->health) self->health = 300; - if(!self->gib_health) + if (!self->gib_health) self->gib_health = -150; - if(!self->mass) + if (!self->mass) self->mass = 400; self->pain = brainbeta_pain; @@ -974,7 +974,7 @@ void SP_monster_brain_beta (edict_t *self) self->monsterinfo.idle = brainbeta_idle; // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -988,9 +988,11 @@ void SP_monster_brain_beta (edict_t *self) self->monsterinfo.power_armor_power = 100; } - if(!self->monsterinfo.flies) + if (!self->monsterinfo.flies) self->monsterinfo.flies = 0.10; + self->common_name = "Beta-Class Brain"; + self->class_id = ENTITY_MONSTER_BRAIN_BETA; if (!self->blood_type) self->blood_type = 3; //sparks and blood diff --git a/missionpack/m_carrier.c b/missionpack/m_carrier.c index ea47f29..8ee0a4d 100644 --- a/missionpack/m_carrier.c +++ b/missionpack/m_carrier.c @@ -1413,6 +1413,7 @@ void SP_monster_carrier (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Carrier"; + self->class_id = ENTITY_MONSTER_CARRIER; gi.linkentity (self); diff --git a/missionpack/m_chick.c b/missionpack/m_chick.c index 09ae048..deef006 100644 --- a/missionpack/m_chick.c +++ b/missionpack/m_chick.c @@ -1030,6 +1030,7 @@ void SP_monster_chick (edict_t *self) self->monsterinfo.flies = 0.40; self->common_name = "Iron Maiden"; + self->class_id = ENTITY_MONSTER_CHICK; // PMM // Knightmare- no blindfire with homing rockets in easy or medium skill @@ -1045,6 +1046,7 @@ void SP_monster_chick (edict_t *self) else self->fogclip |= 2; //custom bloodtype flag self->common_name = "Beta Class Iron Maiden"; + self->class_id = ENTITY_MONSTER_CHICK_HEAT; } } diff --git a/missionpack/m_dog.c b/missionpack/m_dog.c index c58335f..6a188d5 100644 --- a/missionpack/m_dog.c +++ b/missionpack/m_dog.c @@ -500,7 +500,9 @@ void SP_monster_dog (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Rottweiler"; + self->class_id = ENTITY_MONSTER_DOG; gi.linkentity (self); diff --git a/missionpack/m_flipper.c b/missionpack/m_flipper.c index 22997dd..756cac2 100644 --- a/missionpack/m_flipper.c +++ b/missionpack/m_flipper.c @@ -428,6 +428,7 @@ void SP_monster_flipper (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Barracuda Shark"; + self->class_id = ENTITY_MONSTER_FLIPPER; gi.linkentity (self); diff --git a/missionpack/m_float.c b/missionpack/m_float.c index 3dca0cf..6491fd1 100644 --- a/missionpack/m_float.c +++ b/missionpack/m_float.c @@ -739,6 +739,7 @@ void SP_monster_floater (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Technician"; + self->class_id = ENTITY_MONSTER_FLOATER; gi.linkentity (self); diff --git a/missionpack/m_flyer.c b/missionpack/m_flyer.c index 78878a7..3a40dc5 100644 --- a/missionpack/m_flyer.c +++ b/missionpack/m_flyer.c @@ -461,7 +461,7 @@ void flyer_fire (edict_t *self, int flash_number) vec3_t dir; int effect; - if(!self->enemy || !self->enemy->inuse) //PGM + if (!self->enemy || !self->enemy->inuse) //PGM return; //PGM if ((self->s.frame == FRAME_attak204) || (self->s.frame == FRAME_attak207) || (self->s.frame == FRAME_attak210)) @@ -475,7 +475,7 @@ void flyer_fire (edict_t *self, int flash_number) end[2] += self->enemy->viewheight; // Lazarus fog reduction of accuracy - if(self->monsterinfo.visibility < FOG_CANSEEGOOD) + if (self->monsterinfo.visibility < FOG_CANSEEGOOD) { end[0] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); end[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); @@ -766,7 +766,7 @@ qboolean flyer_blocked (edict_t *self, float dist) return true; } // we're a normal flyer - if(blocked_checkshot (self, 0.25 + (0.05 * skill->value) )) + if (blocked_checkshot (self, 0.25 + (0.05 * skill->value) )) return true; return false; @@ -789,7 +789,7 @@ void SP_monster_flyer (edict_t *self) self->target = NULL; } - //Knightmare- random replacement with kamikaze flyers + // Knightmare- random replacement with kamikaze flyers if (kamikaze_flyer_replace->value > 0.0) { float r = random(); @@ -828,9 +828,9 @@ void SP_monster_flyer (edict_t *self) self->s.sound = gi.soundindex ("flyer/flyidle1.wav"); - if(!self->health) + if (!self->health) self->health = 50; - if(!self->mass) + if (!self->mass) self->mass = 50; self->pain = flyer_pain; @@ -849,7 +849,7 @@ void SP_monster_flyer (edict_t *self) self->blood_type = 3; //sparks and blood // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -858,6 +858,7 @@ void SP_monster_flyer (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Flyer"; + self->class_id = ENTITY_MONSTER_FLYER; gi.linkentity (self); @@ -904,10 +905,10 @@ void SP_monster_kamikaze (edict_t *self) self->s.effects |= EF_ROCKET; - if(!self->health) + if (!self->health) self->health = 50; // PMM - normal flyer has mass of 50 - if(!self->mass) + if (!self->mass) self->mass = 100; self->pain = flyer_pain; @@ -926,7 +927,7 @@ void SP_monster_kamikaze (edict_t *self) self->blood_type = 3; //sparks and blood // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -935,6 +936,7 @@ void SP_monster_kamikaze (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Kamikaze Flyer"; + self->class_id = ENTITY_MONSTER_FLYER_KAMIKAZE; gi.linkentity (self); diff --git a/missionpack/m_gekk.c b/missionpack/m_gekk.c index 6e75a2f..2cd146e 100644 --- a/missionpack/m_gekk.c +++ b/missionpack/m_gekk.c @@ -95,16 +95,16 @@ qboolean gekk_check_jump_hazard (edict_t *self, qboolean watertoland, qboolean f // Lazarus: Don't intentionally move closer to a grenade, // but don't perform this check if we're already evading some // other problem (maybe even this grenade) - if(!(self->monsterinfo.aiflags & AI_CHASE_THING)) + if (!(self->monsterinfo.aiflags & AI_CHASE_THING)) { grenade = NULL; while( (grenade = findradius(grenade,neworg,128)) != NULL) { - if(!grenade->inuse) + if (!grenade->inuse) continue; - if(!grenade->classname) + if (!grenade->classname) continue; - if(!Q_stricmp(grenade->classname,"grenade") || !Q_stricmp(grenade->classname,"hgrenade")) + if (!Q_stricmp(grenade->classname,"grenade") || !Q_stricmp(grenade->classname,"hgrenade")) { VectorSubtract(grenade->s.origin, oldorg, dir); g1 = VectorLength(dir); @@ -786,6 +786,8 @@ void fire_loogie (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed loogie->nextthink = level.time + 2; loogie->think = G_FreeEdict; loogie->dmg = damage; + loogie->classname = "loogie"; + loogie->class_id = ENTITY_LOOGIE; gi.linkentity (loogie); tr = gi.trace (self->s.origin, NULL, NULL, loogie->s.origin, loogie, MASK_SHOT); @@ -801,7 +803,7 @@ void fire_loogie (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed void gekk_loogie_delayed_start (edict_t *loogie) { - if(g_edicts[1].linkcount) + if (g_edicts[1].linkcount) { VectorScale(loogie->movedir,loogie->moveinfo.speed,loogie->velocity); loogie->nextthink = level.time + 2; @@ -849,7 +851,7 @@ void loogie (edict_t *self) end[2] += self->enemy->viewheight; // Lazarus fog reduction of accuracy - if(self->monsterinfo.visibility < FOG_CANSEEGOOD) + if (self->monsterinfo.visibility < FOG_CANSEEGOOD) { end[0] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); end[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); @@ -1360,7 +1362,7 @@ void gekk_dead (edict_t *self) M_FlyCheck (self); } // Lazarus monster fade - if(world->effects & FX_WORLDSPAWN_CORPSEFADE) + if (world->effects & FX_WORLDSPAWN_CORPSEFADE) { self->think=FadeDieSink; self->nextthink=level.time+corpse_fadetime->value; @@ -1787,16 +1789,16 @@ void SP_monster_gekk (edict_t *self) gi.modelindex ("models/objects/gekkgib/leg/tris.md2"); gi.modelindex ("models/objects/gekkgib/head/tris.md2"); - if(!self->health) + if (!self->health) { if (skill->value == 0) self->health = 120; else self->health = 150; } - if(!self->gib_health) + if (!self->gib_health) self->gib_health = -100; - if(!self->mass) + if (!self->mass) self->mass = 300; self->pain = gekk_pain; @@ -1819,7 +1821,7 @@ void SP_monster_gekk (edict_t *self) self->monsterinfo.flies = 0.70; // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -1827,7 +1829,9 @@ void SP_monster_gekk (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Gekk"; + self->class_id = ENTITY_MONSTER_GEKK; if (!self->blood_type) self->blood_type = 1; //Knightmare- set this for blood color diff --git a/missionpack/m_gladb.c b/missionpack/m_gladb.c index f50cfe9..b2c32bc 100644 --- a/missionpack/m_gladb.c +++ b/missionpack/m_gladb.c @@ -24,7 +24,7 @@ static int sound_sight; void gladb_idle (edict_t *self) { - if(!(self->spawnflags & SF_MONSTER_AMBUSH)) + if (!(self->spawnflags & SF_MONSTER_AMBUSH)) gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } @@ -159,7 +159,7 @@ void gladbGun (edict_t *self) // calc direction to where we targted // Lazarus fog reduction of accuracy - if(self->monsterinfo.visibility < FOG_CANSEEGOOD) + if (self->monsterinfo.visibility < FOG_CANSEEGOOD) { self->pos1[0] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); self->pos1[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); @@ -273,7 +273,7 @@ void gladb_dead (edict_t *self) M_FlyCheck (self); // Lazarus monster fade - if(world->effects & FX_WORLDSPAWN_CORPSEFADE) + if (world->effects & FX_WORLDSPAWN_CORPSEFADE) { self->think=FadeDieSink; self->nextthink=level.time+corpse_fadetime->value; @@ -342,10 +342,10 @@ void gladb_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage //PGM qboolean gladb_blocked (edict_t *self, float dist) { - if(blocked_checkshot (self, 0.25 + (0.05 * skill->value) )) + if (blocked_checkshot (self, 0.25 + (0.05 * skill->value) )) return true; - if(blocked_checkplat (self, dist)) + if (blocked_checkplat (self, dist)) return true; return false; @@ -396,11 +396,11 @@ void SP_monster_gladb (edict_t *self) VectorSet (self->mins, -32, -32, -24); VectorSet (self->maxs, 32, 32, 40); - if(!self->health) + if (!self->health) self->health = 800; - if(!self->gib_health) + if (!self->gib_health) self->gib_health = -175; - if(!self->mass) + if (!self->mass) self->mass = 350; self->pain = gladb_pain; @@ -425,7 +425,7 @@ void SP_monster_gladb (edict_t *self) self->monsterinfo.scale = MODEL_SCALE; // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -439,10 +439,11 @@ void SP_monster_gladb (edict_t *self) self->monsterinfo.power_armor_power = 400; } - if(!self->monsterinfo.flies) + if (!self->monsterinfo.flies) self->monsterinfo.flies = 0.025; self->common_name = "Beta Class Gladiator"; + self->class_id = ENTITY_MONSTER_GLADIATOR_BETA; walkmonster_start (self); } diff --git a/missionpack/m_gladiator.c b/missionpack/m_gladiator.c index 06e4257..d20d80f 100644 --- a/missionpack/m_gladiator.c +++ b/missionpack/m_gladiator.c @@ -23,7 +23,7 @@ static int sound_sight; void gladiator_idle (edict_t *self) { - if(!(self->spawnflags & SF_MONSTER_AMBUSH)) + if (!(self->spawnflags & SF_MONSTER_AMBUSH)) gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } @@ -158,7 +158,7 @@ void GladiatorGun (edict_t *self) // calc direction to where we targted // Lazarus fog reduction of accuracy - if(self->monsterinfo.visibility < FOG_CANSEEGOOD) + if (self->monsterinfo.visibility < FOG_CANSEEGOOD) { self->pos1[0] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); self->pos1[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); @@ -269,7 +269,7 @@ void gladiator_dead (edict_t *self) M_FlyCheck (self); // Lazarus monster fade - if(world->effects & FX_WORLDSPAWN_CORPSEFADE) + if (world->effects & FX_WORLDSPAWN_CORPSEFADE) { self->think=FadeDieSink; self->nextthink=level.time+corpse_fadetime->value; @@ -337,10 +337,10 @@ void gladiator_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int da //PGM qboolean gladiator_blocked (edict_t *self, float dist) { - if(blocked_checkshot (self, 0.25 + (0.05 * skill->value) )) + if (blocked_checkshot (self, 0.25 + (0.05 * skill->value) )) return true; - if(blocked_checkplat (self, dist)) + if (blocked_checkplat (self, dist)) return true; return false; @@ -384,11 +384,11 @@ void SP_monster_gladiator (edict_t *self) VectorSet (self->mins, -32, -32, -24); VectorSet (self->maxs, 32, 32, 40); - if(!self->health) + if (!self->health) self->health = 400; - if(!self->gib_health) + if (!self->gib_health) self->gib_health = -175; - if(!self->mass) + if (!self->mass) self->mass = 400; self->pain = gladiator_pain; @@ -409,7 +409,7 @@ void SP_monster_gladiator (edict_t *self) self->blood_type = 3; //sparks and blood // Lazarus - if(self->powerarmor) + if (self->powerarmor) { if (self->powerarmortype == 1) self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; @@ -417,9 +417,11 @@ void SP_monster_gladiator (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } - if(!self->monsterinfo.flies) + if (!self->monsterinfo.flies) self->monsterinfo.flies = 0.05; + self->common_name = "Gladiator"; + self->class_id = ENTITY_MONSTER_GLADIATOR; gi.linkentity (self); self->monsterinfo.currentmove = &gladiator_move_stand; diff --git a/missionpack/m_gunner.c b/missionpack/m_gunner.c index 8d12f2a..5a7c7b3 100644 --- a/missionpack/m_gunner.c +++ b/missionpack/m_gunner.c @@ -1151,6 +1151,7 @@ void SP_monster_gunner (edict_t *self) self->monsterinfo.flies = 0.30; self->common_name = "Gunner"; + self->class_id = ENTITY_MONSTER_GUNNER; gi.linkentity (self); diff --git a/missionpack/m_hover.c b/missionpack/m_hover.c index 05aaeb1..d2e54a8 100644 --- a/missionpack/m_hover.c +++ b/missionpack/m_hover.c @@ -828,7 +828,8 @@ void SP_monster_hover (edict_t *self) // Knightmare- precache blaster bolt gi.modelindex ("models/proj/laser2/tris.md2"); // pmm - self->common_name = "Daedalus"; //Knightmare + self->common_name = "Daedalus"; // Knightmare + self->class_id = ENTITY_MONSTER_DAEDALUS; } else { @@ -848,7 +849,8 @@ void SP_monster_hover (edict_t *self) gi.soundindex ("hover/hovatck1.wav"); self->s.sound = gi.soundindex ("hover/hovidle1.wav"); - self->common_name = "Icarus"; //Knightmare + self->common_name = "Icarus"; // Knightmare + self->class_id = ENTITY_MONSTER_HOVER; } //PGM diff --git a/missionpack/m_infantry.c b/missionpack/m_infantry.c index 1487ccf..b8526b4 100644 --- a/missionpack/m_infantry.c +++ b/missionpack/m_infantry.c @@ -887,6 +887,7 @@ void SP_monster_infantry (edict_t *self) self->monsterinfo.flies = 0.40; self->common_name = "Enforcer"; + self->class_id = ENTITY_MONSTER_INFANTRY; gi.linkentity (self); diff --git a/missionpack/m_medic.c b/missionpack/m_medic.c index 6a4da15..396df41 100644 --- a/missionpack/m_medic.c +++ b/missionpack/m_medic.c @@ -2162,7 +2162,8 @@ void SP_monster_medic (edict_t *self) commander_sound_spawn = gi.soundindex ("medic_commander/monsterspawn1.wav"); gi.soundindex ("tank/tnkatck3.wav"); - self->common_name = "Medic Commander"; //Knightmare + self->common_name = "Medic Commander"; // Knightmare + self->class_id = ENTITY_MONSTER_MEDIC_COMMANDER; } else { @@ -2179,7 +2180,8 @@ void SP_monster_medic (edict_t *self) gi.soundindex ("medic/medatck1.wav"); // self->s.skinnum = 0; - self->common_name = "Medic"; //Knightmare + self->common_name = "Medic"; // Knightmare + self->class_id = ENTITY_MONSTER_MEDIC; } //pmm } diff --git a/missionpack/m_mutant.c b/missionpack/m_mutant.c index ec2a943..c501884 100644 --- a/missionpack/m_mutant.c +++ b/missionpack/m_mutant.c @@ -754,6 +754,7 @@ void SP_monster_mutant (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Mutant"; + self->class_id = ENTITY_MONSTER_MUTANT; gi.linkentity (self); diff --git a/missionpack/m_parasite.c b/missionpack/m_parasite.c index ec56b38..b32b286 100644 --- a/missionpack/m_parasite.c +++ b/missionpack/m_parasite.c @@ -723,6 +723,7 @@ void SP_monster_parasite (edict_t *self) self->monsterinfo.flies = 0.30; self->common_name = "Parasite"; + self->class_id = ENTITY_MONSTER_PARASITE; gi.linkentity (self); diff --git a/missionpack/m_q1dog.c b/missionpack/m_q1dog.c index b2b7aa0..ac46e86 100644 --- a/missionpack/m_q1dog.c +++ b/missionpack/m_q1dog.c @@ -491,7 +491,9 @@ void SP_monster_q1_dog (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Rottweiler"; + self->class_id = ENTITY_MONSTER_Q1_DOG; gi.linkentity (self); diff --git a/missionpack/m_q1enforcer.c b/missionpack/m_q1enforcer.c index 4b0db62..a294079 100644 --- a/missionpack/m_q1enforcer.c +++ b/missionpack/m_q1enforcer.c @@ -398,7 +398,9 @@ void SP_monster_q1_enforcer (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Enforcer"; + self->class_id = ENTITY_MONSTER_Q1_ENFORCER; gi.linkentity (self); diff --git a/missionpack/m_q1fiend.c b/missionpack/m_q1fiend.c index 0ac4b21..3169227 100644 --- a/missionpack/m_q1fiend.c +++ b/missionpack/m_q1fiend.c @@ -509,7 +509,9 @@ void SP_monster_q1_fiend (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Fiend"; + self->class_id = ENTITY_MONSTER_Q1_FIEND; gi.linkentity (self); diff --git a/missionpack/m_q1grunt.c b/missionpack/m_q1grunt.c index 6be592e..32d7670 100644 --- a/missionpack/m_q1grunt.c +++ b/missionpack/m_q1grunt.c @@ -457,7 +457,9 @@ void SP_monster_q1_grunt (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Grunt"; + self->class_id = ENTITY_MONSTER_Q1_GRUNT; gi.linkentity (self); diff --git a/missionpack/m_q1hknight.c b/missionpack/m_q1hknight.c index 9248872..57b5732 100644 --- a/missionpack/m_q1hknight.c +++ b/missionpack/m_q1hknight.c @@ -549,7 +549,9 @@ void SP_monster_q1_hknight (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Hell Knight"; + self->class_id = ENTITY_MONSTER_Q1_HKNIGHT; gi.linkentity (self); diff --git a/missionpack/m_q1knight.c b/missionpack/m_q1knight.c index 2dc253d..e7153c9 100644 --- a/missionpack/m_q1knight.c +++ b/missionpack/m_q1knight.c @@ -463,7 +463,9 @@ void SP_monster_q1_knight (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Knight"; + self->class_id = ENTITY_MONSTER_Q1_KNIGHT; gi.linkentity (self); diff --git a/missionpack/m_q1ogre.c b/missionpack/m_q1ogre.c index fafbfae..31a7837 100644 --- a/missionpack/m_q1ogre.c +++ b/missionpack/m_q1ogre.c @@ -575,7 +575,9 @@ void SP_monster_q1_ogre (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Ogre"; + self->class_id = ENTITY_MONSTER_Q1_OGRE; gi.linkentity (self); diff --git a/missionpack/m_q1rotfish.c b/missionpack/m_q1rotfish.c index d00c513..5095fbb 100644 --- a/missionpack/m_q1rotfish.c +++ b/missionpack/m_q1rotfish.c @@ -288,7 +288,9 @@ void SP_monster_q1_rotfish (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Rotfish"; + self->class_id = ENTITY_MONSTER_Q1_ROTFISH; gi.linkentity (self); diff --git a/missionpack/m_q1scrag.c b/missionpack/m_q1scrag.c index 42a4304..41bfdd7 100644 --- a/missionpack/m_q1scrag.c +++ b/missionpack/m_q1scrag.c @@ -391,7 +391,9 @@ void SP_monster_q1_scrag (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Scrag"; + self->class_id = ENTITY_MONSTER_Q1_SCRAG; gi.linkentity (self); diff --git a/missionpack/m_q1shalrath.c b/missionpack/m_q1shalrath.c index f358c4d..65841da 100644 --- a/missionpack/m_q1shalrath.c +++ b/missionpack/m_q1shalrath.c @@ -329,7 +329,9 @@ void SP_monster_q1_shalrath (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Vore"; + self->class_id = ENTITY_MONSTER_Q1_SHALRATH; gi.linkentity (self); diff --git a/missionpack/m_q1shambler.c b/missionpack/m_q1shambler.c index 5bfc252..64f41b5 100644 --- a/missionpack/m_q1shambler.c +++ b/missionpack/m_q1shambler.c @@ -574,7 +574,9 @@ void SP_monster_q1_shambler (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Shambler"; + self->class_id = ENTITY_MONSTER_Q1_SHAMBLER; gi.linkentity (self); diff --git a/missionpack/m_q1tarbaby.c b/missionpack/m_q1tarbaby.c index 5ab8dbb..a5b643d 100644 --- a/missionpack/m_q1tarbaby.c +++ b/missionpack/m_q1tarbaby.c @@ -364,7 +364,9 @@ void SP_monster_q1_tarbaby (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Spawn"; + self->class_id = ENTITY_MONSTER_Q1_TARBABY; gi.linkentity (self); diff --git a/missionpack/m_q1zombie.c b/missionpack/m_q1zombie.c index 731689c..2ec9db4 100644 --- a/missionpack/m_q1zombie.c +++ b/missionpack/m_q1zombie.c @@ -700,7 +700,9 @@ void SP_monster_q1_zombie (edict_t *self) self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = self->powerarmor; } + self->common_name = "Zombie"; + self->class_id = ENTITY_MONSTER_Q1_ZOMBIE; gi.linkentity (self); diff --git a/missionpack/m_soldier.c b/missionpack/m_soldier.c index 5ccdd70..8857df9 100644 --- a/missionpack/m_soldier.c +++ b/missionpack/m_soldier.c @@ -573,15 +573,15 @@ void soldier_fire (edict_t *self, int in_flash_number) //gi.dprintf ("Dot Product: %f", DotProduct (aim_norm, forward)); if (angle < 0.9) // ~25 degree angle { -// if (g_showlogic && g_showlogic->value) -// gi.dprintf (" not firing due to bad dotprod %f\n", angle); + // if (g_showlogic && g_showlogic->value) + // gi.dprintf (" not firing due to bad dotprod %f\n", angle); return; } -// else -// { -// if (g_showlogic && g_showlogic->value) -// gi.dprintf (" firing: dotprod = %f\n", angle); -// } + /* else + { + if (g_showlogic && g_showlogic->value) + gi.dprintf (" firing: dotprod = %f\n", angle); + } */ } //-PMM #endif @@ -616,8 +616,8 @@ void soldier_fire (edict_t *self, int in_flash_number) tr = gi.trace (start, NULL, NULL, aim_good, self, MASK_SHOT); if ((tr.ent != self->enemy) && (tr.ent != world)) { -// if (g_showlogic && g_showlogic->value) -// gi.dprintf ("infantry shot aborted due to bad target\n"); + // if (g_showlogic && g_showlogic->value) + // gi.dprintf ("infantry shot aborted due to bad target\n"); return; } } @@ -3070,7 +3070,6 @@ void soldierh_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int dam void SP_monster_soldier_x (edict_t *self) { - // Lazarus: special purpose skins if ( self->style ) PatchMonsterModel("models/monsters/soldier/tris.md2"); @@ -3158,7 +3157,9 @@ void SP_monster_soldier_light (edict_t *self) gi.modelindex ("models/objects/laser/tris.md2"); gi.soundindex ("misc/lasfly.wav"); gi.soundindex ("soldier/solatck2.wav"); + self->common_name = "Light Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_LIGHT; // self->s.skinnum = 0; if (!self->health) @@ -3168,7 +3169,7 @@ void SP_monster_soldier_light (edict_t *self) // PMM - blindfire self->monsterinfo.blindfire = true; - //Knightmare- call generic spawn function LAST, because it + // Knightmare- call generic spawn function LAST, because it // calls walkmonster_start, which the health and everything else need to be set up for SP_monster_soldier_x (self); // Lazarus: custom skins @@ -3190,7 +3191,9 @@ void SP_monster_soldier (edict_t *self) sound_pain = gi.soundindex ("soldier/solpain1.wav"); sound_death = gi.soundindex ("soldier/soldeth1.wav"); gi.soundindex ("soldier/solatck1.wav"); + self->common_name = "Shotgun Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER; // self->s.skinnum = 2; if (!self->health) @@ -3218,7 +3221,9 @@ void SP_monster_soldier_ss (edict_t *self) sound_pain_ss = gi.soundindex ("soldier/solpain3.wav"); sound_death_ss = gi.soundindex ("soldier/soldeth3.wav"); gi.soundindex ("soldier/solatck3.wav"); + self->common_name = "Machinegun Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_SS; // self->s.skinnum = 4; if (!self->health) @@ -3245,10 +3250,11 @@ void SP_monster_soldier_plasma_re (edict_t *self) sound_pain_ss = gi.soundindex ("soldier/solpain3.wav"); sound_death_ss = gi.soundindex ("soldier/soldeth3.wav"); - gi.modelindex ("models/objects/laser/tris.md2"); - gi.soundindex ("misc/lasfly.wav"); + gi.modelindex (PLASMA_SPRITE_FLY); gi.soundindex ("soldier/solatck2.wav"); + self->common_name = "Plasma Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_PLASMA_BOUNCE; // self->s.skinnum = 0; if (!self->health) @@ -3278,8 +3284,11 @@ void SP_monster_soldier_plasma_sp (edict_t *self) sound_pain_ss = gi.soundindex ("soldier/solpain3.wav"); sound_death_ss = gi.soundindex ("soldier/soldeth3.wav"); - gi.soundindex ("soldier/solatck1.wav"); + gi.modelindex (PLASMA_SPRITE_FLY); + gi.soundindex ("soldier/solatck2.wav"); + self->common_name = "Plasma Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_PLASMA_SPREAD; // self->s.skinnum = 2; if (!self->health) @@ -3391,9 +3400,11 @@ void SP_monster_soldier_ripper (edict_t *self) gi.modelindex ("models/objects/boomrang/tris.md2"); gi.soundindex ("misc/lasfly.wav"); gi.soundindex ("soldier/solatck2.wav"); - self->common_name = "Ripper Guard"; - //self->s.skinnum = 0; + self->common_name = "Ripper Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_RIPPER; + +// self->s.skinnum = 0; if (!self->health) self->health = 50; if (!self->gib_health) @@ -3425,7 +3436,9 @@ void SP_monster_soldier_hypergun (edict_t *self) sound_pain = gi.soundindex ("soldier/solpain1.wav"); sound_death = gi.soundindex ("soldier/soldeth1.wav"); gi.soundindex ("soldier/solatck1.wav"); + self->common_name = "Hyperblaster Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_HYPERGUN; //self->s.skinnum = 2; if (!self->health) @@ -3456,7 +3469,9 @@ void SP_monster_soldier_lasergun (edict_t *self) sound_pain_ss = gi.soundindex ("soldier/solpain3.wav"); sound_death_ss = gi.soundindex ("soldier/soldeth3.wav"); gi.soundindex ("soldier/solatck3.wav"); + self->common_name = "Laser Guard"; + self->class_id = ENTITY_MONSTER_SOLDIER_LASER; //self->s.skinnum = 4; if (!self->health) diff --git a/missionpack/m_stalker.c b/missionpack/m_stalker.c index fb01d44..6f6a3d6 100644 --- a/missionpack/m_stalker.c +++ b/missionpack/m_stalker.c @@ -1263,6 +1263,7 @@ void SP_monster_stalker (edict_t *self) self->monsterinfo.flies = 0.40; self->common_name = "Stalker"; + self->class_id = ENTITY_STALKER; gi.linkentity (self); diff --git a/missionpack/m_supertank.c b/missionpack/m_supertank.c index 0dccbc4..0f03938 100644 --- a/missionpack/m_supertank.c +++ b/missionpack/m_supertank.c @@ -805,6 +805,7 @@ void SP_monster_supertank (edict_t *self) } self->common_name = "Supertank"; + self->class_id = ENTITY_MONSTER_SUPERTANK; gi.linkentity (self); diff --git a/missionpack/m_tank.c b/missionpack/m_tank.c index 477a1aa..b75c87f 100644 --- a/missionpack/m_tank.c +++ b/missionpack/m_tank.c @@ -1074,6 +1074,7 @@ void SP_monster_tank (edict_t *self) self->gib_health = -400; self->common_name = "Tank"; } + self->class_id = ENTITY_MONSTER_TANK; if (!self->mass) self->mass = 500; diff --git a/missionpack/m_turret.c b/missionpack/m_turret.c index 0bbd566..4b84b7c 100644 --- a/missionpack/m_turret.c +++ b/missionpack/m_turret.c @@ -671,6 +671,7 @@ void turret_wall_spawn (edict_t *turret) ent = G_Spawn(); ent->classname = "turret_wall"; + ent->class_id = ENTITY_TURRET_WALL; VectorCopy (turret->s.origin, ent->s.origin); VectorCopy (turret->s.angles, turret->deploy_angles); VectorCopy (turret->s.angles, ent->s.angles); @@ -1179,6 +1180,7 @@ void SP_monster_turret (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Sentry Turret"; + self->class_id = ENTITY_MONSTER_TURRET; // PMM - turrets don't get mad at monsters, and visa versa self->monsterinfo.aiflags |= AI_IGNORE_SHOTS; diff --git a/missionpack/m_widow.c b/missionpack/m_widow.c index 6b0d3cc..aba2998 100644 --- a/missionpack/m_widow.c +++ b/missionpack/m_widow.c @@ -1766,6 +1766,7 @@ void SP_monster_widow (edict_t *self) self->monsterinfo.power_armor_power = self->powerarmor; } self->common_name = "Black Widow"; + self->class_id = ENTITY_MONSTER_WIDOW; gi.linkentity (self); diff --git a/missionpack/m_widow2.c b/missionpack/m_widow2.c index 381df29..6e08a5a 100644 --- a/missionpack/m_widow2.c +++ b/missionpack/m_widow2.c @@ -1276,11 +1276,12 @@ void SP_monster_widow2 (edict_t *self) self->monsterinfo.checkattack = Widow2_CheckAttack; if (!self->blood_type) - self->blood_type = 2; //sparks + self->blood_type = 2; // sparks else - self->fogclip |= 2; //custom bloodtype flag + self->fogclip |= 2; // custom bloodtype flag self->common_name = "Black Widow"; + self->class_id = ENTITY_MONSTER_WIDOW2; gi.linkentity (self); diff --git a/missionpack/p_client.c b/missionpack/p_client.c index c603b86..b37cd07 100644 --- a/missionpack/p_client.c +++ b/missionpack/p_client.c @@ -93,10 +93,13 @@ void SP_misc_teleporter_dest (edict_t *ent); /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 32) The normal starting point for a level. */ -void SP_info_player_start(edict_t *self) +void SP_info_player_start (edict_t *self) { + self->class_id = ENTITY_INFO_PLAYER_START; + if (!coop->value) return; + if (Q_stricmp(level.mapname, "security") == 0) { // invoke one of our gross, ugly, disgusting hacks @@ -113,7 +116,7 @@ NO_PAD - don't make a pad count - the number of maxclients must be less than this for it to spawn. if you don't have a func_dm_wall in your map, don't enter a value. */ -void SP_info_player_deathmatch(edict_t *self) +void SP_info_player_deathmatch (edict_t *self) { if (!deathmatch->value) { @@ -121,7 +124,7 @@ void SP_info_player_deathmatch(edict_t *self) return; } - //Mappack - this makes sure players don't get spawned in an area sealed by a func_dm_wall + // Mappack - this makes sure players don't get spawned in an area sealed by a func_dm_wall if (self->count > 2) { if (self->count <= game.maxclients) @@ -131,16 +134,18 @@ void SP_info_player_deathmatch(edict_t *self) } } - //Mappack - this removes the pad if a flag of 1 is set. + // Mappack - this removes the pad if a flag of 1 is set. if (!(self->spawnflags & 1)) SP_misc_teleporter_dest (self); + + self->class_id = ENTITY_INFO_PLAYER_DEATHMATCH; } /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 32) potential spawning position for coop games */ -void SP_info_player_coop(edict_t *self) +void SP_info_player_coop (edict_t *self) { if (!coop->value) { @@ -148,6 +153,8 @@ void SP_info_player_coop(edict_t *self) return; } + self->class_id = ENTITY_INFO_PLAYER_COOP; + if ((Q_stricmp(level.mapname, "jail2") == 0) || (Q_stricmp(level.mapname, "jail4") == 0) || (Q_stricmp(level.mapname, "mine1") == 0) || @@ -173,24 +180,28 @@ void SP_info_player_coop(edict_t *self) potential spawning position for coop games on rmine2 where lava level needs to be checked */ -void SP_info_player_coop_lava(edict_t *self) +void SP_info_player_coop_lava (edict_t *self) { if (!coop->value) { G_FreeEdict (self); return; } + + self->class_id = ENTITY_INFO_PLAYER_COOP_LAVA; } /*QUAKED info_player_intermission (1 0 1) (-16 -16 -24) (16 16 32) LETTERBOX The deathmatch intermission point will be at one of these Use 'angles' instead of 'angle', so you can set pitch or roll as well as yaw. 'pitch yaw roll' */ -void SP_info_player_intermission(edict_t *self) //was void +void SP_info_player_intermission (edict_t *self) //was void { - //Knightmare- hack for Paradist Lost + self->class_id = ENTITY_INFO_PLAYER_INTERMISSION; + + // Knightmare- hack for Paradise Lost if (Q_stricmp(level.mapname, "coconut1") == 0) - VectorSet(self->s.angles,0,270,0); + VectorSet (self->s.angles, 0, 270, 0); } diff --git a/missionpack/p_weapon.c b/missionpack/p_weapon.c index 24b8f1a..cdfb7bc 100644 --- a/missionpack/p_weapon.c +++ b/missionpack/p_weapon.c @@ -118,6 +118,7 @@ void PlayerNoise(edict_t *who, vec3_t where, int type) { noise = G_Spawn(); noise->classname = "player_noise"; + noise->class_id = ENTITY_PLAYER_NOISE; VectorSet (noise->mins, -8, -8, -8); VectorSet (noise->maxs, 8, 8, 8); noise->owner = who; @@ -126,6 +127,7 @@ void PlayerNoise(edict_t *who, vec3_t where, int type) noise = G_Spawn(); noise->classname = "player_noise"; + noise->class_id = ENTITY_PLAYER_NOISE; VectorSet (noise->mins, -8, -8, -8); VectorSet (noise->maxs, 8, 8, 8); noise->owner = who; diff --git a/missionpack/z_acannon.c b/missionpack/z_acannon.c index 8909949..2a86fc5 100644 --- a/missionpack/z_acannon.c +++ b/missionpack/z_acannon.c @@ -923,6 +923,7 @@ void SP_monster_autocannon (edict_t *self) // Lazarus self->common_name = "Autocannon"; + self->class_id = ENTITY_MONSTER_AUTOCANNON; gi.linkentity(self); } diff --git a/missionpack/z_boss.c b/missionpack/z_boss.c index 6c26a4b..da4467e 100644 --- a/missionpack/z_boss.c +++ b/missionpack/z_boss.c @@ -1807,6 +1807,7 @@ void SP_monster_zboss (edict_t *self) self->blood_type = 2; // sparks self->common_name = "Titan"; + self->class_id = ENTITY_MONSTER_ZBOSS; gi.linkentity (self); diff --git a/missionpack/z_handler.c b/missionpack/z_handler.c index 03ec058..1251738 100644 --- a/missionpack/z_handler.c +++ b/missionpack/z_handler.c @@ -497,6 +497,7 @@ void SP_monster_handler (edict_t *self) self->monsterinfo.flies = 0.40; self->common_name = "Enforcer with HellHound"; + self->class_id = ENTITY_MONSTER_HANDLER; gi.linkentity (self); diff --git a/missionpack/z_hound.c b/missionpack/z_hound.c index e4f8717..d50e37b 100644 --- a/missionpack/z_hound.c +++ b/missionpack/z_hound.c @@ -643,6 +643,7 @@ void SP_monster_hound (edict_t *self) } self->common_name = "HellHound"; + self->class_id = ENTITY_MONSTER_HOUND; gi.linkentity (self); @@ -720,6 +721,7 @@ void hound_createHound (edict_t *self, float healthPercent) hound->monsterinfo.flies = 0.60; hound->common_name = "HellHound"; + hound->class_id = ENTITY_MONSTER_HOUND; // monster_start(hound); diff --git a/missionpack/z_item.c b/missionpack/z_item.c index 4986c1c..03b5d32 100644 --- a/missionpack/z_item.c +++ b/missionpack/z_item.c @@ -119,6 +119,9 @@ void SP_misc_securitycamera (edict_t *self) self->takedamage = DAMAGE_IMMORTAL; // health will not be deducted self->pain = camera_pain; + self->common_name = "Security Camera"; + self->class_id = ENTITY_MISC_SECURITYCAMERA; + gi.linkentity(self); } @@ -351,6 +354,10 @@ void fire_empnuke (edict_t *ent, vec3_t center, int radius) // empnuke->think = G_FreeEdict; // empnuke->nextthink = level.time + 30; + + empnuke->common_name = "EMP Nuke Center"; + empnuke->class_id = ENTITY_Z_EMPNUKECENTER; + gi.linkentity (empnuke); // gi.sound(empnuke, CHAN_VOICE, gi.soundindex("items/empnuke/emp_exp.wav"), 1, ATTN_NORM, 0); @@ -466,6 +473,10 @@ void Use_PlasmaShield (edict_t *ent, gitem_t *item) PlasmaShield->think = PlasmaShield_die; PlasmaShield->nextthink = level.time + sk_plasmashield_life->value; // was 10 + PlasmaShield->common_name = "Plasma Shield"; + PlasmaShield->class_id = ENTITY_Z_PLASMASHIELD; + + gi.linkentity (PlasmaShield); } //#endif // USE_ZAERO_ITEMS_WEAPONS @@ -492,6 +503,9 @@ void setupCrate (edict_t *self) self->think = M_droptofloor; self->nextthink = level.time + 2 * FRAMETIME; + self->common_name = "Pushable Crate"; + self->class_id = ENTITY_MISC_CRATE; + gi.linkentity(self); } @@ -544,6 +558,9 @@ void SP_misc_seat (edict_t *self) // make this pushable setupCrate(self); + + self->common_name = "Ejection Seat"; + self->class_id = ENTITY_MISC_SEAT; } /* @@ -584,6 +601,8 @@ void SP_misc_commdish (edict_t *self) return; } + self->class_id = ENTITY_MISC_COMMDISH; + self->solid = SOLID_BBOX; self->movetype = MOVETYPE_STEP; @@ -671,6 +690,8 @@ void barrier_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t * void SP_func_barrier (edict_t *self) { + self->class_id = ENTITY_FUNC_BARRIER; + self->solid = SOLID_BBOX; self->movetype = MOVETYPE_NONE; self->s.modelindex = gi.modelindex("models/objects/wall/tris.md2"); diff --git a/missionpack/z_sentien.c b/missionpack/z_sentien.c index a7d137c..6b0cdce 100644 --- a/missionpack/z_sentien.c +++ b/missionpack/z_sentien.c @@ -1281,7 +1281,9 @@ void SP_monster_sentien (edict_t *self) } if (!self->monsterinfo.flies) self->monsterinfo.flies = 0.10; + self->common_name = "Sentien"; + self->class_id = ENTITY_MONSTER_SENTIEN; // end Lazarus gi.linkentity (self); diff --git a/missionpack/z_trigger.c b/missionpack/z_trigger.c index ea6ef8b..5455795 100644 --- a/missionpack/z_trigger.c +++ b/missionpack/z_trigger.c @@ -88,12 +88,13 @@ void SP_trigger_laser (edict_t *self) return; } + self->class_id = ENTITY_TRIGGER_LASER; + // if no wait, set default if (!self->wait) { self->wait = 4; } - G_SetMovedir (self->s.angles, self->movedir); self->s.skinnum = 0xf2f2f0f0; // colour self->s.frame = 2; // diameter diff --git a/missionpack/z_weapon.c b/missionpack/z_weapon.c index a8976ea..dd5ea22 100644 --- a/missionpack/z_weapon.c +++ b/missionpack/z_weapon.c @@ -474,6 +474,9 @@ qboolean fire_lasertripbomb (edict_t *self, vec3_t start, vec3_t dir, float time bomb->nextthink = level.time + FRAMETIME; bomb->think = tripbomb_think; + bomb->common_name = "Laser Trip Bomb"; + bomb->class_id = ENTITY_Z_TBOMB; + // remove the oldest trip bomb removeOldest(); @@ -682,7 +685,7 @@ void SP_misc_lasertripbomb (edict_t *bomb) } // set up ourself - setupBomb(bomb, "misc_ired", sk_tbomb_damage->value, sk_tbomb_radius->value); + setupBomb (bomb, "misc_ired", sk_tbomb_damage->value, sk_tbomb_radius->value); if (bomb->targetname) { @@ -693,6 +696,10 @@ void SP_misc_lasertripbomb (edict_t *bomb) bomb->think = create_tripbomb_laser; bomb->nextthink = level.time + TBOMB_DELAY; } + + bomb->common_name = "Laser Trip Bomb"; + bomb->class_id = ENTITY_Z_TBOMB; + gi.linkentity(bomb); } //#endif // USE_ZAERO_ITEMS_WEAPONS @@ -1113,6 +1120,9 @@ void fire_flare (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, flare->dmg_radius = damage_radius; flare->classname = "flare"; + flare->common_name = "Flare"; + flare->class_id = ENTITY_Z_FLARE; + if (self->client) check_dodge (self, flare->s.origin, dir, speed);