diff options
Diffstat (limited to 'src/jake2/game/GameAI.java')
-rw-r--r-- | src/jake2/game/GameAI.java | 1884 |
1 files changed, 495 insertions, 1389 deletions
diff --git a/src/jake2/game/GameAI.java b/src/jake2/game/GameAI.java index 2e32ed8..ae33926 100644 --- a/src/jake2/game/GameAI.java +++ b/src/jake2/game/GameAI.java @@ -19,186 +19,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 02.11.2003 by RST. -// $Id: GameAI.java,v 1.1 2004-07-07 19:58:55 hzi Exp $ +// $Id: GameAI.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.Defines; import jake2.client.M; -import jake2.util.*; +import jake2.util.Lib; +import jake2.util.Math3D; -import java.util.*; +import java.util.StringTokenizer; -public class GameAI extends M_Flash { +public class GameAI extends M_Flash +{ /* =============== GetItemByIndex =============== */ - public static gitem_t GetItemByIndex(int index) { - + public static gitem_t GetItemByIndex(int index) + { if (index == 0 || index >= game.num_items) return null; - return itemlist[index]; + return GameAI.itemlist[index]; } - - /** Common Boss explode animation.*/ - - public static EntThinkAdapter BossExplode = new EntThinkAdapter() { - public boolean think(edict_t self) { - float[] org = { 0, 0, 0 }; - - int n; - - self.think = BossExplode; - Math3D.VectorCopy(self.s.origin, org); - org[2] += 24 + (Lib.rand() & 15); - switch (self.count++) { - case 0 : - org[0] -= 24; - org[1] -= 24; - break; - case 1 : - org[0] += 24; - org[1] += 24; - break; - case 2 : - org[0] += 24; - org[1] -= 24; - break; - case 3 : - org[0] -= 24; - org[1] += 24; - break; - case 4 : - org[0] -= 48; - org[1] -= 48; - break; - case 5 : - org[0] += 48; - org[1] += 48; - break; - case 6 : - org[0] -= 48; - org[1] += 48; - break; - case 7 : - org[0] += 48; - org[1] -= 48; - break; - case 8 : - self.s.sound = 0; - for (n = 0; n < 4; n++) - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC); - for (n = 0; n < 8; n++) - ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC); - ThrowGib(self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC); - ThrowHead(self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC); - self.deadflag = DEAD_DEAD; - return true; - } - - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_EXPLOSION1); - gi.WritePosition(org); - gi.multicast(self.s.origin, MULTICAST_PVS); - - self.nextthink = level.time + 0.1f; - return true; - } - }; - - public static void AttackFinished(edict_t self, float time) { + public static void AttackFinished(edict_t self, float time) + { self.monsterinfo.attack_finished = level.time + time; } - public static EntThinkAdapter walkmonster_start_go = new EntThinkAdapter() { - public boolean think(edict_t self) { - - if (0 == (self.spawnflags & 2) && level.time < 1) { - M.M_droptofloor.think(self); - - if (self.groundentity != null) - if (!M.M_walkmove(self, 0, 0)) - gi.dprintf(self.classname + " in solid at " + Lib.vtos(self.s.origin) + "\n"); - } - - if (0 == self.yaw_speed) - self.yaw_speed = 20; - self.viewheight = 25; - - Monster.monster_start_go(self); - - if ((self.spawnflags & 2) != 0) - Monster.monster_triggered_start.think(self); - return true; - } - }; - - public static EntThinkAdapter walkmonster_start = new EntThinkAdapter() { - public boolean think(edict_t self) { - - self.think = walkmonster_start_go; - Monster.monster_start(self); - return true; - } - }; - - public static EntThinkAdapter flymonster_start_go = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (!M.M_walkmove(self, 0, 0)) - gi.dprintf(self.classname + " in solid at " + Lib.vtos(self.s.origin) + "\n"); - - if (0 == self.yaw_speed) - self.yaw_speed = 10; - self.viewheight = 25; - - Monster.monster_start_go(self); - - if ((self.spawnflags & 2) != 0) - Monster.monster_triggered_start.think(self); - return true; - } - }; - - public static EntThinkAdapter flymonster_start = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.flags |= FL_FLY; - self.think = flymonster_start_go; - Monster.monster_start(self); - return true; - } - }; - - public static EntThinkAdapter swimmonster_start_go = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (0 == self.yaw_speed) - self.yaw_speed = 10; - self.viewheight = 10; - - Monster.monster_start_go(self); - - if ((self.spawnflags & 2) != 0) - Monster.monster_triggered_start.think(self); - return true; - } - }; - - public static EntThinkAdapter swimmonster_start = new EntThinkAdapter() { - public boolean think(edict_t self) { - - { - self.flags |= FL_SWIM; - self.think = swimmonster_start_go; - Monster.monster_start(self); - return true; - } - } - }; - /* ============= ai_turn @@ -207,142 +59,8 @@ public class GameAI extends M_Flash { Distance is for slight position adjustments needed by the animations ============= */ - public static AIAdapter ai_turn = new AIAdapter() { - public void ai(edict_t self, float dist) { - if (dist != 0) - M.M_walkmove(self, self.s.angles[YAW], dist); - - if (FindTarget(self)) - return; - - M.M_ChangeYaw(self); - } - }; - - /* - ============= - ai_move - - Move the specified distance at current facing. - This replaces the QC functions: ai_forward, ai_back, ai_pain, and ai_painforward - ============== - */ - public static AIAdapter ai_move = new AIAdapter() { - public void ai(edict_t self, float dist) { - M.M_walkmove(self, self.s.angles[YAW], dist); - } - }; - - /* - ============= - ai_walk - - The monster is walking it's beat - ============= - */ - public static AIAdapter ai_walk = new AIAdapter() { - public void ai(edict_t self, float dist) { - M.M_MoveToGoal(self, dist); - - // check for noticing a player - if (FindTarget(self)) - return; - - if ((self.monsterinfo.search != null) && (level.time > self.monsterinfo.idle_time)) { - if (self.monsterinfo.idle_time != 0) { - self.monsterinfo.search.think(self); - self.monsterinfo.idle_time = level.time + 15 + Lib.random() * 15; - } - else { - self.monsterinfo.idle_time = level.time + Lib.random() * 15; - } - } - } - }; - - /* - ============= - ai_stand - - Used for standing around and looking for players - Distance is for slight position adjustments needed by the animations - ============== - */ - - public static AIAdapter ai_stand = new AIAdapter() { - public void ai(edict_t self, float dist) { - float[] v = { 0, 0, 0 }; - - if (dist != 0) - M.M_walkmove(self, self.s.angles[YAW], dist); - - if ((self.monsterinfo.aiflags & AI_STAND_GROUND) != 0) { - if (self.enemy != null) { - Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, v); - self.ideal_yaw = Math3D.vectoyaw(v); - if (self.s.angles[YAW] != self.ideal_yaw && 0 != (self.monsterinfo.aiflags & AI_TEMP_STAND_GROUND)) { - self.monsterinfo.aiflags &= ~(AI_STAND_GROUND | AI_TEMP_STAND_GROUND); - self.monsterinfo.run.think(self); - } - M.M_ChangeYaw(self); - ai_checkattack(self, 0); - } - else - FindTarget(self); - return; - } - - if (FindTarget(self)) - return; - - if (level.time > self.monsterinfo.pausetime) { - self.monsterinfo.walk.think(self); - return; - } - - if (0 == (self.spawnflags & 1) && (self.monsterinfo.idle != null) && (level.time > self.monsterinfo.idle_time)) { - if (self.monsterinfo.idle_time != 0) { - self.monsterinfo.idle.think(self); - self.monsterinfo.idle_time = level.time + 15 + Lib.random() * 15; - } - else { - self.monsterinfo.idle_time = level.time + Lib.random() * 15; - } - } - } - }; - - /* - ============= - ai_charge - - Turns towards target and advances - Use this call with a distnace of 0 to replace ai_face - ============== - */ - public static AIAdapter ai_charge = new AIAdapter() { - - public void ai(edict_t self, float dist) { - float[] v = { 0, 0, 0 }; - - Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, v); - self.ideal_yaw = Math3D.vectoyaw(v); - M.M_ChangeYaw(self); - - if (dist != 0) - M.M_walkmove(self, self.s.angles[YAW], dist); - } - }; - - /* - ============= - ai_turn - - don't move, but turn towards ideal_yaw - Distance is for slight position adjustments needed by the animations - ============= - */ - public static void ai_turn(edict_t self, float dist) { + public static void ai_turn(edict_t self, float dist) + { if (dist != 0) M.M_walkmove(self, self.s.angles[YAW], dist); @@ -385,7 +103,8 @@ public class GameAI extends M_Flash { ============ */ - public static boolean FacingIdeal(edict_t self) { + public static boolean FacingIdeal(edict_t self) + { float delta; delta = Math3D.anglemod(self.s.angles[YAW] - self.ideal_yaw); @@ -401,11 +120,13 @@ public class GameAI extends M_Flash { Turn and close until within an angle to launch a melee attack ============= */ - public static void ai_run_melee(edict_t self) { - self.ideal_yaw = enemy_yaw; + public static void ai_run_melee(edict_t self) + { + self.ideal_yaw = GameUtilAdapters.enemy_yaw; M.M_ChangeYaw(self); - if (FacingIdeal(self)) { + if (FacingIdeal(self)) + { self.monsterinfo.melee.think(self); self.monsterinfo.attack_state = AS_STRAIGHT; } @@ -418,11 +139,13 @@ public class GameAI extends M_Flash { Turn in place until within an angle to launch a missile attack ============= */ - public static void ai_run_missile(edict_t self) { - self.ideal_yaw = enemy_yaw; + public static void ai_run_missile(edict_t self) + { + self.ideal_yaw = GameUtilAdapters.enemy_yaw; M.M_ChangeYaw(self); - if (FacingIdeal(self)) { + if (FacingIdeal(self)) + { self.monsterinfo.attack.think(self); self.monsterinfo.attack_state = AS_STRAIGHT; } @@ -435,10 +158,11 @@ public class GameAI extends M_Flash { Strafe sideways, but stay at aproximately the same range ============= */ - public static void ai_run_slide(edict_t self, float distance) { + public static void ai_run_slide(edict_t self, float distance) + { float ofs; - self.ideal_yaw = enemy_yaw; + self.ideal_yaw = GameUtilAdapters.enemy_yaw; M.M_ChangeYaw(self); if (self.monsterinfo.lefty != 0) @@ -461,18 +185,22 @@ public class GameAI extends M_Flash { used by ai_run and ai_stand ============= */ - public static boolean ai_checkattack(edict_t self, float dist) { + public static boolean ai_checkattack(edict_t self, float dist) + { float temp[] = { 0, 0, 0 }; boolean hesDeadJim; // this causes monsters to run blindly to the combat point w/o firing - if (self.goalentity != null) { + if (self.goalentity != null) + { if ((self.monsterinfo.aiflags & AI_COMBAT_POINT) != 0) return false; - if ((self.monsterinfo.aiflags & AI_SOUND_TARGET) != 0) { - if ((level.time - self.enemy.teleport_time) > 5.0) { + if ((self.monsterinfo.aiflags & AI_SOUND_TARGET) != 0) + { + if ((level.time - self.enemy.teleport_time) > 5.0) + { if (self.goalentity == self.enemy) if (self.movetarget != null) self.goalentity = self.movetarget; @@ -482,51 +210,63 @@ public class GameAI extends M_Flash { if ((self.monsterinfo.aiflags & AI_TEMP_STAND_GROUND) != 0) self.monsterinfo.aiflags &= ~(AI_STAND_GROUND | AI_TEMP_STAND_GROUND); } - else { + else + { self.show_hostile = (int) level.time + 1; return false; } } } - enemy_vis = false; + GameUtilAdapters.enemy_vis = false; // see if the enemy is dead hesDeadJim = false; - if ((null == self.enemy) || (self.enemy.inuse)) { + if ((null == self.enemy) || (!self.enemy.inuse)) + { hesDeadJim = true; } - else if ((self.monsterinfo.aiflags & AI_MEDIC) != 0) { - if (self.enemy.health > 0) { + else if ((self.monsterinfo.aiflags & AI_MEDIC) != 0) + { + if (self.enemy.health > 0) + { hesDeadJim = true; self.monsterinfo.aiflags &= ~AI_MEDIC; } } - else { - if ((self.monsterinfo.aiflags & AI_BRUTAL) != 0) { + else + { + if ((self.monsterinfo.aiflags & AI_BRUTAL) != 0) + { if (self.enemy.health <= -80) hesDeadJim = true; } - else { + else + { if (self.enemy.health <= 0) hesDeadJim = true; } } - if (hesDeadJim) { + if (hesDeadJim) + { self.enemy = null; // FIXME: look all around for other targets - if (self.oldenemy != null && self.oldenemy.health > 0) { + if (self.oldenemy != null && self.oldenemy.health > 0) + { self.enemy = self.oldenemy; self.oldenemy = null; HuntTarget(self); } - else { - if (self.movetarget != null) { + else + { + if (self.movetarget != null) + { self.goalentity = self.movetarget; self.monsterinfo.walk.think(self); } - else { + else + { // we need the pausetime otherwise the stand code // will just revert to walking with no target and // the monsters will wonder around aimlessly trying @@ -541,8 +281,9 @@ public class GameAI extends M_Flash { self.show_hostile = (int) level.time + 1; // wake up other monsters // check knowledge of enemy - enemy_vis = visible(self, self.enemy); - if (enemy_vis) { + GameUtilAdapters.enemy_vis = visible(self, self.enemy); + if (GameUtilAdapters.enemy_vis) + { self.monsterinfo.search_time = level.time + 5; Math3D.VectorCopy(self.enemy.s.origin, self.monsterinfo.last_sighting); } @@ -554,225 +295,33 @@ public class GameAI extends M_Flash { // return true; // } - enemy_infront = infront(self, self.enemy); - enemy_range = range(self, self.enemy); + GameUtilAdapters.enemy_infront = infront(self, self.enemy); + GameUtilAdapters.enemy_range = range(self, self.enemy); Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, temp); - enemy_yaw = Math3D.vectoyaw(temp); + GameUtilAdapters.enemy_yaw = Math3D.vectoyaw(temp); // JDC self.ideal_yaw = enemy_yaw; - if (self.monsterinfo.attack_state == AS_MISSILE) { + if (self.monsterinfo.attack_state == AS_MISSILE) + { ai_run_missile(self); return true; } - if (self.monsterinfo.attack_state == AS_MELEE) { + if (self.monsterinfo.attack_state == AS_MELEE) + { ai_run_melee(self); return true; } // if enemy is not currently visible, we will never attack - if (!enemy_vis) + if (!GameUtilAdapters.enemy_vis) return false; return self.monsterinfo.checkattack.think(self); } - /* - ============= - ai_run - - The monster has an enemy it is trying to kill - ============= - */ - public static AIAdapter ai_run = new AIAdapter() { - public void ai_run(edict_t self, float dist) { - float[] v = { 0, 0, 0 }; - - edict_t tempgoal; - edict_t save; - boolean new1; - edict_t marker; - float d1, d2; - trace_t tr; - float[] v_forward = { 0, 0, 0 }, v_right = { 0, 0, 0 }; - float left, center, right; - float[] left_target = { 0, 0, 0 }, right_target = { 0, 0, 0 }; - - // if we're going to a combat point, just proceed - if ((self.monsterinfo.aiflags & AI_COMBAT_POINT) != 0) { - M.M_MoveToGoal(self, dist); - return; - } - - if ((self.monsterinfo.aiflags & AI_SOUND_TARGET) != 0) { - Math3D.VectorSubtract(self.s.origin, self.enemy.s.origin, v); - if (Math3D.VectorLength(v) < 64) { - self.monsterinfo.aiflags |= (AI_STAND_GROUND | AI_TEMP_STAND_GROUND); - self.monsterinfo.stand.think(self); - return; - } - - M.M_MoveToGoal(self, dist); - - if (!FindTarget(self)) - return; - } - - if (ai_checkattack(self, dist)) - return; - - if (self.monsterinfo.attack_state == AS_SLIDING) { - ai_run_slide(self, dist); - return; - } - - if (enemy_vis) { - // if (self.aiflags & AI_LOST_SIGHT) - // dprint("regained sight\n"); - M.M_MoveToGoal(self, dist); - self.monsterinfo.aiflags &= ~AI_LOST_SIGHT; - Math3D.VectorCopy(self.enemy.s.origin, self.monsterinfo.last_sighting); - self.monsterinfo.trail_time = level.time; - return; - } - - // coop will change to another enemy if visible - if (coop.value != 0) { - // FIXME: insane guys get mad with this, which causes crashes! - if (FindTarget(self)) - return; - } - - if ((self.monsterinfo.search_time != 0) && (level.time > (self.monsterinfo.search_time + 20))) { - M.M_MoveToGoal(self, dist); - self.monsterinfo.search_time = 0; - // dprint("search timeout\n"); - return; - } - - save = self.goalentity; - tempgoal = G_Spawn(); - self.goalentity = tempgoal; - - new1 = false; - - if (0 == (self.monsterinfo.aiflags & AI_LOST_SIGHT)) { - // just lost sight of the player, decide where to go first - // dprint("lost sight of player, last seen at "); dprint(vtos(self.last_sighting)); dprint("\n"); - self.monsterinfo.aiflags |= (AI_LOST_SIGHT | AI_PURSUIT_LAST_SEEN); - self.monsterinfo.aiflags &= ~(AI_PURSUE_NEXT | AI_PURSUE_TEMP); - new1 = true; - } - - if ((self.monsterinfo.aiflags & AI_PURSUE_NEXT) != 0) { - self.monsterinfo.aiflags &= ~AI_PURSUE_NEXT; - // dprint("reached current goal: "); dprint(vtos(self.origin)); dprint(" "); dprint(vtos(self.last_sighting)); dprint(" "); dprint(ftos(vlen(self.origin - self.last_sighting))); dprint("\n"); - - // give ourself more time since we got this far - self.monsterinfo.search_time = level.time + 5; - - if ((self.monsterinfo.aiflags & AI_PURSUE_TEMP) != 0) { - // dprint("was temp goal; retrying original\n"); - self.monsterinfo.aiflags &= ~AI_PURSUE_TEMP; - marker = null; - Math3D.VectorCopy(self.monsterinfo.saved_goal, self.monsterinfo.last_sighting); - new1 = true; - } - else if ((self.monsterinfo.aiflags & AI_PURSUIT_LAST_SEEN) != 0) { - self.monsterinfo.aiflags &= ~AI_PURSUIT_LAST_SEEN; - marker = PlayerTrail.PickFirst(self); - } - else { - marker = PlayerTrail.PickNext(self); - } - - if (marker != null) { - Math3D.VectorCopy(marker.s.origin, self.monsterinfo.last_sighting); - self.monsterinfo.trail_time = marker.timestamp; - self.s.angles[YAW] = self.ideal_yaw = marker.s.angles[YAW]; - // dprint("heading is "); dprint(ftos(self.ideal_yaw)); dprint("\n"); - - // debug_drawline(self.origin, self.last_sighting, 52); - new1 = true; - } - } - - Math3D.VectorSubtract(self.s.origin, self.monsterinfo.last_sighting, v); - d1 = Math3D.VectorLength(v); - if (d1 <= dist) { - self.monsterinfo.aiflags |= AI_PURSUE_NEXT; - dist = d1; - } - - Math3D.VectorCopy(self.monsterinfo.last_sighting, self.goalentity.s.origin); - - if (new1) { - // gi.dprintf("checking for course correction\n"); - - tr = gi.trace(self.s.origin, self.mins, self.maxs, self.monsterinfo.last_sighting, self, MASK_PLAYERSOLID); - if (tr.fraction < 1) { - Math3D.VectorSubtract(self.goalentity.s.origin, self.s.origin, v); - d1 = Math3D.VectorLength(v); - center = tr.fraction; - d2 = d1 * ((center + 1) / 2); - self.s.angles[YAW] = self.ideal_yaw = Math3D.vectoyaw(v); - Math3D.AngleVectors(self.s.angles, v_forward, v_right, null); - - Math3D.VectorSet(v, d2, -16, 0); - Math3D.G_ProjectSource(self.s.origin, v, v_forward, v_right, left_target); - tr = gi.trace(self.s.origin, self.mins, self.maxs, left_target, self, MASK_PLAYERSOLID); - left = tr.fraction; - - Math3D.VectorSet(v, d2, 16, 0); - Math3D.G_ProjectSource(self.s.origin, v, v_forward, v_right, right_target); - tr = gi.trace(self.s.origin, self.mins, self.maxs, right_target, self, MASK_PLAYERSOLID); - right = tr.fraction; - - center = (d1 * center) / d2; - if (left >= center && left > right) { - if (left < 1) { - Math3D.VectorSet(v, d2 * left * 0.5f, -16f, 0f); - Math3D.G_ProjectSource(self.s.origin, v, v_forward, v_right, left_target); - // gi.dprintf("incomplete path, go part way and adjust again\n"); - } - Math3D.VectorCopy(self.monsterinfo.last_sighting, self.monsterinfo.saved_goal); - self.monsterinfo.aiflags |= AI_PURSUE_TEMP; - Math3D.VectorCopy(left_target, self.goalentity.s.origin); - Math3D.VectorCopy(left_target, self.monsterinfo.last_sighting); - Math3D.VectorSubtract(self.goalentity.s.origin, self.s.origin, v); - self.s.angles[YAW] = self.ideal_yaw = Math3D.vectoyaw(v); - // gi.dprintf("adjusted left\n"); - // debug_drawline(self.origin, self.last_sighting, 152); - } - else if (right >= center && right > left) { - if (right < 1) { - Math3D.VectorSet(v, d2 * right * 0.5f, 16f, 0f); - Math3D.G_ProjectSource(self.s.origin, v, v_forward, v_right, right_target); - // gi.dprintf("incomplete path, go part way and adjust again\n"); - } - Math3D.VectorCopy(self.monsterinfo.last_sighting, self.monsterinfo.saved_goal); - self.monsterinfo.aiflags |= AI_PURSUE_TEMP; - Math3D.VectorCopy(right_target, self.goalentity.s.origin); - Math3D.VectorCopy(right_target, self.monsterinfo.last_sighting); - Math3D.VectorSubtract(self.goalentity.s.origin, self.s.origin, v); - self.s.angles[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"); - } - - M.M_MoveToGoal(self, dist); - - G_FreeEdict(tempgoal); - - if (self != null) - self.goalentity = save; - } - }; - - public static void UpdateChaseCam(edict_t ent) { + public static void UpdateChaseCam(edict_t ent) + { float[] o = { 0, 0, 0 }, ownerv = { 0, 0, 0 }, goal = { 0, 0, 0 }; edict_t targ; float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; @@ -782,10 +331,12 @@ public class GameAI extends M_Flash { float[] angles = { 0, 0, 0 }; // is our chase target gone? - if (!ent.client.chase_target.inuse || ent.client.chase_target.client.resp.spectator) { + if (!ent.client.chase_target.inuse || ent.client.chase_target.client.resp.spectator) + { edict_t old = ent.client.chase_target; ChaseNext(ent); - if (ent.client.chase_target == old) { + if (ent.client.chase_target == old) + { ent.client.chase_target = null; ent.client.ps.pmove.pm_flags &= ~PMF_NO_PREDICTION; return; @@ -823,7 +374,8 @@ public class GameAI extends M_Flash { Math3D.VectorCopy(goal, o); o[2] += 6; trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); - if (trace.fraction < 1) { + if (trace.fraction < 1) + { Math3D.VectorCopy(trace.endpos, goal); goal[2] -= 6; } @@ -831,7 +383,8 @@ public class GameAI extends M_Flash { Math3D.VectorCopy(goal, o); o[2] -= 6; trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); - if (trace.fraction < 1) { + if (trace.fraction < 1) + { Math3D.VectorCopy(trace.endpos, goal); goal[2] += 6; } @@ -845,12 +398,14 @@ public class GameAI extends M_Flash { for (i = 0; i < 3; i++) ent.client.ps.pmove.delta_angles[i] = (short) Math3D.ANGLE2SHORT(targ.client.v_angle[i] - ent.client.resp.cmd_angles[i]); - if (targ.deadflag != 0) { + if (targ.deadflag != 0) + { ent.client.ps.viewangles[ROLL] = 40; ent.client.ps.viewangles[PITCH] = -15; ent.client.ps.viewangles[YAW] = targ.client.killer_yaw; } - else { + else + { Math3D.VectorCopy(targ.client.v_angle, ent.client.ps.viewangles); Math3D.VectorCopy(targ.client.v_angle, ent.client.v_angle); } @@ -860,7 +415,8 @@ public class GameAI extends M_Flash { gi.linkentity(ent); } - public static void ChaseNext(edict_t ent) { + public static void ChaseNext(edict_t ent) + { int i; edict_t e; @@ -868,7 +424,8 @@ public class GameAI extends M_Flash { return; i = ent.client.chase_target.index; - do { + do + { i++; if (i > maxclients.value) i = 1; @@ -885,7 +442,8 @@ public class GameAI extends M_Flash { ent.client.update_chase = true; } - public static void ChasePrev(edict_t ent) { + public static void ChasePrev(edict_t ent) + { int i; edict_t e; @@ -893,7 +451,8 @@ public class GameAI extends M_Flash { return; i = ent.client.chase_target.index; - do { + do + { i--; if (i < 1) i = (int) maxclients.value; @@ -909,13 +468,16 @@ public class GameAI extends M_Flash { ent.client.update_chase = true; } - public static void GetChaseTarget(edict_t ent) { + public static void GetChaseTarget(edict_t ent) + { int i; edict_t other; - for (i = 1; i <= maxclients.value; i++) { + for (i = 1; i <= maxclients.value; i++) + { other = g_edicts[i]; - if (other.inuse && !other.client.resp.spectator) { + if (other.inuse && !other.client.resp.spectator) + { ent.client.chase_target = other; ent.client.update_chase = true; UpdateChaseCam(ent); @@ -932,40 +494,45 @@ public class GameAI extends M_Flash { Called by worldspawn =============== */ - public static void SetItemNames() { + public static void SetItemNames() + { int i; gitem_t it; - for (i = 1; i < game.num_items; i++) { - it = itemlist[i]; + for (i = 1; i < game.num_items; i++) + { + it = GameAI.itemlist[i]; gi.configstring(CS_ITEMS + i, it.pickup_name); } - jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor")); - combat_armor_index = ITEM_INDEX(FindItem("Combat Armor")); - body_armor_index = ITEM_INDEX(FindItem("Body Armor")); - power_screen_index = ITEM_INDEX(FindItem("Power Screen")); - power_shield_index = ITEM_INDEX(FindItem("Power Shield")); + GameUtilAdapters.jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor")); + GameUtilAdapters.combat_armor_index = ITEM_INDEX(FindItem("Combat Armor")); + GameUtilAdapters.body_armor_index = ITEM_INDEX(FindItem("Body Armor")); + GameUtilAdapters.power_screen_index = ITEM_INDEX(FindItem("Power Screen")); + GameUtilAdapters.power_shield_index = ITEM_INDEX(FindItem("Power Shield")); } - public static void SelectNextItem(edict_t ent, int itflags) { + public static void SelectNextItem(edict_t ent, int itflags) + { gclient_t cl; int i, index; gitem_t it; cl = ent.client; - if (cl.chase_target != null) { + if (cl.chase_target != null) + { ChaseNext(ent); return; } // scan for the next valid one - for (i = 1; i <= MAX_ITEMS; i++) { + for (i = 1; i <= MAX_ITEMS; i++) + { index = (cl.pers.selected_item + i) % MAX_ITEMS; if (0 == cl.pers.inventory[index]) continue; - it = itemlist[index]; + it = GameAI.itemlist[index]; if (it.use == null) continue; if (0 == (it.flags & itflags)) @@ -978,24 +545,27 @@ public class GameAI extends M_Flash { cl.pers.selected_item = -1; } - public static void SelectPrevItem(edict_t ent, int itflags) { + public static void SelectPrevItem(edict_t ent, int itflags) + { gclient_t cl; int i, index; gitem_t it; cl = ent.client; - if (cl.chase_target != null) { + if (cl.chase_target != null) + { ChasePrev(ent); return; } // scan for the next valid one - for (i = 1; i <= MAX_ITEMS; i++) { + for (i = 1; i <= MAX_ITEMS; i++) + { index = (cl.pers.selected_item + MAX_ITEMS - i) % MAX_ITEMS; if (0 == cl.pers.inventory[index]) continue; - it = itemlist[index]; + it = GameAI.itemlist[index]; if (null == it.use) continue; if (0 == (it.flags & itflags)) @@ -1008,7 +578,8 @@ public class GameAI extends M_Flash { cl.pers.selected_item = -1; } - public static void ValidateSelectedItem(edict_t ent) { + public static void ValidateSelectedItem(edict_t ent) + { gclient_t cl; cl = ent.client; @@ -1021,7 +592,8 @@ public class GameAI extends M_Flash { //====================================================================== - public static boolean Add_Ammo(edict_t ent, gitem_t item, int count) { + public static boolean Add_Ammo(edict_t ent, gitem_t item, int count) + { int index; int max; @@ -1065,7 +637,8 @@ public class GameAI extends M_Flash { and for each item in each client's inventory. =============== */ - public static void PrecacheItem(gitem_t it) { + public static void PrecacheItem(gitem_t it) + { String s; String data; int len; @@ -1087,7 +660,8 @@ public class GameAI extends M_Flash { gi.imageindex(it.icon); // parse everything for its ammo - if (it.ammo != null && it.ammo.length() != 0) { + if (it.ammo != null && it.ammo.length() != 0) + { ammo = FindItem(it.ammo); if (ammo != it) PrecacheItem(ammo); @@ -1100,8 +674,8 @@ public class GameAI extends M_Flash { StringTokenizer tk = new StringTokenizer(s); - - while (tk.hasMoreTokens()) { + while (tk.hasMoreTokens()) + { data = tk.nextToken(); len = data.length(); @@ -1118,323 +692,11 @@ public class GameAI extends M_Flash { gi.soundindex(data); else if (data.endsWith("pcx")) gi.imageindex(data); - else + else gi.error("PrecacheItem: bad precache string: " + data); } } - public static EntInteractAdapter Pickup_Ammo = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - int oldcount; - int count; - boolean weapon; - - weapon = (ent.item.flags & IT_WEAPON) != 0; - if ((weapon) && ((int) dmflags.value & DF_INFINITE_AMMO) != 0) - count = 1000; - else if (ent.count != 0) - count = ent.count; - else - count = ent.item.quantity; - - oldcount = other.client.pers.inventory[ITEM_INDEX(ent.item)]; - - if (!Add_Ammo(other, ent.item, count)) - return false; - - if (weapon && 0 == oldcount) { - if (other.client.pers.weapon != ent.item - && (0 == deathmatch.value || other.client.pers.weapon == FindItem("blaster"))) - other.client.newweapon = ent.item; - } - - if (0 == (ent.spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch.value != 0)) - SetRespawn(ent, 30); - return true; - } - }; - - public static EntInteractAdapter Pickup_Armor = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - int old_armor_index; - gitem_armor_t oldinfo; - gitem_armor_t newinfo; - int newcount; - float salvage; - int salvagecount; - - // get info on new armor - newinfo = (gitem_armor_t) ent.item.info; - - old_armor_index = ArmorIndex(other); - - // handle armor shards specially - if (ent.item.tag == ARMOR_SHARD) { - if (0 == old_armor_index) - other.client.pers.inventory[jacket_armor_index] = 2; - else - other.client.pers.inventory[old_armor_index] += 2; - } - - // if player has no armor, just use it - else if (0 == old_armor_index) { - other.client.pers.inventory[ITEM_INDEX(ent.item)] = newinfo.base_count; - } - - // use the better armor - else { - // get info on old armor - if (old_armor_index == jacket_armor_index) - oldinfo = jacketarmor_info; - - else if (old_armor_index == combat_armor_index) - oldinfo = combatarmor_info; - - else // (old_armor_index == body_armor_index) - oldinfo = bodyarmor_info; - - if (newinfo.normal_protection > oldinfo.normal_protection) { - // calc new armor values - salvage = oldinfo.normal_protection / newinfo.normal_protection; - salvagecount = (int) salvage * other.client.pers.inventory[old_armor_index]; - newcount = newinfo.base_count + salvagecount; - if (newcount > newinfo.max_count) - newcount = newinfo.max_count; - - // zero count of old armor so it goes away - other.client.pers.inventory[old_armor_index] = 0; - - // change armor to new item with computed value - other.client.pers.inventory[ITEM_INDEX(ent.item)] = newcount; - } - else { - // calc new armor values - salvage = newinfo.normal_protection / oldinfo.normal_protection; - salvagecount = (int) salvage * newinfo.base_count; - newcount = other.client.pers.inventory[old_armor_index] + salvagecount; - if (newcount > oldinfo.max_count) - newcount = oldinfo.max_count; - - // if we're already maxed out then we don't need the new armor - if (other.client.pers.inventory[old_armor_index] >= newcount) - return false; - - // update current armor value - other.client.pers.inventory[old_armor_index] = newcount; - } - } - - if (0 == (ent.spawnflags & DROPPED_ITEM) && (deathmatch.value == 0)) - SetRespawn(ent, 20); - - return true; - } - }; - - public static EntInteractAdapter Pickup_PowerArmor = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - - int quantity; - - quantity = other.client.pers.inventory[ITEM_INDEX(ent.item)]; - - other.client.pers.inventory[ITEM_INDEX(ent.item)]++; - - if (deathmatch.value != 0) { - if (0 == (ent.spawnflags & DROPPED_ITEM)) - SetRespawn(ent, ent.item.quantity); - // auto-use for DM only if we didn't already have one - if (0 == quantity) - ent.item.use.use(other, ent.item); - } - return true; - } - }; - - // ====================================================================== - - public static EntInteractAdapter Pickup_Powerup = new EntInteractAdapter() { - - public boolean interact(edict_t ent, edict_t other) { - int quantity; - - quantity = other.client.pers.inventory[ITEM_INDEX(ent.item)]; - if ((skill.value == 1 && quantity >= 2) || (skill.value >= 2 && quantity >= 1)) - return false; - - if ((coop.value != 0) && (ent.item.flags & IT_STAY_COOP) != 0 && (quantity > 0)) - return false; - - other.client.pers.inventory[ITEM_INDEX(ent.item)]++; - - if (deathmatch.value != 0) { - if (0 == (ent.spawnflags & DROPPED_ITEM)) - SetRespawn(ent, ent.item.quantity); - if (((int) dmflags.value & DF_INSTANT_ITEMS) != 0 - || ((ent.item.use == Use_Quad) && 0 != (ent.spawnflags & DROPPED_PLAYER_ITEM))) { - if ((ent.item.use == Use_Quad) && 0 != (ent.spawnflags & DROPPED_PLAYER_ITEM)) - quad_drop_timeout_hack = (int) ((ent.nextthink - level.time) / FRAMETIME); - - ent.item.use.use(other, ent.item); - } - } - - return true; - } - }; - - public static EntInteractAdapter Pickup_Adrenaline = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - if (deathmatch.value == 0) - other.max_health += 1; - - if (other.health < other.max_health) - other.health = other.max_health; - - if (0 == (ent.spawnflags & DROPPED_ITEM) && (deathmatch.value != 0)) - SetRespawn(ent, ent.item.quantity); - - return true; - - } - }; - - public static EntInteractAdapter Pickup_AncientHead = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - other.max_health += 2; - - if (0 == (ent.spawnflags & DROPPED_ITEM) && (deathmatch.value != 0)) - SetRespawn(ent, ent.item.quantity); - - return true; - } - }; - - public static EntInteractAdapter Pickup_Bandolier = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - gitem_t item; - int index; - - if (other.client.pers.max_bullets < 250) - other.client.pers.max_bullets = 250; - if (other.client.pers.max_shells < 150) - other.client.pers.max_shells = 150; - if (other.client.pers.max_cells < 250) - other.client.pers.max_cells = 250; - if (other.client.pers.max_slugs < 75) - other.client.pers.max_slugs = 75; - - item = FindItem("Bullets"); - if (item != null) { - index = ITEM_INDEX(item); - other.client.pers.inventory[index] += item.quantity; - if (other.client.pers.inventory[index] > other.client.pers.max_bullets) - other.client.pers.inventory[index] = other.client.pers.max_bullets; - } - - item = FindItem("Shells"); - if (item != null) { - index = ITEM_INDEX(item); - other.client.pers.inventory[index] += item.quantity; - if (other.client.pers.inventory[index] > other.client.pers.max_shells) - other.client.pers.inventory[index] = other.client.pers.max_shells; - } - - if (0 == (ent.spawnflags & DROPPED_ITEM) && (deathmatch.value != 0)) - SetRespawn(ent, ent.item.quantity); - - return true; - - } - }; - - public static EntUseAdapter Use_Item = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - ent.svflags &= ~SVF_NOCLIENT; - ent.use = null; - - if ((ent.spawnflags & ITEM_NO_TOUCH) != 0) { - ent.solid = SOLID_BBOX; - ent.touch = null; - } - else { - ent.solid = SOLID_TRIGGER; - ent.touch = Touch_Item; - } - - gi.linkentity(ent); - } - }; - - /* - ================ - droptofloor - ================ - */ - - public static EntThinkAdapter droptofloor = new EntThinkAdapter() { - public boolean think(edict_t ent) { - trace_t tr; - float[] dest = { 0, 0, 0 }; - - float v[]; - - v = Lib.tv(-15, -15, -15); - Math3D.VectorCopy(v, ent.mins); - v = Lib.tv(15, 15, 15); - Math3D.VectorCopy(v, ent.maxs); - - if (ent.model != null) - gi.setmodel(ent, ent.model); - else - gi.setmodel(ent, ent.item.world_model); - ent.solid = SOLID_TRIGGER; - ent.movetype = MOVETYPE_TOSS; - ent.touch = Touch_Item; - - v = Lib.tv(0, 0, -128); - Math3D.VectorAdd(ent.s.origin, v, dest); - - tr = gi.trace(ent.s.origin, ent.mins, ent.maxs, dest, ent, MASK_SOLID); - if (tr.startsolid) { - gi.dprintf("droptofloor: " + ent.classname + " startsolid at " + Lib.vtos(ent.s.origin) + "\n"); - G_FreeEdict(ent); - return true; - } - - Math3D.VectorCopy(tr.endpos, ent.s.origin); - - if (ent.team != null) { - ent.flags &= ~FL_TEAMSLAVE; - ent.chain = ent.teamchain; - ent.teamchain = null; - - ent.svflags |= SVF_NOCLIENT; - ent.solid = SOLID_NOT; - if (ent == ent.teammaster) { - ent.nextthink = level.time + FRAMETIME; - ent.think = DoRespawn; - } - } - - if ((ent.spawnflags & ITEM_NO_TOUCH) != 0) { - ent.solid = SOLID_BBOX; - ent.touch = null; - ent.s.effects &= ~EF_ROTATE; - ent.s.renderfx &= ~RF_GLOW; - } - - if ((ent.spawnflags & ITEM_TRIGGER_SPAWN) != 0) { - ent.svflags |= SVF_NOCLIENT; - ent.solid = SOLID_NOT; - ent.use = Use_Item; - } - - gi.linkentity(ent); - return true; - } - }; - /* ============ SpawnItem @@ -1445,58 +707,74 @@ public class GameAI extends M_Flash { be on an entity that hasn't spawned yet. ============ */ - public static void SpawnItem(edict_t ent, gitem_t item) { + public static void SpawnItem(edict_t ent, gitem_t item) + { PrecacheItem(item); - if (ent.spawnflags != 0) { - if (Lib.strcmp(ent.classname, "key_power_cube") != 0) { + if (ent.spawnflags != 0) + { + if (Lib.strcmp(ent.classname, "key_power_cube") != 0) + { ent.spawnflags = 0; gi.dprintf("" + ent.classname + " at " + Lib.vtos(ent.s.origin) + " has invalid spawnflags set\n"); } } // some items will be prevented in deathmatch - if (deathmatch.value != 0) { - if (((int) dmflags.value & DF_NO_ARMOR) != 0) { - if (item.pickup == Pickup_Armor || item.pickup == Pickup_PowerArmor) { + if (deathmatch.value != 0) + { + if (((int) dmflags.value & DF_NO_ARMOR) != 0) + { + if (item.pickup == GameAIAdapters.Pickup_Armor || item.pickup == GameAIAdapters.Pickup_PowerArmor) + { G_FreeEdict(ent); return; } } - if (((int) dmflags.value & DF_NO_ITEMS) != 0) { - if (item.pickup == Pickup_Powerup) { + if (((int) dmflags.value & DF_NO_ITEMS) != 0) + { + if (item.pickup == GameAIAdapters.Pickup_Powerup) + { G_FreeEdict(ent); return; } } - if (((int) dmflags.value & DF_NO_HEALTH) != 0) { - if (item.pickup == Pickup_Health || item.pickup == Pickup_Adrenaline || item.pickup == Pickup_AncientHead) { + if (((int) dmflags.value & DF_NO_HEALTH) != 0) + { + if (item.pickup == GameUtilAdapters.Pickup_Health + || item.pickup == GameAIAdapters.Pickup_Adrenaline + || item.pickup == GameAIAdapters.Pickup_AncientHead) + { G_FreeEdict(ent); return; } } - if (((int) dmflags.value & DF_INFINITE_AMMO) != 0) { - if ((item.flags == IT_AMMO) || (Lib.strcmp(ent.classname, "weapon_bfg") == 0)) { + if (((int) dmflags.value & DF_INFINITE_AMMO) != 0) + { + if ((item.flags == IT_AMMO) || (Lib.strcmp(ent.classname, "weapon_bfg") == 0)) + { G_FreeEdict(ent); return; } } } - if (coop.value != 0 && (Lib.strcmp(ent.classname, "key_power_cube") == 0)) { + if (coop.value != 0 && (Lib.strcmp(ent.classname, "key_power_cube") == 0)) + { ent.spawnflags |= (1 << (8 + level.power_cubes)); level.power_cubes++; } // don't let them drop items that stay in a coop game - if ((coop.value != 0) && (item.flags & IT_STAY_COOP) != 0) { + if ((coop.value != 0) && (item.flags & IT_STAY_COOP) != 0) + { item.drop = null; } ent.item = item; ent.nextthink = level.time + 2 * FRAMETIME; // items start after other solids - ent.think = droptofloor; + ent.think = GameAIAdapters.droptofloor; ent.s.effects = item.world_model_flags; ent.s.renderfx = RF_GLOW; @@ -1509,7 +787,8 @@ public class GameAI extends M_Flash { Touch_Item =============== */ - public static void Touch_Item(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { + public static void Touch_Item(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) + { boolean taken; if (other.client == null) @@ -1521,7 +800,8 @@ public class GameAI extends M_Flash { taken = ent.item.pickup.interact(ent, other); - if (taken) { + if (taken) + { // flash the screen other.client.bonus_alpha = 0.25f; @@ -1534,7 +814,8 @@ public class GameAI extends M_Flash { if (ent.item.use != null) other.client.pers.selected_item = other.client.ps.stats[STAT_SELECTED_ITEM] = (short) ITEM_INDEX(ent.item); - if (ent.item.pickup == Pickup_Health) { + if (ent.item.pickup == GameUtilAdapters.Pickup_Health) + { if (ent.count == 2) gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0); else if (ent.count == 10) @@ -1544,12 +825,14 @@ public class GameAI extends M_Flash { else // (ent.count == 100) gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0); } - else if (ent.item.pickup_sound != null) { + else if (ent.item.pickup_sound != null) + { gi.sound(other, CHAN_ITEM, gi.soundindex(ent.item.pickup_sound), 1, ATTN_NORM, 0); } } - if (0 == (ent.spawnflags & ITEM_TARGETS_USED)) { + if (0 == (ent.spawnflags & ITEM_TARGETS_USED)) + { G_UseTargets(ent, other); ent.spawnflags |= ITEM_TARGETS_USED; } @@ -1558,7 +841,8 @@ public class GameAI extends M_Flash { return; if (!((coop.value != 0) && (ent.item.flags & IT_STAY_COOP) != 0) - || 0 != (ent.spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM))) { + || 0 != (ent.spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM))) + { if ((ent.flags & FL_RESPAWN) != 0) ent.flags &= ~FL_RESPAWN; else @@ -1571,25 +855,30 @@ public class GameAI extends M_Flash { LookAtKiller ================== */ - public static void LookAtKiller(edict_t self, edict_t inflictor, edict_t attacker) { + public static void LookAtKiller(edict_t self, edict_t inflictor, edict_t attacker) + { float dir[] = { 0, 0, 0 }; edict_t world = g_edicts[0]; - if (attacker != null && attacker != world && attacker != self) { + if (attacker != null && attacker != world && attacker != self) + { Math3D.VectorSubtract(attacker.s.origin, self.s.origin, dir); } - else if (inflictor != null && inflictor != world && inflictor != self) { + else if (inflictor != null && inflictor != world && inflictor != self) + { Math3D.VectorSubtract(inflictor.s.origin, self.s.origin, dir); } - else { + else + { self.client.killer_yaw = self.s.angles[YAW]; return; } if (dir[0] != 0) self.client.killer_yaw = (float) (180 / Math.PI * Math.atan2(dir[1], dir[0])); - else { + else + { self.client.killer_yaw = 0; if (dir[1] > 0) self.client.killer_yaw = 90; @@ -1601,7 +890,8 @@ public class GameAI extends M_Flash { } - public static void TossClientWeapon(edict_t self) { + public static void TossClientWeapon(edict_t self) + { gitem_t item; edict_t drop; boolean quad; @@ -1626,70 +916,29 @@ public class GameAI extends M_Flash { else spread = 0.0f; - if (item != null) { + if (item != null) + { self.client.v_angle[YAW] -= spread; drop = Drop_Item(self, item); self.client.v_angle[YAW] += spread; drop.spawnflags = DROPPED_PLAYER_ITEM; } - if (quad) { + if (quad) + { self.client.v_angle[YAW] += spread; drop = Drop_Item(self, FindItemByClassname("item_quad")); self.client.v_angle[YAW] -= spread; drop.spawnflags |= DROPPED_PLAYER_ITEM; - drop.touch = Touch_Item; + drop.touch = GameUtilAdapters.Touch_Item; drop.nextthink = level.time + (self.client.quad_framenum - level.framenum) * FRAMETIME; - drop.think = G_FreeEdictA; + drop.think = GameUtilAdapters.G_FreeEdictA; } } - public static EntThinkAdapter gib_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.s.frame++; - self.nextthink = level.time + FRAMETIME; - - if (self.s.frame == 10) { - self.think = G_FreeEdictA; - self.nextthink = level.time + 8 + Lib.random() * 10; - } - return true; - } - }; - - public static EntTouchAdapter gib_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - float[] normal_angles = { 0, 0, 0 }, right = { 0, 0, 0 }; - - if (null == self.groundentity) - return; - - self.touch = null; - - if (plane != null) { - gi.sound(self, CHAN_VOICE, gi.soundindex("misc/fhit3.wav"), 1, ATTN_NORM, 0); - - Math3D.vectoangles(plane.normal, normal_angles); - Math3D.AngleVectors(normal_angles, null, right, null); - Math3D.vectoangles(right, self.s.angles); - - if (self.s.modelindex == sm_meat_index) { - self.s.frame++; - self.think = gib_think; - self.nextthink = level.time + FRAMETIME; - } - } - } - }; - - public static EntDieAdapter gib_die = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - G_FreeEdict(self); - } - }; - - public static void ThrowGib(edict_t self, String gibname, int damage, int type) { + public static void ThrowGib(edict_t self, String gibname, int damage, int type) + { edict_t gib; float[] vd = { 0, 0, 0 }; @@ -1710,14 +959,16 @@ public class GameAI extends M_Flash { gib.s.effects |= EF_GIB; gib.flags |= FL_NO_KNOCKBACK; gib.takedamage = DAMAGE_YES; - gib.die = gib_die; + gib.die = GameAIAdapters.gib_die; - if (type == GIB_ORGANIC) { + if (type == GIB_ORGANIC) + { gib.movetype = MOVETYPE_TOSS; - gib.touch = gib_touch; + gib.touch = GameAIAdapters.gib_touch; vscale = 0.5f; } - else { + else + { gib.movetype = MOVETYPE_BOUNCE; vscale = 1.0f; } @@ -1729,13 +980,14 @@ public class GameAI extends M_Flash { gib.avelocity[1] = Lib.random() * 600; gib.avelocity[2] = Lib.random() * 600; - gib.think = G_FreeEdictA; + gib.think = GameUtilAdapters.G_FreeEdictA; gib.nextthink = level.time + 10 + Lib.random() * 10; gi.linkentity(gib); } - public static void ThrowHead(edict_t self, String gibname, int damage, int type) { + public static void ThrowHead(edict_t self, String gibname, int damage, int type) + { float vd[] = { 0, 0, 0 }; float vscale; @@ -1754,14 +1006,16 @@ public class GameAI extends M_Flash { self.flags |= FL_NO_KNOCKBACK; self.svflags &= ~SVF_MONSTER; self.takedamage = DAMAGE_YES; - self.die = gib_die; + self.die = GameAIAdapters.gib_die; - if (type == GIB_ORGANIC) { + if (type == GIB_ORGANIC) + { self.movetype = MOVETYPE_TOSS; - self.touch = gib_touch; + self.touch = GameAIAdapters.gib_touch; vscale = 0.5f; } - else { + else + { self.movetype = MOVETYPE_BOUNCE; vscale = 1.0f; } @@ -1772,13 +1026,14 @@ public class GameAI extends M_Flash { self.avelocity[YAW] = Lib.crandom() * 600f; - self.think = G_FreeEdictA; + self.think = GameUtilAdapters.G_FreeEdictA; self.nextthink = level.time + 10 + Lib.random() * 10; gi.linkentity(self); } - public static void VelocityForDamage(int damage, float[] v) { + public static void VelocityForDamage(int damage, float[] v) + { v[0] = 100.0f * Lib.crandom(); v[1] = 100.0f * Lib.crandom(); v[2] = 200.0f + 100.0f * Lib.random(); @@ -1789,7 +1044,8 @@ public class GameAI extends M_Flash { Math3D.VectorScale(v, 1.2f, v); } - public static void ClipGibVelocity(edict_t ent) { + public static void ClipGibVelocity(edict_t ent) + { if (ent.velocity[0] < -300) ent.velocity[0] = -300; else if (ent.velocity[0] > 300) @@ -1804,15 +1060,18 @@ public class GameAI extends M_Flash { ent.velocity[2] = 500; } - public static void ThrowClientHead(edict_t self, int damage) { + public static void ThrowClientHead(edict_t self, int damage) + { float vd[] = { 0, 0, 0 }; String gibname; - if ((Lib.rand() & 1) != 0) { + if ((Lib.rand() & 1) != 0) + { gibname = "models/objects/gibs/head2/tris.md2"; self.s.skinnum = 1; // second skin is player } - else { + else + { gibname = "models/objects/gibs/skull/tris.md2"; self.s.skinnum = 0; } @@ -1835,11 +1094,12 @@ public class GameAI extends M_Flash { if (self.client != null) // bodies in the queue don't have a client anymore - { + { self.client.anim_priority = ANIM_DEATH; self.client.anim_end = self.s.frame; } - else { + else + { self.think = null; self.nextthink = 0; } @@ -1847,19 +1107,8 @@ public class GameAI extends M_Flash { gi.linkentity(self); } - /* - ================= - debris - ================= - */ - public static EntDieAdapter debris_die = new EntDieAdapter() { - - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - G_FreeEdict(self); - } - }; - - public static void ThrowDebris(edict_t self, String modelname, float speed, float[] origin) { + public static void ThrowDebris(edict_t self, String modelname, float speed, float[] origin) + { edict_t chunk; float[] v = { 0, 0, 0 }; @@ -1875,17 +1124,18 @@ public class GameAI extends M_Flash { chunk.avelocity[0] = Lib.random() * 600; chunk.avelocity[1] = Lib.random() * 600; chunk.avelocity[2] = Lib.random() * 600; - chunk.think = G_FreeEdictA; + chunk.think = GameUtilAdapters.G_FreeEdictA; chunk.nextthink = level.time + 5 + Lib.random() * 5; chunk.s.frame = 0; chunk.flags = 0; chunk.classname = "debris"; chunk.takedamage = DAMAGE_YES; - chunk.die = debris_die; + chunk.die = GameAIAdapters.debris_die; gi.linkentity(chunk); } - public static void BecomeExplosion1(edict_t self) { + public static void BecomeExplosion1(edict_t self) + { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION1); gi.WritePosition(self.s.origin); @@ -1894,7 +1144,8 @@ public class GameAI extends M_Flash { G_FreeEdict(self); } - public static void BecomeExplosion2(edict_t self) { + public static void BecomeExplosion2(edict_t self) + { gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_EXPLOSION2); gi.WritePosition(self.s.origin); @@ -1904,7 +1155,8 @@ public class GameAI extends M_Flash { } /** Returns true, if the players gender flag was set to female .*/ - public static boolean IsFemale(edict_t ent) { + public static boolean IsFemale(edict_t ent) + { char info; if (null == ent.client) @@ -1917,7 +1169,8 @@ public class GameAI extends M_Flash { } /** Returns true, if the players gender flag was neither set to female nor to male.*/ - public static boolean IsNeutral(edict_t ent) { + public static boolean IsNeutral(edict_t ent) + { char info; if (ent.client == null) @@ -1931,7 +1184,8 @@ public class GameAI extends M_Flash { } /** Some reports about the cause of the players death. */ - public static void ClientObituary(edict_t self, edict_t inflictor, edict_t attacker) { + public static void ClientObituary(edict_t self, edict_t inflictor, edict_t attacker) + { int mod; String message; String message2; @@ -1940,13 +1194,15 @@ public class GameAI extends M_Flash { if (coop.value != 0 && attacker.client != null) meansOfDeath |= MOD_FRIENDLY_FIRE; - if (deathmatch.value != 0 || coop.value != 0) { + if (deathmatch.value != 0 || coop.value != 0) + { ff = (meansOfDeath & MOD_FRIENDLY_FIRE) != 0; mod = meansOfDeath & ~MOD_FRIENDLY_FIRE; message = null; message2 = ""; - switch (mod) { + switch (mod) + { case MOD_SUICIDE : message = "suicides"; break; @@ -1984,8 +1240,10 @@ public class GameAI extends M_Flash { message = "was in the wrong place"; break; } - if (attacker == self) { - switch (mod) { + if (attacker == self) + { + switch (mod) + { case MOD_HELD_GRENADE : message = "tried to put the pin back in"; break; @@ -2019,7 +1277,8 @@ public class GameAI extends M_Flash { break; } } - if (message != null) { + if (message != null) + { gi.bprintf(PRINT_MEDIUM, "" + self.client.pers.netname + " " + message + ".\n"); if (deathmatch.value != 0) self.client.resp.score--; @@ -2029,8 +1288,10 @@ public class GameAI extends M_Flash { self.enemy = attacker; - if (attacker != null && attacker.client != null) { - switch (mod) { + if (attacker != null && attacker.client != null) + { + switch (mod) + { case MOD_BLASTER : message = "was blasted by"; break; @@ -2100,11 +1361,13 @@ public class GameAI extends M_Flash { message2 = "'s personal space"; break; } - if (message != null) { + if (message != null) + { gi.bprintf( PRINT_MEDIUM, self.client.pers.netname + " " + message + " " + attacker.client.pers.netname + "" + message2); - if (deathmatch.value != 0) { + if (deathmatch.value != 0) + { if (ff) attacker.client.resp.score--; else @@ -2126,7 +1389,8 @@ public class GameAI extends M_Flash { ================== */ - public static void DeathmatchScoreboardMessage(edict_t ent, edict_t killer) { + public static void DeathmatchScoreboardMessage(edict_t ent, edict_t killer) + { String entry; String string; int stringlength; @@ -2142,16 +1406,19 @@ public class GameAI extends M_Flash { // sort the clients by score total = 0; - for (i = 0; i < game.maxclients; i++) { + for (i = 0; i < game.maxclients; i++) + { cl_ent = g_edicts[1 + i]; if (!cl_ent.inuse || game.clients[i].resp.spectator) continue; score = game.clients[i].resp.score; - for (j = 0; j < total; j++) { + for (j = 0; j < total; j++) + { if (score > sortedscores[j]) break; } - for (k = total; k > j; k--) { + for (k = total; k > j; k--) + { sorted[k] = sorted[k - 1]; sortedscores[k] = sortedscores[k - 1]; } @@ -2163,13 +1430,14 @@ public class GameAI extends M_Flash { // print level name and exit rules string = ""; - stringlength = Lib.strlen(string); + stringlength = string.length(); // add the clients in sorted order if (total > 12) total = 12; - for (i = 0; i < total; i++) { + for (i = 0; i < total; i++) + { cl = game.clients[sorted[i]]; cl_ent = g_edicts[1 + sorted[i]]; @@ -2184,9 +1452,10 @@ public class GameAI extends M_Flash { tag = "tag2"; else tag = null; - if (tag != null) { + if (tag != null) + { entry = "xv " + (x + 32) + " yv " + y + " picn " + tag + " "; - j = Lib.strlen(entry); + j = entry.length(); if (stringlength + j > 1024) break; @@ -2212,7 +1481,7 @@ public class GameAI extends M_Flash { + (level.framenum - cl.resp.enterframe) / 600f + " "; - j = Lib.strlen(entry); + j = entry.length(); if (stringlength + j > 1024) break; @@ -2234,7 +1503,8 @@ public class GameAI extends M_Flash { Note that it isn't that hard to overflow the 1400 byte message limit! ================== */ - public static void DeathmatchScoreboard(edict_t ent) { + public static void DeathmatchScoreboard(edict_t ent) + { DeathmatchScoreboardMessage(ent, ent.enemy); gi.unicast(ent, true); } @@ -2246,7 +1516,8 @@ public class GameAI extends M_Flash { Draw help computer. ================== */ - public static void HelpComputer(edict_t ent) { + public static void HelpComputer(edict_t ent) + { String string; String sk; @@ -2285,125 +1556,12 @@ public class GameAI extends M_Flash { gi.unicast(ent, true); } - public static int player_die_i = 0; - - /* - ================== - player_die - ================== - */ - static EntDieAdapter player_die = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - int n; - - Math3D.VectorClear(self.avelocity); - - self.takedamage = DAMAGE_YES; - self.movetype = MOVETYPE_TOSS; - - self.s.modelindex2 = 0; // remove linked weapon model - - self.s.angles[0] = 0; - self.s.angles[2] = 0; - - self.s.sound = 0; - self.client.weapon_sound = 0; - - self.maxs[2] = -8; - - // self.solid = SOLID_NOT; - self.svflags |= SVF_DEADMONSTER; - - if (self.deadflag == 0) { - self.client.respawn_time = level.time + 1.0f; - LookAtKiller(self, inflictor, attacker); - self.client.ps.pmove.pm_type = PM_DEAD; - ClientObituary(self, inflictor, attacker); - TossClientWeapon(self); - if (deathmatch.value != 0) - Cmd.Help_f(self); // show scores - - // clear inventory - // this is kind of ugly, but it's how we want to handle keys in coop - for (n = 0; n < game.num_items; n++) { - if (coop.value != 0 && (itemlist[n].flags & IT_KEY) != 0) - self.client.resp.coop_respawn.inventory[n] = self.client.pers.inventory[n]; - self.client.pers.inventory[n] = 0; - } - } - - // remove powerups - self.client.quad_framenum = 0; - self.client.invincible_framenum = 0; - self.client.breather_framenum = 0; - self.client.enviro_framenum = 0; - self.flags &= ~FL_POWER_ARMOR; - - if (self.health < -40) { // gib - gi.sound(self, CHAN_BODY, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); - for (n = 0; n < 4; n++) - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); - ThrowClientHead(self, damage); - - self.takedamage = DAMAGE_NO; - } - else { // normal death - if (self.deadflag == 0) { - - player_die_i = (player_die_i + 1) % 3; - // start a death animation - self.client.anim_priority = ANIM_DEATH; - if ((self.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - self.s.frame = M_Player.FRAME_crdeath1 - 1; - self.client.anim_end = M_Player.FRAME_crdeath5; - } - else - switch (player_die_i) { - case 0 : - self.s.frame = M_Player.FRAME_death101 - 1; - self.client.anim_end = M_Player.FRAME_death106; - break; - case 1 : - self.s.frame = M_Player.FRAME_death201 - 1; - self.client.anim_end = M_Player.FRAME_death206; - break; - case 2 : - self.s.frame = M_Player.FRAME_death301 - 1; - self.client.anim_end = M_Player.FRAME_death308; - break; - } - - gi.sound(self, CHAN_VOICE, gi.soundindex("*death" + ((Lib.rand() % 4) + 1) + ".wav"), 1, ATTN_NORM, 0); - } - } - - self.deadflag = DEAD_DEAD; - - gi.linkentity(self); - } - }; - - public static Comparator PlayerSort = new Comparator() { - public int compare(Object o1, Object o2) { - int anum = ((Integer) o1).intValue(); - int bnum = ((Integer) o2).intValue(); - - int anum1 = game.clients[anum].ps.stats[STAT_FRAGS]; - int bnum1 = game.clients[bnum].ps.stats[STAT_FRAGS]; - - if (anum1 < bnum1) - return -1; - if (anum1 > bnum1) - return 1; - return 0; - } - }; - /** * Processes the commands the player enters in the quake console. * */ - public static void ClientCommand(edict_t ent) { + public static void ClientCommand(edict_t ent) + { String cmd; if (ent.client == null) @@ -2411,23 +1569,28 @@ public class GameAI extends M_Flash { cmd = gi.argv(0); - if (Lib.Q_stricmp(cmd, "players") == 0) { + if (Lib.Q_stricmp(cmd, "players") == 0) + { Cmd.Players_f(ent); return; } - if (Lib.Q_stricmp(cmd, "say") == 0) { + if (Lib.Q_stricmp(cmd, "say") == 0) + { Cmd.Say_f(ent, false, false); return; } - if (Lib.Q_stricmp(cmd, "say_team") == 0) { + if (Lib.Q_stricmp(cmd, "say_team") == 0) + { Cmd.Say_f(ent, true, false); return; } - if (Lib.Q_stricmp(cmd, "score") == 0) { + if (Lib.Q_stricmp(cmd, "score") == 0) + { Cmd.Score_f(ent); return; } - if (Lib.Q_stricmp(cmd, "help") == 0) { + if (Lib.Q_stricmp(cmd, "help") == 0) + { Cmd.Help_f(ent); return; } @@ -2437,6 +1600,7 @@ public class GameAI extends M_Flash { if (Lib.Q_stricmp(cmd, "use") == 0) Cmd.Use_f(ent); + else if (Lib.Q_stricmp(cmd, "drop") == 0) Cmd.Drop_f(ent); else if (Lib.Q_stricmp(cmd, "give") == 0) @@ -2483,34 +1647,16 @@ public class GameAI extends M_Flash { Cmd.Say_f(ent, false, true); } - public static ItemUseAdapter Use_PowerArmor = new ItemUseAdapter() { - public void use(edict_t ent, gitem_t item) { - int index; - - if ((ent.flags & FL_POWER_ARMOR) != 0) { - ent.flags &= ~FL_POWER_ARMOR; - gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0); - } - else { - index = ITEM_INDEX(FindItem("cells")); - if (0 == ent.client.pers.inventory[index]) { - gi.cprintf(ent, PRINT_HIGH, "No cells for power armor.\n"); - return; - } - ent.flags |= FL_POWER_ARMOR; - gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0); - } - } - }; - - public static boolean Pickup_PowerArmor(edict_t ent, edict_t other) { + public static boolean Pickup_PowerArmor(edict_t ent, edict_t other) + { int quantity; quantity = other.client.pers.inventory[ITEM_INDEX(ent.item)]; other.client.pers.inventory[ITEM_INDEX(ent.item)]++; - if (deathmatch.value != 0) { + if (deathmatch.value != 0) + { if (0 == (ent.spawnflags & DROPPED_ITEM)) SetRespawn(ent, ent.item.quantity); // auto-use for DM only if we didn't already have one @@ -2521,55 +1667,80 @@ public class GameAI extends M_Flash { return true; } - public static ItemDropAdapter Drop_Ammo = new ItemDropAdapter() { - public void drop(edict_t ent, gitem_t item) { - edict_t dropped; - int index; - - index = ITEM_INDEX(item); - dropped = Drop_Item(ent, item); - if (ent.client.pers.inventory[index] >= item.quantity) - dropped.count = item.quantity; - else - dropped.count = ent.client.pers.inventory[index]; - - if (ent.client.pers.weapon != null - && ent.client.pers.weapon.tag == AMMO_GRENADES - && item.tag == AMMO_GRENADES - && ent.client.pers.inventory[index] - dropped.count <= 0) { - gi.cprintf(ent, PRINT_HIGH, "Can't drop current weapon\n"); - G_FreeEdict(dropped); - return; - } + public static void InitItems() + { + //game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1; + game.num_items = GameAI.itemlist.length - 1; + } - ent.client.pers.inventory[index] -= dropped.count; - ValidateSelectedItem(ent); + /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16) + */ + public static void SP_item_health(edict_t self) + { + if (deathmatch.value != 0 && ((int) dmflags.value & DF_NO_HEALTH) != 0) + { + G_FreeEdict(self); } - }; - public static ItemDropAdapter Drop_General = new ItemDropAdapter() { - public void drop(edict_t ent, gitem_t item) { - Drop_Item(ent, item); - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); + self.model = "models/items/healing/medium/tris.md2"; + self.count = 10; + SpawnItem(self, FindItem("Health")); + gi.soundindex("items/n_health.wav"); + } + + /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16) + */ + static void SP_item_health_small(edict_t self) + { + if (deathmatch.value != 0 && ((int) dmflags.value & DF_NO_HEALTH) != 0) + { + G_FreeEdict(self); + return; } - }; - public static ItemDropAdapter Drop_PowerArmor = new ItemDropAdapter() { - public void drop(edict_t ent, gitem_t item) { - if (0 != (ent.flags & FL_POWER_ARMOR) && (ent.client.pers.inventory[ITEM_INDEX(item)] == 1)) - Use_PowerArmor.use(ent, item); - Drop_General.drop(ent, item); + self.model = "models/items/healing/stimpack/tris.md2"; + self.count = 2; + SpawnItem(self, FindItem("Health")); + self.style = HEALTH_IGNORE_MAX; + gi.soundindex("items/s_health.wav"); + } + + /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16) + */ + static void SP_item_health_large(edict_t self) + { + if (deathmatch.value != 0 && ((int) dmflags.value & DF_NO_HEALTH) != 0) + { + G_FreeEdict(self); + return; } - }; - public static gitem_armor_t jacketarmor_info = new gitem_armor_t(25, 50, .30f, .00f, ARMOR_JACKET); - public static gitem_armor_t combatarmor_info = new gitem_armor_t(50, 100, .60f, .30f, ARMOR_COMBAT); - public static gitem_armor_t bodyarmor_info = new gitem_armor_t(100, 200, .80f, .60f, ARMOR_BODY); + self.model = "models/items/healing/large/tris.md2"; + self.count = 25; + SpawnItem(self, FindItem("Health")); + gi.soundindex("items/l_health.wav"); + } + + /* + * QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) + */ + static void SP_item_health_mega(edict_t self) + { + if (deathmatch.value != 0 && ((int) dmflags.value & DF_NO_HEALTH) != 0) + { + G_FreeEdict(self); + return; + } + self.model = "models/items/mega_h/tris.md2"; + self.count = 100; + SpawnItem(self, FindItem("Health")); + gi.soundindex("items/m_health.wav"); + self.style = HEALTH_IGNORE_MAX | HEALTH_TIMED; + } public static gitem_t itemlist[] = { //leave index 0 alone - null, + new gitem_t(null, null, null, null, null, null, null, 0, null, null, null, 0, 0, null, 0, 0, null, 0, null), // // ARMOR @@ -2578,13 +1749,21 @@ public class GameAI extends M_Flash { /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16) */ - "item_armor_body", Pickup_Armor, null, null, null, "misc/ar1_pkup.wav", "models/items/armor/body/tris.md2", EF_ROTATE, null, + "item_armor_body", + GameAIAdapters.Pickup_Armor, + null, + null, + null, + "misc/ar1_pkup.wav", + "models/items/armor/body/tris.md2", + Defines.EF_ROTATE, + null, /* icon */ "i_bodyarmor", /* pickup */ "Body Armor", /* width */ - 3, 0, null, IT_ARMOR, 0, bodyarmor_info, ARMOR_BODY, + 3, 0, null, Defines.IT_ARMOR, 0, GameAIAdapters.bodyarmor_info, Defines.ARMOR_BODY, /* precache */ ""), @@ -2592,20 +1771,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_armor_combat", - GameAI.Pickup_Armor, + GameAIAdapters.Pickup_Armor, null, null, null, "misc/ar1_pkup.wav", "models/items/armor/combat/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_combatarmor", /* pickup */ "Combat Armor", /* width */ - 3, 0, null, IT_ARMOR, 0, GameAI.combatarmor_info, ARMOR_COMBAT, + 3, 0, null, Defines.IT_ARMOR, 0, GameAIAdapters.combatarmor_info, Defines.ARMOR_COMBAT, /* precache */ ""), @@ -2613,20 +1792,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_armor_jacket", - GameAI.Pickup_Armor, + GameAIAdapters.Pickup_Armor, null, null, null, "misc/ar1_pkup.wav", "models/items/armor/jacket/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_jacketarmor", /* pickup */ "Jacket Armor", /* width */ - 3, 0, null, IT_ARMOR, 0, GameAI.jacketarmor_info, ARMOR_JACKET, + 3, 0, null, Defines.IT_ARMOR, 0, GameAIAdapters.jacketarmor_info, Defines.ARMOR_JACKET, /* precache */ ""), @@ -2634,20 +1813,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_armor_shard", - GameAI.Pickup_Armor, + GameAIAdapters.Pickup_Armor, null, null, null, "misc/ar2_pkup.wav", "models/items/armor/shard/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_jacketarmor", /* pickup */ "Armor Shard", /* width */ - 3, 0, null, IT_ARMOR, 0, null, ARMOR_SHARD, + 3, 0, null, Defines.IT_ARMOR, 0, null, Defines.ARMOR_SHARD, /* precache */ ""), @@ -2655,20 +1834,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_power_screen", - GameAI.Pickup_PowerArmor, - GameAI.Use_PowerArmor, - GameAI.Drop_PowerArmor, + GameAIAdapters.Pickup_PowerArmor, + GameAIAdapters.Use_PowerArmor, + GameAIAdapters.Drop_PowerArmor, null, "misc/ar3_pkup.wav", "models/items/armor/screen/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_powerscreen", /* pickup */ "Power Screen", /* width */ - 0, 60, null, IT_ARMOR, 0, null, 0, + 0, 60, null, Defines.IT_ARMOR, 0, null, 0, /* precache */ ""), @@ -2676,20 +1855,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_power_shield", - Pickup_PowerArmor, - Use_PowerArmor, - Drop_PowerArmor, + GameAIAdapters.Pickup_PowerArmor, + GameAIAdapters.Use_PowerArmor, + GameAIAdapters.Drop_PowerArmor, null, "misc/ar3_pkup.wav", "models/items/armor/shield/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_powershield", /* pickup */ "Power Shield", /* width */ - 0, 60, null, IT_ARMOR, 0, null, 0, + 0, 60, null, Defines.IT_ARMOR, 0, null, 0, /* precache */ "misc/power2.wav misc/power1.wav"), @@ -2713,7 +1892,7 @@ public class GameAI extends M_Flash { /* icon */ "w_blaster", /* pickup */ - "Blaster", 0, 0, null, IT_WEAPON | IT_STAY_COOP, WEAP_BLASTER, null, 0, + "Blaster", 0, 0, null, Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_BLASTER, null, 0, /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"), @@ -2727,12 +1906,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_Shotgun, "misc/w_pkup.wav", "models/weapons/g_shotg/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_shotg/tris.md2", /* icon */ "w_shotgun", /* pickup */ - "Shotgun", 0, 1, "Shells", IT_WEAPON | IT_STAY_COOP, WEAP_SHOTGUN, null, 0, + "Shotgun", 0, 1, "Shells", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_SHOTGUN, null, 0, /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"), @@ -2746,12 +1925,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_SuperShotgun, "misc/w_pkup.wav", "models/weapons/g_shotg2/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_shotg2/tris.md2", /* icon */ "w_sshotgun", /* pickup */ - "Super Shotgun", 0, 2, "Shells", IT_WEAPON | IT_STAY_COOP, WEAP_SUPERSHOTGUN, null, 0, + "Super Shotgun", 0, 2, "Shells", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_SUPERSHOTGUN, null, 0, /* precache */ "weapons/sshotf1b.wav"), @@ -2765,12 +1944,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_Machinegun, "misc/w_pkup.wav", "models/weapons/g_machn/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_machn/tris.md2", /* icon */ "w_machinegun", /* pickup */ - "Machinegun", 0, 1, "Bullets", IT_WEAPON | IT_STAY_COOP, WEAP_MACHINEGUN, null, 0, + "Machinegun", 0, 1, "Bullets", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_MACHINEGUN, null, 0, /* precache */ "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav"), @@ -2784,12 +1963,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_Chaingun, "misc/w_pkup.wav", "models/weapons/g_chain/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_chain/tris.md2", /* icon */ "w_chaingun", /* pickup */ - "Chaingun", 0, 1, "Bullets", IT_WEAPON | IT_STAY_COOP, WEAP_CHAINGUN, null, 0, + "Chaingun", 0, 1, "Bullets", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_CHAINGUN, null, 0, /* precache */ "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav"), @@ -2797,9 +1976,9 @@ public class GameAI extends M_Flash { */ new gitem_t( "ammo_grenades", - Pickup_Ammo, + GameAIAdapters.Pickup_Ammo, GamePWeapon.Use_Weapon, - Drop_Ammo, + GameAIAdapters.Drop_Ammo, GamePWeapon.Weapon_Grenade, "misc/am_pkup.wav", "models/items/ammo/grenades/medium/tris.md2", @@ -2810,7 +1989,7 @@ public class GameAI extends M_Flash { /* pickup */ "Grenades", /* width */ - 3, 5, "grenades", IT_AMMO | IT_WEAPON, WEAP_GRENADES, null, AMMO_GRENADES, + 3, 5, "grenades", Defines.IT_AMMO | Defines.IT_WEAPON, Defines.WEAP_GRENADES, null, Defines.AMMO_GRENADES, /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "), @@ -2824,12 +2003,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_GrenadeLauncher, "misc/w_pkup.wav", "models/weapons/g_launch/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_launch/tris.md2", /* icon */ "w_glauncher", /* pickup */ - "Grenade Launcher", 0, 1, "Grenades", IT_WEAPON | IT_STAY_COOP, WEAP_GRENADELAUNCHER, null, 0, + "Grenade Launcher", 0, 1, "Grenades", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_GRENADELAUNCHER, null, 0, /* precache */ "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav"), @@ -2843,12 +2022,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_RocketLauncher, "misc/w_pkup.wav", "models/weapons/g_rocket/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_rocket/tris.md2", /* icon */ "w_rlauncher", /* pickup */ - "Rocket Launcher", 0, 1, "Rockets", IT_WEAPON | IT_STAY_COOP, WEAP_ROCKETLAUNCHER, null, 0, + "Rocket Launcher", 0, 1, "Rockets", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_ROCKETLAUNCHER, null, 0, /* precache */ "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2"), @@ -2862,12 +2041,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_HyperBlaster, "misc/w_pkup.wav", "models/weapons/g_hyperb/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_hyperb/tris.md2", /* icon */ "w_hyperblaster", /* pickup */ - "HyperBlaster", 0, 1, "Cells", IT_WEAPON | IT_STAY_COOP, WEAP_HYPERBLASTER, null, 0, + "HyperBlaster", 0, 1, "Cells", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_HYPERBLASTER, null, 0, /* precache */ "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav"), @@ -2881,12 +2060,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_Railgun, "misc/w_pkup.wav", "models/weapons/g_rail/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_rail/tris.md2", /* icon */ "w_railgun", /* pickup */ - "Railgun", 0, 1, "Slugs", IT_WEAPON | IT_STAY_COOP, WEAP_RAILGUN, null, 0, + "Railgun", 0, 1, "Slugs", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_RAILGUN, null, 0, /* precache */ "weapons/rg_hum.wav"), @@ -2900,12 +2079,12 @@ public class GameAI extends M_Flash { GamePWeapon.Weapon_BFG, "misc/w_pkup.wav", "models/weapons/g_bfg/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, "models/weapons/v_bfg/tris.md2", /* icon */ "w_bfg", /* pickup */ - "BFG10K", 0, 50, "Cells", IT_WEAPON | IT_STAY_COOP, WEAP_BFG, null, 0, + "BFG10K", 0, 50, "Cells", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_BFG, null, 0, /* precache */ "sprites/s_bfg1.sp2 sprites/s_bfg2.sp2 sprites/s_bfg3.sp2 weapons/bfg__f1y.wav weapons/bfg__l1a.wav weapons/bfg__x1b.wav weapons/bfg_hum.wav"), @@ -2917,9 +2096,9 @@ public class GameAI extends M_Flash { */ new gitem_t( "ammo_shells", - GamePWeapon.Pickup_Ammo, + GameAIAdapters.Pickup_Ammo, null, - GamePWeapon.Drop_Ammo, + GameAIAdapters.Drop_Ammo, null, "misc/am_pkup.wav", "models/items/ammo/shells/medium/tris.md2", @@ -2930,7 +2109,7 @@ public class GameAI extends M_Flash { /* pickup */ "Shells", /* width */ - 3, 10, null, IT_AMMO, 0, null, AMMO_SHELLS, + 3, 10, null, Defines.IT_AMMO, 0, null, Defines.AMMO_SHELLS, /* precache */ ""), @@ -2938,9 +2117,9 @@ public class GameAI extends M_Flash { */ new gitem_t( "ammo_bullets", - GamePWeapon.Pickup_Ammo, + GameAIAdapters.Pickup_Ammo, null, - GamePWeapon.Drop_Ammo, + GameAIAdapters.Drop_Ammo, null, "misc/am_pkup.wav", "models/items/ammo/bullets/medium/tris.md2", @@ -2951,7 +2130,7 @@ public class GameAI extends M_Flash { /* pickup */ "Bullets", /* width */ - 3, 50, null, IT_AMMO, 0, null, AMMO_BULLETS, + 3, 50, null, Defines.IT_AMMO, 0, null, Defines.AMMO_BULLETS, /* precache */ ""), @@ -2959,9 +2138,9 @@ public class GameAI extends M_Flash { */ new gitem_t( "ammo_cells", - GamePWeapon.Pickup_Ammo, + GameAIAdapters.Pickup_Ammo, null, - GamePWeapon.Drop_Ammo, + GameAIAdapters.Drop_Ammo, null, "misc/am_pkup.wav", "models/items/ammo/cells/medium/tris.md2", @@ -2972,7 +2151,7 @@ public class GameAI extends M_Flash { /* pickup */ "Cells", /* width */ - 3, 50, null, IT_AMMO, 0, null, AMMO_CELLS, + 3, 50, null, Defines.IT_AMMO, 0, null, Defines.AMMO_CELLS, /* precache */ ""), @@ -2980,9 +2159,9 @@ public class GameAI extends M_Flash { */ new gitem_t( "ammo_rockets", - GamePWeapon.Pickup_Ammo, + GameAIAdapters.Pickup_Ammo, null, - GamePWeapon.Drop_Ammo, + GameAIAdapters.Drop_Ammo, null, "misc/am_pkup.wav", "models/items/ammo/rockets/medium/tris.md2", @@ -2993,7 +2172,7 @@ public class GameAI extends M_Flash { /* pickup */ "Rockets", /* width */ - 3, 5, null, IT_AMMO, 0, null, AMMO_ROCKETS, + 3, 5, null, Defines.IT_AMMO, 0, null, Defines.AMMO_ROCKETS, /* precache */ ""), @@ -3001,9 +2180,9 @@ public class GameAI extends M_Flash { */ new gitem_t( "ammo_slugs", - GamePWeapon.Pickup_Ammo, + GameAIAdapters.Pickup_Ammo, null, - GamePWeapon.Drop_Ammo, + GameAIAdapters.Drop_Ammo, null, "misc/am_pkup.wav", "models/items/ammo/slugs/medium/tris.md2", @@ -3014,7 +2193,7 @@ public class GameAI extends M_Flash { /* pickup */ "Slugs", /* width */ - 3, 10, null, IT_AMMO, 0, null, AMMO_SLUGS, + 3, 10, null, Defines.IT_AMMO, 0, null, Defines.AMMO_SLUGS, /* precache */ ""), @@ -3025,20 +2204,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_quad", - Pickup_Powerup, - Use_Quad, - Drop_General, + GameAIAdapters.Pickup_Powerup, + GameUtilAdapters.Use_Quad, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/quaddama/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_quad", /* pickup */ "Quad Damage", /* width */ - 2, 60, null, IT_POWERUP, 0, null, 0, + 2, 60, null, Defines.IT_POWERUP, 0, null, 0, /* precache */ "items/damage.wav items/damage2.wav items/damage3.wav"), @@ -3046,20 +2225,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_invulnerability", - Pickup_Powerup, - Use_Invulnerability, - Drop_General, + GameAIAdapters.Pickup_Powerup, + GameUtilAdapters.Use_Invulnerability, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/invulner/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_invulnerability", /* pickup */ "Invulnerability", /* width */ - 2, 300, null, IT_POWERUP, 0, null, 0, + 2, 300, null, Defines.IT_POWERUP, 0, null, 0, /* precache */ "items/protect.wav items/protect2.wav items/protect4.wav"), @@ -3067,20 +2246,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_silencer", - Pickup_Powerup, - Use_Silencer, - Drop_General, + GameAIAdapters.Pickup_Powerup, + GameUtilAdapters.Use_Silencer, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/silencer/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_silencer", /* pickup */ "Silencer", /* width */ - 2, 60, null, IT_POWERUP, 0, null, 0, + 2, 60, null, Defines.IT_POWERUP, 0, null, 0, /* precache */ ""), @@ -3088,20 +2267,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_breather", - Pickup_Powerup, - Use_Breather, - Drop_General, + GameAIAdapters.Pickup_Powerup, + GameUtilAdapters.Use_Breather, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/breather/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_rebreather", /* pickup */ "Rebreather", /* width */ - 2, 60, null, IT_STAY_COOP | IT_POWERUP, 0, null, 0, + 2, 60, null, Defines.IT_STAY_COOP | Defines.IT_POWERUP, 0, null, 0, /* precache */ "items/airout.wav"), @@ -3109,20 +2288,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_enviro", - Pickup_Powerup, - Use_Envirosuit, - Drop_General, + GameAIAdapters.Pickup_Powerup, + GameUtilAdapters.Use_Envirosuit, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/enviro/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_envirosuit", /* pickup */ "Environment Suit", /* width */ - 2, 60, null, IT_STAY_COOP | IT_POWERUP, 0, null, 0, + 2, 60, null, Defines.IT_STAY_COOP | Defines.IT_POWERUP, 0, null, 0, /* precache */ "items/airout.wav"), @@ -3131,13 +2310,13 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_ancient_head", - Pickup_AncientHead, + GameAIAdapters.Pickup_AncientHead, null, null, null, "items/pkup.wav", "models/items/c_head/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_fixme", @@ -3153,13 +2332,13 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_adrenaline", - Pickup_Adrenaline, + GameAIAdapters.Pickup_Adrenaline, null, null, null, "items/pkup.wav", "models/items/adrenal/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_adrenaline", @@ -3174,13 +2353,13 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_bandolier", - Pickup_Bandolier, + GameAIAdapters.Pickup_Bandolier, null, null, null, "items/pkup.wav", "models/items/band/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "p_bandolier", @@ -3195,13 +2374,13 @@ public class GameAI extends M_Flash { */ new gitem_t( "item_pack", - GamePWeapon.Pickup_Pack, + GameUtilAdapters.Pickup_Pack, null, null, null, "items/pkup.wav", "models/items/pack/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_pack", @@ -3220,20 +2399,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_data_cd", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/data_cd/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_datacd", "Data CD", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3245,20 +2424,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_power_cube", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/power/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_powercube", "Power Cube", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3270,20 +2449,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_pyramid", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/pyramid/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_pyramid", "Pyramid Key", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3295,20 +2474,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_data_spinner", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/spinner/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_dataspin", "Data Spinner", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3320,20 +2499,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_pass", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/pass/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_security", "Security Pass", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3345,20 +2524,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_blue_key", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/key/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_bluekey", "Blue Key", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3370,20 +2549,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_red_key", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/red_key/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, "k_redkey", "Red Key", 2, 0, null, - IT_STAY_COOP | IT_KEY, + Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, @@ -3395,20 +2574,20 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_commander_head", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/monsters/commandr/head/tris.md2", - EF_GIB, + Defines.EF_GIB, null, /* icon */ "k_comhead", /* pickup */ "Commander's Head", /* width */ - 2, 0, null, IT_STAY_COOP | IT_KEY, 0, null, 0, + 2, 0, null, Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, /* precache */ ""), @@ -3417,22 +2596,22 @@ public class GameAI extends M_Flash { */ new gitem_t( "key_airstrike_target", - Pickup_Key, + GameUtilAdapters.Pickup_Key, null, - Drop_General, + GameAIAdapters.Drop_General, null, "items/pkup.wav", "models/items/keys/target/tris.md2", - EF_ROTATE, + Defines.EF_ROTATE, null, /* icon */ "i_airstrike", /* pickup */ "Airstrike Marker", /* width */ - 2, 0, null, IT_STAY_COOP | IT_KEY, 0, null, 0, + 2, 0, null, Defines.IT_STAY_COOP | Defines.IT_KEY, 0, null, 0, /* precache */ - ""), new gitem_t(null, Pickup_Health, null, null, null, "items/pkup.wav", null, 0, null, + ""), new gitem_t(null, GameUtilAdapters.Pickup_Health, null, null, null, "items/pkup.wav", null, 0, null, /* icon */ "i_health", /* pickup */ @@ -3444,77 +2623,4 @@ public class GameAI extends M_Flash { // end of list marker null }; - - public static void InitItems() { - //game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1; - game.num_items = itemlist.length - 1; - } - - - - /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16) - */ - public static void SP_item_health (edict_t self) - { - if ( deathmatch.value!=0 && ((int)dmflags.value & DF_NO_HEALTH) !=0) - { - G_FreeEdict (self); - } - - self.model = "models/items/healing/medium/tris.md2"; - self.count = 10; - SpawnItem (self, FindItem ("Health")); - gi.soundindex ("items/n_health.wav"); - } - - /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16) - */ - static void SP_item_health_small (edict_t self) - { - if ( deathmatch.value!=0 && ((int)dmflags.value & DF_NO_HEALTH)!=0) - { - G_FreeEdict (self); - return; - } - - self.model = "models/items/healing/stimpack/tris.md2"; - self.count = 2; - SpawnItem (self, FindItem ("Health")); - self.style = HEALTH_IGNORE_MAX; - gi.soundindex ("items/s_health.wav"); - } - - /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16) - */ - static void SP_item_health_large (edict_t self) - { - if ( deathmatch.value!=0 && ((int)dmflags.value & DF_NO_HEALTH) !=0) - { - G_FreeEdict (self); - return; - } - - self.model = "models/items/healing/large/tris.md2"; - self.count = 25; - SpawnItem (self, FindItem ("Health")); - gi.soundindex ("items/l_health.wav"); - } - - /* - * QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) - */ - static void SP_item_health_mega (edict_t self) - { - if ( deathmatch.value!=0 && ((int)dmflags.value & DF_NO_HEALTH) !=0) - { - G_FreeEdict (self); - return; - } - - self.model = "models/items/mega_h/tris.md2"; - self.count = 100; - SpawnItem (self, FindItem ("Health")); - gi.soundindex ("items/m_health.wav"); - self.style = HEALTH_IGNORE_MAX | HEALTH_TIMED; - } } |