void medic_search(edict_t *self) { edict_t *ent; if (!self) { return; } gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0); if (!self->oldenemy) { ent = medic_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); } } }
void medic_run(edict_t *self) { if (!self) { return; } if (!(self->monsterinfo.aiflags & AI_MEDIC)) { edict_t *ent; ent = medic_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); return; } } if (self->monsterinfo.aiflags & AI_STAND_GROUND) { self->monsterinfo.currentmove = &medic_move_stand; } else { self->monsterinfo.currentmove = &medic_move_run; } }
void medic_search (edict_t *self) { gi.sound (self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0); if (!self->oldenemy) medic_FindDeadMonster(self); }
void medic_run (edict_t *self) { monster_done_dodge (self); if (!(self->monsterinfo.aiflags & AI_MEDIC)) { edict_t *ent; ent = medic_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->monsterinfo.healer = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget (self); return; } } // else if (!canReach(self, self->enemy)) // { // abortHeal (self, 0); // } if (self->monsterinfo.aiflags & AI_STAND_GROUND) self->monsterinfo.currentmove = &medic_move_stand; else self->monsterinfo.currentmove = &medic_move_run; }
void medic_run (edict_t *self) { if (!(self->monsterinfo.aiflags & AI_MEDIC)) { if (medic_FindDeadMonster(self)) return; } if (self->monsterinfo.aiflags & AI_STAND_GROUND) self->monsterinfo.currentmove = &medic_move_stand; else self->monsterinfo.currentmove = &medic_move_run; }
void medic_idle(edict_t * self) { edict_t *ent; gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); ent = medic_FindDeadMonster(self); if (ent) { self->enemy = ent; self->enemy->owner = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget(self); } }
void medic_search (edict_t *self) { edict_t *ent; // PMM - commander sounds if (self->mass == 400) gi.sound (self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0); else gi.sound (self, CHAN_VOICE, commander_sound_search, 1, ATTN_IDLE, 0); if (!self->oldenemy) { ent = medic_FindDeadMonster(self); if (ent) { self->oldenemy = self->enemy; self->enemy = ent; self->enemy->monsterinfo.healer = self; self->monsterinfo.aiflags |= AI_MEDIC; FoundTarget (self); } } }
void medic_StopPatrolling (edict_t *self) { self->goalentity = NULL; self->movetarget = NULL; self->monsterinfo.aiflags &= ~AI_MEDIC_PATROL; if (!(self->monsterinfo.aiflags & AI_MEDIC)) { if(medic_FindDeadMonster(self)) return; } if (has_valid_enemy(self)) { if (visible(self, self->enemy)) { FoundTarget (self); return; } HuntTarget (self); return; } if(self->monsterinfo.aiflags & AI_MEDIC) abortHeal(self,false); }
void medic_idle (edict_t *self) { if(!(self->spawnflags & SF_MONSTER_AMBUSH)) gi.sound (self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); if(self->monsterinfo.aiflags & AI_MEDIC) { // Then we must have reached this point after losing sight // of our patient. abortHeal(self,false); } if(medic_FindDeadMonster(self)) return; // If the map has hint_paths, AND the medic isn't at a HOLD point_combat, // AND the medic has previously called FoundTarget (trail_time set to // level.time), then look for hint_path chain and follow it, hopefully // to find monsters to resurrect if(self->monsterinfo.aiflags & AI_HINT_TEST) return; if (hint_chains_exist && !(self->monsterinfo.aiflags & AI_STAND_GROUND) && ((self->monsterinfo.trail_time > 0) || medic_test) ) { edict_t *e; edict_t *hint=NULL; float dist; vec3_t dir; int i; float bestdistance=99999; for(i=game.maxclients+1; i<globals.num_edicts; i++) { e = &g_edicts[i]; if(!e->inuse) continue; if(Q_strcasecmp(e->classname,"hint_path")) continue; if(!visible(self,e)) continue; if(!canReach(self,e)) continue; VectorSubtract(e->s.origin,self->s.origin,dir); dist = VectorLength(dir); if(dist < bestdistance) { hint = e; bestdistance = dist; } } if(hint) { self->hint_chain_id = hint->hint_chain_id; if(!self->monsterinfo.pathdir) self->monsterinfo.pathdir = 1; VectorSubtract(hint->s.origin, self->s.origin, dir); self->ideal_yaw = vectoyaw(dir); self->goalentity = self->movetarget = hint; self->monsterinfo.pausetime = 0; self->monsterinfo.aiflags |= AI_MEDIC_PATROL; self->monsterinfo.aiflags &= ~(AI_SOUND_TARGET | AI_PURSUIT_LAST_SEEN | AI_PURSUE_NEXT | AI_PURSUE_TEMP); // run for it self->monsterinfo.run (self); } } }
void medic_NextPatrolPoint (edict_t *self, edict_t *hint) { edict_t *next=NULL; edict_t *e; vec3_t dir; qboolean switch_paths=false; self->monsterinfo.aiflags &= ~AI_MEDIC_PATROL; // if(self->monsterinfo.aiflags & AI_MEDIC) // return; if(self->goalentity == hint) self->goalentity = NULL; if(self->movetarget == hint) self->movetarget = NULL; if (!(self->monsterinfo.aiflags & AI_MEDIC)) { if(medic_FindDeadMonster(self)) return; } if(self->monsterinfo.pathdir == 1) { if(hint->hint_chain) next = hint->hint_chain; else { self->monsterinfo.pathdir = -1; switch_paths = true; } } if(self->monsterinfo.pathdir == -1) { e = hint_chain_starts[hint->hint_chain_id]; while(e) { if(e->hint_chain == hint) { next = e; break; } e = e->hint_chain; } } if(!next) { self->monsterinfo.pathdir = 1; next = hint->hint_chain; switch_paths = true; } // If switch_paths is true, we reached the end of a hint_chain. Just for grins, // search for *another* visible hint_path chain and use it if it's reasonably close if(switch_paths && hint_chain_count > 1) { edict_t *e; edict_t *alternate=NULL; float dist; vec3_t dir; int i; float bestdistance=512; for(i=game.maxclients+1; i<globals.num_edicts; i++) { e = &g_edicts[i]; if(!e->inuse) continue; if(Q_strcasecmp(e->classname,"hint_path")) continue; if(next && (e->hint_chain_id == next->hint_chain_id)) continue; if(!visible(self,e)) continue; if(!canReach(self,e)) continue; VectorSubtract(e->s.origin,self->s.origin,dir); dist = VectorLength(dir); if(dist < bestdistance) { alternate = e; bestdistance = dist; } } if(alternate) next = alternate; } if(next) { self->hint_chain_id = next->hint_chain_id; VectorSubtract(next->s.origin, self->s.origin, dir); self->ideal_yaw = vectoyaw(dir); self->goalentity = self->movetarget = next; self->monsterinfo.pausetime = 0; self->monsterinfo.aiflags |= AI_MEDIC_PATROL; self->monsterinfo.aiflags &= ~(AI_SOUND_TARGET | AI_PURSUIT_LAST_SEEN | AI_PURSUE_NEXT | AI_PURSUE_TEMP); // run for it self->monsterinfo.run (self); } else { self->monsterinfo.pausetime = level.time + 100000000; self->monsterinfo.stand (self); } }
qboolean medic_checkattack (edict_t *self) { if (!(self->monsterinfo.aiflags & AI_MEDIC)) { if( medic_FindDeadMonster(self) ) return false; } if (self->monsterinfo.aiflags & AI_MEDIC) { float r; vec3_t forward, right, offset, start; trace_t tr; // if we have 5 seconds or less before a timeout, // look for a hint_path to the target if ( (self->timestamp < level.time + 5) && (self->monsterinfo.last_hint_time + 5 < level.time) ) { // check for hint_paths. self->monsterinfo.last_hint_time = level.time; if (hintcheck_monsterlost(self)) { if(developer->value) gi.dprintf("medic at %s using hint_paths to find %s\n", vtos(self->s.origin), self->enemy->classname); self->timestamp = level.time + MEDIC_TRY_TIME; return false; } } // if we ran out of time, give up if (self->timestamp < level.time) { //if(developer->value) // gi.dprintf("medic at %s timed out, abort heal\n",vtos(self->s.origin)); abortHeal (self, true); self->timestamp = 0; return false; } // if our target went away if ((!self->enemy) || (!self->enemy->inuse)) { abortHeal (self,false); return false; } // if target is embedded in a solid if (embedded(self->enemy)) { abortHeal (self,false); return false; } r = realrange(self,self->enemy); if (r > MEDIC_MAX_HEAL_DISTANCE+10) { self->monsterinfo.attack_state = AS_STRAIGHT; //abortHeal(self,false); return false; } else if(r < MEDIC_MIN_DISTANCE) { abortHeal(self,false); return false; } // Lazarus 1.6.2.3: if point-to-point vector from cable to // target is blocked by a solid AngleVectors (self->s.angles, forward, right, NULL); // Offset [8] has the largest displacement to the left... not a sure // thing but this one should be the most severe test. VectorCopy (medic_cable_offsets[8], offset); G_ProjectSource (self->s.origin, offset, forward, right, start); tr = gi.trace(start,NULL,NULL,self->enemy->s.origin,self,MASK_SHOT|MASK_WATER); if (tr.fraction < 1.0 && tr.ent != self->enemy) return false; medic_attack(self); return true; } // Lazarus: NEVER attack other monsters if ((self->enemy) && (self->enemy->svflags & SVF_MONSTER)) { self->enemy = self->oldenemy; self->oldenemy = NULL; if(self->enemy && self->enemy->inuse) { if(visible(self,self->enemy)) FoundTarget(self); else HuntTarget(self); } return false; } return M_CheckAttack (self); }