aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/game
diff options
context:
space:
mode:
authorRene Stoeckel <[email protected]>2005-02-20 16:38:36 +0000
committerRene Stoeckel <[email protected]>2005-02-20 16:38:36 +0000
commit3e7a81778bab6d2717618a0368693186730c0982 (patch)
tree99b20c31265719f94536e76d4de278d646cc5f81 /src/jake2/game
parenta4d8750bd468ef6988aae2c700a09d2434ebabd9 (diff)
some changes in monster ai (findtarget, ai_run)
Diffstat (limited to 'src/jake2/game')
-rw-r--r--src/jake2/game/GameAI.java34
-rw-r--r--src/jake2/game/GameUtil.java50
2 files changed, 47 insertions, 37 deletions
diff --git a/src/jake2/game/GameAI.java b/src/jake2/game/GameAI.java
index cdd1a95..5887cfa 100644
--- a/src/jake2/game/GameAI.java
+++ b/src/jake2/game/GameAI.java
@@ -19,7 +19,7 @@
*/
// Created on 02.11.2003 by RST.
-// $Id: GameAI.java,v 1.6 2005-02-06 18:58:51 salomo Exp $
+// $Id: GameAI.java,v 1.7 2005-02-20 16:38:36 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -2634,7 +2634,7 @@ public class GameAI {
}
if (0 == self.yaw_speed)
- self.yaw_speed = 20;
+ self.yaw_speed = 40;
self.viewheight = 25;
Monster.monster_start_go(self);
@@ -2661,7 +2661,7 @@ public class GameAI {
+ Lib.vtos(self.s.origin) + "\n");
if (0 == self.yaw_speed)
- self.yaw_speed = 10;
+ self.yaw_speed = 20;
self.viewheight = 25;
Monster.monster_start_go(self);
@@ -2684,7 +2684,7 @@ public class GameAI {
public static EntThinkAdapter swimmonster_start_go = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (0 == self.yaw_speed)
- self.yaw_speed = 10;
+ self.yaw_speed = 20;
self.viewheight = 10;
Monster.monster_start_go(self);
@@ -2865,18 +2865,25 @@ public class GameAI {
return;
}
+ // 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) {
- self.monsterinfo.aiflags |= (Defines.AI_STAND_GROUND | Defines.AI_TEMP_STAND_GROUND);
+ //don't move, just stand and listen.
+ //self.monsterinfo.aiflags |= (Defines.AI_STAND_GROUND | Defines.AI_TEMP_STAND_GROUND);
self.monsterinfo.stand.think(self);
- return;
+ // since now it is aware and does not to be triggered again.
+ self.spawnflags &= ~1;
+ self.enemy = null;
}
-
- M.M_MoveToGoal(self, dist);
-
+ else
+ M.M_MoveToGoal(self, dist);
+
+ // look for new targets
if (!GameUtil.FindTarget(self))
return;
+
}
if (ai_checkattack(self, dist))
@@ -2898,12 +2905,13 @@ public class GameAI {
return;
}
- // coop will change to another enemy if visible
+ // coop will change to another enemy if visible^
if (GameBase.coop.value != 0) {
// FIXME: insane guys get mad with this, which causes crashes!
if (GameUtil.FindTarget(self))
return;
}
+
if ((self.monsterinfo.search_time != 0)
&& (GameBase.level.time > (self.monsterinfo.search_time + 20))) {
@@ -3050,11 +3058,11 @@ public class GameAI {
self.s.origin, v);
self.s.angles[Defines.YAW] = self.ideal_yaw = Math3D
.vectoyaw(v);
- // gi.dprintf("adjusted right\n");
- // debug_drawline(self.origin, self.last_sighting, 152);
+ // gi.dprintf("adjusted right\n");
+ // debug_drawline(self.origin, self.last_sighting, 152);
}
}
- // else gi.dprintf("course was fine\n");
+ // else gi.dprintf("course was fine\n");
}
M.M_MoveToGoal(self, dist);
diff --git a/src/jake2/game/GameUtil.java b/src/jake2/game/GameUtil.java
index c8bf185..346355b 100644
--- a/src/jake2/game/GameUtil.java
+++ b/src/jake2/game/GameUtil.java
@@ -19,7 +19,7 @@
*/
// Created on 01.11.2003 by RST.
-// $Id: GameUtil.java,v 1.11 2005-02-19 23:32:01 salomo Exp $
+// $Id: GameUtil.java,v 1.12 2005-02-20 16:38:36 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -1009,13 +1009,15 @@ public class GameUtil {
boolean heardit;
int r;
- if ((self.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) {
+ if ((self.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0)
+ {
if (self.goalentity != null && self.goalentity.inuse
- && self.goalentity.classname != null) {
+ && self.goalentity.classname != null)
+ {
if (self.goalentity.classname.equals("target_actor"))
return false;
}
-
+
//FIXME look for monsters?
return false;
}
@@ -1036,10 +1038,9 @@ public class GameUtil {
heardit = false;
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;
- }
+ 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;
heardit = true;
@@ -1058,9 +1059,6 @@ public class GameUtil {
if (!client.inuse)
return false;
- if (client == self.enemy)
- return true; // JDC false;
-
if (client.client != null) {
if ((client.flags & Defines.FL_NOTARGET) != 0)
return false;
@@ -1081,27 +1079,28 @@ public class GameUtil {
if (r == Defines.RANGE_FAR)
return false;
- // this is where we would check invisibility
-
+ // 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)) {
+ if (!visible(self, client))
return false;
- }
+
if (r == Defines.RANGE_NEAR) {
if (client.show_hostile < GameBase.level.time
- && !infront(self, client)) {
- return false;
- }
+ && !infront(self, client))
+ return false;
} else if (r == Defines.RANGE_MID) {
- if (!infront(self, client)) {
- return false;
- }
+ if (!infront(self, client))
+ return false;
}
+ if (client == self.enemy)
+ return true; // JDC false;
+
self.enemy = client;
if (!self.enemy.classname.equals("player_noise")) {
@@ -1130,9 +1129,8 @@ public class GameUtil {
Math3D.VectorSubtract(client.s.origin, self.s.origin, temp);
if (Math3D.VectorLength(temp) > 1000) // too far to hear
- {
return false;
- }
+
// check area portals - if they are different and not connected then
// we can't hear it
@@ -1145,7 +1143,11 @@ public class GameUtil {
// hunt the sound for a bit; hopefully find the real player
self.monsterinfo.aiflags |= Defines.AI_SOUND_TARGET;
- self.enemy = client;
+
+ if (client == self.enemy)
+ return true; // JDC false;
+
+ self.enemy = client;
}
//