Added POSTTHINK_CHILD_MOVEMENT macro to new movewith host entities in g_spawn.c->SpawnEntities() in default Lazarus DLL.

Added Zaero flare gun to no-autoswitch in p_weapon.c->Pickup_Weapon() in missionpack DLL.
Added LM plasma rifle to p_weapon.c->NoAmmoWeaponChange() in missionpack DLL.
Added output of modelindex5&6, alpha, and attenuation to properties command  in missionpack DLL.
Added nogib and environment spawnflags to trigger_hurt and trigger_hurt_boox in missionpack DLL.
Added MONSTER_KNOWS_MIRRORS flag to berserker, barracuda shark, and mutant in missionpack DLL.
Added entity class IDs to misc_actor and target_actor in missionpack DLL.
Added syntax whitespacing to some files in missionpack DLL.
Added backpack drop to certain monsters in missionpack DLL.
Changed some sound paths for new monsters and weapons in missionpack DLL.
This commit is contained in:
Knightmare66 2020-10-29 13:03:20 -04:00
parent e7db654934
commit 7b6f4281ad
42 changed files with 842 additions and 442 deletions

View file

@ -1384,6 +1384,7 @@ removeflags:
Q_stricmp(ent->movewith_ent->classname, "func_door") && Q_stricmp(ent->movewith_ent->classname, "func_door") &&
// Knightmare added // Knightmare added
#ifdef POSTTHINK_CHILD_MOVEMENT
Q_stricmp(ent->movewith_ent->classname, "func_door_rotating") && Q_stricmp(ent->movewith_ent->classname, "func_door_rotating") &&
Q_stricmp(ent->movewith_ent->classname, "func_plat") && Q_stricmp(ent->movewith_ent->classname, "func_plat") &&
Q_stricmp(ent->movewith_ent->classname, "func_plat2") && Q_stricmp(ent->movewith_ent->classname, "func_plat2") &&
@ -1394,6 +1395,7 @@ removeflags:
Q_stricmp(ent->movewith_ent->classname, "func_door_swinging") && Q_stricmp(ent->movewith_ent->classname, "func_door_swinging") &&
Q_stricmp(ent->movewith_ent->classname, "func_breakaway") && Q_stricmp(ent->movewith_ent->classname, "func_breakaway") &&
Q_stricmp(ent->movewith_ent->classname, "func_trackchange") && Q_stricmp(ent->movewith_ent->classname, "func_trackchange") &&
#endif // POSTTHINK_CHILD_MOVEMENT
// end Knightmare // end Knightmare
Q_stricmp(ent->movewith_ent->classname, "func_vehicle") && Q_stricmp(ent->movewith_ent->classname, "func_vehicle") &&

View file

@ -22,20 +22,31 @@ void SaveEntProps (edict_t *e, FILE *f)
#endif #endif
" frame = %d\n" " frame = %d\n"
" skinnum = %d\n" " skinnum = %d\n"
#ifdef KMQUAKE2_ENGINE_MOD
" alpha = %g\n"
#endif
" effects = 0x%08x\n" " effects = 0x%08x\n"
" solid = 0x%08x\n" " solid = 0x%08x\n"
" sound = %d\n" " sound = %d\n"
" event = %d\n", #ifdef LOOP_SOUND_ATTENUATION
e->s.number,vtos(e->s.origin),vtos(e->s.angles), " attenuation = %g\n"
vtos(e->s.old_origin),e->s.modelindex,e->s.modelindex2,
e->s.modelindex3,e->s.modelindex4,
#ifdef KMQUAKE2_ENGINE_MOD
e->s.modelindex5,e->s.modelindex6,
#endif #endif
e->s.frame, " event = %d\n",
e->s.skinnum,e->s.effects,e->s.solid,e->s.sound, e->s.number, vtos(e->s.origin), vtos(e->s.angles),
e->s.event); vtos(e->s.old_origin), e->s.modelindex, e->s.modelindex2,
fprintf(f,"inuse = %d\n" e->s.modelindex3, e->s.modelindex4,
#ifdef KMQUAKE2_ENGINE_MOD
e->s.modelindex5, e->s.modelindex6,
#endif
e->s.frame, e->s.skinnum,
#ifdef KMQUAKE2_ENGINE_MOD
e->s.alpha,
#endif
e->s.effects, e->s.solid, e->s.sound,
#ifdef LOOP_SOUND_ATTENUATION
e->s.attenuation,
#endif
e->s.event); fprintf(f,"inuse = %d\n"
"linkcount = %d\n" "linkcount = %d\n"
"svflags = 0x%08x\n" "svflags = 0x%08x\n"
"mins = %s\n" "mins = %s\n"
@ -45,16 +56,17 @@ void SaveEntProps (edict_t *e, FILE *f)
"size = %s\n" "size = %s\n"
"solid = 0x%08x\n" "solid = 0x%08x\n"
"clipmask = 0x%08x\n", "clipmask = 0x%08x\n",
e->inuse,e->linkcount,e->svflags,vtos(e->mins), e->inuse, e->linkcount, e->svflags, vtos(e->mins),
vtos(e->maxs),vtos(e->absmin),vtos(e->absmax), vtos(e->maxs), vtos(e->absmin), vtos(e->absmax),
vtos(e->size),e->solid,e->clipmask); vtos(e->size), e->solid, e->clipmask);
fprintf(f,"movetype = 0x%08x\n" fprintf(f, "movetype = 0x%08x\n"
"flags = 0x%08x\n" "flags = 0x%08x\n"
"freetime = %g\n" "freetime = %g\n"
"message = %s\n" "message = %s\n"
"key_message = %s\n" "key_message = %s\n"
"classname = %s\n" "classname = %s\n"
"spawnflags = 0x%08x\n" "spawnflags = 0x%08x\n"
"moreflags = 0x%08x\n"
"timestamp = %g\n" "timestamp = %g\n"
"angle = %g\n" "angle = %g\n"
"target = %s\n" "target = %s\n"
@ -65,11 +77,11 @@ void SaveEntProps (edict_t *e, FILE *f)
"deathtarget = %s\n" "deathtarget = %s\n"
"combattarget= %s\n" "combattarget= %s\n"
"dmgteam = %s\n", "dmgteam = %s\n",
e->movetype,e->flags,e->freetime,e->message,e->key_message, e->movetype, e->flags, e->freetime, e->message, e->key_message,
e->classname,e->spawnflags,e->timestamp,e->angle,e->target, e->classname, e->spawnflags, e->moreflags, e->timestamp, e->angle, e->target,
e->targetname,e->killtarget,e->team,e->pathtarget,e->deathtarget, e->targetname, e->killtarget, e->team, e->pathtarget, e->deathtarget,
e->combattarget,e->dmgteam); e->combattarget, e->dmgteam);
fprintf(f,"speed = %g\n" fprintf(f, "speed = %g\n"
"accel = %g\n" "accel = %g\n"
"decel = %g\n" "decel = %g\n"
"movedir = %s\n" "movedir = %s\n"
@ -87,21 +99,21 @@ void SaveEntProps (edict_t *e, FILE *f)
"ideal_roll = %g\n" "ideal_roll = %g\n"
"roll = %g\n" "roll = %g\n"
"groundentity= %s\n", "groundentity= %s\n",
e->speed,e->accel,e->decel,vtos(e->movedir),vtos(e->pos1), e->speed, e->accel, e->decel, vtos(e->movedir), vtos(e->pos1),
vtos(e->pos2),vtos(e->velocity),vtos(e->avelocity), vtos(e->pos2), vtos(e->velocity), vtos(e->avelocity),
e->mass,e->air_finished,e->gravity,e->yaw_speed,e->ideal_yaw, e->mass, e->air_finished, e->gravity, e->yaw_speed, e->ideal_yaw,
e->pitch_speed,e->ideal_pitch,e->ideal_roll,e->roll, e->pitch_speed, e->ideal_pitch, e->ideal_roll, e->roll,
(e->groundentity ? e->groundentity->classname : "None") ); (e->groundentity ? e->groundentity->classname : "None") );
fprintf(f,"touch_debounce_time = %g\n" fprintf(f, "touch_debounce_time = %g\n"
"pain_debounce_time = %g\n" "pain_debounce_time = %g\n"
"damage_debounce_time = %g\n" "damage_debounce_time = %g\n"
"gravity_debounce_time= %g\n" "gravity_debounce_time= %g\n"
"fly_debounce_time = %g\n" "fly_debounce_time = %g\n"
"last_move_time = %g\n", "last_move_time = %g\n",
e->touch_debounce_time,e->pain_debounce_time, e->touch_debounce_time, e->pain_debounce_time,
e->damage_debounce_time,e->gravity_debounce_time, e->damage_debounce_time, e->gravity_debounce_time,
e->fly_sound_debounce_time,e->last_move_time); e->fly_sound_debounce_time, e->last_move_time);
fprintf(f,"health = %d\n" fprintf(f, "health = %d\n"
"max_health = %d\n" "max_health = %d\n"
"gib_health = %d\n" "gib_health = %d\n"
"deadflag = %d\n" "deadflag = %d\n"
@ -109,18 +121,18 @@ void SaveEntProps (edict_t *e, FILE *f)
"health2 = %d\n" "health2 = %d\n"
"mass2 = %d\n" "mass2 = %d\n"
"powerarmor_time=%g\n", "powerarmor_time=%g\n",
e->health,e->max_health,e->gib_health,e->deadflag,e->show_hostile, e->health, e->max_health, e->gib_health, e->deadflag, e->show_hostile,
e->health2,e->mass2,e->powerarmor_time); e->health2, e->mass2, e->powerarmor_time);
fprintf(f,"viewheight = %d\n" fprintf(f, "viewheight = %d\n"
"takedamage = %d\n" "takedamage = %d\n"
"dmg = %d\n" "dmg = %d\n"
"radius_dmg = %d\n" "radius_dmg = %d\n"
"dmg_radius = %g\n" "dmg_radius = %g\n"
"sounds = %d\n" "sounds = %d\n"
"count = %d\n", "count = %d\n",
e->viewheight,e->takedamage,e->dmg,e->radius_dmg,e->dmg_radius, e->viewheight, e->takedamage, e->dmg, e->radius_dmg, e->dmg_radius,
e->sounds,e->count); e->sounds, e->count);
fprintf(f,"noise_index = %d\n" fprintf(f, "noise_index = %d\n"
"noise_index2= %d\n" "noise_index2= %d\n"
"volume = %d\n" "volume = %d\n"
"attenuation = %g\n" "attenuation = %g\n"
@ -134,15 +146,15 @@ void SaveEntProps (edict_t *e, FILE *f)
"waterlevel = %d\n" "waterlevel = %d\n"
"move_origin = %s\n" "move_origin = %s\n"
"move_angles = %s\n", "move_angles = %s\n",
e->noise_index,e->noise_index2,e->volume,e->attenuation, e->noise_index, e->noise_index2, e->volume, e->attenuation,
e->wait,e->delay,e->random,e->starttime,e->endtime,e->teleport_time, e->wait, e->delay, e->random, e->starttime, e->endtime, e->teleport_time,
e->watertype,e->waterlevel,vtos(e->move_origin),vtos(e->move_angles)); e->watertype, e->waterlevel, vtos(e->move_origin), vtos(e->move_angles));
fprintf(f,"light_level = %d\n" fprintf(f, "light_level = %d\n"
"style = %d\n", "style = %d\n",
e->light_level,e->style); e->light_level, e->style);
fprintf(f,"enemy = %s\n",(e->enemy ? e->enemy->classname : "NULL")); fprintf(f, "enemy = %s\n",(e->enemy ? e->enemy->classname : "NULL"));
fprintf(f,"enemy->inuse? %s\n",(e->enemy && e->enemy->inuse ? "Y" : "N")); fprintf(f, "enemy->inuse? %s\n",(e->enemy && e->enemy->inuse ? "Y" : "N"));
fprintf(f,"moveinfo_t\n" fprintf(f, "moveinfo_t\n"
" start_origin = %s\n" " start_origin = %s\n"
" start_angles = %s\n" " start_angles = %s\n"
" end_origin = %s\n" " end_origin = %s\n"
@ -166,13 +178,13 @@ void SaveEntProps (edict_t *e, FILE *f)
vtos(e->moveinfo.start_angles), vtos(e->moveinfo.start_angles),
vtos(e->moveinfo.end_origin), vtos(e->moveinfo.end_origin),
vtos(e->moveinfo.end_angles), vtos(e->moveinfo.end_angles),
e->moveinfo.sound_start,e->moveinfo.sound_middle, e->moveinfo.sound_start, e->moveinfo.sound_middle,
e->moveinfo.sound_end,e->moveinfo.accel,e->moveinfo.speed, e->moveinfo.sound_end, e->moveinfo.accel, e->moveinfo.speed,
e->moveinfo.decel,e->moveinfo.distance,e->moveinfo.wait, e->moveinfo.decel, e->moveinfo.distance, e->moveinfo.wait,
e->moveinfo.state,vtos(e->moveinfo.dir),e->moveinfo.current_speed, e->moveinfo.state, vtos(e->moveinfo.dir), e->moveinfo.current_speed,
e->moveinfo.move_speed,e->moveinfo.next_speed, e->moveinfo.move_speed, e->moveinfo.next_speed,
e->moveinfo.remaining_distance,e->moveinfo.decel_distance); e->moveinfo.remaining_distance, e->moveinfo.decel_distance);
fprintf(f,"monsterinfo\n" fprintf(f, "monsterinfo\n"
" aiflags = 0x%08x\n" " aiflags = 0x%08x\n"
" nextframe = %d\n" " nextframe = %d\n"
" scale = %g\n" " scale = %g\n"
@ -189,14 +201,14 @@ void SaveEntProps (edict_t *e, FILE *f)
" power_armor_type = %d\n" " power_armor_type = %d\n"
" power_armor_power= %d\n" " power_armor_power= %d\n"
" min_range = %g\n", " min_range = %g\n",
e->monsterinfo.aiflags,e->monsterinfo.nextframe, e->monsterinfo.aiflags, e->monsterinfo.nextframe,
e->monsterinfo.scale,e->monsterinfo.pausetime, e->monsterinfo.scale, e->monsterinfo.pausetime,
e->monsterinfo.attack_finished,vtos(e->monsterinfo.saved_goal), e->monsterinfo.attack_finished, vtos(e->monsterinfo.saved_goal),
e->monsterinfo.search_time,e->monsterinfo.trail_time, e->monsterinfo.search_time, e->monsterinfo.trail_time,
vtos(e->monsterinfo.last_sighting),e->monsterinfo.attack_state, vtos(e->monsterinfo.last_sighting), e->monsterinfo.attack_state,
e->monsterinfo.lefty,e->monsterinfo.idle_time, e->monsterinfo.lefty, e->monsterinfo.idle_time,
e->monsterinfo.linkcount,e->monsterinfo.power_armor_type, e->monsterinfo.linkcount, e->monsterinfo.power_armor_type,
e->monsterinfo.power_armor_power,e->monsterinfo.min_range); e->monsterinfo.power_armor_power, e->monsterinfo.min_range);
} }
void ShiftItem (edict_t *ent, int direction) void ShiftItem (edict_t *ent, int direction)

View file

@ -1780,4 +1780,3 @@ void SP_crane_reset (edict_t *self)
self->use = crane_reset_use; self->use = crane_reset_use;
} }

View file

@ -1028,7 +1028,7 @@ void SP_func_plat (edict_t *ent)
else else
ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip; ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip;
ent->postthink = train_move_children; //supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
ent->use = Use_Plat; ent->use = Use_Plat;
@ -1090,7 +1090,7 @@ void plat2_spawn_danger_area (edict_t *ent)
VectorCopy (ent->maxs, maxs); VectorCopy (ent->maxs, maxs);
maxs[2] = ent->mins[2] + 64; maxs[2] = ent->mins[2] + 64;
SpawnBadArea(mins, maxs, 0, ent); SpawnBadArea (mins, maxs, 0, ent);
} }
void plat2_kill_danger_area (edict_t *ent) void plat2_kill_danger_area (edict_t *ent)
@ -1111,8 +1111,9 @@ void plat2_hit_top (edict_t *ent)
{ {
if (ent->moveinfo.sound_end) if (ent->moveinfo.sound_end)
gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, ent->moveinfo.sound_end, 1, ent->attenuation, 0); // was ATTN_STATIC gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, ent->moveinfo.sound_end, 1, ent->attenuation, 0); // was ATTN_STATIC
ent->s.sound = 0; // ent->s.sound = 0;
} }
ent->s.sound = 0; // Knightmare- make sure this is always set to 0, lead mover or not!
ent->moveinfo.state = STATE_TOP; ent->moveinfo.state = STATE_TOP;
if (ent->plat2flags & PLAT2_CALLED) if (ent->plat2flags & PLAT2_CALLED)
@ -1123,7 +1124,7 @@ void plat2_hit_top (edict_t *ent)
ent->think = plat2_go_down; ent->think = plat2_go_down;
ent->nextthink = level.time + 5.0; ent->nextthink = level.time + 5.0;
} }
if (deathmatch->value) if ( (int)deathmatch->value )
ent->last_move_time = level.time - 1.0; ent->last_move_time = level.time - 1.0;
else else
ent->last_move_time = level.time - 2.0; ent->last_move_time = level.time - 2.0;
@ -1150,8 +1151,9 @@ void plat2_hit_bottom (edict_t *ent)
{ {
if (ent->moveinfo.sound_end) if (ent->moveinfo.sound_end)
gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, ent->moveinfo.sound_end, 1, ent->attenuation, 0); // was ATTN_STATIC gi.sound (ent, CHAN_NO_PHS_ADD+CHAN_VOICE, ent->moveinfo.sound_end, 1, ent->attenuation, 0); // was ATTN_STATIC
ent->s.sound = 0; // ent->s.sound = 0;
} }
ent->s.sound = 0; // Knightmare- make sure this is always set to 0, lead mover or not!
ent->moveinfo.state = STATE_BOTTOM; ent->moveinfo.state = STATE_BOTTOM;
if (ent->plat2flags & PLAT2_CALLED) if (ent->plat2flags & PLAT2_CALLED)
@ -1301,7 +1303,7 @@ void Touch_Plat_Center2 (edict_t *ent, edict_t *other, cplane_t *plane, csurface
if ((!(other->svflags & SVF_MONSTER)) && (!other->client)) if ((!(other->svflags & SVF_MONSTER)) && (!other->client))
return; return;
plat2_operate(ent, other); plat2_operate (ent, other);
} }
void plat2_blocked (edict_t *self, edict_t *other) void plat2_blocked (edict_t *self, edict_t *other)
@ -1319,7 +1321,7 @@ void plat2_blocked (edict_t *self, edict_t *other)
// Remove dead Q1 monsters, as they can't be gibbed // Remove dead Q1 monsters, as they can't be gibbed
if ( (other->svflags & SVF_DEADMONSTER) && (other->flags & FL_Q1_MONSTER) ) if ( (other->svflags & SVF_DEADMONSTER) && (other->flags & FL_Q1_MONSTER) )
{ {
G_FreeEdict(other); G_FreeEdict (other);
return; return;
} }
@ -1355,7 +1357,7 @@ void Use_Plat2 (edict_t *ent, edict_t *other, edict_t *activator)
{ {
if (trigger->enemy == ent) if (trigger->enemy == ent)
{ {
// Touch_Plat_Center2 (trigger, activator, NULL, NULL); // Touch_Plat_Center2 (trigger, activator, NULL, NULL);
plat2_operate (trigger, activator); plat2_operate (trigger, activator);
return; return;
} }
@ -1447,7 +1449,6 @@ void SP_func_plat2 (edict_t *ent)
ent->decel *= 2; ent->decel *= 2;
} }
// PMM Added to kill things it's being blocked by // PMM Added to kill things it's being blocked by
if (!ent->dmg) if (!ent->dmg)
ent->dmg = 2; ent->dmg = 2;
@ -1497,7 +1498,7 @@ void SP_func_plat2 (edict_t *ent)
} }
} }
ent->postthink = train_move_children; // supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
gi.linkentity (ent); gi.linkentity (ent);
@ -1682,7 +1683,7 @@ void SP_func_rotating (edict_t *ent)
if (ent->attenuation <= 0) if (ent->attenuation <= 0)
ent->attenuation = ATTN_STATIC; ent->attenuation = ATTN_STATIC;
ent->postthink = train_move_children; // supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
ent->use = rotating_use; ent->use = rotating_use;
if (ent->dmg) if (ent->dmg)
@ -1893,7 +1894,7 @@ void SP_func_button (edict_t *ent)
else if (! ent->targetname) else if (! ent->targetname)
ent->touch = button_touch; ent->touch = button_touch;
ent->postthink = train_move_children; //supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
ent->moveinfo.state = STATE_BOTTOM; ent->moveinfo.state = STATE_BOTTOM;
@ -1986,34 +1987,6 @@ void trainbutton_killed (edict_t *self, edict_t *inflictor, edict_t *attacker, i
trainbutton_fire (self); trainbutton_fire (self);
} }
/*void movewith_init (edict_t *ent)
{
edict_t *e, *child;
// Unnamed entities can't be movewith parents
if (!ent->targetname) return;
child = G_Find(NULL,FOFS(movewith),ent->targetname);
e = ent;
while (child)
{
child->movewith_ent = ent;
// Copy parent's current angles to the child. They SHOULD be 0,0,0 at this point
// for all currently supported parents, but ya never know.
VectorCopy (ent->s.angles,child->parent_attach_angles);
if (child->org_movetype < 0)
child->org_movetype = child->movetype;
if (child->movetype != MOVETYPE_NONE)
child->movetype = MOVETYPE_PUSH;
VectorCopy (child->mins,child->org_mins);
VectorCopy (child->maxs,child->org_maxs);
VectorSubtract(child->s.origin,ent->s.origin,child->movewith_offset);
e->movewith_next = child;
e = child;
child = G_Find(child,FOFS(movewith),ent->targetname);
}
}*/
void SP_func_trainbutton (edict_t *ent) void SP_func_trainbutton (edict_t *ent)
{ {
if (!ent->movewith) if (!ent->movewith)
@ -2570,7 +2543,20 @@ void Think_SpawnDoorTrigger (edict_t *ent)
other->movewith = ent->movewith; other->movewith = ent->movewith;
VectorCopy (other->s.angles, other->org_angles); VectorCopy (other->s.angles, other->org_angles);
gi.linkentity (other); gi.linkentity (other);
/*
// Lazarus movewith
if (ent->movewith)
{
other->movewith = ent->movewith;
VectorCopy(ent->s.origin,other->s.origin);
VectorSubtract(other->mins,other->s.origin,other->mins);
VectorSubtract(other->maxs,other->s.origin,other->maxs);
if (ent->movewith_ent) {
// Uh-oh... movewith_init was already called.. no harm in calling it again
movewith_init (ent->movewith_ent);
}
}
*/
if (ent->spawnflags & DOOR_START_OPEN) if (ent->spawnflags & DOOR_START_OPEN)
door_use_areaportals (ent, true); door_use_areaportals (ent, true);
@ -2704,7 +2690,7 @@ void SP_func_door (edict_t *ent)
// create a speaker entity at center of bmodel // create a speaker entity at center of bmodel
// Removed because this breaks when the center point of // Removed because this breaks when the center point of
// the door moves inside the wall (can't be heard). // the door moves inside the wall (can't be heard).
/*if (ent->moveinfo.sound_middle)// && ent->sounds > 4) /* if (ent->moveinfo.sound_middle)// && ent->sounds > 4)
{ {
edict_t *speaker; edict_t *speaker;
@ -2817,7 +2803,7 @@ void SP_func_door (edict_t *ent)
} }
// end Zaero // end Zaero
ent->postthink = train_move_children; // Knightmare- now supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
ent->nextthink = level.time + FRAMETIME; ent->nextthink = level.time + FRAMETIME;
// Zaero // Zaero
@ -3001,7 +2987,7 @@ void SP_func_door_rotating (edict_t *ent)
if (!ent->team) if (!ent->team)
ent->teammaster = ent; ent->teammaster = ent;
ent->postthink = train_move_children; //supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
gi.linkentity (ent); gi.linkentity (ent);
@ -3236,6 +3222,36 @@ void train_move_prox (edict_t *self)
} }
} }
/*
void movewith_init (edict_t *ent)
{
edict_t *e, *child;
// Unnamed entities can't be movewith parents
if (!ent->targetname) return;
child = G_Find(NULL, FOFS(movewith), ent->targetname);
e = ent;
while (child)
{
child->movewith_ent = ent;
// Copy parent's current angles to the child. They SHOULD be 0,0,0 at this point
// for all currently supported parents, but ya never know.
VectorCopy (ent->s.angles, child->parent_attach_angles);
if (child->org_movetype < 0)
child->org_movetype = child->movetype;
if (child->movetype != MOVETYPE_NONE)
child->movetype = MOVETYPE_PUSH;
VectorCopy (child->mins, child->org_mins);
VectorCopy (child->maxs, child->org_maxs);
VectorSubtract (child->s.origin, ent->s.origin, child->movewith_offset);
e->movewith_next = child;
e = child;
child = G_Find(child, FOFS(movewith), ent->targetname);
}
}
*/
// Knightmare- this function moves the movewith children // Knightmare- this function moves the movewith children
// Most of this code is by David Hyde, he got tired of just helping me piecemeal... // Most of this code is by David Hyde, he got tired of just helping me piecemeal...
void turret_stand (edict_t *self); void turret_stand (edict_t *self);
@ -3284,8 +3300,8 @@ void train_move_children (edict_t *self)
VectorCopy (ent->s.angles, ent->child_attach_angles); VectorCopy (ent->s.angles, ent->child_attach_angles);
// Knightmare- backup turret's old angle offset // 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 ) // if ( (ent->class_id == ENTITY_MONSTER_TURRET) && ent->offset )
VectorCopy (ent->offset, ent->old_offset); VectorCopy (ent->offset, ent->old_offset);
ent->movewith_set = 1; ent->movewith_set = 1;
@ -3319,16 +3335,16 @@ void train_move_children (edict_t *self)
*/ */
// For all but buttons, doors, and plats, move origin and match velocities // For all but buttons, doors, and plats, move origin and match velocities
/* if ( strcmp(ent->classname, "func_door") && strcmp(ent->classname, "func_button") 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) && strcmp(ent->classname, "func_door_secret2")
&& strcmp(ent->classname, "func_plat") && strcmp(ent->classname, "func_plat2") && strcmp(ent->classname, "func_plat") && strcmp(ent->classname, "func_plat2")
&& strcmp(ent->classname, "func_water") && strcmp(ent->classname, "turret_wall") && 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) /* 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_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_PLAT) && (ent->class_id != ENTITY_FUNC_PLAT2)
&& (ent->class_id != ENTITY_FUNC_WATER) && (ent->class_id != ENTITY_TURRET_WALL) && (ent->class_id != ENTITY_FUNC_WATER) && (ent->class_id != ENTITY_TURRET_WALL)
&& ( (ent->class_id != ENTITY_MONSTER_TURRET) || !(ent->spawnflags & 128) ) ) && ( (ent->class_id != ENTITY_MONSTER_TURRET) || !(ent->spawnflags & 128) ) )*/
{ {
VectorMA (self->s.origin, ent->movewith_offset[0], forward, ent->s.origin); VectorMA (self->s.origin, ent->movewith_offset[0], forward, ent->s.origin);
VectorMA (ent->s.origin, ent->movewith_offset[1], right, ent->s.origin); VectorMA (ent->s.origin, ent->movewith_offset[1], right, ent->s.origin);
@ -3357,8 +3373,8 @@ void train_move_children (edict_t *self)
// Match angular velocities // Match angular velocities
if (self->turn_rider) 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->class_id == ENTITY_FUNC_ROTATING)
{ {
/* if (ent->movedir[0] > 0) /* if (ent->movedir[0] > 0)
ent->s.angles[1] = self->s.angles[1]; ent->s.angles[1] = self->s.angles[1];
@ -3396,11 +3412,11 @@ void train_move_children (edict_t *self)
// their own. // their own.
if (!ent->do_not_rotate) 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) ) // if ( (ent->class_id == ENTITY_TURRET_BREACH) || (ent->class_id == ENTITY_TURRET_BASE) )
VectorCopy (self->avelocity, ent->avelocity); 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) // else if (ent->class_id == ENTITY_FUNC_DOOR_ROTATING)
{ {
VectorCopy (self->avelocity, ent->avelocity); VectorCopy (self->avelocity, ent->avelocity);
// VectorCopy (parent_angle_change, ent->pos1); // VectorCopy (parent_angle_change, ent->pos1);
@ -3441,8 +3457,8 @@ void train_move_children (edict_t *self)
else if (is_monster) else if (is_monster)
{ {
// Knightmare- adjust monster_turret's aiming angles for yaw movement // 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->class_id == ENTITY_MONSTER_TURRET) && (amove[YAW] != 0) )
{ {
if (ent->offset && ent->old_offset && (ent->offset[1] != -1 && ent->offset[1] != -2)) if (ent->offset && ent->old_offset && (ent->offset[1] != -1 && ent->offset[1] != -2))
{ {
@ -3468,22 +3484,22 @@ void train_move_children (edict_t *self)
} }
// Special cases: // Special cases:
// Func_door/func_button and trigger fields // Func_door/func_button and trigger fields
/* if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button") 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) || !strcmp(ent->classname, "func_door_secret2")
|| !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2") || !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")
|| !strcmp(ent->classname, "func_water") || !strcmp(ent->classname, "turret_wall") || !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) /* 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_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_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2)
|| (ent->class_id == ENTITY_FUNC_WATER) || (ent->class_id == ENTITY_TURRET_WALL) || (ent->class_id == ENTITY_FUNC_WATER) || (ent->class_id == ENTITY_TURRET_WALL)
|| ( (ent->class_id == ENTITY_MONSTER_TURRET) && (ent->spawnflags & 128) ) ) || ( (ent->class_id == ENTITY_MONSTER_TURRET) && (ent->spawnflags & 128) ) )*/
{ {
VectorAdd (ent->s.angles, ent->org_angles, angles); VectorAdd (ent->s.angles, ent->org_angles, angles);
G_SetMovedir (angles, ent->movedir); G_SetMovedir (angles, ent->movedir);
// Knightmare- these entities need special calculations // 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) ) // if ( (ent->class_id == ENTITY_MONSTER_TURRET) || (ent->class_id == ENTITY_TURRET_WALL) )
{ {
vec3_t eforward, tangles; vec3_t eforward, tangles;
@ -3494,7 +3510,6 @@ void train_move_children (edict_t *self)
VectorMA (ent->pos1, ent->movewith_offset[2], up, ent->pos1); VectorMA (ent->pos1, ent->movewith_offset[2], up, ent->pos1);
VectorMA (ent->pos1, 32, eforward, ent->pos2); VectorMA (ent->pos1, 32, eforward, ent->pos2);
} }
// else if (!strcmp(ent->classname, "func_door_secret"))
if (ent->class_id == ENTITY_FUNC_DOOR_SECRET) if (ent->class_id == ENTITY_FUNC_DOOR_SECRET)
{ {
vec3_t eforward, eright, eup; vec3_t eforward, eright, eup;
@ -3509,8 +3524,8 @@ void train_move_children (edict_t *self)
VectorMA (ent->pos0, ent->side * ent->width, eright, ent->pos1); VectorMA (ent->pos0, ent->side * ent->width, eright, ent->pos1);
VectorMA (ent->pos1, ent->length, eforward, ent->pos2); VectorMA (ent->pos1, ent->length, eforward, ent->pos2);
} }
// else if (!strcmp(ent->classname, "func_door_secret2")) else if (!strcmp(ent->classname, "func_door_secret2"))
else if (ent->class_id == ENTITY_FUNC_DOOR_SECRET2) // else if (ent->class_id == ENTITY_FUNC_DOOR_SECRET2)
{ {
vec3_t eforward, eright, eup; vec3_t eforward, eright, eup;
@ -3537,8 +3552,8 @@ void train_move_children (edict_t *self)
VectorAdd (ent->pos1, eforward, ent->pos2); 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) ) // 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 (self->s.origin, ent->movewith_offset[0], forward, ent->pos1);
VectorMA (ent->pos1, ent->movewith_offset[1], right, ent->pos1); VectorMA (ent->pos1, ent->movewith_offset[1], right, ent->pos1);
@ -3568,8 +3583,8 @@ void train_move_children (edict_t *self)
// movement routines // movement routines
VectorCopy (self->velocity, ent->velocity); VectorCopy (self->velocity, ent->velocity);
// Sanity insurance: // 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) ) // if ( (ent->class_id == ENTITY_FUNC_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2) )
{ // top and bottom states are reversed for plats { // top and bottom states are reversed for plats
if (ent->moveinfo.state == STATE_BOTTOM) if (ent->moveinfo.state == STATE_BOTTOM)
VectorCopy (ent->pos2, ent->s.origin); VectorCopy (ent->pos2, ent->s.origin);
@ -3590,18 +3605,18 @@ void train_move_children (edict_t *self)
if (amove[YAW]) if (amove[YAW])
{ {
// Cross fingers here... move bounding boxes of doors and buttons // Cross fingers here... move bounding boxes of doors and buttons
/* if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button") 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) || !strcmp(ent->classname, "func_door_secret2")
|| !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2") || !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")
|| !strcmp(ent->classname, "func_water") || (ent->solid == SOLID_TRIGGER) || !strcmp(ent->classname, "func_water") || (ent->solid == SOLID_TRIGGER)
|| !strcmp(ent->classname, "turret_wall") || !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) /* 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_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_PLAT) || (ent->class_id == ENTITY_FUNC_PLAT2)
|| (ent->class_id == ENTITY_FUNC_WATER) || (ent->solid == SOLID_TRIGGER) || (ent->class_id == ENTITY_FUNC_WATER) || (ent->solid == SOLID_TRIGGER)
|| (ent->class_id == ENTITY_TURRET_WALL) || (ent->class_id == ENTITY_TURRET_WALL)
|| ( (ent->class_id == ENTITY_MONSTER_TURRET) && (ent->spawnflags & 128) ) ) || ( (ent->class_id == ENTITY_MONSTER_TURRET) && (ent->spawnflags & 128) ) )*/
{ {
float ca, sa, yaw; float ca, sa, yaw;
vec3_t p00, p01, p10, p11; vec3_t p00, p01, p10, p11;
@ -3638,8 +3653,8 @@ void train_move_children (edict_t *self)
} }
// FMOD // FMOD
// if (!Q_stricmp(ent->classname, "target_playback")) if (!Q_stricmp(ent->classname, "target_playback"))
if (ent->class_id == ENTITY_TARGET_PLAYBACK) // if (ent->class_id == ENTITY_TARGET_PLAYBACK)
FMOD_UpdateSpeakerPos(ent); FMOD_UpdateSpeakerPos(ent);
// Correct func_door_rotating start/end positions // Correct func_door_rotating start/end positions
@ -4034,13 +4049,13 @@ void train_children_think (edict_t *self)
return; return;
} }
// if (self->enemy->movewith_next && (self->enemy->movewith_next->movewith_ent == self->enemy)) /* if (self->enemy->movewith_next && (self->enemy->movewith_next->movewith_ent == self->enemy))
// { {
// set_child_movement(self->enemy); set_child_movement (self->enemy);
// self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
// } }
else else
// if (level.time < 2) if (level.time < 2) */
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
} }
@ -4560,7 +4575,7 @@ void func_train_find (edict_t *self)
ent->enemy = self; ent->enemy = self;
ent->nextthink = level.time + FRAMETIME; ent->nextthink = level.time + FRAMETIME;
} }
//end Rroff // end Rroff
else if (self->spawnflags & TRAIN_SPLINE) else if (self->spawnflags & TRAIN_SPLINE)
{ {
ent->think = Train_Move_Spline; ent->think = Train_Move_Spline;
@ -4573,7 +4588,7 @@ void func_train_find (edict_t *self)
ent->enemy = self; ent->enemy = self;
ent->nextthink = level.time + FRAMETIME; ent->nextthink = level.time + FRAMETIME;
} }
self->postthink = train_move_children; // Knightmare- supports movewith self->postthink = train_move_children; // Knightmare- supports movewith
VectorCopy (self->s.origin, daoldorigin); // Knightmare- copy old orgin for reference VectorCopy (self->s.origin, daoldorigin); // Knightmare- copy old orgin for reference
if (self->spawnflags & TRAIN_ORIGIN) // Knightmare- func_train_origin support if (self->spawnflags & TRAIN_ORIGIN) // Knightmare- func_train_origin support
@ -5327,7 +5342,7 @@ void SP_func_door_secret (edict_t *ent)
ent->touch = door_touch; ent->touch = door_touch;
} }
ent->classname = "func_door"; ent->classname = "func_door";
ent->postthink = train_move_children; // Knightmare- now supports movewith ent->postthink = train_move_children; // Knightmare- now supports movewith
gi.linkentity (ent); gi.linkentity (ent);
} }
@ -6066,7 +6081,7 @@ void SP_func_door_swinging (edict_t *self)
if ( pivot && (self->health > 0) ) if ( pivot && (self->health > 0) )
self->die = swinging_door_killed; self->die = swinging_door_killed;
self->postthink = train_move_children; //supports movewith self->postthink = train_move_children; // Knightmare- now supports movewith
self->flags |= FL_REVERSIBLE; self->flags |= FL_REVERSIBLE;
// strcpy(self->classname, "func_door_rotating"); // strcpy(self->classname, "func_door_rotating");

View file

@ -2499,10 +2499,12 @@ extern void Item_TriggeredSpawn ( edict_t * self , edict_t * other , edict_t * a
extern void PrecacheItem ( gitem_t * it ) ; extern void PrecacheItem ( gitem_t * it ) ;
extern void droptofloor ( edict_t * ent ) ; extern void droptofloor ( edict_t * ent ) ;
extern void Use_Item ( edict_t * ent , edict_t * other , edict_t * activator ) ; extern void Use_Item ( edict_t * ent , edict_t * other , edict_t * activator ) ;
extern edict_t * Drop_Q1Backpack ( edict_t * ent , gitem_t * item , int count ) ;
extern edict_t * Drop_Item ( edict_t * ent , gitem_t * item ) ; extern edict_t * Drop_Item ( edict_t * ent , gitem_t * item ) ;
extern void Item_Die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void Item_Die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
extern void drop_make_touchable ( edict_t * ent ) ; extern void drop_make_touchable ( edict_t * ent ) ;
extern void drop_temp_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void drop_temp_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ;
extern void Touch_Q1Backpack ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ;
extern void Touch_Item ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void Touch_Item ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ;
extern void Drop_Visor ( edict_t * ent , gitem_t * item ) ; extern void Drop_Visor ( edict_t * ent , gitem_t * item ) ;
extern qboolean Pickup_Visor ( edict_t * ent , edict_t * other ) ; extern qboolean Pickup_Visor ( edict_t * ent , edict_t * other ) ;

View file

@ -2499,10 +2499,12 @@
{"PrecacheItem", (byte *)PrecacheItem}, {"PrecacheItem", (byte *)PrecacheItem},
{"droptofloor", (byte *)droptofloor}, {"droptofloor", (byte *)droptofloor},
{"Use_Item", (byte *)Use_Item}, {"Use_Item", (byte *)Use_Item},
{"Drop_Q1Backpack", (byte *)Drop_Q1Backpack},
{"Drop_Item", (byte *)Drop_Item}, {"Drop_Item", (byte *)Drop_Item},
{"Item_Die", (byte *)Item_Die}, {"Item_Die", (byte *)Item_Die},
{"drop_make_touchable", (byte *)drop_make_touchable}, {"drop_make_touchable", (byte *)drop_make_touchable},
{"drop_temp_touch", (byte *)drop_temp_touch}, {"drop_temp_touch", (byte *)drop_temp_touch},
{"Touch_Q1Backpack", (byte *)Touch_Q1Backpack},
{"Touch_Item", (byte *)Touch_Item}, {"Touch_Item", (byte *)Touch_Item},
{"Drop_Visor", (byte *)Drop_Visor}, {"Drop_Visor", (byte *)Drop_Visor},
{"Pickup_Visor", (byte *)Pickup_Visor}, {"Pickup_Visor", (byte *)Pickup_Visor},

View file

@ -1294,7 +1294,7 @@ qboolean Pickup_Ammo (edict_t *ent, edict_t *other)
int count; int count;
qboolean weapon; qboolean weapon;
//Knightmare- override ammo pickup values with cvars // Knightmare- override ammo pickup values with cvars
SetAmmoPickupValues (); SetAmmoPickupValues ();
weapon = (ent->item->flags & IT_WEAPON); weapon = (ent->item->flags & IT_WEAPON);
@ -1378,7 +1378,7 @@ qboolean Pickup_Health (edict_t *ent, edict_t *other)
if ((ent->style & HEALTH_FOODCUBE) && other->health >= other->client->pers.max_fc_health) if ((ent->style & HEALTH_FOODCUBE) && other->health >= other->client->pers.max_fc_health)
return false; return false;
//backup current health upon getting megahealth // backup current health upon getting megahealth
/* if (ent->style & HEALTH_TIMED) /* if (ent->style & HEALTH_TIMED)
{ {
if (other->base_health && other->health > other->base_health) if (other->base_health && other->health > other->base_health)
@ -1399,7 +1399,7 @@ qboolean Pickup_Health (edict_t *ent, edict_t *other)
other->health += ent->count; other->health += ent->count;
//stimpacks shouldn't rot away // stimpacks shouldn't rot away
/* if (ent->style & HEALTH_IGNORE_MAX /* if (ent->style & HEALTH_IGNORE_MAX
&& other->base_health >= other->max_health && other->health >= other->base_health) && other->base_health >= other->max_health && other->health >= other->base_health)
other->base_health += ent->count; other->base_health += ent->count;
@ -1790,7 +1790,7 @@ void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
{ {
if (ent->style & HEALTH_FOODCUBE) if (ent->style & HEALTH_FOODCUBE)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0); gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
//if (ent->count == sk_health_bonus_value->value) // Knightmare // if (ent->count == sk_health_bonus_value->value) // Knightmare
else if (ent->count < 10) // Knightmare else if (ent->count < 10) // Knightmare
gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0); gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
else if (ent->count == 10) else if (ent->count == 10)
@ -1827,6 +1827,55 @@ void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
} }
} }
// Knightmare added
/*
===============
Touch_Q1Backpack
===============
*/
void Touch_Q1Backpack (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
qboolean taken;
// if (other == ent->owner) // can't be touched by the entity that dropped us
// return;
if (!other->client)
return;
if (other->health < 1)
return; // dead people can't pickup
if (!ent->item->pickup)
return; // not a grabbable item?
taken = ent->item->pickup(ent, other);
if (taken)
{
// flash the screen
other->client->bonus_alpha = 0.25;
// show icon and name on status bar
other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
other->client->pickup_msg_time = level.time + 3.0;
// gi.sound(other, CHAN_ITEM, gi.soundindex("q1weapons/lock4.wav"), 1, ATTN_NORM, 0);
/* if (ent->noise_index != 0) {
gi.sound(other, CHAN_ITEM, ent->noise_index, 1, ATTN_NORM, 0);
}*/
}
if (!taken)
return;
// Lazarus reflections
DeleteReflection (ent, -1);
// just delete it, no respawning
G_FreeEdict (ent);
}
// end Knightmare
//====================================================================== //======================================================================
/*static*/ void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) /*static*/ void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
@ -1917,17 +1966,17 @@ edict_t *Drop_Item (edict_t *ent, gitem_t *item)
VectorCopy (ent->velocity, dropped->velocity); //if it's moving on a conveyor VectorCopy (ent->velocity, dropped->velocity); //if it's moving on a conveyor
} }
else*/ else*/
if (ent->solid != SOLID_BSP) //Knightmare- hack for items dropped by shootable boxes if (ent->solid != SOLID_BSP) // Knightmare- hack for items dropped by shootable boxes
VectorScale (forward, 100, dropped->velocity); VectorScale (forward, 100, dropped->velocity);
if (!strcmp(ent->classname, "func_pushable")) //Make items dropped by movable crates destroyable if (!strcmp(ent->classname, "func_pushable")) // Make items dropped by movable crates destroyable
{ {
dropped->spawnflags |= ITEM_SHOOTABLE; dropped->spawnflags |= ITEM_SHOOTABLE;
dropped->solid = SOLID_BBOX; dropped->solid = SOLID_BBOX;
dropped->health = 20; dropped->health = 20;
dropped->takedamage = DAMAGE_YES; dropped->takedamage = DAMAGE_YES;
//dropped->die = BecomeExplosion1; // dropped->die = BecomeExplosion1;
//Knightmare- this compiles cleaner // Knightmare- this compiles cleaner
dropped->die = Item_Die; dropped->die = Item_Die;
} }
@ -1942,6 +1991,81 @@ edict_t *Drop_Item (edict_t *ent, gitem_t *item)
return dropped; return dropped;
} }
// Knightmare added
/*
============
Drop_Q1Backpack
Spawns backpack dropped by Q1 monsters.
Similar to Drop_Item, but the backpack is not an item in the item table.
It contains an item instead.
============
*/
edict_t *Drop_Q1Backpack (edict_t *ent, gitem_t *item, int count)
{
edict_t *backpack;
vec3_t forward, right;
vec3_t offset;
if (!ent)
return NULL;
if (!item) {
gi.dprintf ("Drop_Q1Backpack: invalid item\n");
return NULL;
}
backpack = G_Spawn();
backpack->classname = "misc_q1_backpack";
backpack->item = item;
backpack->count = count;
backpack->touch = Touch_Q1Backpack;
backpack->spawnflags = DROPPED_ITEM;
backpack->s.skinnum = 0;
backpack->s.effects = EF_ROTATE;
backpack->s.renderfx = RF_GLOW | RF_IR_VISIBLE;
backpack->s.angles[1] = ent->s.angles[1]; // Knightmare- preserve yaw from dropping entity
backpack->s.angles[1] += crandom() * 45;
// backpack->noise_index = gi.soundindex("q1weapons/lock4.wav");
VectorSet (backpack->mins, -16, -16, -16);
VectorSet (backpack->maxs, 16, 16, 16);
gi.setmodel (backpack, "models/items/q1backpack/tris.md2");
backpack->solid = SOLID_TRIGGER;
backpack->movetype = MOVETYPE_TOSS;
backpack->touch = drop_temp_touch;
backpack->owner = ent;
if (ent->client)
{
trace_t trace;
AngleVectors (ent->client->v_angle, forward, right, NULL);
VectorSet(offset, 24, 0, -16);
G_ProjectSource (ent->s.origin, offset, forward, right, backpack->s.origin);
trace = gi.trace (ent->s.origin, backpack->mins, backpack->maxs,
backpack->s.origin, ent, CONTENTS_SOLID);
VectorCopy (trace.endpos, backpack->s.origin);
}
else
{
AngleVectors (ent->s.angles, forward, right, NULL);
VectorCopy (ent->s.origin, backpack->s.origin);
}
VectorScale (forward, 100, backpack->velocity);
backpack->velocity[2] += 300;
backpack->think = G_FreeEdict;
backpack->nextthink = level.time + 1800;
gi.linkentity (backpack);
return backpack;
}
// end Knightmare
void Use_Item (edict_t *ent, edict_t *other, edict_t *activator) void Use_Item (edict_t *ent, edict_t *other, edict_t *activator)
{ {
ent->svflags &= ~SVF_NOCLIENT; ent->svflags &= ~SVF_NOCLIENT;
@ -2299,7 +2423,7 @@ void SpawnItem (edict_t *ent, gitem_t *item)
ent->item = item; ent->item = item;
ent->nextthink = level.time + 2 * FRAMETIME; // items start after other solids ent->nextthink = level.time + 2 * FRAMETIME; // items start after other solids
ent->think = droptofloor; ent->think = droptofloor;
ent->s.skinnum = item->world_model_skinnum; //Knightmare- skinnum specified in item table ent->s.skinnum = item->world_model_skinnum; // Knightmare- skinnum specified in item table
ent->s.effects = item->world_model_flags; ent->s.effects = item->world_model_flags;
ent->s.renderfx = RF_GLOW; ent->s.renderfx = RF_GLOW;
if (ent->model) if (ent->model)
@ -4683,7 +4807,7 @@ model="models/items/q1keys/gold/tris.md2"
NULL, NULL,
Drop_General, Drop_General,
NULL, NULL,
"q1items/medkey.wav", "q1misc/medkey.wav",
"models/items/q1keys/gold/tris.md2", 0, EF_ROTATE, "models/items/q1keys/gold/tris.md2", 0, EF_ROTATE,
NULL, NULL,
"k_med_gold", "k_med_gold",
@ -4709,7 +4833,7 @@ model="models/items/q1keys/silver/tris.md2"
NULL, NULL,
Drop_General, Drop_General,
NULL, NULL,
"q1items/medkey.wav", "q1misc/medkey.wav",
"models/items/q1keys/silver/tris.md2", 0, EF_ROTATE, "models/items/q1keys/silver/tris.md2", 0, EF_ROTATE,
NULL, NULL,
"k_med_silver", "k_med_silver",
@ -4735,7 +4859,7 @@ model="models/items/q1keys/gold/rune/tris.md2"
NULL, NULL,
Drop_General, Drop_General,
NULL, NULL,
"q1items/runekey.wav", "q1misc/runekey.wav",
"models/items/q1keys/gold/rune/tris.md2", 0, EF_ROTATE, "models/items/q1keys/gold/rune/tris.md2", 0, EF_ROTATE,
NULL, NULL,
"k_rune_gold", "k_rune_gold",
@ -4761,7 +4885,7 @@ model="models/items/q1keys/silver/rune/tris.md2"
NULL, NULL,
Drop_General, Drop_General,
NULL, NULL,
"q1items/runekey.wav", "q1misc/runekey.wav",
"models/items/q1keys/silver/rune/tris.md2", 0, EF_ROTATE, "models/items/q1keys/silver/rune/tris.md2", 0, EF_ROTATE,
NULL, NULL,
"k_rune_silver", "k_rune_silver",
@ -4787,7 +4911,7 @@ model="models/items/q1keys/gold/base/tris.md2"
NULL, NULL,
Drop_General, Drop_General,
NULL, NULL,
"q1items/basekey.wav", "q1misc/basekey.wav",
"models/items/q1keys/gold/base/tris.md2", 0, EF_ROTATE, "models/items/q1keys/gold/base/tris.md2", 0, EF_ROTATE,
NULL, NULL,
"k_base_gold", "k_base_gold",
@ -4813,7 +4937,7 @@ model="models/items/q1keys/silver/base/tris.md2"
NULL, NULL,
Drop_General, Drop_General,
NULL, NULL,
"q1items/basekey.wav", "q1misc/basekey.wav",
"models/items/q1keys/silver/base/tris.md2", 0, EF_ROTATE, "models/items/q1keys/silver/base/tris.md2", 0, EF_ROTATE,
NULL, NULL,
"k_base_silver", "k_base_silver",

View file

@ -1173,6 +1173,7 @@ gitem_t *FindItem (char *pickup_name);
gitem_t *FindItemByClassname (char *classname); gitem_t *FindItemByClassname (char *classname);
#define ITEM_INDEX(x) ((x)-itemlist) #define ITEM_INDEX(x) ((x)-itemlist)
edict_t *Drop_Item (edict_t *ent, gitem_t *item); edict_t *Drop_Item (edict_t *ent, gitem_t *item);
edict_t *Drop_Q1Backpack (edict_t *ent, gitem_t *item, int count); // Knightmare added
void SetRespawn (edict_t *ent, float delay); void SetRespawn (edict_t *ent, float delay);
void ChangeWeapon (edict_t *ent); void ChangeWeapon (edict_t *ent);
void SpawnItem (edict_t *ent, gitem_t *item); void SpawnItem (edict_t *ent, gitem_t *item);
@ -1308,6 +1309,7 @@ qboolean box_walkmove (edict_t *ent, float yaw, float dist);
void button_use (edict_t *self, edict_t *other, edict_t *activator); void button_use (edict_t *self, edict_t *other, edict_t *activator);
void trainbutton_use (edict_t *self, edict_t *other, edict_t *activator); void trainbutton_use (edict_t *self, edict_t *other, edict_t *activator);
void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*)); void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*));
void movewith_init (edict_t *ent);
void train_move_children (edict_t *self); void train_move_children (edict_t *self);
void train_kill_children (edict_t *self); void train_kill_children (edict_t *self);
void train_remove_children (edict_t *self); void train_remove_children (edict_t *self);
@ -1315,6 +1317,8 @@ void fade_children (edict_t *self);
void fade_children2 (edict_t *self); void fade_children2 (edict_t *self);
void train_next (edict_t *self); void train_next (edict_t *self);
void func_train_find (edict_t *self); void func_train_find (edict_t *self);
void train_use (edict_t *self, edict_t *other, edict_t *activator);
void train_blocked (edict_t *self, edict_t *other);
// damage flags // damage flags
#define DAMAGE_RADIUS 0x00000001 // damage was indirect #define DAMAGE_RADIUS 0x00000001 // damage was indirect

View file

@ -284,7 +284,7 @@ void modelspawn_think (edict_t *self)
if (self->s.frame >= self->framenumbers) if (self->s.frame >= self->framenumbers)
{ {
self->s.frame = self->startframe; self->s.frame = self->startframe;
if(self->spawnflags & ANIM_ONCE) if (self->spawnflags & ANIM_ONCE)
{ {
model_spawn_use(self,world,world); model_spawn_use(self,world,world);
return; return;
@ -302,7 +302,7 @@ void model_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
{ {
self->svflags &= ~SVF_NOCLIENT; self->svflags &= ~SVF_NOCLIENT;
self->delay = 0; self->delay = 0;
if(self->framenumbers > 1) if (self->framenumbers > 1)
{ {
self->think = modelspawn_think; self->think = modelspawn_think;
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
@ -325,7 +325,7 @@ void model_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
void model_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) void model_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{ {
if(self->deathtarget) if (self->deathtarget)
{ {
self->target = self->deathtarget; self->target = self->deathtarget;
G_UseTargets (self, attacker); G_UseTargets (self, attacker);
@ -415,11 +415,11 @@ void SP_model_spawn (edict_t *ent)
{ {
if (ent->spawnflags & PLAYER_MODEL) if (ent->spawnflags & PLAYER_MODEL)
{ {
if(!ent->usermodel || !strlen(ent->usermodel)) if (!ent->usermodel || !strlen(ent->usermodel))
ent->s.modelindex = MAX_MODELS-1; //was 255 ent->s.modelindex = MAX_MODELS-1; //was 255
else else
{ {
if(strstr(ent->usermodel,"tris.md2")) if (strstr(ent->usermodel,"tris.md2"))
Com_sprintf(modelname, sizeof(modelname), "players/%s", ent->usermodel); Com_sprintf(modelname, sizeof(modelname), "players/%s", ent->usermodel);
else else
Com_sprintf(modelname, sizeof(modelname), "players/%s/tris.md2", ent->usermodel); Com_sprintf(modelname, sizeof(modelname), "players/%s/tris.md2", ent->usermodel);
@ -471,7 +471,7 @@ void SP_model_spawn (edict_t *ent)
ent->use = model_spawn_use; ent->use = model_spawn_use;
} }
if(!(ent->s.effects & ANIM_MASK) && (ent->framenumbers > 1)) if (!(ent->s.effects & ANIM_MASK) && (ent->framenumbers > 1))
{ {
ent->think = modelspawn_think; ent->think = modelspawn_think;
ent->nextthink = level.time + 2*FRAMETIME; ent->nextthink = level.time + 2*FRAMETIME;
@ -591,27 +591,23 @@ NOTE: All the pieces must be created after the model train entity, otherwise the
#define TRAIN_ROT_CONST 16 #define TRAIN_ROT_CONST 16
#define TRAIN_SPLINE 8192 #define TRAIN_SPLINE 8192
extern void train_use (edict_t *self, edict_t *other, edict_t *activator);
extern void func_train_find (edict_t *self);
void train_blocked (edict_t *self, edict_t *other);
void model_train_animator(edict_t *animator) void model_train_animator(edict_t *animator)
{ {
edict_t *train; edict_t *train;
train = animator->owner; train = animator->owner;
if(!train || !train->inuse) if (!train || !train->inuse)
{ {
G_FreeEdict(animator); G_FreeEdict(animator);
return; return;
} }
if(Q_stricmp(train->classname,"model_train")) if (Q_stricmp(train->classname, "model_train"))
{ {
G_FreeEdict(animator); G_FreeEdict(animator);
return; return;
} }
animator->nextthink = level.time + FRAMETIME; animator->nextthink = level.time + FRAMETIME;
if(VectorLength(train->velocity) == 0) if (VectorLength(train->velocity) == 0)
return; return;
train->s.frame++; train->s.frame++;
if (train->s.frame >= train->framenumbers) if (train->s.frame >= train->framenumbers)
@ -629,7 +625,7 @@ void SP_model_train (edict_t *self)
self->moveinfo.sound_middle = self->s.sound; self->moveinfo.sound_middle = self->s.sound;
self->s.sound = 0; self->s.sound = 0;
if(!self->inuse) return; if (!self->inuse) return;
// Reset some things from SP_model_spawn // Reset some things from SP_model_spawn
self->delay = 0; self->delay = 0;
@ -644,7 +640,7 @@ void SP_model_train (edict_t *self)
self->takedamage = DAMAGE_YES; self->takedamage = DAMAGE_YES;
} }
if(self->framenumbers > self->startframe+1) if (self->framenumbers > self->startframe+1)
{ {
edict_t *animator; edict_t *animator;
animator = G_Spawn(); animator = G_Spawn();
@ -677,9 +673,9 @@ void SP_model_train (edict_t *self)
self->spawnflags &= ~TRAIN_ROT_CONST; self->spawnflags &= ~TRAIN_ROT_CONST;
self->spawnflags |= TRAIN_SPLINE; self->spawnflags |= TRAIN_SPLINE;
} }
if(self->style == 3) if (self->style == 3)
self->spawnflags |= TRAIN_ANIM; // 32 self->spawnflags |= TRAIN_ANIM; // 32
if(self->style == 4) if (self->style == 4)
self->spawnflags |= TRAIN_ANIM_FAST; // 64 self->spawnflags |= TRAIN_ANIM_FAST; // 64
// TRAIN_SMOOTH forces trains to go directly to Move_Done from // TRAIN_SMOOTH forces trains to go directly to Move_Done from
@ -702,12 +698,12 @@ void SP_model_train (edict_t *self)
if (!self->speed) if (!self->speed)
self->speed = 100; self->speed = 100;
//Mappack // Mappack
if(!self->accel) if (!self->accel)
self->moveinfo.accel = self->speed; self->moveinfo.accel = self->speed;
else else
self->moveinfo.accel = self->accel; self->moveinfo.accel = self->accel;
if(!self->decel) if (!self->decel)
self->moveinfo.decel = self->speed; self->moveinfo.decel = self->speed;
else else
self->moveinfo.decel = self->decel; self->moveinfo.decel = self->decel;

View file

@ -1998,7 +1998,7 @@ void SP_func_breakaway (edict_t *self)
self->takedamage = DAMAGE_YES; 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; self->touch = func_breakaway_touch;
@ -4267,6 +4267,8 @@ void SP_trigger_teleporter_bbox (edict_t *self)
else else
self->solid = SOLID_TRIGGER; self->solid = SOLID_TRIGGER;
self->class_id = ENTITY_TRIGGER_TELEPORTER;
gi.linkentity (self); gi.linkentity (self);
} }
@ -4283,6 +4285,7 @@ void SP_misc_teleporter_dest (edict_t *ent)
VectorSet (ent->mins, -32, -32, -24); VectorSet (ent->mins, -32, -32, -24);
VectorSet (ent->maxs, 32, 32, -16); VectorSet (ent->maxs, 32, 32, -16);
ent->common_name = "Teleporter Destination";
ent->class_id = ENTITY_MISC_TELEPORTER_DEST; ent->class_id = ENTITY_MISC_TELEPORTER_DEST;
gi.linkentity (ent); gi.linkentity (ent);
@ -5350,6 +5353,7 @@ void target_fountain_delayed_use (edict_t *self)
else else
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
} }
void SP_target_fountain (edict_t *ent) void SP_target_fountain (edict_t *ent)
{ {
char *buffer; char *buffer;

View file

@ -335,7 +335,7 @@ void q1_use_target_trapshooter (edict_t *self, edict_t *other, edict_t *activato
else { else {
q1_fire_nail (self, self->s.origin, self->movedir, self->dmg, self->speed, super); q1_fire_nail (self, self->s.origin, self->movedir, self->dmg, self->speed, super);
#ifndef KMQUAKE2_ENGINE_MOD #ifndef KMQUAKE2_ENGINE_MOD
gi.sound (self, CHAN_AUTO, gi.soundindex("q1weap/nails/s_end.wav"), 1.0, ATTN_NORM, 0); gi.sound (self, CHAN_AUTO, gi.soundindex("q1weapons/s_end.wav"), 1.0, ATTN_NORM, 0);
#endif #endif
} }
} }
@ -360,10 +360,10 @@ void SP_target_q1_trap (edict_t *self)
} }
else { else {
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
self->noise_index = gi.soundindex ("q1weap/nails/spike2.wav"); self->noise_index = gi.soundindex ("q1weapons/spike2.wav");
#else #else
self->noise_index = gi.soundindex ("q1weap/nails/spike.wav"); self->noise_index = gi.soundindex ("q1weapons/spike.wav");
gi.soundindex("q1weap/nails/s_end.wav"); gi.soundindex("q1weapons/s_end.wav");
#endif #endif
if (!self->speed) if (!self->speed)
self->speed = 500; self->speed = 500;
@ -474,7 +474,7 @@ void q1_barrel_explode (edict_t *self)
VectorCopy (save, self->s.origin); VectorCopy (save, self->s.origin);
} }
gi.sound (self, CHAN_AUTO, gi.soundindex ("q1weap/rocket/r_exp3.wav"), 1.0, ATTN_NORM, 0); gi.sound (self, CHAN_AUTO, gi.soundindex ("q1weapons/r_exp3.wav"), 1.0, ATTN_NORM, 0);
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_ROCKET_EXPLOSION); gi.WriteByte (TE_ROCKET_EXPLOSION);
gi.WritePosition (self->s.origin); gi.WritePosition (self->s.origin);
@ -505,7 +505,7 @@ void SP_misc_q1_explobox (edict_t *self)
{ {
// precache // precache
gi.modelindex ("sprites/s_explod.sp2"); gi.modelindex ("sprites/s_explod.sp2");
gi.soundindex ("q1weap/rocket/r_exp3.wav"); gi.soundindex ("q1weapons/r_exp3.wav");
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;
//self->solid = SOLID_NOT; //self->solid = SOLID_NOT;

View file

@ -35,13 +35,13 @@ qboolean blocked_checkshot (edict_t *self, float shotChance)
{ {
qboolean playerVisible; qboolean playerVisible;
if(!self->enemy) if (!self->enemy)
return false; return false;
// blocked checkshot is only against players. this will // blocked checkshot is only against players. this will
// filter out player sounds and other shit they should // filter out player sounds and other shit they should
// not be firing at. // not be firing at.
if(!(self->enemy->client)) if (!(self->enemy->client))
return false; return false;
if (random() < shotChance) if (random() < shotChance)
@ -74,7 +74,7 @@ qboolean blocked_checkshot (edict_t *self, float shotChance)
{ {
self->monsterinfo.aiflags |= AI_BLOCKED; self->monsterinfo.aiflags |= AI_BLOCKED;
if(self->monsterinfo.attack) if (self->monsterinfo.attack)
self->monsterinfo.attack(self); self->monsterinfo.attack(self);
self->monsterinfo.aiflags &= ~AI_BLOCKED; self->monsterinfo.aiflags &= ~AI_BLOCKED;
@ -84,18 +84,18 @@ qboolean blocked_checkshot (edict_t *self, float shotChance)
playerVisible = visible (self, self->enemy); playerVisible = visible (self, self->enemy);
// always shoot at teslas // always shoot at teslas
if(playerVisible) if (playerVisible)
{ {
if (!strcmp(self->enemy->classname, "tesla")) if (!strcmp(self->enemy->classname, "tesla"))
{ {
// if(g_showlogic && g_showlogic->value) // if (g_showlogic && g_showlogic->value)
// gi.dprintf("blocked: taking a shot\n"); // gi.dprintf("blocked: taking a shot\n");
// turn on AI_BLOCKED to let the monster know the attack is being called // turn on AI_BLOCKED to let the monster know the attack is being called
// by the blocked functions... // by the blocked functions...
self->monsterinfo.aiflags |= AI_BLOCKED; self->monsterinfo.aiflags |= AI_BLOCKED;
if(self->monsterinfo.attack) if (self->monsterinfo.attack)
self->monsterinfo.attack(self); self->monsterinfo.attack(self);
self->monsterinfo.aiflags &= ~AI_BLOCKED; self->monsterinfo.aiflags &= ~AI_BLOCKED;
@ -116,32 +116,32 @@ qboolean blocked_checkplat (edict_t *self, float dist)
vec3_t forward; vec3_t forward;
edict_t *plat; edict_t *plat;
if(!self->enemy) if (!self->enemy)
return false; return false;
// check player's relative altitude // check player's relative altitude
if(self->enemy->absmin[2] >= self->absmax[2]) if (self->enemy->absmin[2] >= self->absmax[2])
playerPosition = 1; playerPosition = 1;
else if(self->enemy->absmax[2] <= self->absmin[2]) else if (self->enemy->absmax[2] <= self->absmin[2])
playerPosition = -1; playerPosition = -1;
else else
playerPosition = 0; playerPosition = 0;
// if we're close to the same position, don't bother trying plats. // if we're close to the same position, don't bother trying plats.
if(playerPosition == 0) if (playerPosition == 0)
return false; return false;
plat = NULL; plat = NULL;
// see if we're already standing on a plat. // see if we're already standing on a plat.
if(self->groundentity && self->groundentity != world) if (self->groundentity && self->groundentity != world)
{ {
if(!strncmp(self->groundentity->classname, "func_plat", 8)) if (!strncmp(self->groundentity->classname, "func_plat", 8))
plat = self->groundentity; plat = self->groundentity;
} }
// if we're not, check to see if we'll step onto one with this move // if we're not, check to see if we'll step onto one with this move
if(!plat) if (!plat)
{ {
AngleVectors (self->s.angles, forward, NULL, NULL); AngleVectors (self->s.angles, forward, NULL, NULL);
VectorMA(self->s.origin, dist, forward, pt1); VectorMA(self->s.origin, dist, forward, pt1);
@ -149,9 +149,9 @@ qboolean blocked_checkplat (edict_t *self, float dist)
pt2[2] -= 384; pt2[2] -= 384;
trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, MASK_MONSTERSOLID); trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, MASK_MONSTERSOLID);
if(trace.fraction < 1 && !trace.allsolid && !trace.startsolid) if (trace.fraction < 1 && !trace.allsolid && !trace.startsolid)
{ {
if(!strncmp(trace.ent->classname, "func_plat", 8)) if (!strncmp(trace.ent->classname, "func_plat", 8))
{ {
plat = trace.ent; plat = trace.ent;
} }
@ -159,31 +159,31 @@ qboolean blocked_checkplat (edict_t *self, float dist)
} }
// if we've found a plat, trigger it. // if we've found a plat, trigger it.
if(plat && plat->use) if (plat && plat->use)
{ {
if (playerPosition == 1) if (playerPosition == 1)
{ {
if((self->groundentity == plat && plat->moveinfo.state == STATE_BOTTOM) || if ((self->groundentity == plat && plat->moveinfo.state == STATE_BOTTOM) ||
(self->groundentity != plat && plat->moveinfo.state == STATE_TOP)) (self->groundentity != plat && plat->moveinfo.state == STATE_TOP))
{ {
// if(g_showlogic && g_showlogic->value) // if (g_showlogic && g_showlogic->value)
// gi.dprintf("player above, and plat will raise. using!\n"); // gi.dprintf("player above, and plat will raise. using!\n");
plat->use (plat, self, self); plat->use (plat, self, self);
return true; return true;
} }
} }
else if(playerPosition == -1) else if (playerPosition == -1)
{ {
if((self->groundentity == plat && plat->moveinfo.state == STATE_TOP) || if ((self->groundentity == plat && plat->moveinfo.state == STATE_TOP) ||
(self->groundentity != plat && plat->moveinfo.state == STATE_BOTTOM)) (self->groundentity != plat && plat->moveinfo.state == STATE_BOTTOM))
{ {
// if(g_showlogic && g_showlogic->value) // if (g_showlogic && g_showlogic->value)
// gi.dprintf("player below, and plat will lower. using!\n"); // gi.dprintf("player below, and plat will lower. using!\n");
plat->use (plat, self, self); plat->use (plat, self, self);
return true; return true;
} }
} }
// if(g_showlogic && g_showlogic->value) // if (g_showlogic && g_showlogic->value)
// gi.dprintf("hit a plat, not using. ppos: %d plat: %d\n", playerPosition, plat->moveinfo.state); // gi.dprintf("hit a plat, not using. ppos: %d plat: %d\n", playerPosition, plat->moveinfo.state);
} }
@ -205,13 +205,13 @@ qboolean blocked_checkjump (edict_t *self, float dist, float maxDown, float maxU
// Lazarus: Rogue only did this for enemies. We do it for enemies or // Lazarus: Rogue only did this for enemies. We do it for enemies or
// movetargets // movetargets
if(!self->monsterinfo.jump) if (!self->monsterinfo.jump)
return false; return false;
if(!self->enemy) if (!self->enemy)
return false; return false;
if(self->enemy) if (self->enemy)
target = self->enemy; target = self->enemy;
else if(self->movetarget) else if (self->movetarget)
target = self->movetarget; target = self->movetarget;
else else
return false; return false;
@ -222,35 +222,35 @@ qboolean blocked_checkjump (edict_t *self, float dist, float maxDown, float maxU
AngleVectors (self->s.angles, forward, NULL, up); AngleVectors (self->s.angles, forward, NULL, up);
VectorMA(self->s.origin, 48, forward, pt1); VectorMA(self->s.origin, 48, forward, pt1);
if(target->absmin[2] > (self->absmin[2] + 16)) if (target->absmin[2] > (self->absmin[2] + 16))
playerPosition = 1; playerPosition = 1;
else if(target->absmin[2] < (self->absmin[2] - 16)) else if (target->absmin[2] < (self->absmin[2] - 16))
playerPosition = -1; playerPosition = -1;
else else
playerPosition = 0; playerPosition = 0;
if(playerPosition == -1 && maxDown) if (playerPosition == -1 && maxDown)
{ {
// check to make sure we can even get to the spot we're going to "fall" from // check to make sure we can even get to the spot we're going to "fall" from
trace = gi.trace(self->s.origin, self->mins, self->maxs, pt1, self, MASK_MONSTERSOLID); trace = gi.trace(self->s.origin, self->mins, self->maxs, pt1, self, MASK_MONSTERSOLID);
if(trace.fraction < 1) if (trace.fraction < 1)
return false; return false;
VectorCopy (pt1, pt2); VectorCopy (pt1, pt2);
pt2[2] = self->mins[2] - maxDown - 1; pt2[2] = self->mins[2] - maxDown - 1;
trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, MASK_MONSTERSOLID | MASK_WATER); trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, MASK_MONSTERSOLID | MASK_WATER);
if(trace.fraction < 1 && !trace.allsolid && !trace.startsolid) if (trace.fraction < 1 && !trace.allsolid && !trace.startsolid)
{ {
if((self->absmin[2] - trace.endpos[2]) >= 24 && trace.contents & MASK_SOLID) if ((self->absmin[2] - trace.endpos[2]) >= 24 && trace.contents & MASK_SOLID)
{ {
if( (target->absmin[2] - trace.endpos[2]) > 32) if ( (target->absmin[2] - trace.endpos[2]) > 32)
return false; return false;
if(trace.plane.normal[2] < 0.9) if (trace.plane.normal[2] < 0.9)
return false; return false;
VectorSubtract(target->s.origin,trace.endpos,pt1); VectorSubtract(target->s.origin,trace.endpos,pt1);
d1 = VectorLength(pt1); d1 = VectorLength(pt1);
if(d0 < d1) if (d0 < d1)
return false; return false;
self->velocity[0] = forward[0]*dist*10; self->velocity[0] = forward[0]*dist*10;
self->velocity[1] = forward[1]*dist*10; self->velocity[1] = forward[1]*dist*10;
@ -260,19 +260,19 @@ qboolean blocked_checkjump (edict_t *self, float dist, float maxDown, float maxU
} }
} }
} }
else if(playerPosition == 1 && maxUp) else if (playerPosition == 1 && maxUp)
{ {
VectorCopy(pt1, pt2); VectorCopy(pt1, pt2);
pt1[2] = self->absmax[2] + maxUp; pt1[2] = self->absmax[2] + maxUp;
trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, MASK_MONSTERSOLID | MASK_WATER); trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, MASK_MONSTERSOLID | MASK_WATER);
if(trace.fraction < 1 && !trace.allsolid && !trace.startsolid) if (trace.fraction < 1 && !trace.allsolid && !trace.startsolid)
{ {
if((trace.endpos[2] - self->absmin[2]) <= maxUp && trace.contents & MASK_SOLID) if ((trace.endpos[2] - self->absmin[2]) <= maxUp && trace.contents & MASK_SOLID)
{ {
VectorSubtract(target->s.origin,trace.endpos,pt1); VectorSubtract(target->s.origin,trace.endpos,pt1);
d1 = VectorLength(pt1); d1 = VectorLength(pt1);
if(d0 < d1) if (d0 < d1)
return false; return false;
face_wall(self); face_wall(self);
self->monsterinfo.jump(self); self->monsterinfo.jump(self);
@ -282,13 +282,13 @@ qboolean blocked_checkjump (edict_t *self, float dist, float maxDown, float maxU
gi.linkentity(self); gi.linkentity(self);
return true; return true;
} }
// else if(g_showlogic && g_showlogic->value) // else if (g_showlogic && g_showlogic->value)
// gi.dprintf("Too high to jump %0.1f\n", (trace.endpos[2] - self->absmin[2])); // gi.dprintf("Too high to jump %0.1f\n", (trace.endpos[2] - self->absmin[2]));
} }
// else if(g_showlogic && g_showlogic->value) // else if (g_showlogic && g_showlogic->value)
// gi.dprintf("Not something I could jump onto\n"); // gi.dprintf("Not something I could jump onto\n");
} }
// else if(g_showlogic && g_showlogic->value) // else if (g_showlogic && g_showlogic->value)
// gi.dprintf("Player at similar level. No need to jump up?\n"); // gi.dprintf("Player at similar level. No need to jump up?\n");
return false; return false;
@ -348,21 +348,21 @@ int num_hint_paths;
// ============= // =============
// hintpath_findstart - given any hintpath node, finds the start node // hintpath_findstart - given any hintpath node, finds the start node
// ============= // =============
edict_t *hintpath_findstart(edict_t *ent) edict_t *hintpath_findstart (edict_t *ent)
{ {
edict_t *e; edict_t *e;
edict_t *last; edict_t *last;
int field; int field;
if(ent->target) // starting point if (ent->target) // starting point
{ {
last = world; last = world;
field = FOFS(targetname); field = FOFS(targetname);
e = G_Find(NULL, field, ent->target); e = G_Find(NULL, field, ent->target);
while(e) while (e)
{ {
last = e; last = e;
if(!e->target) if (!e->target)
break; break;
e = G_Find(NULL, field, e->target); e = G_Find(NULL, field, e->target);
} }
@ -372,22 +372,22 @@ edict_t *hintpath_findstart(edict_t *ent)
last = world; last = world;
field = FOFS(target); field = FOFS(target);
e = G_Find(NULL, field, ent->targetname); e = G_Find(NULL, field, ent->targetname);
while(e) while (e)
{ {
last = e; last = e;
if(!e->targetname) if (!e->targetname)
break; break;
e = G_Find(NULL, field, e->targetname); e = G_Find(NULL, field, e->targetname);
} }
} }
if(!(last->spawnflags & HINT_ENDPOINT)) if (!(last->spawnflags & HINT_ENDPOINT))
{ {
// gi.dprintf ("end of chain is not HINT_ENDPOINT\n"); // gi.dprintf ("end of chain is not HINT_ENDPOINT\n");
return NULL; return NULL;
} }
if(last == world) if (last == world)
last = NULL; last = NULL;
return last; return last;
} }
@ -395,21 +395,21 @@ edict_t *hintpath_findstart(edict_t *ent)
// ============= // =============
// hintpath_other_end - given one endpoint of a hintpath, returns the other end. // hintpath_other_end - given one endpoint of a hintpath, returns the other end.
// ============= // =============
edict_t *hintpath_other_end(edict_t *ent) edict_t *hintpath_other_end (edict_t *ent)
{ {
edict_t *e; edict_t *e;
edict_t *last; edict_t *last;
int field; int field;
if(ent->target) // starting point if (ent->target) // starting point
{ {
last = world; last = world;
field = FOFS(targetname); field = FOFS(targetname);
e = G_Find(NULL, field, ent->target); e = G_Find(NULL, field, ent->target);
while(e) while (e)
{ {
last = e; last = e;
if(!e->target) if (!e->target)
break; break;
e = G_Find(NULL, field, e->target); e = G_Find(NULL, field, e->target);
} }
@ -419,22 +419,22 @@ edict_t *hintpath_other_end(edict_t *ent)
last = world; last = world;
field = FOFS(target); field = FOFS(target);
e = G_Find(NULL, field, ent->targetname); e = G_Find(NULL, field, ent->targetname);
while(e) while (e)
{ {
last = e; last = e;
if(!e->targetname) if (!e->targetname)
break; break;
e = G_Find(NULL, field, e->targetname); e = G_Find(NULL, field, e->targetname);
} }
} }
if(!(last->spawnflags & HINT_ENDPOINT)) if (!(last->spawnflags & HINT_ENDPOINT))
{ {
// gi.dprintf ("end of chain is not HINT_ENDPOINT\n"); // gi.dprintf ("end of chain is not HINT_ENDPOINT\n");
return NULL; return NULL;
} }
if(last == world) if (last == world)
last = NULL; last = NULL;
return last; return last;
} }
@ -515,10 +515,10 @@ qboolean monsterlost_checkhint (edict_t *self)
qboolean hint_path_represented[MAX_HINT_CHAINS]; qboolean hint_path_represented[MAX_HINT_CHAINS];
// if there are no hint paths on this map, exit immediately. // if there are no hint paths on this map, exit immediately.
if(!hint_paths_present) if (!hint_paths_present)
return false; return false;
if(!self->enemy) if (!self->enemy)
return false; return false;
if (self->monsterinfo.aiflags & AI_STAND_GROUND) if (self->monsterinfo.aiflags & AI_STAND_GROUND)
@ -536,7 +536,7 @@ qboolean monsterlost_checkhint (edict_t *self)
for (i=0; i < num_hint_paths; i++) for (i=0; i < num_hint_paths; i++)
{ {
e = hint_path_start[i]; e = hint_path_start[i];
while(e) while (e)
{ {
count1++; count1++;
if (e->monster_hint_chain) if (e->monster_hint_chain)
@ -832,10 +832,10 @@ qboolean monsterlost_checkhint2 (edict_t *self)
int playerVisible, selfVisible; int playerVisible, selfVisible;
// if there are no hint paths on this map, exit immediately. // if there are no hint paths on this map, exit immediately.
if(!hint_paths_present) if (!hint_paths_present)
return false; return false;
if(!self->enemy) if (!self->enemy)
return false; return false;
goPoint = NULL; goPoint = NULL;
@ -843,10 +843,10 @@ qboolean monsterlost_checkhint2 (edict_t *self)
// check all the hint_paths. // check all the hint_paths.
e = G_Find(NULL, field, "hint_path"); e = G_Find(NULL, field, "hint_path");
while(e) while (e)
{ {
// if it's an endpoint, check for "validity" // if it's an endpoint, check for "validity"
if(e->spawnflags & HINT_ENDPOINT) if (e->spawnflags & HINT_ENDPOINT)
{ {
// check visibility from this spot // check visibility from this spot
selfVisible = visible(e, self); selfVisible = visible(e, self);
@ -855,31 +855,31 @@ qboolean monsterlost_checkhint2 (edict_t *self)
// at least one of us is visible from this endpoint. // at least one of us is visible from this endpoint.
// now check the other one if needed. // now check the other one if needed.
if(selfVisible || playerVisible) if (selfVisible || playerVisible)
{ {
// if endpoint 1 saw me, set my destination to it. // if endpoint 1 saw me, set my destination to it.
if(selfVisible) if (selfVisible)
goPoint = e; goPoint = e;
// if both aren't visible, try the other endpoint // if both aren't visible, try the other endpoint
if(!selfVisible || !playerVisible) if (!selfVisible || !playerVisible)
{ {
e2 = hintpath_other_end(e); e2 = hintpath_other_end(e);
if(!e2) // could not connect to the other endpoint if (!e2) // could not connect to the other endpoint
{ {
gi.dprintf("Unlinked hint paths!\n"); gi.dprintf("Unlinked hint paths!\n");
return false; return false;
} }
// if endpoint 1 saw the enemy, see if endpoint 2 sees me // if endpoint 1 saw the enemy, see if endpoint 2 sees me
if(!selfVisible) if (!selfVisible)
selfVisible = visible(e2, self); selfVisible = visible(e2, self);
// if endpoint 1 saw me, see if endpoint 2 sees the enemy // if endpoint 1 saw me, see if endpoint 2 sees the enemy
else if(!playerVisible) else if (!playerVisible)
playerVisible = visible(e2, self->enemy); playerVisible = visible(e2, self->enemy);
// if endpoint 2 saw me, set my destination to it. // if endpoint 2 saw me, set my destination to it.
if(!goPoint && selfVisible) if (!goPoint && selfVisible)
goPoint = e2; goPoint = e2;
// gi.dprintf("checking other endpoint at %s %d %d\n", vtos(e2->s.origin),selfVisible,playerVisible); // gi.dprintf("checking other endpoint at %s %d %d\n", vtos(e2->s.origin),selfVisible,playerVisible);
@ -887,10 +887,10 @@ qboolean monsterlost_checkhint2 (edict_t *self)
// if both are visible from at least one endpoint, // if both are visible from at least one endpoint,
// go for it. // go for it.
if(selfVisible && playerVisible) if (selfVisible && playerVisible)
{ {
// set me to go to goPoint // set me to go to goPoint
if(g_showlogic && g_showlogic->value) if (g_showlogic && g_showlogic->value)
gi.dprintf("found path. proceed to %s\n", vtos(goPoint->s.origin)); gi.dprintf("found path. proceed to %s\n", vtos(goPoint->s.origin));
// since this is a new hint path trip, set last_hint to NULL // since this is a new hint path trip, set last_hint to NULL
@ -904,7 +904,7 @@ qboolean monsterlost_checkhint2 (edict_t *self)
} }
// if we got here, we didn't find a valid path // if we got here, we didn't find a valid path
if(g_showlogic && g_showlogic->value) if (g_showlogic && g_showlogic->value)
gi.dprintf("blocked_checkhint: found no paths\n"); gi.dprintf("blocked_checkhint: found no paths\n");
return false; return false;
} }
@ -922,15 +922,15 @@ void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
// int chain; // direction - (-1) = upstream, (1) = downstream, (0) = done // int chain; // direction - (-1) = upstream, (1) = downstream, (0) = done
qboolean goalFound = false; qboolean goalFound = false;
if(other->monsterinfo.aiflags & AI_MEDIC_PATROL) if (other->monsterinfo.aiflags & AI_MEDIC_PATROL)
{ {
if(other->movetarget == self) if (other->movetarget == self)
medic_NextPatrolPoint(other,self); medic_NextPatrolPoint(other,self);
return; return;
} }
// make sure we're the target of it's obsession // make sure we're the target of it's obsession
if(other->movetarget == self) if (other->movetarget == self)
{ {
goal = other->monsterinfo.goal_hint; goal = other->monsterinfo.goal_hint;
@ -966,7 +966,7 @@ void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
} }
// if we couldn't find it, have the monster go back to normal hunting. // if we couldn't find it, have the monster go back to normal hunting.
if(!next) if (!next)
{ {
hintpath_stop(other); hintpath_stop(other);
return; return;
@ -978,7 +978,7 @@ void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
// have the monster freeze if the hint path we just touched has a wait time // have the monster freeze if the hint path we just touched has a wait time
// on it, for example, when riding a plat. // on it, for example, when riding a plat.
if(self->wait) if (self->wait)
other->nextthink = level.time + self->wait; other->nextthink = level.time + self->wait;
} }
} }
@ -989,16 +989,16 @@ void hint_path_touch2 (edict_t *self, edict_t *other, cplane_t *plane, csurface_
int chain; int chain;
// make sure we're the target of it's obsession // make sure we're the target of it's obsession
if(other->movetarget == self) if (other->movetarget == self)
{ {
chain = 0; // direction the monster is going in the chain chain = 0; // direction the monster is going in the chain
next = NULL; // next hint_path next = NULL; // next hint_path
// gi.dprintf("hint_path %s\n", vtos(self->s.origin)); // gi.dprintf("hint_path %s\n", vtos(self->s.origin));
// is this the first hintpath targeted? if so, we can do this easily. // is this the first hintpath targeted? if so, we can do this easily.
if(other->monsterinfo.last_hint == NULL) if (other->monsterinfo.last_hint == NULL)
{ {
if(self->target) // forward chaining if (self->target) // forward chaining
chain = 1; chain = 1;
else // backward chaining else // backward chaining
chain = -1; chain = -1;
@ -1011,7 +1011,7 @@ void hint_path_touch2 (edict_t *self, edict_t *other, cplane_t *plane, csurface_
// make sure it's valid... // make sure it's valid...
if ( (last < g_edicts) || (last >= &g_edicts[globals.num_edicts])) if ( (last < g_edicts) || (last >= &g_edicts[globals.num_edicts]))
{ {
if(g_showlogic && g_showlogic->value) if (g_showlogic && g_showlogic->value)
{ {
gi.dprintf("bogus last_hint encountered.\n"); gi.dprintf("bogus last_hint encountered.\n");
gi.dprintf("detaching from hint path %d\n", chain); gi.dprintf("detaching from hint path %d\n", chain);
@ -1021,18 +1021,18 @@ void hint_path_touch2 (edict_t *self, edict_t *other, cplane_t *plane, csurface_
} }
// if we're an endpoint, then the monster is done moving. // if we're an endpoint, then the monster is done moving.
if(self->spawnflags & HINT_ENDPOINT) if (self->spawnflags & HINT_ENDPOINT)
{ {
chain = 0; chain = 0;
} }
// if last hint's target is our targetname, it's forward chaining. // if last hint's target is our targetname, it's forward chaining.
else if(last->target && self->targetname && !strcmp(last->target, self->targetname)) else if (last->target && self->targetname && !strcmp(last->target, self->targetname))
{ {
chain = 1; chain = 1;
} }
// if last hint's targetname is our target, it's backward chaining. // if last hint's targetname is our target, it's backward chaining.
// FIXME - last->targetname was 1, not NULL ???? was a screwed up hintpath // FIXME - last->targetname was 1, not NULL ???? was a screwed up hintpath
else if(self->target && last->targetname && !strcmp(last->targetname, self->target)) else if (self->target && last->targetname && !strcmp(last->targetname, self->target))
{ {
chain = -1; chain = -1;
} }
@ -1044,15 +1044,15 @@ void hint_path_touch2 (edict_t *self, edict_t *other, cplane_t *plane, csurface_
} }
// find the "next" hint_path // find the "next" hint_path
if(chain == 1 && self->target) // forward chaining if (chain == 1 && self->target) // forward chaining
next = G_Find(NULL, FOFS(targetname), self->target); next = G_Find(NULL, FOFS(targetname), self->target);
else if(chain == -1 && self->targetname) // backward chaining else if (chain == -1 && self->targetname) // backward chaining
next = G_Find(NULL, FOFS(target), self->targetname); next = G_Find(NULL, FOFS(target), self->targetname);
// if we couldn't find it, have the monster go back to normal hunting. // if we couldn't find it, have the monster go back to normal hunting.
if(!next) if (!next)
{ {
if(g_showlogic && g_showlogic->value) if (g_showlogic && g_showlogic->value)
gi.dprintf("detaching from hint path %d\n", chain); gi.dprintf("detaching from hint path %d\n", chain);
hintpath_stop(other); hintpath_stop(other);
return; return;
@ -1061,15 +1061,15 @@ void hint_path_touch2 (edict_t *self, edict_t *other, cplane_t *plane, csurface_
// set the last_hint entry to this hint_path, and // set the last_hint entry to this hint_path, and
// send him on his way // send him on his way
other->monsterinfo.last_hint = self; other->monsterinfo.last_hint = self;
if(g_showlogic && g_showlogic->value) if (g_showlogic && g_showlogic->value)
gi.dprintf("moving to next point, %s\n", vtos(next->s.origin)); gi.dprintf("moving to next point, %s\n", vtos(next->s.origin));
hintpath_go(other, next); hintpath_go(other, next);
// have the monster freeze if the hint path we just touched has a wait time // have the monster freeze if the hint path we just touched has a wait time
// on it, for example, when riding a plat. // on it, for example, when riding a plat.
if(self->wait) if (self->wait)
{ {
if(g_showlogic && g_showlogic->value) if (g_showlogic && g_showlogic->value)
gi.dprintf("monster waiting %0.1f\n", self->wait); gi.dprintf("monster waiting %0.1f\n", self->wait);
other->nextthink = level.time + self->wait; other->nextthink = level.time + self->wait;
} }
@ -1133,16 +1133,16 @@ void InitHintPaths (void)
// check all the hint_paths. // check all the hint_paths.
field = FOFS(classname); field = FOFS(classname);
e = G_Find(NULL, field, "hint_path"); e = G_Find(NULL, field, "hint_path");
if(e) if (e)
hint_paths_present = 1; hint_paths_present = 1;
else else
return; return;
memset (hint_path_start, 0, MAX_HINT_CHAINS*sizeof (edict_t *)); memset (hint_path_start, 0, MAX_HINT_CHAINS*sizeof (edict_t *));
num_hint_paths = 0; num_hint_paths = 0;
while(e) while (e)
{ {
if(e->spawnflags & HINT_ENDPOINT) if (e->spawnflags & HINT_ENDPOINT)
{ {
if (e->target) // start point if (e->target) // start point
{ {
@ -1255,11 +1255,11 @@ qboolean face_wall (edict_t *self)
AngleVectors (self->s.angles, forward, NULL, NULL); AngleVectors (self->s.angles, forward, NULL, NULL);
VectorMA(self->s.origin, 64, forward, pt); VectorMA(self->s.origin, 64, forward, pt);
tr = gi.trace(self->s.origin, vec3_origin, vec3_origin, pt, self, MASK_MONSTERSOLID); tr = gi.trace(self->s.origin, vec3_origin, vec3_origin, pt, self, MASK_MONSTERSOLID);
if(tr.fraction < 1 && !tr.allsolid && !tr.startsolid) if (tr.fraction < 1 && !tr.allsolid && !tr.startsolid)
{ {
vectoangles2(tr.plane.normal, ang); vectoangles2(tr.plane.normal, ang);
self->ideal_yaw = ang[YAW] + 180; self->ideal_yaw = ang[YAW] + 180;
if(self->ideal_yaw > 360) if (self->ideal_yaw > 360)
self->ideal_yaw -= 360; self->ideal_yaw -= 360;
M_ChangeYaw(self); M_ChangeYaw(self);
@ -1299,12 +1299,12 @@ edict_t *SpawnBadArea(vec3_t mins, vec3_t maxs, float lifespan, edict_t *owner)
badarea->classname = "bad_area"; badarea->classname = "bad_area";
gi.linkentity (badarea); gi.linkentity (badarea);
if(lifespan) if (lifespan)
{ {
badarea->think = G_FreeEdict; badarea->think = G_FreeEdict;
badarea->nextthink = level.time + lifespan; badarea->nextthink = level.time + lifespan;
} }
if(owner) if (owner)
{ {
badarea->owner = owner; badarea->owner = owner;
} }
@ -1354,7 +1354,7 @@ qboolean MarkTeslaArea(edict_t *self, edict_t *tesla)
edict_t *tail; edict_t *tail;
edict_t *area; edict_t *area;
if(!tesla || !self) if (!tesla || !self)
return false; return false;
area = NULL; area = NULL;
@ -1365,7 +1365,7 @@ qboolean MarkTeslaArea(edict_t *self, edict_t *tesla)
while (e) while (e)
{ {
tail = tail->teamchain; tail = tail->teamchain;
if(!strcmp(e->classname, "bad_area")) if (!strcmp(e->classname, "bad_area"))
{ {
// gi.dprintf("tesla already has a bad area marked\n"); // gi.dprintf("tesla already has a bad area marked\n");
return false; return false;
@ -1374,7 +1374,7 @@ qboolean MarkTeslaArea(edict_t *self, edict_t *tesla)
} }
// see if we can grab the trigger directly // see if we can grab the trigger directly
if(tesla->teamchain && tesla->teamchain->inuse) if (tesla->teamchain && tesla->teamchain->inuse)
{ {
edict_t *trigger; edict_t *trigger;
@ -1385,7 +1385,7 @@ qboolean MarkTeslaArea(edict_t *self, edict_t *tesla)
VectorCopy(trigger->absmin, mins); VectorCopy(trigger->absmin, mins);
VectorCopy(trigger->absmax, maxs); VectorCopy(trigger->absmax, maxs);
if(tesla->air_finished) if (tesla->air_finished)
area = SpawnBadArea (mins, maxs, tesla->air_finished, tesla); area = SpawnBadArea (mins, maxs, tesla->air_finished, tesla);
else else
area = SpawnBadArea (mins, maxs, tesla->nextthink, tesla); area = SpawnBadArea (mins, maxs, tesla->nextthink, tesla);
@ -1401,7 +1401,7 @@ qboolean MarkTeslaArea(edict_t *self, edict_t *tesla)
} }
// if we spawned a bad area, then link it to the tesla // if we spawned a bad area, then link it to the tesla
if(area) if (area)
{ {
// gi.dprintf("bad area marker spawned and linked to tesla\n"); // gi.dprintf("bad area marker spawned and linked to tesla\n");
tail->teamchain = area; tail->teamchain = area;
@ -1724,10 +1724,10 @@ qboolean has_valid_enemy (edict_t *self)
// return false; // return false;
if (self->monsterinfo.aiflags & AI_MEDIC) if (self->monsterinfo.aiflags & AI_MEDIC)
{ {
if(self->enemy->health > 0) if (self->enemy->health > 0)
return false; return false;
} }
else if(self->enemy->health < 1) else if (self->enemy->health < 1)
return false; return false;
return true; return true;
@ -1747,14 +1747,14 @@ void TargetTesla (edict_t *self, edict_t *tesla)
} }
// store the player enemy in case we lose track of him. // store the player enemy in case we lose track of him.
if(self->enemy && self->enemy->client) if (self->enemy && self->enemy->client)
self->monsterinfo.last_player_enemy = self->enemy; self->monsterinfo.last_player_enemy = self->enemy;
if(self->enemy != tesla) if (self->enemy != tesla)
{ {
self->oldenemy = self->enemy; self->oldenemy = self->enemy;
self->enemy = tesla; self->enemy = tesla;
if(self->monsterinfo.attack) if (self->monsterinfo.attack)
{ {
if (self->health <= 0) if (self->health <= 0)
{ {

View file

@ -364,7 +364,7 @@ void SP_func_door_secret2 (edict_t *ent)
} }
if (!ent->wait) if (!ent->wait)
ent->wait = 5; // 5 seconds before closing 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); gi.linkentity(ent);
} }

View file

@ -1134,7 +1134,95 @@ target : Targetname of entity to attach/detach.
pathtarget : Targetname of parent entity to attach to. Not needed to detach. pathtarget : Targetname of parent entity to attach to. Not needed to detach.
count : Number of times it can be used count : Number of times it can be used
*/ */
void movewith_init (edict_t *ent);
#if 0
void movewith_detach (edict_t *child)
{
edict_t *e;
edict_t *parent = NULL;
int i;
for (i=1; i<globals.num_edicts && !parent; i++) {
e = g_edicts + i;
if (e->movewith_next == child) parent=e;
}
if (parent) parent->movewith_next = child->movewith_next;
child->movewith_next = NULL;
child->movewith = NULL;
child->movetype = child->oldmovetype;
// if monster, give 'em a small vertical boost
if (child->svflags & SVF_MONSTER)
child->s.origin[2] += 2;
gi.linkentity(child);
}
void target_movewith_use (edict_t *self, edict_t *other, edict_t *activator)
{
edict_t *target;
if (!self->target)
return;
target = G_Find(NULL,FOFS(targetname),self->target);
if (self->spawnflags & 1)
{
// Detach
while (target)
{
if (target->movewith_ent)
movewith_detach(target);
target = G_Find(target,FOFS(targetname),self->target);
}
}
else
{
// Attach
edict_t *parent;
edict_t *e;
edict_t *previous;
parent = G_Find(NULL, FOFS(targetname), self->pathtarget);
if (!parent || !parent->inuse)
return;
while (target)
{
if (!target->movewith_ent || (target->movewith_ent != parent) )
{
if (target->movewith_ent)
movewith_detach(target);
target->movewith_ent = parent;
VectorCopy (parent->s.angles, target->parent_attach_angles);
VectorCopy (target->s.angles, target->child_attach_angles);
if (target->oldmovetype < 0)
target->oldmovetype = target->movetype;
if (target->movetype != MOVETYPE_NONE)
target->movetype = MOVETYPE_PUSH;
VectorCopy (target->mins, target->org_mins);
VectorCopy (target->maxs, target->org_maxs);
VectorSubtract (target->s.origin, parent->s.origin, target->movewith_offset);
e = parent->movewith_next;
previous = parent;
while (e)
{
previous = e;
e = previous->movewith_next;
}
previous->movewith_next = target;
gi.linkentity(target);
}
target = G_Find(target,FOFS(targetname),self->target);
}
}
self->count--;
if (!self->count) {
self->think = G_FreeEdict;
self->nextthink = level.time + 1;
}
}
#endif
void target_movewith_use (edict_t *self, edict_t *activator, edict_t *other) void target_movewith_use (edict_t *self, edict_t *activator, edict_t *other)
{ {
@ -1176,7 +1264,8 @@ void SP_target_movewith (edict_t *self)
if (!self->target) if (!self->target)
gi.dprintf("target_movewith without a target at %s\n", vtos(self->s.origin)); gi.dprintf("target_movewith without a target at %s\n", vtos(self->s.origin));
if (!self->pathtarget && !(self->spawnflags & 1)) if (!self->pathtarget && !(self->spawnflags & 1))
gi.dprintf("target_movewith without a pathtarget at %s\n", vtos(self->s.origin)); gi.dprintf("target_movewith without a pathtarget at %s\n", vtos(self->s.origin));
self->svflags |= SVF_NOCLIENT; self->svflags |= SVF_NOCLIENT;
self->use = target_movewith_use; self->use = target_movewith_use;
@ -1314,6 +1403,7 @@ void SP_target_change (edict_t *self)
gi.dprintf("target_change without a targetname at %s\n", vtos(self->s.origin)); gi.dprintf("target_change without a targetname at %s\n", vtos(self->s.origin));
if (!self->target) if (!self->target)
gi.dprintf("target_change without a target at %s\n", vtos(self->s.origin)); gi.dprintf("target_change without a target at %s\n", vtos(self->s.origin));
self->svflags |= SVF_NOCLIENT; self->svflags |= SVF_NOCLIENT;
self->use = target_change_use; self->use = target_change_use;
if (st.noise) //David Hyde's code if (st.noise) //David Hyde's code
@ -1745,7 +1835,7 @@ void target_rocks_use (edict_t *self, edict_t *activator, edict_t *other)
VectorSet(source,8,8,8); VectorSet(source,8,8,8);
mass = self->mass; mass = self->mass;
//set movedir here- if we're // set movedir here- if we're
G_SetMovedir2 (self->s.angles, self->movedir); G_SetMovedir2 (self->s.angles, self->movedir);
// if (self->sounds == 1) // if (self->sounds == 1)
// gi.sound (self, CHAN_AUTO, gi.soundindex("zer/wall01.wav"), 1.0, ATTN_NORM, 0); // gi.sound (self, CHAN_AUTO, gi.soundindex("zer/wall01.wav"), 1.0, ATTN_NORM, 0);
@ -1798,12 +1888,17 @@ void SP_target_rocks (edict_t *self)
{ {
self->class_id = ENTITY_TARGET_ROCKS; self->class_id = ENTITY_TARGET_ROCKS;
// precache
gi.modelindex ("models/objects/rock1/tris.md2");
gi.modelindex ("models/objects/rock2/tris.md2");
if (!self->targetname) if (!self->targetname)
gi.dprintf("target_rocks without a targetname at %s\n", vtos(self->s.origin)); gi.dprintf("target_rocks without a targetname at %s\n", vtos(self->s.origin));
if (!self->mass) if (!self->mass)
self->mass = 500; self->mass = 500;
if (!self->speed) if (!self->speed)
self->speed = 400; self->speed = 400;
// G_SetMovedir (self->s.angles, self->movedir); // G_SetMovedir (self->s.angles, self->movedir);
self->svflags |= SVF_NOCLIENT; self->svflags |= SVF_NOCLIENT;
@ -3005,6 +3100,11 @@ void target_animation_use (edict_t *self, edict_t *other, edict_t *activator)
void SP_target_animation (edict_t *self) void SP_target_animation (edict_t *self)
{ {
#if 1
gi.dprintf("Target_animation is currently not implemented.\n");
G_FreeEdict(self);
return;
#else
mmove_t *move; mmove_t *move;
self->class_id = ENTITY_TARGET_ANIMATION; self->class_id = ENTITY_TARGET_ANIMATION;
@ -3053,6 +3153,7 @@ void SP_target_animation (edict_t *self)
self->use = target_animation_use; self->use = target_animation_use;
move = gi.TagMalloc(sizeof(mmove_t), TAG_LEVEL); move = gi.TagMalloc(sizeof(mmove_t), TAG_LEVEL);
self->monsterinfo.currentmove = move; self->monsterinfo.currentmove = move;
#endif
} }
/*=================================================================================== /*===================================================================================
@ -3189,6 +3290,7 @@ void SP_target_failure (edict_t *self)
G_FreeEdict (self); G_FreeEdict (self);
return; return;
} }
self->class_id = ENTITY_TARGET_FAILURE; self->class_id = ENTITY_TARGET_FAILURE;
self->use = use_target_failure; self->use = use_target_failure;

View file

@ -1595,8 +1595,6 @@ Creates a server's entity / program execution context by
parsing textual entity definitions out of an ent file. parsing textual entity definitions out of an ent file.
============== ==============
*/ */
void movewith_init (edict_t *ent);
void SpawnEntities (char *mapname, char *entities, char *spawnpoint) void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
{ {
edict_t *ent; edict_t *ent;
@ -1829,7 +1827,7 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
PlayerTrail_Init (); PlayerTrail_Init ();
//ROGUE // ROGUE
if (deathmatch->value) if (deathmatch->value)
{ {
if (randomrespawn && randomrespawn->value) if (randomrespawn && randomrespawn->value)
@ -1837,9 +1835,9 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
} }
else else
{ {
InitHintPaths(); // if there aren't hintpaths on this map, enable quick aborts InitHintPaths(); // if there aren't hintpaths on this map, enable quick aborts
} }
//ROGUE // ROGUE
// ROGUE -- allow dm games to do init stuff right before game starts. // ROGUE -- allow dm games to do init stuff right before game starts.
if (deathmatch->value && gamerules && gamerules->value) if (deathmatch->value && gamerules && gamerules->value)
@ -1849,7 +1847,51 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
} }
// ROGUE // ROGUE
//Knightmare added // Lazarus movewith init
/* for (i=1, ent=g_edicts+i; i < globals.num_edicts; i++, ent++)
{
if (!ent->movewith)
continue;
if (ent->movewith_ent)
continue;
ent->movewith_ent = G_Find(NULL, FOFS(targetname), ent->movewith);
// Make sure that we can really "movewith" this guy. This check
// allows us to have movewith parent with same targetname as
// other entities
while (ent->movewith_ent &&
(Q_stricmp(ent->movewith_ent->classname, "func_train") &&
Q_stricmp(ent->movewith_ent->classname, "model_train") &&
Q_stricmp(ent->movewith_ent->classname, "func_door") &&
Q_stricmp(ent->movewith_ent->classname, "func_door_rotating") &&
Q_stricmp(ent->movewith_ent->classname, "func_plat") &&
Q_stricmp(ent->movewith_ent->classname, "func_plat2") &&
Q_stricmp(ent->movewith_ent->classname, "func_rotating") &&
Q_stricmp(ent->movewith_ent->classname, "func_button") &&
Q_stricmp(ent->movewith_ent->classname, "func_door_secret") &&
Q_stricmp(ent->movewith_ent->classname, "func_door_secret2") &&
Q_stricmp(ent->movewith_ent->classname, "func_door_swinging") &&
Q_stricmp(ent->movewith_ent->classname, "func_breakaway") &&
Q_stricmp(ent->movewith_ent->classname, "func_trackchange") &&
Q_stricmp(ent->movewith_ent->classname, "func_vehicle") &&
Q_stricmp(ent->movewith_ent->classname, "func_tracktrain") ))
ent->movewith_ent = G_Find (ent->movewith_ent, FOFS(targetname), ent->movewith);
if (ent->movewith_ent)
movewith_init (ent->movewith_ent);
}
*/
/* for(i=1, ent=g_edicts+i; i < globals.num_edicts; i++, ent++)
{
gi.dprintf("%s:%s - movewith=%s, movewith_ent=%s:%s, movewith_next=%s:%s\n====================\n",
ent->classname, (ent->targetname ? ent->targetname : "noname"),
(ent->movewith ? ent->movewith : "N/A"),
(ent->movewith_ent ? ent->movewith_ent->classname : "N/A"),
(ent->movewith_ent ? (ent->movewith_ent->targetname ? ent->movewith_ent->targetname : "noname") : "N/A"),
(ent->movewith_next ? ent->movewith_next->classname : "N/A"),
(ent->movewith_next ? (ent->movewith_next->targetname ? ent->movewith_next->targetname : "noname") : "N/A"));
} */
// Knightmare added
if (game.transition_ents) if (game.transition_ents)
{ {
LoadTransitionEnts(); LoadTransitionEnts();

View file

@ -245,6 +245,7 @@ void SP_target_goal (edict_t *ent)
G_FreeEdict (ent); G_FreeEdict (ent);
return; return;
} }
ent->class_id = ENTITY_TARGET_GOAL; ent->class_id = ENTITY_TARGET_GOAL;
ent->use = use_target_goal; ent->use = use_target_goal;

View file

@ -347,7 +347,7 @@ void SP_func_trackchange (edict_t *self)
gi.setmodel (self, self->model); gi.setmodel (self, self->model);
self->use = trackchange_use; self->use = trackchange_use;
self->postthink = train_move_children; //Knightmare- supports movewith self->postthink = train_move_children; // Knightmare- now supports movewith
// bottom starters: // bottom starters:
if (self->spawnflags & SF_TRACK_STARTBOTTOM) if (self->spawnflags & SF_TRACK_STARTBOTTOM)
@ -1977,7 +1977,7 @@ void SP_func_tracktrain (edict_t *self)
self->turn_rider = 1; self->turn_rider = 1;
VectorClear (self->s.angles); VectorClear (self->s.angles);
self->postthink = train_move_children; // Knightmare- supports movewith self->postthink = train_move_children; // Knightmare- supports movewith
if (self->target) if (self->target)
{ {

View file

@ -22,7 +22,7 @@ void InitTrigger (edict_t *self)
self->svflags = SVF_NOCLIENT; self->svflags = SVF_NOCLIENT;
} }
//Knightmare- same as above, but for bbox triggers // Knightmare- same as above, but for bbox triggers
void InitTriggerBbox (edict_t *self) void InitTriggerBbox (edict_t *self)
{ {
if (!VectorCompare (self->s.angles, vec3_origin)) if (!VectorCompare (self->s.angles, vec3_origin))
@ -212,7 +212,7 @@ sounds
"message" string to be displayed when triggered "message" string to be displayed when triggered
*/ */
void SP_trigger_once(edict_t *ent) void SP_trigger_once (edict_t *ent)
{ {
// make old maps work because I messed up on flag assignments here // make old maps work because I messed up on flag assignments here
// triggered was on bit 1 when it should have been on bit 4 // triggered was on bit 1 when it should have been on bit 4
@ -252,6 +252,8 @@ count - how many times it can be used before being auto-killtargeted
void SP_trigger_bbox (edict_t *self) void SP_trigger_bbox (edict_t *self)
{ {
self->class_id = ENTITY_TRIGGER_BBOX;
if (self->sounds == 1) if (self->sounds == 1)
self->noise_index = gi.soundindex ("misc/secret.wav"); self->noise_index = gi.soundindex ("misc/secret.wav");
else if (self->sounds == 2) else if (self->sounds == 2)
@ -369,11 +371,11 @@ void trigger_key_use (edict_t *self, edict_t *other, edict_t *activator)
if (self->item->flags & IT_Q1) if (self->item->flags & IT_Q1)
{ {
if (index == key_q1_med_gold_index || index == key_q1_med_silver_index) if (index == key_q1_med_gold_index || index == key_q1_med_silver_index)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1world/doors/medtry.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1doors/medtry.wav"), 1, ATTN_NORM, 0);
else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index) else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1world/doors/runetry.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1doors/runetry.wav"), 1, ATTN_NORM, 0);
else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index) else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1world/doors/basetry.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1doors/basetry.wav"), 1, ATTN_NORM, 0);
} }
else else
// end Skid // end Skid
@ -388,11 +390,11 @@ void trigger_key_use (edict_t *self, edict_t *other, edict_t *activator)
if (self->item->flags & IT_Q1) if (self->item->flags & IT_Q1)
{ {
if (index == key_q1_med_gold_index || index == key_q1_med_silver_index) if (index == key_q1_med_gold_index || index == key_q1_med_silver_index)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1world/doors/meduse.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1doors/meduse.wav"), 1, ATTN_NORM, 0);
else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index) else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1world/doors/runeuse.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1doors/runeuse.wav"), 1, ATTN_NORM, 0);
else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index) else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index)
gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1world/doors/baseuse.wav"), 1, ATTN_NORM, 0); gi.sound (activator, CHAN_AUTO, gi.soundindex ("q1doors/baseuse.wav"), 1, ATTN_NORM, 0);
} }
else else
// end Skid // end Skid
@ -493,16 +495,16 @@ void SP_trigger_key (edict_t *self)
if (self->item->flags & IT_Q1) if (self->item->flags & IT_Q1)
{ {
if (index == key_q1_med_gold_index || index == key_q1_med_silver_index) { if (index == key_q1_med_gold_index || index == key_q1_med_silver_index) {
gi.soundindex ("q1world/doors/medtry.wav"); gi.soundindex ("q1doors/medtry.wav");
gi.soundindex ("q1world/doors/meduse.wav"); gi.soundindex ("q1doors/meduse.wav");
} }
else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index) { else if (index == key_q1_rune_gold_index || index == key_q1_rune_silver_index) {
gi.soundindex ("q1world/doors/runetry.wav"); gi.soundindex ("q1doors/runetry.wav");
gi.soundindex ("q1world/doors/runeuse.wav"); gi.soundindex ("q1doors/runeuse.wav");
} }
else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index) { else if (index == key_q1_base_gold_index || index == key_q1_base_silver_index) {
gi.soundindex ("q1world/doors/basetry.wav"); gi.soundindex ("q1doors/basetry.wav");
gi.soundindex ("q1world/doors/baseuse.wav"); gi.soundindex ("q1doors/baseuse.wav");
} }
} }
else { else {
@ -708,7 +710,7 @@ void SP_trigger_push (edict_t *self)
self->solid = SOLID_NOT; self->solid = SOLID_NOT;
} }
else if (self->spawnflags & PUSH_START_OFF) else if (self->spawnflags & PUSH_START_OFF)
{ //Knightmare- they must be using the custom sound spawngflag from Lazarus { // Knightmare- they must be using the custom sound spawngflag from Lazarus
gi.dprintf ("trigger_push is START_OFF but not targeted.\n"); gi.dprintf ("trigger_push is START_OFF but not targeted.\n");
// self->svflags = 0; // self->svflags = 0;
// self->touch = NULL; // self->touch = NULL;
@ -742,6 +744,8 @@ SILENT - Doesn't make wind noise
void SP_trigger_push_bbox (edict_t *self) void SP_trigger_push_bbox (edict_t *self)
{ {
self->class_id = ENTITY_TRIGGER_PUSH;
InitTriggerBbox (self); InitTriggerBbox (self);
if (self->spawnflags & PUSH_CUSTOM_SND) if (self->spawnflags & PUSH_CUSTOM_SND)
@ -803,6 +807,15 @@ NO_PROTECTION *nothing* stops the damage
"dmg" default 5 (whole numbers only) "dmg" default 5 (whole numbers only)
*/ */
#define SF_HURT_START_OFF 1
#define SF_HURT_TOGGLE 2
#define SF_HURT_SILENT 4 // supresses playing the sound
#define SF_HURT_NO_PROTECTION 8 // *nothing* stops the damage
#define SF_HURT_SLOW 16 // changes the damage rate to once per second
#define SF_HURT_NOGIB 32 // Lazarus: won't gib entity
#define SF_HURT_ENVIRONMENT 64 // Lazarus: environment suit protects from damage
void hurt_use (edict_t *self, edict_t *other, edict_t *activator) void hurt_use (edict_t *self, edict_t *other, edict_t *activator)
{ {
if (self->solid == SOLID_NOT) if (self->solid == SOLID_NOT)
@ -811,7 +824,7 @@ void hurt_use (edict_t *self, edict_t *other, edict_t *activator)
self->solid = SOLID_NOT; self->solid = SOLID_NOT;
gi.linkentity (self); gi.linkentity (self);
if (!(self->spawnflags & 2)) if (!(self->spawnflags & SF_HURT_TOGGLE))
self->use = NULL; self->use = NULL;
} }
@ -826,22 +839,55 @@ void hurt_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *sur
if (self->timestamp > level.time) if (self->timestamp > level.time)
return; return;
if (self->spawnflags & 16) if (self->spawnflags & SF_HURT_SLOW)
self->timestamp = level.time + 1; self->timestamp = level.time + 1;
else else
self->timestamp = level.time + FRAMETIME; self->timestamp = level.time + FRAMETIME;
if (!(self->spawnflags & 4)) if ( !(self->spawnflags & SF_HURT_SILENT) )
{ {
if ((level.framenum % 10) == 0) // DWH - Original code would fail to play a sound for
// SF=16 unless player just HAPPENED to hit
// trigger_hurt at framenum = an integral number of
// full seconds.
// if ((level.framenum % 10) == 0)
if ( ((level.framenum % 10) == 0 ) || (self->spawnflags & SF_HURT_SLOW) )
gi.sound (other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0); gi.sound (other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0);
} }
if (self->spawnflags & 8) if (self->spawnflags & SF_HURT_NO_PROTECTION)
dflags = DAMAGE_NO_PROTECTION; dflags = DAMAGE_NO_PROTECTION;
else else
dflags = 0; dflags = 0;
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, self->dmg, dflags, MOD_TRIGGER_HURT); // T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, self->dmg, dflags, MOD_TRIGGER_HURT);
// Lazarus: healing, no gib, and environment suit protection
if (self->dmg > 0)
{
int damage = self->dmg;
if (self->spawnflags & SF_HURT_NOGIB)
{
if (skill->value > 0)
damage = min(damage, other->health - other->gib_health - 1);
else
damage = min(damage, 2*(other->health - other->gib_health - 1));
if (damage < 0)
damage = 0;
}
if (other->client && (self->spawnflags & SF_HURT_ENVIRONMENT) && (other->client->enviro_framenum > level.framenum))
damage = 0;
if (damage > 0)
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, damage, self->dmg, dflags, MOD_TRIGGER_HURT);
}
else
{
other->health -= self->dmg;
if (other->health > other->max_health)
other->health = other->max_health;
}
} }
void SP_trigger_hurt (edict_t *self) void SP_trigger_hurt (edict_t *self)
@ -850,24 +896,30 @@ void SP_trigger_hurt (edict_t *self)
InitTrigger (self); InitTrigger (self);
self->noise_index = gi.soundindex ("world/electro.wav"); // self->noise_index = gi.soundindex ("world/electro.wav");
self->touch = hurt_touch; self->touch = hurt_touch;
if (!self->dmg) if (!self->dmg)
self->dmg = 5; self->dmg = 5;
if (self->spawnflags & 1) // DWH - play different sound for healing
if (self->dmg > 0)
self->noise_index = gi.soundindex ("world/electro.wav");
else
self->noise_index = gi.soundindex ("items/s_health.wav");
if (self->spawnflags & SF_HURT_START_OFF)
self->solid = SOLID_NOT; self->solid = SOLID_NOT;
else else
self->solid = SOLID_TRIGGER; self->solid = SOLID_TRIGGER;
if (self->spawnflags & 2) if (self->spawnflags & SF_HURT_TOGGLE)
self->use = hurt_use; self->use = hurt_use;
gi.linkentity (self); gi.linkentity (self);
} }
//Knightmare // Knightmare
/*QUAKED trigger_hurt_bbox (.5 .5 .5) (-8 -8 -8) (8 8 8) START_OFF TOGGLE SILENT NO_PROTECTION SLOW /*QUAKED trigger_hurt_bbox (.5 .5 .5) (-8 -8 -8) (8 8 8) START_OFF TOGGLE SILENT NO_PROTECTION SLOW
Any entity that touches this will be hurt. Any entity that touches this will be hurt.
Same as trigger_hurt, except it doesn't use a model. Same as trigger_hurt, except it doesn't use a model.
@ -886,22 +938,28 @@ tright Max b-box coords XYZ. Default = 16 16 16
void SP_trigger_hurt_bbox (edict_t *self) void SP_trigger_hurt_bbox (edict_t *self)
{ {
InitTriggerBbox (self);
self->class_id = ENTITY_TRIGGER_HURT; self->class_id = ENTITY_TRIGGER_HURT;
self->noise_index = gi.soundindex ("world/electro.wav"); InitTriggerBbox (self);
// self->noise_index = gi.soundindex ("world/electro.wav");
self->touch = hurt_touch; self->touch = hurt_touch;
if (!self->dmg) if (!self->dmg)
self->dmg = 5; self->dmg = 5;
if (self->spawnflags & 1) // DWH - play different sound for healing
if (self->dmg > 0)
self->noise_index = gi.soundindex ("world/electro.wav");
else
self->noise_index = gi.soundindex ("items/s_health.wav");
if (self->spawnflags & SF_HURT_START_OFF)
self->solid = SOLID_NOT; self->solid = SOLID_NOT;
else else
self->solid = SOLID_TRIGGER; self->solid = SOLID_TRIGGER;
if (self->spawnflags & 2) if (self->spawnflags & SF_HURT_TOGGLE)
self->use = hurt_use; self->use = hurt_use;
gi.linkentity (self); gi.linkentity (self);
@ -985,7 +1043,7 @@ void SP_trigger_gravity_bbox (edict_t *self)
{ {
if (st.gravity == 0) if (st.gravity == 0)
{ {
gi.dprintf("trigger_gravity without gravity set at %s\n", vtos(self->s.origin)); gi.dprintf("trigger_gravity_bbox without gravity set at %s\n", vtos(self->s.origin));
G_FreeEdict (self); G_FreeEdict (self);
return; return;
} }
@ -1068,6 +1126,17 @@ void SP_trigger_monsterjump (edict_t *self)
self->movedir[2] = st.height; self->movedir[2] = st.height;
} }
/*QUAKED trigger_monsterjump_bbox (.5 .5 .5) (-8 -8 -8) (8 8 8)
Walking monsters that touch this will jump in the direction of the trigger's angle.
Same as trigger_monsterjump, except that it doesn't use a model.
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
bleft Min b-box coords XYZ. Default = -16 -16 -16
tright Max b-box coords XYZ. Default = 16 16 16
*/
void SP_trigger_monsterjump_bbox (edict_t *self) void SP_trigger_monsterjump_bbox (edict_t *self)
{ {
self->class_id = ENTITY_TRIGGER_MONSTERJUMP; self->class_id = ENTITY_TRIGGER_MONSTERJUMP;
@ -1086,16 +1155,7 @@ void SP_trigger_monsterjump_bbox (edict_t *self)
self->movedir[2] = st.height; self->movedir[2] = st.height;
} }
/*QUAKED trigger_monsterjump_bbox (.5 .5 .5) (-8 -8 -8) (8 8 8)
Walking monsters that touch this will jump in the direction of the trigger's angle.
Same as trigger_monsterjump, except that it doesn't use a model.
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
bleft Min b-box coords XYZ. Default = -16 -16 -16
tright Max b-box coords XYZ. Default = 16 16 16
*/
//========================================================================================= //=========================================================================================
// TRIGGER_MASS - triggers its targets when touched by any entity with mass >= mass value // TRIGGER_MASS - triggers its targets when touched by any entity with mass >= mass value
@ -1146,7 +1206,7 @@ void SP_trigger_mass (edict_t *self)
gi.linkentity (self); gi.linkentity (self);
} }
//Knightmare // Knightmare added
/*QUAKED trigger_mass_bbox (.5 .5 .5) (-8 -8 -8) (8 8 8) x x TRIGGERED /*QUAKED trigger_mass_bbox (.5 .5 .5) (-8 -8 -8) (8 8 8) x x TRIGGERED
A "weight limit" trigger that fires at its targets when the mass of the activator is equal to or greater than the mass value for the trigger. A "weight limit" trigger that fires at its targets when the mass of the activator is equal to or greater than the mass value for the trigger.
Same as trigger_mass, except that it doesn't use a model. Same as trigger_mass, except that it doesn't use a model.

View file

@ -472,7 +472,7 @@ void SP_func_vehicle (edict_t *self)
gi.linkentity (self); gi.linkentity (self);
VectorCopy(self->size,self->org_size); VectorCopy(self->size,self->org_size);
self->postthink = train_move_children; //Knightmare- supports movewith self->postthink = train_move_children; // Knightmare- supports movewith
if (self->ideal_yaw != 0) if (self->ideal_yaw != 0)
self->prethink = turn_vehicle; self->prethink = turn_vehicle;

View file

@ -55,14 +55,14 @@ void q1_nail_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
if (sound < 0.3) if (sound < 0.3)
{ {
if (sound < 0.1) if (sound < 0.1)
gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weap/nails/ric3.wav"), 1, ATTN_STATIC, 0); gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weapons/ric3.wav"), 1, ATTN_STATIC, 0);
else if (sound < 0.2) else if (sound < 0.2)
gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weap/nails/ric2.wav"), 1, ATTN_STATIC, 0); gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weapons/ric2.wav"), 1, ATTN_STATIC, 0);
else else
gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weap/nails/ric1.wav"), 1, ATTN_STATIC, 0); gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weapons/ric1.wav"), 1, ATTN_STATIC, 0);
} }
else if (sound < 0.5) else if (sound < 0.5)
gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weap/nails/tink1.wav"), 1, ATTN_STATIC, 0); gi.sound (self, CHAN_WEAPON, gi.soundindex ("q1weapons/tink1.wav"), 1, ATTN_STATIC, 0);
} }
} }
@ -367,7 +367,7 @@ void q1_grenade_explode (edict_t *ent)
T_RadiusDamage(ent, ent->owner, ent->dmg, ent->enemy, ent->dmg_radius, MOD_Q1_GL_SPLASH); T_RadiusDamage(ent, ent->owner, ent->dmg, ent->enemy, ent->dmg_radius, MOD_Q1_GL_SPLASH);
VectorMA (ent->s.origin, -0.02, ent->velocity, origin); VectorMA (ent->s.origin, -0.02, ent->velocity, origin);
gi.sound (ent, CHAN_AUTO, gi.soundindex ("q1weap/rocket/r_exp3.wav"), 1.0, ATTN_NORM, 0); gi.sound (ent, CHAN_AUTO, gi.soundindex ("q1weapons/r_exp3.wav"), 1.0, ATTN_NORM, 0);
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_ROCKET_EXPLOSION); gi.WriteByte (TE_ROCKET_EXPLOSION);
@ -405,7 +405,7 @@ void q1_grenade_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t
if (!other->takedamage || if (!other->takedamage ||
(other->solid == SOLID_BSP)) (other->solid == SOLID_BSP))
{ {
gi.sound (ent, CHAN_RELIABLE|CHAN_WEAPON, gi.soundindex ("q1weap/grenades/bounce.wav"), 1, ATTN_NORM, 0); gi.sound (ent, CHAN_RELIABLE|CHAN_WEAPON, gi.soundindex ("q1weapons/bounce.wav"), 1, ATTN_NORM, 0);
return; return;
} }
@ -481,7 +481,7 @@ void q1_rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t
T_Damage (other, ent, ent->owner, ent->velocity, ent->s.origin, plane->normal, ent->dmg, 0, 0, MOD_Q1_RL); T_Damage (other, ent, ent->owner, ent->velocity, ent->s.origin, plane->normal, ent->dmg, 0, 0, MOD_Q1_RL);
} }
T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_Q1_RL_SPLASH); T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_Q1_RL_SPLASH);
gi.sound (ent,CHAN_AUTO , gi.soundindex ("q1weap/rocket/r_exp3.wav"), 1.0, ATTN_NORM, 0); gi.sound (ent,CHAN_AUTO , gi.soundindex ("q1weapons/r_exp3.wav"), 1.0, ATTN_NORM, 0);
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_ROCKET_EXPLOSION); gi.WriteByte (TE_ROCKET_EXPLOSION);
@ -656,7 +656,7 @@ void q1_firepod_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_
T_Damage (other, self, self->owner, vec3_origin, other->s.origin, vec3_origin, 200, 0, 0, 0); T_Damage (other, self, self->owner, vec3_origin, other->s.origin, vec3_origin, 200, 0, 0, 0);
T_RadiusDamage (self, self->owner, 40, NULL, 40, MOD_Q1_FIREPOD); T_RadiusDamage (self, self->owner, 40, NULL, 40, MOD_Q1_FIREPOD);
gi.sound (self,CHAN_AUTO , gi.soundindex ("q1weap/rocket/r_exp3.wav"), 1.0, ATTN_NORM, 0); gi.sound (self,CHAN_AUTO , gi.soundindex ("q1weapons/r_exp3.wav"), 1.0, ATTN_NORM, 0);
VectorMA (self->s.origin, -0.02, self->velocity, origin); VectorMA (self->s.origin, -0.02, self->velocity, origin);
@ -801,7 +801,7 @@ Fires a lavaball. Used by Chthon.
} }
T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_Q1_RL_SPLASH); T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_Q1_RL_SPLASH);
gi.sound (ent, CHAN_WEAPON, gi.soundindex ("q1weap/rocket/r_exp3.wav"), 1.0, ATTN_NORM, 0); gi.sound (ent, CHAN_WEAPON, gi.soundindex ("q1weapons/r_exp3.wav"), 1.0, ATTN_NORM, 0);
// //
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
@ -923,18 +923,18 @@ void q1_fire_acidspit (edict_t *self, vec3_t start, vec3_t dir, int damage, int
acidbolt->movetype = MOVETYPE_FLYMISSILE; acidbolt->movetype = MOVETYPE_FLYMISSILE;
acidbolt->clipmask = MASK_SHOT; acidbolt->clipmask = MASK_SHOT;
acidbolt->solid = SOLID_BBOX; acidbolt->solid = SOLID_BBOX;
acidbolt->s.effects |= EF_GREENGIB; //EF_HYPERBLASTER EF_BFG EF_GREENTRAIL acidbolt->s.effects |= EF_GREENGIB; // EF_HYPERBLASTER EF_BFG EF_GREENTRAIL
acidbolt->s.renderfx |= RF_TRANSLUCENT;//FULLBRIGHT; acidbolt->s.renderfx |= RF_TRANSLUCENT; // FULLBRIGHT
VectorClear (acidbolt->mins); VectorClear (acidbolt->mins);
VectorClear (acidbolt->maxs); VectorClear (acidbolt->maxs);
acidbolt->s.modelindex = gi.modelindex ("models/monsters/q1scrag/bolt/tris.md2"); acidbolt->s.modelindex = gi.modelindex ("models/monsters/q1scrag/w_spike/tris.md2");
acidbolt->owner = self; acidbolt->owner = self;
acidbolt->touch = q1_acidbolt_touch; acidbolt->touch = q1_acidbolt_touch;
acidbolt->nextthink = level.time + 8000/speed; acidbolt->nextthink = level.time + 8000/speed;
acidbolt->think = G_FreeEdict; acidbolt->think = G_FreeEdict;
acidbolt->dmg = damage; acidbolt->dmg = damage;
//acidbolt->s.sound = gi.soundindex ("weapons/rockfly.wav"); // acidbolt->s.sound = gi.soundindex ("weapons/rockfly.wav");
acidbolt->classname = "acidbolt"; acidbolt->classname = "acidbolt";
acidbolt->common_name = "Acid Bolt"; acidbolt->common_name = "Acid Bolt";

View file

@ -1374,6 +1374,7 @@ void SP_misc_actor (edict_t *self)
return; return;
} }
self->class_id = ENTITY_MISC_ACTOR;
self->movetype = MOVETYPE_STEP; self->movetype = MOVETYPE_STEP;
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;
@ -1845,6 +1846,7 @@ void SP_target_actor (edict_t *self)
G_FreeEdict(self); G_FreeEdict(self);
return; return;
} }
self->class_id = ENTITY_TARGET_ACTOR;
if (!self->targetname) if (!self->targetname)
gi.dprintf ("%s with no targetname at %s\n", self->classname, vtos(self->s.origin)); gi.dprintf ("%s with no targetname at %s\n", self->classname, vtos(self->s.origin));

View file

@ -591,6 +591,7 @@ void SP_monster_berserk (edict_t *self)
self->common_name = "Berserker"; self->common_name = "Berserker";
self->class_id = ENTITY_MONSTER_BERSERK; self->class_id = ENTITY_MONSTER_BERSERK;
self->spawnflags |= SF_MONSTER_KNOWS_MIRRORS;
gi.linkentity (self); gi.linkentity (self);

View file

@ -746,7 +746,7 @@ void SP_monster_brain (edict_t *self)
self->class_id = ENTITY_MONSTER_BRAIN; self->class_id = ENTITY_MONSTER_BRAIN;
if (!self->blood_type) if (!self->blood_type)
self->blood_type = 3; //sparks and blood self->blood_type = 3; // sparks and blood
gi.linkentity (self); gi.linkentity (self);

View file

@ -39,7 +39,7 @@ static int sound_search;
void ChickMoan (edict_t *self) void ChickMoan (edict_t *self)
{ {
if(!(self->spawnflags & SF_MONSTER_AMBUSH)) if (!(self->spawnflags & SF_MONSTER_AMBUSH))
{ {
if (random() < 0.5) if (random() < 0.5)
gi.sound (self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); gi.sound (self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0);
@ -310,7 +310,7 @@ void chick_dead (edict_t *self)
M_FlyCheck (self); M_FlyCheck (self);
// Lazarus monster fade // Lazarus monster fade
if(world->effects & FX_WORLDSPAWN_CORPSEFADE) if (world->effects & FX_WORLDSPAWN_CORPSEFADE)
{ {
self->think=FadeDieSink; self->think=FadeDieSink;
self->nextthink=level.time+corpse_fadetime->value; self->nextthink=level.time+corpse_fadetime->value;
@ -542,7 +542,7 @@ void ChickRocket (edict_t *self)
else else
blindfire = false; blindfire = false;
if(!self->enemy || !self->enemy->inuse) //PGM if (!self->enemy || !self->enemy->inuse) //PGM
return; //PGM return; //PGM
AngleVectors (self->s.angles, forward, right, NULL); AngleVectors (self->s.angles, forward, right, NULL);
@ -568,7 +568,7 @@ void ChickRocket (edict_t *self)
} }
// pmm // pmm
// don't shoot at feet if they're above where i'm shooting from. // don't shoot at feet if they're above where i'm shooting from.
else if(random() < 0.33 || (start[2] < self->enemy->absmin[2])) else if (random() < 0.33 || (start[2] < self->enemy->absmin[2]))
{ {
// gi.dprintf("normal shot\n"); // gi.dprintf("normal shot\n");
VectorCopy (target, vec); VectorCopy (target, vec);
@ -886,10 +886,10 @@ void chick_sight(edict_t *self, edict_t *other)
//PGM //PGM
qboolean chick_blocked (edict_t *self, float dist) qboolean chick_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; return true;
if(blocked_checkplat (self, dist)) if (blocked_checkplat (self, dist))
return true; return true;
return false; return false;
@ -985,11 +985,11 @@ void SP_monster_chick (edict_t *self)
VectorSet (self->mins, -16, -16, 0); VectorSet (self->mins, -16, -16, 0);
VectorSet (self->maxs, 16, 16, 56); VectorSet (self->maxs, 16, 16, 56);
if(!self->health) if (!self->health)
self->health = 175; self->health = 175;
if(!self->gib_health) if (!self->gib_health)
self->gib_health = -150; self->gib_health = -150;
if(!self->mass) if (!self->mass)
self->mass = 200; self->mass = 200;
self->pain = chick_pain; self->pain = chick_pain;
@ -1016,7 +1016,7 @@ void SP_monster_chick (edict_t *self)
self->monsterinfo.scale = MODEL_SCALE; self->monsterinfo.scale = MODEL_SCALE;
// Lazarus // Lazarus
if(self->powerarmor) if (self->powerarmor)
{ {
if (self->powerarmortype == 1) if (self->powerarmortype == 1)
self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN;
@ -1024,9 +1024,9 @@ void SP_monster_chick (edict_t *self)
self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;
self->monsterinfo.power_armor_power = self->powerarmor; self->monsterinfo.power_armor_power = self->powerarmor;
} }
if(!self->monsterinfo.flies && self->spawnflags & SF_MONSTER_SPECIAL) if (!self->monsterinfo.flies && self->spawnflags & SF_MONSTER_SPECIAL)
self->monsterinfo.flies = 0.35; self->monsterinfo.flies = 0.35;
else if(!self->monsterinfo.flies) else if (!self->monsterinfo.flies)
self->monsterinfo.flies = 0.40; self->monsterinfo.flies = 0.40;
self->common_name = "Iron Maiden"; self->common_name = "Iron Maiden";

View file

@ -22,7 +22,7 @@ static int sound_sight;
void flipper_stand (edict_t *self); void flipper_stand (edict_t *self);
//Knightmare added- these sounds were unused // Knightmare added- these sounds were unused
void flipper_breathe (edict_t *self) void flipper_breathe (edict_t *self)
{ {
if (self->waterlevel > 0) //only make bubble sounds if submerged if (self->waterlevel > 0) //only make bubble sounds if submerged
@ -429,6 +429,7 @@ void SP_monster_flipper (edict_t *self)
} }
self->common_name = "Barracuda Shark"; self->common_name = "Barracuda Shark";
self->class_id = ENTITY_MONSTER_FLIPPER; self->class_id = ENTITY_MONSTER_FLIPPER;
self->spawnflags |= SF_MONSTER_KNOWS_MIRRORS;
gi.linkentity (self); gi.linkentity (self);

View file

@ -25,7 +25,7 @@ void floater_sight (edict_t *self, edict_t *other)
void floater_idle (edict_t *self) void floater_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); gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
} }
@ -46,7 +46,7 @@ void floater_fire_blaster (edict_t *self)
vec3_t dir; vec3_t dir;
int effect; int effect;
if(!self->enemy || !self->enemy->inuse) //PGM if (!self->enemy || !self->enemy->inuse) //PGM
return; //PGM return; //PGM
if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107)) if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107))
@ -60,7 +60,7 @@ void floater_fire_blaster (edict_t *self)
end[2] += self->enemy->viewheight; end[2] += self->enemy->viewheight;
// Lazarus fog reduction of accuracy // 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[0] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility);
end[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility); end[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility);
@ -658,7 +658,7 @@ void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int dama
//PGM //PGM
qboolean floater_blocked (edict_t *self, float dist) qboolean floater_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; return true;
return false; return false;
@ -703,11 +703,11 @@ void SP_monster_floater (edict_t *self)
VectorSet (self->mins, -24, -24, -16); VectorSet (self->mins, -24, -24, -16);
VectorSet (self->maxs, 24, 24, 40); VectorSet (self->maxs, 24, 24, 40);
if(!self->health) if (!self->health)
self->health = 200; self->health = 200;
if(!self->gib_health) if (!self->gib_health)
self->gib_health = -80; self->gib_health = -80;
if(!self->mass) if (!self->mass)
self->mass = 300; self->mass = 300;
self->pain = floater_pain; self->pain = floater_pain;
@ -730,7 +730,7 @@ void SP_monster_floater (edict_t *self)
self->fogclip |= 2; //custom bloodtype flag self->fogclip |= 2; //custom bloodtype flag
// Lazarus // Lazarus
if(self->powerarmor) if (self->powerarmor)
{ {
if (self->powerarmortype == 1) if (self->powerarmortype == 1)
self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN; self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN;

View file

@ -676,6 +676,7 @@ void SP_misc_insane (edict_t *self)
self->monsterinfo.flies = 0.30; self->monsterinfo.flies = 0.30;
self->common_name = "Insane Marine"; self->common_name = "Insane Marine";
self->class_id = ENTITY_MISC_INSANE;
self->monsterinfo.scale = MODEL_SCALE; self->monsterinfo.scale = MODEL_SCALE;

View file

@ -755,6 +755,7 @@ void SP_monster_mutant (edict_t *self)
} }
self->common_name = "Mutant"; self->common_name = "Mutant";
self->class_id = ENTITY_MONSTER_MUTANT; self->class_id = ENTITY_MONSTER_MUTANT;
self->spawnflags |= SF_MONSTER_KNOWS_MIRRORS;
gi.linkentity (self); gi.linkentity (self);

View file

@ -397,7 +397,7 @@ void q1dog_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC);
for (n= 0; n < 2; n++) for (n= 0; n < 2; n++)

View file

@ -192,9 +192,13 @@ void q1enforcer_dead (edict_t *self)
void q1enforcer_throw_backpack (edict_t *self) void q1enforcer_throw_backpack (edict_t *self)
{ {
/* edict_t *backpack; edict_t *backpack;
backpack = Drop_Item(self, FindItemByClassname("item_q1_backpack")); if (self->health <= self->gib_health)
return;
backpack = Drop_Q1Backpack (self, FindItemByClassname("ammo_cells"), 5);
/* backpack = Drop_Item(self, FindItemByClassname("item_q1_backpack"));
backpack->item = FindItemByClassname("ammo_cells"); backpack->item = FindItemByClassname("ammo_cells");
backpack->count = 5; backpack->count = 5;
backpack->touch = Touch_Item; backpack->touch = Touch_Item;
@ -249,7 +253,7 @@ void q1enforcer_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int d
// check for gib // check for gib
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
for (n= 0; n < 2; n++) for (n= 0; n < 2; n++)
ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC);
@ -350,6 +354,10 @@ void SP_monster_q1_enforcer (edict_t *self)
sound_sight4 = gi.soundindex ("q1enforcer/sight4.wav"); sound_sight4 = gi.soundindex ("q1enforcer/sight4.wav");
sound_fire = gi.soundindex ("q1enforcer/enfire.wav"); sound_fire = gi.soundindex ("q1enforcer/enfire.wav");
// precache backpack
gi.modelindex ("models/items/q1backpack/tris.md2");
// gi.soundindex ("q1weapons/lock4.wav");
self->movetype = MOVETYPE_STEP; self->movetype = MOVETYPE_STEP;
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;

View file

@ -413,7 +413,7 @@ void fiend_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
for (n= 0; n < 2; n++) for (n= 0; n < 2; n++)
ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC);

View file

@ -298,12 +298,13 @@ void q1grunt_sight(edict_t *self, edict_t *other)
// //
void q1grunt_dropshells (edict_t *self) void q1grunt_dropshells (edict_t *self)
{ {
/* edict_t *backpack; edict_t *backpack;
if (self->health <= self->gib_health) if (self->health <= self->gib_health)
return; return;
backpack = Drop_Item(self, FindItemByClassname("item_q1_backpack")); backpack = Drop_Q1Backpack (self, FindItemByClassname("ammo_shells"), 5);
/* backpack = Drop_Item(self, FindItemByClassname("item_q1_backpack"));
backpack->item = FindItemByClassname("ammo_shells"); backpack->item = FindItemByClassname("ammo_shells");
backpack->count = 5; backpack->count = 5;
backpack->touch = Touch_Item; backpack->touch = Touch_Item;
@ -360,7 +361,7 @@ void q1grunt_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int dama
// check for gib // check for gib
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
// if dead body, don't drop pack when gibbed // if dead body, don't drop pack when gibbed
// if (self->deadflag != DEAD_DEAD) // if (self->deadflag != DEAD_DEAD)
@ -412,6 +413,10 @@ void SP_monster_q1_grunt (edict_t *self)
sound_death = gi.soundindex ("q1grunt/death1.wav"); sound_death = gi.soundindex ("q1grunt/death1.wav");
sound_attack = gi.soundindex ("q1grunt/sattck1.wav"); sound_attack = gi.soundindex ("q1grunt/sattck1.wav");
// precache backpack
gi.modelindex ("models/items/q1backpack/tris.md2");
// gi.soundindex ("q1weapons/lock4.wav");
self->movetype = MOVETYPE_STEP; self->movetype = MOVETYPE_STEP;
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;

View file

@ -363,7 +363,7 @@ void hknight_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int dama
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
for (n= 0; n < 2; n++) for (n= 0; n < 2; n++)
ThrowGib (self, "models/objects/q1gibs/q1gib3/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib3/tris.md2", damage, GIB_ORGANIC);

View file

@ -368,7 +368,7 @@ void knight_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
for (n= 0; n < 2; n++) for (n= 0; n < 2; n++)
ThrowGib (self, "models/objects/q1gibs/q1gib3/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib3/tris.md2", damage, GIB_ORGANIC);

View file

@ -242,14 +242,15 @@ void ogre_pain (edict_t *self, edict_t *other, float kick, int damage)
void ogre_droprockets (edict_t *self) void ogre_droprockets (edict_t *self)
{ {
/* edict_t *backpack; edict_t *backpack;
if (self->health <= self->gib_health) if (self->health <= self->gib_health)
return; return;
backpack = Drop_Item(self, FindItemByClassname("item_q1_backpack")); backpack = Drop_Q1Backpack (self, FindItemByClassname("ammo_grenades"), 2);
// backpack->item = FindItemByClassname("ammo_grenades"); /* backpack = Drop_Item(self, FindItemByClassname("item_q1_backpack"));
backpack->item = FindItemByClassname("ammo_rockets"); backpack->item = FindItemByClassname("ammo_grenades");
// backpack->item = FindItemByClassname("ammo_rockets");
backpack->count = 2; backpack->count = 2;
backpack->touch = Touch_Item; backpack->touch = Touch_Item;
backpack->nextthink = level.time + 1800; backpack->nextthink = level.time + 1800;
@ -314,7 +315,7 @@ void ogre_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage,
// check for gib // check for gib
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
// if dead body, don't drop pack when gibbed // if dead body, don't drop pack when gibbed
// if (self->deadflag != DEAD_DEAD) // if (self->deadflag != DEAD_DEAD)
@ -374,7 +375,7 @@ void ogre_grenade_fire(edict_t *self)
gi.WriteByte (MZ_MACHINEGUN | 128); gi.WriteByte (MZ_MACHINEGUN | 128);
gi.multicast (self->s.origin, MULTICAST_PVS); gi.multicast (self->s.origin, MULTICAST_PVS);
gi.sound (self, CHAN_WEAPON|CHAN_RELIABLE, gi.soundindex("q1weap/grenades/grenade.wav"), 1.0, ATTN_NORM, 0); gi.sound (self, CHAN_WEAPON|CHAN_RELIABLE, gi.soundindex("q1weapons/grenade.wav"), 1.0, ATTN_NORM, 0);
q1_fire_grenade (self, start,aim,40 , 600, 2.5, 80); q1_fire_grenade (self, start,aim,40 , 600, 2.5, 80);
} }
@ -520,13 +521,17 @@ void SP_monster_q1_ogre (edict_t *self)
return; return;
} }
sound_pain = gi.soundindex ("q1ogre/ogpain1.wav"); sound_pain = gi.soundindex ("q1ogre/ogpain1.wav");
sound_death= gi.soundindex ("q1ogre/ogdth.wav"); sound_death = gi.soundindex ("q1ogre/ogdth.wav");
sound_idle = gi.soundindex ("q1ogre/ogidle.wav"); sound_idle = gi.soundindex ("q1ogre/ogidle.wav");
sound_idle2= gi.soundindex ("q1ogre/ogidle2.wav"); sound_idle2 = gi.soundindex ("q1ogre/ogidle2.wav");
sound_wake = gi.soundindex ("q1ogre/ogwake.wav"); sound_wake = gi.soundindex ("q1ogre/ogwake.wav");
sound_saw = gi.soundindex ("q1ogre/ogsawatk.wav"); sound_saw = gi.soundindex ("q1ogre/ogsawatk.wav");
sound_drag = gi.soundindex ("q1ogre/ogdrag.wav"); sound_drag = gi.soundindex ("q1ogre/ogdrag.wav");
// precache backpack
gi.modelindex ("models/items/q1backpack/tris.md2");
// gi.soundindex ("q1weapons/lock4.wav");
self->movetype = MOVETYPE_STEP; self->movetype = MOVETYPE_STEP;
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;

View file

@ -27,9 +27,9 @@ void scrag_sight (edict_t *self, edict_t *other)
gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
} }
void scrag_attack_sound(edict_t *self) void scrag_attack_sound (edict_t *self)
{ {
gi.sound (self, CHAN_VOICE, sound_attack, 1, ATTN_NORM, 0); //WAS ATTN_IDLE gi.sound (self, CHAN_VOICE, sound_attack, 1, ATTN_NORM, 0); // WAS ATTN_IDLE
} }
void scrag_idle (edict_t *self) void scrag_idle (edict_t *self)
@ -154,12 +154,12 @@ void scrag_pain (edict_t *self, edict_t *other, float kick, int damage)
if (skill->value == 3) if (skill->value == 3)
return; // no pain anims in nightmare return; // no pain anims in nightmare
if(self->health > 0) if (self->health > 0)
gi.sound (self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0);
self->monsterinfo.currentmove = &scrag_move_pain; self->monsterinfo.currentmove = &scrag_move_pain;
} }
void scrag_dead(edict_t * self) void scrag_dead (edict_t * self)
{ {
VectorSet (self->mins, -16, -16, -24); VectorSet (self->mins, -16, -16, -24);
VectorSet (self->maxs, 16, 16, -8); VectorSet (self->maxs, 16, 16, -8);
@ -190,14 +190,14 @@ mframe_t scrag_frames_die [] =
mmove_t scrag_move_die = {FRAME_death1, FRAME_death8, scrag_frames_die, scrag_dead}; mmove_t scrag_move_die = {FRAME_death1, FRAME_death8, scrag_frames_die, scrag_dead};
void scrag_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) void scrag_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{ {
int n; int n;
// check for gib // check for gib
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
for (n= 0; n < 3; n++) for (n= 0; n < 3; n++)
ThrowGib (self, "models/objects/q1gibs/q1gib2/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib2/tris.md2", damage, GIB_ORGANIC);
@ -223,16 +223,16 @@ void scrag_fire (edict_t *self)
vec3_t forward, right, start; vec3_t forward, right, start;
vec3_t end, dir; vec3_t end, dir;
if(!self->enemy) if (!self->enemy)
return; return;
// gi.sound (self, CHAN_VOICE, sound_attack, 1, ATTN_NORM, 0); // gi.sound (self, CHAN_VOICE, sound_attack, 1, ATTN_NORM, 0);
//fire 1 // fire 1
AngleVectors (self->s.angles, forward, right, NULL); AngleVectors (self->s.angles, forward, right, NULL);
G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLYER_BLASTER_1], forward, right, start); G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLYER_BLASTER_1], forward, right, start);
start[2] += 48; //was 32 start[2] += 48; // was 32
VectorCopy (self->enemy->s.origin, end); VectorCopy (self->enemy->s.origin, end);
end[2] += self->enemy->viewheight; end[2] += self->enemy->viewheight;
@ -244,13 +244,13 @@ void scrag_fire (edict_t *self)
gi.WriteByte (MZ2_FLYER_BLASTER_1); gi.WriteByte (MZ2_FLYER_BLASTER_1);
gi.multicast (start, MULTICAST_PVS); gi.multicast (start, MULTICAST_PVS);
*/ */
q1_fire_acidspit(self,start, dir, 9, 500); q1_fire_acidspit (self, start, dir, 9, 500);
// fire 2 // fire 2
/* AngleVectors (self->s.angles, forward, right, NULL); /* AngleVectors (self->s.angles, forward, right, NULL);
G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLYER_BLASTER_2], forward, right, start); G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLYER_BLASTER_2], forward, right, start);
start[2]+=32; start[2] += 32;
VectorCopy (self->enemy->s.origin, end); VectorCopy (self->enemy->s.origin, end);
end[2] += self->enemy->viewheight; end[2] += self->enemy->viewheight;
@ -263,7 +263,7 @@ void scrag_fire (edict_t *self)
gi.WriteByte (MZ2_FLYER_BLASTER_2); gi.WriteByte (MZ2_FLYER_BLASTER_2);
gi.multicast (start, MULTICAST_PVS); gi.multicast (start, MULTICAST_PVS);
*/ */
// q1_fire_acidspit(self,start, dir, 9, 500); // q1_fire_acidspit (self, start, dir, 9, 500);
} }
void scrag_fire2 (edict_t *self) void scrag_fire2 (edict_t *self)
@ -271,7 +271,7 @@ void scrag_fire2 (edict_t *self)
vec3_t forward, right, start; vec3_t forward, right, start;
vec3_t end, dir; vec3_t end, dir;
if(!self->enemy) if (!self->enemy)
return; return;
// gi.sound (self, CHAN_VOICE, sound_attack, 1, ATTN_NORM, 0); // gi.sound (self, CHAN_VOICE, sound_attack, 1, ATTN_NORM, 0);
@ -307,9 +307,9 @@ mframe_t scrag_frames_attack [] =
ai_charge, -1,scrag_fire, ai_charge, -1,scrag_fire,
ai_charge, -2,NULL, ai_charge, -2,NULL,
ai_charge, -3,NULL, ai_charge, -3,NULL,
ai_charge, -2,NULL, //scrag_fire ai_charge, -2,NULL, // scrag_fire
ai_charge, -1,NULL, ai_charge, -1,NULL,
ai_charge, 0, scrag_fire2, //scrag_fire ai_charge, 0, scrag_fire2, // scrag_fire
ai_charge, 0, NULL, ai_charge, 0, NULL,
ai_charge, 0, NULL ai_charge, 0, NULL
}; };

View file

@ -241,7 +241,7 @@ void q1shalrath_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int d
// check for gib // check for gib
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
for (n = 0; n < 2; n++) for (n = 0; n < 2; n++)
ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC);

View file

@ -206,7 +206,7 @@ void shambler_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int dam
// check for gib // check for gib
if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB)) if (self->health <= self->gib_health && !(self->spawnflags & SF_MONSTER_NOGIB))
{ {
gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1monstr/udeath.wav"), 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE|CHAN_RELIABLE, gi.soundindex ("q1player/udeath.wav"), 1, ATTN_NORM, 0);
ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib1/tris.md2", damage, GIB_ORGANIC);
ThrowGib (self, "models/objects/q1gibs/q1gib3/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib3/tris.md2", damage, GIB_ORGANIC);
ThrowGib (self, "models/objects/q1gibs/q1gib2/tris.md2", damage, GIB_ORGANIC); ThrowGib (self, "models/objects/q1gibs/q1gib2/tris.md2", damage, GIB_ORGANIC);

View file

@ -315,10 +315,10 @@ void SP_monster_q1_tarbaby (edict_t *self)
return; return;
} }
sound_death = gi.soundindex ("q1tarbaby/death1.wav"); sound_death = gi.soundindex ("q1blob/death1.wav");
sound_hit = gi.soundindex ("q1tarbaby/hit1.wav"); sound_hit = gi.soundindex ("q1blob/hit1.wav");
sound_land = gi.soundindex ("q1tarbaby/land1.wav"); sound_land = gi.soundindex ("q1blob/land1.wav");
sound_sight = gi.soundindex ("q1tarbaby/sight1.wav"); sound_sight = gi.soundindex ("q1blob/sight1.wav");
self->movetype = MOVETYPE_STEP; self->movetype = MOVETYPE_STEP;
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;

View file

@ -1886,7 +1886,7 @@ edict_t *SelectRandomDeathmatchSpawnPoint (void)
float range, range1, range2; float range, range1, range2;
spot = NULL; spot = NULL;
range1 = range2 = 99999; range1 = range2 = 999999;
spot1 = spot2 = NULL; spot1 = spot2 = NULL;
while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL)
@ -1985,12 +1985,12 @@ edict_t *SelectLavaCoopSpawnPoint (edict_t *ent)
edict_t *lava; edict_t *lava;
edict_t *pointWithLeastLava; edict_t *pointWithLeastLava;
float lowest; float lowest;
edict_t *spawnPoints [64]; edict_t *spawnPoints[64];
vec3_t center; vec3_t center;
int numPoints; int numPoints;
edict_t *highestlava; edict_t *highestlava;
lavatop = -99999; lavatop = -999999;
highestlava = NULL; highestlava = NULL;
// first, find the highest lava // first, find the highest lava

View file

@ -83,7 +83,7 @@ edict_t *PlayerTrail_PickFirst (edict_t *self)
for (marker = trail_head, n = TRAIL_LENGTH; n; n--) for (marker = trail_head, n = TRAIL_LENGTH; n; n--)
{ {
if(trail[marker]->timestamp <= self->monsterinfo.trail_time) if (trail[marker]->timestamp <= self->monsterinfo.trail_time)
marker = NEXT(marker); marker = NEXT(marker);
else else
break; break;
@ -112,7 +112,7 @@ edict_t *PlayerTrail_PickNext (edict_t *self)
for (marker = trail_head, n = TRAIL_LENGTH; n; n--) for (marker = trail_head, n = TRAIL_LENGTH; n; n--)
{ {
if(trail[marker]->timestamp <= self->monsterinfo.trail_time) if (trail[marker]->timestamp <= self->monsterinfo.trail_time)
marker = NEXT(marker); marker = NEXT(marker);
else else
break; break;

View file

@ -202,10 +202,13 @@ qboolean Pickup_Weapon (edict_t *ent, edict_t *other)
} }
} }
if (other->client->pers.weapon != ent->item && if ( (other->client->pers.weapon != ent->item) &&
(other->client->pers.inventory[index] == 1) && (other->client->pers.inventory[index] == 1) &&
( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") || ( !deathmatch->value ||
other->client->pers.weapon == FindItem("No weapon") ) ) other->client->pers.weapon == FindItem("Blaster") ||
other->client->pers.weapon == FindItem("Flare Gun") || // Zaero
other->client->pers.weapon == FindItem("No Weapon")
) )
other->client->newweapon = ent->item; other->client->newweapon = ent->item;
// If rocket launcher, give the HML (but no ammo). // If rocket launcher, give the HML (but no ammo).
@ -348,6 +351,14 @@ void NoAmmoWeaponChange (edict_t *ent)
return; return;
} }
// -ROGUE // -ROGUE
// SKWiD MOD
if ( (ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))] >= PLASMA_CELLS_PER_SHOT)
&& ent->client->pers.inventory[ITEM_INDEX(FindItem(PLASMA_PICKUP_NAME))] )
{
ent->client->newweapon = FindItem (PLASMA_PICKUP_NAME);
return;
}
// end SKWiD MOD
if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))] if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))]
&& ent->client->pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))] ) && ent->client->pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))] )
{ {