From: Rene S. <sa...@us...> - 2005-02-20 16:38:46
|
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25891/src/jake2/game Modified Files: GameAI.java GameUtil.java Log Message: some changes in monster ai (findtarget, ai_run) Index: GameUtil.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameUtil.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GameUtil.java 19 Feb 2005 23:32:01 -0000 1.11 --- GameUtil.java 20 Feb 2005 16:38:36 -0000 1.12 *************** *** 1010,1020 **** int r; ! if ((self.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) { if (self.goalentity != null && self.goalentity.inuse ! && self.goalentity.classname != null) { if (self.goalentity.classname.equals("target_actor")) return false; } ! //FIXME look for monsters? return false; --- 1010,1022 ---- int r; ! if ((self.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) ! { if (self.goalentity != null && self.goalentity.inuse ! && self.goalentity.classname != null) ! { if (self.goalentity.classname.equals("target_actor")) return false; } ! //FIXME look for monsters? return false; *************** *** 1037,1044 **** if ((GameBase.level.sight_entity_framenum >= (GameBase.level.framenum - 1)) && 0 == (self.spawnflags & 1)) { ! client = GameBase.level.sight_entity; ! if (client.enemy == self.enemy) { ! return false; ! } } else if (GameBase.level.sound_entity_framenum >= (GameBase.level.framenum - 1)) { client = GameBase.level.sound_entity; --- 1039,1045 ---- if ((GameBase.level.sight_entity_framenum >= (GameBase.level.framenum - 1)) && 0 == (self.spawnflags & 1)) { ! client = GameBase.level.sight_entity; ! if (client.enemy == self.enemy) ! return false; } else if (GameBase.level.sound_entity_framenum >= (GameBase.level.framenum - 1)) { client = GameBase.level.sound_entity; *************** *** 1059,1065 **** return false; - if (client == self.enemy) - return true; // JDC false; - if (client.client != null) { if ((client.flags & Defines.FL_NOTARGET) != 0) --- 1060,1063 ---- *************** *** 1082,1106 **** return false; ! // this is where we would check invisibility ! // is client in an spot too dark to be seen? if (client.light_level <= 5) return false; ! if (!visible(self, client)) { return false; ! } if (r == Defines.RANGE_NEAR) { if (client.show_hostile < GameBase.level.time ! && !infront(self, client)) { ! return false; ! } } else if (r == Defines.RANGE_MID) { ! if (!infront(self, client)) { ! return false; ! } } self.enemy = client; --- 1080,1105 ---- return false; ! // this is where we would check invisibility // is client in an spot too dark to be seen? + if (client.light_level <= 5) return false; ! if (!visible(self, client)) return false; ! if (r == Defines.RANGE_NEAR) { if (client.show_hostile < GameBase.level.time ! && !infront(self, client)) ! return false; } else if (r == Defines.RANGE_MID) { ! if (!infront(self, client)) ! return false; } + if (client == self.enemy) + return true; // JDC false; + self.enemy = client; *************** *** 1131,1137 **** if (Math3D.VectorLength(temp) > 1000) // too far to hear - { return false; ! } // check area portals - if they are different and not connected then --- 1130,1135 ---- if (Math3D.VectorLength(temp) > 1000) // too far to hear return false; ! // check area portals - if they are different and not connected then *************** *** 1146,1150 **** // hunt the sound for a bit; hopefully find the real player self.monsterinfo.aiflags |= Defines.AI_SOUND_TARGET; ! self.enemy = client; } --- 1144,1152 ---- // hunt the sound for a bit; hopefully find the real player self.monsterinfo.aiflags |= Defines.AI_SOUND_TARGET; ! ! if (client == self.enemy) ! return true; // JDC false; ! ! self.enemy = client; } Index: GameAI.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameAI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GameAI.java 6 Feb 2005 18:58:51 -0000 1.6 --- GameAI.java 20 Feb 2005 16:38:36 -0000 1.7 *************** *** 2635,2639 **** if (0 == self.yaw_speed) ! self.yaw_speed = 20; self.viewheight = 25; --- 2635,2639 ---- if (0 == self.yaw_speed) ! self.yaw_speed = 40; self.viewheight = 25; *************** *** 2662,2666 **** if (0 == self.yaw_speed) ! self.yaw_speed = 10; self.viewheight = 25; --- 2662,2666 ---- if (0 == self.yaw_speed) ! self.yaw_speed = 20; self.viewheight = 25; *************** *** 2685,2689 **** public boolean think(edict_t self) { if (0 == self.yaw_speed) ! self.yaw_speed = 10; self.viewheight = 10; --- 2685,2689 ---- public boolean think(edict_t self) { if (0 == self.yaw_speed) ! self.yaw_speed = 20; self.viewheight = 10; *************** *** 2866,2881 **** } if ((self.monsterinfo.aiflags & Defines.AI_SOUND_TARGET) != 0) { Math3D.VectorSubtract(self.s.origin, self.enemy.s.origin, v); if (Math3D.VectorLength(v) < 64) { ! self.monsterinfo.aiflags |= (Defines.AI_STAND_GROUND | Defines.AI_TEMP_STAND_GROUND); self.monsterinfo.stand.think(self); ! return; } ! ! M.M_MoveToGoal(self, dist); ! if (!GameUtil.FindTarget(self)) return; } --- 2866,2888 ---- } + // rst: monster heard a sound.... if ((self.monsterinfo.aiflags & Defines.AI_SOUND_TARGET) != 0) { Math3D.VectorSubtract(self.s.origin, self.enemy.s.origin, v); + // ...and reached it if (Math3D.VectorLength(v) < 64) { ! //don't move, just stand and listen. ! //self.monsterinfo.aiflags |= (Defines.AI_STAND_GROUND | Defines.AI_TEMP_STAND_GROUND); self.monsterinfo.stand.think(self); ! // since now it is aware and does not to be triggered again. ! self.spawnflags &= ~1; ! self.enemy = null; } ! else ! M.M_MoveToGoal(self, dist); ! ! // look for new targets if (!GameUtil.FindTarget(self)) return; + } *************** *** 2899,2903 **** } ! // coop will change to another enemy if visible if (GameBase.coop.value != 0) { // FIXME: insane guys get mad with this, which causes crashes! --- 2906,2910 ---- } ! // coop will change to another enemy if visible^ if (GameBase.coop.value != 0) { // FIXME: insane guys get mad with this, which causes crashes! *************** *** 2905,2908 **** --- 2912,2916 ---- return; } + if ((self.monsterinfo.search_time != 0) *************** *** 3051,3059 **** self.s.angles[Defines.YAW] = self.ideal_yaw = Math3D .vectoyaw(v); ! // gi.dprintf("adjusted right\n"); ! // debug_drawline(self.origin, self.last_sighting, 152); } } ! // else gi.dprintf("course was fine\n"); } --- 3059,3067 ---- self.s.angles[Defines.YAW] = self.ideal_yaw = Math3D .vectoyaw(v); ! // gi.dprintf("adjusted right\n"); ! // debug_drawline(self.origin, self.last_sighting, 152); } } ! // else gi.dprintf("course was fine\n"); } |