diff options
Diffstat (limited to 'src')
137 files changed, 17738 insertions, 15775 deletions
diff --git a/src/jake2/Defines.java b/src/jake2/Defines.java index 8556e03..26984e9 100644 --- a/src/jake2/Defines.java +++ b/src/jake2/Defines.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: Defines.java,v 1.1 2004-07-07 19:58:31 hzi Exp $ +// $Id: Defines.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ /** Contains the definitions for the game engine. */ @@ -1368,4 +1368,13 @@ public class Defines extends Math3D { public final static String NO_SERVER_STRING = "<no server>"; public final static int NUM_ADDRESSBOOK_ENTRIES = 9; + // // rserr_t + static final int rserr_ok = 0; + + static final int rserr_invalid_fullscreen = 1; + + static final int rserr_invalid_mode = 2; + + static final int rserr_unknown = 3; + } diff --git a/src/jake2/Enum.java b/src/jake2/Enum.java deleted file mode 100644 index cf489fe..0000000 --- a/src/jake2/Enum.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Enum.java - * Copyright (C) 2003 - * - * $Id: Enum.java,v 1.1 2004-07-07 19:58:31 hzi Exp $ - */ - /* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -package jake2; - -/** - * Enum - * - * @author cwei - */ -public interface Enum { - -// // rserr_t - static final int rserr_ok = 0; - static final int rserr_invalid_fullscreen = 1; - static final int rserr_invalid_mode = 2; - static final int rserr_unknown = 3; - -// // and so on -} diff --git a/src/jake2/Globals.java b/src/jake2/Globals.java index 5b2a998..27b6e4a 100644 --- a/src/jake2/Globals.java +++ b/src/jake2/Globals.java @@ -2,77 +2,7 @@ * Globals.java * Copyright (C) 2003 * - * $Id: Globals.java,v 1.1 2004-07-07 19:58:32 hzi Exp $ - * $Log: Globals.java,v $ - * Revision 1.1 2004-07-07 19:58:32 hzi - * Initial revision - * - * Revision 1.1.1.1 2004/07/07 18:35:04 holger - * import of Jake2 version sunrise - * - * Revision 1.46 2004/02/11 19:56:28 cwei - * monster debug. - * - * Revision 1.45 2004/02/11 05:12:47 cwei - * scr_rect wird gesetzt - * - * Revision 1.44 2004/02/08 13:26:13 hoz - * - aufr?umen - * - * Revision 1.43 2004/02/04 11:24:15 hoz - * - some fx functions - * - long -> int for time variables - * - * Revision 1.42 2004/02/02 22:06:54 hoz - * - some client effects - * - * Revision 1.41 2004/02/02 21:15:40 hoz - * input kram - * - * Revision 1.40 2004/02/02 19:25:23 hoz - * *** empty log message *** - * - * Revision 1.39 2004/02/02 19:13:26 rst - * cosmetic - * - * Revision 1.38 2004/01/30 18:44:32 cwei - * logfile - * - * Revision 1.37 2004/01/30 13:34:31 hoz - * - client code - * - * Revision 1.36 2004/01/30 09:24:20 hoz - * - client code - * - * Revision 1.35 2004/01/28 21:04:10 hoz - * - client code - * - * Revision 1.34 2004/01/28 14:42:58 hoz - * - client code - * - * Revision 1.33 2004/01/28 10:03:06 hoz - * - client code - * - * Revision 1.32 2004/01/27 20:10:29 rst - * now has a quake menu - * - * Revision 1.31 2004/01/18 12:36:02 hoz - * Key.* - * - * Revision 1.30 2004/01/18 10:39:34 rst - * M O N S T E R - C O M M I T - * (network and server code) - * - * Revision 1.29 2004/01/18 09:41:57 hoz - * Key.Message() - * - * Revision 1.28 2004/01/11 14:38:47 cwei - * Aenderungen fuer VID impl - * - * Revision 1.27 2004/01/09 22:25:09 rst - * cosmetic - * - * + * $Id: Globals.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -103,6 +33,7 @@ import jake2.render.model_t; import java.io.FileWriter; import java.io.RandomAccessFile; +import java.util.Random; /** * Globals ist the collection of global variables and constants. @@ -113,12 +44,6 @@ import java.io.RandomAccessFile; */ public class Globals extends Defines { - /* - * global constants - */ - - public static final String BUILDSTRING = "Java"; - public static final String CPUSTRING = "jvm"; public static final String __DATE__ = "2003"; public static final float VERSION = 3.21f; @@ -132,23 +57,11 @@ public class Globals extends Defines { public static boolean cmd_wait; public static int alias_count; - public static int com_argc; public static int c_traces; public static int c_brush_traces; public static int c_pointcontents; public static int server_state; - public static String[] com_argv = new String[MAX_NUM_ARGVS]; - - public static cvar_t adr0; - public static cvar_t adr1; - public static cvar_t adr2; - public static cvar_t adr3; - public static cvar_t adr4; - public static cvar_t adr5; - public static cvar_t adr6; - public static cvar_t adr7; - public static cvar_t adr8; public static cvar_t cl_add_blend; public static cvar_t cl_add_entities; public static cvar_t cl_add_lights; @@ -171,6 +84,7 @@ public class Globals extends Defines { public static cvar_t cl_upspeed; public static cvar_t cl_yawspeed; public static cvar_t dedicated; + public static cvar_t slomo; public static cvar_t developer; public static cvar_t fixedtime; public static cvar_t freelook; @@ -446,7 +360,6 @@ public class Globals extends Defines { public static String[] keybindings = new String[256]; public static boolean[] keydown = new boolean[256]; - public static int anykeydown = 0; public static boolean chat_team = false; public static String chat_buffer = ""; public static byte[][] key_lines = new byte[32][]; @@ -459,7 +372,7 @@ public class Globals extends Defines { public static cvar_t crosshair; public static vrect_t scr_vrect = new vrect_t(); - public static long sys_frame_time; + public static int sys_frame_time; public static int chat_bufferlen = 0; public static int gun_frame; public static model_t gun_model; @@ -472,4 +385,6 @@ public class Globals extends Defines { public static cvar_t m_filter; public static int vidref_val = VIDREF_GL; + + public static Random rnd = new Random(); } diff --git a/src/jake2/Jake2.java b/src/jake2/Jake2.java index 8ea4111..70649b2 100644 --- a/src/jake2/Jake2.java +++ b/src/jake2/Jake2.java @@ -2,7 +2,7 @@ * Jake2.java * Copyright (C) 2003 * - * $Id: Jake2.java,v 1.1 2004-07-07 19:58:32 hzi Exp $ + * $Id: Jake2.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -102,7 +102,7 @@ public final class Jake2 { // save cpu resources // try { -// Thread.sleep(5); +// Thread.sleep(1); // } // catch (InterruptedException e) { // } diff --git a/src/jake2/client/CDAudio.java b/src/jake2/client/CDAudio.java deleted file mode 100644 index 49c5c42..0000000 --- a/src/jake2/client/CDAudio.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -// Created on 31.01.2004 by RST. -// $Id: CDAudio.java,v 1.1 2004-07-07 19:58:32 hzi Exp $ - -package jake2.client; - - -// import jake2.*; -// import jake2.client.*; -// import jake2.game.*; -// import jake2.qcommon.*; -// import jake2.render.*; -// import jake2.server.*; - -public class CDAudio { - - public static void CDAudio_Play(int i, boolean b) { - // TODO:implement CDAudio_Play - } - - public static void Stop() { - // TODO impl: CDAudio.Stop() - } -} diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java index 58ce048..3522aa2 100644 --- a/src/jake2/client/CL.java +++ b/src/jake2/client/CL.java @@ -2,7 +2,7 @@ * CL.java * Copyright (C) 2004 * - * $Id: CL.java,v 1.1 2004-07-07 19:58:33 hzi Exp $ + * $Id: CL.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -42,7 +42,16 @@ import java.nio.ByteBuffer; */ public final class CL extends CL_pred { - //// cl_main.c -- client main loop + +// static cvar_t adr0; +// static cvar_t adr1; +// static cvar_t adr2; +// static cvar_t adr3; +// static cvar_t adr4; +// static cvar_t adr5; +// static cvar_t adr6; +// static cvar_t adr7; +// static cvar_t adr8; /* ==================== @@ -91,7 +100,6 @@ public final class CL extends CL_pred { cls.demofile = null; cls.demorecording = false; Com.Printf("Stopped demo.\n"); - } catch (IOException e) { } @@ -107,7 +115,8 @@ public final class CL extends CL_pred { Begins recording a demo from the current position ==================== */ - private static entity_state_t nullstate = new entity_state_t(null); + static entity_state_t nullstate = new entity_state_t(null); + static xcommand_t Record_f = new xcommand_t() { public void execute() { try { @@ -115,7 +124,6 @@ public final class CL extends CL_pred { byte buf_data[] = new byte[MAX_MSGLEN]; sizebuf_t buf = new sizebuf_t(); int i; - int len; entity_state_t ent; if (Cmd.Argc() != 2) { @@ -425,7 +433,7 @@ public final class CL extends CL_pred { if (cls.state >= ca_connected) to = cls.netchan.remote_address; else { - if (strlen(rcon_address.string) == 0) { + if (rcon_address.string.length() == 0) { Com.Printf( "You must either be connected,\nor set the 'rcon_address' cvar\nto issue rcon commands\n"); @@ -1033,7 +1041,7 @@ public final class CL extends CL_pred { int i, n; //char model[MAX_QPATH], skin[MAX_QPATH], * p; - String model, skin, p; + String model, skin; i = (precache_check - CS_PLAYERSKINS) / PLAYER_MULT; n = (precache_check - CS_PLAYERSKINS) % PLAYER_MULT; @@ -1195,7 +1203,7 @@ public final class CL extends CL_pred { CM.intwrap iw = new CM.intwrap(0); // for detecting cheater maps CM.CM_LoadMap(cl.configstrings[CS_MODELS + 1], true, iw); - int mapchecksum = iw.i ; +// int mapchecksum = iw.i ; CL.RegisterSounds(); CL.PrepRefresh(); return; @@ -1221,15 +1229,16 @@ public final class CL extends CL_pred { InitInput(); - adr0 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr1 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr2 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr3 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr4 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr5 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr6 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr7 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr8 = Cvar.Get("adr0", "", CVAR_ARCHIVE); + // never used !! +// adr0 = Cvar.Get("adr0", "", CVAR_ARCHIVE); +// adr1 = Cvar.Get("adr1", "", CVAR_ARCHIVE); +// adr2 = Cvar.Get("adr2", "", CVAR_ARCHIVE); +// adr3 = Cvar.Get("adr3", "", CVAR_ARCHIVE); +// adr4 = Cvar.Get("adr4", "", CVAR_ARCHIVE); +// adr5 = Cvar.Get("adr5", "", CVAR_ARCHIVE); +// adr6 = Cvar.Get("adr6", "", CVAR_ARCHIVE); +// adr7 = Cvar.Get("adr7", "", CVAR_ARCHIVE); +// adr8 = Cvar.Get("adr8", "", CVAR_ARCHIVE); // // register our variables @@ -1367,6 +1376,10 @@ public final class CL extends CL_pred { path = FS.Gamedir() + "/config.cfg"; f = fopen(path, "rw"); + if (f == null) { + Com.Printf("Couldn't write config.cfg.\n"); + return; + } try { f.seek(0); @@ -1374,15 +1387,11 @@ public final class CL extends CL_pred { } catch (IOException e1) {} - if (f == null) { - Com.Printf("Couldn't write config.cfg.\n"); - return; - } try { f.writeBytes("// generated by quake, do not modify\n"); } catch (IOException e) {} - //fprintf (f, "// generated by quake, do not modify\n"); + Key.WriteBindings(f); fclose(f); Cvar.WriteVariables(path); @@ -1430,7 +1439,7 @@ public final class CL extends CL_pred { int i; cheatvar_t var; - if (0 == strcmp(cl.configstrings[CS_MAXCLIENTS], "1") || 0 == cl.configstrings[CS_MAXCLIENTS].length()) + if ("1".equals(cl.configstrings[CS_MAXCLIENTS]) || 0 == cl.configstrings[CS_MAXCLIENTS].length()) return; // single player can cheat // find all the cvars if we haven't done it yet @@ -1444,7 +1453,7 @@ public final class CL extends CL_pred { // make sure they are all set to the proper values for (i = 0; i < numcheatvars; i++) { var = cheatvars[i]; - if (0 != strcmp(var.var.string, var.value)) { + if (!var.var.string.equals(var.value)) { Cvar.Set(var.name, var.value); } } @@ -1485,7 +1494,7 @@ public final class CL extends CL_pred { ================== */ private static int extratime; - private static int lasttimecalled; +// private static int lasttimecalled; public static void Frame(int msec) { @@ -1531,8 +1540,8 @@ public final class CL extends CL_pred { if (!cl.refresh_prepped && cls.state == ca_active) { CL.PrepRefresh(); // TODO force GC after level loading - System.gc(); - System.gc(); + //System.gc(); + //System.gc(); } SCR.UpdateScreen(); diff --git a/src/jake2/client/CL_ents.java b/src/jake2/client/CL_ents.java index 135f3fe..4dc4330 100644 --- a/src/jake2/client/CL_ents.java +++ b/src/jake2/client/CL_ents.java @@ -2,7 +2,7 @@ * CL_ents.java * Copyright (C) 2004 * - * $Id: CL_ents.java,v 1.1 2004-07-07 19:58:35 hzi Exp $ + * $Id: CL_ents.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -36,9 +36,6 @@ import jake2.render.model_t; // cl_ents.c -- entity parsing and management public class CL_ents extends CL_inv { - // PGM - static int vidref_val; - // PGM /* ========================================================================= @@ -591,7 +588,6 @@ public class CL_ents extends CL_inv { public static model_t S_RegisterSexedModel(entity_state_t ent, String base) { int n; - String p; model_t mdl; String model; String buffer; @@ -734,7 +730,8 @@ public class CL_ents extends CL_inv { // tweak the color of beams if ((renderfx & RF_BEAM)!=0) { // the four beam colors are encoded in 32 bits of skinnum (hack) ent.alpha = 0.30f; - ent.skinnum = (s1.skinnum >> ((rand() % 4) * 8)) & 0xff; + ent.skinnum = (s1.skinnum >> ((rnd.nextInt(4)) * 8)) & 0xff; + Math.random(); ent.model = null; } else { @@ -1012,7 +1009,7 @@ public class CL_ents extends CL_inv { else if ((effects & EF_TRAP)!=0) { ent.origin[2] += 32; TrapParticles( ent); - i = (rand() % 100) + 100; + i = (rnd.nextInt(100)) + 100; V.AddLight(ent.origin, i, 1, 0.8f, 0.1f); } else if ((effects & EF_FLAG1)!=0) { @@ -1143,7 +1140,6 @@ public class CL_ents extends CL_inv { static void CalcViewValues() { int i; float lerp, backlerp; - centity_t ent; frame_t oldframe; player_state_t ps, ops; @@ -1163,7 +1159,6 @@ public class CL_ents extends CL_inv { || Math.abs(ops.pmove.origin[2] - ps.pmove.origin[2]) > 256 * 8) ops = ps; // don't interpolate - ent = cl_entities[cl.playernum + 1]; lerp = cl.lerpfrac; // calculate the origin diff --git a/src/jake2/client/CL_fx.java b/src/jake2/client/CL_fx.java index 1ce63ad..86642ee 100644 --- a/src/jake2/client/CL_fx.java +++ b/src/jake2/client/CL_fx.java @@ -2,7 +2,7 @@ * CL_fx.java * Copyright (C) 2004 * - * $Id: CL_fx.java,v 1.1 2004-07-07 19:58:36 hzi Exp $ + * $Id: CL_fx.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -125,7 +125,7 @@ public class CL_fx extends CL_tent { s = cl.configstrings[i + CS_LIGHTS]; - j = strlen(s); + j = s.length(); if (j >= MAX_QPATH) Com.Error(ERR_DROP, "svc_lightstyle length=" + j); @@ -288,9 +288,9 @@ public class CL_fx extends CL_tent { VectorMA(dl.origin, 18, fv, dl.origin); VectorMA(dl.origin, 16, rv, dl.origin); if (silenced != 0) - dl.radius = 100 + (rand() & 31); + dl.radius = 100 + (rnd.nextInt() & 31); else - dl.radius = 200 + (rand() & 31); + dl.radius = 200 + (rnd.nextInt() & 31); dl.minlight = 32; dl.die = cl.time; // + 0.1; @@ -323,7 +323,7 @@ public class CL_fx extends CL_tent { dl.color[1] = 1; dl.color[2] = 0; //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0); break; case MZ_SHOTGUN : @@ -340,41 +340,41 @@ public class CL_fx extends CL_tent { S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0); break; case MZ_CHAINGUN1 : - dl.radius = 200 + (rand() & 31); + dl.radius = 200 + (rnd.nextInt() & 31); dl.color[0] = 1; dl.color[1] = 0.25f; dl.color[2] = 0; //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0); break; case MZ_CHAINGUN2 : - dl.radius = 225 + (rand() & 31); + dl.radius = 225 + (rnd.nextInt() & 31); dl.color[0] = 1; dl.color[1] = 0.5f; dl.color[2] = 0; dl.die = cl.time + 0.1f; // long delay //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0); //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0.05f); break; case MZ_CHAINGUN3 : - dl.radius = 250 + (rand() & 31); + dl.radius = 250 + (rnd.nextInt() & 31); dl.color[0] = 1; dl.color[1] = 1; dl.color[2] = 0; dl.die = cl.time + 0.1f; // long delay //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0); //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0.033f); //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - soundname = "weapons/machgf" + ((rand() % 5) + 1) + "b.wav"; + soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav"; S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0.066f); break; case MZ_RAILGUN : @@ -545,7 +545,7 @@ public class CL_fx extends CL_tent { dl = CL.AllocDlight(ent); VectorCopy(origin, dl.origin); - dl.radius = 200 + (rand() & 31); + dl.radius = 200 + (rnd.nextInt() & 31); dl.minlight = 32; dl.die = cl.time; // + 0.1; @@ -729,7 +729,7 @@ public class CL_fx extends CL_tent { CL.ParticleEffect(origin, vec3_origin, 0, 40); CL.SmokeAndFlash(origin); //Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5); - soundname = "tank/tnkatk2" + (char) ('a' + rand() % 5) + ".wav"; + soundname = "tank/tnkatk2" + (char) ('a' + rnd.nextInt(5)) + ".wav"; S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound(soundname), 1, ATTN_NORM, 0); break; @@ -938,7 +938,7 @@ public class CL_fx extends CL_tent { case MZ2_WIDOW2_BEAM_SWEEP_9 : case MZ2_WIDOW2_BEAM_SWEEP_10 : case MZ2_WIDOW2_BEAM_SWEEP_11 : - dl.radius = 300 + (rand() & 100); + dl.radius = 300 + (rnd.nextInt() & 100); dl.color[0] = 1; dl.color[1] = 1; dl.color[2] = 0; @@ -1848,7 +1848,7 @@ public class CL_fx extends CL_tent { int i; cparticle_t p; float angle; - float sr, sp, sy, cr, cp, cy; + float sp, sy, cp, cy; float [] forward= new float[3]; float dist = 64; float ltime; @@ -1877,8 +1877,6 @@ public class CL_fx extends CL_tent { sp = (float)Math.sin(angle); cp = (float)Math.cos(angle); angle = ltime * avelocities[i][2]; - sr = (float)Math.sin(angle); - cr = (float)Math.cos(angle); forward[0] = cp*cy; forward[1] = cp*sy; @@ -1945,7 +1943,7 @@ public class CL_fx extends CL_tent { int i; cparticle_t p; float angle; - float sr, sp, sy, cr, cp, cy; + float sp, sy, cp, cy; float[] forward = new float[3]; float dist = 64; float[] v = new float[3]; @@ -1968,8 +1966,6 @@ public class CL_fx extends CL_tent { sp = (float)Math.sin(angle); cp = (float)Math.cos(angle); angle = ltime * avelocities[i][2]; - sr = (float)Math.sin(angle); - cr = (float)Math.cos(angle); forward[0] = cp * cy; forward[1] = cp * sy; diff --git a/src/jake2/client/CL_input.java b/src/jake2/client/CL_input.java index 1b6233c..b55b866 100644 --- a/src/jake2/client/CL_input.java +++ b/src/jake2/client/CL_input.java @@ -2,7 +2,7 @@ * CL_input.java * Copyright (C) 2004 * - * $Id: CL_input.java,v 1.1 2004-07-07 19:58:37 hzi Exp $ + * $Id: CL_input.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -341,7 +341,7 @@ public class CL_input extends CL_ents { cmd.buttons |= BUTTON_USE; in_use.state &= ~2; - if (anykeydown != 0 && cls.key_dest == key_game) + if (Key.anykeydown != 0 && cls.key_dest == key_game) cmd.buttons |= BUTTON_ANY; // send milliseconds of time to apply the move @@ -460,8 +460,7 @@ public class CL_input extends CL_ents { Cmd.AddCommand("-klook", new xcommand_t() { public void execute() {IN_KLookUp();}}); - // TODO nodelta - cl_nodelta = Cvar.Get("cl_nodelta", "1",0); + cl_nodelta = Cvar.Get("cl_nodelta", "0",0); } /* diff --git a/src/jake2/client/CL_newfx.java b/src/jake2/client/CL_newfx.java index bfa1c71..67abf81 100644 --- a/src/jake2/client/CL_newfx.java +++ b/src/jake2/client/CL_newfx.java @@ -2,7 +2,7 @@ * CL_newfx.java * Copyright (C) 2004 * - * $Id: CL_newfx.java,v 1.1 2004-07-07 19:58:38 hzi Exp $ + * $Id: CL_newfx.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -229,59 +229,59 @@ public class CL_newfx extends CL_fx { } } - static void FlameEffects(centity_t ent, float[] origin) { - int n, count; - int j; - cparticle_t p; - - count = rand() & 0xF; - - for (n = 0; n < count; n++) { - if (free_particles == null) - return; - - p = free_particles; - free_particles = p.next; - p.next = active_particles; - active_particles = p; - - VectorClear(p.accel); - p.time = cl.time; - - p.alpha = 1.0f; - p.alphavel = -1.0f / (1 + frand() * 0.2f); - p.color = 226 + (rand() % 4); - for (j = 0; j < 3; j++) { - p.org[j] = origin[j] + crand() * 5; - p.vel[j] = crand() * 5; - } - p.vel[2] = crand() * -10; - p.accel[2] = -PARTICLE_GRAVITY; - } - - count = rand() & 0x7; - - for (n = 0; n < count; n++) { - if (free_particles == null) - return; - p = free_particles; - free_particles = p.next; - p.next = active_particles; - active_particles = p; - VectorClear(p.accel); - - p.time = cl.time; - - p.alpha = 1.0f; - p.alphavel = -1.0f / (1 + frand() * 0.5f); - p.color = 0 + (rand() % 4); - for (j = 0; j < 3; j++) { - p.org[j] = origin[j] + crand() * 3; - } - p.vel[2] = 20 + crand() * 5; - } - - } +// static void FlameEffects(centity_t ent, float[] origin) { +// int n, count; +// int j; +// cparticle_t p; +// +// count = rand() & 0xF; +// +// for (n = 0; n < count; n++) { +// if (free_particles == null) +// return; +// +// p = free_particles; +// free_particles = p.next; +// p.next = active_particles; +// active_particles = p; +// +// VectorClear(p.accel); +// p.time = cl.time; +// +// p.alpha = 1.0f; +// p.alphavel = -1.0f / (1 + frand() * 0.2f); +// p.color = 226 + (rand() % 4); +// for (j = 0; j < 3; j++) { +// p.org[j] = origin[j] + crand() * 5; +// p.vel[j] = crand() * 5; +// } +// p.vel[2] = crand() * -10; +// p.accel[2] = -PARTICLE_GRAVITY; +// } +// +// count = rand() & 0x7; +// +// for (n = 0; n < count; n++) { +// if (free_particles == null) +// return; +// p = free_particles; +// free_particles = p.next; +// p.next = active_particles; +// active_particles = p; +// VectorClear(p.accel); +// +// p.time = cl.time; +// +// p.alpha = 1.0f; +// p.alphavel = -1.0f / (1 + frand() * 0.5f); +// p.color = 0 + (rand() % 4); +// for (j = 0; j < 3; j++) { +// p.org[j] = origin[j] + crand() * 3; +// } +// p.vel[2] = 20 + crand() * 5; +// } +// +// } /* diff --git a/src/jake2/client/CL_parse.java b/src/jake2/client/CL_parse.java index e972ea6..d60de21 100644 --- a/src/jake2/client/CL_parse.java +++ b/src/jake2/client/CL_parse.java @@ -2,7 +2,7 @@ * CL_parse.java * Copyright (C) 2004 * - * $Id: CL_parse.java,v 1.1 2004-07-07 19:58:38 hzi Exp $ + * $Id: CL_parse.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -135,8 +135,7 @@ public class CL_parse extends CL_view { MSG.WriteString(cls.netchan.message, "download " + cls.downloadname + " " + len); } else { - // TODO bugfix cwei - cls.downloadname = cls.downloadname.toLowerCase(); + cls.downloadname = cls.downloadname; Com.Printf("Downloading " + cls.downloadname + "\n"); MSG.WriteByte(cls.netchan.message, clc_stringcmd); @@ -166,7 +165,7 @@ public class CL_parse extends CL_view { filename = Cmd.Argv(1); - if (strstr(filename, "..")) { + if (filename.indexOf("..") != -1) { Com.Printf("Refusing to download a path with ..\n"); return; } @@ -183,7 +182,7 @@ public class CL_parse extends CL_view { // to the real name when done, so if interrupted // a runt file wont be left Com.StripExtension(cls.downloadname, cls.downloadtempname); - strcat(cls.downloadtempname, ".tmp"); + cls.downloadtempname += ".tmp"; MSG.WriteByte(cls.netchan.message, clc_stringcmd); MSG.WriteString(cls.netchan.message, "download " + cls.downloadname); @@ -546,14 +545,9 @@ public class CL_parse extends CL_view { // do something apropriate - if (i >= CS_LIGHTS && i < CS_LIGHTS + MAX_LIGHTSTYLES) - { + if (i >= CS_LIGHTS && i < CS_LIGHTS + MAX_LIGHTSTYLES) { SetLightstyle(i - CS_LIGHTS); } - else if (i == CS_CDTRACK) { - if (cl.refresh_prepped) - CDAudio.CDAudio_Play(atoi(cl.configstrings[CS_CDTRACK]), true); - } else if (i >= CS_MODELS && i < CS_MODELS + MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i - CS_MODELS] = re.RegisterModel(cl.configstrings[i]); @@ -572,7 +566,7 @@ public class CL_parse extends CL_view { cl.image_precache[i - CS_IMAGES] = re.RegisterPic(cl.configstrings[i]); } else if (i >= CS_PLAYERSKINS && i < CS_PLAYERSKINS + MAX_CLIENTS) { - if (cl.refresh_prepped && strcmp(olds, s)!=0) + if (cl.refresh_prepped && !olds.equals(s)) ParseClientinfo(i - CS_PLAYERSKINS); } } diff --git a/src/jake2/client/CL_pred.java b/src/jake2/client/CL_pred.java index cc8061f..eecf0eb 100644 --- a/src/jake2/client/CL_pred.java +++ b/src/jake2/client/CL_pred.java @@ -2,7 +2,7 @@ * CL_pred.java * Copyright (C) 2004 * - * $Id: CL_pred.java,v 1.1 2004-07-07 19:58:39 hzi Exp $ + * $Id: CL_pred.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,23 +31,20 @@ import jake2.qcommon.*; /** * CL_pred */ -public class CL_pred extends CL_parse -{ +public class CL_pred extends CL_parse { /* =================== CL_CheckPredictionError =================== */ - static void CheckPredictionError() - { + static void CheckPredictionError() { int frame; int[] delta = new int[3]; int i; int len; - if (cl_predict.value == 0.0f - || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION) != 0) + if (cl_predict.value == 0.0f || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION) != 0) return; // calculate the last usercmd_t we sent that the server has processed @@ -55,31 +52,19 @@ public class CL_pred extends CL_parse frame &= (CMD_BACKUP - 1); // compare what the server returned with what we had predicted it to be - VectorSubtract( - cl.frame.playerstate.pmove.origin, - cl.predicted_origins[frame], - delta); + VectorSubtract(cl.frame.playerstate.pmove.origin, cl.predicted_origins[frame], delta); // save the prediction error for interpolation len = Math.abs(delta[0]) + Math.abs(delta[1]) + Math.abs(delta[2]); if (len > 640) // 80 world units - { // a teleport or something + { // a teleport or something VectorClear(cl.prediction_error); } - else - { - if (cl_showmiss.value != 0.0f - && (delta[0] != 0 || delta[1] != 0 || delta[2] != 0)) - Com.Printf( - "prediction miss on " - + cl.frame.serverframe - + ": " - + (delta[0] + delta[1] + delta[2]) - + "\n"); - - VectorCopy( - cl.frame.playerstate.pmove.origin, - cl.predicted_origins[frame]); + else { + if (cl_showmiss.value != 0.0f && (delta[0] != 0 || delta[1] != 0 || delta[2] != 0)) + Com.Printf("prediction miss on " + cl.frame.serverframe + ": " + (delta[0] + delta[1] + delta[2]) + "\n"); + + VectorCopy(cl.frame.playerstate.pmove.origin, cl.predicted_origins[frame]); // save for error itnerpolation for (i = 0; i < 3; i++) @@ -93,13 +78,7 @@ public class CL_pred extends CL_parse ==================== */ - static void ClipMoveToEntities( - float[] start, - float[] mins, - float[] maxs, - float[] end, - trace_t tr) - { + static void ClipMoveToEntities(float[] start, float[] mins, float[] maxs, float[] end, trace_t tr) { int i, x, zd, zu; trace_t trace; int headnode; @@ -110,8 +89,7 @@ public class CL_pred extends CL_parse float[] bmins = new float[3]; float[] bmaxs = new float[3]; - for (i = 0; i < cl.frame.num_entities; i++) - { + for (i = 0; i < cl.frame.num_entities; i++) { num = (cl.frame.parse_entities + i) & (MAX_PARSE_ENTITIES - 1); ent = cl_parse_entities[num]; @@ -121,16 +99,14 @@ public class CL_pred extends CL_parse if (ent.number == cl.playernum + 1) continue; - if (ent.solid == 31) - { // special value for bmodel + if (ent.solid == 31) { // special value for bmodel cmodel = cl.model_clip[ent.modelindex]; if (cmodel == null) continue; headnode = cmodel.headnode; angles = ent.angles; } - else - { // encoded bbox + else { // encoded bbox x = 8 * (ent.solid & 31); zd = 8 * ((ent.solid >>> 5) & 31); zu = 8 * ((ent.solid >>> 10) & 63) - 32; @@ -147,31 +123,16 @@ public class CL_pred extends CL_parse if (tr.allsolid) return; - trace = - CM.TransformedBoxTrace( - start, - end, - mins, - maxs, - headnode, - MASK_PLAYERSOLID, - ent.origin, - angles); - - if (trace.allsolid - || trace.startsolid - || trace.fraction < tr.fraction) - { - // TODO bugfix cwei - //if (trace.ent == null) trace.ent = new edict_t(0); + trace = CM.TransformedBoxTrace(start, end, mins, maxs, headnode, MASK_PLAYERSOLID, ent.origin, angles); + + if (trace.allsolid || trace.startsolid || trace.fraction < tr.fraction) { trace.ent = ent.surrounding_ent; - if (tr.startsolid) - { - tr = trace; + if (tr.startsolid) { + tr.set(trace); // rst: solved the Z U P P E L - P R O B L E M tr.startsolid = true; } else - tr = trace; + tr.set(trace); // rst: solved the Z U P P E L - P R O B L E M } else if (trace.startsolid) tr.startsolid = true; @@ -183,9 +144,9 @@ public class CL_pred extends CL_parse CL_PMTrace ================ */ - - static edict_t DUMMY_ENT = new edict_t(-1); - + + public static edict_t DUMMY_ENT = new edict_t(-1); + static trace_t PMTrace(float[] start, float[] mins, float[] maxs, float[] end) { trace_t t; @@ -202,8 +163,14 @@ public class CL_pred extends CL_parse return t; } - static int PMpointcontents(float[] point) - { + /* + ================= + PMpointcontents + + Returns the content identificator of the point. + ================= + */ + static int PMpointcontents(float[] point) { int i; entity_state_t ent; int num; @@ -212,8 +179,7 @@ public class CL_pred extends CL_parse contents = CM.PointContents(point, 0); - for (i = 0; i < cl.frame.num_entities; i++) - { + for (i = 0; i < cl.frame.num_entities; i++) { num = (cl.frame.parse_entities + i) & (MAX_PARSE_ENTITIES - 1); ent = cl_parse_entities[num]; @@ -224,14 +190,8 @@ public class CL_pred extends CL_parse if (cmodel == null) continue; - contents - |= CM.TransformedPointContents( - point, - cmodel.headnode, - ent.origin, - ent.angles); + contents |= CM.TransformedPointContents(point, cmodel.headnode, ent.origin, ent.angles); } - return contents; } @@ -242,8 +202,7 @@ public class CL_pred extends CL_parse Sets cl.predicted_origin and cl.predicted_angles ================= */ - static void PredictMovement() - { + static void PredictMovement() { int ack, current; int frame; int oldframe; @@ -259,14 +218,10 @@ public class CL_pred extends CL_parse if (cl_paused.value != 0.0f) return; - if (cl_predict.value == 0.0f - || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION) != 0) - { // just set angles - for (i = 0; i < 3; i++) - { - cl.predicted_angles[i] = - cl.viewangles[i] - + SHORT2ANGLE(cl.frame.playerstate.pmove.delta_angles[i]); + if (cl_predict.value == 0.0f || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION) != 0) { + // just set angles + for (i = 0; i < 3; i++) { + cl.predicted_angles[i] = cl.viewangles[i] + SHORT2ANGLE(cl.frame.playerstate.pmove.delta_angles[i]); } return; } @@ -275,8 +230,7 @@ public class CL_pred extends CL_parse current = cls.netchan.outgoing_sequence; // if we are too far out of date, just freeze - if (current - ack >= CMD_BACKUP) - { + if (current - ack >= CMD_BACKUP) { if (cl_showmiss.value != 0.0f) Com.Printf("exceeded CMD_BACKUP\n"); return; @@ -286,41 +240,32 @@ public class CL_pred extends CL_parse //memset (pm, 0, sizeof(pm)); pm = new pmove_t(); - pm.trace = new pmove_t.TraceAdapter() - { - public trace_t trace( - float[] start, - float[] mins, - float[] maxs, - float[] end) - { + pm.trace = new pmove_t.TraceAdapter() { + public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end) { return CL.PMTrace(start, mins, maxs, end); } }; - pm.pointcontents = new pmove_t.PointContentsAdapter() - { - public int pointcontents(float[] point) - { + pm.pointcontents = new pmove_t.PointContentsAdapter() { + public int pointcontents(float[] point) { return CL.PMpointcontents(point); } }; PMove.pm_airaccelerate = atof(cl.configstrings[CS_AIRACCEL]); - // bugfix (rst) yeah !!!!!!!! found the B E W E G U N G S P R O B L E M. + // bugfix (rst) yeah !!!!!!!! found the solution to the B E W E G U N G S P R O B L E M. pm.s.set(cl.frame.playerstate.pmove); // SCR_DebugGraph (current - ack - 1, 0); frame = 0; // run frames - while (++ack < current) - { + while (++ack < current) { frame = ack & (CMD_BACKUP - 1); cmd = cl.cmds[frame]; - + pm.cmd.set(cmd); - + PMove.Pmove(pm); // save for debug checking @@ -330,8 +275,7 @@ public class CL_pred extends CL_parse oldframe = (ack - 2) & (CMD_BACKUP - 1); oldz = cl.predicted_origins[oldframe][2]; step = pm.s.origin[2] - oldz; - if (step > 63 && step < 160 && (pm.s.pm_flags & PMF_ON_GROUND) != 0) - { + if (step > 63 && step < 160 && (pm.s.pm_flags & PMF_ON_GROUND) != 0) { cl.predicted_step = step * 0.125f; cl.predicted_step_time = (int) (cls.realtime - cls.frametime * 500); } @@ -343,5 +287,4 @@ public class CL_pred extends CL_parse VectorCopy(pm.viewangles, cl.predicted_angles); } - } diff --git a/src/jake2/client/Console.java b/src/jake2/client/Console.java index d37bf5c..11a7a64 100644 --- a/src/jake2/client/Console.java +++ b/src/jake2/client/Console.java @@ -2,7 +2,7 @@ * Con.java * Copyright (C) 2003 * - * $Id: Console.java,v 1.1 2004-07-07 19:58:41 hzi Exp $ + * $Id: Console.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -398,7 +398,6 @@ public final class Console extends Globals { ================ */ static void DrawInput() { - int y; int i; byte[] text; int start = 0; @@ -422,7 +421,7 @@ public final class Console extends Globals { start += 1 + key_linepos - con.linewidth; // draw it - y = con.vislines-16; +// y = con.vislines-16; for (i=0 ; i<con.linewidth ; i++) re.DrawChar ( (i+1)<<3, con.vislines - 22, text[i]); @@ -574,9 +573,7 @@ public final class Console extends Globals { dlbar = cls.downloadname.substring(text); } dlbar += ": "; - i = strlen(dlbar); dlbar += (char)0x80; - i++; // where's the dot go? if (cls.downloadpercent == 0) diff --git a/src/jake2/client/Key.java b/src/jake2/client/Key.java index 33b25a2..2fe8ed3 100644 --- a/src/jake2/client/Key.java +++ b/src/jake2/client/Key.java @@ -2,7 +2,7 @@ * Key.java * Copyright (C) 2003 * - * $Id: Key.java,v 1.1 2004-07-07 19:58:42 hzi Exp $ + * $Id: Key.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -114,6 +114,7 @@ public class Key extends Globals { public static final int K_MWHEELDOWN = 239; public static final int K_MWHEELUP = 240; + static int anykeydown = 0; static int key_waiting; static int history_line = 0; static boolean shift_down = false; @@ -369,12 +370,12 @@ public class Key extends Globals { Globals.keydown[key] = down; if (down) { if (key_repeats[key] == 1) - Globals.anykeydown++; + Key.anykeydown++; } else { - Globals.anykeydown--; - if (Globals.anykeydown < 0) - Globals.anykeydown = 0; + Key.anykeydown--; + if (Key.anykeydown < 0) + Key.anykeydown = 0; } // @@ -586,15 +587,17 @@ public class Key extends Globals { Cbuf.AddText( new String(Globals.key_lines[Globals.edit_line], 1, Lib.strlen(Globals.key_lines[Globals.edit_line]) - 1)); + Cbuf.AddText("\n"); - Com.Printf(new String(Globals.key_lines[Globals.edit_line], 0, Lib.strlen(Globals.key_lines[Globals.edit_line]))); + + Com.Printf(new String(Globals.key_lines[Globals.edit_line], 0, Lib.strlen(Globals.key_lines[Globals.edit_line])) + "\n"); Globals.edit_line = (Globals.edit_line + 1) & 31; history_line = Globals.edit_line; + Globals.key_lines[Globals.edit_line][0] = ']'; Globals.key_linepos = 1; if (Globals.cls.state == Defines.ca_disconnected) - SCR.UpdateScreen(); // force an update, because the command - // may take some time + SCR.UpdateScreen(); // force an update, because the command may take some time return; } @@ -791,7 +794,7 @@ public class Key extends Globals { static void ClearStates() { int i; - anykeydown = 0; + Key.anykeydown = 0; for (i = 0; i < 256; i++) { if (keydown[i] || key_repeats[i]!=0) diff --git a/src/jake2/client/M.java b/src/jake2/client/M.java index ebd9ebd..86747f8 100644 --- a/src/jake2/client/M.java +++ b/src/jake2/client/M.java @@ -2,7 +2,7 @@ * M.java * Copyright (C) 2003 * - * $Id: M.java,v 1.1 2004-07-07 19:58:42 hzi Exp $ + * $Id: M.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -27,6 +27,7 @@ package jake2.client; import jake2.Defines; import jake2.game.*; +import jake2.qcommon.Com; import jake2.server.SV; import jake2.util.Lib; import jake2.util.Math3D; @@ -34,16 +35,19 @@ import jake2.util.Math3D; /** * M */ -public final class M { +public final class M +{ - public static void M_CheckGround(edict_t ent) { + public static void M_CheckGround(edict_t ent) + { float[] point = { 0, 0, 0 }; trace_t trace; if ((ent.flags & (Defines.FL_SWIM | Defines.FL_FLY)) != 0) return; - if (ent.velocity[2] > 100) { + if (ent.velocity[2] > 100) + { ent.groundentity = null; return; } @@ -56,7 +60,8 @@ public final class M { trace = GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, point, ent, Defines.MASK_MONSTERSOLID); // check steepness - if (trace.plane.normal[2] < 0.7 && !trace.startsolid) { + if (trace.plane.normal[2] < 0.7 && !trace.startsolid) + { ent.groundentity = null; return; } @@ -65,7 +70,8 @@ public final class M { // ent.groundentity_linkcount = trace.ent.linkcount; // if (!trace.startsolid && !trace.allsolid) // VectorCopy (trace.endpos, ent.s.origin); - if (!trace.startsolid && !trace.allsolid) { + if (!trace.startsolid && !trace.allsolid) + { Math3D.VectorCopy(trace.endpos, ent.s.origin); ent.groundentity = trace.ent; ent.groundentity_linkcount = trace.ent.linkcount; @@ -73,7 +79,8 @@ public final class M { } } - public static boolean M_CheckBottom(edict_t ent) { + public static boolean M_CheckBottom(edict_t ent) + { float[] mins = { 0, 0, 0 }; float[] maxs = { 0, 0, 0 }; float[] start = { 0, 0, 0 }; @@ -91,10 +98,12 @@ public final class M { // the corners must be within 16 of the midpoint start[2] = mins[2] - 1; for (x = 0; x <= 1; x++) - for (y = 0; y <= 1; y++) { + for (y = 0; y <= 1; y++) + { start[0] = x != 0 ? maxs[0] : mins[0]; start[1] = y != 0 ? maxs[1] : mins[1]; - if (GameBase.gi.pointcontents.pointcontents(start) != Defines.CONTENTS_SOLID) { + if (GameBase.gi.pointcontents.pointcontents(start) != Defines.CONTENTS_SOLID) + { GameBase.c_no++; // // check it for real... @@ -113,7 +122,8 @@ public final class M { // the corners must be within 16 of the midpoint for (x = 0; x <= 1; x++) - for (y = 0; y <= 1; y++) { + for (y = 0; y <= 1; y++) + { start[0] = stop[0] = x != 0 ? maxs[0] : mins[0]; start[1] = stop[1] = y != 0 ? maxs[1] : mins[1]; @@ -146,8 +156,9 @@ public final class M { M_ChangeYaw =============== - *///ok - public static void M_ChangeYaw(edict_t ent) { + */ //ok + public static void M_ChangeYaw(edict_t ent) + { float ideal; float current; float move; @@ -161,19 +172,23 @@ public final class M { move = ideal - current; speed = ent.yaw_speed; - if (ideal > current) { + if (ideal > current) + { if (move >= 180) move = move - 360; } - else { + else + { if (move <= -180) move = move + 360; } - if (move > 0) { + if (move > 0) + { if (move > speed) move = speed; } - else { + else + { if (move < -speed) move = -speed; } @@ -185,8 +200,9 @@ public final class M { ====================== M_MoveToGoal ====================== - */ - public static void M_MoveToGoal(edict_t ent, float dist) { + */ // ok + public static void M_MoveToGoal(edict_t ent, float dist) + { edict_t goal = ent.goalentity; if (ent.groundentity == null && (ent.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == 0) @@ -197,7 +213,8 @@ public final class M { return; // bump around... - if ((Lib.rand() & 3) == 1 || !SV.SV_StepDirection(ent, ent.ideal_yaw, dist)) { + if ((Lib.rand() & 3) == 1 || !SV.SV_StepDirection(ent, ent.ideal_yaw, dist)) + { if (ent.inuse) SV.SV_NewChaseDir(ent, goal, dist); } @@ -208,7 +225,8 @@ public final class M { M_walkmove =============== */ - public static boolean M_walkmove(edict_t ent, float yaw, float dist) { + public static boolean M_walkmove(edict_t ent, float yaw, float dist) + { float[] move = { 0, 0, 0 }; if ((ent.groundentity == null) && (ent.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == 0) @@ -223,7 +241,8 @@ public final class M { return SV.SV_movestep(ent, move, true); } - public static void M_CatagorizePosition(edict_t ent) { + public static void M_CatagorizePosition(edict_t ent) + { float[] point = { 0, 0, 0 }; int cont; @@ -235,7 +254,8 @@ public final class M { point[2] = ent.s.origin[2] + ent.mins[2] + 1; cont = Game.gi.pointcontents.pointcontents(point); - if (0 == (cont & Defines.MASK_WATER)) { + if (0 == (cont & Defines.MASK_WATER)) + { ent.waterlevel = 0; ent.watertype = 0; return; @@ -255,17 +275,23 @@ public final class M { ent.waterlevel = 3; } - public static void M_WorldEffects(edict_t ent) { + public static void M_WorldEffects(edict_t ent) + { int dmg; - if (ent.health > 0) { - if (0 == (ent.flags & Defines.FL_SWIM)) { - if (ent.waterlevel < 3) { + if (ent.health > 0) + { + if (0 == (ent.flags & Defines.FL_SWIM)) + { + if (ent.waterlevel < 3) + { ent.air_finished = GameBase.level.time + 12; } - else if (ent.air_finished < GameBase.level.time) { + else if (ent.air_finished < GameBase.level.time) + { // drown! - if (ent.pain_debounce_time < GameBase.level.time) { + if (ent.pain_debounce_time < GameBase.level.time) + { dmg = (int) (2f + 2f * Math.floor(GameBase.level.time - ent.air_finished)); if (dmg > 15) dmg = 15; @@ -284,13 +310,17 @@ public final class M { } } } - else { - if (ent.waterlevel > 0) { + else + { + if (ent.waterlevel > 0) + { ent.air_finished = GameBase.level.time + 9; } - else if (ent.air_finished < GameBase.level.time) { + else if (ent.air_finished < GameBase.level.time) + { // suffocate! - if (ent.pain_debounce_time < GameBase.level.time) { + if (ent.pain_debounce_time < GameBase.level.time) + { dmg = (int) (2 + 2 * Math.floor(GameBase.level.time - ent.air_finished)); if (dmg > 15) dmg = 15; @@ -311,16 +341,20 @@ public final class M { } } - if (ent.waterlevel == 0) { - if ((ent.flags & Defines.FL_INWATER) != 0) { + if (ent.waterlevel == 0) + { + if ((ent.flags & Defines.FL_INWATER) != 0) + { GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi.soundindex("player/watr_out.wav"), 1, Defines.ATTN_NORM, 0); ent.flags &= ~Defines.FL_INWATER; } return; } - if ((ent.watertype & Defines.CONTENTS_LAVA) != 0 && 0 == (ent.flags & Defines.FL_IMMUNE_LAVA)) { - if (ent.damage_debounce_time < GameBase.level.time) { + if ((ent.watertype & Defines.CONTENTS_LAVA) != 0 && 0 == (ent.flags & Defines.FL_IMMUNE_LAVA)) + { + if (ent.damage_debounce_time < GameBase.level.time) + { ent.damage_debounce_time = GameBase.level.time + 0.2f; GameUtil.T_Damage( ent, @@ -335,8 +369,10 @@ public final class M { Defines.MOD_LAVA); } } - if ((ent.watertype & Defines.CONTENTS_SLIME) != 0 && 0 == (ent.flags & Defines.FL_IMMUNE_SLIME)) { - if (ent.damage_debounce_time < GameBase.level.time) { + if ((ent.watertype & Defines.CONTENTS_SLIME) != 0 && 0 == (ent.flags & Defines.FL_IMMUNE_SLIME)) + { + if (ent.damage_debounce_time < GameBase.level.time) + { ent.damage_debounce_time = GameBase.level.time + 1; GameUtil.T_Damage( ent, @@ -352,8 +388,10 @@ public final class M { } } - if (0 == (ent.flags & Defines.FL_INWATER)) { - if (0 == (ent.svflags & Defines.SVF_DEADMONSTER)) { + if (0 == (ent.flags & Defines.FL_INWATER)) + { + if (0 == (ent.svflags & Defines.SVF_DEADMONSTER)) + { if ((ent.watertype & Defines.CONTENTS_LAVA) != 0) if (Lib.random() <= 0.5) GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi.soundindex("player/lava1.wav"), 1, Defines.ATTN_NORM, 0); @@ -370,8 +408,10 @@ public final class M { } } - public static EntThinkAdapter M_droptofloor = new EntThinkAdapter() { - public boolean think(edict_t ent) { + public static EntThinkAdapter M_droptofloor = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { float[] end = { 0, 0, 0 }; trace_t trace; @@ -393,11 +433,13 @@ public final class M { } }; - public static void M_SetEffects(edict_t ent) { + public static void M_SetEffects(edict_t ent) + { ent.s.effects &= ~(Defines.EF_COLOR_SHELL | Defines.EF_POWERSCREEN); ent.s.renderfx &= ~(Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE); - if ((ent.monsterinfo.aiflags & Defines.AI_RESURRECTING) != 0) { + if ((ent.monsterinfo.aiflags & Defines.AI_RESURRECTING) != 0) + { ent.s.effects |= Defines.EF_COLOR_SHELL; ent.s.renderfx |= Defines.RF_SHELL_RED; } @@ -405,19 +447,24 @@ public final class M { if (ent.health <= 0) return; - if (ent.powerarmor_time > GameBase.level.time) { - if (ent.monsterinfo.power_armor_type == Defines.POWER_ARMOR_SCREEN) { + if (ent.powerarmor_time > GameBase.level.time) + { + if (ent.monsterinfo.power_armor_type == Defines.POWER_ARMOR_SCREEN) + { ent.s.effects |= Defines.EF_POWERSCREEN; } - else if (ent.monsterinfo.power_armor_type == Defines.POWER_ARMOR_SHIELD) { + else if (ent.monsterinfo.power_armor_type == Defines.POWER_ARMOR_SHIELD) + { ent.s.effects |= Defines.EF_COLOR_SHELL; ent.s.renderfx |= Defines.RF_SHELL_GREEN; } } }; - public static void M_MoveFrame(edict_t self) { - mmove_t move; + //ok + public static void M_MoveFrame(edict_t self) + { + mmove_t move; //ptr int index; move = self.monsterinfo.currentmove; @@ -425,13 +472,17 @@ public final class M { if ((self.monsterinfo.nextframe != 0) && (self.monsterinfo.nextframe >= move.firstframe) - && (self.monsterinfo.nextframe <= move.lastframe)) { + && (self.monsterinfo.nextframe <= move.lastframe)) + { self.s.frame = self.monsterinfo.nextframe; self.monsterinfo.nextframe = 0; } - else { - if (self.s.frame == move.lastframe) { - if (move.endfunc != null) { + else + { + if (self.s.frame == move.lastframe) + { + if (move.endfunc != null) + { move.endfunc.think(self); // regrab move, endfunc is very likely to change it @@ -443,12 +494,15 @@ public final class M { } } - if (self.s.frame < move.firstframe || self.s.frame > move.lastframe) { + if (self.s.frame < move.firstframe || self.s.frame > move.lastframe) + { self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; self.s.frame = move.firstframe; } - else { - if (0 == (self.monsterinfo.aiflags & Defines.AI_HOLD_FRAME)) { + else + { + if (0 == (self.monsterinfo.aiflags & Defines.AI_HOLD_FRAME)) + { self.s.frame++; if (self.s.frame > move.lastframe) self.s.frame = move.firstframe; @@ -467,7 +521,8 @@ public final class M { move.frame[index].think.think(self); } - public static void M_ReactToDamage(edict_t targ, edict_t attacker) { + public static void M_ReactToDamage(edict_t targ, edict_t attacker) + { if ((null != attacker.client) && 0 != (attacker.svflags & Defines.SVF_MONSTER)) return; @@ -476,7 +531,8 @@ public final class M { // if we are a good guy monster and our attacker is a player // or another good guy, do not get mad at them - if (0 != (targ.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) { + if (0 != (targ.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) + { if (attacker.client != null || (attacker.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) return; } @@ -484,20 +540,23 @@ public final class M { // we now know that we are not both good guys // if attacker is a client, get mad at them because he's good and we're not - if (attacker.client != null) { + if (attacker.client != null) + { targ.monsterinfo.aiflags &= ~Defines.AI_SOUND_TARGET; // this can only happen in coop (both new and old enemies are clients) // only switch if can't see the current enemy - if (targ.enemy != null && targ.enemy.client != null) { - if (GameUtil.visible(targ, targ.enemy)) { + if (targ.enemy != null && targ.enemy.client != null) + { + if (GameUtil.visible(targ, targ.enemy)) + { targ.oldenemy = attacker; return; } targ.oldenemy = targ.enemy; } targ.enemy = attacker; - if (0 != (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) + if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) GameUtil.FoundTarget(targ); return; } @@ -509,7 +568,8 @@ public final class M { && (Lib.strcmp(attacker.classname, "monster_tank") != 0) && (Lib.strcmp(attacker.classname, "monster_supertank") != 0) && (Lib.strcmp(attacker.classname, "monster_makron") != 0) - && (Lib.strcmp(attacker.classname, "monster_jorg") != 0)) { + && (Lib.strcmp(attacker.classname, "monster_jorg") != 0)) + { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker; @@ -517,7 +577,8 @@ public final class M { GameUtil.FoundTarget(targ); } // if they *meant* to shoot us, then shoot back - else if (attacker.enemy == targ) { + else if (attacker.enemy == targ) + { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker; @@ -525,7 +586,8 @@ public final class M { GameUtil.FoundTarget(targ); } // otherwise get mad at whoever they are mad at (help our buddy) unless it is us! - else if (attacker.enemy != null && attacker.enemy != targ) { + else if (attacker.enemy != null && attacker.enemy != targ) + { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker.enemy; @@ -534,16 +596,20 @@ public final class M { } } /** Stops the Flies. */ - public static EntThinkAdapter M_FliesOff = new EntThinkAdapter() { - public boolean think(edict_t self) { + public static EntThinkAdapter M_FliesOff = new EntThinkAdapter() + { + public boolean think(edict_t self) + { self.s.effects &= ~Defines.EF_FLIES; self.s.sound = 0; return true; } }; /** Starts the Flies as setting the animation flag in the entity. */ - public static EntThinkAdapter M_FliesOn = new EntThinkAdapter() { - public boolean think(edict_t self) { + public static EntThinkAdapter M_FliesOn = new EntThinkAdapter() + { + public boolean think(edict_t self) + { if (self.waterlevel != 0) return true; @@ -555,8 +621,10 @@ public final class M { } }; /** Adds some flies after a random time */ - public static EntThinkAdapter M_FlyCheck = new EntThinkAdapter() { - public boolean think(edict_t self) { + public static EntThinkAdapter M_FlyCheck = new EntThinkAdapter() + { + public boolean think(edict_t self) + { if (self.waterlevel != 0) return true; @@ -569,5 +637,4 @@ public final class M { return true; } }; - } diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java index 264d38f..8ac689f 100644 --- a/src/jake2/client/Menu.java +++ b/src/jake2/client/Menu.java @@ -2,7 +2,7 @@ * Menu.java * Copyright (C) 2004 * - * $Id: Menu.java,v 1.1 2004-07-07 19:58:51 hzi Exp $ + * $Id: Menu.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -90,9 +90,8 @@ public final class Menu extends Key { } - static class mcallback { - public void execute(Object self) { - } + abstract static class mcallback { + abstract public void execute(Object self); } static class menucommon_s { @@ -149,8 +148,6 @@ public final class Menu extends Key { public static int m_menudepth; static void Banner(String name) { - int w, h; - Dimension dim = new Dimension(); Globals.re.DrawGetPicSize(dim, name); @@ -723,7 +720,6 @@ public final class Menu extends Key { static void UnbindCommand(String command) { int j; - int l; String b; for (j = 0; j < 256; j++) { @@ -738,7 +734,6 @@ public final class Menu extends Key { static void FindKeysForCommand(String command, int twokeys[]) { int count; int j; - int l; String b; twokeys[0] = twokeys[1] = -1; @@ -782,7 +777,7 @@ public final class Menu extends Key { Menu_DrawString(a.x + a.parent.x + 16, a.y + a.parent.y, name); - x = strlen(name) * 8; + x = name.length() * 8; if (keys[1] != -1) { Menu_DrawString(a.x + a.parent.x + 24 + x, a.y + a.parent.y, "or"); @@ -2023,7 +2018,7 @@ public final class Menu extends Key { for (j = 0; j + stringoffset < credits[i].length(); j++) { int x; - x = (viddef.width - strlen(credits[i]) * 8 - stringoffset * 8) / 2 + (j + stringoffset) * 8; + x = (viddef.width - credits[i].length() * 8 - stringoffset * 8) / 2 + (j + stringoffset) * 8; if (bold) re.DrawChar(x, y, credits[i].charAt(j + stringoffset) + 128); @@ -2057,8 +2052,6 @@ public final class Menu extends Key { }; static void Menu_Credits_f() { int n; - int count; - String p; int isdeveloper = 0; byte b[] = FS.LoadFile("credits"); @@ -2811,10 +2804,8 @@ public final class Menu extends Key { // ======= byte[] buffer = null; - //char mapsname[1024]; String mapsname; String s; - int length; int i; RandomAccessFile fp; @@ -4061,7 +4052,7 @@ public final class Menu extends Key { s_player_name_field.length = 20; s_player_name_field.visible_length = 20; s_player_name_field.buffer = new StringBuffer(name.string); - s_player_name_field.cursor = strlen(name.string); + s_player_name_field.cursor = name.string.length(); s_player_model_title.type = MTYPE_SEPARATOR; s_player_model_title.name = "model"; @@ -4747,7 +4738,7 @@ public final class Menu extends Key { public static void Menu_DrawStatusBar(String string) { if (string != null) { - int l = strlen(string); + int l = string.length(); int maxrow = viddef.height / 8; int maxcol = viddef.width / 8; int col = maxcol / 2 - l / 2; @@ -4763,7 +4754,7 @@ public final class Menu extends Key { public static void Menu_DrawString(int x, int y, String string) { int i; - for (i = 0; i < strlen(string); i++) { + for (i = 0; i < string.length(); i++) { re.DrawChar((x + i * 8), y, string.charAt(i)); } } @@ -4771,7 +4762,7 @@ public final class Menu extends Key { public static void Menu_DrawStringDark(int x, int y, String string) { int i; - for (i = 0; i < strlen(string); i++) { + for (i = 0; i < string.length(); i++) { re.DrawChar((x + i * 8), y, string.charAt(i) + 128); } } @@ -4779,16 +4770,18 @@ public final class Menu extends Key { public static void Menu_DrawStringR2L(int x, int y, String string) { int i; - for (i = 0; i < strlen(string); i++) { - re.DrawChar((x - i * 8), y, string.charAt(strlen(string) - i - 1)); + int l = string.length(); + for (i = 0; i < l; i++) { + re.DrawChar((x - i * 8), y, string.charAt(l - i - 1)); } } public static void Menu_DrawStringR2LDark(int x, int y, String string) { int i; - for (i = 0; i < strlen(string); i++) { - re.DrawChar((x - i * 8), y, string.charAt(strlen(string) - i - 1) + 128); + int l = string.length(); + for (i = 0; i < l; i++) { + re.DrawChar((x - i * 8), y, string.charAt(l - i - 1) + 128); } } diff --git a/src/jake2/client/SCR.java b/src/jake2/client/SCR.java index 9755008..8363f6e 100644 --- a/src/jake2/client/SCR.java +++ b/src/jake2/client/SCR.java @@ -2,9 +2,9 @@ * SCR.java * Copyright (C) 2003 * - * $Id: SCR.java,v 1.1 2004-07-07 19:58:51 hzi Exp $ + * $Id: SCR.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ - /* +/* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - package jake2.client; import jake2.Globals; @@ -39,17 +38,15 @@ import java.awt.Dimension; /** * SCR */ -public final class SCR extends Globals { +public final class SCR extends Globals +{ // cl_scrn.c -- master for refresh, status bar, console, chat, notify, etc - - static String[][] sb_nums = - { - {"num_0", "num_1", "num_2", "num_3", "num_4", "num_5", - "num_6", "num_7", "num_8", "num_9", "num_minus"}, - {"anum_0", "anum_1", "anum_2", "anum_3", "anum_4", "anum_5", - "anum_6", "anum_7", "anum_8", "anum_9", "anum_minus"} - }; + + static String[][] sb_nums = + { { "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_minus" }, { + "anum_0", "anum_1", "anum_2", "anum_3", "anum_4", "anum_5", "anum_6", "anum_7", "anum_8", "anum_9", "anum_minus" } + }; /* full screen console @@ -58,14 +55,14 @@ public final class SCR extends Globals { blanked background with menu cinematics full screen image for quit and victory - + end of unit intermissions */ - static float scr_con_current; // aproaches scr_conlines at scr_conspeed - static float scr_conlines; // 0.0 to 1.0 lines of console to display + static float scr_con_current; // aproaches scr_conlines at scr_conspeed + static float scr_conlines; // 0.0 to 1.0 lines of console to display - static boolean scr_initialized; // ready to draw + static boolean scr_initialized; // ready to draw static int scr_draw_loading; @@ -86,9 +83,11 @@ public final class SCR extends Globals { static cvar_t scr_graphscale; static cvar_t scr_graphshift; static cvar_t scr_drawall; + static cvar_t fps; + static cvar_t fps_updates; static dirty_t scr_dirty = new dirty_t(); - static dirty_t[] scr_old_dirty = { new dirty_t(), new dirty_t() }; + static dirty_t[] scr_old_dirty = { new dirty_t(), new dirty_t()}; static String crosshair_pic; static int crosshair_width, crosshair_height; @@ -103,28 +102,28 @@ public final class SCR extends Globals { /* =============================================================================== - + BAR GRAPHS - + =============================================================================== */ - -// typedef struct -// { -// float value; -// int color; -// } graphsamp_t; - static class graphsamp_t { + // typedef struct + // { + // float value; + // int color; + // } graphsamp_t; + static class graphsamp_t + { float value; int color; } static int current; static graphsamp_t[] values = new graphsamp_t[1024]; - + static { - for (int n=0; n < 1024; n++) - values[n]= new graphsamp_t(); + for (int n = 0; n < 1024; n++) + values[n] = new graphsamp_t(); } /* @@ -132,9 +131,10 @@ public final class SCR extends Globals { SCR_DebugGraph ============== */ - public static void DebugGraph(float value, int color) { - values[current&1023].value = value; - values[current&1023].color = color; + public static void DebugGraph(float value, int color) + { + values[current & 1023].value = value; + values[current & 1023].color = color; current++; } @@ -143,7 +143,8 @@ public final class SCR extends Globals { SCR_DrawDebugGraph ============== */ - static void DrawDebugGraph() { + static void DrawDebugGraph() + { int a, x, y, w, i, h; float v; int color; @@ -154,9 +155,10 @@ public final class SCR extends Globals { x = scr_vrect.x; y = scr_vrect.y + scr_vrect.height; - re.DrawFill(x, (int) (y - scr_graphheight.value), w, (int)scr_graphheight.value, 8); + re.DrawFill(x, (int) (y - scr_graphheight.value), w, (int) scr_graphheight.value, 8); - for (a = 0; a < w; a++) { + for (a = 0; a < w; a++) + { i = (current - 1 - a + 1024) & 1023; v = values[i].value; color = values[i].color; @@ -164,22 +166,22 @@ public final class SCR extends Globals { if (v < 0) v += scr_graphheight.value * (1 + (int) (-v / scr_graphheight.value)); - h = (int)v % (int)scr_graphheight.value; + h = (int) v % (int) scr_graphheight.value; re.DrawFill(x + w - 1 - a, y - h, 1, h, color); } } /* =============================================================================== - + CENTER PRINTING - + =============================================================================== */ // char scr_centerstring[1024]; static String scr_centerstring; - static float scr_centertime_start; // for slow victory printing + static float scr_centertime_start; // for slow victory printing static float scr_centertime_off; static int scr_center_lines; static int scr_erase_center; @@ -187,12 +189,13 @@ public final class SCR extends Globals { /* ============== SCR_CenterPrint - + Called for important messages that should stay in the center of the screen for a few moments ============== */ - static void CenterPrint(String str) { + static void CenterPrint(String str) + { //char *s; int s; StringBuffer line = new StringBuffer(64); @@ -206,7 +209,8 @@ public final class SCR extends Globals { // count the number of lines for centering scr_center_lines = 1; s = 0; - while (s < str.length()) { + while (s < str.length()) + { if (str.charAt(s) == '\n') scr_center_lines++; s++; @@ -217,10 +221,11 @@ public final class SCR extends Globals { "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"); s = 0; - + if (str.length() != 0) { - do { + do + { // scan the width of the line for (l = 0; l < 40 && (l + s) < str.length(); l++) @@ -228,18 +233,19 @@ public final class SCR extends Globals { break; for (i = 0; i < (40 - l) / 2; i++) line.append(' '); - - for (j = 0; j < l; j++) { + + for (j = 0; j < l; j++) + { line.append(str.charAt(s + j)); } - + line.append('\n'); - + Com.Printf(line.toString()); - + while (s < str.length() && str.charAt(s) != '\n') s++; - + if (s == str.length()) break; s++; // skip the \n @@ -251,8 +257,9 @@ public final class SCR extends Globals { Console.ClearNotify(); } - static void DrawCenterString() { - String cs = scr_centerstring +"\0"; + static void DrawCenterString() + { + String cs = scr_centerstring + "\0"; int start; int l; int j; @@ -275,15 +282,16 @@ public final class SCR extends Globals { else y = 48; - do { + do + { // scan the width of the line for (l = 0; l < 40; l++) - if (start + l == cs.length() - 1 || cs.charAt(start + l) == '\n') break; x = (viddef.width - l * 8) / 2; SCR.AddDirtyPoint(x, y); - for (j = 0; j < l; j++, x += 8) { + for (j = 0; j < l; j++, x += 8) + { re.DrawChar(x, y, cs.charAt(start + j)); if (remaining == 0) return; @@ -306,19 +314,19 @@ public final class SCR extends Globals { static void CheckDrawCenterString() { scr_centertime_off -= cls.frametime; - + if (scr_centertime_off <= 0) return; DrawCenterString(); } -// ============================================================================= + // ============================================================================= /* ================= SCR_CalcVrect - + Sets scr_vrect, the coordinates of the rendered window ================= */ @@ -328,59 +336,57 @@ public final class SCR extends Globals { // bound viewsize if (scr_viewsize.value < 40) - Cvar.Set ("viewsize","40"); + Cvar.Set("viewsize", "40"); if (scr_viewsize.value > 100) - Cvar.Set ("viewsize","100"); + Cvar.Set("viewsize", "100"); - size = (int)scr_viewsize.value; + size = (int) scr_viewsize.value; - scr_vrect.width = viddef.width*size/100; + scr_vrect.width = viddef.width * size / 100; scr_vrect.width &= ~7; - scr_vrect.height = viddef.height*size/100; + scr_vrect.height = viddef.height * size / 100; scr_vrect.height &= ~1; - scr_vrect.x = (viddef.width - scr_vrect.width)/2; - scr_vrect.y = (viddef.height - scr_vrect.height)/2; + scr_vrect.x = (viddef.width - scr_vrect.width) / 2; + scr_vrect.y = (viddef.height - scr_vrect.height) / 2; } - /* ================= SCR_SizeUp_f - + Keybinding command ================= */ static void SizeUp_f() { - Cvar.SetValue("viewsize",scr_viewsize.value+10); + Cvar.SetValue("viewsize", scr_viewsize.value + 10); } - /* ================= SCR_SizeDown_f - + Keybinding command ================= */ static void SizeDown_f() { - Cvar.SetValue("viewsize",scr_viewsize.value-10); + Cvar.SetValue("viewsize", scr_viewsize.value - 10); } /* ================= SCR_Sky_f - + Set a specific sky and rotation speed ================= */ static void Sky_f() { - float rotate; - float[] axis = {0, 0, 0}; + float rotate; + float[] axis = { 0, 0, 0 }; if (Cmd.Argc() < 2) { @@ -407,53 +413,66 @@ public final class SCR extends Globals { re.SetSky(Cmd.Argv(1), rotate, axis); } -// ============================================================================ + // ============================================================================ /* ================== SCR_Init ================== */ - static void Init() { + static void Init() + { scr_viewsize = Cvar.Get("viewsize", "100", CVAR_ARCHIVE); scr_conspeed = Cvar.Get("scr_conspeed", "3", 0); - scr_showturtle = Cvar.Get ("scr_showturtle", "0", 0); - scr_showpause = Cvar.Get ("scr_showpause", "1", 0); - scr_centertime = Cvar.Get ("scr_centertime", "2.5", 0); - scr_printspeed = Cvar.Get ("scr_printspeed", "8", 0); - scr_netgraph = Cvar.Get ("netgraph", "1", 0); - scr_timegraph = Cvar.Get ("timegraph", "1", 0); - scr_debuggraph = Cvar.Get ("debuggraph", "1", 0); - scr_graphheight = Cvar.Get ("graphheight", "32", 0); - scr_graphscale = Cvar.Get ("graphscale", "1", 0); - scr_graphshift = Cvar.Get ("graphshift", "0", 0); - scr_drawall = Cvar.Get ("scr_drawall", "1", 0); + scr_showturtle = Cvar.Get("scr_showturtle", "0", 0); + scr_showpause = Cvar.Get("scr_showpause", "1", 0); + scr_centertime = Cvar.Get("scr_centertime", "2.5", 0); + scr_printspeed = Cvar.Get("scr_printspeed", "8", 0); + scr_netgraph = Cvar.Get("netgraph", "1", 0); + scr_timegraph = Cvar.Get("timegraph", "1", 0); + scr_debuggraph = Cvar.Get("debuggraph", "1", 0); + scr_graphheight = Cvar.Get("graphheight", "32", 0); + scr_graphscale = Cvar.Get("graphscale", "1", 0); + scr_graphshift = Cvar.Get("graphshift", "0", 0); + scr_drawall = Cvar.Get("scr_drawall", "1", 0); + fps = Cvar.Get("fps", "0", 0); + fps_updates = Cvar.Get("fps_updates", "1", 0); // // register our commands // - Cmd.AddCommand ("timerefresh", new xcommand_t() { - public void execute() { + Cmd.AddCommand("timerefresh", new xcommand_t() + { + public void execute() + { TimeRefresh_f(); } }); - Cmd.AddCommand ("loading", new xcommand_t() { - public void execute() { + Cmd.AddCommand("loading", new xcommand_t() + { + public void execute() + { Loading_f(); } }); - Cmd.AddCommand ("sizeup", new xcommand_t() { - public void execute() { + Cmd.AddCommand("sizeup", new xcommand_t() + { + public void execute() + { SizeUp_f(); } }); - Cmd.AddCommand ("sizedown", new xcommand_t() { - public void execute() { + Cmd.AddCommand("sizedown", new xcommand_t() + { + public void execute() + { SizeDown_f(); } }); - Cmd.AddCommand ("sky", new xcommand_t() { - public void execute() { + Cmd.AddCommand("sky", new xcommand_t() + { + public void execute() + { Sky_f(); } }); @@ -461,7 +480,6 @@ public final class SCR extends Globals { scr_initialized = true; } - /* ============== SCR_DrawNet @@ -469,11 +487,10 @@ public final class SCR extends Globals { */ static void DrawNet() { - if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged - < CMD_BACKUP - 1) + if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP - 1) return; - re.DrawPic(scr_vrect.x+64, scr_vrect.y, "net"); + re.DrawPic(scr_vrect.x + 64, scr_vrect.y, "net"); } /* @@ -485,14 +502,14 @@ public final class SCR extends Globals { { Dimension dim = new Dimension(); - if (scr_showpause.value == 0) // turn off for screenshots + if (scr_showpause.value == 0) // turn off for screenshots return; if (cl_paused.value == 0) return; - re.DrawGetPicSize (dim, "pause"); - re.DrawPic ((viddef.width - dim.width) / 2, viddef.height / 2 + 8, "pause"); + re.DrawGetPicSize(dim, "pause"); + re.DrawPic((viddef.width - dim.width) / 2, viddef.height / 2 + 8, "pause"); } /* @@ -503,41 +520,42 @@ public final class SCR extends Globals { static void DrawLoading() { Dimension dim = new Dimension(); - + if (scr_draw_loading == 0) return; scr_draw_loading = 0; re.DrawGetPicSize(dim, "loading"); - re.DrawPic ((viddef.width - dim.width)/2, (viddef.height - dim.height)/2, "loading"); + re.DrawPic((viddef.width - dim.width) / 2, (viddef.height - dim.height) / 2, "loading"); } -// ============================================================================= + // ============================================================================= /* ================== SCR_RunConsole - + Scroll it up or down ================== */ - static void RunConsole() { + static void RunConsole() + { // decide on the height of the console if (cls.key_dest == key_console) - scr_conlines = 0.5f; // half screen + scr_conlines = 0.5f; // half screen else - scr_conlines = 0; // none visible - + scr_conlines = 0; // none visible + if (scr_conlines < scr_con_current) { - scr_con_current -= scr_conspeed.value*cls.frametime; + scr_con_current -= scr_conspeed.value * cls.frametime; if (scr_conlines > scr_con_current) scr_con_current = scr_conlines; } else if (scr_conlines > scr_con_current) { - scr_con_current += scr_conspeed.value*cls.frametime; + scr_con_current += scr_conspeed.value * cls.frametime; if (scr_conlines < scr_con_current) scr_con_current = scr_conlines; } @@ -551,17 +569,17 @@ public final class SCR extends Globals { static void DrawConsole() { Console.CheckResize(); - + if (cls.state == ca_disconnected || cls.state == ca_connecting) - { // forced full screen console + { // forced full screen console Console.DrawConsole(1.0f); return; } if (cls.state != ca_active || !cl.refresh_prepped) - { // connected, but can't render + { // connected, but can't render Console.DrawConsole(0.5f); - re.DrawFill (0, viddef.height/2, viddef.width, viddef.height/2, 0); + re.DrawFill(0, viddef.height / 2, viddef.width, viddef.height / 2, 0); return; } @@ -572,33 +590,35 @@ public final class SCR extends Globals { else { if (cls.key_dest == key_game || cls.key_dest == key_message) - Console.DrawNotify(); // only draw notify in game + Console.DrawNotify(); // only draw notify in game } } -// ============================================================================= + // ============================================================================= /* ================ SCR_BeginLoadingPlaque ================ */ - public static void BeginLoadingPlaque() { - S.StopAllSounds (); + public static void BeginLoadingPlaque() + { + S.StopAllSounds(); cl.sound_prepped = false; // don't play ambients - CDAudio.Stop(); + if (cls.disable_screen != 0) return; if (developer.value != 0) return; if (cls.state == ca_disconnected) - return; // if at console, don't bring up the plaque + return; // if at console, don't bring up the plaque if (cls.key_dest == key_console) return; if (cl.cinematictime > 0) - scr_draw_loading = 2; // clear to balack first + scr_draw_loading = 2; // clear to balack first else scr_draw_loading = 1; + UpdateScreen(); cls.disable_screen = Sys.Milliseconds(); cls.disable_servercount = cl.servercount; @@ -609,7 +629,8 @@ public final class SCR extends Globals { SCR_EndLoadingPlaque ================ */ - public static void EndLoadingPlaque() { + public static void EndLoadingPlaque() + { cls.disable_screen = 0; Console.ClearNotify(); } @@ -629,7 +650,8 @@ public final class SCR extends Globals { SCR_TimeRefresh_f ================ */ - static void TimeRefresh_f() { + static void TimeRefresh_f() + { int i; int start, stop; float time; @@ -639,15 +661,20 @@ public final class SCR extends Globals { start = Sys.Milliseconds(); - if (Cmd.Argc() == 2) { // run without page flipping + if (Cmd.Argc() == 2) + { // run without page flipping re.BeginFrame(0); - for (i = 0; i < 128; i++) { + for (i = 0; i < 128; i++) + { cl.refdef.viewangles[1] = i / 128.0f * 360.0f; re.RenderFrame(cl.refdef); } re.EndFrame(); - } else { - for (i = 0; i < 128; i++) { + } + else + { + for (i = 0; i < 128; i++) + { cl.refdef.viewangles[1] = i / 128.0f * 360.0f; re.BeginFrame(0); @@ -661,15 +688,16 @@ public final class SCR extends Globals { Com.Printf("%f seconds (%f fps)\n", new Vargs(2).add(time).add(128.0f / time)); } - static void DirtyScreen() { + static void DirtyScreen() + { AddDirtyPoint(0, 0); - AddDirtyPoint(viddef.width-1, viddef.height-1); + AddDirtyPoint(viddef.width - 1, viddef.height - 1); } /* ============== SCR_TileClear - + Clear any parts of the tiled background that were drawn on last frame ============== */ @@ -680,19 +708,19 @@ public final class SCR extends Globals { dirty_t clear = new dirty_t(); if (scr_drawall.value != 0) - DirtyScreen (); // for power vr or broken page flippers... + DirtyScreen(); // for power vr or broken page flippers... if (scr_con_current == 1.0f) - return; // full screen console + return; // full screen console if (scr_viewsize.value == 100) - return; // full screen rendering + return; // full screen rendering if (cl.cinematictime > 0) - return; // full screen cinematic + return; // full screen cinematic // erase rect will be the union of the past three frames // so tripple buffering works properly clear = scr_dirty; - for (i=0 ; i<2 ; i++) + for (i = 0; i < 2; i++) { if (scr_old_dirty[i].x1 < clear.x1) clear.x1 = scr_old_dirty[i].x1; @@ -713,55 +741,50 @@ public final class SCR extends Globals { scr_dirty.y2 = -9999; // don't bother with anything convered by the console) - top = (int)(scr_con_current * viddef.height); + top = (int) (scr_con_current * viddef.height); if (top >= clear.y1) clear.y1 = top; if (clear.y2 <= clear.y1) - return; // nothing disturbed + return; // nothing disturbed top = scr_vrect.y; - bottom = top + scr_vrect.height-1; + bottom = top + scr_vrect.height - 1; left = scr_vrect.x; - right = left + scr_vrect.width-1; + right = left + scr_vrect.width - 1; if (clear.y1 < top) - { // clear above view screen - i = clear.y2 < top-1 ? clear.y2 : top-1; - re.DrawTileClear (clear.x1 , clear.y1, - clear.x2 - clear.x1 + 1, i - clear.y1+1, "backtile"); + { // clear above view screen + i = clear.y2 < top - 1 ? clear.y2 : top - 1; + re.DrawTileClear(clear.x1, clear.y1, clear.x2 - clear.x1 + 1, i - clear.y1 + 1, "backtile"); clear.y1 = top; } if (clear.y2 > bottom) - { // clear below view screen - i = clear.y1 > bottom+1 ? clear.y1 : bottom+1; - re.DrawTileClear (clear.x1, i, - clear.x2-clear.x1+1, clear.y2-i+1, "backtile"); + { // clear below view screen + i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1; + re.DrawTileClear(clear.x1, i, clear.x2 - clear.x1 + 1, clear.y2 - i + 1, "backtile"); clear.y2 = bottom; } if (clear.x1 < left) - { // clear left of view screen - i = clear.x2 < left-1 ? clear.x2 : left-1; - re.DrawTileClear (clear.x1, clear.y1, - i-clear.x1+1, clear.y2 - clear.y1 + 1, "backtile"); + { // clear left of view screen + i = clear.x2 < left - 1 ? clear.x2 : left - 1; + re.DrawTileClear(clear.x1, clear.y1, i - clear.x1 + 1, clear.y2 - clear.y1 + 1, "backtile"); clear.x1 = left; } if (clear.x2 > right) - { // clear left of view screen - i = clear.x1 > right+1 ? clear.x1 : right+1; - re.DrawTileClear (i, clear.y1, - clear.x2-i+1, clear.y2 - clear.y1 + 1, "backtile"); + { // clear left of view screen + i = clear.x1 > right + 1 ? clear.x1 : right + 1; + re.DrawTileClear(i, clear.y1, clear.x2 - i + 1, clear.y2 - clear.y1 + 1, "backtile"); clear.x2 = right; } } - -// =============================================================== + // =============================================================== static final int STAT_MINUS = 10; // num frame for '-' stats digit - static final int ICON_WIDTH = 24; + static final int ICON_WIDTH = 24; static final int ICON_HEIGHT = 24; static final int CHAR_WIDTH = 16; static final int ICON_SPACE = 8; @@ -769,22 +792,27 @@ public final class SCR extends Globals { /* ================ SizeHUDString - + Allow embedded \n in the string ================ */ - static void SizeHUDString(String string, Dimension dim) { + static void SizeHUDString(String string, Dimension dim) + { int lines, width, current; lines = 1; width = 0; current = 0; - for (int i = 0; i < string.length(); i++) { - if (string.charAt(i) == '\n') { + for (int i = 0; i < string.length(); i++) + { + if (string.charAt(i) == '\n') + { lines++; current = 0; - } else { + } + else + { current++; if (current > width) width = current; @@ -796,7 +824,8 @@ public final class SCR extends Globals { dim.height = lines * 8; } - static void DrawHUDString(String string, int x, int y, int centerwidth, int xor) { + static void DrawHUDString(String string, int x, int y, int centerwidth, int xor) + { int margin; //char line[1024]; StringBuffer line = new StringBuffer(1024); @@ -804,7 +833,8 @@ public final class SCR extends Globals { margin = x; - for (int l = 0; l < string.length();) { + for (int l = 0; l < string.length();) + { // scan out one line of text from the string line = new StringBuffer(1024); while (string.charAt(l) != '\n') @@ -815,11 +845,13 @@ public final class SCR extends Globals { x = margin + (centerwidth - line.length() * 8) / 2; else x = margin; - for (i = 0; i < line.length(); i++) { + for (i = 0; i < line.length(); i++) + { re.DrawChar(x, y, line.charAt(i) ^ xor); x += 8; } - if (l < string.length()) { + if (l < string.length()) + { l++; // skip the \n x = margin; y += 8; @@ -827,7 +859,6 @@ public final class SCR extends Globals { } } - /* ============== SCR_DrawField @@ -836,7 +867,6 @@ public final class SCR extends Globals { static void DrawField(int x, int y, int color, int width, int value) { char ptr; - int ptrp; String num; int l; int frame; @@ -855,10 +885,10 @@ public final class SCR extends Globals { l = num.length(); if (l > width) l = width; - x += 2 + CHAR_WIDTH*(width - l); + x += 2 + CHAR_WIDTH * (width - l); ptr = num.charAt(0); - ptrp = 0; + for (int i = 0; i < l; i++) { ptr = num.charAt(i); @@ -867,7 +897,7 @@ public final class SCR extends Globals { else frame = ptr - '0'; - re.DrawPic (x,y,sb_nums[color][frame]); + re.DrawPic(x, y, sb_nums[color][frame]); x += CHAR_WIDTH; } } @@ -875,58 +905,59 @@ public final class SCR extends Globals { /* =============== SCR_TouchPics - + Allows rendering code to cache all needed sbar graphics =============== */ - static void TouchPics() { + static void TouchPics() + { int i, j; - - for (i=0 ; i<2 ; i++) - for (j=0 ; j<11 ; j++) + + for (i = 0; i < 2; i++) + for (j = 0; j < 11; j++) re.RegisterPic(sb_nums[i][j]); - - if (crosshair.value != 0.0f) { + + if (crosshair.value != 0.0f) + { if (crosshair.value > 3.0f || crosshair.value < 0.0f) crosshair.value = 3.0f; - - crosshair_pic = "ch" + (int)crosshair.value; - Dimension dim = new Dimension(); - re.DrawGetPicSize(dim, crosshair_pic); - crosshair_width = dim.width; - crosshair_height = dim.height; - if (crosshair_width == 0) - crosshair_pic = ""; + + crosshair_pic = "ch" + (int) crosshair.value; + Dimension dim = new Dimension(); + re.DrawGetPicSize(dim, crosshair_pic); + crosshair_width = dim.width; + crosshair_height = dim.height; + if (crosshair_width == 0) + crosshair_pic = ""; } } - /* ================ SCR_ExecuteLayoutString - + ================ */ static void ExecuteLayoutString(String s) { - int x, y; - int value; + int x, y; + int value; String token; - int width; - int index; - clientinfo_t ci; + int width; + int index; + clientinfo_t ci; if (cls.state != ca_active || !cl.refresh_prepped) return; -// if (!s[0]) + // if (!s[0]) if (s == null || s.length() == 0) return; x = 0; y = 0; width = 3; - + Com.ParseHelp ph = new Com.ParseHelp(s); while (!ph.isEof()) @@ -947,7 +978,7 @@ public final class SCR extends Globals { if (token.equals("xv")) { token = Com.Parse(ph); - x = viddef.width/2 - 160 + atoi(token); + x = viddef.width / 2 - 160 + atoi(token); continue; } @@ -966,40 +997,40 @@ public final class SCR extends Globals { if (token.equals("yv")) { token = Com.Parse(ph); - y = viddef.height/2 - 120 + atoi(token); + y = viddef.height / 2 - 120 + atoi(token); continue; } if (token.equals("pic")) - { // draw a pic from a stat number + { // draw a pic from a stat number token = Com.Parse(ph); value = cl.frame.playerstate.stats[atoi(token)]; if (value >= MAX_IMAGES) - Com.Error (ERR_DROP, "Pic >= MAX_IMAGES"); - if (cl.configstrings[CS_IMAGES+value] != null) + Com.Error(ERR_DROP, "Pic >= MAX_IMAGES"); + if (cl.configstrings[CS_IMAGES + value] != null) { - AddDirtyPoint (x, y); - AddDirtyPoint (x+23, y+23); - re.DrawPic (x, y, cl.configstrings[CS_IMAGES+value]); + AddDirtyPoint(x, y); + AddDirtyPoint(x + 23, y + 23); + re.DrawPic(x, y, cl.configstrings[CS_IMAGES + value]); } continue; } if (token.equals("client")) - { // draw a deathmatch client block - int score, ping, time; + { // draw a deathmatch client block + int score, ping, time; token = Com.Parse(ph); - x = viddef.width/2 - 160 + atoi(token); + x = viddef.width / 2 - 160 + atoi(token); token = Com.Parse(ph); - y = viddef.height/2 - 120 + atoi(token); - AddDirtyPoint (x, y); - AddDirtyPoint (x+159, y+31); + y = viddef.height / 2 - 120 + atoi(token); + AddDirtyPoint(x, y); + AddDirtyPoint(x + 159, y + 31); token = Com.Parse(ph); value = atoi(token); if (value >= MAX_CLIENTS || value < 0) - Com.Error (ERR_DROP, "client >= MAX_CLIENTS"); + Com.Error(ERR_DROP, "client >= MAX_CLIENTS"); ci = cl.clientinfo[value]; token = Com.Parse(ph); @@ -1011,33 +1042,33 @@ public final class SCR extends Globals { token = Com.Parse(ph); time = atoi(token); - Console.DrawAltString (x+32, y, ci.name); - Console.DrawString (x+32, y+8, "Score: "); - Console.DrawAltString (x+32+7*8, y+8, "" + score); - Console.DrawString (x+32, y+16, "Ping: " + ping); - Console.DrawString (x+32, y+24, "Time: " + time); + Console.DrawAltString(x + 32, y, ci.name); + Console.DrawString(x + 32, y + 8, "Score: "); + Console.DrawAltString(x + 32 + 7 * 8, y + 8, "" + score); + Console.DrawString(x + 32, y + 16, "Ping: " + ping); + Console.DrawString(x + 32, y + 24, "Time: " + time); if (ci.icon == null) ci = cl.baseclientinfo; - re.DrawPic (x, y, ci.iconname); + re.DrawPic(x, y, ci.iconname); continue; } if (token.equals("ctf")) - { // draw a ctf client block - int score, ping; + { // draw a ctf client block + int score, ping; token = Com.Parse(ph); - x = viddef.width/2 - 160 + atoi(token); + x = viddef.width / 2 - 160 + atoi(token); token = Com.Parse(ph); - y = viddef.height/2 - 120 + atoi(token); - AddDirtyPoint (x, y); - AddDirtyPoint (x+159, y+31); + y = viddef.height / 2 - 120 + atoi(token); + AddDirtyPoint(x, y); + AddDirtyPoint(x + 159, y + 31); token = Com.Parse(ph); value = atoi(token); if (value >= MAX_CLIENTS || value < 0) - Com.Error (ERR_DROP, "client >= MAX_CLIENTS"); + Com.Error(ERR_DROP, "client >= MAX_CLIENTS"); ci = cl.clientinfo[value]; token = Com.Parse(ph); @@ -1052,142 +1083,141 @@ public final class SCR extends Globals { String block = Com.sprintf("%3d %3d %-12.12s", new Vargs(3).add(score).add(ping).add(ci.name)); if (value == cl.playernum) - Console.DrawAltString (x, y, block); + Console.DrawAltString(x, y, block); else - Console.DrawString (x, y, block); + Console.DrawString(x, y, block); continue; } if (token.equals("picn")) - { // draw a pic from a name + { // draw a pic from a name token = Com.Parse(ph); - AddDirtyPoint (x, y); - AddDirtyPoint (x+23, y+23); - re.DrawPic (x, y, token); + AddDirtyPoint(x, y); + AddDirtyPoint(x + 23, y + 23); + re.DrawPic(x, y, token); continue; } if (token.equals("num")) - { // draw a number + { // draw a number token = Com.Parse(ph); width = atoi(token); token = Com.Parse(ph); value = cl.frame.playerstate.stats[atoi(token)]; - DrawField (x, y, 0, width, value); + DrawField(x, y, 0, width, value); continue; } if (token.equals("hnum")) - { // health number - int color; + { // health number + int color; width = 3; value = cl.frame.playerstate.stats[STAT_HEALTH]; if (value > 25) - color = 0; // green + color = 0; // green else if (value > 0) - color = (cl.frame.serverframe>>2) & 1; // flash + color = (cl.frame.serverframe >> 2) & 1; // flash else color = 1; if ((cl.frame.playerstate.stats[STAT_FLASHES] & 1) != 0) - re.DrawPic (x, y, "field_3"); + re.DrawPic(x, y, "field_3"); - DrawField (x, y, color, width, value); + DrawField(x, y, color, width, value); continue; } if (token.equals("anum")) - { // ammo number - int color; + { // ammo number + int color; width = 3; value = cl.frame.playerstate.stats[STAT_AMMO]; if (value > 5) - color = 0; // green + color = 0; // green else if (value >= 0) - color = (cl.frame.serverframe>>2) & 1; // flash + color = (cl.frame.serverframe >> 2) & 1; // flash else - continue; // negative number = don't show + continue; // negative number = don't show if ((cl.frame.playerstate.stats[STAT_FLASHES] & 4) != 0) - re.DrawPic (x, y, "field_3"); + re.DrawPic(x, y, "field_3"); - DrawField (x, y, color, width, value); + DrawField(x, y, color, width, value); continue; } if (token.equals("rnum")) - { // armor number - int color; + { // armor number + int color; width = 3; value = cl.frame.playerstate.stats[STAT_ARMOR]; if (value < 1) continue; - color = 0; // green + color = 0; // green if ((cl.frame.playerstate.stats[STAT_FLASHES] & 2) != 0) - re.DrawPic (x, y, "field_3"); + re.DrawPic(x, y, "field_3"); - DrawField (x, y, color, width, value); + DrawField(x, y, color, width, value); continue; } - if (token.equals("stat_string")) { token = Com.Parse(ph); index = atoi(token); if (index < 0 || index >= MAX_CONFIGSTRINGS) - Com.Error (ERR_DROP, "Bad stat_string index"); + Com.Error(ERR_DROP, "Bad stat_string index"); index = cl.frame.playerstate.stats[index]; if (index < 0 || index >= MAX_CONFIGSTRINGS) - Com.Error (ERR_DROP, "Bad stat_string index"); - Console.DrawString (x, y, cl.configstrings[index]); + Com.Error(ERR_DROP, "Bad stat_string index"); + Console.DrawString(x, y, cl.configstrings[index]); continue; } if (token.equals("cstring")) { token = Com.Parse(ph); - DrawHUDString (token, x, y, 320, 0); + DrawHUDString(token, x, y, 320, 0); continue; } if (token.equals("string")) { token = Com.Parse(ph); - Console.DrawString (x, y, token); + Console.DrawString(x, y, token); continue; } if (token.equals("cstring2")) { token = Com.Parse(ph); - DrawHUDString (token, x, y, 320,0x80); + DrawHUDString(token, x, y, 320, 0x80); continue; } if (token.equals("string2")) { token = Com.Parse(ph); - Console.DrawAltString (x, y, token); + Console.DrawAltString(x, y, token); continue; } if (token.equals("if")) - { // draw a number + { // draw a number token = Com.Parse(ph); value = cl.frame.playerstate.stats[atoi(token)]; if (value == 0) - { // skip to endif -// while (s && strcmp(token, "endif") ) -// { -// token = Com.Parse(ph); -// } - + { // skip to endif + // while (s && strcmp(token, "endif") ) + // { + // token = Com.Parse(ph); + // } + while (!ph.isEof() && !(token = Com.Parse(ph)).equals("endif")); } @@ -1195,19 +1225,19 @@ public final class SCR extends Globals { continue; } - } } /* ================ SCR_DrawStats - + The status bar is a small layout program that is based on the stats array ================ */ - static void DrawStats() { + static void DrawStats() + { //TODO: SCR.ExecuteLayoutString(cl.configstrings[CS_STATUSBAR]); } @@ -1215,12 +1245,13 @@ public final class SCR extends Globals { /* ================ SCR_DrawLayout - + ================ */ static final int STAT_LAYOUTS = 13; - static void DrawLayout() { + static void DrawLayout() + { if (cl.frame.playerstate.stats[STAT_LAYOUTS] != 0) return; SCR.ExecuteLayoutString(cl.layout); @@ -1231,7 +1262,7 @@ public final class SCR extends Globals { /* ================== SCR_UpdateScreen - + This is called every frame, and can also be called explicitly to flush text to the screen. ================== @@ -1241,7 +1272,7 @@ public final class SCR extends Globals { int numframes; int i; float[] separation = { 0, 0 }; - + // if the screen is disabled (loading plaque is up, or vid mode changing) // do nothing at all if (cls.disable_screen != 0) @@ -1255,23 +1286,23 @@ public final class SCR extends Globals { } if (!scr_initialized || !con.initialized) - return; // not initialized yet + return; // not initialized yet /* ** range check cl_camera_separation so we don't inadvertently fry someone's ** brain */ - if ( cl_stereo_separation.value > 1.0 ) - Cvar.SetValue( "cl_stereo_separation", 1.0f ); - else if ( cl_stereo_separation.value < 0 ) - Cvar.SetValue( "cl_stereo_separation", 0.0f ); + if (cl_stereo_separation.value > 1.0) + Cvar.SetValue("cl_stereo_separation", 1.0f); + else if (cl_stereo_separation.value < 0) + Cvar.SetValue("cl_stereo_separation", 0.0f); - if ( cl_stereo.value != 0 ) + if (cl_stereo.value != 0) { numframes = 2; separation[0] = -cl_stereo_separation.value / 2; - separation[1] = cl_stereo_separation.value / 2; - } + separation[1] = cl_stereo_separation.value / 2; + } else { separation[0] = 0; @@ -1279,19 +1310,19 @@ public final class SCR extends Globals { numframes = 1; } - for ( i = 0; i < numframes; i++ ) + for (i = 0; i < numframes; i++) { - re.BeginFrame( separation[i] ); + re.BeginFrame(separation[i]); if (scr_draw_loading == 2) - { // loading plaque over black screen + { // loading plaque over black screen Dimension dim = new Dimension(); re.CinematicSetPalette(null); scr_draw_loading = 0; // false - re.DrawGetPicSize (dim, "loading"); - re.DrawPic ((viddef.width-dim.width)/2, (viddef.height-dim.height)/2, "loading"); - } + re.DrawGetPicSize(dim, "loading"); + re.DrawPic((viddef.width - dim.width) / 2, (viddef.height - dim.height) / 2, "loading"); + } // if a cinematic is supposed to be running, handle menus // and console specially else if (cl.cinematictime > 0) @@ -1317,10 +1348,10 @@ public final class SCR extends Globals { else { // TODO impl: cl_cin.c for cinematics - //DrawCinematic(); + DrawCinematic(); } } - else + else { // make sure the game palette is active if (cl.cinematicpalette_active) @@ -1335,7 +1366,7 @@ public final class SCR extends Globals { // clear any dirty part of the background TileClear(); - V.RenderView( separation[i] ); + V.RenderView(separation[i]); DrawStats(); // TODO impl this @@ -1346,22 +1377,22 @@ public final class SCR extends Globals { DrawNet(); CheckDrawCenterString(); -// -// if (scr_timegraph->value) -// SCR_DebugGraph (cls.frametime*300, 0); -// -// if (scr_debuggraph->value || scr_timegraph->value || scr_netgraph->value) -// SCR_DrawDebugGraph (); -// + DrawFPS(); + + // + // if (scr_timegraph->value) + // SCR_DebugGraph (cls.frametime*300, 0); + // + // if (scr_debuggraph->value || scr_timegraph->value || scr_netgraph->value) + // SCR_DrawDebugGraph (); + // DrawPause(); - DrawConsole(); - - Menu.Draw (); - + Menu.Draw(); DrawLoading(); } } + Globals.re.EndFrame(); } @@ -1370,11 +1401,13 @@ public final class SCR extends Globals { SCR_DrawCrosshair ================= */ - static void DrawCrosshair() { + static void DrawCrosshair() + { if (crosshair.value == 0.0f) return; - if (crosshair.modified) { + if (crosshair.modified) + { crosshair.modified = false; SCR.TouchPics(); } @@ -1382,21 +1415,25 @@ public final class SCR extends Globals { if (crosshair_pic.length() == 0) return; - re.DrawPic(scr_vrect.x + ((scr_vrect.width - crosshair_width)>>1), - scr_vrect.y + ((scr_vrect.height - crosshair_height)>>1), crosshair_pic); + re.DrawPic( + scr_vrect.x + ((scr_vrect.width - crosshair_width) >> 1), + scr_vrect.y + ((scr_vrect.height - crosshair_height) >> 1), + crosshair_pic); } - + // wird anstelle von der richtigen UpdateScreen benoetigt - public static void UpdateScreen() { + public static void UpdateScreen() + { Globals.re.updateScreen(null); } - + /* ================= SCR_AddDirtyPoint ================= */ - static void AddDirtyPoint(int x, int y) { + static void AddDirtyPoint(int x, int y) + { if (x < scr_dirty.x1) scr_dirty.x1 = x; if (x > scr_dirty.x2) @@ -1407,14 +1444,667 @@ public final class SCR extends Globals { scr_dirty.y2 = y; } - - public static void PlayCinematic(String str) { - // TODO: implement PlayCinematic + private static int lastframes = 0; + private static int lasttime = 0; + private static String fpsvalue = ""; + static void DrawFPS() + { + if (fps.value > 0.0f) + { + int diff = cls.realtime - lasttime; + if (diff > (int) (fps.value * 1000)) + { + fpsvalue = (cls.framecount - lastframes) * 100000 / diff / 100.0f + " fps"; + lastframes = cls.framecount; + lasttime = cls.realtime; + } + int x = viddef.width - 8 * fpsvalue.length() - 2; + for (int i = 0; i < fpsvalue.length(); i++) + { + re.DrawChar(x, 2, fpsvalue.charAt(i)); + x += 8; + } + } } - static void FinishCinematic() { + /* + ================================================================= + + cl_cin.c + + Play Cinematics + + ================================================================= + */ + +// typedef struct +// { +// byte *data; +// int count; +// } cblock_t; +// +// typedef struct +// { +// qboolean restart_sound; +// int s_rate; +// int s_width; +// int s_channels; +// +// int width; +// int height; +// byte *pic; +// byte *pic_pending; +// +// // order 1 huffman stuff +// int *hnodes1; // [256][256][2]; +// int numhnodes1[256]; +// +// int h_used[512]; +// int h_count[512]; +// } cinematics_t; +// +// cinematics_t cin; +// +// /* +// ================================================================= +// +// PCX LOADING +// +// ================================================================= +// */ +// +// +// /* +// ============== +// SCR_LoadPCX +// ============== +// */ +// void SCR_LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height) +// { +// byte *raw; +// pcx_t *pcx; +// int x, y; +// int len; +// int dataByte, runLength; +// byte *out, *pix; +// +// *pic = NULL; +// +// // +// // load the file +// // +// len = FS_LoadFile (filename, (void **)&raw); +// if (!raw) +// return; // Com_Printf ("Bad pcx file %s\n", filename); +// +// // +// // parse the PCX file +// // +// pcx = (pcx_t *)raw; +// raw = &pcx->data; +// +// if (pcx->manufacturer != 0x0a +// || pcx->version != 5 +// || pcx->encoding != 1 +// || pcx->bits_per_pixel != 8 +// || pcx->xmax >= 640 +// || pcx->ymax >= 480) +// { +// Com_Printf ("Bad pcx file %s\n", filename); +// return; +// } +// +// out = Z_Malloc ( (pcx->ymax+1) * (pcx->xmax+1) ); +// +// *pic = out; +// +// pix = out; +// +// if (palette) +// { +// *palette = Z_Malloc(768); +// memcpy (*palette, (byte *)pcx + len - 768, 768); +// } +// +// if (width) +// *width = pcx->xmax+1; +// if (height) +// *height = pcx->ymax+1; +// +// for (y=0 ; y<=pcx->ymax ; y++, pix += pcx->xmax+1) +// { +// for (x=0 ; x<=pcx->xmax ; ) +// { +// dataByte = *raw++; +// +// if((dataByte & 0xC0) == 0xC0) +// { +// runLength = dataByte & 0x3F; +// dataByte = *raw++; +// } +// else +// runLength = 1; +// +// while(runLength-- > 0) +// pix[x++] = dataByte; +// } +// +// } +// +// if ( raw - (byte *)pcx > len) +// { +// Com_Printf ("PCX file %s was malformed", filename); +// Z_Free (*pic); +// *pic = NULL; +// } +// +// FS_FreeFile (pcx); +// } +// + // ============================================================= + + /* + ================== + SCR_StopCinematic + ================== + */ + static void StopCinematic() + { + cl.cinematictime = 0; // done +// if (cin.pic) +// { +// Z_Free (cin.pic); +// cin.pic = NULL; +// } +// if (cin.pic_pending) +// { +// Z_Free (cin.pic_pending); +// cin.pic_pending = NULL; +// } + if (cl.cinematicpalette_active) + { + re.CinematicSetPalette(null); + cl.cinematicpalette_active = false; + } +// if (cl.cinematic_file) +// { +// fclose (cl.cinematic_file); +// cl.cinematic_file = NULL; +// } +// if (cin.hnodes1) +// { +// Z_Free (cin.hnodes1); +// cin.hnodes1 = NULL; +// } +// +// // switch back down to 11 khz sound if necessary +// if (cin.restart_sound) +// { +// cin.restart_sound = false; +// CL_Snd_Restart_f (); +// } +// + } + + /* + ==================== + SCR_FinishCinematic + + Called when either the cinematic completes, or it is aborted + ==================== + */ + static void FinishCinematic() + { // tell the server to advance to the next map / cinematic MSG.WriteByte(cls.netchan.message, clc_stringcmd); SZ.Print(cls.netchan.message, "nextserver " + cl.servercount + '\n'); } + + // ========================================================================== + +// /* +// ================== +// SmallestNode1 +// ================== +// */ +// int SmallestNode1 (int numhnodes) +// { +// int i; +// int best, bestnode; +// +// best = 99999999; +// bestnode = -1; +// for (i=0 ; i<numhnodes ; i++) +// { +// if (cin.h_used[i]) +// continue; +// if (!cin.h_count[i]) +// continue; +// if (cin.h_count[i] < best) +// { +// best = cin.h_count[i]; +// bestnode = i; +// } +// } +// +// if (bestnode == -1) +// return -1; +// +// cin.h_used[bestnode] = true; +// return bestnode; +// } +// +// +// /* +// ================== +// Huff1TableInit +// +// Reads the 64k counts table and initializes the node trees +// ================== +// */ +// void Huff1TableInit (void) +// { +// int prev; +// int j; +// int *node, *nodebase; +// byte counts[256]; +// int numhnodes; +// +// cin.hnodes1 = Z_Malloc (256*256*2*4); +// memset (cin.hnodes1, 0, 256*256*2*4); +// +// for (prev=0 ; prev<256 ; prev++) +// { +// memset (cin.h_count,0,sizeof(cin.h_count)); +// memset (cin.h_used,0,sizeof(cin.h_used)); +// +// // read a row of counts +// FS_Read (counts, sizeof(counts), cl.cinematic_file); +// for (j=0 ; j<256 ; j++) +// cin.h_count[j] = counts[j]; +// +// // build the nodes +// numhnodes = 256; +// nodebase = cin.hnodes1 + prev*256*2; +// +// while (numhnodes != 511) +// { +// node = nodebase + (numhnodes-256)*2; +// +// // pick two lowest counts +// node[0] = SmallestNode1 (numhnodes); +// if (node[0] == -1) +// break; // no more +// +// node[1] = SmallestNode1 (numhnodes); +// if (node[1] == -1) +// break; +// +// cin.h_count[numhnodes] = cin.h_count[node[0]] + cin.h_count[node[1]]; +// numhnodes++; +// } +// +// cin.numhnodes1[prev] = numhnodes-1; +// } +// } +// +// /* +// ================== +// Huff1Decompress +// ================== +// */ +// cblock_t Huff1Decompress (cblock_t in) +// { +// byte *input; +// byte *out_p; +// int nodenum; +// int count; +// cblock_t out; +// int inbyte; +// int *hnodes, *hnodesbase; +//// int i; +// +// // get decompressed count +// count = in.data[0] + (in.data[1]<<8) + (in.data[2]<<16) + (in.data[3]<<24); +// input = in.data + 4; +// out_p = out.data = Z_Malloc (count); +// +// // read bits +// +// hnodesbase = cin.hnodes1 - 256*2; // nodes 0-255 aren't stored +// +// hnodes = hnodesbase; +// nodenum = cin.numhnodes1[0]; +// while (count) +// { +// inbyte = *input++; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// //----------- +// if (nodenum < 256) +// { +// hnodes = hnodesbase + (nodenum<<9); +// *out_p++ = nodenum; +// if (!--count) +// break; +// nodenum = cin.numhnodes1[nodenum]; +// } +// nodenum = hnodes[nodenum*2 + (inbyte&1)]; +// inbyte >>=1; +// } +// +// if (input - in.data != in.count && input - in.data != in.count+1) +// { +// Com_Printf ("Decompression overread by %i", (input - in.data) - in.count); +// } +// out.count = out_p - out.data; +// +// return out; +// } +// +// /* +// ================== +// SCR_ReadNextFrame +// ================== +// */ +// byte *SCR_ReadNextFrame (void) +// { +// int r; +// int command; +// byte samples[22050/14*4]; +// byte compressed[0x20000]; +// int size; +// byte *pic; +// cblock_t in, huf1; +// int start, end, count; +// +// // read the next frame +// r = fread (&command, 4, 1, cl.cinematic_file); +// if (r == 0) // we'll give it one more chance +// r = fread (&command, 4, 1, cl.cinematic_file); +// +// if (r != 1) +// return NULL; +// command = LittleLong(command); +// if (command == 2) +// return NULL; // last frame marker +// +// if (command == 1) +// { // read palette +// FS_Read (cl.cinematicpalette, sizeof(cl.cinematicpalette), cl.cinematic_file); +// cl.cinematicpalette_active=0; // dubious.... exposes an edge case +// } +// +// // decompress the next frame +// FS_Read (&size, 4, cl.cinematic_file); +// size = LittleLong(size); +// if (size > sizeof(compressed) || size < 1) +// Com_Error (ERR_DROP, "Bad compressed frame size"); +// FS_Read (compressed, size, cl.cinematic_file); +// +// // read sound +// start = cl.cinematicframe*cin.s_rate/14; +// end = (cl.cinematicframe+1)*cin.s_rate/14; +// count = end - start; +// +// FS_Read (samples, count*cin.s_width*cin.s_channels, cl.cinematic_file); +// +// S_RawSamples (count, cin.s_rate, cin.s_width, cin.s_channels, samples); +// +// in.data = compressed; +// in.count = size; +// +// huf1 = Huff1Decompress (in); +// +// pic = huf1.data; +// +// cl.cinematicframe++; +// +// return pic; +// } +// +// + /* + ================== + SCR_RunCinematic + + ================== + */ + static void RunCinematic() + { + int frame; + + if (cl.cinematictime <= 0) + { + StopCinematic(); + return; + } + +// if (cl.cinematicframe == -1) +// return; // static image +// +// if (cls.key_dest != key_game) +// { // pause if menu or console is up +// cl.cinematictime = cls.realtime - cl.cinematicframe*1000/14; +// return; +// } +// +// frame = (cls.realtime - cl.cinematictime)*14.0/1000; +// if (frame <= cl.cinematicframe) +// return; +// if (frame > cl.cinematicframe+1) +// { +// Com_Printf ("Dropped frame: %i > %i\n", frame, cl.cinematicframe+1); +// cl.cinematictime = cls.realtime - cl.cinematicframe*1000/14; +// } +// if (cin.pic) +// Z_Free (cin.pic); +// cin.pic = cin.pic_pending; +// cin.pic_pending = NULL; +// cin.pic_pending = SCR_ReadNextFrame (); +// if (!cin.pic_pending) +// { +// SCR_StopCinematic (); +// SCR_FinishCinematic (); +// cl.cinematictime = 1; // hack to get the black screen behind loading +// SCR_BeginLoadingPlaque (); +// cl.cinematictime = 0; +// return; +// } + } + + /* + ================== + SCR_DrawCinematic + + Returns true if a cinematic is active, meaning the view rendering + should be skipped + ================== + */ + static boolean DrawCinematic() + { +// if (cl.cinematictime <= 0) +// { + return false; +// } +// +// if (cls.key_dest == key_menu) +// { // blank screen and pause if menu is up +// re.CinematicSetPalette(NULL); +// cl.cinematicpalette_active = false; +// return true; +// } +// +// if (!cl.cinematicpalette_active) +// { +// re.CinematicSetPalette(cl.cinematicpalette); +// cl.cinematicpalette_active = true; +// } +// +// if (!cin.pic) +// return true; +// +// re.DrawStretchRaw (0, 0, viddef.width, viddef.height, +// cin.width, cin.height, cin.pic); +// +// return true; + } + + /* + ================== + SCR_PlayCinematic + + ================== + */ + static void PlayCinematic(String arg) + { +// int width, height; +// byte *palette; +// char name[MAX_OSPATH], *dot; +// int old_khz; +// +// // make sure CD isn't playing music + //CDAudio.Stop(); + + cl.cinematicframe = 0; +// dot = strstr (arg, "."); +// if (dot && !strcmp (dot, ".pcx")) +// { // static pcx image +// Com_sprintf (name, sizeof(name), "pics/%s", arg); +// SCR_LoadPCX (name, &cin.pic, &palette, &cin.width, &cin.height); +// cl.cinematicframe = -1; +// cl.cinematictime = 1; +// SCR_EndLoadingPlaque (); +// cls.state = ca_active; +// if (!cin.pic) +// { +// Com_Printf ("%s not found.\n", name); +// cl.cinematictime = 0; +// } +// else +// { +// memcpy (cl.cinematicpalette, palette, sizeof(cl.cinematicpalette)); +// Z_Free (palette); +// } +// return; +// } +// +// Com_sprintf (name, sizeof(name), "video/%s", arg); +// FS_FOpenFile (name, &cl.cinematic_file); +// if (!cl.cinematic_file) +// { + // Com_Error (ERR_DROP, "Cinematic %s not found.\n", name); + FinishCinematic(); + cl.cinematictime = 0; // done + return; +// } +// +// SCR_EndLoadingPlaque (); +// +// cls.state = ca_active; +// +// FS_Read (&width, 4, cl.cinematic_file); +// FS_Read (&height, 4, cl.cinematic_file); +// cin.width = LittleLong(width); +// cin.height = LittleLong(height); +// +// FS_Read (&cin.s_rate, 4, cl.cinematic_file); +// cin.s_rate = LittleLong(cin.s_rate); +// FS_Read (&cin.s_width, 4, cl.cinematic_file); +// cin.s_width = LittleLong(cin.s_width); +// FS_Read (&cin.s_channels, 4, cl.cinematic_file); +// cin.s_channels = LittleLong(cin.s_channels); +// +// Huff1TableInit (); +// +// // switch up to 22 khz sound if necessary +// old_khz = Cvar_VariableValue ("s_khz"); +// if (old_khz != cin.s_rate/1000) +// { +// cin.restart_sound = true; +// Cvar_SetValue ("s_khz", cin.s_rate/1000); +// CL_Snd_Restart_f (); +// Cvar_SetValue ("s_khz", old_khz); +// } +// +// cl.cinematicframe = 0; +// cin.pic = SCR_ReadNextFrame (); +// cl.cinematictime = Sys_Milliseconds (); + } + }
\ No newline at end of file diff --git a/src/jake2/client/SND_DMA.java b/src/jake2/client/SND_DMA.java index fba94c1..dc487d8 100644 --- a/src/jake2/client/SND_DMA.java +++ b/src/jake2/client/SND_DMA.java @@ -2,7 +2,7 @@ * S_DMA.java * Copyright (C) 2004 * - * $Id: SND_DMA.java,v 1.1 2004-07-07 19:58:51 hzi Exp $ + * $Id: SND_DMA.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -117,14 +117,12 @@ public class SND_DMA extends SND_MIX { // ==================================================================== - static void SoundInfo_f() - { - if (!sound_started) - { - Com.Printf ("sound system not started\n"); + static void SoundInfo_f() { + if (!sound_started) { + Com.Printf("sound system not started\n"); return; } - + Com.Printf("%5d stereo\n", new Vargs(1).add(dma.channels - 1)); Com.Printf("%5d samples\n", new Vargs(1).add(dma.samples)); Com.Printf("%5d samplepos\n", new Vargs(1).add(dma.samplepos)); @@ -249,7 +247,7 @@ S.SoundInfo_f(); if (name.length() == 0) Com.Error(ERR_FATAL, "S_FindName: empty name\n"); - if (strlen(name) >= MAX_QPATH) + if (name.length() >= MAX_QPATH) Com.Error(ERR_FATAL, "Sound name too long: " + name); // see if already loaded diff --git a/src/jake2/client/SND_MEM.java b/src/jake2/client/SND_MEM.java index a5f7671..85215d1 100644 --- a/src/jake2/client/SND_MEM.java +++ b/src/jake2/client/SND_MEM.java @@ -2,7 +2,7 @@ * SND_MEM.java * Copyright (C) 2004 * - * $Id: SND_MEM.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ + * $Id: SND_MEM.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.client; +import jake2.qcommon.Com; +import jake2.qcommon.FS; + /** * SND_MEM */ @@ -39,52 +42,51 @@ public class SND_MEM extends SND_JAVA { // // byte *S_Alloc (int size); // -// /* -// ================ -// ResampleSfx -// ================ -// */ -// void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data) -// { -// int outcount; -// int srcsample; -// float stepscale; -// int i; -// int sample, samplefrac, fracstep; -// sfxcache_t *sc; -// -// sc = sfx->cache; -// if (!sc) -// return; -// -// stepscale = (float)inrate / dma.speed; // this is usually 0.5, 1, or 2 -// -// outcount = sc->length / stepscale; -// sc->length = outcount; -// if (sc->loopstart != -1) -// sc->loopstart = sc->loopstart / stepscale; -// -// sc->speed = dma.speed; -// if (s_loadas8bit->value) -// sc->width = 1; -// else -// sc->width = inwidth; -// sc->stereo = 0; -// -//// resample / decimate to the current source rate -// -// if (stepscale == 1 && inwidth == 1 && sc->width == 1) -// { -//// fast special case -// for (i=0 ; i<outcount ; i++) -// ((signed char *)sc->data)[i] -// = (int)( (unsigned char)(data[i]) - 128); -// } -// else -// { -//// general case -// samplefrac = 0; -// fracstep = stepscale*256; + /* + ================ + ResampleSfx + ================ + */ + static void ResampleSfx (sfx_t sfx, int inrate, int inwidth, byte[] data, int ofs) + { + int outcount; + int srcsample; + float stepscale; + int i; + int sample, samplefrac, fracstep; + sfxcache_t sc; + + sc = sfx.cache; + if (sc == null) + return; + + stepscale = (float)inrate / dma.speed; // this is usually 0.5, 1, or 2 + + outcount = (int)(sc.length / stepscale); + sc.length = outcount; + if (sc.loopstart != -1) + sc.loopstart = (int)(sc.loopstart / stepscale); + + sc.speed = dma.speed; + if (SND_DMA.s_loadas8bit.value != 0.0f) + sc.width = 1; + else + sc.width = inwidth; + sc.stereo = 0; + +// resample / decimate to the current source rate + + if (stepscale == 1 && inwidth == 1 && sc.width == 1) + { +// fast special case + for (i=0 ; i<outcount ; i++) + sc.data[i+ofs] = (byte)((data[i+ofs] & 0xFF) - 128); + } + else + { +// general case + samplefrac = 0; + fracstep = (int)(stepscale*256); // for (i=0 ; i<outcount ; i++) // { // srcsample = samplefrac >> 8; @@ -98,8 +100,8 @@ public class SND_MEM extends SND_JAVA { // else // ((signed char *)sc->data)[i] = sample >> 8; // } -// } -// } + } + } // //// ============================================================================= // @@ -108,77 +110,70 @@ public class SND_MEM extends SND_JAVA { S_LoadSound ============== */ - static sfxcache_t LoadSound (sfx_t s) - { -// char namebuffer[MAX_QPATH]; -// byte *data; -// wavinfo_t info; -// int len; -// float stepscale; - sfxcache_t sc = null; -// int size; -// char *name; -// -// if (s->name[0] == '*') -// return NULL; -// -//// see if still in memory -// sc = s->cache; -// if (sc) -// return sc; -// -//// Com_Printf ("S_LoadSound: %x\n", (int)stackbuf); -//// load it in -// if (s->truename) -// name = s->truename; -// else -// name = s->name; -// -// if (name[0] == '#') -// strcpy(namebuffer, &name[1]); -// else -// Com_sprintf (namebuffer, sizeof(namebuffer), "sound/%s", name); -// -//// Com_Printf ("loading %s\n",namebuffer); -// -// size = FS_LoadFile (namebuffer, (void **)&data); -// -// if (!data) -// { -// Com_DPrintf ("Couldn't load %s\n", namebuffer); -// return NULL; -// } -// -// info = GetWavinfo (s->name, data, size); -// if (info.channels != 1) -// { -// Com_Printf ("%s is a stereo sample\n",s->name); -// FS_FreeFile (data); -// return NULL; -// } -// -// stepscale = (float)info.rate / dma.speed; -// len = info.samples / stepscale; -// -// len = len * info.width * info.channels; -// -// sc = s->cache = Z_Malloc (len + sizeof(sfxcache_t)); -// if (!sc) -// { -// FS_FreeFile (data); -// return NULL; -// } -// -// sc->length = info.samples; -// sc->loopstart = info.loopstart; -// sc->speed = info.rate; -// sc->width = info.width; -// sc->stereo = info.channels; -// -// ResampleSfx (s, sc->speed, sc->width, data + info.dataofs); -// -// FS_FreeFile (data); -// + static sfxcache_t LoadSound(sfx_t s) { + String namebuffer; + byte[] data; + wavinfo_t info; + int len; + float stepscale; + sfxcache_t sc = null; + int size; + String name; + + if (s.name.charAt(0) == '*') + return null; + + // see if still in memory + sc = s.cache; + if (sc != null) + return sc; + + // load it in + if (s.truename != null) + name = s.truename; + else + name = s.name; + + if (name.charAt(0) == '#') + namebuffer = name.substring(1); + //strcpy(namebuffer, &name[1]); + else + namebuffer = "sound/" + name; + //Com_sprintf (namebuffer, sizeof(namebuffer), "sound/%s", name); + + data = FS.LoadFile(namebuffer); + + if (data == null) { + Com.DPrintf("Couldn't load " + namebuffer + "\n"); + return null; + } + size = data.length; + + info = GetWavinfo(s.name, data, size); + if (info.channels != 1) { + Com.Printf(s.name + " is a stereo sample\n"); + FS.FreeFile(data); + return null; + } + + stepscale = ((float)info.rate) / dma.speed; + len = (int) (info.samples / stepscale); + + len = len * info.width * info.channels; + + //sc = s.cache = Z_Malloc (len + sizeof(sfxcache_t)); + sc = s.cache = new sfxcache_t(len); + + sc.length = info.samples; + sc.loopstart = info.loopstart; + sc.speed = info.rate; + sc.width = info.width; + sc.stereo = info.channels; + + ResampleSfx(s, sc.speed, sc.width, data, info.dataofs); + + FS.FreeFile(data); + return sc; } // @@ -192,67 +187,65 @@ public class SND_MEM extends SND_JAVA { // =============================================================================== // */ // -// -// byte *data_p; -// byte *iff_end; -// byte *last_chunk; -// byte *iff_data; -// int iff_chunk_len; -// -// -// short GetLittleShort(void) -// { -// short val = 0; -// val = *data_p; -// val = val + (*(data_p+1)<<8); -// data_p += 2; -// return val; -// } -// -// int GetLittleLong(void) -// { -// int val = 0; -// val = *data_p; -// val = val + (*(data_p+1)<<8); -// val = val + (*(data_p+2)<<16); -// val = val + (*(data_p+3)<<24); -// data_p += 4; -// return val; -// } -// -// void FindNextChunk(char *name) -// { -// while (1) -// { -// data_p=last_chunk; -// -// if (data_p >= iff_end) -// { // didn't find the chunk -// data_p = NULL; -// return; -// } -// -// data_p += 4; -// iff_chunk_len = GetLittleLong(); -// if (iff_chunk_len < 0) -// { -// data_p = NULL; -// return; -// } -//// if (iff_chunk_len > 1024*1024) -//// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); -// data_p -= 8; -// last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 ); -// if (!strncmp(data_p, name, 4)) -// return; -// } -// } -// -// void FindChunk(char *name) -// { -// last_chunk = iff_data; -// FindNextChunk (name); -// } + static byte[] data_b; + static int data_p; + static int iff_end; + static int last_chunk; + static int iff_data; + static int iff_chunk_len; + + + static short GetLittleShort() { + short val = 0; + val = data_b[data_p]; + data_p++; + val |= (data_b[data_p] << 8); + data_p++; + return val; + } + + static int GetLittleLong() { + int val = 0; + val = data_b[data_p]; + data_p++; + val |= (data_b[data_p] << 8); + data_p++; + val |= (data_b[data_p] << 16); + data_p++; + val |= (data_b[data_p] << 24); + data_p++; + return val; + } + + static void FindNextChunk(String name) { + while (true) { + data_p = last_chunk; + + if (data_p >= iff_end) { // didn't find the chunk + data_p = 0; + return; + } + + data_p += 4; + iff_chunk_len = GetLittleLong(); + if (iff_chunk_len < 0) { + data_p = 0; + return; + } + // if (iff_chunk_len > 1024*1024) + // Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); + data_p -= 8; + last_chunk = data_p + 8 + ((iff_chunk_len + 1) & ~1); + String s = new String(data_b, data_p, 4); + if (s.equals(name)) + return; + } + } + + static void FindChunk(String name) { + last_chunk = iff_data; + FindNextChunk(name); + } // // // void DumpChunks(void) @@ -271,104 +264,101 @@ public class SND_MEM extends SND_JAVA { // } while (data_p < iff_end); // } // -// /* -// ============ -// GetWavinfo -// ============ -// */ -// wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength) -// { -// wavinfo_t info; -// int i; -// int format; -// int samples; -// -// memset (&info, 0, sizeof(info)); -// -// if (!wav) -// return info; -// -// iff_data = wav; -// iff_end = wav + wavlength; -// -//// find "RIFF" chunk -// FindChunk("RIFF"); -// if (!(data_p && !strncmp(data_p+8, "WAVE", 4))) -// { -// Com_Printf("Missing RIFF/WAVE chunks\n"); -// return info; -// } -// -//// get "fmt " chunk -// iff_data = data_p + 12; -//// DumpChunks (); -// -// FindChunk("fmt "); -// if (!data_p) -// { -// Com_Printf("Missing fmt chunk\n"); -// return info; -// } -// data_p += 8; -// format = GetLittleShort(); -// if (format != 1) -// { -// Com_Printf("Microsoft PCM format only\n"); -// return info; -// } -// -// info.channels = GetLittleShort(); -// info.rate = GetLittleLong(); -// data_p += 4+2; -// info.width = GetLittleShort() / 8; -// -//// get cue chunk -// FindChunk("cue "); -// if (data_p) -// { -// data_p += 32; -// info.loopstart = GetLittleLong(); -//// Com_Printf("loopstart=%d\n", sfx->loopstart); -// -// // if the next chunk is a LIST chunk, look for a cue length marker -// FindNextChunk ("LIST"); -// if (data_p) -// { -// if (!strncmp (data_p + 28, "mark", 4)) -// { // this is not a proper parse, but it works with cooledit... -// data_p += 24; -// i = GetLittleLong (); // samples in loop -// info.samples = info.loopstart + i; -//// Com_Printf("looped length: %i\n", i); -// } -// } -// } -// else -// info.loopstart = -1; -// -//// find data chunk -// FindChunk("data"); -// if (!data_p) -// { -// Com_Printf("Missing data chunk\n"); -// return info; -// } -// -// data_p += 4; -// samples = GetLittleLong () / info.width; -// -// if (info.samples) -// { -// if (samples < info.samples) -// Com_Error (ERR_DROP, "Sound %s has a bad loop length", name); -// } -// else -// info.samples = samples; -// -// info.dataofs = data_p - wav; -// -// return info; -// } -// + /* + ============ + GetWavinfo + ============ + */ + static wavinfo_t GetWavinfo(String name, byte[] wav, int wavlength) { + wavinfo_t info = new wavinfo_t(); + int i; + int format; + int samples; + + if (wav == null) + return info; + + iff_data = 0; + iff_end = wavlength; + data_b = wav; + + // find "RIFF" chunk + FindChunk("RIFF"); + String s = new String(data_b, data_p + 8, 4); + if (!((data_p != 0) && s.equals("WAVE"))) { + Com.Printf("Missing RIFF/WAVE chunks\n"); + return info; + } + + // get "fmt " chunk + iff_data = data_p + 12; + // DumpChunks (); + + FindChunk("fmt "); + if (data_p == 0) { + Com.Printf("Missing fmt chunk\n"); + return info; + } + data_p += 8; + format = GetLittleShort(); + if (format != 1) { + Com.Printf("Microsoft PCM format only\n"); + return info; + } + + info.channels = GetLittleShort(); + info.rate = GetLittleLong(); + data_p += 4 + 2; + info.width = GetLittleShort() / 8; + + // get cue chunk + FindChunk("cue "); + if (data_p != 0) { + data_p += 32; + info.loopstart = GetLittleLong(); + // Com_Printf("loopstart=%d\n", sfx->loopstart); + // if the next chunk is a LIST chunk, look for a cue length marker + FindNextChunk("LIST"); + if (data_p != 0) { + s = new String(data_b, data_p + 28, 4); + if (s.equals("MARK")) { // this is not a proper parse, but it works with cooledit... + data_p += 24; + i = GetLittleLong(); // samples in loop + info.samples = info.loopstart + i; + // Com_Printf("looped length: %i\n", i); + } + } + } else + info.loopstart = -1; + + // find data chunk + FindChunk("data"); + if (data_p == 0) { + Com.Printf("Missing data chunk\n"); + return info; + } + + data_p += 4; + samples = GetLittleLong() / info.width; + + if (info.samples != 0) { + if (samples < info.samples) + Com.Error(ERR_DROP, "Sound " + name + " has a bad loop length"); + } else + info.samples = samples; + + info.dataofs = data_p; + + return info; + } + + static class wavinfo_t { + int rate; + int width; + int channels; + int loopstart; + int samples; + int dataofs; // chunk starts this many bytes from file start + } } diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java index dad6fc0..7b71830 100644 --- a/src/jake2/client/VID.java +++ b/src/jake2/client/VID.java @@ -2,7 +2,7 @@ * VID.java * Copyright (C) 2003 * - * $Id: VID.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ + * $Id: VID.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,9 +31,8 @@ import jake2.game.Cmd; import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.render.Renderer; -import jake2.sys.*; +import jake2.sys.IN; import jake2.sys.KBD; -import jake2.sys.RW; import jake2.util.Vargs; import java.awt.Dimension; @@ -147,7 +146,7 @@ public class VID extends Globals { { if (Globals.re != null) { KBD.Close(); - RW.IN_Shutdown(); + IN.Shutdown(); } Globals.re = null; @@ -165,7 +164,7 @@ public class VID extends Globals { if ( reflib_active ) { KBD.Close(); - RW.IN_Shutdown(); + IN.Shutdown(); Globals.re.Shutdown(); FreeReflib(); @@ -404,7 +403,7 @@ public class VID extends Globals { if ( reflib_active ) { KBD.Close(); - RW.IN_Shutdown(); + IN.Shutdown(); Globals.re.Shutdown(); FreeReflib(); diff --git a/src/jake2/client/sfx_t.java b/src/jake2/client/sfx_t.java index 97431ab..359b40f 100644 --- a/src/jake2/client/sfx_t.java +++ b/src/jake2/client/sfx_t.java @@ -2,7 +2,7 @@ * sfx_t.java * Copyright (C) 2003 * - * $Id: sfx_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ + * $Id: sfx_t.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.client; public class sfx_t { - String name =""; //mem + String name; //mem int registration_sequence; sfxcache_t cache; //ptr String truename; //ptr diff --git a/src/jake2/client/sfxcache_t.java b/src/jake2/client/sfxcache_t.java index 69fbcde..245d921 100644 --- a/src/jake2/client/sfxcache_t.java +++ b/src/jake2/client/sfxcache_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.11.2003 by RST. -// $Id: sfxcache_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: sfxcache_t.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.client; @@ -29,6 +29,9 @@ public class sfxcache_t { int speed; // not needed, because converted on load? int width; int stereo; - byte data[] = new byte[1]; // variable sized - + byte data[]; // variable sized + + public sfxcache_t(int size) { + data = new byte[size]; + } } diff --git a/src/jake2/game/AIAdapter.java b/src/jake2/game/AIAdapter.java index f6bd6cb..4f4a538 100644 --- a/src/jake2/game/AIAdapter.java +++ b/src/jake2/game/AIAdapter.java @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 11.11.2003 by RST. -// $Id: AIAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: AIAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class AIAdapter extends SuperAdapter { - public void ai(edict_t self, float dist) { - } +public abstract class AIAdapter extends SuperAdapter +{ + public abstract void ai(edict_t self, float dist); } diff --git a/src/jake2/game/BigEndianHandler.java b/src/jake2/game/BigEndianHandler.java index 493410c..c9e2830 100644 --- a/src/jake2/game/BigEndianHandler.java +++ b/src/jake2/game/BigEndianHandler.java @@ -1,8 +1,25 @@ /* - * BigEndianHandler.java - * Copyright (C) 2003 - * - * $Id: BigEndianHandler.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +/* + * $Id: BigEndianHandler.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ */ package jake2.game; diff --git a/src/jake2/game/Cmd.java b/src/jake2/game/Cmd.java index 8292d25..bbb6742 100644 --- a/src/jake2/game/Cmd.java +++ b/src/jake2/game/Cmd.java @@ -2,7 +2,7 @@ * Cmd.java * Copyright (C) 2003 * - * $Id: Cmd.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ + * $Id: Cmd.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -194,7 +194,7 @@ public final class Cmd extends PlayerView { token = Cvar.VariableString(token); - j = strlen(token); + j = token.length(); len += j; @@ -240,7 +240,6 @@ public final class Cmd extends PlayerView { ============ */ public static void TokenizeString(char text[], boolean macroExpand) { - int i; String com_token; cmd_argc = 0; @@ -394,7 +393,6 @@ public final class Cmd extends PlayerView { // // Com.DPrintf("\n"); // } - //System.out.println("tokenized[" + Argv(0) + "]" + "[" + Argv(1) + "]"); // execute the command line if (Argc() == 0) return; // no tokens @@ -476,7 +474,7 @@ public final class Cmd extends PlayerView { } if (give_all || 0 == Lib.Q_stricmp(name, "weapons")) { - for (i = 0; i < GameBase.game.num_items; i++) { + for (i = 1; i < GameBase.game.num_items; i++) { it = GameAI.itemlist[i]; if (null == it.pickup) continue; @@ -489,7 +487,7 @@ public final class Cmd extends PlayerView { } if (give_all || 0 == Lib.Q_stricmp(name, "ammo")) { - for (i = 0; i < GameBase.game.num_items; i++) { + for (i = 1; i < GameBase.game.num_items; i++) { it = GameAI.itemlist[i]; if (null == it.pickup) continue; @@ -523,7 +521,7 @@ public final class Cmd extends PlayerView { it_ent = GameUtil.G_Spawn(); it_ent.classname = it.classname; GameAI.SpawnItem(it_ent, it); - GameAI.Touch_Item(it_ent, ent, null, null); + GameAI.Touch_Item(it_ent, ent, GameBase.dummyplane, null); if (it_ent.inuse) GameUtil.G_FreeEdict(it_ent); @@ -532,7 +530,7 @@ public final class Cmd extends PlayerView { } if (give_all) { - for (i = 0; i < GameBase.game.num_items; i++) { + for (i = 1; i < GameBase.game.num_items; i++) { it = GameAI.itemlist[i]; if (it.pickup != null) continue; @@ -570,7 +568,7 @@ public final class Cmd extends PlayerView { it_ent = GameUtil.G_Spawn(); it_ent.classname = it.classname; GameAI.SpawnItem(it_ent, it); - GameAI.Touch_Item(it_ent, ent, null, null); + GameAI.Touch_Item(it_ent, ent, GameBase.dummyplane, null); if (it_ent.inuse) GameUtil.G_FreeEdict(it_ent); } @@ -669,7 +667,7 @@ public final class Cmd extends PlayerView { s = GameBase.gi.args(); it = GameUtil.FindItem(s); - if (it != null) { + if (it == null) { GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n"); return; } @@ -825,6 +823,8 @@ public final class Cmd extends PlayerView { // scan for the next valid one for (i = 1; i <= Defines.MAX_ITEMS; i++) { index = (selected_weapon + Defines.MAX_ITEMS - i) % Defines.MAX_ITEMS; + //bugfix rst + if (index == 0) index++; if (0 == cl.pers.inventory[index]) continue; it = GameAI.itemlist[index]; @@ -950,7 +950,7 @@ public final class Cmd extends PlayerView { ent.flags &= ~Defines.FL_GODMODE; ent.health = 0; GameBase.meansOfDeath = Defines.MOD_SUICIDE; - GameAI.player_die.die(ent, ent, ent, 100000, GameBase.vec3_origin); + GameAIAdapters.player_die.die(ent, ent, ent, 100000, GameBase.vec3_origin); } /* @@ -989,7 +989,7 @@ public final class Cmd extends PlayerView { // sort by frags //qsort(index, count, sizeof(index[0]), PlayerSort); //replaced by: - Arrays.sort(index, 0, count - 1, GameAI.PlayerSort); + Arrays.sort(index, 0, count - 1, GameAIAdapters.PlayerSort); // print information large = ""; @@ -1001,7 +1001,7 @@ public final class Cmd extends PlayerView { + GameBase.game.clients[index[i].intValue()].pers.netname + "\n"; - if (Lib.strlen(small) + Lib.strlen(large) > 1024 - 100) { + if (small.length() + large.length() > 1024 - 100) { // can't print all of them in one packet large += "...\n"; break; @@ -1070,7 +1070,6 @@ public final class Cmd extends PlayerView { int i, j; edict_t other; - char p; String text; gclient_t cl; @@ -1108,7 +1107,7 @@ public final class Cmd extends PlayerView { } // don't let text be too long for malicious reasons - if (strlen(text) > 150) + if (text.length() > 150) //text[150] = 0; text = text.substring(0, 150); @@ -1186,7 +1185,7 @@ public final class Cmd extends PlayerView { + (e2.client.resp.spectator ? " (spectator)" : "") + "\n"; - if (Lib.strlen(text) + Lib.strlen(st) > 1024 - 50) { + if (text.length() + st.length() > 1024 - 50) { text += "And more...\n"; GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "" + text + ""); return; diff --git a/src/jake2/game/EdictFindFilter.java b/src/jake2/game/EdictFindFilter.java index 53fd1de..84dddf2 100644 --- a/src/jake2/game/EdictFindFilter.java +++ b/src/jake2/game/EdictFindFilter.java @@ -19,14 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 07.11.2003 by RST. -// $Id: EdictFindFilter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EdictFindFilter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; /** Helps for filtering the iteration over the gedicts[] array, see GFind(). RST.*/ -public class EdictFindFilter { - boolean matches(edict_t e, String s) { +public class EdictFindFilter +{ + boolean matches(edict_t e, String s) + { return false; }; }
\ No newline at end of file diff --git a/src/jake2/game/EdictIterator.java b/src/jake2/game/EdictIterator.java index ea0d5ca..859edd5 100644 --- a/src/jake2/game/EdictIterator.java +++ b/src/jake2/game/EdictIterator.java @@ -19,18 +19,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 07.11.2003 by RST. -// $Id: EdictIterator.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EdictIterator.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; /** Helps for iterating over the gedicts[] array. RST.*/ -class EdictIterator { - - EdictIterator(int i) { - this.i= i; +public class EdictIterator +{ + EdictIterator(int i) + { + this.i = i; } - edict_t o; int i; }
\ No newline at end of file diff --git a/src/jake2/game/EndianHandler.java b/src/jake2/game/EndianHandler.java index 510541d..06595d2 100644 --- a/src/jake2/game/EndianHandler.java +++ b/src/jake2/game/EndianHandler.java @@ -2,7 +2,7 @@ * AbstractEndianHandler.java * Copyright (C) 2003 * - * $Id: EndianHandler.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ + * $Id: EndianHandler.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,14 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.game; - -/** - * AbstractEndianHandler</code> - */ -public abstract class EndianHandler{ - +public abstract class EndianHandler +{ private static final int mask = 0xFF; - + abstract public float BigFloat(float f); abstract public short BigShort(short s); abstract public int BigLong(int i); @@ -40,38 +36,41 @@ public abstract class EndianHandler{ abstract public short LittleShort(short s); abstract public int LittleLong(int i); - public static float swapFloat(float f) { + public static float swapFloat(float f) + { int i = Float.floatToRawIntBits(f); i = swapInt(i); f = Float.intBitsToFloat(i); - + return f; } - - public static int swapInt(int i) { - + + public static int swapInt(int i) + { + int a = i & mask; i >>>= 8; - + a <<= 24; - + int b = i & mask; - + i >>>= 8; b <<= 16; - + int c = i & mask; i >>>= 8; c <<= 8; return i | c | b | a; } - - public static short swapShort(short s) { + + public static short swapShort(short s) + { int a = s & mask; a <<= 8; int b = (s >>> 8) & mask; - - return (short)(b | a); + + return (short) (b | a); } } diff --git a/src/jake2/game/EntBlockedAdapter.java b/src/jake2/game/EntBlockedAdapter.java index 8ed731f..09ae485 100644 --- a/src/jake2/game/EntBlockedAdapter.java +++ b/src/jake2/game/EntBlockedAdapter.java @@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntBlockedAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntBlockedAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntBlockedAdapter extends SuperAdapter{ +public abstract class EntBlockedAdapter extends SuperAdapter +{ // move to moveinfo? - public void blocked(edict_t self, edict_t other) { - } + public abstract void blocked(edict_t self, edict_t other); }
\ No newline at end of file diff --git a/src/jake2/game/EntDieAdapter.java b/src/jake2/game/EntDieAdapter.java index 3900bd4..d5ead8a 100644 --- a/src/jake2/game/EntDieAdapter.java +++ b/src/jake2/game/EntDieAdapter.java @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntDieAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntDieAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntDieAdapter extends SuperAdapter { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - } +public abstract class EntDieAdapter extends SuperAdapter +{ + public abstract void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point); }
\ No newline at end of file diff --git a/src/jake2/game/EntDodgeAdapter.java b/src/jake2/game/EntDodgeAdapter.java index 17e8004..34aa612 100644 --- a/src/jake2/game/EntDodgeAdapter.java +++ b/src/jake2/game/EntDodgeAdapter.java @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntDodgeAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntDodgeAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntDodgeAdapter extends SuperAdapter { - public void dodge(edict_t self, edict_t other, float eta) { - } +public abstract class EntDodgeAdapter extends SuperAdapter +{ + public abstract void dodge(edict_t self, edict_t other, float eta); } diff --git a/src/jake2/game/EntInteractAdapter.java b/src/jake2/game/EntInteractAdapter.java index d65e16e..360126f 100644 --- a/src/jake2/game/EntInteractAdapter.java +++ b/src/jake2/game/EntInteractAdapter.java @@ -18,14 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - // Created on 08.11.2003 by RST. -// $Id: EntInteractAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntInteractAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntInteractAdapter extends SuperAdapter { - public boolean interact(edict_t self, edict_t other) { - return false; - } +public abstract class EntInteractAdapter extends SuperAdapter +{ + public abstract boolean interact(edict_t self, edict_t other); }
\ No newline at end of file diff --git a/src/jake2/game/EntPainAdapter.java b/src/jake2/game/EntPainAdapter.java index 129876b..ae814a4 100644 --- a/src/jake2/game/EntPainAdapter.java +++ b/src/jake2/game/EntPainAdapter.java @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntPainAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntPainAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntPainAdapter extends SuperAdapter { - public void pain(edict_t self, edict_t other, float kick, int damage) { - } +public abstract class EntPainAdapter extends SuperAdapter +{ + public abstract void pain(edict_t self, edict_t other, float kick, int damage); }
\ No newline at end of file diff --git a/src/jake2/game/EntThinkAdapter.java b/src/jake2/game/EntThinkAdapter.java index 4bf7ef8..0cbab2e 100644 --- a/src/jake2/game/EntThinkAdapter.java +++ b/src/jake2/game/EntThinkAdapter.java @@ -19,13 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntThinkAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntThinkAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public abstract class EntThinkAdapter extends SuperAdapter { - - public boolean think(edict_t self) { - return false; - } +public abstract class EntThinkAdapter extends SuperAdapter +{ + public abstract boolean think(edict_t self); }
\ No newline at end of file diff --git a/src/jake2/game/EntTouchAdapter.java b/src/jake2/game/EntTouchAdapter.java index 732e1fa..7d217ab 100644 --- a/src/jake2/game/EntTouchAdapter.java +++ b/src/jake2/game/EntTouchAdapter.java @@ -19,12 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntTouchAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntTouchAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntTouchAdapter extends SuperAdapter { - - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - } +public abstract class EntTouchAdapter extends SuperAdapter +{ + public abstract void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf); }
\ No newline at end of file diff --git a/src/jake2/game/EntUseAdapter.java b/src/jake2/game/EntUseAdapter.java index 03bc62b..b4ab343 100644 --- a/src/jake2/game/EntUseAdapter.java +++ b/src/jake2/game/EntUseAdapter.java @@ -19,12 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: EntUseAdapter.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: EntUseAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class EntUseAdapter extends SuperAdapter { - - public void use(edict_t self, edict_t other, edict_t activator) { - } +public abstract class EntUseAdapter extends SuperAdapter +{ + public abstract void use(edict_t self, edict_t other, edict_t activator); }
\ No newline at end of file diff --git a/src/jake2/game/Fire.java b/src/jake2/game/Fire.java index 9a68b08..2c79b3a 100644 --- a/src/jake2/game/Fire.java +++ b/src/jake2/game/Fire.java @@ -19,20 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 04.12.2003 by RST. -// $Id: Fire.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: Fire.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; +import jake2.Defines; +import jake2.util.Lib; +import jake2.util.Math3D; - import jake2.*; - import jake2.client.*; - import jake2.qcommon.*; - import jake2.render.*; - import jake2.server.*; -import jake2.util.*; - -public class Fire { - +public class Fire +{ /* ================= fire_hit @@ -40,48 +36,53 @@ public class Fire { Used for all impact (hit/punch/slash) attacks ================= */ - public static boolean fire_hit(edict_t self, float[] aim, int damage, int kick) { + public static boolean fire_hit(edict_t self, float[] aim, int damage, int kick) + { trace_t tr; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }, up= { 0, 0, 0 }; - float[] v= { 0, 0, 0 }; - float[] point= { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 }; + float[] v = { 0, 0, 0 }; + float[] point = { 0, 0, 0 }; float range; - float[] dir= { 0, 0, 0 }; - + float[] dir = { 0, 0, 0 }; + //see if enemy is in range Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, dir); - range= Math3D.VectorLength(dir); + range = Math3D.VectorLength(dir); if (range > aim[0]) return false; - - if (aim[1] > self.mins[0] && aim[1] < self.maxs[0]) { + + if (aim[1] > self.mins[0] && aim[1] < self.maxs[0]) + { // the hit is straight on so back the range up to the edge of their bbox range -= self.enemy.maxs[0]; - } else { + } + else + { // this is a side hit so adjust the "right" value out to the edge of their bbox if (aim[1] < 0) - aim[1]= self.enemy.mins[0]; + aim[1] = self.enemy.mins[0]; else - aim[1]= self.enemy.maxs[0]; + aim[1] = self.enemy.maxs[0]; } - + Math3D.VectorMA(self.s.origin, range, dir, point); - - tr= GameBase.gi.trace(self.s.origin, null, null, point, self, Defines.MASK_SHOT); - if (tr.fraction < 1) { + + tr = GameBase.gi.trace(self.s.origin, null, null, point, self, Defines.MASK_SHOT); + if (tr.fraction < 1) + { if (0 == tr.ent.takedamage) return false; // if it will hit any client/monster then hit the one we wanted to hit if ((tr.ent.svflags & Defines.SVF_MONSTER) != 0 || (tr.ent.client != null)) - tr.ent= self.enemy; + tr.ent = self.enemy; } - + Math3D.AngleVectors(self.s.angles, forward, right, up); Math3D.VectorMA(self.s.origin, range, forward, point); Math3D.VectorMA(point, aim[1], right, point); Math3D.VectorMA(point, aim[2], up, point); Math3D.VectorSubtract(point, self.enemy.s.origin, dir); - + // do the damage GameUtil.T_Damage( tr.ent, @@ -94,17 +95,17 @@ public class Fire { kick / 2, Defines.DAMAGE_NO_KNOCKBACK, Defines.MOD_HIT); - + if (0 == (tr.ent.svflags & Defines.SVF_MONSTER) && (null == tr.ent.client)) return false; - + // do our special form of knockback here Math3D.VectorMA(self.enemy.absmin, 0.5f, self.enemy.size, v); Math3D.VectorSubtract(v, point, v); Math3D.VectorNormalize(v); Math3D.VectorMA(self.enemy.velocity, kick, v, self.enemy.velocity); if (self.enemy.velocity[2] > 0) - self.enemy.groundentity= null; + self.enemy.groundentity = null; return true; } /* @@ -114,7 +115,7 @@ public class Fire { This is an internal support routine used for bullet/pellet based weapons. ================= */ - public static void fire_lead( + public static void fire_lead( edict_t self, float[] start, float[] aimdir, @@ -123,57 +124,65 @@ public class Fire { int te_impact, int hspread, int vspread, - int mod) { + int mod) + { trace_t tr; - float[] dir= { 0, 0, 0 }; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }, up= { 0, 0, 0 }; - float[] end= { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; float r; float u; - float[] water_start= { 0, 0, 0 }; - boolean water= false; - int content_mask= Defines.MASK_SHOT | Defines.MASK_WATER; - - tr= GameBase.gi.trace(self.s.origin, null, null, start, self, Defines.MASK_SHOT); - if (!(tr.fraction < 1.0)) { + float[] water_start = { 0, 0, 0 }; + boolean water = false; + int content_mask = Defines.MASK_SHOT | Defines.MASK_WATER; + + tr = GameBase.gi.trace(self.s.origin, null, null, start, self, Defines.MASK_SHOT); + if (!(tr.fraction < 1.0)) + { Math3D.vectoangles(aimdir, dir); Math3D.AngleVectors(dir, forward, right, up); - - r= Lib.crandom() * hspread; - u= Lib.crandom() * vspread; + + r = Lib.crandom() * hspread; + u = Lib.crandom() * vspread; Math3D.VectorMA(start, 8192, forward, end); Math3D.VectorMA(end, r, right, end); Math3D.VectorMA(end, u, up, end); - - if ((GameBase.gi.pointcontents.pointcontents(start) & Defines.MASK_WATER) != 0) { - water= true; + + if ((GameBase.gi.pointcontents.pointcontents(start) & Defines.MASK_WATER) != 0) + { + water = true; Math3D.VectorCopy(start, water_start); content_mask &= ~Defines.MASK_WATER; } - - tr= GameBase.gi.trace(start, null, null, end, self, content_mask); - + + tr = GameBase.gi.trace(start, null, null, end, self, content_mask); + // see if we hit water - if ((tr.contents & Defines.MASK_WATER) != 0) { + if ((tr.contents & Defines.MASK_WATER) != 0) + { int color; - - water= true; + + water = true; Math3D.VectorCopy(tr.endpos, water_start); - - if (0 == Math3D.VectorCompare(start, tr.endpos)) { - if ((tr.contents & Defines.CONTENTS_WATER) != 0) { + + if (0 == Math3D.VectorCompare(start, tr.endpos)) + { + if ((tr.contents & Defines.CONTENTS_WATER) != 0) + { if (Lib.strcmp(tr.surface.name, "*brwater") == 0) - color= Defines.SPLASH_BROWN_WATER; + color = Defines.SPLASH_BROWN_WATER; else - color= Defines.SPLASH_BLUE_WATER; - } else if ((tr.contents & Defines.CONTENTS_SLIME) != 0) - color= Defines.SPLASH_SLIME; + color = Defines.SPLASH_BLUE_WATER; + } + else if ((tr.contents & Defines.CONTENTS_SLIME) != 0) + color = Defines.SPLASH_SLIME; else if ((tr.contents & Defines.CONTENTS_LAVA) != 0) - color= Defines.SPLASH_LAVA; + color = Defines.SPLASH_LAVA; else - color= Defines.SPLASH_UNKNOWN; - - if (color != Defines.SPLASH_UNKNOWN) { + color = Defines.SPLASH_UNKNOWN; + + if (color != Defines.SPLASH_UNKNOWN) + { GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(Defines.TE_SPLASH); GameBase.gi.WriteByte(8); @@ -182,27 +191,30 @@ public class Fire { GameBase.gi.WriteByte(color); GameBase.gi.multicast(tr.endpos, Defines.MULTICAST_PVS); } - + // change bullet's course when it enters water Math3D.VectorSubtract(end, start, dir); Math3D.vectoangles(dir, dir); Math3D.AngleVectors(dir, forward, right, up); - r= Lib.crandom() * hspread * 2; - u= Lib.crandom() * vspread * 2; + r = Lib.crandom() * hspread * 2; + u = Lib.crandom() * vspread * 2; Math3D.VectorMA(water_start, 8192, forward, end); Math3D.VectorMA(end, r, right, end); Math3D.VectorMA(end, u, up, end); } - + // re-trace ignoring water this time - tr= GameBase.gi.trace(water_start, null, null, end, self, Defines.MASK_SHOT); + tr = GameBase.gi.trace(water_start, null, null, end, self, Defines.MASK_SHOT); } } - + // send gun puff / flash - if (!((tr.surface != null) && 0 != (tr.surface.flags & Defines.SURF_SKY))) { - if (tr.fraction < 1.0) { - if (tr.ent.takedamage != 0) { + if (!((tr.surface != null) && 0 != (tr.surface.flags & Defines.SURF_SKY))) + { + if (tr.fraction < 1.0) + { + if (tr.ent.takedamage != 0) + { GameUtil.T_Damage( tr.ent, self, @@ -214,36 +226,40 @@ public class Fire { kick, Defines.DAMAGE_BULLET, mod); - } else { - if (!"sky".equals(tr.surface.name)) { + } + else + { + if (!"sky".equals(tr.surface.name)) + { GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(te_impact); GameBase.gi.WritePosition(tr.endpos); GameBase.gi.WriteDir(tr.plane.normal); GameBase.gi.multicast(tr.endpos, Defines.MULTICAST_PVS); - + if (self.client != null) GameWeapon.PlayerNoise(self, tr.endpos, Defines.PNOISE_IMPACT); } } } } - + // if went through water, determine where the end and make a bubble trail - if (water) { - float[] pos= { 0, 0, 0 }; - + if (water) + { + float[] pos = { 0, 0, 0 }; + Math3D.VectorSubtract(tr.endpos, water_start, dir); Math3D.VectorNormalize(dir); Math3D.VectorMA(tr.endpos, -2, dir, pos); if ((Game.gi.pointcontents.pointcontents(pos) & Defines.MASK_WATER) != 0) Math3D.VectorCopy(pos, tr.endpos); else - tr= GameBase.gi.trace(pos, null, null, water_start, tr.ent, Defines.MASK_WATER); - + tr = GameBase.gi.trace(pos, null, null, water_start, tr.ent, Defines.MASK_WATER); + Math3D.VectorAdd(water_start, tr.endpos, pos); Math3D.VectorScale(pos, 0.5f, pos); - + GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(Defines.TE_BUBBLETRAIL); GameBase.gi.WritePosition(water_start); @@ -259,7 +275,7 @@ public class Fire { pistols, rifles, etc.... ================= */ - public static void fire_bullet( + public static void fire_bullet( edict_t self, float[] start, float[] aimdir, @@ -267,7 +283,8 @@ public class Fire { int kick, int hspread, int vspread, - int mod) { + int mod) + { fire_lead(self, start, aimdir, damage, kick, Defines.TE_GUNSHOT, hspread, vspread, mod); } /* @@ -277,7 +294,7 @@ public class Fire { Shoots shotgun pellets. Used by shotgun and super shotgun. ================= */ - public static void fire_shotgun( + public static void fire_shotgun( edict_t self, float[] start, float[] aimdir, @@ -286,27 +303,22 @@ public class Fire { int hspread, int vspread, int count, - int mod) { + int mod) + { int i; - - for (i= 0; i < count; i++) + + for (i = 0; i < count; i++) fire_lead(self, start, aimdir, damage, kick, Defines.TE_SHOTGUN, hspread, vspread, mod); } - public static void fire_blaster( - edict_t self, - float[] start, - float[] dir, - int damage, - int speed, - int effect, - boolean hyper) { + public static void fire_blaster(edict_t self, float[] start, float[] dir, int damage, int speed, int effect, boolean hyper) + { edict_t bolt; trace_t tr; - + Math3D.VectorNormalize(dir); - - bolt= GameUtil.G_Spawn(); - bolt.svflags= Defines.SVF_DEADMONSTER; + + bolt = GameUtil.G_Spawn(); + bolt.svflags = Defines.SVF_DEADMONSTER; // yes, I know it looks weird that projectiles are deadmonsters // what this means is that when prediction is used against the object // (blaster/hyperblaster shots), the player won't be solid clipped against @@ -316,31 +328,32 @@ public class Fire { Math3D.VectorCopy(start, bolt.s.old_origin); Math3D.vectoangles(dir, bolt.s.angles); Math3D.VectorScale(dir, speed, bolt.velocity); - bolt.movetype= Defines.MOVETYPE_FLYMISSILE; - bolt.clipmask= Defines.MASK_SHOT; - bolt.solid= Defines.SOLID_BBOX; + bolt.movetype = Defines.MOVETYPE_FLYMISSILE; + bolt.clipmask = Defines.MASK_SHOT; + bolt.solid = Defines.SOLID_BBOX; bolt.s.effects |= effect; Math3D.VectorClear(bolt.mins); Math3D.VectorClear(bolt.maxs); - bolt.s.modelindex= GameBase.gi.modelindex("models/objects/laser/tris.md2"); - bolt.s.sound= GameBase.gi.soundindex("misc/lasfly.wav"); - bolt.owner= self; - bolt.touch= GameWeapon.blaster_touch; - bolt.nextthink= GameBase.level.time + 2; - bolt.think= GameUtil.G_FreeEdictA; - bolt.dmg= damage; - bolt.classname= "bolt"; + bolt.s.modelindex = GameBase.gi.modelindex("models/objects/laser/tris.md2"); + bolt.s.sound = GameBase.gi.soundindex("misc/lasfly.wav"); + bolt.owner = self; + bolt.touch = GameWeaponAdapters.blaster_touch; + bolt.nextthink = GameBase.level.time + 2; + bolt.think = GameUtilAdapters.G_FreeEdictA; + bolt.dmg = damage; + bolt.classname = "bolt"; if (hyper) - bolt.spawnflags= 1; + bolt.spawnflags = 1; GameBase.gi.linkentity(bolt); - + if (self.client != null) GameWeapon.check_dodge(self, bolt.s.origin, dir, speed); - - tr= GameBase.gi.trace(self.s.origin, null, null, bolt.s.origin, bolt, Defines.MASK_SHOT); - if (tr.fraction < 1.0) { + + tr = GameBase.gi.trace(self.s.origin, null, null, bolt.s.origin, bolt, Defines.MASK_SHOT); + if (tr.fraction < 1.0) + { Math3D.VectorMA(bolt.s.origin, -10, dir, bolt.s.origin); - bolt.touch.touch(bolt, tr.ent, null, null); + bolt.touch.touch(bolt, tr.ent, GameBase.dummyplane, null); } } /* @@ -348,46 +361,47 @@ public class Fire { fire_grenade ================= */ - - public static void fire_grenade( + + public static void fire_grenade( edict_t self, float[] start, float[] aimdir, int damage, int speed, float timer, - float damage_radius) { + float damage_radius) + { edict_t grenade; - float[] dir= { 0, 0, 0 }; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }, up= { 0, 0, 0 }; - + float[] dir = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 }; + Math3D.vectoangles(aimdir, dir); Math3D.AngleVectors(dir, forward, right, up); - - grenade= GameUtil.G_Spawn(); + + grenade = GameUtil.G_Spawn(); Math3D.VectorCopy(start, grenade.s.origin); Math3D.VectorScale(aimdir, speed, grenade.velocity); Math3D.VectorMA(grenade.velocity, 200f + Lib.crandom() * 10.0f, up, grenade.velocity); Math3D.VectorMA(grenade.velocity, Lib.crandom() * 10.0f, right, grenade.velocity); Math3D.VectorSet(grenade.avelocity, 300, 300, 300); - grenade.movetype= Defines.MOVETYPE_BOUNCE; - grenade.clipmask= Defines.MASK_SHOT; - grenade.solid= Defines.SOLID_BBOX; + grenade.movetype = Defines.MOVETYPE_BOUNCE; + grenade.clipmask = Defines.MASK_SHOT; + grenade.solid = Defines.SOLID_BBOX; grenade.s.effects |= Defines.EF_GRENADE; Math3D.VectorClear(grenade.mins); Math3D.VectorClear(grenade.maxs); - grenade.s.modelindex= GameBase.gi.modelindex("models/objects/grenade/tris.md2"); - grenade.owner= self; - grenade.touch= GameWeapon.Grenade_Touch; - grenade.nextthink= GameBase.level.time + timer; - grenade.think= GameWeapon.Grenade_Explode; - grenade.dmg= damage; - grenade.dmg_radius= damage_radius; - grenade.classname= "grenade"; - + grenade.s.modelindex = GameBase.gi.modelindex("models/objects/grenade/tris.md2"); + grenade.owner = self; + grenade.touch = GameWeaponAdapters.Grenade_Touch; + grenade.nextthink = GameBase.level.time + timer; + grenade.think = GameWeaponAdapters.Grenade_Explode; + grenade.dmg = damage; + grenade.dmg_radius = damage_radius; + grenade.classname = "grenade"; + GameBase.gi.linkentity(grenade); } - public static void fire_grenade2( + public static void fire_grenade2( edict_t self, float[] start, float[] aimdir, @@ -395,82 +409,85 @@ public class Fire { int speed, float timer, float damage_radius, - boolean held) { + boolean held) + { edict_t grenade; - float[] dir= { 0, 0, 0 }; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }, up= { 0, 0, 0 }; - + float[] dir = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 }; + Math3D.vectoangles(aimdir, dir); Math3D.AngleVectors(dir, forward, right, up); - - grenade= GameUtil.G_Spawn(); + + grenade = GameUtil.G_Spawn(); Math3D.VectorCopy(start, grenade.s.origin); Math3D.VectorScale(aimdir, speed, grenade.velocity); Math3D.VectorMA(grenade.velocity, 200f + Lib.crandom() * 10.0f, up, grenade.velocity); Math3D.VectorMA(grenade.velocity, Lib.crandom() * 10.0f, right, grenade.velocity); Math3D.VectorSet(grenade.avelocity, 300f, 300f, 300f); - grenade.movetype= Defines.MOVETYPE_BOUNCE; - grenade.clipmask= Defines.MASK_SHOT; - grenade.solid= Defines.SOLID_BBOX; + grenade.movetype = Defines.MOVETYPE_BOUNCE; + grenade.clipmask = Defines.MASK_SHOT; + grenade.solid = Defines.SOLID_BBOX; grenade.s.effects |= Defines.EF_GRENADE; Math3D.VectorClear(grenade.mins); Math3D.VectorClear(grenade.maxs); - grenade.s.modelindex= GameBase.gi.modelindex("models/objects/grenade2/tris.md2"); - grenade.owner= self; - grenade.touch= GameWeapon.Grenade_Touch; - grenade.nextthink= GameBase.level.time + timer; - grenade.think= GameWeapon.Grenade_Explode; - grenade.dmg= damage; - grenade.dmg_radius= damage_radius; - grenade.classname= "hgrenade"; + grenade.s.modelindex = GameBase.gi.modelindex("models/objects/grenade2/tris.md2"); + grenade.owner = self; + grenade.touch = GameWeaponAdapters.Grenade_Touch; + grenade.nextthink = GameBase.level.time + timer; + grenade.think = GameWeaponAdapters.Grenade_Explode; + grenade.dmg = damage; + grenade.dmg_radius = damage_radius; + grenade.classname = "hgrenade"; if (held) - grenade.spawnflags= 3; + grenade.spawnflags = 3; else - grenade.spawnflags= 1; - grenade.s.sound= GameBase.gi.soundindex("weapons/hgrenc1b.wav"); - + grenade.spawnflags = 1; + grenade.s.sound = GameBase.gi.soundindex("weapons/hgrenc1b.wav"); + if (timer <= 0.0) - GameWeapon.Grenade_Explode.think(grenade); - else { + GameWeaponAdapters.Grenade_Explode.think(grenade); + else + { GameBase.gi.sound(self, Defines.CHAN_WEAPON, GameBase.gi.soundindex("weapons/hgrent1a.wav"), 1, Defines.ATTN_NORM, 0); GameBase.gi.linkentity(grenade); } } - public static void fire_rocket( + public static void fire_rocket( edict_t self, float[] start, float[] dir, int damage, int speed, float damage_radius, - int radius_damage) { + int radius_damage) + { edict_t rocket; - - rocket= GameUtil.G_Spawn(); + + rocket = GameUtil.G_Spawn(); Math3D.VectorCopy(start, rocket.s.origin); Math3D.VectorCopy(dir, rocket.movedir); Math3D.vectoangles(dir, rocket.s.angles); Math3D.VectorScale(dir, speed, rocket.velocity); - rocket.movetype= Defines.MOVETYPE_FLYMISSILE; - rocket.clipmask= Defines.MASK_SHOT; - rocket.solid= Defines.SOLID_BBOX; + rocket.movetype = Defines.MOVETYPE_FLYMISSILE; + rocket.clipmask = Defines.MASK_SHOT; + rocket.solid = Defines.SOLID_BBOX; rocket.s.effects |= Defines.EF_ROCKET; Math3D.VectorClear(rocket.mins); Math3D.VectorClear(rocket.maxs); - rocket.s.modelindex= GameBase.gi.modelindex("models/objects/rocket/tris.md2"); - rocket.owner= self; - rocket.touch= GameWeapon.rocket_touch; - rocket.nextthink= GameBase.level.time + 8000 / speed; - rocket.think= GameUtil.G_FreeEdictA; - rocket.dmg= damage; - rocket.radius_dmg= radius_damage; - rocket.dmg_radius= damage_radius; - rocket.s.sound= GameBase.gi.soundindex("weapons/rockfly.wav"); - rocket.classname= "rocket"; - + rocket.s.modelindex = GameBase.gi.modelindex("models/objects/rocket/tris.md2"); + rocket.owner = self; + rocket.touch = GameWeaponAdapters.rocket_touch; + rocket.nextthink = GameBase.level.time + 8000 / speed; + rocket.think = GameUtilAdapters.G_FreeEdictA; + rocket.dmg = damage; + rocket.radius_dmg = radius_damage; + rocket.dmg_radius = damage_radius; + rocket.s.sound = GameBase.gi.soundindex("weapons/rockfly.wav"); + rocket.classname = "rocket"; + if (self.client != null) GameWeapon.check_dodge(self, rocket.s.origin, dir, speed); - + GameBase.gi.linkentity(rocket); } /* @@ -478,51 +495,44 @@ public class Fire { fire_rail ================= */ - public static void fire_rail(edict_t self, float[] start, float[] aimdir, int damage, int kick) { - float[] from= { 0, 0, 0 }; - float[] end= { 0, 0, 0 }; - trace_t tr= null; + public static void fire_rail(edict_t self, float[] start, float[] aimdir, int damage, int kick) + { + float[] from = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + trace_t tr = null; edict_t ignore; int mask; boolean water; - + Math3D.VectorMA(start, 8192f, aimdir, end); Math3D.VectorCopy(start, from); - ignore= self; - water= false; - mask= Defines.MASK_SHOT | Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA; - while (ignore != null) { - tr= GameBase.gi.trace(from, null, null, end, ignore, mask); - - if ((tr.contents & (Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA)) != 0) { + ignore = self; + water = false; + mask = Defines.MASK_SHOT | Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA; + while (ignore != null) + { + tr = GameBase.gi.trace(from, null, null, end, ignore, mask); + + if ((tr.contents & (Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA)) != 0) + { mask &= ~(Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA); - water= true; - } else { + water = true; + } + else + { //ZOID--added so rail goes through SOLID_BBOX entities (gibs, etc) - if ((tr.ent.svflags & Defines.SVF_MONSTER) != 0 - || (tr.ent.client != null) - || (tr.ent.solid == Defines.SOLID_BBOX)) - ignore= tr.ent; + if ((tr.ent.svflags & Defines.SVF_MONSTER) != 0 || (tr.ent.client != null) || (tr.ent.solid == Defines.SOLID_BBOX)) + ignore = tr.ent; else - ignore= null; - + ignore = null; + if ((tr.ent != self) && (tr.ent.takedamage != 0)) - GameUtil.T_Damage( - tr.ent, - self, - self, - aimdir, - tr.endpos, - tr.plane.normal, - damage, - kick, - 0, - Defines.MOD_RAILGUN); + GameUtil.T_Damage(tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, 0, Defines.MOD_RAILGUN); } - + Math3D.VectorCopy(tr.endpos, from); } - + // send gun puff / flash GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(Defines.TE_RAILTRAIL); @@ -530,55 +540,51 @@ public class Fire { GameBase.gi.WritePosition(tr.endpos); GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PHS); // gi.multicast (start, MULTICAST_PHS); - if (water) { + if (water) + { GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(Defines.TE_RAILTRAIL); GameBase.gi.WritePosition(start); GameBase.gi.WritePosition(tr.endpos); GameBase.gi.multicast(tr.endpos, Defines.MULTICAST_PHS); } - + if (self.client != null) GameWeapon.PlayerNoise(self, tr.endpos, Defines.PNOISE_IMPACT); } - public static void fire_bfg( - edict_t self, - float[] start, - float[] dir, - int damage, - int speed, - float damage_radius) { + public static void fire_bfg(edict_t self, float[] start, float[] dir, int damage, int speed, float damage_radius) + { edict_t bfg; - - bfg= GameUtil.G_Spawn(); + + bfg = GameUtil.G_Spawn(); Math3D.VectorCopy(start, bfg.s.origin); Math3D.VectorCopy(dir, bfg.movedir); Math3D.vectoangles(dir, bfg.s.angles); Math3D.VectorScale(dir, speed, bfg.velocity); - bfg.movetype= Defines.MOVETYPE_FLYMISSILE; - bfg.clipmask= Defines.MASK_SHOT; - bfg.solid= Defines.SOLID_BBOX; + bfg.movetype = Defines.MOVETYPE_FLYMISSILE; + bfg.clipmask = Defines.MASK_SHOT; + bfg.solid = Defines.SOLID_BBOX; bfg.s.effects |= Defines.EF_BFG | Defines.EF_ANIM_ALLFAST; Math3D.VectorClear(bfg.mins); Math3D.VectorClear(bfg.maxs); - bfg.s.modelindex= GameBase.gi.modelindex("sprites/s_bfg1.sp2"); - bfg.owner= self; - bfg.touch= GameWeapon.bfg_touch; - bfg.nextthink= GameBase.level.time + 8000 / speed; - bfg.think= GameUtil.G_FreeEdictA; - bfg.radius_dmg= damage; - bfg.dmg_radius= damage_radius; - bfg.classname= "bfg blast"; - bfg.s.sound= GameBase.gi.soundindex("weapons/bfg__l1a.wav"); - - bfg.think= GameWeapon.bfg_think; - bfg.nextthink= GameBase.level.time + Defines.FRAMETIME; - bfg.teammaster= bfg; - bfg.teamchain= null; - + bfg.s.modelindex = GameBase.gi.modelindex("sprites/s_bfg1.sp2"); + bfg.owner = self; + bfg.touch = GameWeaponAdapters.bfg_touch; + bfg.nextthink = GameBase.level.time + 8000 / speed; + bfg.think = GameUtilAdapters.G_FreeEdictA; + bfg.radius_dmg = damage; + bfg.dmg_radius = damage_radius; + bfg.classname = "bfg blast"; + bfg.s.sound = GameBase.gi.soundindex("weapons/bfg__l1a.wav"); + + bfg.think = GameWeaponAdapters.bfg_think; + bfg.nextthink = GameBase.level.time + Defines.FRAMETIME; + bfg.teammaster = bfg; + bfg.teamchain = null; + if (self.client != null) GameWeapon.check_dodge(self, bfg.s.origin, dir, speed); - + GameBase.gi.linkentity(bfg); } } diff --git a/src/jake2/game/Game.java b/src/jake2/game/Game.java index 1a98896..39947d6 100644 --- a/src/jake2/game/Game.java +++ b/src/jake2/game/Game.java @@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 17.11.2003 by RST. -// $Id: Game.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ +// $Id: Game.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; // just offers the game namespace. will grow more. -public class Game extends GameSVCmds{ +public class Game extends GameSVCmds +{ } 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; - } } diff --git a/src/jake2/game/GameAIAdapters.java b/src/jake2/game/GameAIAdapters.java new file mode 100644 index 0000000..ea20995 --- /dev/null +++ b/src/jake2/game/GameAIAdapters.java @@ -0,0 +1,1175 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameAIAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.Defines; +import jake2.client.M; +import jake2.qcommon.Com; +import jake2.util.*; + +import java.util.*; + +public class GameAIAdapters +{ + /** 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++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", 500, Defines.GIB_ORGANIC); + for (n = 0; n < 8; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", 500, Defines.GIB_METALLIC); + GameAI.ThrowGib(self, "models/objects/gibs/chest/tris.md2", 500, Defines.GIB_ORGANIC); + GameAI.ThrowHead(self, "models/objects/gibs/gear/tris.md2", 500, Defines.GIB_METALLIC); + self.deadflag = Defines.DEAD_DEAD; + return true; + } + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_EXPLOSION1); + GameBase.gi.WritePosition(org); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + + self.nextthink = GameBase.level.time + 0.1f; + return true; + } + }; + public static EntThinkAdapter walkmonster_start_go = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + if (0 == (self.spawnflags & 2) && GameBase.level.time < 1) + { + M.M_droptofloor.think(self); + + if (self.groundentity != null) + if (!M.M_walkmove(self, 0, 0)) + GameBase.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) + MonsterAdapters.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)) + GameBase.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) + MonsterAdapters.monster_triggered_start.think(self); + return true; + } + }; + public static EntThinkAdapter flymonster_start = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.flags |= Defines.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) + MonsterAdapters.monster_triggered_start.think(self); + return true; + } + }; + public static EntThinkAdapter swimmonster_start = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + { + self.flags |= Defines.FL_SWIM; + self.think = swimmonster_start_go; + Monster.monster_start(self); + return true; + } + } + }; + /* + ============= + ai_turn + + don't move, but turn towards ideal_yaw + 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[Defines.YAW], dist); + + if (GameUtil.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[Defines.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) + { + if (self.index == 312) + self.index = 312; + + M.M_MoveToGoal(self, dist); + + // check for noticing a player + if (GameUtil.FindTarget(self)) + return; + + if ((self.monsterinfo.search != null) && (GameBase.level.time > self.monsterinfo.idle_time)) + { + if (self.monsterinfo.idle_time != 0) + { + self.monsterinfo.search.think(self); + self.monsterinfo.idle_time = GameBase.level.time + 15 + Lib.random() * 15; + } + else + { + self.monsterinfo.idle_time = GameBase.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[Defines.YAW], dist); + + if ((self.monsterinfo.aiflags & Defines.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[Defines.YAW] != self.ideal_yaw + && 0 != (self.monsterinfo.aiflags & Defines.AI_TEMP_STAND_GROUND)) + { + self.monsterinfo.aiflags &= ~(Defines.AI_STAND_GROUND | Defines.AI_TEMP_STAND_GROUND); + self.monsterinfo.run.think(self); + } + M.M_ChangeYaw(self); + GameAI.ai_checkattack(self, 0); + } + else + GameUtil.FindTarget(self); + return; + } + + if (GameUtil.FindTarget(self)) + return; + + if (GameBase.level.time > self.monsterinfo.pausetime) + { + self.monsterinfo.walk.think(self); + return; + } + + if (0 == (self.spawnflags & 1) && (self.monsterinfo.idle != null) && (GameBase.level.time > self.monsterinfo.idle_time)) + { + if (self.monsterinfo.idle_time != 0) + { + self.monsterinfo.idle.think(self); + self.monsterinfo.idle_time = GameBase.level.time + 15 + Lib.random() * 15; + } + else + { + self.monsterinfo.idle_time = GameBase.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[Defines.YAW], dist); + } + }; + /* + ============= + ai_run + + The monster has an enemy it is trying to kill + ============= + */ //ok + public static AIAdapter ai_run = new AIAdapter() + { + public void ai(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; // mem + 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 & Defines.AI_COMBAT_POINT) != 0) + { + M.M_MoveToGoal(self, dist); + return; + } + + 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; + } + + if (GameAI.ai_checkattack(self, dist)) + return; + + if (self.monsterinfo.attack_state == Defines.AS_SLIDING) + { + GameAI.ai_run_slide(self, dist); + return; + } + + if (GameUtilAdapters.enemy_vis) + { + // if (self.aiflags & AI_LOST_SIGHT) + // dprint("regained sight\n"); + M.M_MoveToGoal(self, dist); + self.monsterinfo.aiflags &= ~Defines.AI_LOST_SIGHT; + Math3D.VectorCopy(self.enemy.s.origin, self.monsterinfo.last_sighting); + self.monsterinfo.trail_time = GameBase.level.time; + return; + } + + // 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))) + { + M.M_MoveToGoal(self, dist); + self.monsterinfo.search_time = 0; + // dprint("search timeout\n"); + return; + } + + save = self.goalentity; + tempgoal = GameUtil.G_Spawn(); + self.goalentity = tempgoal; + + new1 = false; + + if (0 == (self.monsterinfo.aiflags & Defines.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 |= (Defines.AI_LOST_SIGHT | Defines.AI_PURSUIT_LAST_SEEN); + self.monsterinfo.aiflags &= ~(Defines.AI_PURSUE_NEXT | Defines.AI_PURSUE_TEMP); + new1 = true; + } + + if ((self.monsterinfo.aiflags & Defines.AI_PURSUE_NEXT) != 0) + { + self.monsterinfo.aiflags &= ~Defines.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 = GameBase.level.time + 5; + + if ((self.monsterinfo.aiflags & Defines.AI_PURSUE_TEMP) != 0) + { + // dprint("was temp goal; retrying original\n"); + self.monsterinfo.aiflags &= ~Defines.AI_PURSUE_TEMP; + marker = null; + Math3D.VectorCopy(self.monsterinfo.saved_goal, self.monsterinfo.last_sighting); + new1 = true; + } + else if ((self.monsterinfo.aiflags & Defines.AI_PURSUIT_LAST_SEEN) != 0) + { + self.monsterinfo.aiflags &= ~Defines.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[Defines.YAW] = self.ideal_yaw = marker.s.angles[Defines.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 |= Defines.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 = + GameBase.gi.trace( + self.s.origin, + self.mins, + self.maxs, + self.monsterinfo.last_sighting, + self, + Defines.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[Defines.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 = GameBase.gi.trace(self.s.origin, self.mins, self.maxs, left_target, self, Defines.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 = GameBase.gi.trace(self.s.origin, self.mins, self.maxs, right_target, self, Defines.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 |= Defines.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[Defines.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 |= Defines.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[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"); + } + + M.M_MoveToGoal(self, dist); + + GameUtil.G_FreeEdict(tempgoal); + + if (self != null) + self.goalentity = save; + } + }; + 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 & Defines.IT_WEAPON) != 0; + if ((weapon) && ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO) != 0) + count = 1000; + else if (ent.count != 0) + count = ent.count; + else + count = ent.item.quantity; + + oldcount = other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)]; + + if (!GameAI.Add_Ammo(other, ent.item, count)) + return false; + + if (weapon && 0 == oldcount) + { + if (other.client.pers.weapon != ent.item + && (0 == GameBase.deathmatch.value || other.client.pers.weapon == GameUtil.FindItem("blaster"))) + other.client.newweapon = ent.item; + } + + if (0 == (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM)) && (GameBase.deathmatch.value != 0)) + GameUtil.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 = GameUtil.ArmorIndex(other); + + // handle armor shards specially + if (ent.item.tag == Defines.ARMOR_SHARD) + { + if (0 == old_armor_index) + other.client.pers.inventory[GameUtilAdapters.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[GameUtil.ITEM_INDEX(ent.item)] = newinfo.base_count; + } + + // use the better armor + else + { + // get info on old armor + if (old_armor_index == GameUtilAdapters.jacket_armor_index) + oldinfo = jacketarmor_info; + + else if (old_armor_index == GameUtilAdapters.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[GameUtil.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 & Defines.DROPPED_ITEM) && (GameBase.deathmatch.value == 0)) + GameUtil.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[GameUtil.ITEM_INDEX(ent.item)]; + + other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)]++; + + if (GameBase.deathmatch.value != 0) + { + if (0 == (ent.spawnflags & Defines.DROPPED_ITEM)) + GameUtil.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[GameUtil.ITEM_INDEX(ent.item)]; + if ((GameBase.skill.value == 1 && quantity >= 2) || (GameBase.skill.value >= 2 && quantity >= 1)) + return false; + + if ((GameBase.coop.value != 0) && (ent.item.flags & Defines.IT_STAY_COOP) != 0 && (quantity > 0)) + return false; + + other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)]++; + + if (GameBase.deathmatch.value != 0) + { + if (0 == (ent.spawnflags & Defines.DROPPED_ITEM)) + GameUtil.SetRespawn(ent, ent.item.quantity); + if (((int) GameBase.dmflags.value & Defines.DF_INSTANT_ITEMS) != 0 + || ((ent.item.use == GameUtilAdapters.Use_Quad) && 0 != (ent.spawnflags & Defines.DROPPED_PLAYER_ITEM))) + { + if ((ent.item.use == GameUtilAdapters.Use_Quad) && 0 != (ent.spawnflags & Defines.DROPPED_PLAYER_ITEM)) + GameUtilAdapters.quad_drop_timeout_hack = (int) ((ent.nextthink - GameBase.level.time) / Defines.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 (GameBase.deathmatch.value == 0) + other.max_health += 1; + + if (other.health < other.max_health) + other.health = other.max_health; + + if (0 == (ent.spawnflags & Defines.DROPPED_ITEM) && (GameBase.deathmatch.value != 0)) + GameUtil.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 & Defines.DROPPED_ITEM) && (GameBase.deathmatch.value != 0)) + GameUtil.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 = GameUtil.FindItem("Bullets"); + if (item != null) + { + index = GameUtil.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 = GameUtil.FindItem("Shells"); + if (item != null) + { + index = GameUtil.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 & Defines.DROPPED_ITEM) && (GameBase.deathmatch.value != 0)) + GameUtil.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 &= ~Defines.SVF_NOCLIENT; + ent.use = null; + + if ((ent.spawnflags & Defines.ITEM_NO_TOUCH) != 0) + { + ent.solid = Defines.SOLID_BBOX; + ent.touch = null; + } + else + { + ent.solid = Defines.SOLID_TRIGGER; + ent.touch = GameUtilAdapters.Touch_Item; + } + + GameBase.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) + GameBase.gi.setmodel(ent, ent.model); + else + GameBase.gi.setmodel(ent, ent.item.world_model); + ent.solid = Defines.SOLID_TRIGGER; + ent.movetype = Defines.MOVETYPE_TOSS; + ent.touch = GameUtilAdapters.Touch_Item; + + v = Lib.tv(0, 0, -128); + Math3D.VectorAdd(ent.s.origin, v, dest); + + tr = GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, dest, ent, Defines.MASK_SOLID); + if (tr.startsolid) + { + GameBase.gi.dprintf("droptofloor: " + ent.classname + " startsolid at " + Lib.vtos(ent.s.origin) + "\n"); + GameUtil.G_FreeEdict(ent); + return true; + } + + Math3D.VectorCopy(tr.endpos, ent.s.origin); + + if (ent.team != null) + { + ent.flags &= ~Defines.FL_TEAMSLAVE; + ent.chain = ent.teamchain; + ent.teamchain = null; + + ent.svflags |= Defines.SVF_NOCLIENT; + ent.solid = Defines.SOLID_NOT; + if (ent == ent.teammaster) + { + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + ent.think = GameUtilAdapters.DoRespawn; + } + } + + if ((ent.spawnflags & Defines.ITEM_NO_TOUCH) != 0) + { + ent.solid = Defines.SOLID_BBOX; + ent.touch = null; + ent.s.effects &= ~Defines.EF_ROTATE; + ent.s.renderfx &= ~Defines.RF_GLOW; + } + + if ((ent.spawnflags & Defines.ITEM_TRIGGER_SPAWN) != 0) + { + ent.svflags |= Defines.SVF_NOCLIENT; + ent.solid = Defines.SOLID_NOT; + ent.use = Use_Item; + } + + GameBase.gi.linkentity(ent); + return true; + } + }; + public static EntThinkAdapter gib_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.s.frame++; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + + if (self.s.frame == 10) + { + self.think = GameUtilAdapters.G_FreeEdictA; + self.nextthink = GameBase.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) + { + GameBase.gi.sound(self, Defines.CHAN_VOICE, GameBase.gi.soundindex("misc/fhit3.wav"), 1, Defines.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 == GameBase.sm_meat_index) + { + self.s.frame++; + self.think = gib_think; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + } + } + }; + public static EntDieAdapter gib_die = new EntDieAdapter() + { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + GameUtil.G_FreeEdict(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) + { + GameUtil.G_FreeEdict(self); + } + }; + 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 = Defines.DAMAGE_YES; + self.movetype = Defines.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 |= Defines.SVF_DEADMONSTER; + + if (self.deadflag == 0) + { + self.client.respawn_time = GameBase.level.time + 1.0f; + GameAI.LookAtKiller(self, inflictor, attacker); + self.client.ps.pmove.pm_type = Defines.PM_DEAD; + GameAI.ClientObituary(self, inflictor, attacker); + GameAI.TossClientWeapon(self); + if (GameBase.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 < GameBase.game.num_items; n++) + { + if (GameBase.coop.value != 0 && (GameAI.itemlist[n].flags & Defines.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 &= ~Defines.FL_POWER_ARMOR; + + if (self.health < -40) + { // gib + GameBase.gi.sound(self, Defines.CHAN_BODY, GameBase.gi.soundindex("misc/udeath.wav"), 1, Defines.ATTN_NORM, 0); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); + GameAI.ThrowClientHead(self, damage); + + self.takedamage = Defines.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 = Defines.ANIM_DEATH; + if ((self.client.ps.pmove.pm_flags & Defines.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; + } + + GameBase.gi.sound( + self, + Defines.CHAN_VOICE, + GameBase.gi.soundindex("*death" + ((Lib.rand() % 4) + 1) + ".wav"), + 1, + Defines.ATTN_NORM, + 0); + } + } + + self.deadflag = Defines.DEAD_DEAD; + + GameBase.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 = GameBase.game.clients[anum].ps.stats[Defines.STAT_FRAGS]; + int bnum1 = GameBase.game.clients[bnum].ps.stats[Defines.STAT_FRAGS]; + + if (anum1 < bnum1) + return -1; + if (anum1 > bnum1) + return 1; + return 0; + } + }; + public static ItemUseAdapter Use_PowerArmor = new ItemUseAdapter() + { + public void use(edict_t ent, gitem_t item) + { + int index; + + if ((ent.flags & Defines.FL_POWER_ARMOR) != 0) + { + ent.flags &= ~Defines.FL_POWER_ARMOR; + GameBase.gi.sound(ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/power2.wav"), 1, Defines.ATTN_NORM, 0); + } + else + { + index = GameUtil.ITEM_INDEX(GameUtil.FindItem("cells")); + if (0 == ent.client.pers.inventory[index]) + { + GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "No cells for power armor.\n"); + return; + } + ent.flags |= Defines.FL_POWER_ARMOR; + GameBase.gi.sound(ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/power1.wav"), 1, Defines.ATTN_NORM, 0); + } + } + }; + public static ItemDropAdapter Drop_Ammo = new ItemDropAdapter() + { + public void drop(edict_t ent, gitem_t item) + { + edict_t dropped; + int index; + + index = GameUtil.ITEM_INDEX(item); + dropped = GameUtil.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 == Defines.AMMO_GRENADES + && item.tag == Defines.AMMO_GRENADES + && ent.client.pers.inventory[index] - dropped.count <= 0) + { + GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Can't drop current weapon\n"); + GameUtil.G_FreeEdict(dropped); + return; + } + + ent.client.pers.inventory[index] -= dropped.count; + GameAI.ValidateSelectedItem(ent); + } + }; + public static ItemDropAdapter Drop_General = new ItemDropAdapter() + { + public void drop(edict_t ent, gitem_t item) + { + GameUtil.Drop_Item(ent, item); + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--; + GameAI.ValidateSelectedItem(ent); + } + }; + public static ItemDropAdapter Drop_PowerArmor = new ItemDropAdapter() + { + public void drop(edict_t ent, gitem_t item) + { + if (0 != (ent.flags & Defines.FL_POWER_ARMOR) && (ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)] == 1)) + Use_PowerArmor.use(ent, item); + Drop_General.drop(ent, item); + } + }; + public static gitem_armor_t jacketarmor_info = new gitem_armor_t(25, 50, .30f, .00f, Defines.ARMOR_JACKET); + public static gitem_armor_t combatarmor_info = new gitem_armor_t(50, 100, .60f, .30f, Defines.ARMOR_COMBAT); + public static gitem_armor_t bodyarmor_info = new gitem_armor_t(100, 200, .80f, .60f, Defines.ARMOR_BODY); +} diff --git a/src/jake2/game/GameBase.java b/src/jake2/game/GameBase.java index 317da9b..ef1e1c9 100644 --- a/src/jake2/game/GameBase.java +++ b/src/jake2/game/GameBase.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 30.11.2003 by RST. -// $Id: GameBase.java,v 1.1 2004-07-07 19:58:56 hzi Exp $ +// $Id: GameBase.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ /** Father of all Objects. */ @@ -33,7 +33,9 @@ import jake2.qcommon.Com; import jake2.server.*; import jake2.util.*; -public class GameBase extends Globals { +public class GameBase extends Globals +{ + public static cplane_t dummyplane = new cplane_t(); public static game_locals_t game = new game_locals_t(); public static level_locals_t level = new level_locals_t(); public static game_import_t gi = new game_import_t(); @@ -186,7 +188,8 @@ public class GameBase extends Globals { * Slide off of the impacting object * returns the blocked flags (1 = floor, 2 = step / wall). */ - public static int ClipVelocity(float[] in, float[] normal, float[] out, float overbounce) { + public static int ClipVelocity(float[] in, float[] normal, float[] out, float overbounce) + { float backoff; float change; int i, blocked; @@ -199,7 +202,8 @@ public class GameBase extends Globals { backoff = Math3D.DotProduct(in, normal) * overbounce; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) + { change = normal[i] * backoff; out[i] = in[i] - change; if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON) @@ -238,16 +242,19 @@ public class GameBase extends Globals { * Call with null as from parameter to search from array beginning. */ - public static EdictIterator G_Find(EdictIterator from, EdictFindFilter eff, String s) { + public static EdictIterator G_Find(EdictIterator from, EdictFindFilter eff, String s) + { if (from == null) from = new EdictIterator(0); else from.i++; - for (; from.i < globals.num_edicts; from.i++) { + for (; from.i < globals.num_edicts; from.i++) + { from.o = g_edicts[from.i]; - if (from.o.classname == null) { + if (from.o.classname == null) + { Com.Printf("edict with classname = null" + from.o.index); } @@ -262,7 +269,8 @@ public class GameBase extends Globals { } // comfort version (rst) - public static edict_t G_FindEdict(EdictIterator from, EdictFindFilter eff, String s) { + public static edict_t G_FindEdict(EdictIterator from, EdictFindFilter eff, String s) + { EdictIterator ei = G_Find(from, eff, s); if (ei == null) return null; @@ -273,7 +281,8 @@ public class GameBase extends Globals { /** * Returns entities that have origins within a spherical area. */ - public static EdictIterator findradius(EdictIterator from, float[] org, float rad) { + public static EdictIterator findradius(EdictIterator from, float[] org, float rad) + { float[] eorg = { 0, 0, 0 }; int j; @@ -282,7 +291,8 @@ public class GameBase extends Globals { else from.i++; - for (; from.i < globals.num_edicts; from.i++) { + for (; from.i < globals.num_edicts; from.i++) + { from.o = g_edicts[from.i]; if (!from.o.inuse) continue; @@ -311,24 +321,28 @@ public class GameBase extends Globals { public static int MAXCHOICES = 8; - public static edict_t G_PickTarget(String targetname) { + public static edict_t G_PickTarget(String targetname) + { int num_choices = 0; edict_t choice[] = new edict_t[MAXCHOICES]; - if (targetname == null) { + if (targetname == null) + { gi.dprintf("G_PickTarget called with null targetname\n"); return null; } EdictIterator es = null; - while ((es = G_Find(es, findByTarget, targetname)) != null) { + while ((es = G_Find(es, findByTarget, targetname)) != null) + { choice[num_choices++] = es.o; if (num_choices == MAXCHOICES) break; } - if (num_choices == 0) { + if (num_choices == 0) + { gi.dprintf("G_PickTarget: target " + targetname + " not found\n"); return null; } @@ -341,21 +355,26 @@ public class GameBase extends Globals { public static float[] VEC_DOWN = { 0, -2, 0 }; public static float[] MOVEDIR_DOWN = { 0, 0, -1 }; - public static void G_SetMovedir(float[] angles, float[] movedir) { - if (Math3D.VectorCompare(angles, VEC_UP) != 0) { + public static void G_SetMovedir(float[] angles, float[] movedir) + { + if (Math3D.VectorCompare(angles, VEC_UP) != 0) + { Math3D.VectorCopy(MOVEDIR_UP, movedir); } - else if (Math3D.VectorCompare(angles, VEC_DOWN) != 0) { + else if (Math3D.VectorCompare(angles, VEC_DOWN) != 0) + { Math3D.VectorCopy(MOVEDIR_DOWN, movedir); } - else { + else + { Math3D.AngleVectors(angles, movedir, null, null); } Math3D.VectorClear(angles); } - public static String G_CopyString(String in) { + public static String G_CopyString(String in) + { return new String(in); } @@ -365,7 +384,8 @@ public class GameBase extends Globals { ============ */ - public static void G_TouchTriggers(edict_t ent) { + public static void G_TouchTriggers(edict_t ent) + { int i, num; edict_t touch[] = new edict_t[MAX_EDICTS], hit; @@ -377,19 +397,24 @@ public class GameBase extends Globals { // be careful, it is possible to have an entity in this // list removed before we get to it (killtriggered) - for (i = 0; i < num; i++) { + for (i = 0; i < num; i++) + { hit = touch[i]; if (!hit.inuse) continue; if (hit.touch == null) continue; - - hit.touch.touch(hit, ent, null, null); + hit.touch.touch(hit, ent, GameBase.dummyplane, null); } } public static pushed_t pushed[] = new pushed_t[MAX_EDICTS]; + static { + for (int n = 0; n < MAX_EDICTS; n++) + pushed[n] = new pushed_t(); + } + public static int pushed_p; public static edict_t obstacle; @@ -414,11 +439,13 @@ public class GameBase extends Globals { ================ */ - public static void G_RunEntity(edict_t ent) { + public static void G_RunEntity(edict_t ent) + { if (ent.prethink != null) ent.prethink.think(ent); - switch ((int) ent.movetype) { + switch ((int) ent.movetype) + { case MOVETYPE_PUSH : case MOVETYPE_STOP : SV.SV_Physics_Pusher(ent); @@ -450,15 +477,19 @@ public class GameBase extends Globals { ================ */ public static int DI_NODIR = -1; - public static void assert1(boolean cond) { - if (!cond) { + public static void assert1(boolean cond) + { + if (!cond) + { - try { + try + { int a[] = null; int b = a[0]; } - catch (Exception e) { + catch (Exception e) + { System.err.println("assertion failed!"); e.printStackTrace(); } @@ -466,16 +497,19 @@ public class GameBase extends Globals { } } - public static void ClearBounds(float[] mins, float[] maxs) { + public static void ClearBounds(float[] mins, float[] maxs) + { mins[0] = mins[1] = mins[2] = 99999; maxs[0] = maxs[1] = maxs[2] = -99999; } - public static void AddPointToBounds(float[] v, float[] mins, float[] maxs) { + public static void AddPointToBounds(float[] v, float[] mins, float[] maxs) + { int i; float val; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) + { val = v[i]; if (val < mins[i]) mins[i] = val; @@ -484,23 +518,28 @@ public class GameBase extends Globals { } } - public static EdictFindFilter findByTarget = new EdictFindFilter() { - public boolean matches(edict_t e, String s) { + public static EdictFindFilter findByTarget = new EdictFindFilter() + { + public boolean matches(edict_t e, String s) + { if (e.targetname == null) return false; return e.targetname.equalsIgnoreCase(s); } }; - public static EdictFindFilter findByClass = new EdictFindFilter() { - public boolean matches(edict_t e, String s) { + public static EdictFindFilter findByClass = new EdictFindFilter() + { + public boolean matches(edict_t e, String s) + { return e.classname.equalsIgnoreCase(s); } }; //=================================================================== - public static void ShutdownGame() { + public static void ShutdownGame() + { gi.dprintf("==== ShutdownGame ====\n"); //gi.FreeTags (TAG_LEVEL); @@ -514,13 +553,15 @@ public class GameBase extends Globals { ClientEndServerFrames ================= */ - public static void ClientEndServerFrames() { + public static void ClientEndServerFrames() + { int i; edict_t ent; // calc the player views now that all pushing // and damage has been added - for (i = 0; i < maxclients.value; i++) { + for (i = 0; i < maxclients.value; i++) + { ent = g_edicts[1 + i]; if (!ent.inuse || null == ent.client) continue; @@ -536,7 +577,8 @@ public class GameBase extends Globals { Returns the created target changelevel ================= */ - public static edict_t CreateTargetChangeLevel(String map) { + public static edict_t CreateTargetChangeLevel(String map) + { edict_t ent; ent = Game.G_Spawn(); @@ -553,7 +595,8 @@ public class GameBase extends Globals { The timelimit or fraglimit has been exceeded ================= */ - public static void EndDMLevel() { + public static void EndDMLevel() + { edict_t ent; //char * s, * t, * f; //static const char * seps = " ,\n\r"; @@ -561,23 +604,28 @@ public class GameBase extends Globals { String seps = " ,\n\r"; // stay on same level flag - if (((int) dmflags.value & DF_SAME_LEVEL) != 0) { + if (((int) dmflags.value & DF_SAME_LEVEL) != 0) + { Game.BeginIntermission(CreateTargetChangeLevel(level.mapname)); return; } // see if it's in the map list - if (sv_maplist.string.length() > 0) { + if (sv_maplist.string.length() > 0) + { s = sv_maplist.string; f = null; StringTokenizer tk = new StringTokenizer(s, seps); t = tk.nextToken(); //t = strtok(s, seps); - while (t != null) { - if (Q_stricmp(t, level.mapname) == 0) { + while (t != null) + { + if (Q_stricmp(t, level.mapname) == 0) + { // it's in the list, go to the next one t = tk.nextToken(); - if (t == null) { // end of list, go to first one + if (t == null) + { // end of list, go to first one if (f == null) // there isn't a first one, same level Game.BeginIntermission(CreateTargetChangeLevel(level.mapname)); else @@ -596,10 +644,12 @@ public class GameBase extends Globals { if (level.nextmap.length() > 0) // go to a specific map Game.BeginIntermission(CreateTargetChangeLevel(level.nextmap)); - else { // search for a changelevel + else + { // search for a changelevel EdictIterator edit = null; edit = G_Find(edit, findByClass, "target_changelevel"); - if (edit == null) { // the map designer didn't include a changelevel, + if (edit == null) + { // the map designer didn't include a changelevel, // so create a fake ent that goes back to the same level Game.BeginIntermission(CreateTargetChangeLevel(level.mapname)); return; @@ -614,12 +664,14 @@ public class GameBase extends Globals { CheckNeedPass ================= */ - public static void CheckNeedPass() { + public static void CheckNeedPass() + { int need; // if password or spectator_password has changed, update needpass // as needed - if (password.modified || spectator_password.modified) { + if (password.modified || spectator_password.modified) + { password.modified = spectator_password.modified = false; need = 0; @@ -638,7 +690,8 @@ public class GameBase extends Globals { CheckDMRules ================= */ - public static void CheckDMRules() { + public static void CheckDMRules() + { int i; gclient_t cl; @@ -648,21 +701,26 @@ public class GameBase extends Globals { if (0 == deathmatch.value) return; - if (timelimit.value != 0) { - if (level.time >= timelimit.value * 60) { + if (timelimit.value != 0) + { + if (level.time >= timelimit.value * 60) + { gi.bprintf(PRINT_HIGH, "Timelimit hit.\n"); EndDMLevel(); return; } } - if (fraglimit.value != 0) { - for (i = 0; i < maxclients.value; i++) { + if (fraglimit.value != 0) + { + for (i = 0; i < maxclients.value; i++) + { cl = game.clients[i]; if (!g_edicts[i + 1].inuse) continue; - if (cl.resp.score >= fraglimit.value) { + if (cl.resp.score >= fraglimit.value) + { gi.bprintf(PRINT_HIGH, "Fraglimit hit.\n"); EndDMLevel(); return; @@ -676,7 +734,8 @@ public class GameBase extends Globals { ExitLevel ============= */ - public static void ExitLevel() { + public static void ExitLevel() + { int i; edict_t ent; //char command[256]; @@ -690,7 +749,8 @@ public class GameBase extends Globals { ClientEndServerFrames(); // clear some things before going to next level - for (i = 0; i < maxclients.value; i++) { + for (i = 0; i < maxclients.value; i++) + { ent = g_edicts[1 + i]; if (!ent.inuse) continue; @@ -707,7 +767,8 @@ public class GameBase extends Globals { Advances the world by 0.1 seconds ================ */ - public static void G_RunFrame() { + public static void G_RunFrame() + { int i; edict_t ent; @@ -719,7 +780,8 @@ public class GameBase extends Globals { // exit intermissions - if (level.exitintermission) { + if (level.exitintermission) + { ExitLevel(); return; } @@ -729,7 +791,8 @@ public class GameBase extends Globals { // even the world gets a chance to think // - for (i = 0; i < globals.num_edicts; i++) { + for (i = 0; i < globals.num_edicts; i++) + { ent = g_edicts[i]; if (!ent.inuse) continue; @@ -739,34 +802,38 @@ public class GameBase extends Globals { VectorCopy(ent.s.origin, ent.s.old_origin); // if the ground entity moved, make sure we are still on it - if ((ent.groundentity != null) && (ent.groundentity.linkcount != ent.groundentity_linkcount)) { + if ((ent.groundentity != null) && (ent.groundentity.linkcount != ent.groundentity_linkcount)) + { ent.groundentity = null; - if (0 == (ent.flags & (FL_SWIM | FL_FLY)) && (ent.svflags & SVF_MONSTER) != 0) { + if (0 == (ent.flags & (FL_SWIM | FL_FLY)) && (ent.svflags & SVF_MONSTER) != 0) + { M.M_CheckGround(ent); } } - if (i > 0 && i <= maxclients.value) { + if (i > 0 && i <= maxclients.value) + { Game.ClientBeginServerFrame(ent); continue; } - //TODO: RST: disabled for debugging - //if (ent.classname.startsWith("trigger") )//|| ent.classname.startsWith("monster")) - //G_RunEntity(ent); - - if (ent == g_edicts[307]) - G_RunEntity(ent); - else if (ent == g_edicts[1]) + //TODO: RST: disabled for debugging; + //if (!ent.classname.startsWith("monster") || ent.index == 312) G_RunEntity(ent); - - else if (true) - if (ent.classname.startsWith("monster_soldier") - || ent.classname.startsWith("target") - || ent.classname.startsWith( - "misc_explo") //ent.classname.startsWith("func_door") - ) //|| ent.classname.startsWith("monster")) - G_RunEntity(ent); + + // if (ent == g_edicts[307]) + // G_RunEntity(ent); + // else if (ent == g_edicts[1]) + // G_RunEntity(ent); + // + // else if (true) + // if (ent.classname.startsWith("monster") + // || ent.classname.startsWith("trigger") + // || ent.classname.startsWith("target") + // || ent.classname.startsWith( + // "misc_explo") //ent.classname.startsWith("func_door") + // ) //|| ent.classname.startsWith("monster")) + // G_RunEntity(ent); } @@ -789,11 +856,14 @@ public class GameBase extends Globals { ================= */ - public static game_export_t GetGameApi(game_import_t imp) { + public static game_export_t GetGameApi(game_import_t imp) + { gi = imp; - gi.pointcontents = new pmove_t.PointContentsAdapter() { - public int pointcontents(float[] o) { + gi.pointcontents = new pmove_t.PointContentsAdapter() + { + public int pointcontents(float[] o) + { return SV_WORLD.SV_PointContents(o); } }; diff --git a/src/jake2/game/GameFunc.java b/src/jake2/game/GameFunc.java index 2844ff7..8860b00 100644 --- a/src/jake2/game/GameFunc.java +++ b/src/jake2/game/GameFunc.java @@ -19,210 +19,63 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 18.11.2003 by RST. -// $Id: GameFunc.java,v 1.1 2004-07-07 19:58:58 hzi Exp $ +// $Id: GameFunc.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; +import jake2.Defines; +import jake2.Globals; +import jake2.qcommon.Com; import jake2.util.*; import jake2.util.*; -public class GameFunc extends PlayerView { +public class GameFunc extends PlayerView +{ - /* - ========================================================= - - PLATS - - movement options: - - linear - smooth start, hard stop - smooth start, smooth stop - - start - end - acceleration - speed - deceleration - begin sound - end sound - target fired when reaching end - wait at end - - object characteristics that use move segments - --------------------------------------------- - movetype_push, or movetype_stop - action when touched - action when blocked - action when used - disabled? - auto trigger spawning - - - ========================================================= - */ - - public final static int PLAT_LOW_TRIGGER = 1; - - public final static int STATE_TOP = 0; - public final static int STATE_BOTTOM = 1; - public final static int STATE_UP = 2; - public final static int STATE_DOWN = 3; - - public final static int DOOR_START_OPEN = 1; - public final static int DOOR_REVERSE = 2; - public final static int DOOR_CRUSHER = 4; - public final static int DOOR_NOMONSTER = 8; - public final static int DOOR_TOGGLE = 32; - public final static int DOOR_X_AXIS = 64; - public final static int DOOR_Y_AXIS = 128; - - // - // Support routines for movement (changes in origin using velocity) - // - - static EntThinkAdapter Move_Done = new EntThinkAdapter() { - public boolean think(edict_t ent) { - Math3D.VectorClear(ent.velocity); - ent.moveinfo.endfunc.think(ent); - return true; - } - }; - - static EntThinkAdapter Move_Final = new EntThinkAdapter() { - public boolean think(edict_t ent) { - - if (ent.moveinfo.remaining_distance == 0) { - Move_Done.think(ent); - return true; - } - - Math3D.VectorScale(ent.moveinfo.dir, ent.moveinfo.remaining_distance / FRAMETIME, ent.velocity); - - ent.think = Move_Done; - ent.nextthink = level.time + FRAMETIME; - return true; - } - }; - - static EntThinkAdapter Move_Begin = new EntThinkAdapter() { - public boolean think(edict_t ent) { - - float frames; - - if ((ent.moveinfo.speed * FRAMETIME) >= ent.moveinfo.remaining_distance) { - Move_Final.think(ent); - return true; - } - Math3D.VectorScale(ent.moveinfo.dir, ent.moveinfo.speed, ent.velocity); - frames = (float) Math.floor((ent.moveinfo.remaining_distance / ent.moveinfo.speed) / FRAMETIME); - ent.moveinfo.remaining_distance -= frames * ent.moveinfo.speed * FRAMETIME; - ent.nextthink = level.time + (frames * FRAMETIME); - ent.think = Move_Final; - return true; - } - }; - - - static void Move_Calc(edict_t ent, float[] dest, EntThinkAdapter func) { + static void Move_Calc(edict_t ent, float[] dest, EntThinkAdapter func) + { Math3D.VectorClear(ent.velocity); Math3D.VectorSubtract(dest, ent.s.origin, ent.moveinfo.dir); ent.moveinfo.remaining_distance = Math3D.VectorNormalize(ent.moveinfo.dir); + + //TODO: BIG HACK !!! + if (ent.moveinfo.remaining_distance == 2) + ent.moveinfo.remaining_distance = 94; ent.moveinfo.endfunc = func; - if (ent.moveinfo.speed == ent.moveinfo.accel && ent.moveinfo.speed == ent.moveinfo.decel) { - if (level.current_entity == ((ent.flags & FL_TEAMSLAVE) != 0 ? ent.teammaster : ent)) { - Move_Begin.think(ent); - } else { + if (ent.moveinfo.speed == ent.moveinfo.accel && ent.moveinfo.speed == ent.moveinfo.decel) + { + if (level.current_entity == ((ent.flags & FL_TEAMSLAVE) != 0 ? ent.teammaster : ent)) + { + GameFuncAdapters.Move_Begin.think(ent); + } + else + { ent.nextthink = level.time + FRAMETIME; - ent.think = Move_Begin; + ent.think = GameFuncAdapters.Move_Begin; } - } else { + } + else + { // accelerative ent.moveinfo.current_speed = 0; - ent.think = Think_AccelMove; + ent.think = GameFuncAdapters.Think_AccelMove; ent.nextthink = level.time + FRAMETIME; } } - // - // Support routines for angular movement (changes in angle using avelocity) - // - - static EntThinkAdapter AngleMove_Done = new EntThinkAdapter() { - public boolean think(edict_t ent) { - Math3D.VectorClear(ent.avelocity); - ent.moveinfo.endfunc.think(ent); - return true; - } - }; - - static EntThinkAdapter AngleMove_Final = new EntThinkAdapter() { - public boolean think(edict_t ent) { - float[] move={0,0,0}; - - if (ent.moveinfo.state == STATE_UP) - Math3D.VectorSubtract(ent.moveinfo.end_angles, ent.s.angles, move); - else - Math3D.VectorSubtract(ent.moveinfo.start_angles, ent.s.angles, move); - - if (Math3D.VectorCompare(move, vec3_origin) != 0) { - AngleMove_Done.think(ent); - return true; - } - - Math3D.VectorScale(move, 1.0f / FRAMETIME, ent.avelocity); - - ent.think = AngleMove_Done; - ent.nextthink = level.time + FRAMETIME; - return true; - } - }; - - static EntThinkAdapter AngleMove_Begin = new EntThinkAdapter() { - public boolean think(edict_t ent) { - float[] destdelta={0,0,0}; - float len; - float traveltime; - float frames; - - // set destdelta to the vector needed to move - if (ent.moveinfo.state == STATE_UP) - Math3D.VectorSubtract(ent.moveinfo.end_angles, ent.s.angles, destdelta); - else - Math3D.VectorSubtract(ent.moveinfo.start_angles, ent.s.angles, destdelta); - - // calculate length of vector - len = Math3D.VectorLength(destdelta); - - // divide by speed to get time to reach dest - traveltime = len / ent.moveinfo.speed; - - if (traveltime < FRAMETIME) { - AngleMove_Final.think(ent); - return true; - } - - frames = (float) (Math.floor(traveltime / FRAMETIME)); - - // scale the destdelta vector by the time spent traveling to get velocity - Math3D.VectorScale(destdelta, 1.0f / traveltime, ent.avelocity); - - // set nextthink to trigger a think when dest is reached - ent.nextthink = level.time + frames * FRAMETIME; - ent.think = AngleMove_Final; - return true; - } - }; - - static void AngleMove_Calc(edict_t ent, EntThinkAdapter func) { + static void AngleMove_Calc(edict_t ent, EntThinkAdapter func) + { Math3D.VectorClear(ent.avelocity); ent.moveinfo.endfunc = func; - if (level.current_entity == ((ent.flags & FL_TEAMSLAVE) != 0 ? ent.teammaster : ent)) { - AngleMove_Begin.think(ent); - } else { + if (level.current_entity == ((ent.flags & FL_TEAMSLAVE) != 0 ? ent.teammaster : ent)) + { + GameFuncAdapters.AngleMove_Begin.think(ent); + } + else + { ent.nextthink = level.time + FRAMETIME; - ent.think = AngleMove_Begin; + ent.think = GameFuncAdapters.AngleMove_Begin; } } @@ -234,17 +87,20 @@ public class GameFunc extends PlayerView { change the speed for the next frame ============== */ - static float AccelerationDistance(float target, float rate) { + static float AccelerationDistance(float target, float rate) + { return target * ((target / rate) + 1) / 2; }; - static void plat_CalcAcceleratedMove(moveinfo_t moveinfo) { + static void plat_CalcAcceleratedMove(moveinfo_t moveinfo) + { float accel_dist; float decel_dist; moveinfo.move_speed = moveinfo.speed; - if (moveinfo.remaining_distance < moveinfo.accel) { + if (moveinfo.remaining_distance < moveinfo.accel) + { moveinfo.current_speed = moveinfo.remaining_distance; return; } @@ -252,7 +108,8 @@ public class GameFunc extends PlayerView { accel_dist = AccelerationDistance(moveinfo.speed, moveinfo.accel); decel_dist = AccelerationDistance(moveinfo.speed, moveinfo.decel); - if ((moveinfo.remaining_distance - accel_dist - decel_dist) < 0) { + if ((moveinfo.remaining_distance - accel_dist - decel_dist) < 0) + { float f; f = (moveinfo.accel + moveinfo.decel) / (moveinfo.accel * moveinfo.decel); @@ -263,11 +120,15 @@ public class GameFunc extends PlayerView { moveinfo.decel_distance = decel_dist; }; - static void plat_Accelerate(moveinfo_t moveinfo) { + static void plat_Accelerate(moveinfo_t moveinfo) + { // are we decelerating? - if (moveinfo.remaining_distance <= moveinfo.decel_distance) { - if (moveinfo.remaining_distance < moveinfo.decel_distance) { - if (moveinfo.next_speed != 0) { + if (moveinfo.remaining_distance <= moveinfo.decel_distance) + { + if (moveinfo.remaining_distance < moveinfo.decel_distance) + { + if (moveinfo.next_speed != 0) + { moveinfo.current_speed = moveinfo.next_speed; moveinfo.next_speed = 0; return; @@ -280,7 +141,8 @@ public class GameFunc extends PlayerView { // are we at full speed and need to start decelerating during this move? if (moveinfo.current_speed == moveinfo.move_speed) - if ((moveinfo.remaining_distance - moveinfo.current_speed) < moveinfo.decel_distance) { + if ((moveinfo.remaining_distance - moveinfo.current_speed) < moveinfo.decel_distance) + { float p1_distance; float p2_distance; float distance; @@ -294,7 +156,8 @@ public class GameFunc extends PlayerView { } // are we accelerating? - if (moveinfo.current_speed < moveinfo.speed) { + if (moveinfo.current_speed < moveinfo.speed) + { float old_speed; float p1_distance; float p1_speed; @@ -328,133 +191,28 @@ public class GameFunc extends PlayerView { return; }; - static EntThinkAdapter Think_AccelMove = new EntThinkAdapter() { - public boolean think(edict_t ent) { - ent.moveinfo.remaining_distance -= ent.moveinfo.current_speed; - - if (ent.moveinfo.current_speed == 0) // starting or blocked - plat_CalcAcceleratedMove(ent.moveinfo); - - plat_Accelerate(ent.moveinfo); - - // will the entire move complete on next frame? - if (ent.moveinfo.remaining_distance <= ent.moveinfo.current_speed) { - Move_Final.think(ent); - return true; - } - - Math3D.VectorScale(ent.moveinfo.dir, ent.moveinfo.current_speed * 10, ent.velocity); - ent.nextthink = level.time + FRAMETIME; - ent.think = Think_AccelMove; - return true; - } - }; - - static EntThinkAdapter plat_hit_top = new EntThinkAdapter() { - public boolean think(edict_t ent) { - if (0 == (ent.flags & FL_TEAMSLAVE)) { - if (ent.moveinfo.sound_end != 0) - gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent.moveinfo.sound_end, 1, ATTN_STATIC, 0); - ent.s.sound = 0; - } - ent.moveinfo.state = STATE_TOP; - - ent.think = plat_go_down; - ent.nextthink = level.time + 3; - return true; - } - }; - - static EntThinkAdapter plat_hit_bottom = new EntThinkAdapter() { - public boolean think(edict_t ent) { - - if (0 == (ent.flags & FL_TEAMSLAVE)) { - if (ent.moveinfo.sound_end != 0) - gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent.moveinfo.sound_end, 1, ATTN_STATIC, 0); - ent.s.sound = 0; - } - ent.moveinfo.state = STATE_BOTTOM; - return true; - } - }; - - static EntThinkAdapter plat_go_down = new EntThinkAdapter() { - public boolean think(edict_t ent) { - if (0 == (ent.flags & FL_TEAMSLAVE)) { - if (ent.moveinfo.sound_start != 0) - gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent.moveinfo.sound_start, 1, ATTN_STATIC, 0); - ent.s.sound = ent.moveinfo.sound_middle; - } - ent.moveinfo.state = STATE_DOWN; - Move_Calc(ent, ent.moveinfo.end_origin, plat_hit_bottom); - return true; - } - }; - - static void plat_go_up(edict_t ent) { - if (0 == (ent.flags & FL_TEAMSLAVE)) { + static void plat_go_up(edict_t ent) + { + if (0 == (ent.flags & FL_TEAMSLAVE)) + { if (ent.moveinfo.sound_start != 0) gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent.moveinfo.sound_start, 1, ATTN_STATIC, 0); ent.s.sound = ent.moveinfo.sound_middle; } - ent.moveinfo.state = STATE_UP; - Move_Calc(ent, ent.moveinfo.start_origin, plat_hit_top); + ent.moveinfo.state = GameFuncAdapters.STATE_UP; + Move_Calc(ent, ent.moveinfo.start_origin, GameFuncAdapters.plat_hit_top); } - static EntBlockedAdapter plat_blocked = new EntBlockedAdapter() { - public void blocked(edict_t self, edict_t other) { - if (0 == (other.svflags & SVF_MONSTER) && (null == other.client)) { - // give it a chance to go away on it's own terms (like gibs) - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); - // if it's still there, nuke it - if (other != null) - BecomeExplosion1(other); - return; - } - - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - - if (self.moveinfo.state == STATE_UP) - plat_go_down.think(self); - else if (self.moveinfo.state == STATE_DOWN) - plat_go_up(self); - - } - }; - - static EntUseAdapter Use_Plat = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - if (ent.think != null) - return; // already down - plat_go_down.think(ent); - } - }; - - static EntTouchAdapter Touch_Plat_Center = new EntTouchAdapter() { - public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { - if (other.client == null) - return; - - if (other.health <= 0) - return; - - ent = ent.enemy; // now point at the plat, not the trigger - if (ent.moveinfo.state == STATE_BOTTOM) - plat_go_up(ent); - else if (ent.moveinfo.state == STATE_TOP) - ent.nextthink = level.time + 1; // the player is still on the plat, so delay going down - } - }; - - static void plat_spawn_inside_trigger(edict_t ent) { + static void plat_spawn_inside_trigger(edict_t ent) + { edict_t trigger; - float[] tmin={0,0,0}, tmax={0,0,0}; + float[] tmin = { 0, 0, 0 }, tmax = { 0, 0, 0 }; // // middle trigger // trigger = G_Spawn(); - trigger.touch = Touch_Plat_Center; + trigger.touch = GameFuncAdapters.Touch_Plat_Center; trigger.movetype = MOVETYPE_NONE; trigger.solid = SOLID_TRIGGER; trigger.enemy = ent; @@ -469,14 +227,16 @@ public class GameFunc extends PlayerView { tmin[2] = tmax[2] - (ent.pos1[2] - ent.pos2[2] + st.lip); - if ((ent.spawnflags & PLAT_LOW_TRIGGER) != 0) + if ((ent.spawnflags & GameFuncAdapters.PLAT_LOW_TRIGGER) != 0) tmax[2] = tmin[2] + 8; - if (tmax[0] - tmin[0] <= 0) { + if (tmax[0] - tmin[0] <= 0) + { tmin[0] = (ent.mins[0] + ent.maxs[0]) * 0.5f; tmax[0] = tmin[0] + 1; } - if (tmax[1] - tmin[1] <= 0) { + if (tmax[1] - tmin[1] <= 0) + { tmin[1] = (ent.mins[1] + ent.maxs[1]) * 0.5f; tmax[1] = tmin[1] + 1; } @@ -504,14 +264,15 @@ public class GameFunc extends PlayerView { 1) base fast 2) chain slow */ - static void SP_func_plat(edict_t ent) { + static void SP_func_plat(edict_t ent) + { Math3D.VectorClear(ent.s.angles); ent.solid = SOLID_BSP; ent.movetype = MOVETYPE_PUSH; gi.setmodel(ent, ent.model); - ent.blocked = plat_blocked; + ent.blocked = GameFuncAdapters.plat_blocked; if (0 == ent.speed) ent.speed = 20; @@ -542,16 +303,19 @@ public class GameFunc extends PlayerView { else ent.pos2[2] -= (ent.maxs[2] - ent.mins[2]) - st.lip; - ent.use = Use_Plat; + ent.use = GameFuncAdapters.Use_Plat; plat_spawn_inside_trigger(ent); // the "start moving" trigger - if (ent.targetname == null) { - ent.moveinfo.state = STATE_UP; - } else { + if (ent.targetname != null) + { + ent.moveinfo.state = GameFuncAdapters.STATE_UP; + } + else + { Math3D.VectorCopy(ent.pos2, ent.s.origin); gi.linkentity(ent); - ent.moveinfo.state = STATE_BOTTOM; + ent.moveinfo.state = GameFuncAdapters.STATE_BOTTOM; } ent.moveinfo.speed = ent.speed; @@ -568,261 +332,6 @@ public class GameFunc extends PlayerView { ent.moveinfo.sound_end = gi.soundindex("plats/pt1_end.wav"); } - // ==================================================================== - - /*QUAKED func_rotating (0 .5 .8) ? START_ON REVERSE X_AXIS Y_AXIS TOUCH_PAIN STOP ANIMATED ANIMATED_FAST - You need to have an origin brush as part of this entity. The center of that brush will be - the point around which it is rotated. It will rotate around the Z axis by default. You can - check either the X_AXIS or Y_AXIS box to change that. - - "speed" determines how fast it moves; default value is 100. - "dmg" damage to inflict when blocked (2 default) - - REVERSE will cause the it to rotate in the opposite direction. - STOP mean it will stop moving instead of pushing entities - */ - - static EntBlockedAdapter rotating_blocked = new EntBlockedAdapter() { - public void blocked(edict_t self, edict_t other) { - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - } - }; - - static EntTouchAdapter rotating_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (self.avelocity[0] != 0 || self.avelocity[1] != 0 || self.avelocity[2] != 0) - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - } - }; - - static EntUseAdapter rotating_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - if (0 == Math3D.VectorCompare(self.avelocity, vec3_origin)) { - self.s.sound = 0; - Math3D.VectorClear(self.avelocity); - self.touch = null; - } else { - self.s.sound = self.moveinfo.sound_middle; - Math3D.VectorScale(self.movedir, self.speed, self.avelocity); - if ((self.spawnflags & 16) != 0) - self.touch = rotating_touch; - } - } - }; - static EntThinkAdapter SP_func_rotating = new EntThinkAdapter() { - public boolean think(edict_t ent) { - ent.solid = SOLID_BSP; - if ((ent.spawnflags & 32) != 0) - ent.movetype = MOVETYPE_STOP; - else - ent.movetype = MOVETYPE_PUSH; - - // set the axis of rotation - Math3D.VectorClear(ent.movedir); - if ((ent.spawnflags & 4) != 0) - ent.movedir[2] = 1.0f; - else if ((ent.spawnflags & 8) != 0) - ent.movedir[0] = 1.0f; - else // Z_AXIS - ent.movedir[1] = 1.0f; - - // check for reverse rotation - if ((ent.spawnflags & 2) != 0) - Math3D.VectorNegate(ent.movedir, ent.movedir); - - if (0 == ent.speed) - ent.speed = 100; - if (0 == ent.dmg) - ent.dmg = 2; - - // ent.moveinfo.sound_middle = "doors/hydro1.wav"; - - ent.use = rotating_use; - if (ent.dmg != 0) - ent.blocked = rotating_blocked; - - if ((ent.spawnflags & 1) != 0) - ent.use.use(ent, null, null); - - if ((ent.spawnflags & 64) != 0) - ent.s.effects |= EF_ANIM_ALL; - if ((ent.spawnflags & 128) != 0) - ent.s.effects |= EF_ANIM_ALLFAST; - - gi.setmodel(ent, ent.model); - gi.linkentity(ent); - return true; - } - }; - - /* - ====================================================================== - - BUTTONS - - ====================================================================== - */ - - /*QUAKED func_button (0 .5 .8) ? - When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again. - - "angle" determines the opening direction - "target" all entities with a matching targetname will be used - "speed" override the default 40 speed - "wait" override the default 1 second wait (-1 = never return) - "lip" override the default 4 pixel lip remaining at end of move - "health" if set, the button must be killed instead of touched - "sounds" - 1) silent - 2) steam metal - 3) wooden clunk - 4) metallic click - 5) in-out - */ - - static EntThinkAdapter button_done = new EntThinkAdapter() { - public boolean think(edict_t self) { - - self.moveinfo.state = STATE_BOTTOM; - self.s.effects &= ~EF_ANIM23; - self.s.effects |= EF_ANIM01; - return true; - } - }; - - static EntThinkAdapter button_return = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.moveinfo.state = STATE_DOWN; - - Move_Calc(self, self.moveinfo.start_origin, button_done); - - self.s.frame = 0; - - if (self.health != 0) - self.takedamage = DAMAGE_YES; - return true; - } - }; - - static EntThinkAdapter button_wait = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.moveinfo.state = STATE_TOP; - self.s.effects &= ~EF_ANIM01; - self.s.effects |= EF_ANIM23; - - G_UseTargets(self, self.activator); - self.s.frame = 1; - if (self.moveinfo.wait >= 0) { - self.nextthink = level.time + self.moveinfo.wait; - self.think = button_return; - } - return true; - } - }; - - static EntThinkAdapter button_fire = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.moveinfo.state == STATE_UP || self.moveinfo.state == STATE_TOP) - return true; - - self.moveinfo.state = STATE_UP; - if (self.moveinfo.sound_start != 0 && 0 == (self.flags & FL_TEAMSLAVE)) - gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_start, 1, ATTN_STATIC, 0); - Move_Calc(self, self.moveinfo.end_origin, button_wait); - return true; - } - }; - - static EntUseAdapter button_use = new EntUseAdapter() { - public boolean think(edict_t self, edict_t activator) { - self.activator = activator; - button_fire.think(self); - return true; - } - }; - - static EntTouchAdapter button_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (null == other.client) - return; - - if (other.health <= 0) - return; - - self.activator = other; - button_fire.think(self); - - } - }; - - static EntDieAdapter button_killed = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - self.activator = attacker; - self.health = self.max_health; - self.takedamage = DAMAGE_NO; - button_fire.think(self); - - } - }; - - static EntThinkAdapter SP_func_button = new EntThinkAdapter() { - public boolean think(edict_t ent) { - float[] abs_movedir={0,0,0}; - float dist; - - G_SetMovedir(ent.s.angles, ent.movedir); - ent.movetype = MOVETYPE_STOP; - ent.solid = SOLID_BSP; - gi.setmodel(ent, ent.model); - - if (ent.sounds != 1) - ent.moveinfo.sound_start = gi.soundindex("switches/butn2.wav"); - - if (0 == ent.speed) - ent.speed = 40; - if (0 == ent.accel) - ent.accel = ent.speed; - if (0 == ent.decel) - ent.decel = ent.speed; - - if (0 == ent.wait) - ent.wait = 3; - if (0 == st.lip) - st.lip = 4; - - Math3D.VectorCopy(ent.s.origin, ent.pos1); - abs_movedir[0] = (float) Math.abs(ent.movedir[0]); - abs_movedir[1] = (float) Math.abs(ent.movedir[1]); - abs_movedir[2] = (float) Math.abs(ent.movedir[2]); - dist = abs_movedir[0] * ent.size[0] + abs_movedir[1] * ent.size[1] + abs_movedir[2] * ent.size[2] - st.lip; - Math3D.VectorMA(ent.pos1, dist, ent.movedir, ent.pos2); - - ent.use = button_use; - ent.s.effects |= EF_ANIM01; - - if (ent.health != 0) { - ent.max_health = ent.health; - ent.die = button_killed; - ent.takedamage = DAMAGE_YES; - } else if (null == ent.targetname) - ent.touch = button_touch; - - ent.moveinfo.state = STATE_BOTTOM; - - ent.moveinfo.speed = ent.speed; - ent.moveinfo.accel = ent.accel; - ent.moveinfo.decel = ent.decel; - ent.moveinfo.wait = ent.wait; - Math3D.VectorCopy(ent.pos1, ent.moveinfo.start_origin); - Math3D.VectorCopy(ent.s.angles, ent.moveinfo.start_angles); - Math3D.VectorCopy(ent.pos2, ent.moveinfo.end_origin); - Math3D.VectorCopy(ent.s.angles, ent.moveinfo.end_angles); - - gi.linkentity(ent); - return true; - } - }; - /* ====================================================================== @@ -854,7 +363,8 @@ public class GameFunc extends PlayerView { 4) heavy */ - static void door_use_areaportals(edict_t self, boolean open) { + static void door_use_areaportals(edict_t self, boolean open) + { edict_t t = null; if (self.target == null) @@ -862,493 +372,46 @@ public class GameFunc extends PlayerView { EdictIterator edit = null; - while ((edit = G_Find(edit, findByTarget, self.target)) != null) { + while ((edit = G_Find(edit, findByTarget, self.target)) != null) + { t = edit.o; - if (Lib.Q_stricmp(t.classname, "func_areaportal") == 0) { + if (Lib.Q_stricmp(t.classname, "func_areaportal") == 0) + { + //Com.p("Setting portalstate to:" + open); gi.SetAreaPortalState(t.style, open); } } } - static EntThinkAdapter door_hit_top = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (0 == (self.flags & FL_TEAMSLAVE)) { - if (self.moveinfo.sound_end != 0) - gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_end, 1, ATTN_STATIC, 0); - self.s.sound = 0; - } - self.moveinfo.state = STATE_TOP; - if ((self.spawnflags & DOOR_TOGGLE) != 0) - return true; - if (self.moveinfo.wait >= 0) { - self.think = door_go_down; - self.nextthink = level.time + self.moveinfo.wait; - } - return true; - } - }; - - static EntThinkAdapter door_hit_bottom = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (0 == (self.flags & FL_TEAMSLAVE)) { - if (self.moveinfo.sound_end != 0) - gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_end, 1, ATTN_STATIC, 0); - self.s.sound = 0; - } - self.moveinfo.state = STATE_BOTTOM; - door_use_areaportals(self, false); - return true; - } - }; - - static EntThinkAdapter door_go_down = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (0 == (self.flags & FL_TEAMSLAVE)) { - if (self.moveinfo.sound_start != 0) - gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_start, 1, ATTN_STATIC, 0); - self.s.sound = self.moveinfo.sound_middle; - } - if (self.max_health != 0) { - self.takedamage = DAMAGE_YES; - self.health = self.max_health; - } - - self.moveinfo.state = STATE_DOWN; - if (Lib.strcmp(self.classname, "func_door") == 0) - Move_Calc(self, self.moveinfo.start_origin, door_hit_bottom); - else if (Lib.strcmp(self.classname, "func_door_rotating") == 0) - AngleMove_Calc(self, door_hit_bottom); - return true; - } - }; - - static void door_go_up(edict_t self, edict_t activator) { - if (self.moveinfo.state == STATE_UP) + static void door_go_up(edict_t self, edict_t activator) + { + if (self.moveinfo.state == GameFuncAdapters.STATE_UP) return; // already going up - if (self.moveinfo.state == STATE_TOP) { // reset top wait time + if (self.moveinfo.state == GameFuncAdapters.STATE_TOP) + { + // reset top wait time if (self.moveinfo.wait >= 0) self.nextthink = level.time + self.moveinfo.wait; return; } - if (0 == (self.flags & FL_TEAMSLAVE)) { + if (0 == (self.flags & FL_TEAMSLAVE)) + { if (self.moveinfo.sound_start != 0) gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_start, 1, ATTN_STATIC, 0); self.s.sound = self.moveinfo.sound_middle; } - self.moveinfo.state = STATE_UP; + self.moveinfo.state = GameFuncAdapters.STATE_UP; if (Lib.strcmp(self.classname, "func_door") == 0) - Move_Calc(self, self.moveinfo.end_origin, door_hit_top); + Move_Calc(self, self.moveinfo.end_origin, GameFuncAdapters.door_hit_top); else if (Lib.strcmp(self.classname, "func_door_rotating") == 0) - AngleMove_Calc(self, door_hit_top); + AngleMove_Calc(self, GameFuncAdapters.door_hit_top); G_UseTargets(self, activator); door_use_areaportals(self, true); } - static EntUseAdapter door_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - edict_t ent; - - if ((self.flags & FL_TEAMSLAVE) != 0) - return; - - if ((self.spawnflags & DOOR_TOGGLE) != 0) { - if (self.moveinfo.state == STATE_UP || self.moveinfo.state == STATE_TOP) { - // trigger all paired doors - for (ent = self; ent != null; ent = ent.teamchain) { - ent.message = null; - ent.touch = null; - door_go_down.think(ent); - } - return; - } - } - - // trigger all paired doors - for (ent = self; ent != null; ent = ent.teamchain) { - ent.message = null; - ent.touch = null; - door_go_up(ent, activator); - } - } - }; - - static EntTouchAdapter Touch_DoorTrigger = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (other.health <= 0) - return; - - if (0 == (other.svflags & SVF_MONSTER) && (null == other.client)) - return; - - if (0 != (self.owner.spawnflags & DOOR_NOMONSTER) && 0 != (other.svflags & SVF_MONSTER)) - return; - - if (level.time < self.touch_debounce_time) - return; - self.touch_debounce_time = level.time + 1.0f; - - door_use.use(self.owner, other, other); - } - }; - - static EntThinkAdapter Think_CalcMoveSpeed = new EntThinkAdapter() { - public boolean think(edict_t self) { - edict_t ent; - float min; - float time; - float newspeed; - float ratio; - float dist; - - if ((self.flags & FL_TEAMSLAVE) != 0) - return true; // only the team master does this - - // find the smallest distance any member of the team will be moving - min = Math.abs(self.moveinfo.distance); - for (ent = self.teamchain; ent != null; ent = ent.teamchain) { - dist = Math.abs(ent.moveinfo.distance); - if (dist < min) - min = dist; - } - - time = min / self.moveinfo.speed; - - // adjust speeds so they will all complete at the same time - for (ent = self; ent != null; ent = ent.teamchain) { - newspeed = Math.abs(ent.moveinfo.distance) / time; - ratio = newspeed / ent.moveinfo.speed; - if (ent.moveinfo.accel == ent.moveinfo.speed) - ent.moveinfo.accel = newspeed; - else - ent.moveinfo.accel *= ratio; - if (ent.moveinfo.decel == ent.moveinfo.speed) - ent.moveinfo.decel = newspeed; - else - ent.moveinfo.decel *= ratio; - ent.moveinfo.speed = newspeed; - } - return true; - } - }; - - static EntThinkAdapter Think_SpawnDoorTrigger = new EntThinkAdapter() { - public boolean think(edict_t ent) { - edict_t other; - float[] mins={0,0,0}, maxs={0,0,0}; - - if ((ent.flags & FL_TEAMSLAVE) != 0) - return true; // only the team leader spawns a trigger - - Math3D.VectorCopy(ent.absmin, mins); - Math3D.VectorCopy(ent.absmax, maxs); - - for (other = ent.teamchain; other != null; other = other.teamchain) { - AddPointToBounds(other.absmin, mins, maxs); - AddPointToBounds(other.absmax, mins, maxs); - } - - // expand - mins[0] -= 60; - mins[1] -= 60; - maxs[0] += 60; - maxs[1] += 60; - - other = G_Spawn(); - Math3D.VectorCopy(mins, other.mins); - Math3D.VectorCopy(maxs, other.maxs); - other.owner = ent; - other.solid = SOLID_TRIGGER; - other.movetype = MOVETYPE_NONE; - other.touch = Touch_DoorTrigger; - gi.linkentity(other); - - if ((ent.spawnflags & DOOR_START_OPEN) != 0) - door_use_areaportals(ent, true); - - Think_CalcMoveSpeed.think(ent); - return true; - } - }; - - static EntBlockedAdapter door_blocked = new EntBlockedAdapter() { - public void blocked(edict_t self, edict_t other) { - edict_t ent; - - if (0 == (other.svflags & SVF_MONSTER) && (null == other.client)) { - // give it a chance to go away on it's own terms (like gibs) - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); - // if it's still there, nuke it - if (other != null) - BecomeExplosion1(other); - return; - } - - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - - if ((self.spawnflags & DOOR_CRUSHER) != 0) - return; - - // if a door has a negative wait, it would never come back if blocked, - // so let it just squash the object to death real fast - if (self.moveinfo.wait >= 0) { - if (self.moveinfo.state == STATE_DOWN) { - for (ent = self.teammaster; ent != null; ent = ent.teamchain) - door_go_up(ent, ent.activator); - } else { - for (ent = self.teammaster; ent != null; ent = ent.teamchain) - door_go_down.think(ent); - } - } - } - }; - - static EntDieAdapter door_killed = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - edict_t ent; - - for (ent = self.teammaster; ent != null; ent = ent.teamchain) { - ent.health = ent.max_health; - ent.takedamage = DAMAGE_NO; - } - door_use.use(self.teammaster, attacker, attacker); - } - }; - - static EntTouchAdapter door_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (null == other.client) - return; - - if (level.time < self.touch_debounce_time) - return; - self.touch_debounce_time = level.time + 5.0f; - - gi.centerprintf(other, self.message); - gi.sound(other, CHAN_AUTO, gi.soundindex("misc/talk1.wav"), 1, ATTN_NORM, 0); - } - }; - - static EntThinkAdapter SP_func_door = new EntThinkAdapter() { - public boolean think(edict_t ent) { - float[] abs_movedir={0,0,0}; - - if (ent.sounds != 1) { - ent.moveinfo.sound_start = gi.soundindex("doors/dr1_strt.wav"); - ent.moveinfo.sound_middle = gi.soundindex("doors/dr1_mid.wav"); - ent.moveinfo.sound_end = gi.soundindex("doors/dr1_end.wav"); - } - - G_SetMovedir(ent.s.angles, ent.movedir); - ent.movetype = MOVETYPE_PUSH; - ent.solid = SOLID_BSP; - gi.setmodel(ent, ent.model); - - ent.blocked = door_blocked; - ent.use = door_use; - - if (0 == ent.speed) - ent.speed = 100; - if (deathmatch.value != 0) - ent.speed *= 2; - - if (0 == ent.accel) - ent.accel = ent.speed; - if (0 == ent.decel) - ent.decel = ent.speed; - - if (0 == ent.wait) - ent.wait = 3; - if (0 == st.lip) - st.lip = 8; - if (0 == ent.dmg) - ent.dmg = 2; - - // calculate second position - Math3D.VectorCopy(ent.s.origin, ent.pos1); - abs_movedir[0] = Math.abs(ent.movedir[0]); - abs_movedir[1] = Math.abs(ent.movedir[1]); - abs_movedir[2] = Math.abs(ent.movedir[2]); - ent.moveinfo.distance = - abs_movedir[0] * ent.size[0] + abs_movedir[1] * ent.size[1] + abs_movedir[2] * ent.size[2] - st.lip; - Math3D.VectorMA(ent.pos1, ent.moveinfo.distance, ent.movedir, ent.pos2); - - // if it starts open, switch the positions - if ((ent.spawnflags & DOOR_START_OPEN) != 0) { - Math3D.VectorCopy(ent.pos2, ent.s.origin); - Math3D.VectorCopy(ent.pos1, ent.pos2); - Math3D.VectorCopy(ent.s.origin, ent.pos1); - } - - ent.moveinfo.state = STATE_BOTTOM; - - if (ent.health != 0) { - ent.takedamage = DAMAGE_YES; - ent.die = door_killed; - ent.max_health = ent.health; - } else if (ent.targetname != null && ent.message != null) { - gi.soundindex("misc/talk.wav"); - ent.touch = door_touch; - } - - ent.moveinfo.speed = ent.speed; - ent.moveinfo.accel = ent.accel; - ent.moveinfo.decel = ent.decel; - ent.moveinfo.wait = ent.wait; - Math3D.VectorCopy(ent.pos1, ent.moveinfo.start_origin); - Math3D.VectorCopy(ent.s.angles, ent.moveinfo.start_angles); - Math3D.VectorCopy(ent.pos2, ent.moveinfo.end_origin); - Math3D.VectorCopy(ent.s.angles, ent.moveinfo.end_angles); - - if ((ent.spawnflags & 16) != 0) - ent.s.effects |= EF_ANIM_ALL; - if ((ent.spawnflags & 64) != 0) - ent.s.effects |= EF_ANIM_ALLFAST; - - // to simplify logic elsewhere, make non-teamed doors into a team of one - if (null == ent.team) - ent.teammaster = ent; - - gi.linkentity(ent); - - ent.nextthink = level.time + FRAMETIME; - if (ent.health != 0 || ent.targetname != null) - ent.think = Think_CalcMoveSpeed; - else - ent.think = Think_SpawnDoorTrigger; - return true; - } - }; - - /*QUAKED func_door_rotating (0 .5 .8) ? START_OPEN REVERSE CRUSHER NOMONSTER ANIMATED TOGGLE X_AXIS Y_AXIS - TOGGLE causes the door to wait in both the start and end states for a trigger event. - - START_OPEN the door to moves to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not useful for touch or takedamage doors). - NOMONSTER monsters will not trigger this door - - You need to have an origin brush as part of this entity. The center of that brush will be - the point around which it is rotated. It will rotate around the Z axis by default. You can - check either the X_AXIS or Y_AXIS box to change that. - - "distance" is how many degrees the door will be rotated. - "speed" determines how fast the door moves; default value is 100. - - REVERSE will cause the door to rotate in the opposite direction. - - "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet - "angle" determines the opening direction - "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. - "health" if set, door must be shot open - "speed" movement speed (100 default) - "wait" wait before returning (3 default, -1 = never return) - "dmg" damage to inflict when blocked (2 default) - "sounds" - 1) silent - 2) light - 3) medium - 4) heavy - */ - - static EntThinkAdapter SP_func_door_rotating = new EntThinkAdapter() { - public boolean think(edict_t ent) { - Math3D.VectorClear(ent.s.angles); - - // set the axis of rotation - Math3D.VectorClear(ent.movedir); - if ((ent.spawnflags & DOOR_X_AXIS) != 0) - ent.movedir[2] = 1.0f; - else if ((ent.spawnflags & DOOR_Y_AXIS) != 0) - ent.movedir[0] = 1.0f; - else // Z_AXIS - ent.movedir[1] = 1.0f; - - // check for reverse rotation - if ((ent.spawnflags & DOOR_REVERSE) != 0) - Math3D.VectorNegate(ent.movedir, ent.movedir); - - if (0 == st.distance) { - gi.dprintf(ent.classname + " at " + Lib.vtos(ent.s.origin) + " with no distance set\n"); - st.distance = 90; - } - - Math3D.VectorCopy(ent.s.angles, ent.pos1); - Math3D.VectorMA(ent.s.angles, st.distance, ent.movedir, ent.pos2); - ent.moveinfo.distance = st.distance; - - ent.movetype = MOVETYPE_PUSH; - ent.solid = SOLID_BSP; - gi.setmodel(ent, ent.model); - - ent.blocked = door_blocked; - ent.use = door_use; - - if (0 == ent.speed) - ent.speed = 100; - if (0 == ent.accel) - ent.accel = ent.speed; - if (0 == ent.decel) - ent.decel = ent.speed; - - if (0 == ent.wait) - ent.wait = 3; - if (0 == ent.dmg) - ent.dmg = 2; - - if (ent.sounds != 1) { - ent.moveinfo.sound_start = gi.soundindex("doors/dr1_strt.wav"); - ent.moveinfo.sound_middle = gi.soundindex("doors/dr1_mid.wav"); - ent.moveinfo.sound_end = gi.soundindex("doors/dr1_end.wav"); - } - - // if it starts open, switch the positions - if ((ent.spawnflags & DOOR_START_OPEN) != 0) { - Math3D.VectorCopy(ent.pos2, ent.s.angles); - Math3D.VectorCopy(ent.pos1, ent.pos2); - Math3D.VectorCopy(ent.s.angles, ent.pos1); - Math3D.VectorNegate(ent.movedir, ent.movedir); - } - - if (ent.health != 0) { - ent.takedamage = DAMAGE_YES; - ent.die = door_killed; - ent.max_health = ent.health; - } - - if (ent.targetname != null && ent.message != null) { - gi.soundindex("misc/talk.wav"); - ent.touch = door_touch; - } - - ent.moveinfo.state = STATE_BOTTOM; - ent.moveinfo.speed = ent.speed; - ent.moveinfo.accel = ent.accel; - ent.moveinfo.decel = ent.decel; - ent.moveinfo.wait = ent.wait; - Math3D.VectorCopy(ent.s.origin, ent.moveinfo.start_origin); - Math3D.VectorCopy(ent.pos1, ent.moveinfo.start_angles); - Math3D.VectorCopy(ent.s.origin, ent.moveinfo.end_origin); - Math3D.VectorCopy(ent.pos2, ent.moveinfo.end_angles); - - if ((ent.spawnflags & 16) != 0) - ent.s.effects |= EF_ANIM_ALL; - - // to simplify logic elsewhere, make non-teamed doors into a team of one - if (ent.team == null) - ent.teammaster = ent; - - gi.linkentity(ent); - - ent.nextthink = level.time + FRAMETIME; - if (ent.health != 0 || ent.targetname != null) - ent.think = Think_CalcMoveSpeed; - else - ent.think = Think_SpawnDoorTrigger; - return true; - } - }; - /*QUAKED func_water (0 .5 .8) ? START_OPEN func_water is a moveable water brush. It must be targeted to operate. Use a non-water texture at your own risk. @@ -1364,15 +427,17 @@ public class GameFunc extends PlayerView { 2) lava */ - static void SP_func_water(edict_t self) { - float[] abs_movedir={0,0,0}; + static void SP_func_water(edict_t self) + { + float[] abs_movedir = { 0, 0, 0 }; G_SetMovedir(self.s.angles, self.movedir); self.movetype = MOVETYPE_PUSH; self.solid = SOLID_BSP; gi.setmodel(self, self.model); - switch (self.sounds) { + switch (self.sounds) + { default : break; @@ -1397,7 +462,8 @@ public class GameFunc extends PlayerView { Math3D.VectorMA(self.pos1, self.moveinfo.distance, self.movedir, self.pos2); // if it starts open, switch the positions - if ((self.spawnflags & DOOR_START_OPEN) != 0) { + if ((self.spawnflags & GameFuncAdapters.DOOR_START_OPEN) != 0) + { Math3D.VectorCopy(self.pos2, self.s.origin); Math3D.VectorCopy(self.pos1, self.pos2); Math3D.VectorCopy(self.s.origin, self.pos1); @@ -1408,7 +474,7 @@ public class GameFunc extends PlayerView { Math3D.VectorCopy(self.pos2, self.moveinfo.end_origin); Math3D.VectorCopy(self.s.angles, self.moveinfo.end_angles); - self.moveinfo.state = STATE_BOTTOM; + self.moveinfo.state = GameFuncAdapters.STATE_BOTTOM; if (0 == self.speed) self.speed = 25; @@ -1418,223 +484,42 @@ public class GameFunc extends PlayerView { self.wait = -1; self.moveinfo.wait = self.wait; - self.use = door_use; + self.use = GameFuncAdapters.door_use; if (self.wait == -1) - self.spawnflags |= DOOR_TOGGLE; + self.spawnflags |= GameFuncAdapters.DOOR_TOGGLE; self.classname = "func_door"; gi.linkentity(self); } - public final static int TRAIN_START_ON = 1; - public final static int TRAIN_TOGGLE = 2; - public final static int TRAIN_BLOCK_STOPS = 4; - - /*QUAKED func_train (0 .5 .8) ? START_ON TOGGLE BLOCK_STOPS - Trains are moving platforms that players can ride. - The targets origin specifies the min point of the train at each corner. - The train spawns at the first target it is pointing at. - If the train is the target of a button or trigger, it will not begin moving until activated. - speed default 100 - dmg default 2 - noise looping sound to play when the train is in motion - - */ - - static EntBlockedAdapter train_blocked = new EntBlockedAdapter() { - - public void blocked(edict_t self, edict_t other) { - if (0 == (other.svflags & SVF_MONSTER) && (null == other.client)) { - // give it a chance to go away on it's own terms (like gibs) - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); - // if it's still there, nuke it - if (other != null) - BecomeExplosion1(other); - return; - } - - if (level.time < self.touch_debounce_time) - return; - - if (self.dmg == 0) - return; - self.touch_debounce_time = level.time + 0.5f; - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - } - }; - - static EntThinkAdapter train_wait = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.target_ent.pathtarget != null) { - String savetarget; - edict_t ent; - - ent = self.target_ent; - savetarget = ent.target; - ent.target = ent.pathtarget; - G_UseTargets(ent, self.activator); - ent.target = savetarget; - - // make sure we didn't get killed by a killtarget - if (!self.inuse) - return true; - } - - if (self.moveinfo.wait != 0) { - if (self.moveinfo.wait > 0) { - self.nextthink = level.time + self.moveinfo.wait; - self.think = train_next; - } else if (0 != (self.spawnflags & TRAIN_TOGGLE)) // && wait < 0 - { - train_next.think(self); - self.spawnflags &= ~TRAIN_START_ON; - Math3D.VectorClear(self.velocity); - self.nextthink = 0; - } - - if (0 == (self.flags & FL_TEAMSLAVE)) { - if (self.moveinfo.sound_end != 0) - gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_end, 1, ATTN_STATIC, 0); - self.s.sound = 0; - } - } else { - train_next.think(self); - } - return true; - } - }; - - static EntThinkAdapter train_next = new EntThinkAdapter() { - public boolean think(edict_t self) { - edict_t ent=null; - float[] dest={0,0,0}; - boolean first; - - first = true; - - boolean dogoto = true; - while (dogoto) { - if (null == self.target) { - // gi.dprintf ("train_next: no next target\n"); - return true; - } - - ent = G_PickTarget(self.target); - if (null == ent) { - gi.dprintf("train_next: bad target " + self.target + "\n"); - return true; - } - - self.target = ent.target; - dogoto = false; - // check for a teleport path_corner - if ((ent.spawnflags & 1) != 0) { - if (!first) { - gi.dprintf("connected teleport path_corners, see " + ent.classname + " at " + Lib.vtos(ent.s.origin) + "\n"); - return true; - } - first = false; - Math3D.VectorSubtract(ent.s.origin, self.mins, self.s.origin); - Math3D.VectorCopy(self.s.origin, self.s.old_origin); - self.s.event = EV_OTHER_TELEPORT; - gi.linkentity(self); - dogoto = true; - } - } - self.moveinfo.wait = ent.wait; - self.target_ent = ent; - - if (0 == (self.flags & FL_TEAMSLAVE)) { - if (self.moveinfo.sound_start != 0) - gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self.moveinfo.sound_start, 1, ATTN_STATIC, 0); - self.s.sound = self.moveinfo.sound_middle; - } - - Math3D.VectorSubtract(ent.s.origin, self.mins, dest); - self.moveinfo.state = STATE_TOP; - Math3D.VectorCopy(self.s.origin, self.moveinfo.start_origin); - Math3D.VectorCopy(dest, self.moveinfo.end_origin); - Move_Calc(self, dest, train_wait); - self.spawnflags |= TRAIN_START_ON; - return true; - } - }; - - static void train_resume(edict_t self) { + static void train_resume(edict_t self) + { edict_t ent; - float[] dest={0,0,0}; + float[] dest = { 0, 0, 0 }; ent = self.target_ent; Math3D.VectorSubtract(ent.s.origin, self.mins, dest); - self.moveinfo.state = STATE_TOP; + self.moveinfo.state = GameFuncAdapters.STATE_TOP; Math3D.VectorCopy(self.s.origin, self.moveinfo.start_origin); Math3D.VectorCopy(dest, self.moveinfo.end_origin); - Move_Calc(self, dest, train_wait); - self.spawnflags |= TRAIN_START_ON; + Move_Calc(self, dest, GameFuncAdapters.train_wait); + self.spawnflags |= GameFuncAdapters.TRAIN_START_ON; } - public static EntThinkAdapter func_train_find = new EntThinkAdapter() { - public boolean think(edict_t self) { - edict_t ent; - - if (null == self.target) { - gi.dprintf("train_find: no target\n"); - return true; - } - ent = G_PickTarget(self.target); - if (null == ent) { - gi.dprintf("train_find: target " + self.target + " not found\n"); - return true; - } - self.target = ent.target; - - Math3D.VectorSubtract(ent.s.origin, self.mins, self.s.origin); - gi.linkentity(self); - - // if not triggered, start immediately - if (null == self.targetname) - self.spawnflags |= TRAIN_START_ON; - - if ((self.spawnflags & TRAIN_START_ON) != 0) { - self.nextthink = level.time + FRAMETIME; - self.think = train_next; - self.activator = self; - } - return true; - } - }; - - public static EntUseAdapter train_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.activator = activator; - - if ((self.spawnflags & TRAIN_START_ON) != 0) { - if (0 == (self.spawnflags & TRAIN_TOGGLE)) - return; - self.spawnflags &= ~TRAIN_START_ON; - Math3D.VectorClear(self.velocity); - self.nextthink = 0; - } else { - if (self.target_ent != null) - train_resume(self); - else - train_next.think(self); - } - } - }; - - static void SP_func_train(edict_t self) { + static void SP_func_train(edict_t self) + { self.movetype = MOVETYPE_PUSH; Math3D.VectorClear(self.s.angles); - self.blocked = train_blocked; - if ((self.spawnflags & TRAIN_BLOCK_STOPS) != 0) + self.blocked = GameFuncAdapters.train_blocked; + if ((self.spawnflags & GameFuncAdapters.TRAIN_BLOCK_STOPS) != 0) self.dmg = 0; - else { + else + { if (0 == self.dmg) self.dmg = 100; } @@ -1650,132 +535,39 @@ public class GameFunc extends PlayerView { self.moveinfo.speed = self.speed; self.moveinfo.accel = self.moveinfo.decel = self.moveinfo.speed; - self.use = train_use; + self.use = GameFuncAdapters.train_use; gi.linkentity(self); - if (self.target != null) { + if (self.target != null) + { // start trains on the second frame, to make sure their targets have had // a chance to spawn self.nextthink = level.time + FRAMETIME; - self.think = func_train_find; - } else { + self.think = GameFuncAdapters.func_train_find; + } + else + { gi.dprintf("func_train without a target at " + Lib.vtos(self.absmin) + "\n"); } } - /*QUAKED trigger_elevator (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) - */ - static EntUseAdapter trigger_elevator_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - edict_t target; - - if (0 != self.movetarget.nextthink) { - // gi.dprintf("elevator busy\n"); - return; - } - - if (null == other.pathtarget) { - gi.dprintf("elevator used with no pathtarget\n"); - return; - } - - target = G_PickTarget(other.pathtarget); - if (null == target) { - gi.dprintf("elevator used with bad pathtarget: " + other.pathtarget + "\n"); - return; - } - - self.movetarget.target_ent = target; - train_resume(self.movetarget); - } - }; - - static EntThinkAdapter trigger_elevator_init = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (null == self.target) { - gi.dprintf("trigger_elevator has no target\n"); - return true; - } - self.movetarget = G_PickTarget(self.target); - if (null == self.movetarget) { - gi.dprintf("trigger_elevator unable to find target " + self.target + "\n"); - return true; - } - if (Lib.strcmp(self.movetarget.classname, "func_train") != 0) { - gi.dprintf("trigger_elevator target " + self.target + " is not a train\n"); - return true; - } - - self.use = trigger_elevator_use; - self.svflags = SVF_NOCLIENT; - return true; - } - }; - - static EntThinkAdapter SP_trigger_elevator = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.think = trigger_elevator_init; - self.nextthink = level.time + FRAMETIME; - return true; - } - }; - - /*QUAKED func_timer (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) START_ON - "wait" base time between triggering all targets, default is 1 - "random" wait variance, default is 0 - - so, the basic time between firing is a random time between - (wait - random) and (wait + random) - - "delay" delay before first firing when turned on, default is 0 - - "pausetime" additional delay used only the very first time - and only if spawned with START_ON - - These can used but not touched. - */ - - static EntThinkAdapter func_timer_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - G_UseTargets(self, self.activator); - self.nextthink = level.time + self.wait + Lib.crandom() * self.random; - return true; - } - }; - - static EntUseAdapter func_timer_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.activator = activator; - - // if on, turn it off - if (self.nextthink != 0) { - self.nextthink = 0; - return; - } - - // turn it on - if (self.delay != 0) - self.nextthink = level.time + self.delay; - else - func_timer_think.think(self); - } - }; - - static void SP_func_timer(edict_t self) { + static void SP_func_timer(edict_t self) + { if (0 == self.wait) self.wait = 1.0f; - self.use = func_timer_use; - self.think = func_timer_think; + self.use = GameFuncAdapters.func_timer_use; + self.think = GameFuncAdapters.func_timer_think; - if (self.random >= self.wait) { + if (self.random >= self.wait) + { self.random = self.wait - FRAMETIME; gi.dprintf("func_timer at " + Lib.vtos(self.s.origin) + " has random >= wait\n"); } - if ((self.spawnflags & 1) != 0) { + if ((self.spawnflags & 1) != 0) + { self.nextthink = level.time + 1.0f + st.pausetime + self.delay + self.wait + Lib.crandom() * self.random; self.activator = self; } @@ -1783,245 +575,4 @@ public class GameFunc extends PlayerView { self.svflags = SVF_NOCLIENT; } - /*QUAKED func_conveyor (0 .5 .8) ? START_ON TOGGLE - Conveyors are stationary brushes that move what's on them. - The brush should be have a surface with at least one current content enabled. - speed default 100 - */ - - static EntUseAdapter func_conveyor_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - if ((self.spawnflags & 1) != 0) { - self.speed = 0; - self.spawnflags &= ~1; - } else { - self.speed = self.count; - self.spawnflags |= 1; - } - - if (0 == (self.spawnflags & 2)) - self.count = 0; - } - }; - - static EntThinkAdapter SP_func_conveyor = new EntThinkAdapter() { - public boolean think(edict_t self) { - - if (0 == self.speed) - self.speed = 100; - - if (0 == (self.spawnflags & 1)) { - self.count = (int) self.speed; - self.speed = 0; - } - - self.use = func_conveyor_use; - - gi.setmodel(self, self.model); - self.solid = SOLID_BSP; - gi.linkentity(self); - return true; - } - }; - - /*QUAKED func_door_secret (0 .5 .8) ? always_shoot 1st_left 1st_down - A secret door. Slide back and then to the side. - - open_once doors never closes - 1st_left 1st move is left of arrow - 1st_down 1st move is down from arrow - always_shoot door is shootebale even if targeted - - "angle" determines the direction - "dmg" damage to inflic when blocked (default 2) - "wait" how long to hold in the open position (default 5, -1 means hold) - */ - - public final static int SECRET_ALWAYS_SHOOT = 1; - public final static int SECRET_1ST_LEFT = 2; - public final static int SECRET_1ST_DOWN = 4; - - static EntUseAdapter door_secret_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - // make sure we're not already moving - if (0 == Math3D.VectorCompare(self.s.origin, vec3_origin)) - return; - - Move_Calc(self, self.pos1, door_secret_move1); - door_use_areaportals(self, true); - } - }; - - static EntThinkAdapter door_secret_move1 = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.nextthink = level.time + 1.0f; - self.think = door_secret_move2; - return true; - } - }; - - static EntThinkAdapter door_secret_move2 = new EntThinkAdapter() { - public boolean think(edict_t self) { - Move_Calc(self, self.pos2, door_secret_move3); - return true; - } - }; - - static EntThinkAdapter door_secret_move3 = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.wait == -1) - return true; - self.nextthink = level.time + self.wait; - self.think = door_secret_move4; - return true; - } - }; - - static EntThinkAdapter door_secret_move4 = new EntThinkAdapter() { - public boolean think(edict_t self) { - Move_Calc(self, self.pos1, door_secret_move5); - return true; - } - }; - - static EntThinkAdapter door_secret_move5 = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.nextthink = level.time + 1.0f; - self.think = door_secret_move6; - return true; - } - }; - - static EntThinkAdapter door_secret_move6 = new EntThinkAdapter() { - public boolean think(edict_t self) { - - Move_Calc(self, vec3_origin, door_secret_done); - return true; - } - }; - - static EntThinkAdapter door_secret_done = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (null == (self.targetname) || 0 != (self.spawnflags & SECRET_ALWAYS_SHOOT)) { - self.health = 0; - self.takedamage = DAMAGE_YES; - } - door_use_areaportals(self, false); - return true; - } - }; - - static EntBlockedAdapter door_secret_blocked = new EntBlockedAdapter() { - - public void blocked(edict_t self, edict_t other) { - if (0 == (other.svflags & SVF_MONSTER) && (null == other.client)) { - // give it a chance to go away on it's own terms (like gibs) - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); - // if it's still there, nuke it - if (other != null) - BecomeExplosion1(other); - return; - } - - if (level.time < self.touch_debounce_time) - return; - self.touch_debounce_time = level.time + 0.5f; - - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - } - }; - - static EntDieAdapter door_secret_die = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - self.takedamage = DAMAGE_NO; - door_secret_use.use(self, attacker, attacker); - } - }; - - static EntThinkAdapter SP_func_door_secret = new EntThinkAdapter() { - public boolean think(edict_t ent) { - float[] forward={0,0,0}, right={0,0,0}, up={0,0,0}; - float side; - float width; - float length; - - ent.moveinfo.sound_start = gi.soundindex("doors/dr1_strt.wav"); - ent.moveinfo.sound_middle = gi.soundindex("doors/dr1_mid.wav"); - ent.moveinfo.sound_end = gi.soundindex("doors/dr1_end.wav"); - - ent.movetype = MOVETYPE_PUSH; - ent.solid = SOLID_BSP; - gi.setmodel(ent, ent.model); - - ent.blocked = door_secret_blocked; - ent.use = door_secret_use; - - if (null == (ent.targetname) || 0 != (ent.spawnflags & SECRET_ALWAYS_SHOOT)) { - ent.health = 0; - ent.takedamage = DAMAGE_YES; - ent.die = door_secret_die; - } - - if (0 == ent.dmg) - ent.dmg = 2; - - if (0 == ent.wait) - ent.wait = 5; - - ent.moveinfo.accel = ent.moveinfo.decel = ent.moveinfo.speed = 50; - - // calculate positions - Math3D.AngleVectors(ent.s.angles, forward, right, up); - Math3D.VectorClear(ent.s.angles); - side = 1.0f - (ent.spawnflags & SECRET_1ST_LEFT); - if ((ent.spawnflags & SECRET_1ST_DOWN) != 0) - width = Math.abs(Math3D.DotProduct(up, ent.size)); - else - width = Math.abs(Math3D.DotProduct(right, ent.size)); - length = Math.abs(Math3D.DotProduct(forward, ent.size)); - if ((ent.spawnflags & SECRET_1ST_DOWN) != 0) - Math3D.VectorMA(ent.s.origin, -1 * width, up, ent.pos1); - else - Math3D.VectorMA(ent.s.origin, side * width, right, ent.pos1); - Math3D.VectorMA(ent.pos1, length, forward, ent.pos2); - - if (ent.health != 0) { - ent.takedamage = DAMAGE_YES; - ent.die = door_killed; - ent.max_health = ent.health; - } else if (ent.targetname != null && ent.message != null) { - gi.soundindex("misc/talk.wav"); - ent.touch = door_touch; - } - - ent.classname = "func_door"; - - gi.linkentity(ent); - return true; - } - }; - - /*QUAKED func_killbox (1 0 0) ? - Kills everything inside when fired, irrespective of protection. - */ - static EntUseAdapter use_killbox = new EntUseAdapter() { - void use_killbox(edict_t self, edict_t other, edict_t activator) { - KillBox(self); - } - }; - - static EntThinkAdapter SP_func_killbox = new EntThinkAdapter() { - public boolean think(edict_t ent) { - gi.setmodel(ent, ent.model); - ent.use = use_killbox; - ent.svflags = SVF_NOCLIENT; - return true; - } - }; - - - - - } diff --git a/src/jake2/game/GameFuncAdapters.java b/src/jake2/game/GameFuncAdapters.java new file mode 100644 index 0000000..5d48a6e --- /dev/null +++ b/src/jake2/game/GameFuncAdapters.java @@ -0,0 +1,1835 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameFuncAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.util.Lib; +import jake2.util.Math3D; +import jake2.Defines; +import jake2.Globals; +import jake2.util.*; +import jake2.util.*; + +public class GameFuncAdapters +{ + + /* + ========================================================= + + PLATS + + movement options: + + linear + smooth start, hard stop + smooth start, smooth stop + + start + end + acceleration + speed + deceleration + begin sound + end sound + target fired when reaching end + wait at end + + object characteristics that use move segments + --------------------------------------------- + movetype_push, or movetype_stop + action when touched + action when blocked + action when used + disabled? + auto trigger spawning + + + ========================================================= + */ + + public final static int PLAT_LOW_TRIGGER = 1; + public final static int STATE_TOP = 0; + public final static int STATE_BOTTOM = 1; + public final static int STATE_UP = 2; + public final static int STATE_DOWN = 3; + public final static int DOOR_START_OPEN = 1; + public final static int DOOR_REVERSE = 2; + public final static int DOOR_CRUSHER = 4; + public final static int DOOR_NOMONSTER = 8; + public final static int DOOR_TOGGLE = 32; + public final static int DOOR_X_AXIS = 64; + public final static int DOOR_Y_AXIS = 128; + // + // Support routines for movement (changes in origin using velocity) + // + + static EntThinkAdapter Move_Done = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + Math3D.VectorClear(ent.velocity); + ent.moveinfo.endfunc.think(ent); + return true; + } + }; + static EntThinkAdapter Move_Final = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + + if (ent.moveinfo.remaining_distance == 0) + { + Move_Done.think(ent); + return true; + } + + Math3D.VectorScale(ent.moveinfo.dir, ent.moveinfo.remaining_distance / Defines.FRAMETIME, ent.velocity); + + ent.think = Move_Done; + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + static EntThinkAdapter Move_Begin = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + + float frames; + + if ((ent.moveinfo.speed * Defines.FRAMETIME) >= ent.moveinfo.remaining_distance) + { + Move_Final.think(ent); + return true; + } + Math3D.VectorScale(ent.moveinfo.dir, ent.moveinfo.speed, ent.velocity); + frames = (float) Math.floor((ent.moveinfo.remaining_distance / ent.moveinfo.speed) / Defines.FRAMETIME); + ent.moveinfo.remaining_distance -= frames * ent.moveinfo.speed * Defines.FRAMETIME; + ent.nextthink = GameBase.level.time + (frames * Defines.FRAMETIME); + ent.think = Move_Final; + return true; + } + }; + // + // Support routines for angular movement (changes in angle using avelocity) + // + + static EntThinkAdapter AngleMove_Done = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + Math3D.VectorClear(ent.avelocity); + ent.moveinfo.endfunc.think(ent); + return true; + } + }; + static EntThinkAdapter AngleMove_Final = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + float[] move = { 0, 0, 0 }; + + if (ent.moveinfo.state == STATE_UP) + Math3D.VectorSubtract(ent.moveinfo.end_angles, ent.s.angles, move); + else + Math3D.VectorSubtract(ent.moveinfo.start_angles, ent.s.angles, move); + + if (Math3D.VectorCompare(move, Globals.vec3_origin) != 0) + { + AngleMove_Done.think(ent); + return true; + } + + Math3D.VectorScale(move, 1.0f / Defines.FRAMETIME, ent.avelocity); + + ent.think = AngleMove_Done; + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + static EntThinkAdapter AngleMove_Begin = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + float[] destdelta = { 0, 0, 0 }; + float len; + float traveltime; + float frames; + + // set destdelta to the vector needed to move + if (ent.moveinfo.state == STATE_UP) + Math3D.VectorSubtract(ent.moveinfo.end_angles, ent.s.angles, destdelta); + else + Math3D.VectorSubtract(ent.moveinfo.start_angles, ent.s.angles, destdelta); + + // calculate length of vector + len = Math3D.VectorLength(destdelta); + + // divide by speed to get time to reach dest + traveltime = len / ent.moveinfo.speed; + + if (traveltime < Defines.FRAMETIME) + { + AngleMove_Final.think(ent); + return true; + } + + frames = (float) (Math.floor(traveltime / Defines.FRAMETIME)); + + // scale the destdelta vector by the time spent traveling to get velocity + Math3D.VectorScale(destdelta, 1.0f / traveltime, ent.avelocity); + + // set nextthink to trigger a think when dest is reached + ent.nextthink = GameBase.level.time + frames * Defines.FRAMETIME; + ent.think = AngleMove_Final; + return true; + } + }; + static EntThinkAdapter Think_AccelMove = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + ent.moveinfo.remaining_distance -= ent.moveinfo.current_speed; + + if (ent.moveinfo.current_speed == 0) // starting or blocked + GameFunc.plat_CalcAcceleratedMove(ent.moveinfo); + + GameFunc.plat_Accelerate(ent.moveinfo); + + // will the entire move complete on next frame? + if (ent.moveinfo.remaining_distance <= ent.moveinfo.current_speed) + { + Move_Final.think(ent); + return true; + } + + Math3D.VectorScale(ent.moveinfo.dir, ent.moveinfo.current_speed * 10, ent.velocity); + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + ent.think = Think_AccelMove; + return true; + } + }; + static EntThinkAdapter plat_hit_top = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + if (0 == (ent.flags & Defines.FL_TEAMSLAVE)) + { + if (ent.moveinfo.sound_end != 0) + GameBase.gi.sound( + ent, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + ent.moveinfo.sound_end, + 1, + Defines.ATTN_STATIC, + 0); + ent.s.sound = 0; + } + ent.moveinfo.state = STATE_TOP; + + ent.think = plat_go_down; + ent.nextthink = GameBase.level.time + 3; + return true; + } + }; + static EntThinkAdapter plat_hit_bottom = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + + if (0 == (ent.flags & Defines.FL_TEAMSLAVE)) + { + if (ent.moveinfo.sound_end != 0) + GameBase.gi.sound( + ent, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + ent.moveinfo.sound_end, + 1, + Defines.ATTN_STATIC, + 0); + ent.s.sound = 0; + } + ent.moveinfo.state = STATE_BOTTOM; + return true; + } + }; + static EntThinkAdapter plat_go_down = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + if (0 == (ent.flags & Defines.FL_TEAMSLAVE)) + { + if (ent.moveinfo.sound_start != 0) + GameBase.gi.sound( + ent, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + ent.moveinfo.sound_start, + 1, + Defines.ATTN_STATIC, + 0); + ent.s.sound = ent.moveinfo.sound_middle; + } + ent.moveinfo.state = STATE_DOWN; + GameFunc.Move_Calc(ent, ent.moveinfo.end_origin, plat_hit_bottom); + return true; + } + }; + static EntBlockedAdapter plat_blocked = new EntBlockedAdapter() + { + public void blocked(edict_t self, edict_t other) + { + if (0 == (other.svflags & Defines.SVF_MONSTER) && (null == other.client)) + { + // give it a chance to go away on it's own terms (like gibs) + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + 100000, + 1, + 0, + Defines.MOD_CRUSH); + // if it's still there, nuke it + if (other != null) + GameAI.BecomeExplosion1(other); + return; + } + + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + + if (self.moveinfo.state == STATE_UP) + plat_go_down.think(self); + else if (self.moveinfo.state == STATE_DOWN) + GameFunc.plat_go_up(self); + + } + }; + static EntUseAdapter Use_Plat = new EntUseAdapter() + { + public void use(edict_t ent, edict_t other, edict_t activator) + { + if (ent.think != null) + return; // already down + plat_go_down.think(ent); + } + }; + static EntTouchAdapter Touch_Plat_Center = new EntTouchAdapter() + { + public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) + { + if (other.client == null) + return; + + if (other.health <= 0) + return; + + ent = ent.enemy; // now point at the plat, not the trigger + if (ent.moveinfo.state == STATE_BOTTOM) + GameFunc.plat_go_up(ent); + else if (ent.moveinfo.state == STATE_TOP) + { + ent.nextthink = GameBase.level.time + 1; // the player is still on the plat, so delay going down + } + } + }; + // ==================================================================== + + /*QUAKED func_rotating (0 .5 .8) ? START_ON REVERSE X_AXIS Y_AXIS TOUCH_PAIN STOP ANIMATED ANIMATED_FAST + You need to have an origin brush as part of this entity. The center of that brush will be + the point around which it is rotated. It will rotate around the Z axis by default. You can + check either the X_AXIS or Y_AXIS box to change that. + + "speed" determines how fast it moves; default value is 100. + "dmg" damage to inflict when blocked (2 default) + + REVERSE will cause the it to rotate in the opposite direction. + STOP mean it will stop moving instead of pushing entities + */ + + static EntBlockedAdapter rotating_blocked = new EntBlockedAdapter() + { + public void blocked(edict_t self, edict_t other) + { + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + } + }; + static EntTouchAdapter rotating_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + if (self.avelocity[0] != 0 || self.avelocity[1] != 0 || self.avelocity[2] != 0) + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + } + }; + static EntUseAdapter rotating_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + if (0 == Math3D.VectorCompare(self.avelocity, Globals.vec3_origin)) + { + self.s.sound = 0; + Math3D.VectorClear(self.avelocity); + self.touch = null; + } + else + { + self.s.sound = self.moveinfo.sound_middle; + Math3D.VectorScale(self.movedir, self.speed, self.avelocity); + if ((self.spawnflags & 16) != 0) + self.touch = rotating_touch; + } + } + }; + static EntThinkAdapter SP_func_rotating = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + ent.solid = Defines.SOLID_BSP; + if ((ent.spawnflags & 32) != 0) + ent.movetype = Defines.MOVETYPE_STOP; + else + ent.movetype = Defines.MOVETYPE_PUSH; + + // set the axis of rotation + Math3D.VectorClear(ent.movedir); + if ((ent.spawnflags & 4) != 0) + ent.movedir[2] = 1.0f; + else if ((ent.spawnflags & 8) != 0) + ent.movedir[0] = 1.0f; + else // Z_AXIS + ent.movedir[1] = 1.0f; + + // check for reverse rotation + if ((ent.spawnflags & 2) != 0) + Math3D.VectorNegate(ent.movedir, ent.movedir); + + if (0 == ent.speed) + ent.speed = 100; + if (0 == ent.dmg) + ent.dmg = 2; + + // ent.moveinfo.sound_middle = "doors/hydro1.wav"; + + ent.use = rotating_use; + if (ent.dmg != 0) + ent.blocked = rotating_blocked; + + if ((ent.spawnflags & 1) != 0) + ent.use.use(ent, null, null); + + if ((ent.spawnflags & 64) != 0) + ent.s.effects |= Defines.EF_ANIM_ALL; + if ((ent.spawnflags & 128) != 0) + ent.s.effects |= Defines.EF_ANIM_ALLFAST; + + GameBase.gi.setmodel(ent, ent.model); + GameBase.gi.linkentity(ent); + return true; + } + }; + /* + ====================================================================== + + BUTTONS + + ====================================================================== + */ + + /*QUAKED func_button (0 .5 .8) ? + When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again. + + "angle" determines the opening direction + "target" all entities with a matching targetname will be used + "speed" override the default 40 speed + "wait" override the default 1 second wait (-1 = never return) + "lip" override the default 4 pixel lip remaining at end of move + "health" if set, the button must be killed instead of touched + "sounds" + 1) silent + 2) steam metal + 3) wooden clunk + 4) metallic click + 5) in-out + */ + + static EntThinkAdapter button_done = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + self.moveinfo.state = STATE_BOTTOM; + self.s.effects &= ~Defines.EF_ANIM23; + self.s.effects |= Defines.EF_ANIM01; + return true; + } + }; + static EntThinkAdapter button_return = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.moveinfo.state = STATE_DOWN; + + GameFunc.Move_Calc(self, self.moveinfo.start_origin, button_done); + + self.s.frame = 0; + + if (self.health != 0) + self.takedamage = Defines.DAMAGE_YES; + return true; + } + }; + static EntThinkAdapter button_wait = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.moveinfo.state = STATE_TOP; + self.s.effects &= ~Defines.EF_ANIM01; + self.s.effects |= Defines.EF_ANIM23; + + GameUtil.G_UseTargets(self, self.activator); + self.s.frame = 1; + if (self.moveinfo.wait >= 0) + { + self.nextthink = GameBase.level.time + self.moveinfo.wait; + self.think = button_return; + } + return true; + } + }; + static EntThinkAdapter button_fire = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.moveinfo.state == STATE_UP || self.moveinfo.state == STATE_TOP) + return true; + + self.moveinfo.state = STATE_UP; + if (self.moveinfo.sound_start != 0 && 0 == (self.flags & Defines.FL_TEAMSLAVE)) + GameBase.gi.sound( + self, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + self.moveinfo.sound_start, + 1, + Defines.ATTN_STATIC, + 0); + GameFunc.Move_Calc(self, self.moveinfo.end_origin, button_wait); + return true; + } + }; + static EntUseAdapter button_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.activator = activator; + button_fire.think(self); + return; + } + }; + static EntTouchAdapter button_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + if (null == other.client) + return; + + if (other.health <= 0) + return; + + self.activator = other; + button_fire.think(self); + + } + }; + static EntDieAdapter button_killed = new EntDieAdapter() + { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + self.activator = attacker; + self.health = self.max_health; + self.takedamage = Defines.DAMAGE_NO; + button_fire.think(self); + + } + }; + static EntThinkAdapter SP_func_button = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + float[] abs_movedir = { 0, 0, 0 }; + float dist; + + GameBase.G_SetMovedir(ent.s.angles, ent.movedir); + ent.movetype = Defines.MOVETYPE_STOP; + ent.solid = Defines.SOLID_BSP; + GameBase.gi.setmodel(ent, ent.model); + + if (ent.sounds != 1) + ent.moveinfo.sound_start = GameBase.gi.soundindex("switches/butn2.wav"); + + if (0 == ent.speed) + ent.speed = 40; + if (0 == ent.accel) + ent.accel = ent.speed; + if (0 == ent.decel) + ent.decel = ent.speed; + + if (0 == ent.wait) + ent.wait = 3; + if (0 == GameBase.st.lip) + GameBase.st.lip = 4; + + Math3D.VectorCopy(ent.s.origin, ent.pos1); + abs_movedir[0] = (float) Math.abs(ent.movedir[0]); + abs_movedir[1] = (float) Math.abs(ent.movedir[1]); + abs_movedir[2] = (float) Math.abs(ent.movedir[2]); + dist = abs_movedir[0] * ent.size[0] + abs_movedir[1] * ent.size[1] + abs_movedir[2] * ent.size[2] - GameBase.st.lip; + Math3D.VectorMA(ent.pos1, dist, ent.movedir, ent.pos2); + + ent.use = button_use; + ent.s.effects |= Defines.EF_ANIM01; + + if (ent.health != 0) + { + ent.max_health = ent.health; + ent.die = button_killed; + ent.takedamage = Defines.DAMAGE_YES; + } + else if (null == ent.targetname) + ent.touch = button_touch; + + ent.moveinfo.state = STATE_BOTTOM; + + ent.moveinfo.speed = ent.speed; + ent.moveinfo.accel = ent.accel; + ent.moveinfo.decel = ent.decel; + ent.moveinfo.wait = ent.wait; + Math3D.VectorCopy(ent.pos1, ent.moveinfo.start_origin); + Math3D.VectorCopy(ent.s.angles, ent.moveinfo.start_angles); + Math3D.VectorCopy(ent.pos2, ent.moveinfo.end_origin); + Math3D.VectorCopy(ent.s.angles, ent.moveinfo.end_angles); + + GameBase.gi.linkentity(ent); + return true; + } + }; + static EntThinkAdapter door_hit_top = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (0 == (self.flags & Defines.FL_TEAMSLAVE)) + { + if (self.moveinfo.sound_end != 0) + GameBase.gi.sound( + self, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + self.moveinfo.sound_end, + 1, + Defines.ATTN_STATIC, + 0); + self.s.sound = 0; + } + self.moveinfo.state = STATE_TOP; + if ((self.spawnflags & DOOR_TOGGLE) != 0) + return true; + if (self.moveinfo.wait >= 0) + { + self.think = door_go_down; + self.nextthink = GameBase.level.time + self.moveinfo.wait; + } + return true; + } + }; + static EntThinkAdapter door_hit_bottom = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (0 == (self.flags & Defines.FL_TEAMSLAVE)) + { + if (self.moveinfo.sound_end != 0) + GameBase.gi.sound( + self, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + self.moveinfo.sound_end, + 1, + Defines.ATTN_STATIC, + 0); + self.s.sound = 0; + } + self.moveinfo.state = STATE_BOTTOM; + GameFunc.door_use_areaportals(self, false); + return true; + } + }; + static EntThinkAdapter door_go_down = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (0 == (self.flags & Defines.FL_TEAMSLAVE)) + { + if (self.moveinfo.sound_start != 0) + GameBase.gi.sound( + self, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + self.moveinfo.sound_start, + 1, + Defines.ATTN_STATIC, + 0); + self.s.sound = self.moveinfo.sound_middle; + } + if (self.max_health != 0) + { + self.takedamage = Defines.DAMAGE_YES; + self.health = self.max_health; + } + + self.moveinfo.state = STATE_DOWN; + if (Lib.strcmp(self.classname, "func_door") == 0) + GameFunc.Move_Calc(self, self.moveinfo.start_origin, door_hit_bottom); + else if (Lib.strcmp(self.classname, "func_door_rotating") == 0) + GameFunc.AngleMove_Calc(self, door_hit_bottom); + return true; + } + }; + static EntUseAdapter door_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + edict_t ent; + + if ((self.flags & Defines.FL_TEAMSLAVE) != 0) + return; + + if ((self.spawnflags & DOOR_TOGGLE) != 0) + { + if (self.moveinfo.state == STATE_UP || self.moveinfo.state == STATE_TOP) + { + // trigger all paired doors + for (ent = self; ent != null; ent = ent.teamchain) + { + ent.message = null; + ent.touch = null; + door_go_down.think(ent); + } + return; + } + } + + // trigger all paired doors + for (ent = self; ent != null; ent = ent.teamchain) + { + ent.message = null; + ent.touch = null; + GameFunc.door_go_up(ent, activator); + } + } + }; + static EntTouchAdapter Touch_DoorTrigger = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + if (other.health <= 0) + return; + + if (0 == (other.svflags & Defines.SVF_MONSTER) && (null == other.client)) + return; + + if (0 != (self.owner.spawnflags & DOOR_NOMONSTER) && 0 != (other.svflags & Defines.SVF_MONSTER)) + return; + + if (GameBase.level.time < self.touch_debounce_time) + return; + self.touch_debounce_time = GameBase.level.time + 1.0f; + + door_use.use(self.owner, other, other); + } + }; + static EntThinkAdapter Think_CalcMoveSpeed = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + edict_t ent; + float min; + float time; + float newspeed; + float ratio; + float dist; + + if ((self.flags & Defines.FL_TEAMSLAVE) != 0) + return true; // only the team master does this + + // find the smallest distance any member of the team will be moving + min = Math.abs(self.moveinfo.distance); + for (ent = self.teamchain; ent != null; ent = ent.teamchain) + { + dist = Math.abs(ent.moveinfo.distance); + if (dist < min) + min = dist; + } + + time = min / self.moveinfo.speed; + + // adjust speeds so they will all complete at the same time + for (ent = self; ent != null; ent = ent.teamchain) + { + newspeed = Math.abs(ent.moveinfo.distance) / time; + ratio = newspeed / ent.moveinfo.speed; + if (ent.moveinfo.accel == ent.moveinfo.speed) + ent.moveinfo.accel = newspeed; + else + ent.moveinfo.accel *= ratio; + if (ent.moveinfo.decel == ent.moveinfo.speed) + ent.moveinfo.decel = newspeed; + else + ent.moveinfo.decel *= ratio; + ent.moveinfo.speed = newspeed; + } + return true; + } + }; + + static EntThinkAdapter Think_SpawnDoorTrigger = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + edict_t other; + float[] mins = { 0, 0, 0 }, maxs = { 0, 0, 0 }; + + if ((ent.flags & Defines.FL_TEAMSLAVE) != 0) + return true; // only the team leader spawns a trigger + + Math3D.VectorCopy(ent.absmin, mins); + Math3D.VectorCopy(ent.absmax, maxs); + + for (other = ent.teamchain; other != null; other = other.teamchain) + { + GameBase.AddPointToBounds(other.absmin, mins, maxs); + GameBase.AddPointToBounds(other.absmax, mins, maxs); + } + + // expand + mins[0] -= 60; + mins[1] -= 60; + maxs[0] += 60; + maxs[1] += 60; + + other = GameUtil.G_Spawn(); + Math3D.VectorCopy(mins, other.mins); + Math3D.VectorCopy(maxs, other.maxs); + other.owner = ent; + other.solid = Defines.SOLID_TRIGGER; + other.movetype = Defines.MOVETYPE_NONE; + other.touch = Touch_DoorTrigger; + GameBase.gi.linkentity(other); + + if ((ent.spawnflags & DOOR_START_OPEN) != 0) + GameFunc.door_use_areaportals(ent, true); + + Think_CalcMoveSpeed.think(ent); + return true; + } + }; + static EntBlockedAdapter door_blocked = new EntBlockedAdapter() + { + public void blocked(edict_t self, edict_t other) + { + edict_t ent; + + if (0 == (other.svflags & Defines.SVF_MONSTER) && (null == other.client)) + { + // give it a chance to go away on it's own terms (like gibs) + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + 100000, + 1, + 0, + Defines.MOD_CRUSH); + // if it's still there, nuke it + if (other != null) + GameAI.BecomeExplosion1(other); + return; + } + + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + + if ((self.spawnflags & DOOR_CRUSHER) != 0) + return; + + // if a door has a negative wait, it would never come back if blocked, + // so let it just squash the object to death real fast + if (self.moveinfo.wait >= 0) + { + if (self.moveinfo.state == STATE_DOWN) + { + for (ent = self.teammaster; ent != null; ent = ent.teamchain) + GameFunc.door_go_up(ent, ent.activator); + } + else + { + for (ent = self.teammaster; ent != null; ent = ent.teamchain) + door_go_down.think(ent); + } + } + } + }; + static EntDieAdapter door_killed = new EntDieAdapter() + { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + edict_t ent; + + for (ent = self.teammaster; ent != null; ent = ent.teamchain) + { + ent.health = ent.max_health; + ent.takedamage = Defines.DAMAGE_NO; + } + door_use.use(self.teammaster, attacker, attacker); + } + }; + static EntTouchAdapter door_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + if (null == other.client) + return; + + if (GameBase.level.time < self.touch_debounce_time) + return; + self.touch_debounce_time = GameBase.level.time + 5.0f; + + GameBase.gi.centerprintf(other, self.message); + GameBase.gi.sound(other, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/talk1.wav"), 1, Defines.ATTN_NORM, 0); + } + }; + static EntThinkAdapter SP_func_door = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + float[] abs_movedir = { 0, 0, 0 }; + + if (ent.sounds != 1) + { + ent.moveinfo.sound_start = GameBase.gi.soundindex("doors/dr1_strt.wav"); + ent.moveinfo.sound_middle = GameBase.gi.soundindex("doors/dr1_mid.wav"); + ent.moveinfo.sound_end = GameBase.gi.soundindex("doors/dr1_end.wav"); + } + + GameBase.G_SetMovedir(ent.s.angles, ent.movedir); + ent.movetype = Defines.MOVETYPE_PUSH; + ent.solid = Defines.SOLID_BSP; + GameBase.gi.setmodel(ent, ent.model); + + ent.blocked = door_blocked; + ent.use = door_use; + + if (0 == ent.speed) + ent.speed = 100; + if (GameBase.deathmatch.value != 0) + ent.speed *= 2; + + if (0 == ent.accel) + ent.accel = ent.speed; + if (0 == ent.decel) + ent.decel = ent.speed; + + if (0 == ent.wait) + ent.wait = 3; + if (0 == GameBase.st.lip) + GameBase.st.lip = 8; + if (0 == ent.dmg) + ent.dmg = 2; + + // calculate second position + Math3D.VectorCopy(ent.s.origin, ent.pos1); + abs_movedir[0] = Math.abs(ent.movedir[0]); + abs_movedir[1] = Math.abs(ent.movedir[1]); + abs_movedir[2] = Math.abs(ent.movedir[2]); + ent.moveinfo.distance = + abs_movedir[0] * ent.size[0] + abs_movedir[1] * ent.size[1] + abs_movedir[2] * ent.size[2] - GameBase.st.lip; + + Math3D.VectorMA(ent.pos1, ent.moveinfo.distance, ent.movedir, ent.pos2); + + // if it starts open, switch the positions + if ((ent.spawnflags & DOOR_START_OPEN) != 0) + { + Math3D.VectorCopy(ent.pos2, ent.s.origin); + Math3D.VectorCopy(ent.pos1, ent.pos2); + Math3D.VectorCopy(ent.s.origin, ent.pos1); + } + + ent.moveinfo.state = STATE_BOTTOM; + + if (ent.health != 0) + { + ent.takedamage = Defines.DAMAGE_YES; + ent.die = door_killed; + ent.max_health = ent.health; + } + else if (ent.targetname != null && ent.message != null) + { + GameBase.gi.soundindex("misc/talk.wav"); + ent.touch = door_touch; + } + + ent.moveinfo.speed = ent.speed; + ent.moveinfo.accel = ent.accel; + ent.moveinfo.decel = ent.decel; + ent.moveinfo.wait = ent.wait; + Math3D.VectorCopy(ent.pos1, ent.moveinfo.start_origin); + Math3D.VectorCopy(ent.s.angles, ent.moveinfo.start_angles); + Math3D.VectorCopy(ent.pos2, ent.moveinfo.end_origin); + Math3D.VectorCopy(ent.s.angles, ent.moveinfo.end_angles); + + if ((ent.spawnflags & 16) != 0) + ent.s.effects |= Defines.EF_ANIM_ALL; + if ((ent.spawnflags & 64) != 0) + ent.s.effects |= Defines.EF_ANIM_ALLFAST; + + // to simplify logic elsewhere, make non-teamed doors into a team of one + if (null == ent.team) + ent.teammaster = ent; + + GameBase.gi.linkentity(ent); + + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + if (ent.health != 0 || ent.targetname != null) + ent.think = Think_CalcMoveSpeed; + else + ent.think = Think_SpawnDoorTrigger; + return true; + } + }; + /*QUAKED func_door_rotating (0 .5 .8) ? START_OPEN REVERSE CRUSHER NOMONSTER ANIMATED TOGGLE X_AXIS Y_AXIS + TOGGLE causes the door to wait in both the start and end states for a trigger event. + + START_OPEN the door to moves to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not useful for touch or takedamage doors). + NOMONSTER monsters will not trigger this door + + You need to have an origin brush as part of this entity. The center of that brush will be + the point around which it is rotated. It will rotate around the Z axis by default. You can + check either the X_AXIS or Y_AXIS box to change that. + + "distance" is how many degrees the door will be rotated. + "speed" determines how fast the door moves; default value is 100. + + REVERSE will cause the door to rotate in the opposite direction. + + "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet + "angle" determines the opening direction + "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. + "health" if set, door must be shot open + "speed" movement speed (100 default) + "wait" wait before returning (3 default, -1 = never return) + "dmg" damage to inflict when blocked (2 default) + "sounds" + 1) silent + 2) light + 3) medium + 4) heavy + */ + + static EntThinkAdapter SP_func_door_rotating = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + Math3D.VectorClear(ent.s.angles); + + // set the axis of rotation + Math3D.VectorClear(ent.movedir); + if ((ent.spawnflags & DOOR_X_AXIS) != 0) + ent.movedir[2] = 1.0f; + else if ((ent.spawnflags & DOOR_Y_AXIS) != 0) + ent.movedir[0] = 1.0f; + else // Z_AXIS + ent.movedir[1] = 1.0f; + + // check for reverse rotation + if ((ent.spawnflags & DOOR_REVERSE) != 0) + Math3D.VectorNegate(ent.movedir, ent.movedir); + + if (0 == GameBase.st.distance) + { + GameBase.gi.dprintf(ent.classname + " at " + Lib.vtos(ent.s.origin) + " with no distance set\n"); + GameBase.st.distance = 90; + } + + Math3D.VectorCopy(ent.s.angles, ent.pos1); + Math3D.VectorMA(ent.s.angles, GameBase.st.distance, ent.movedir, ent.pos2); + ent.moveinfo.distance = GameBase.st.distance; + + ent.movetype = Defines.MOVETYPE_PUSH; + ent.solid = Defines.SOLID_BSP; + GameBase.gi.setmodel(ent, ent.model); + + ent.blocked = door_blocked; + ent.use = door_use; + + if (0 == ent.speed) + ent.speed = 100; + if (0 == ent.accel) + ent.accel = ent.speed; + if (0 == ent.decel) + ent.decel = ent.speed; + + if (0 == ent.wait) + ent.wait = 3; + if (0 == ent.dmg) + ent.dmg = 2; + + if (ent.sounds != 1) + { + ent.moveinfo.sound_start = GameBase.gi.soundindex("doors/dr1_strt.wav"); + ent.moveinfo.sound_middle = GameBase.gi.soundindex("doors/dr1_mid.wav"); + ent.moveinfo.sound_end = GameBase.gi.soundindex("doors/dr1_end.wav"); + } + + // if it starts open, switch the positions + if ((ent.spawnflags & DOOR_START_OPEN) != 0) + { + Math3D.VectorCopy(ent.pos2, ent.s.angles); + Math3D.VectorCopy(ent.pos1, ent.pos2); + Math3D.VectorCopy(ent.s.angles, ent.pos1); + Math3D.VectorNegate(ent.movedir, ent.movedir); + } + + if (ent.health != 0) + { + ent.takedamage = Defines.DAMAGE_YES; + ent.die = door_killed; + ent.max_health = ent.health; + } + + if (ent.targetname != null && ent.message != null) + { + GameBase.gi.soundindex("misc/talk.wav"); + ent.touch = door_touch; + } + + ent.moveinfo.state = STATE_BOTTOM; + ent.moveinfo.speed = ent.speed; + ent.moveinfo.accel = ent.accel; + ent.moveinfo.decel = ent.decel; + ent.moveinfo.wait = ent.wait; + Math3D.VectorCopy(ent.s.origin, ent.moveinfo.start_origin); + Math3D.VectorCopy(ent.pos1, ent.moveinfo.start_angles); + Math3D.VectorCopy(ent.s.origin, ent.moveinfo.end_origin); + Math3D.VectorCopy(ent.pos2, ent.moveinfo.end_angles); + + if ((ent.spawnflags & 16) != 0) + ent.s.effects |= Defines.EF_ANIM_ALL; + + // to simplify logic elsewhere, make non-teamed doors into a team of one + if (ent.team == null) + ent.teammaster = ent; + + GameBase.gi.linkentity(ent); + + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + if (ent.health != 0 || ent.targetname != null) + ent.think = Think_CalcMoveSpeed; + else + ent.think = Think_SpawnDoorTrigger; + return true; + } + }; + public final static int TRAIN_START_ON = 1; + public final static int TRAIN_TOGGLE = 2; + public final static int TRAIN_BLOCK_STOPS = 4; + /*QUAKED func_train (0 .5 .8) ? START_ON TOGGLE BLOCK_STOPS + Trains are moving platforms that players can ride. + The targets origin specifies the min point of the train at each corner. + The train spawns at the first target it is pointing at. + If the train is the target of a button or trigger, it will not begin moving until activated. + speed default 100 + dmg default 2 + noise looping sound to play when the train is in motion + + */ + + static EntBlockedAdapter train_blocked = new EntBlockedAdapter() + { + + public void blocked(edict_t self, edict_t other) + { + if (0 == (other.svflags & Defines.SVF_MONSTER) && (null == other.client)) + { + // give it a chance to go away on it's own terms (like gibs) + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + 100000, + 1, + 0, + Defines.MOD_CRUSH); + // if it's still there, nuke it + if (other != null) + GameAI.BecomeExplosion1(other); + return; + } + + if (GameBase.level.time < self.touch_debounce_time) + return; + + if (self.dmg == 0) + return; + self.touch_debounce_time = GameBase.level.time + 0.5f; + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + } + }; + static EntThinkAdapter train_wait = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.target_ent.pathtarget != null) + { + String savetarget; + edict_t ent; + + ent = self.target_ent; + savetarget = ent.target; + ent.target = ent.pathtarget; + GameUtil.G_UseTargets(ent, self.activator); + ent.target = savetarget; + + // make sure we didn't get killed by a killtarget + if (!self.inuse) + return true; + } + + if (self.moveinfo.wait != 0) + { + if (self.moveinfo.wait > 0) + { + self.nextthink = GameBase.level.time + self.moveinfo.wait; + self.think = train_next; + } + else if (0 != (self.spawnflags & TRAIN_TOGGLE)) // && wait < 0 + { + train_next.think(self); + self.spawnflags &= ~TRAIN_START_ON; + Math3D.VectorClear(self.velocity); + self.nextthink = 0; + } + + if (0 == (self.flags & Defines.FL_TEAMSLAVE)) + { + if (self.moveinfo.sound_end != 0) + GameBase.gi.sound( + self, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + self.moveinfo.sound_end, + 1, + Defines.ATTN_STATIC, + 0); + self.s.sound = 0; + } + } + else + { + train_next.think(self); + } + return true; + } + }; + static EntThinkAdapter train_next = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + edict_t ent = null; + float[] dest = { 0, 0, 0 }; + boolean first; + + first = true; + + boolean dogoto = true; + while (dogoto) + { + if (null == self.target) + { + // gi.dprintf ("train_next: no next target\n"); + return true; + } + + ent = GameBase.G_PickTarget(self.target); + if (null == ent) + { + GameBase.gi.dprintf("train_next: bad target " + self.target + "\n"); + return true; + } + + self.target = ent.target; + dogoto = false; + // check for a teleport path_corner + if ((ent.spawnflags & 1) != 0) + { + if (!first) + { + GameBase.gi.dprintf( + "connected teleport path_corners, see " + ent.classname + " at " + Lib.vtos(ent.s.origin) + "\n"); + return true; + } + first = false; + Math3D.VectorSubtract(ent.s.origin, self.mins, self.s.origin); + Math3D.VectorCopy(self.s.origin, self.s.old_origin); + self.s.event = Defines.EV_OTHER_TELEPORT; + GameBase.gi.linkentity(self); + dogoto = true; + } + } + self.moveinfo.wait = ent.wait; + self.target_ent = ent; + + if (0 == (self.flags & Defines.FL_TEAMSLAVE)) + { + if (self.moveinfo.sound_start != 0) + GameBase.gi.sound( + self, + Defines.CHAN_NO_PHS_ADD + Defines.CHAN_VOICE, + self.moveinfo.sound_start, + 1, + Defines.ATTN_STATIC, + 0); + self.s.sound = self.moveinfo.sound_middle; + } + + Math3D.VectorSubtract(ent.s.origin, self.mins, dest); + self.moveinfo.state = STATE_TOP; + Math3D.VectorCopy(self.s.origin, self.moveinfo.start_origin); + Math3D.VectorCopy(dest, self.moveinfo.end_origin); + GameFunc.Move_Calc(self, dest, train_wait); + self.spawnflags |= TRAIN_START_ON; + return true; + } + }; + public static EntThinkAdapter func_train_find = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + edict_t ent; + + if (null == self.target) + { + GameBase.gi.dprintf("train_find: no target\n"); + return true; + } + ent = GameBase.G_PickTarget(self.target); + if (null == ent) + { + GameBase.gi.dprintf("train_find: target " + self.target + " not found\n"); + return true; + } + self.target = ent.target; + + Math3D.VectorSubtract(ent.s.origin, self.mins, self.s.origin); + GameBase.gi.linkentity(self); + + // if not triggered, start immediately + if (null == self.targetname) + self.spawnflags |= TRAIN_START_ON; + + if ((self.spawnflags & TRAIN_START_ON) != 0) + { + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + self.think = train_next; + self.activator = self; + } + return true; + } + }; + public static EntUseAdapter train_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.activator = activator; + + if ((self.spawnflags & TRAIN_START_ON) != 0) + { + if (0 == (self.spawnflags & TRAIN_TOGGLE)) + return; + self.spawnflags &= ~TRAIN_START_ON; + Math3D.VectorClear(self.velocity); + self.nextthink = 0; + } + else + { + if (self.target_ent != null) + GameFunc.train_resume(self); + else + train_next.think(self); + } + } + }; + /*QUAKED trigger_elevator (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) + */ + static EntUseAdapter trigger_elevator_use = new EntUseAdapter() + { + + public void use(edict_t self, edict_t other, edict_t activator) + { + edict_t target; + + if (0 != self.movetarget.nextthink) + { + // gi.dprintf("elevator busy\n"); + return; + } + + if (null == other.pathtarget) + { + GameBase.gi.dprintf("elevator used with no pathtarget\n"); + return; + } + + target = GameBase.G_PickTarget(other.pathtarget); + if (null == target) + { + GameBase.gi.dprintf("elevator used with bad pathtarget: " + other.pathtarget + "\n"); + return; + } + + self.movetarget.target_ent = target; + GameFunc.train_resume(self.movetarget); + } + }; + static EntThinkAdapter trigger_elevator_init = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (null == self.target) + { + GameBase.gi.dprintf("trigger_elevator has no target\n"); + return true; + } + self.movetarget = GameBase.G_PickTarget(self.target); + if (null == self.movetarget) + { + GameBase.gi.dprintf("trigger_elevator unable to find target " + self.target + "\n"); + return true; + } + if (Lib.strcmp(self.movetarget.classname, "func_train") != 0) + { + GameBase.gi.dprintf("trigger_elevator target " + self.target + " is not a train\n"); + return true; + } + + self.use = trigger_elevator_use; + self.svflags = Defines.SVF_NOCLIENT; + return true; + } + }; + static EntThinkAdapter SP_trigger_elevator = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.think = trigger_elevator_init; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + /*QUAKED func_timer (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) START_ON + "wait" base time between triggering all targets, default is 1 + "random" wait variance, default is 0 + + so, the basic time between firing is a random time between + (wait - random) and (wait + random) + + "delay" delay before first firing when turned on, default is 0 + + "pausetime" additional delay used only the very first time + and only if spawned with START_ON + + These can used but not touched. + */ + + static EntThinkAdapter func_timer_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + GameUtil.G_UseTargets(self, self.activator); + self.nextthink = GameBase.level.time + self.wait + Lib.crandom() * self.random; + return true; + } + }; + static EntUseAdapter func_timer_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.activator = activator; + + // if on, turn it off + if (self.nextthink != 0) + { + self.nextthink = 0; + return; + } + + // turn it on + if (self.delay != 0) + self.nextthink = GameBase.level.time + self.delay; + else + func_timer_think.think(self); + } + }; + /*QUAKED func_conveyor (0 .5 .8) ? START_ON TOGGLE + Conveyors are stationary brushes that move what's on them. + The brush should be have a surface with at least one current content enabled. + speed default 100 + */ + + static EntUseAdapter func_conveyor_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + if ((self.spawnflags & 1) != 0) + { + self.speed = 0; + self.spawnflags &= ~1; + } + else + { + self.speed = self.count; + self.spawnflags |= 1; + } + + if (0 == (self.spawnflags & 2)) + self.count = 0; + } + }; + static EntThinkAdapter SP_func_conveyor = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + if (0 == self.speed) + self.speed = 100; + + if (0 == (self.spawnflags & 1)) + { + self.count = (int) self.speed; + self.speed = 0; + } + + self.use = func_conveyor_use; + + GameBase.gi.setmodel(self, self.model); + self.solid = Defines.SOLID_BSP; + GameBase.gi.linkentity(self); + return true; + } + }; + /*QUAKED func_door_secret (0 .5 .8) ? always_shoot 1st_left 1st_down + A secret door. Slide back and then to the side. + + open_once doors never closes + 1st_left 1st move is left of arrow + 1st_down 1st move is down from arrow + always_shoot door is shootebale even if targeted + + "angle" determines the direction + "dmg" damage to inflic when blocked (default 2) + "wait" how long to hold in the open position (default 5, -1 means hold) + */ + + public final static int SECRET_ALWAYS_SHOOT = 1; + public final static int SECRET_1ST_LEFT = 2; + public final static int SECRET_1ST_DOWN = 4; + static EntUseAdapter door_secret_use = new EntUseAdapter() + { + + public void use(edict_t self, edict_t other, edict_t activator) + { + // make sure we're not already moving + if (0 == Math3D.VectorCompare(self.s.origin, Globals.vec3_origin)) + return; + + GameFunc.Move_Calc(self, self.pos1, door_secret_move1); + GameFunc.door_use_areaportals(self, true); + } + }; + static EntThinkAdapter door_secret_move1 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.nextthink = GameBase.level.time + 1.0f; + self.think = door_secret_move2; + return true; + } + }; + static EntThinkAdapter door_secret_move2 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + GameFunc.Move_Calc(self, self.pos2, door_secret_move3); + return true; + } + }; + static EntThinkAdapter door_secret_move3 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.wait == -1) + return true; + self.nextthink = GameBase.level.time + self.wait; + self.think = door_secret_move4; + return true; + } + }; + static EntThinkAdapter door_secret_move4 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + GameFunc.Move_Calc(self, self.pos1, door_secret_move5); + return true; + } + }; + static EntThinkAdapter door_secret_move5 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.nextthink = GameBase.level.time + 1.0f; + self.think = door_secret_move6; + return true; + } + }; + static EntThinkAdapter door_secret_move6 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + GameFunc.Move_Calc(self, Globals.vec3_origin, door_secret_done); + return true; + } + }; + static EntThinkAdapter door_secret_done = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (null == (self.targetname) || 0 != (self.spawnflags & SECRET_ALWAYS_SHOOT)) + { + self.health = 0; + self.takedamage = Defines.DAMAGE_YES; + } + GameFunc.door_use_areaportals(self, false); + return true; + } + }; + static EntBlockedAdapter door_secret_blocked = new EntBlockedAdapter() + { + + public void blocked(edict_t self, edict_t other) + { + if (0 == (other.svflags & Defines.SVF_MONSTER) && (null == other.client)) + { + // give it a chance to go away on it's own terms (like gibs) + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + 100000, + 1, + 0, + Defines.MOD_CRUSH); + // if it's still there, nuke it + if (other != null) + GameAI.BecomeExplosion1(other); + return; + } + + if (GameBase.level.time < self.touch_debounce_time) + return; + self.touch_debounce_time = GameBase.level.time + 0.5f; + + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + other.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + } + }; + static EntDieAdapter door_secret_die = new EntDieAdapter() + { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + self.takedamage = Defines.DAMAGE_NO; + door_secret_use.use(self, attacker, attacker); + } + }; + static EntThinkAdapter SP_func_door_secret = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 }; + float side; + float width; + float length; + + ent.moveinfo.sound_start = GameBase.gi.soundindex("doors/dr1_strt.wav"); + ent.moveinfo.sound_middle = GameBase.gi.soundindex("doors/dr1_mid.wav"); + ent.moveinfo.sound_end = GameBase.gi.soundindex("doors/dr1_end.wav"); + + ent.movetype = Defines.MOVETYPE_PUSH; + ent.solid = Defines.SOLID_BSP; + GameBase.gi.setmodel(ent, ent.model); + + ent.blocked = door_secret_blocked; + ent.use = door_secret_use; + + if (null == (ent.targetname) || 0 != (ent.spawnflags & SECRET_ALWAYS_SHOOT)) + { + ent.health = 0; + ent.takedamage = Defines.DAMAGE_YES; + ent.die = door_secret_die; + } + + if (0 == ent.dmg) + ent.dmg = 2; + + if (0 == ent.wait) + ent.wait = 5; + + ent.moveinfo.accel = ent.moveinfo.decel = ent.moveinfo.speed = 50; + + // calculate positions + Math3D.AngleVectors(ent.s.angles, forward, right, up); + Math3D.VectorClear(ent.s.angles); + side = 1.0f - (ent.spawnflags & SECRET_1ST_LEFT); + if ((ent.spawnflags & SECRET_1ST_DOWN) != 0) + width = Math.abs(Math3D.DotProduct(up, ent.size)); + else + width = Math.abs(Math3D.DotProduct(right, ent.size)); + length = Math.abs(Math3D.DotProduct(forward, ent.size)); + if ((ent.spawnflags & SECRET_1ST_DOWN) != 0) + Math3D.VectorMA(ent.s.origin, -1 * width, up, ent.pos1); + else + Math3D.VectorMA(ent.s.origin, side * width, right, ent.pos1); + Math3D.VectorMA(ent.pos1, length, forward, ent.pos2); + + if (ent.health != 0) + { + ent.takedamage = Defines.DAMAGE_YES; + ent.die = door_killed; + ent.max_health = ent.health; + } + else if (ent.targetname != null && ent.message != null) + { + GameBase.gi.soundindex("misc/talk.wav"); + ent.touch = door_touch; + } + + ent.classname = "func_door"; + + GameBase.gi.linkentity(ent); + return true; + } + }; + /*QUAKED func_killbox (1 0 0) ? + Kills everything inside when fired, irrespective of protection. + */ + static EntUseAdapter use_killbox = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + GameUtil.KillBox(self); + } + }; + static EntThinkAdapter SP_func_killbox = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + GameBase.gi.setmodel(ent, ent.model); + ent.use = use_killbox; + ent.svflags = Defines.SVF_NOCLIENT; + return true; + } + }; +} diff --git a/src/jake2/game/GameMisc.java b/src/jake2/game/GameMisc.java index a269c15..dbad217 100644 --- a/src/jake2/game/GameMisc.java +++ b/src/jake2/game/GameMisc.java @@ -19,200 +19,48 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 27.12.2003 by RST. -// $Id: GameMisc.java,v 1.1 2004-07-07 19:58:59 hzi Exp $ +// $Id: GameMisc.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -import java.util.Date; +import jake2.client.M; -import jake2.*; -import jake2.client.*; -import jake2.qcommon.*; -import jake2.render.*; -import jake2.server.*; - -public class GameMisc extends GameTrigger { - - /*QUAKED func_group (0 0 0) ? - Used to group brushes together just for editor convenience. - */ - - //===================================================== - - static EntUseAdapter Use_Areaportal = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - ent.count ^= 1; // toggle state - // gi.dprintf ("portalstate: %i = %i\n", ent.style, ent.count); - gi.SetAreaPortalState(ent.style, ent.count!=0); - } - }; - - /*QUAKED func_areaportal (0 0 0) ? - - This is a non-visible object that divides the world into - areas that are seperated when this portal is not activated. - Usually enclosed in the middle of a door. - */ - - static EntThinkAdapter SP_func_areaportal = new EntThinkAdapter() { - public boolean think(edict_t ent) { - ent.use = Use_Areaportal; - ent.count = 0; // always start closed; - return true; - } - }; - - /*QUAKED path_corner (.5 .3 0) (-8 -8 -8) (8 8 8) TELEPORT - Target: next path corner - Pathtarget: gets used when an entity that has - this path_corner targeted touches it - */ - static EntTouchAdapter path_corner_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - float[] v={0,0,0}; - edict_t next; - - if (other.movetarget != self) - return; - - if (other.enemy != null) - return; - - if (self.pathtarget != null) { - String savetarget; - - savetarget = self.target; - self.target = self.pathtarget; - G_UseTargets(self, other); - self.target = savetarget; - } - - if (self.target != null) - next = G_PickTarget(self.target); - else - next = null; - - if ((next != null) && (next.spawnflags & 1) != 0) { - VectorCopy(next.s.origin, v); - v[2] += next.mins[2]; - v[2] -= other.mins[2]; - VectorCopy(v, other.s.origin); - next = G_PickTarget(next.target); - other.s.event = EV_OTHER_TELEPORT; - } - - other.goalentity = other.movetarget = next; - - if (self.wait != 0) { - other.monsterinfo.pausetime = level.time + self.wait; - other.monsterinfo.stand.think(other); - return; - } - - if (other.movetarget == null) { - other.monsterinfo.pausetime = level.time + 100000000; - other.monsterinfo.stand.think(other); - } - else { - VectorSubtract(other.goalentity.s.origin, other.s.origin, v); - other.ideal_yaw = vectoyaw(v); - } - } - }; - - public static void SP_path_corner(edict_t self) { - if (self.targetname == null) { +public class GameMisc extends GameTrigger +{ + public static void SP_path_corner(edict_t self) + { + if (self.targetname == null) + { gi.dprintf("path_corner with no targetname at " + vtos(self.s.origin) + "\n"); G_FreeEdict(self); return; } self.solid = SOLID_TRIGGER; - self.touch = path_corner_touch; + self.touch = GameMiscAdapters.path_corner_touch; VectorSet(self.mins, -8, -8, -8); VectorSet(self.maxs, 8, 8, 8); self.svflags |= SVF_NOCLIENT; gi.linkentity(self); } - /*QUAKED point_combat (0.5 0.3 0) (-8 -8 -8) (8 8 8) Hold - Makes this the target of a monster and it will head here - when first activated before going after the activator. If - hold is selected, it will stay here. - */ - static EntTouchAdapter point_combat_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - edict_t activator; - - if (other.movetarget != self) - return; - - if (self.target != null) { - other.target = self.target; - other.goalentity = other.movetarget = G_PickTarget(other.target); - if (null == other.goalentity) { - gi.dprintf(self.classname + " at " + vtos(self.s.origin) + " target " + self.target + " does not exist\n"); - other.movetarget = self; - } - self.target = null; - } - else if ((self.spawnflags & 1) != 0 && 0 == (other.flags & (FL_SWIM | FL_FLY))) { - other.monsterinfo.pausetime = level.time + 100000000; - other.monsterinfo.aiflags |= AI_STAND_GROUND; - other.monsterinfo.stand.think(other); - } - - if (other.movetarget == self) { - other.target = null; - other.movetarget = null; - other.goalentity = other.enemy; - other.monsterinfo.aiflags &= ~AI_COMBAT_POINT; - } - - if (self.pathtarget != null) { - String savetarget; - - savetarget = self.target; - self.target = self.pathtarget; - if (other.enemy != null && other.enemy.client != null) - activator = other.enemy; - else if (other.oldenemy != null && other.oldenemy.client != null) - activator = other.oldenemy; - else if (other.activator != null && other.activator.client != null) - activator = other.activator; - else - activator = other; - G_UseTargets(self, activator); - self.target = savetarget; - } - } - }; - - public static void SP_point_combat(edict_t self) { - if (deathmatch.value != 0) { + public static void SP_point_combat(edict_t self) + { + if (deathmatch.value != 0) + { G_FreeEdict(self); return; } self.solid = SOLID_TRIGGER; - self.touch = point_combat_touch; + self.touch = GameMiscAdapters.point_combat_touch; VectorSet(self.mins, -8, -8, -16); VectorSet(self.maxs, 8, 8, 16); self.svflags = SVF_NOCLIENT; gi.linkentity(self); }; - /*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8) - Just for the debugging level. Don't use - */ - public static EntThinkAdapter TH_viewthing = new EntThinkAdapter() { - public boolean think(edict_t ent) { - ent.s.frame = (ent.s.frame + 1) % 7; - ent.nextthink = level.time + FRAMETIME; - return true; - } - }; - - public static void SP_viewthing(edict_t ent) { + public static void SP_viewthing(edict_t ent) + { gi.dprintf("viewthing spawned\n"); ent.movetype = MOVETYPE_NONE; @@ -223,98 +71,48 @@ public class GameMisc extends GameTrigger { ent.s.modelindex = gi.modelindex("models/objects/banner/tris.md2"); gi.linkentity(ent); ent.nextthink = level.time + 0.5f; - ent.think = TH_viewthing; + ent.think = GameMiscAdapters.TH_viewthing; return; } /*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) Used as a positional target for spotlights, etc. */ - public static void SP_info_null(edict_t self) { + public static void SP_info_null(edict_t self) + { G_FreeEdict(self); }; /*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) Used as a positional target for lightning. */ - public static void SP_info_notnull(edict_t self) { + public static void SP_info_notnull(edict_t self) + { VectorCopy(self.s.origin, self.absmin); VectorCopy(self.s.origin, self.absmax); }; - /*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF - Non-displayed light. - Default light value is 300. - Default style is 0. - If targeted, will toggle between on and off. - Default _cone value is 10 (used to set size of light for spotlights) - */ - - public static final int START_OFF = 1; - - static EntUseAdapter light_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - if ((self.spawnflags & START_OFF) != 0) { - gi.configstring(CS_LIGHTS + self.style, "m"); - self.spawnflags &= ~START_OFF; - } - else { - gi.configstring(CS_LIGHTS + self.style, "a"); - self.spawnflags |= START_OFF; - } - } - }; - - public static void SP_light(edict_t self) { + public static void SP_light(edict_t self) + { // no targeted lights in deathmatch, because they cause global messages - if (null == self.targetname || deathmatch.value != 0) { + if (null == self.targetname || deathmatch.value != 0) + { G_FreeEdict(self); return; } - if (self.style >= 32) { - self.use = light_use; - if ((self.spawnflags & START_OFF) != 0) + if (self.style >= 32) + { + self.use = GameMiscAdapters.light_use; + if ((self.spawnflags & GameMiscAdapters.START_OFF) != 0) gi.configstring(CS_LIGHTS + self.style, "a"); else gi.configstring(CS_LIGHTS + self.style, "m"); } } - /*QUAKED func_wall (0 .5 .8) ? TRIGGER_SPAWN TOGGLE START_ON ANIMATED ANIMATED_FAST - This is just a solid wall if not inhibited - - TRIGGER_SPAWN the wall will not be present until triggered - it will then blink in to existance; it will - kill anything that was in it's way - - TOGGLE only valid for TRIGGER_SPAWN walls - this allows the wall to be turned on and off - - START_ON only valid for TRIGGER_SPAWN walls - the wall will initially be present - */ - - static EntUseAdapter func_wall_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - if (self.solid == SOLID_NOT) { - self.solid = SOLID_BSP; - self.svflags &= ~SVF_NOCLIENT; - KillBox(self); - } - else { - self.solid = SOLID_NOT; - self.svflags |= SVF_NOCLIENT; - } - gi.linkentity(self); - - if (0 == (self.spawnflags & 2)) - self.use = null; - } - }; - - public static void SP_func_wall(edict_t self) { + public static void SP_func_wall(edict_t self) + { self.movetype = MOVETYPE_PUSH; gi.setmodel(self, self.model); @@ -324,72 +122,45 @@ public class GameMisc extends GameTrigger { self.s.effects |= EF_ANIM_ALLFAST; // just a wall - if ((self.spawnflags & 7) == 0) { + if ((self.spawnflags & 7) == 0) + { self.solid = SOLID_BSP; gi.linkentity(self); return; } // it must be TRIGGER_SPAWN - if (0 == (self.spawnflags & 1)) { + if (0 == (self.spawnflags & 1)) + { // gi.dprintf("func_wall missing TRIGGER_SPAWN\n"); self.spawnflags |= 1; } // yell if the spawnflags are odd - if ((self.spawnflags & 4) != 0) { - if (0 == (self.spawnflags & 2)) { + if ((self.spawnflags & 4) != 0) + { + if (0 == (self.spawnflags & 2)) + { gi.dprintf("func_wall START_ON without TOGGLE\n"); self.spawnflags |= 2; } } - self.use = func_wall_use; - if ((self.spawnflags & 4) != 0) { + self.use = GameMiscAdapters.func_wall_use; + if ((self.spawnflags & 4) != 0) + { self.solid = SOLID_BSP; } - else { + else + { self.solid = SOLID_NOT; self.svflags |= SVF_NOCLIENT; } gi.linkentity(self); } - /*QUAKED func_object (0 .5 .8) ? TRIGGER_SPAWN ANIMATED ANIMATED_FAST - This is solid bmodel that will fall if it's support it removed. - */ - static EntTouchAdapter func_object_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - // only squash thing we fall on top of - if (plane == null) - return; - if (plane.normal[2] < 1.0) - return; - if (other.takedamage == DAMAGE_NO) - return; - T_Damage(other, self, self, vec3_origin, self.s.origin, vec3_origin, self.dmg, 1, 0, MOD_CRUSH); - } - }; - - static EntThinkAdapter func_object_release = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.movetype = MOVETYPE_TOSS; - self.touch = func_object_touch; - return true; - } - }; - - static EntUseAdapter func_object_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.solid = SOLID_BSP; - self.svflags &= ~SVF_NOCLIENT; - self.use = null; - KillBox(self); - func_object_release.think(self); - } - }; - - public static void SP_func_object(edict_t self) { + public static void SP_func_object(edict_t self) + { gi.setmodel(self, self.model); self.mins[0] += 1; @@ -402,16 +173,18 @@ public class GameMisc extends GameTrigger { if (self.dmg == 0) self.dmg = 100; - if (self.spawnflags == 0) { + if (self.spawnflags == 0) + { self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; - self.think = func_object_release; + self.think = GameMiscAdapters.func_object_release; self.nextthink = level.time + 2 * FRAMETIME; } - else { + else + { self.solid = SOLID_NOT; self.movetype = MOVETYPE_PUSH; - self.use = func_object_use; + self.use = GameMiscAdapters.func_object_use; self.svflags |= SVF_NOCLIENT; } @@ -425,101 +198,10 @@ public class GameMisc extends GameTrigger { gi.linkentity(self); } - /*QUAKED func_explosive (0 .5 .8) ? Trigger_Spawn ANIMATED ANIMATED_FAST - Any brush that you want to explode or break apart. If you want an - ex0plosion, set dmg and it will do a radius explosion of that amount - at the center of the bursh. - - If targeted it will not be shootable. - - health defaults to 100. - - mass defaults to 75. This determines how much debris is emitted when - it explodes. You get one large chunk per 100 of mass (up to 8) and - one small chunk per 25 of mass (up to 16). So 800 gives the most. - */ - static EntDieAdapter func_explosive_explode = new EntDieAdapter() { - - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - float[] origin={0,0,0}; - float[] chunkorigin={0,0,0}; - float[] size={0,0,0}; - int count; - int mass; - - // bmodel origins are (0 0 0), we need to adjust that here - VectorScale(self.size, 0.5f, size); - VectorAdd(self.absmin, size, origin); - VectorCopy(origin, self.s.origin); - - self.takedamage = DAMAGE_NO; - - if (self.dmg != 0) - T_RadiusDamage(self, attacker, self.dmg, null, self.dmg + 40, MOD_EXPLOSIVE); - - VectorSubtract(self.s.origin, inflictor.s.origin, self.velocity); - VectorNormalize(self.velocity); - VectorScale(self.velocity, 150, self.velocity); - - // start chunks towards the center - VectorScale(size, 0.5f, size); - - mass = self.mass; - if (0 == mass) - mass = 75; - - // big chunks - if (mass >= 100) { - count = mass / 100; - if (count > 8) - count = 8; - while (count-- != 0) { - chunkorigin[0] = origin[0] + crandom() * size[0]; - chunkorigin[1] = origin[1] + crandom() * size[1]; - chunkorigin[2] = origin[2] + crandom() * size[2]; - ThrowDebris(self, "models/objects/debris1/tris.md2", 1, chunkorigin); - } - } - - // small chunks - count = mass / 25; - if (count > 16) - count = 16; - while (count-- != 0) { - chunkorigin[0] = origin[0] + crandom() * size[0]; - chunkorigin[1] = origin[1] + crandom() * size[1]; - chunkorigin[2] = origin[2] + crandom() * size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin); - } - - G_UseTargets(self, attacker); - - if (self.dmg != 0) - BecomeExplosion1(self); - else - G_FreeEdict(self); - } - }; - - static EntUseAdapter func_explosive_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - func_explosive_explode.die(self, self, other, self.health, vec3_origin); - } - }; - - static EntUseAdapter func_explosive_spawn = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - self.solid = SOLID_BSP; - self.svflags &= ~SVF_NOCLIENT; - self.use = null; - KillBox(self); - gi.linkentity(self); - } - }; - - public static void SP_func_explosive(edict_t self) { - if (deathmatch.value != 0) { // auto-remove for deathmatch + public static void SP_func_explosive(edict_t self) + { + if (deathmatch.value != 0) + { // auto-remove for deathmatch G_FreeEdict(self); return; } @@ -531,15 +213,17 @@ public class GameMisc extends GameTrigger { gi.setmodel(self, self.model); - if ((self.spawnflags & 1) != 0) { + if ((self.spawnflags & 1) != 0) + { self.svflags |= SVF_NOCLIENT; self.solid = SOLID_NOT; - self.use = func_explosive_spawn; + self.use = GameMiscAdapters.func_explosive_spawn; } - else { + else + { self.solid = SOLID_BSP; if (self.targetname != null) - self.use = func_explosive_use; + self.use = GameMiscAdapters.func_explosive_use; } if ((self.spawnflags & 2) != 0) @@ -547,131 +231,21 @@ public class GameMisc extends GameTrigger { if ((self.spawnflags & 4) != 0) self.s.effects |= EF_ANIM_ALLFAST; - if (self.use != func_explosive_use) { + if (self.use != GameMiscAdapters.func_explosive_use) + { if (self.health == 0) self.health = 100; - self.die = func_explosive_explode; + self.die = GameMiscAdapters.func_explosive_explode; self.takedamage = DAMAGE_YES; } gi.linkentity(self); } - /*QUAKED misc_explobox (0 .5 .8) (-16 -16 0) (16 16 40) - Large exploding box. You can override its mass (100), - health (80), and dmg (150). - */ - - static EntTouchAdapter barrel_touch = new EntTouchAdapter() { - - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - float ratio; - float[] v={0,0,0}; - - if ((null == other.groundentity) || (other.groundentity == self)) - return; - - ratio = (float) other.mass / (float) self.mass; - VectorSubtract(self.s.origin, other.s.origin, v); - M.M_walkmove(self, vectoyaw(v), 20 * ratio * FRAMETIME); - } - }; - - static EntThinkAdapter barrel_explode = new EntThinkAdapter() { - public boolean think(edict_t self) { - - float[] org={0,0,0}; - float spd; - float[] save={0,0,0}; - - T_RadiusDamage(self, self.activator, self.dmg, null, self.dmg + 40, MOD_BARREL); - - VectorCopy(self.s.origin, save); - VectorMA(self.absmin, 0.5f, self.size, self.s.origin); - - // a few big chunks - spd = 1.5f * (float) self.dmg / 200.0f; - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); - - // bottom corners - spd = 1.75f * (float) self.dmg / 200.0f; - VectorCopy(self.absmin, org); - ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); - VectorCopy(self.absmin, org); - org[0] += self.size[0]; - ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); - VectorCopy(self.absmin, org); - org[1] += self.size[1]; - ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); - VectorCopy(self.absmin, org); - org[0] += self.size[0]; - org[1] += self.size[1]; - ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); - - // a bunch of little chunks - spd = 2 * self.dmg / 200; - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - org[0] = self.s.origin[0] + crandom() * self.size[0]; - org[1] = self.s.origin[1] + crandom() * self.size[1]; - org[2] = self.s.origin[2] + crandom() * self.size[2]; - ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); - - VectorCopy(save, self.s.origin); - if (self.groundentity != null) - BecomeExplosion2(self); - else - BecomeExplosion1(self); - - return true; - } - }; - - static EntDieAdapter barrel_delay = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - - self.takedamage = DAMAGE_NO; - self.nextthink = level.time + 2 * FRAMETIME; - self.think = barrel_explode; - self.activator = attacker; - } - }; - - public static void SP_misc_explobox(edict_t self) { - if (deathmatch.value != 0) { // auto-remove for deathmatch + public static void SP_misc_explobox(edict_t self) + { + if (deathmatch.value != 0) + { // auto-remove for deathmatch G_FreeEdict(self); return; } @@ -695,11 +269,11 @@ public class GameMisc extends GameTrigger { if (0 == self.dmg) self.dmg = 150; - self.die = barrel_delay; + self.die = GameMiscAdapters.barrel_delay; self.takedamage = DAMAGE_YES; self.monsterinfo.aiflags = AI_NOSTEP; - self.touch = barrel_touch; + self.touch = GameMiscAdapters.barrel_touch; self.think = M.M_droptofloor; self.nextthink = level.time + 2 * FRAMETIME; @@ -707,174 +281,68 @@ public class GameMisc extends GameTrigger { gi.linkentity(self); } - // - // miscellaneous specialty items - // - - /*QUAKED misc_blackhole (1 .5 0) (-8 -8 -8) (8 8 8) - */ - - static EntUseAdapter misc_blackhole_use = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - /* - gi.WriteByte (svc_temp_entity); - gi.WriteByte (TE_BOSSTPORT); - gi.WritePosition (ent.s.origin); - gi.multicast (ent.s.origin, MULTICAST_PVS); - */ - G_FreeEdict(ent); - } - }; - - static EntThinkAdapter misc_blackhole_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - if (++self.s.frame < 19) - self.nextthink = level.time + FRAMETIME; - else { - self.s.frame = 0; - self.nextthink = level.time + FRAMETIME; - } - return true; - } - }; - - public static void SP_misc_blackhole(edict_t ent) { + public static void SP_misc_blackhole(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_NOT; VectorSet(ent.mins, -64, -64, 0); VectorSet(ent.maxs, 64, 64, 8); ent.s.modelindex = gi.modelindex("models/objects/black/tris.md2"); ent.s.renderfx = RF_TRANSLUCENT; - ent.use = misc_blackhole_use; - ent.think = misc_blackhole_think; + ent.use = GameMiscAdapters.misc_blackhole_use; + ent.think = GameMiscAdapters.misc_blackhole_think; ent.nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } - /*QUAKED misc_eastertank (1 .5 0) (-32 -32 -16) (32 32 32) - */ - - static EntThinkAdapter misc_eastertank_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (++self.s.frame < 293) - self.nextthink = level.time + FRAMETIME; - else { - self.s.frame = 254; - self.nextthink = level.time + FRAMETIME; - } - return true; - } - }; - - public static void SP_misc_eastertank(edict_t ent) { + public static void SP_misc_eastertank(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; VectorSet(ent.mins, -32, -32, -16); VectorSet(ent.maxs, 32, 32, 32); ent.s.modelindex = gi.modelindex("models/monsters/tank/tris.md2"); ent.s.frame = 254; - ent.think = misc_eastertank_think; + ent.think = GameMiscAdapters.misc_eastertank_think; ent.nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } - /*QUAKED misc_easterchick (1 .5 0) (-32 -32 0) (32 32 32) - */ - - static EntThinkAdapter misc_easterchick_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (++self.s.frame < 247) - self.nextthink = level.time + FRAMETIME; - else { - self.s.frame = 208; - self.nextthink = level.time + FRAMETIME; - } - return true; - } - }; - - public static void SP_misc_easterchick(edict_t ent) { + public static void SP_misc_easterchick(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; VectorSet(ent.mins, -32, -32, 0); VectorSet(ent.maxs, 32, 32, 32); ent.s.modelindex = gi.modelindex("models/monsters/bitch/tris.md2"); ent.s.frame = 208; - ent.think = misc_easterchick_think; + ent.think = GameMiscAdapters.misc_easterchick_think; ent.nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } - /*QUAKED misc_easterchick2 (1 .5 0) (-32 -32 0) (32 32 32) - */ - static EntThinkAdapter misc_easterchick2_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (++self.s.frame < 287) - self.nextthink = level.time + FRAMETIME; - else { - self.s.frame = 248; - self.nextthink = level.time + FRAMETIME; - } - return true; - } - }; - - public static void SP_misc_easterchick2(edict_t ent) { + public static void SP_misc_easterchick2(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; VectorSet(ent.mins, -32, -32, 0); VectorSet(ent.maxs, 32, 32, 32); ent.s.modelindex = gi.modelindex("models/monsters/bitch/tris.md2"); ent.s.frame = 248; - ent.think = misc_easterchick2_think; + ent.think = GameMiscAdapters.misc_easterchick2_think; ent.nextthink = level.time + 2 * FRAMETIME; gi.linkentity(ent); } - /*QUAKED monster_commander_body (1 .5 0) (-32 -32 0) (32 32 48) - Not really a monster, this is the Tank Commander's decapitated body. - There should be a item_commander_head that has this as it's target. - */ - - static EntThinkAdapter commander_body_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (++self.s.frame < 24) - self.nextthink = level.time + FRAMETIME; - else - self.nextthink = 0; - - if (self.s.frame == 22) - gi.sound(self, CHAN_BODY, gi.soundindex("tank/thud.wav"), 1, ATTN_NORM, 0); - return true; - } - }; - - static EntUseAdapter commander_body_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - self.think = commander_body_think; - self.nextthink = level.time + FRAMETIME; - gi.sound(self, CHAN_BODY, gi.soundindex("tank/pain.wav"), 1, ATTN_NORM, 0); - } - }; - - static EntThinkAdapter commander_body_drop = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.movetype = MOVETYPE_TOSS; - self.s.origin[2] += 2; - return true; - } - }; - - public static void SP_monster_commander_body(edict_t self) { + public static void SP_monster_commander_body(edict_t self) + { self.movetype = MOVETYPE_NONE; self.solid = SOLID_BBOX; self.model = "models/monsters/commandr/tris.md2"; self.s.modelindex = gi.modelindex(self.model); VectorSet(self.mins, -32, -32, 0); VectorSet(self.maxs, 32, 32, 48); - self.use = commander_body_use; + self.use = GameMiscAdapters.commander_body_use; self.takedamage = DAMAGE_YES; self.flags = FL_GODMODE; self.s.renderfx |= RF_FRAMELERP; @@ -883,53 +351,26 @@ public class GameMisc extends GameTrigger { gi.soundindex("tank/thud.wav"); gi.soundindex("tank/pain.wav"); - self.think = commander_body_drop; + self.think = GameMiscAdapters.commander_body_drop; self.nextthink = level.time + 5 * FRAMETIME; } - /*QUAKED misc_banner (1 .5 0) (-4 -4 -4) (4 4 4) - The origin is the bottom of the banner. - The banner is 128 tall. - */ - static EntThinkAdapter misc_banner_think = new EntThinkAdapter() { - public boolean think(edict_t ent) { - ent.s.frame = (ent.s.frame + 1) % 16; - ent.nextthink = level.time + FRAMETIME; - return true; - } - }; - - public static void SP_misc_banner(edict_t ent) { + public static void SP_misc_banner(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_NOT; ent.s.modelindex = gi.modelindex("models/objects/banner/tris.md2"); ent.s.frame = rand() % 16; gi.linkentity(ent); - ent.think = misc_banner_think; + ent.think = GameMiscAdapters.misc_banner_think; ent.nextthink = level.time + FRAMETIME; } - /*QUAKED misc_deadsoldier (1 .5 0) (-16 -16 0) (16 16 16) ON_BACK ON_STOMACH BACK_DECAP FETAL_POS SIT_DECAP IMPALED - This is the dead player model. Comes in 6 exciting different poses! - */ - static EntDieAdapter misc_deadsoldier_die = new EntDieAdapter() { - - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - int n; - - if (self.health > -80) - return; - - 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); - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); - } - }; - - public static void SP_misc_deadsoldier(edict_t ent) { - if (deathmatch.value != 0) { // auto-remove for deathmatch + public static void SP_misc_deadsoldier(edict_t ent) + { + if (deathmatch.value != 0) + { // auto-remove for deathmatch G_FreeEdict(ent); return; } @@ -957,30 +398,16 @@ public class GameMisc extends GameTrigger { ent.deadflag = DEAD_DEAD; ent.takedamage = DAMAGE_YES; ent.svflags |= SVF_MONSTER | SVF_DEADMONSTER; - ent.die = misc_deadsoldier_die; + ent.die = GameMiscAdapters.misc_deadsoldier_die; ent.monsterinfo.aiflags |= AI_GOOD_GUY; gi.linkentity(ent); } - /*QUAKED misc_viper (1 .5 0) (-16 -16 0) (16 16 32) - This is the Viper for the flyby bombing. - It is trigger_spawned, so you must have something use it for it to show up. - There must be a path for it to follow once it is activated. - - "speed" How fast the Viper should fly - */ - - static EntUseAdapter misc_viper_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.svflags &= ~SVF_NOCLIENT; - self.use = GameFunc.train_use; - GameFunc.train_use.use(self, other, activator); - } - }; - - public static void SP_misc_viper(edict_t ent) { - if (null == ent.target) { + public static void SP_misc_viper(edict_t ent) + { + if (null == ent.target) + { gi.dprintf("misc_viper without a target at " + vtos(ent.absmin) + "\n"); G_FreeEdict(ent); return; @@ -995,9 +422,9 @@ public class GameMisc extends GameTrigger { VectorSet(ent.mins, -16, -16, 0); VectorSet(ent.maxs, 16, 16, 32); - ent.think = GameFunc.func_train_find; + ent.think = GameFuncAdapters.func_train_find; ent.nextthink = level.time + FRAMETIME; - ent.use = misc_viper_use; + ent.use = GameMiscAdapters.misc_viper_use; ent.svflags |= SVF_NOCLIENT; ent.moveinfo.accel = ent.moveinfo.decel = ent.moveinfo.speed = ent.speed; @@ -1007,7 +434,8 @@ public class GameMisc extends GameTrigger { /*QUAKED misc_bigviper (1 .5 0) (-176 -120 -24) (176 120 72) This is a large stationary viper as seen in Paul's intro */ - public static void SP_misc_bigviper(edict_t ent) { + public static void SP_misc_bigviper(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; VectorSet(ent.mins, -176, -120, -24); @@ -1016,70 +444,8 @@ public class GameMisc extends GameTrigger { gi.linkentity(ent); } - /*QUAKED misc_viper_bomb (1 0 0) (-8 -8 -8) (8 8 8) - "dmg" how much boom should the bomb make? - */ - static EntTouchAdapter misc_viper_bomb_touch = new EntTouchAdapter() { - - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - G_UseTargets(self, self.activator); - - self.s.origin[2] = self.absmin[2] + 1; - T_RadiusDamage(self, self, self.dmg, null, self.dmg + 40, MOD_BOMB); - BecomeExplosion2(self); - } - }; - - static EntThinkAdapter misc_viper_bomb_prethink = new EntThinkAdapter() { - public boolean think(edict_t self) { - - float[] v={0,0,0}; - float diff; - - self.groundentity = null; - - diff = self.timestamp - level.time; - if (diff < -1.0) - diff = -1.0f; - - VectorScale(self.moveinfo.dir, 1.0f + diff, v); - v[2] = diff; - - diff = self.s.angles[2]; - vectoangles(v, self.s.angles); - self.s.angles[2] = diff + 10; - - return true; - } - }; - - static EntUseAdapter misc_viper_bomb_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - edict_t viper=null; - - self.solid = SOLID_BBOX; - self.svflags &= ~SVF_NOCLIENT; - self.s.effects |= EF_ROCKET; - self.use = null; - self.movetype = MOVETYPE_TOSS; - self.prethink = misc_viper_bomb_prethink; - self.touch = misc_viper_bomb_touch; - self.activator = activator; - - EdictIterator es = null; - - es = G_Find(es, findByClass, "misc_viper"); - if (es != null) - viper = es.o; - - VectorScale(viper.moveinfo.dir, viper.moveinfo.speed, self.velocity); - - self.timestamp = level.time; - VectorCopy(viper.moveinfo.dir, self.moveinfo.dir); - } - }; - - public static void SP_misc_viper_bomb(edict_t self) { + public static void SP_misc_viper_bomb(edict_t self) + { self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; VectorSet(self.mins, -8, -8, -8); @@ -1090,30 +456,16 @@ public class GameMisc extends GameTrigger { if (self.dmg == 0) self.dmg = 1000; - self.use = misc_viper_bomb_use; + self.use = GameMiscAdapters.misc_viper_bomb_use; self.svflags |= SVF_NOCLIENT; gi.linkentity(self); } - /*QUAKED misc_strogg_ship (1 .5 0) (-16 -16 0) (16 16 32) - This is a Storgg ship for the flybys. - It is trigger_spawned, so you must have something use it for it to show up. - There must be a path for it to follow once it is activated. - - "speed" How fast it should fly - */ - - static EntUseAdapter misc_strogg_ship_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.svflags &= ~SVF_NOCLIENT; - self.use = GameFunc.train_use; - GameFunc.train_use.use(self, other, activator); - } - }; - - public static void SP_misc_strogg_ship(edict_t ent) { - if (null == ent.target) { + public static void SP_misc_strogg_ship(edict_t ent) + { + if (null == ent.target) + { gi.dprintf(ent.classname + " without a target at " + vtos(ent.absmin) + "\n"); G_FreeEdict(ent); return; @@ -1128,47 +480,30 @@ public class GameMisc extends GameTrigger { VectorSet(ent.mins, -16, -16, 0); VectorSet(ent.maxs, 16, 16, 32); - ent.think = GameFunc.func_train_find; + ent.think = GameFuncAdapters.func_train_find; ent.nextthink = level.time + FRAMETIME; - ent.use = misc_strogg_ship_use; + ent.use = GameMiscAdapters.misc_strogg_ship_use; ent.svflags |= SVF_NOCLIENT; ent.moveinfo.accel = ent.moveinfo.decel = ent.moveinfo.speed = ent.speed; gi.linkentity(ent); } - /*QUAKED misc_satellite_dish (1 .5 0) (-64 -64 0) (64 64 128) - */ - static EntThinkAdapter misc_satellite_dish_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.s.frame++; - if (self.s.frame < 38) - self.nextthink = level.time + FRAMETIME; - return true; - } - }; - - static EntUseAdapter misc_satellite_dish_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.s.frame = 0; - self.think = misc_satellite_dish_think; - self.nextthink = level.time + FRAMETIME; - } - }; - - public static void SP_misc_satellite_dish(edict_t ent) { + public static void SP_misc_satellite_dish(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; VectorSet(ent.mins, -64, -64, 0); VectorSet(ent.maxs, 64, 64, 128); ent.s.modelindex = gi.modelindex("models/objects/satellite/tris.md2"); - ent.use = misc_satellite_dish_use; + ent.use = GameMiscAdapters.misc_satellite_dish_use; gi.linkentity(ent); } /*QUAKED light_mine1 (0 1 0) (-2 -2 -12) (2 2 12) */ - public static void SP_light_mine1(edict_t ent) { + public static void SP_light_mine1(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; ent.s.modelindex = gi.modelindex("models/objects/minelite/light1/tris.md2"); @@ -1177,7 +512,8 @@ public class GameMisc extends GameTrigger { /*QUAKED light_mine2 (0 1 0) (-2 -2 -12) (2 2 12) */ - public static void SP_light_mine2(edict_t ent) { + public static void SP_light_mine2(edict_t ent) + { ent.movetype = MOVETYPE_NONE; ent.solid = SOLID_BBOX; ent.s.modelindex = gi.modelindex("models/objects/minelite/light2/tris.md2"); @@ -1187,19 +523,20 @@ public class GameMisc extends GameTrigger { /*QUAKED misc_gib_arm (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the target_spawner */ - public static void SP_misc_gib_arm(edict_t ent) { + public static void SP_misc_gib_arm(edict_t ent) + { gi.setmodel(ent, "models/objects/gibs/arm/tris.md2"); ent.solid = SOLID_NOT; ent.s.effects |= EF_GIB; ent.takedamage = DAMAGE_YES; - ent.die = gib_die; + ent.die = GameAIAdapters.gib_die; ent.movetype = MOVETYPE_TOSS; ent.svflags |= SVF_MONSTER; ent.deadflag = DEAD_DEAD; ent.avelocity[0] = random() * 200; ent.avelocity[1] = random() * 200; ent.avelocity[2] = random() * 200; - ent.think = G_FreeEdictA; + ent.think = GameUtilAdapters.G_FreeEdictA; ent.nextthink = level.time + 30; gi.linkentity(ent); } @@ -1207,19 +544,20 @@ public class GameMisc extends GameTrigger { /*QUAKED misc_gib_leg (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the target_spawner */ - public static void SP_misc_gib_leg(edict_t ent) { + public static void SP_misc_gib_leg(edict_t ent) + { gi.setmodel(ent, "models/objects/gibs/leg/tris.md2"); ent.solid = SOLID_NOT; ent.s.effects |= EF_GIB; ent.takedamage = DAMAGE_YES; - ent.die = gib_die; + ent.die = GameAIAdapters.gib_die; ent.movetype = MOVETYPE_TOSS; ent.svflags |= SVF_MONSTER; ent.deadflag = DEAD_DEAD; ent.avelocity[0] = random() * 200; ent.avelocity[1] = random() * 200; ent.avelocity[2] = random() * 200; - ent.think = G_FreeEdictA; + ent.think = GameUtilAdapters.G_FreeEdictA; ent.nextthink = level.time + 30; gi.linkentity(ent); } @@ -1227,19 +565,20 @@ public class GameMisc extends GameTrigger { /*QUAKED misc_gib_head (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the target_spawner */ - public static void SP_misc_gib_head(edict_t ent) { + public static void SP_misc_gib_head(edict_t ent) + { gi.setmodel(ent, "models/objects/gibs/head/tris.md2"); ent.solid = SOLID_NOT; ent.s.effects |= EF_GIB; ent.takedamage = DAMAGE_YES; - ent.die = gib_die; + ent.die = GameAIAdapters.gib_die; ent.movetype = MOVETYPE_TOSS; ent.svflags |= SVF_MONSTER; ent.deadflag = DEAD_DEAD; ent.avelocity[0] = random() * 200; ent.avelocity[1] = random() * 200; ent.avelocity[2] = random() * 200; - ent.think = G_FreeEdictA; + ent.think = GameUtilAdapters.G_FreeEdictA; ent.nextthink = level.time + 30; gi.linkentity(ent); } @@ -1251,7 +590,8 @@ public class GameMisc extends GameTrigger { "count" is position in the string (starts at 1) */ - public static void SP_target_character(edict_t self) { + public static void SP_target_character(edict_t self) + { self.movetype = MOVETYPE_PUSH; gi.setmodel(self, self.model); self.solid = SOLID_BSP; @@ -1260,82 +600,42 @@ public class GameMisc extends GameTrigger { return; } - /*QUAKED target_string (0 0 1) (-8 -8 -8) (8 8 8) - */ - - static EntUseAdapter target_string_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - edict_t e; - int n, l; - char c; - - l = strlen(self.message); - for (e = self.teammaster; e != null; e = e.teamchain) { - if (e.count == 0) - continue; - n = e.count - 1; - if (n > l) { - e.s.frame = 12; - continue; - } - - c = self.message.charAt(n); - if (c >= '0' && c <= '9') - e.s.frame = c - '0'; - else if (c == '-') - e.s.frame = 10; - else if (c == ':') - e.s.frame = 11; - else - e.s.frame = 12; - } - } - }; - - public static void SP_target_string(edict_t self) { + public static void SP_target_string(edict_t self) + { if (self.message == null) self.message = ""; - self.use = target_string_use; + self.use = GameMiscAdapters.target_string_use; } - /*QUAKED func_clock (0 0 1) (-8 -8 -8) (8 8 8) TIMER_UP TIMER_DOWN START_OFF MULTI_USE - target a target_string with this - - The default is to be a time of day clock - - TIMER_UP and TIMER_DOWN run for "count" seconds and the fire "pathtarget" - If START_OFF, this entity must be used before it starts - - "style" 0 "xx" - 1 "xx:xx" - 2 "xx:xx:xx" - */ - - public static final int CLOCK_MESSAGE_SIZE = 16; - // don't let field width of any clock messages change, or it // could cause an overwrite after a game load - public static void func_clock_reset(edict_t self) { + public static void func_clock_reset(edict_t self) + { self.activator = null; - if ((self.spawnflags & 1) != 0) { + if ((self.spawnflags & 1) != 0) + { self.health = 0; self.wait = self.count; } - else if ((self.spawnflags & 2) != 0) { + else if ((self.spawnflags & 2) != 0) + { self.health = self.count; self.wait = 0; } } - public static void func_clock_format_countdown(edict_t self) { - if (self.style == 0) { + public static void func_clock_format_countdown(edict_t self) + { + if (self.style == 0) + { self.message = "" + self.health; //Com_sprintf(self.message, CLOCK_MESSAGE_SIZE, "%2i", self.health); return; } - if (self.style == 1) { + if (self.style == 1) + { self.message = "" + self.health / 60 + ":" + self.health % 60; //Com_sprintf(self.message, CLOCK_MESSAGE_SIZE, "%2i:%2i", self.health / 60, self.health % 60); /* @@ -1345,7 +645,8 @@ public class GameMisc extends GameTrigger { return; } - if (self.style == 2) { + if (self.style == 2) + { self.message = "" + self.health / 3600 + ":" + (self.health - (self.health / 3600) * 3600) / 60 + ":" + self.health % 60; /* Com_sprintf( @@ -1364,99 +665,17 @@ public class GameMisc extends GameTrigger { } } - public static EntThinkAdapter func_clock_think = new EntThinkAdapter() { - - public boolean think(edict_t self) { - if (null == self.enemy) { - - EdictIterator es = null; - - es = G_Find(es, findByTarget, self.target); - if (es != null) - self.enemy = es.o; - if (self.enemy == null) - return true; - } - - if ((self.spawnflags & 1) != 0) { - func_clock_format_countdown(self); - self.health++; - } - else if ((self.spawnflags & 2) != 0) { - func_clock_format_countdown(self); - self.health--; - } - else { - Date d = new Date(); - self.message = "" + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); - - /* - struct tm * ltime; - time_t gmtime; - - time(& gmtime); - ltime = localtime(& gmtime); - Com_sprintf(self.message, CLOCK_MESSAGE_SIZE, "%2i:%2i:%2i", ltime.tm_hour, ltime.tm_min, ltime.tm_sec); - if (self.message[3] == ' ') - self.message[3] = '0'; - if (self.message[6] == ' ') - self.message[6] = '0'; - */ - } - - self.enemy.message = self.message; - self.enemy.use.use(self.enemy, self, self); - - if (((self.spawnflags & 1) != 0 && (self.health > self.wait)) - || ((self.spawnflags & 2) != 0 && (self.health < self.wait))) { - if (self.pathtarget != null) { - String savetarget; - String savemessage; - - savetarget = self.target; - savemessage = self.message; - self.target = self.pathtarget; - self.message = null; - G_UseTargets(self, self.activator); - self.target = savetarget; - self.message = savemessage; - } - - if (0 == (self.spawnflags & 8)) - return true; - - func_clock_reset(self); - - if ((self.spawnflags & 4) != 0) - return true; - } - - self.nextthink = level.time + 1; - return true; - - } - }; - - static EntUseAdapter func_clock_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - if (0 == (self.spawnflags & 8)) - self.use = null; - if (self.activator!=null) - return; - self.activator = activator; - self.think.think(self); - } - }; - - public static void SP_func_clock(edict_t self) { - if (self.target == null) { + public static void SP_func_clock(edict_t self) + { + if (self.target == null) + { gi.dprintf(self.classname + " with no target at " + vtos(self.s.origin) + "\n"); G_FreeEdict(self); return; } - if ((self.spawnflags & 2) != 0 && (0 == self.count)) { + if ((self.spawnflags & 2) != 0 && (0 == self.count)) + { gi.dprintf(self.classname + " with no count at " + vtos(self.s.origin) + "\n"); G_FreeEdict(self); return; @@ -1470,71 +689,23 @@ public class GameMisc extends GameTrigger { //self.message = gi.TagMalloc(CLOCK_MESSAGE_SIZE, TAG_LEVEL); self.message = new String(); - self.think = func_clock_think; + self.think = GameMiscAdapters.func_clock_think; if ((self.spawnflags & 4) != 0) - self.use = func_clock_use; + self.use = GameMiscAdapters.func_clock_use; else self.nextthink = level.time + 1; } - //================================================================================= - - static EntTouchAdapter teleporter_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - edict_t dest; - int i; - - if (other.client ==null) - return; - - EdictIterator es =null; - dest = G_Find(null, findByTarget, self.target).o; - - if (dest==null) { - gi.dprintf("Couldn't find destination\n"); - return; - } - - // unlink to make sure it can't possibly interfere with KillBox - gi.unlinkentity(other); - - VectorCopy(dest.s.origin, other.s.origin); - VectorCopy(dest.s.origin, other.s.old_origin); - other.s.origin[2] += 10; - - // clear the velocity and hold them in place briefly - VectorClear(other.velocity); - other.client.ps.pmove.pm_time = 160 >> 3; // hold time - other.client.ps.pmove.pm_flags |= PMF_TIME_TELEPORT; - - // draw the teleport splash at source and on the player - self.owner.s.event = EV_PLAYER_TELEPORT; - other.s.event = EV_PLAYER_TELEPORT; - - // set angles - for (i = 0; i < 3; i++) { - other.client.ps.pmove.delta_angles[i] = (short) ANGLE2SHORT(dest.s.angles[i] - other.client.resp.cmd_angles[i]); - } - - VectorClear(other.s.angles); - VectorClear(other.client.ps.viewangles); - VectorClear(other.client.v_angle); - - // kill anything at the destination - KillBox(other); - - gi.linkentity(other); - } - }; - /*QUAKED misc_teleporter (1 0 0) (-32 -32 -24) (32 32 -16) Stepping onto this disc will teleport players to the targeted misc_teleporter_dest object. */ - public static void SP_misc_teleporter(edict_t ent) { + public static void SP_misc_teleporter(edict_t ent) + { edict_t trig; - if (ent.target==null) { + if (ent.target == null) + { gi.dprintf("teleporter without a target.\n"); G_FreeEdict(ent); return; @@ -1551,7 +722,7 @@ public class GameMisc extends GameTrigger { gi.linkentity(ent); trig = G_Spawn(); - trig.touch = teleporter_touch; + trig.touch = GameMiscAdapters.teleporter_touch; trig.solid = SOLID_TRIGGER; trig.target = ent.target; trig.owner = ent; @@ -1559,25 +730,5 @@ public class GameMisc extends GameTrigger { VectorSet(trig.mins, -8, -8, 8); VectorSet(trig.maxs, 8, 8, 24); gi.linkentity(trig); - } - - /*QUAKED misc_teleporter_dest (1 0 0) (-32 -32 -24) (32 32 -16) - Point teleporters at these. - */ - - public static EntThinkAdapter SP_misc_teleporter_dest = new EntThinkAdapter() { - public boolean think(edict_t ent) { - - gi.setmodel(ent, "models/objects/dmspot/tris.md2"); - ent.s.skinnum = 0; - ent.solid = SOLID_BBOX; - // ent.s.effects |= EF_FLIES; - VectorSet(ent.mins, -32, -32, -24); - VectorSet(ent.maxs, 32, 32, -16); - gi.linkentity(ent); - return true; - } - }; - } diff --git a/src/jake2/game/GameMiscAdapters.java b/src/jake2/game/GameMiscAdapters.java new file mode 100644 index 0000000..c4322d3 --- /dev/null +++ b/src/jake2/game/GameMiscAdapters.java @@ -0,0 +1,1016 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameMiscAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.Defines; +import jake2.Globals; +import jake2.client.M; +import jake2.util.Lib; +import jake2.util.Math3D; + +import java.util.Date; + +public class GameMiscAdapters +{ + + /*QUAKED func_group (0 0 0) ? + Used to group brushes together just for editor convenience. + */ + + //===================================================== + + public static EntUseAdapter Use_Areaportal = new EntUseAdapter() + { + public void use(edict_t ent, edict_t other, edict_t activator) + { + ent.count ^= 1; // toggle state + // gi.dprintf ("portalstate: %i = %i\n", ent.style, ent.count); + GameBase.gi.SetAreaPortalState(ent.style, ent.count != 0); + } + }; + /*QUAKED func_areaportal (0 0 0) ? + + This is a non-visible object that divides the world into + areas that are seperated when this portal is not activated. + Usually enclosed in the middle of a door. + */ + + static EntThinkAdapter SP_func_areaportal = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + ent.use = Use_Areaportal; + ent.count = 0; // always start closed; + return true; + } + }; + /*QUAKED path_corner (.5 .3 0) (-8 -8 -8) (8 8 8) TELEPORT + Target: next path corner + Pathtarget: gets used when an entity that has + this path_corner targeted touches it + */ + public static EntTouchAdapter path_corner_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + float[] v = { 0, 0, 0 }; + edict_t next; + + if (other.movetarget != self) + return; + + if (other.enemy != null) + return; + + if (self.pathtarget != null) + { + String savetarget; + + savetarget = self.target; + self.target = self.pathtarget; + GameUtil.G_UseTargets(self, other); + self.target = savetarget; + } + + if (self.target != null) + next = GameBase.G_PickTarget(self.target); + else + next = null; + + if ((next != null) && (next.spawnflags & 1) != 0) + { + Math3D.VectorCopy(next.s.origin, v); + v[2] += next.mins[2]; + v[2] -= other.mins[2]; + Math3D.VectorCopy(v, other.s.origin); + next = GameBase.G_PickTarget(next.target); + other.s.event = Defines.EV_OTHER_TELEPORT; + } + + other.goalentity = other.movetarget = next; + + if (self.wait != 0) + { + other.monsterinfo.pausetime = GameBase.level.time + self.wait; + other.monsterinfo.stand.think(other); + return; + } + + if (other.movetarget == null) + { + other.monsterinfo.pausetime = GameBase.level.time + 100000000; + other.monsterinfo.stand.think(other); + } + else + { + Math3D.VectorSubtract(other.goalentity.s.origin, other.s.origin, v); + other.ideal_yaw = Math3D.vectoyaw(v); + } + } + }; + /*QUAKED point_combat (0.5 0.3 0) (-8 -8 -8) (8 8 8) Hold + Makes this the target of a monster and it will head here + when first activated before going after the activator. If + hold is selected, it will stay here. + */ + public static EntTouchAdapter point_combat_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + edict_t activator; + + if (other.movetarget != self) + return; + + if (self.target != null) + { + other.target = self.target; + other.goalentity = other.movetarget = GameBase.G_PickTarget(other.target); + if (null == other.goalentity) + { + GameBase.gi.dprintf( + self.classname + " at " + Lib.vtos(self.s.origin) + " target " + self.target + " does not exist\n"); + other.movetarget = self; + } + self.target = null; + } + else if ((self.spawnflags & 1) != 0 && 0 == (other.flags & (Defines.FL_SWIM | Defines.FL_FLY))) + { + other.monsterinfo.pausetime = GameBase.level.time + 100000000; + other.monsterinfo.aiflags |= Defines.AI_STAND_GROUND; + other.monsterinfo.stand.think(other); + } + + if (other.movetarget == self) + { + other.target = null; + other.movetarget = null; + other.goalentity = other.enemy; + other.monsterinfo.aiflags &= ~Defines.AI_COMBAT_POINT; + } + + if (self.pathtarget != null) + { + String savetarget; + + savetarget = self.target; + self.target = self.pathtarget; + if (other.enemy != null && other.enemy.client != null) + activator = other.enemy; + else if (other.oldenemy != null && other.oldenemy.client != null) + activator = other.oldenemy; + else if (other.activator != null && other.activator.client != null) + activator = other.activator; + else + activator = other; + GameUtil.G_UseTargets(self, activator); + self.target = savetarget; + } + } + }; + /*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8) + Just for the debugging level. Don't use + */ + public static EntThinkAdapter TH_viewthing = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + ent.s.frame = (ent.s.frame + 1) % 7; + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + /*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF + Non-displayed light. + Default light value is 300. + Default style is 0. + If targeted, will toggle between on and off. + Default _cone value is 10 (used to set size of light for spotlights) + */ + + public static final int START_OFF = 1; + public static EntUseAdapter light_use = new EntUseAdapter() + { + + public void use(edict_t self, edict_t other, edict_t activator) + { + if ((self.spawnflags & START_OFF) != 0) + { + GameBase.gi.configstring(Defines.CS_LIGHTS + self.style, "m"); + self.spawnflags &= ~START_OFF; + } + else + { + GameBase.gi.configstring(Defines.CS_LIGHTS + self.style, "a"); + self.spawnflags |= START_OFF; + } + } + }; + /*QUAKED func_wall (0 .5 .8) ? TRIGGER_SPAWN TOGGLE START_ON ANIMATED ANIMATED_FAST + This is just a solid wall if not inhibited + + TRIGGER_SPAWN the wall will not be present until triggered + it will then blink in to existance; it will + kill anything that was in it's way + + TOGGLE only valid for TRIGGER_SPAWN walls + this allows the wall to be turned on and off + + START_ON only valid for TRIGGER_SPAWN walls + the wall will initially be present + */ + + static EntUseAdapter func_wall_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + if (self.solid == Defines.SOLID_NOT) + { + self.solid = Defines.SOLID_BSP; + self.svflags &= ~Defines.SVF_NOCLIENT; + GameUtil.KillBox(self); + } + else + { + self.solid = Defines.SOLID_NOT; + self.svflags |= Defines.SVF_NOCLIENT; + } + GameBase.gi.linkentity(self); + + if (0 == (self.spawnflags & 2)) + self.use = null; + } + }; + /*QUAKED func_object (0 .5 .8) ? TRIGGER_SPAWN ANIMATED ANIMATED_FAST + This is solid bmodel that will fall if it's support it removed. + */ + static EntTouchAdapter func_object_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + // only squash thing we fall on top of + if (plane == null) + return; + if (plane.normal[2] < 1.0) + return; + if (other.takedamage == Defines.DAMAGE_NO) + return; + GameUtil.T_Damage( + other, + self, + self, + Globals.vec3_origin, + self.s.origin, + Globals.vec3_origin, + self.dmg, + 1, + 0, + Defines.MOD_CRUSH); + } + }; + static EntThinkAdapter func_object_release = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.movetype = Defines.MOVETYPE_TOSS; + self.touch = func_object_touch; + return true; + } + }; + static EntUseAdapter func_object_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.solid = Defines.SOLID_BSP; + self.svflags &= ~Defines.SVF_NOCLIENT; + self.use = null; + GameUtil.KillBox(self); + func_object_release.think(self); + } + }; + /*QUAKED func_explosive (0 .5 .8) ? Trigger_Spawn ANIMATED ANIMATED_FAST + Any brush that you want to explode or break apart. If you want an + ex0plosion, set dmg and it will do a radius explosion of that amount + at the center of the bursh. + + If targeted it will not be shootable. + + health defaults to 100. + + mass defaults to 75. This determines how much debris is emitted when + it explodes. You get one large chunk per 100 of mass (up to 8) and + one small chunk per 25 of mass (up to 16). So 800 gives the most. + */ + public static EntDieAdapter func_explosive_explode = new EntDieAdapter() + { + + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + float[] origin = { 0, 0, 0 }; + float[] chunkorigin = { 0, 0, 0 }; + float[] size = { 0, 0, 0 }; + int count; + int mass; + + // bmodel origins are (0 0 0), we need to adjust that here + Math3D.VectorScale(self.size, 0.5f, size); + Math3D.VectorAdd(self.absmin, size, origin); + Math3D.VectorCopy(origin, self.s.origin); + + self.takedamage = Defines.DAMAGE_NO; + + if (self.dmg != 0) + GameUtil.T_RadiusDamage(self, attacker, self.dmg, null, self.dmg + 40, Defines.MOD_EXPLOSIVE); + + Math3D.VectorSubtract(self.s.origin, inflictor.s.origin, self.velocity); + Math3D.VectorNormalize(self.velocity); + Math3D.VectorScale(self.velocity, 150, self.velocity); + + // start chunks towards the center + Math3D.VectorScale(size, 0.5f, size); + + mass = self.mass; + if (0 == mass) + mass = 75; + + // big chunks + if (mass >= 100) + { + count = mass / 100; + if (count > 8) + count = 8; + while (count-- != 0) + { + chunkorigin[0] = origin[0] + Lib.crandom() * size[0]; + chunkorigin[1] = origin[1] + Lib.crandom() * size[1]; + chunkorigin[2] = origin[2] + Lib.crandom() * size[2]; + GameAI.ThrowDebris(self, "models/objects/debris1/tris.md2", 1, chunkorigin); + } + } + + // small chunks + count = mass / 25; + if (count > 16) + count = 16; + while (count-- != 0) + { + chunkorigin[0] = origin[0] + Lib.crandom() * size[0]; + chunkorigin[1] = origin[1] + Lib.crandom() * size[1]; + chunkorigin[2] = origin[2] + Lib.crandom() * size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin); + } + + GameUtil.G_UseTargets(self, attacker); + + if (self.dmg != 0) + GameAI.BecomeExplosion1(self); + else + GameUtil.G_FreeEdict(self); + } + }; + public static EntUseAdapter func_explosive_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + func_explosive_explode.die(self, self, other, self.health, Globals.vec3_origin); + } + }; + public static EntUseAdapter func_explosive_spawn = new EntUseAdapter() + { + + public void use(edict_t self, edict_t other, edict_t activator) + { + self.solid = Defines.SOLID_BSP; + self.svflags &= ~Defines.SVF_NOCLIENT; + self.use = null; + GameUtil.KillBox(self); + GameBase.gi.linkentity(self); + } + }; + /*QUAKED misc_explobox (0 .5 .8) (-16 -16 0) (16 16 40) + Large exploding box. You can override its mass (100), + health (80), and dmg (150). + */ + + public static EntTouchAdapter barrel_touch = new EntTouchAdapter() + { + + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + float ratio; + float[] v = { 0, 0, 0 }; + + if ((null == other.groundentity) || (other.groundentity == self)) + return; + + ratio = (float) other.mass / (float) self.mass; + Math3D.VectorSubtract(self.s.origin, other.s.origin, v); + M.M_walkmove(self, Math3D.vectoyaw(v), 20 * ratio * Defines.FRAMETIME); + } + }; + public static EntThinkAdapter barrel_explode = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + float[] org = { 0, 0, 0 }; + float spd; + float[] save = { 0, 0, 0 }; + + GameUtil.T_RadiusDamage(self, self.activator, self.dmg, null, self.dmg + 40, Defines.MOD_BARREL); + + Math3D.VectorCopy(self.s.origin, save); + Math3D.VectorMA(self.absmin, 0.5f, self.size, self.s.origin); + + // a few big chunks + spd = 1.5f * (float) self.dmg / 200.0f; + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris1/tris.md2", spd, org); + + // bottom corners + spd = 1.75f * (float) self.dmg / 200.0f; + Math3D.VectorCopy(self.absmin, org); + GameAI.ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); + Math3D.VectorCopy(self.absmin, org); + org[0] += self.size[0]; + GameAI.ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); + Math3D.VectorCopy(self.absmin, org); + org[1] += self.size[1]; + GameAI.ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); + Math3D.VectorCopy(self.absmin, org); + org[0] += self.size[0]; + org[1] += self.size[1]; + GameAI.ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org); + + // a bunch of little chunks + spd = 2 * self.dmg / 200; + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + org[0] = self.s.origin[0] + Lib.crandom() * self.size[0]; + org[1] = self.s.origin[1] + Lib.crandom() * self.size[1]; + org[2] = self.s.origin[2] + Lib.crandom() * self.size[2]; + GameAI.ThrowDebris(self, "models/objects/debris2/tris.md2", spd, org); + + Math3D.VectorCopy(save, self.s.origin); + if (self.groundentity != null) + GameAI.BecomeExplosion2(self); + else + GameAI.BecomeExplosion1(self); + + return true; + } + }; + public static EntDieAdapter barrel_delay = new EntDieAdapter() + { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + + self.takedamage = Defines.DAMAGE_NO; + self.nextthink = GameBase.level.time + 2 * Defines.FRAMETIME; + self.think = barrel_explode; + self.activator = attacker; + } + }; + // + // miscellaneous specialty items + // + + /*QUAKED misc_blackhole (1 .5 0) (-8 -8 -8) (8 8 8) + */ + + static EntUseAdapter misc_blackhole_use = new EntUseAdapter() + { + public void use(edict_t ent, edict_t other, edict_t activator) + { + /* + gi.WriteByte (svc_temp_entity); + gi.WriteByte (TE_BOSSTPORT); + gi.WritePosition (ent.s.origin); + gi.multicast (ent.s.origin, MULTICAST_PVS); + */ + GameUtil.G_FreeEdict(ent); + } + }; + static EntThinkAdapter misc_blackhole_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + if (++self.s.frame < 19) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + else + { + self.s.frame = 0; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + return true; + } + }; + /*QUAKED misc_eastertank (1 .5 0) (-32 -32 -16) (32 32 32) + */ + + static EntThinkAdapter misc_eastertank_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (++self.s.frame < 293) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + else + { + self.s.frame = 254; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + return true; + } + }; + /*QUAKED misc_easterchick (1 .5 0) (-32 -32 0) (32 32 32) + */ + + static EntThinkAdapter misc_easterchick_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (++self.s.frame < 247) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + else + { + self.s.frame = 208; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + return true; + } + }; + /*QUAKED misc_easterchick2 (1 .5 0) (-32 -32 0) (32 32 32) + */ + static EntThinkAdapter misc_easterchick2_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (++self.s.frame < 287) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + else + { + self.s.frame = 248; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + return true; + } + }; + /*QUAKED monster_commander_body (1 .5 0) (-32 -32 0) (32 32 48) + Not really a monster, this is the Tank Commander's decapitated body. + There should be a item_commander_head that has this as it's target. + */ + + public static EntThinkAdapter commander_body_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (++self.s.frame < 24) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + else + self.nextthink = 0; + + if (self.s.frame == 22) + GameBase.gi.sound(self, Defines.CHAN_BODY, GameBase.gi.soundindex("tank/thud.wav"), 1, Defines.ATTN_NORM, 0); + return true; + } + }; + public static EntUseAdapter commander_body_use = new EntUseAdapter() + { + + public void use(edict_t self, edict_t other, edict_t activator) + { + self.think = commander_body_think; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + GameBase.gi.sound(self, Defines.CHAN_BODY, GameBase.gi.soundindex("tank/pain.wav"), 1, Defines.ATTN_NORM, 0); + } + }; + public static EntThinkAdapter commander_body_drop = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.movetype = Defines.MOVETYPE_TOSS; + self.s.origin[2] += 2; + return true; + } + }; + /*QUAKED misc_banner (1 .5 0) (-4 -4 -4) (4 4 4) + The origin is the bottom of the banner. + The banner is 128 tall. + */ + static EntThinkAdapter misc_banner_think = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + ent.s.frame = (ent.s.frame + 1) % 16; + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + /*QUAKED misc_deadsoldier (1 .5 0) (-16 -16 0) (16 16 16) ON_BACK ON_STOMACH BACK_DECAP FETAL_POS SIT_DECAP IMPALED + This is the dead player model. Comes in 6 exciting different poses! + */ + static EntDieAdapter misc_deadsoldier_die = new EntDieAdapter() + { + + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + int n; + + if (self.health > -80) + return; + + GameBase.gi.sound(self, Defines.CHAN_BODY, GameBase.gi.soundindex("misc/udeath.wav"), 1, Defines.ATTN_NORM, 0); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); + GameAI.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); + } + }; + /*QUAKED misc_viper (1 .5 0) (-16 -16 0) (16 16 32) + This is the Viper for the flyby bombing. + It is trigger_spawned, so you must have something use it for it to show up. + There must be a path for it to follow once it is activated. + + "speed" How fast the Viper should fly + */ + + static EntUseAdapter misc_viper_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.svflags &= ~Defines.SVF_NOCLIENT; + self.use = GameFuncAdapters.train_use; + GameFuncAdapters.train_use.use(self, other, activator); + } + }; + /*QUAKED misc_viper_bomb (1 0 0) (-8 -8 -8) (8 8 8) + "dmg" how much boom should the bomb make? + */ + static EntTouchAdapter misc_viper_bomb_touch = new EntTouchAdapter() + { + + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + GameUtil.G_UseTargets(self, self.activator); + + self.s.origin[2] = self.absmin[2] + 1; + GameUtil.T_RadiusDamage(self, self, self.dmg, null, self.dmg + 40, Defines.MOD_BOMB); + GameAI.BecomeExplosion2(self); + } + }; + static EntThinkAdapter misc_viper_bomb_prethink = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + float[] v = { 0, 0, 0 }; + float diff; + + self.groundentity = null; + + diff = self.timestamp - GameBase.level.time; + if (diff < -1.0) + diff = -1.0f; + + Math3D.VectorScale(self.moveinfo.dir, 1.0f + diff, v); + v[2] = diff; + + diff = self.s.angles[2]; + Math3D.vectoangles(v, self.s.angles); + self.s.angles[2] = diff + 10; + + return true; + } + }; + static EntUseAdapter misc_viper_bomb_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + edict_t viper = null; + + self.solid = Defines.SOLID_BBOX; + self.svflags &= ~Defines.SVF_NOCLIENT; + self.s.effects |= Defines.EF_ROCKET; + self.use = null; + self.movetype = Defines.MOVETYPE_TOSS; + self.prethink = misc_viper_bomb_prethink; + self.touch = misc_viper_bomb_touch; + self.activator = activator; + + EdictIterator es = null; + + es = GameBase.G_Find(es, GameBase.findByClass, "misc_viper"); + if (es != null) + viper = es.o; + + Math3D.VectorScale(viper.moveinfo.dir, viper.moveinfo.speed, self.velocity); + + self.timestamp = GameBase.level.time; + Math3D.VectorCopy(viper.moveinfo.dir, self.moveinfo.dir); + } + }; + /*QUAKED misc_strogg_ship (1 .5 0) (-16 -16 0) (16 16 32) + This is a Storgg ship for the flybys. + It is trigger_spawned, so you must have something use it for it to show up. + There must be a path for it to follow once it is activated. + + "speed" How fast it should fly + */ + + static EntUseAdapter misc_strogg_ship_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.svflags &= ~Defines.SVF_NOCLIENT; + self.use = GameFuncAdapters.train_use; + GameFuncAdapters.train_use.use(self, other, activator); + } + }; + /*QUAKED misc_satellite_dish (1 .5 0) (-64 -64 0) (64 64 128) + */ + static EntThinkAdapter misc_satellite_dish_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.s.frame++; + if (self.s.frame < 38) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + static EntUseAdapter misc_satellite_dish_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + self.s.frame = 0; + self.think = misc_satellite_dish_think; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + }; + /*QUAKED target_string (0 0 1) (-8 -8 -8) (8 8 8) + */ + + static EntUseAdapter target_string_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + edict_t e; + int n, l; + char c; + + l = self.message.length(); + for (e = self.teammaster; e != null; e = e.teamchain) + { + if (e.count == 0) + continue; + n = e.count - 1; + if (n > l) + { + e.s.frame = 12; + continue; + } + + c = self.message.charAt(n); + if (c >= '0' && c <= '9') + e.s.frame = c - '0'; + else if (c == '-') + e.s.frame = 10; + else if (c == ':') + e.s.frame = 11; + else + e.s.frame = 12; + } + } + }; + /*QUAKED func_clock (0 0 1) (-8 -8 -8) (8 8 8) TIMER_UP TIMER_DOWN START_OFF MULTI_USE + target a target_string with this + + The default is to be a time of day clock + + TIMER_UP and TIMER_DOWN run for "count" seconds and the fire "pathtarget" + If START_OFF, this entity must be used before it starts + + "style" 0 "xx" + 1 "xx:xx" + 2 "xx:xx:xx" + */ + + public static final int CLOCK_MESSAGE_SIZE = 16; + public static EntThinkAdapter func_clock_think = new EntThinkAdapter() + { + + public boolean think(edict_t self) + { + if (null == self.enemy) + { + + EdictIterator es = null; + + es = GameBase.G_Find(es, GameBase.findByTarget, self.target); + if (es != null) + self.enemy = es.o; + if (self.enemy == null) + return true; + } + + if ((self.spawnflags & 1) != 0) + { + GameMisc.func_clock_format_countdown(self); + self.health++; + } + else if ((self.spawnflags & 2) != 0) + { + GameMisc.func_clock_format_countdown(self); + self.health--; + } + else + { + Date d = new Date(); + self.message = "" + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); + + /* + struct tm * ltime; + time_t gmtime; + + time(& gmtime); + ltime = localtime(& gmtime); + Com_sprintf(self.message, CLOCK_MESSAGE_SIZE, "%2i:%2i:%2i", ltime.tm_hour, ltime.tm_min, ltime.tm_sec); + if (self.message[3] == ' ') + self.message[3] = '0'; + if (self.message[6] == ' ') + self.message[6] = '0'; + */ + } + + self.enemy.message = self.message; + self.enemy.use.use(self.enemy, self, self); + + if (((self.spawnflags & 1) != 0 && (self.health > self.wait)) + || ((self.spawnflags & 2) != 0 && (self.health < self.wait))) + { + if (self.pathtarget != null) + { + String savetarget; + String savemessage; + + savetarget = self.target; + savemessage = self.message; + self.target = self.pathtarget; + self.message = null; + GameUtil.G_UseTargets(self, self.activator); + self.target = savetarget; + self.message = savemessage; + } + + if (0 == (self.spawnflags & 8)) + return true; + + GameMisc.func_clock_reset(self); + + if ((self.spawnflags & 4) != 0) + return true; + } + + self.nextthink = GameBase.level.time + 1; + return true; + + } + }; + public static EntUseAdapter func_clock_use = new EntUseAdapter() + { + + public void use(edict_t self, edict_t other, edict_t activator) + { + if (0 == (self.spawnflags & 8)) + self.use = null; + if (self.activator != null) + return; + self.activator = activator; + self.think.think(self); + } + }; + //================================================================================= + + static EntTouchAdapter teleporter_touch = new EntTouchAdapter() + { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) + { + edict_t dest; + int i; + + if (other.client == null) + return; + + EdictIterator es = null; + dest = GameBase.G_Find(null, GameBase.findByTarget, self.target).o; + + if (dest == null) + { + GameBase.gi.dprintf("Couldn't find destination\n"); + return; + } + + // unlink to make sure it can't possibly interfere with KillBox + GameBase.gi.unlinkentity(other); + + Math3D.VectorCopy(dest.s.origin, other.s.origin); + Math3D.VectorCopy(dest.s.origin, other.s.old_origin); + other.s.origin[2] += 10; + + // clear the velocity and hold them in place briefly + Math3D.VectorClear(other.velocity); + other.client.ps.pmove.pm_time = 160 >> 3; // hold time + other.client.ps.pmove.pm_flags |= Defines.PMF_TIME_TELEPORT; + + // draw the teleport splash at source and on the player + self.owner.s.event = Defines.EV_PLAYER_TELEPORT; + other.s.event = Defines.EV_PLAYER_TELEPORT; + + // set angles + for (i = 0; i < 3; i++) + { + other.client.ps.pmove.delta_angles[i] = (short) Math3D.ANGLE2SHORT(dest.s.angles[i] - other.client.resp.cmd_angles[i]); + } + + Math3D.VectorClear(other.s.angles); + Math3D.VectorClear(other.client.ps.viewangles); + Math3D.VectorClear(other.client.v_angle); + + // kill anything at the destination + GameUtil.KillBox(other); + + GameBase.gi.linkentity(other); + } + }; + /*QUAKED misc_teleporter_dest (1 0 0) (-32 -32 -24) (32 32 -16) + Point teleporters at these. + */ + + public static EntThinkAdapter SP_misc_teleporter_dest = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + GameBase.gi.setmodel(ent, "models/objects/dmspot/tris.md2"); + ent.s.skinnum = 0; + ent.solid = Defines.SOLID_BBOX; + // ent.s.effects |= EF_FLIES; + Math3D.VectorSet(ent.mins, -32, -32, -24); + Math3D.VectorSet(ent.maxs, 32, 32, -16); + GameBase.gi.linkentity(ent); + return true; + } + }; +} diff --git a/src/jake2/game/GamePWeapon.java b/src/jake2/game/GamePWeapon.java index 7d845f0..e8247c4 100644 --- a/src/jake2/game/GamePWeapon.java +++ b/src/jake2/game/GamePWeapon.java @@ -19,512 +19,54 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 16.11.2003 by RST. -// $Id: GamePWeapon.java,v 1.1 2004-07-07 19:59:00 hzi Exp $ +// $Id: GamePWeapon.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; +import jake2.Defines; +import jake2.Globals; import jake2.util.*; import jake2.util.*; -public class GamePWeapon extends M_Player { +public class GamePWeapon { - static boolean is_quad; - static byte is_silenced; - - static void P_ProjectSource( - gclient_t client, - float[] point, - float[] distance, - float[] forward, - float[] right, - float[] result) { - float[] _distance= { 0, 0, 0 }; - - Math3D.VectorCopy(distance, _distance); - if (client.pers.hand == LEFT_HANDED) - _distance[1] *= -1; - else if (client.pers.hand == CENTER_HANDED) - _distance[1]= 0; - Math3D.G_ProjectSource(point, _distance, forward, right, result); - } - - static EntInteractAdapter Pickup_Weapon= new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - int index; - gitem_t ammo; - - index= ITEM_INDEX(ent.item); - - if ((((int) (dmflags.value) & DF_WEAPONS_STAY) != 0 || coop.value != 0) - && 0 != other.client.pers.inventory[index]) { - if (0 == (ent.spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM))) - return false; // leave the weapon for others to pickup - } - - other.client.pers.inventory[index]++; - - if (0 == (ent.spawnflags & DROPPED_ITEM)) { - // give them some ammo with it - ammo= FindItem(ent.item.ammo); - if (((int) dmflags.value & DF_INFINITE_AMMO) != 0) - Add_Ammo(other, ammo, 1000); - else - Add_Ammo(other, ammo, ammo.quantity); - - if (0 == (ent.spawnflags & DROPPED_PLAYER_ITEM)) { - if (deathmatch.value != 0) { - if (((int) (dmflags.value) & DF_WEAPONS_STAY) != 0) - ent.flags |= FL_RESPAWN; - else - SetRespawn(ent, 30); - } - if (coop.value != 0) - ent.flags |= FL_RESPAWN; - } - } - - if (other.client.pers.weapon != ent.item - && (other.client.pers.inventory[index] == 1) - && (0 == deathmatch.value || other.client.pers.weapon == FindItem("blaster"))) - other.client.newweapon= ent.item; - - return true; - } - }; - - /* - =============== - ChangeWeapon - - The old weapon has been dropped all the way, so make the new one - current - =============== - */ - static void ChangeWeapon(edict_t ent) { - int i; - - if (ent.client.grenade_time != 0) { - ent.client.grenade_time= level.time; - ent.client.weapon_sound= 0; - weapon_grenade_fire(ent, false); - ent.client.grenade_time= 0; - } - - ent.client.pers.lastweapon= ent.client.pers.weapon; - ent.client.pers.weapon= ent.client.newweapon; - ent.client.newweapon= null; - ent.client.machinegun_shots= 0; - - // set visible model - if (ent.s.modelindex == 255) { - if (ent.client.pers.weapon != null) - i= ((ent.client.pers.weapon.weapmodel & 0xff) << 8); - else - i= 0; - //ent.s.skinnum = (ent - g_edicts - 1) | i; - ent.s.skinnum= (ent.index - 1) | i; - } - - if (ent.client.pers.weapon != null && ent.client.pers.weapon.ammo != null) - ent.client.ammo_index= ITEM_INDEX(FindItem(ent.client.pers.weapon.ammo)); - else - ent.client.ammo_index= 0; - - if (ent.client.pers.weapon == null) { // dead - ent.client.ps.gunindex= 0; - return; - } - - ent.client.weaponstate= WEAPON_ACTIVATING; - ent.client.ps.gunframe= 0; - ent.client.ps.gunindex= gi.modelindex(ent.client.pers.weapon.view_model); - - ent.client.anim_priority= ANIM_PAIN; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crpain1; - ent.client.anim_end= FRAME_crpain4; - } else { - ent.s.frame= FRAME_pain301; - ent.client.anim_end= FRAME_pain304; - - } - } - - /* - ================= - NoAmmoWeaponChange - ================= - */ - static void NoAmmoWeaponChange(edict_t ent) { - if (0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("slugs"))] - && 0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("railgun"))]) { - ent.client.newweapon= FindItem("railgun"); - return; - } - if (0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("cells"))] - && 0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))]) { - ent.client.newweapon= FindItem("hyperblaster"); - return; - } - if (0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("bullets"))] - && 0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("chaingun"))]) { - ent.client.newweapon= FindItem("chaingun"); - return; - } - if (0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("bullets"))] - && 0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("machinegun"))]) { - ent.client.newweapon= FindItem("machinegun"); - return; - } - if (ent.client.pers.inventory[ITEM_INDEX(FindItem("shells"))] > 1 - && 0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("super shotgun"))]) { - ent.client.newweapon= FindItem("super shotgun"); - return; - } - if (0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("shells"))] - && 0 != ent.client.pers.inventory[ITEM_INDEX(FindItem("shotgun"))]) { - ent.client.newweapon= FindItem("shotgun"); - return; - } - ent.client.newweapon= FindItem("blaster"); - } - - /* - ================= - Think_Weapon - - Called by ClientBeginServerFrame and ClientThink - ================= - */ - static void Think_Weapon(edict_t ent) { - // if just died, put the weapon away - if (ent.health < 1) { - ent.client.newweapon= null; - ChangeWeapon(ent); - } - - // call active weapon think routine - if (null != ent.client.pers.weapon && null != ent.client.pers.weapon.weaponthink) { - is_quad= (ent.client.quad_framenum > level.framenum); - if (ent.client.silencer_shots != 0) - is_silenced= (byte) MZ_SILENCED; - else - is_silenced= 0; - ent.client.pers.weapon.weaponthink.think(ent); - } - } - - /* - ================ - Use_Weapon - - Make the weapon ready if there is ammo - ================ - */ - static ItemUseAdapter Use_Weapon= new ItemUseAdapter() { - - public void use(edict_t ent, gitem_t item) { - int ammo_index; - gitem_t ammo_item; - - // see if we're already using it - if (item == ent.client.pers.weapon) - return; - - if (item.ammo != null && 0 == g_select_empty.value && 0 == (item.flags & IT_AMMO)) { - ammo_item= FindItem(item.ammo); - ammo_index= ITEM_INDEX(ammo_item); - - if (0 == ent.client.pers.inventory[ammo_index]) { - gi.cprintf(ent, PRINT_HIGH, "No " + ammo_item.pickup_name + " for " + ".\n"); - return; - } - - if (ent.client.pers.inventory[ammo_index] < item.quantity) { - gi.cprintf( - ent, - PRINT_HIGH, - "Not enough " + ammo_item.pickup_name + " for " + item.pickup_name + ".\n"); - return; - } - } - - // change to this weapon when down - ent.client.newweapon= item; - } - }; - - /* - ================ - Drop_Weapon - ================ - */ - - static ItemDropAdapter Drop_Weapon= new ItemDropAdapter() { - public void drop(edict_t ent, gitem_t item) { - int index; - - if (0 != ((int) (dmflags.value) & DF_WEAPONS_STAY)) - return; - - index= ITEM_INDEX(item); - // see if we're already using it - if (((item == ent.client.pers.weapon) || (item == ent.client.newweapon)) - && (ent.client.pers.inventory[index] == 1)) { - gi.cprintf(ent, PRINT_HIGH, "Can't drop current weapon\n"); - return; - } - - Drop_Item(ent, item); - ent.client.pers.inventory[index]--; - } - }; - - /* - ================ - Weapon_Generic - - A generic function to handle the basics of weapon thinking - ================ - */ - - static void Weapon_Generic( - edict_t ent, - int FRAME_ACTIVATE_LAST, - int FRAME_FIRE_LAST, - int FRAME_IDLE_LAST, - int FRAME_DEACTIVATE_LAST, - int pause_frames[], - int fire_frames[], - EntThinkAdapter fire) { - int FRAME_FIRE_FIRST= (FRAME_ACTIVATE_LAST + 1); - int FRAME_IDLE_FIRST= (FRAME_FIRE_LAST + 1); - int FRAME_DEACTIVATE_FIRST= (FRAME_IDLE_LAST + 1); - - int n; - - if (ent.deadflag != 0 || ent.s.modelindex != 255) // VWep animations screw up corpses - { - return; - } - - if (ent.client.weaponstate == WEAPON_DROPPING) { - if (ent.client.ps.gunframe == FRAME_DEACTIVATE_LAST) { - ChangeWeapon(ent); - return; - } else if ((FRAME_DEACTIVATE_LAST - ent.client.ps.gunframe) == 4) { - ent.client.anim_priority= ANIM_REVERSE; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crpain4 + 1; - ent.client.anim_end= FRAME_crpain1; - } else { - ent.s.frame= FRAME_pain304 + 1; - ent.client.anim_end= FRAME_pain301; - - } - } - - ent.client.ps.gunframe++; - return; - } - - if (ent.client.weaponstate == WEAPON_ACTIVATING) { - if (ent.client.ps.gunframe == FRAME_ACTIVATE_LAST) { - ent.client.weaponstate= WEAPON_READY; - ent.client.ps.gunframe= FRAME_IDLE_FIRST; - return; - } - - ent.client.ps.gunframe++; - return; - } - - if ((ent.client.newweapon != null) && (ent.client.weaponstate != WEAPON_FIRING)) { - ent.client.weaponstate= WEAPON_DROPPING; - ent.client.ps.gunframe= FRAME_DEACTIVATE_FIRST; - - if ((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4) { - ent.client.anim_priority= ANIM_REVERSE; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crpain4 + 1; - ent.client.anim_end= FRAME_crpain1; - } else { - ent.s.frame= FRAME_pain304 + 1; - ent.client.anim_end= FRAME_pain301; - - } - } - return; - } - - if (ent.client.weaponstate == WEAPON_READY) { - if (((ent.client.latched_buttons | ent.client.buttons) & BUTTON_ATTACK) != 0) { - ent.client.latched_buttons &= ~BUTTON_ATTACK; - if ((0 != ent.client.ammo_index) - || (ent.client.pers.inventory[ent.client.ammo_index] - >= ent.client.pers.weapon.quantity)) { - ent.client.ps.gunframe= FRAME_FIRE_FIRST; - ent.client.weaponstate= WEAPON_FIRING; - - // start the animation - ent.client.anim_priority= ANIM_ATTACK; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crattak1 - 1; - ent.client.anim_end= FRAME_crattak9; - } else { - ent.s.frame= FRAME_attack1 - 1; - ent.client.anim_end= FRAME_attack8; - } - } else { - if (level.time >= ent.pain_debounce_time) { - gi.sound( - ent, - CHAN_VOICE, - gi.soundindex("weapons/noammo.wav"), - 1, - ATTN_NORM, - 0); - ent.pain_debounce_time= level.time + 1; - } - NoAmmoWeaponChange(ent); - } - } else { - if (ent.client.ps.gunframe == FRAME_IDLE_LAST) { - ent.client.ps.gunframe= FRAME_IDLE_FIRST; - return; - } - - if (pause_frames != null) { - for (n= 0; pause_frames[n] != 0; n++) { - if (ent.client.ps.gunframe == pause_frames[n]) { - if ((Lib.rand() & 15) != 0) - return; - } - } - } - - ent.client.ps.gunframe++; - return; - } - } - - if (ent.client.weaponstate == WEAPON_FIRING) { - for (n= 0; fire_frames[n] != 0; n++) { - if (ent.client.ps.gunframe == fire_frames[n]) { - if (ent.client.quad_framenum > level.framenum) - gi.sound( - ent, - CHAN_ITEM, - gi.soundindex("items/damage3.wav"), - 1, - ATTN_NORM, - 0); - - fire.think(ent); - break; - } - } - - if (0 == fire_frames[n]) - ent.client.ps.gunframe++; - - if (ent.client.ps.gunframe == FRAME_IDLE_FIRST + 1) - ent.client.weaponstate= WEAPON_READY; - } - } - - /* - ====================================================================== - - GRENADE + public static EntThinkAdapter Weapon_Grenade= new EntThinkAdapter() { - ====================================================================== - */ - - static void weapon_grenade_fire(edict_t ent, boolean held) { - float[] offset= { 0, 0, 0 }; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; - float[] start= { 0, 0, 0 }; - int damage= 125; - float timer; - int speed; - float radius; - - radius= damage + 40; - if (is_quad) - damage *= 4; - - Math3D.VectorSet(offset, 8, 8, ent.viewheight - 8); - Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - - timer= ent.client.grenade_time - level.time; - speed= - (int) (GRENADE_MINSPEED - + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER)); - Fire.fire_grenade2(ent, start, forward, damage, speed, timer, radius, held); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) - ent.client.pers.inventory[ent.client.ammo_index]--; - - ent.client.grenade_time= level.time + 1.0f; - - if (ent.deadflag != 0 || ent.s.modelindex != 255) // VWep animations screw up corpses - { - return; - } - - if (ent.health <= 0) - return; - - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.client.anim_priority= ANIM_ATTACK; - ent.s.frame= FRAME_crattak1 - 1; - ent.client.anim_end= FRAME_crattak3; - } else { - ent.client.anim_priority= ANIM_REVERSE; - ent.s.frame= FRAME_wave08; - ent.client.anim_end= FRAME_wave01; - } - } - - static EntThinkAdapter Weapon_Grenade= new EntThinkAdapter() { - public boolean think(edict_t ent) { - if ((ent.client.newweapon != null) && (ent.client.weaponstate == WEAPON_READY)) { - ChangeWeapon(ent); + if ((ent.client.newweapon != null) && (ent.client.weaponstate == Defines.WEAPON_READY)) { + GamePWeapon.ChangeWeapon(ent); return true; } - - if (ent.client.weaponstate == WEAPON_ACTIVATING) { - ent.client.weaponstate= WEAPON_READY; + + if (ent.client.weaponstate == Defines.WEAPON_ACTIVATING) { + ent.client.weaponstate= Defines.WEAPON_READY; ent.client.ps.gunframe= 16; return true; } - - if (ent.client.weaponstate == WEAPON_READY) { - if (((ent.client.latched_buttons | ent.client.buttons) & BUTTON_ATTACK) != 0) { - ent.client.latched_buttons &= ~BUTTON_ATTACK; + + if (ent.client.weaponstate == Defines.WEAPON_READY) { + if (((ent.client.latched_buttons | ent.client.buttons) & Defines.BUTTON_ATTACK) != 0) { + ent.client.latched_buttons &= ~Defines.BUTTON_ATTACK; if (0 != ent.client.pers.inventory[ent.client.ammo_index]) { ent.client.ps.gunframe= 1; - ent.client.weaponstate= WEAPON_FIRING; + ent.client.weaponstate= Defines.WEAPON_FIRING; ent.client.grenade_time= 0; } else { - if (level.time >= ent.pain_debounce_time) { - gi.sound( + if (GameBase.level.time >= ent.pain_debounce_time) { + GameBase.gi.sound( ent, - CHAN_VOICE, - gi.soundindex("weapons/noammo.wav"), + Defines.CHAN_VOICE, + GameBase.gi.soundindex("weapons/noammo.wav"), 1, - ATTN_NORM, + Defines.ATTN_NORM, 0); - ent.pain_debounce_time= level.time + 1; + ent.pain_debounce_time= GameBase.level.time + 1; } - NoAmmoWeaponChange(ent); + GamePWeapon.NoAmmoWeaponChange(ent); } return true; } - + if ((ent.client.ps.gunframe == 29) || (ent.client.ps.gunframe == 34) || (ent.client.ps.gunframe == 39) @@ -532,40 +74,40 @@ public class GamePWeapon extends M_Player { if ((Lib.rand() & 15) != 0) return true; } - + if (++ent.client.ps.gunframe > 48) ent.client.ps.gunframe= 16; return true; } - - if (ent.client.weaponstate == WEAPON_FIRING) { + + if (ent.client.weaponstate == Defines.WEAPON_FIRING) { if (ent.client.ps.gunframe == 5) - gi.sound( + GameBase.gi.sound( ent, - CHAN_WEAPON, - gi.soundindex("weapons/hgrena1b.wav"), + Defines.CHAN_WEAPON, + GameBase.gi.soundindex("weapons/hgrena1b.wav"), 1, - ATTN_NORM, + Defines.ATTN_NORM, 0); - + if (ent.client.ps.gunframe == 11) { if (0 == ent.client.grenade_time) { - ent.client.grenade_time= level.time + GRENADE_TIMER + 0.2f; - ent.client.weapon_sound= gi.soundindex("weapons/hgrenc1b.wav"); + ent.client.grenade_time= GameBase.level.time + Defines.GRENADE_TIMER + 0.2f; + ent.client.weapon_sound= GameBase.gi.soundindex("weapons/hgrenc1b.wav"); } - + // they waited too long, detonate it in their hand - if (!ent.client.grenade_blew_up && level.time >= ent.client.grenade_time) { + if (!ent.client.grenade_blew_up && GameBase.level.time >= ent.client.grenade_time) { ent.client.weapon_sound= 0; - weapon_grenade_fire(ent, true); + GamePWeapon.weapon_grenade_fire(ent, true); ent.client.grenade_blew_up= true; } - - if ((ent.client.buttons & BUTTON_ATTACK) != 0) + + if ((ent.client.buttons & Defines.BUTTON_ATTACK) != 0) return true; - + if (ent.client.grenade_blew_up) { - if (level.time >= ent.client.grenade_time) { + if (GameBase.level.time >= ent.client.grenade_time) { ent.client.ps.gunframe= 15; ent.client.grenade_blew_up= false; } else { @@ -573,26 +115,25 @@ public class GamePWeapon extends M_Player { } } } - + if (ent.client.ps.gunframe == 12) { ent.client.weapon_sound= 0; - weapon_grenade_fire(ent, false); + GamePWeapon.weapon_grenade_fire(ent, false); } - - if ((ent.client.ps.gunframe == 15) && (level.time < ent.client.grenade_time)) + + if ((ent.client.ps.gunframe == 15) && (GameBase.level.time < ent.client.grenade_time)) return true; - + ent.client.ps.gunframe++; - + if (ent.client.ps.gunframe == 16) { ent.client.grenade_time= 0; - ent.client.weaponstate= WEAPON_READY; + ent.client.weaponstate= Defines.WEAPON_READY; } } return true; } }; - /* ====================================================================== @@ -600,54 +141,53 @@ public class GamePWeapon extends M_Player { ====================================================================== */ - - static EntThinkAdapter weapon_grenadelauncher_fire= new EntThinkAdapter() { - + + public static EntThinkAdapter weapon_grenadelauncher_fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { float[] offset= { 0, 0, 0 }; float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; float[] start= { 0, 0, 0 }; int damage= 120; float radius; - + radius= damage + 40; - if (is_quad) + if (GamePWeapon.is_quad) damage *= 4; - + Math3D.VectorSet(offset, 8, 8, ent.viewheight - 8); Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - + GamePWeapon.P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + Math3D.VectorScale(forward, -2, ent.client.kick_origin); ent.client.kick_angles[0]= -1; - + Fire.fire_grenade(ent, start, forward, damage, 600, 2.5f, radius); - - gi.WriteByte(svc_muzzleflash); + + GameBase.gi.WriteByte(Defines.svc_muzzleflash); //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_GRENADE | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_GRENADE | GamePWeapon.is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + ent.client.ps.gunframe++; - - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index]--; - + return true; } }; - - static EntThinkAdapter Weapon_GrenadeLauncher= new EntThinkAdapter() { - + public static EntThinkAdapter Weapon_GrenadeLauncher= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + int pause_frames[]= { 34, 51, 59, 0 }; int fire_frames[]= { 6, 0 }; - - Weapon_Generic( + + GamePWeapon.Weapon_Generic( ent, 5, 16, @@ -659,7 +199,6 @@ public class GamePWeapon extends M_Player { return true; } }; - /* ====================================================================== @@ -667,60 +206,59 @@ public class GamePWeapon extends M_Player { ====================================================================== */ - - static EntThinkAdapter Weapon_RocketLauncher_Fire= new EntThinkAdapter() { - + + public static EntThinkAdapter Weapon_RocketLauncher_Fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + float[] offset= { 0, 0, 0 }, start= { 0, 0, 0 }; float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; int damage; float damage_radius; int radius_damage; - + damage= 100 + (int) (Lib.random() * 20.0); radius_damage= 120; damage_radius= 120; - if (is_quad) { + if (GamePWeapon.is_quad) { damage *= 4; radius_damage *= 4; } - + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - + Math3D.VectorScale(forward, -2, ent.client.kick_origin); ent.client.kick_angles[0]= -1; - + Math3D.VectorSet(offset, 8, 8, ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + GamePWeapon.P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); Fire.fire_rocket(ent, start, forward, damage, 650, damage_radius, radius_damage); - + // send muzzle flash - gi.WriteByte(svc_muzzleflash); + GameBase.gi.WriteByte(Defines.svc_muzzleflash); //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_ROCKET | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_ROCKET | GamePWeapon.is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + ent.client.ps.gunframe++; - - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index]--; - + return true; } }; - - static EntThinkAdapter Weapon_RocketLauncher= new EntThinkAdapter() { - + public static EntThinkAdapter Weapon_RocketLauncher= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + int pause_frames[]= { 25, 33, 42, 50, 0 }; int fire_frames[]= { 5, 0 }; - - Weapon_Generic( + + GamePWeapon.Weapon_Generic( ent, 4, 12, @@ -732,395 +270,130 @@ public class GamePWeapon extends M_Player { return true; } }; - - /* - ====================================================================== + public static EntThinkAdapter Weapon_Blaster_Fire= new EntThinkAdapter() { - BLASTER / HYPERBLASTER - - ====================================================================== - */ - - static void Blaster_Fire( - edict_t ent, - float[] g_offset, - int damage, - boolean hyper, - int effect) { - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; - float[] start= { 0, 0, 0 }; - float[] offset= { 0, 0, 0 }; - - if (is_quad) - damage *= 4; - Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - Math3D.VectorSet(offset, 24, 8, ent.viewheight - 8); - Math3D.VectorAdd(offset, g_offset, offset); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - - Math3D.VectorScale(forward, -2, ent.client.kick_origin); - ent.client.kick_angles[0]= -1; - - Fire.fire_blaster(ent, start, forward, damage, 1000, effect, hyper); - - // send muzzle flash - gi.WriteByte(svc_muzzleflash); - //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - if (hyper) - gi.WriteByte(MZ_HYPERBLASTER | is_silenced); - else - gi.WriteByte(MZ_BLASTER | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - - PlayerNoise(ent, start, PNOISE_WEAPON); - } - - static EntThinkAdapter Weapon_Blaster_Fire= new EntThinkAdapter() { - public boolean think(edict_t ent) { - + int damage; - - if (deathmatch.value != 0) + + if (GameBase.deathmatch.value != 0) damage= 15; else damage= 10; - Blaster_Fire(ent, vec3_origin, damage, false, EF_BLASTER); + GamePWeapon.Blaster_Fire(ent, Globals.vec3_origin, damage, false, Defines.EF_BLASTER); ent.client.ps.gunframe++; return true; } }; - - static EntThinkAdapter Weapon_Blaster= new EntThinkAdapter() { - + public static EntThinkAdapter Weapon_Blaster= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + int pause_frames[]= { 19, 32, 0 }; int fire_frames[]= { 5, 0 }; - - Weapon_Generic(ent, 4, 8, 52, 55, pause_frames, fire_frames, Weapon_Blaster_Fire); + + GamePWeapon.Weapon_Generic(ent, 4, 8, 52, 55, pause_frames, fire_frames, Weapon_Blaster_Fire); return true; } }; - - static EntThinkAdapter Weapon_HyperBlaster_Fire= new EntThinkAdapter() { - + public static EntThinkAdapter Weapon_HyperBlaster_Fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { float rotation; float[] offset= { 0, 0, 0 }; int effect; int damage; - - ent.client.weapon_sound= gi.soundindex("weapons/hyprbl1a.wav"); - - if (0 == (ent.client.buttons & BUTTON_ATTACK)) { + + ent.client.weapon_sound= GameBase.gi.soundindex("weapons/hyprbl1a.wav"); + + if (0 == (ent.client.buttons & Defines.BUTTON_ATTACK)) { ent.client.ps.gunframe++; } else { if (0 == ent.client.pers.inventory[ent.client.ammo_index]) { - if (level.time >= ent.pain_debounce_time) { - gi.sound( + if (GameBase.level.time >= ent.pain_debounce_time) { + GameBase.gi.sound( ent, - CHAN_VOICE, - gi.soundindex("weapons/noammo.wav"), + Defines.CHAN_VOICE, + GameBase.gi.soundindex("weapons/noammo.wav"), 1, - ATTN_NORM, + Defines.ATTN_NORM, 0); - ent.pain_debounce_time= level.time + 1; + ent.pain_debounce_time= GameBase.level.time + 1; } - NoAmmoWeaponChange(ent); + GamePWeapon.NoAmmoWeaponChange(ent); } else { rotation= (float) ((ent.client.ps.gunframe - 5) * 2 * Math.PI / 6); offset[0]= (float) (-4 * Math.sin(rotation)); offset[1]= 0f; offset[2]= (float) (4 * Math.cos(rotation)); - + if ((ent.client.ps.gunframe == 6) || (ent.client.ps.gunframe == 9)) - effect= EF_HYPERBLASTER; + effect= Defines.EF_HYPERBLASTER; else effect= 0; - if (deathmatch.value != 0) + if (GameBase.deathmatch.value != 0) damage= 15; else damage= 20; - Blaster_Fire(ent, offset, damage, true, effect); - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + GamePWeapon.Blaster_Fire(ent, offset, damage, true, effect); + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index]--; - - ent.client.anim_priority= ANIM_ATTACK; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crattak1 - 1; - ent.client.anim_end= FRAME_crattak9; + + ent.client.anim_priority= Defines.ANIM_ATTACK; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crattak1 - 1; + ent.client.anim_end= M_Player.FRAME_crattak9; } else { - ent.s.frame= FRAME_attack1 - 1; - ent.client.anim_end= FRAME_attack8; + ent.s.frame= M_Player.FRAME_attack1 - 1; + ent.client.anim_end= M_Player.FRAME_attack8; } } - + ent.client.ps.gunframe++; if (ent.client.ps.gunframe == 12 && 0 != ent.client.pers.inventory[ent.client.ammo_index]) ent.client.ps.gunframe= 6; } - + if (ent.client.ps.gunframe == 12) { - gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0); + GameBase.gi.sound(ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("weapons/hyprbd1a.wav"), 1, Defines.ATTN_NORM, 0); ent.client.weapon_sound= 0; } - + return true; - + } }; - - static EntThinkAdapter Weapon_HyperBlaster= new EntThinkAdapter() { + public static EntThinkAdapter Weapon_HyperBlaster= new EntThinkAdapter() { public boolean think(edict_t ent) { - + int pause_frames[]= { 0 }; int fire_frames[]= { 6, 7, 8, 9, 10, 11, 0 }; - - Weapon_Generic(ent, 5, 20, 49, 53, pause_frames, fire_frames, Weapon_HyperBlaster_Fire); - return true; - } - }; - - /* - ====================================================================== - - MACHINEGUN / CHAINGUN - ====================================================================== - */ - - static EntThinkAdapter Machinegun_Fire= new EntThinkAdapter() { - - public boolean think(edict_t ent) { - - int i; - float[] start= { 0, 0, 0 }; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; - float[] angles= { 0, 0, 0 }; - int damage= 8; - int kick= 2; - float[] offset= { 0, 0, 0 }; - - if (0 == (ent.client.buttons & BUTTON_ATTACK)) { - ent.client.machinegun_shots= 0; - ent.client.ps.gunframe++; - return true; - } - - if (ent.client.ps.gunframe == 5) - ent.client.ps.gunframe= 4; - else - ent.client.ps.gunframe= 5; - - if (ent.client.pers.inventory[ent.client.ammo_index] < 1) { - ent.client.ps.gunframe= 6; - if (level.time >= ent.pain_debounce_time) { - gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); - ent.pain_debounce_time= level.time + 1; - } - NoAmmoWeaponChange(ent); - return true; - } - - if (is_quad) { - damage *= 4; - kick *= 4; - } - - for (i= 1; i < 3; i++) { - ent.client.kick_origin[i]= Lib.crandom() * 0.35f; - ent.client.kick_angles[i]= Lib.crandom() * 0.7f; - } - ent.client.kick_origin[0]= Lib.crandom() * 0.35f; - ent.client.kick_angles[0]= ent.client.machinegun_shots * -1.5f; - - // raise the gun as it is firing - if (0 == deathmatch.value) { - ent.client.machinegun_shots++; - if (ent.client.machinegun_shots > 9) - ent.client.machinegun_shots= 9; - } - - // get start / end positions - Math3D.VectorAdd(ent.client.v_angle, ent.client.kick_angles, angles); - Math3D.AngleVectors(angles, forward, right, null); - Math3D.VectorSet(offset, 0, 8, ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - Fire.fire_bullet( - ent, - start, - forward, - damage, - kick, - DEFAULT_BULLET_HSPREAD, - DEFAULT_BULLET_VSPREAD, - MOD_MACHINEGUN); - - gi.WriteByte(svc_muzzleflash); - //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_MACHINEGUN | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) - ent.client.pers.inventory[ent.client.ammo_index]--; - - ent.client.anim_priority= ANIM_ATTACK; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crattak1 - (int) (Lib.random() + 0.25); - ent.client.anim_end= FRAME_crattak9; - } else { - ent.s.frame= FRAME_attack1 - (int) (Lib.random() + 0.25); - ent.client.anim_end= FRAME_attack8; - } + GamePWeapon.Weapon_Generic(ent, 5, 20, 49, 53, pause_frames, fire_frames, Weapon_HyperBlaster_Fire); return true; } }; - - static EntThinkAdapter Weapon_Machinegun= new EntThinkAdapter() { + public static EntThinkAdapter Weapon_Machinegun= new EntThinkAdapter() { public boolean think(edict_t ent) { - + int pause_frames[]= { 23, 45, 0 }; int fire_frames[]= { 4, 5, 0 }; - - Weapon_Generic(ent, 3, 5, 45, 49, pause_frames, fire_frames, Machinegun_Fire); - return true; - } - }; - - static EntThinkAdapter Chaingun_Fire= new EntThinkAdapter() { - - public boolean think(edict_t ent) { - - int i; - int shots; - float[] start= { 0, 0, 0 }; - float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }, up= { 0, 0, 0 }; - float r, u; - float[] offset= { 0, 0, 0 }; - int damage; - int kick= 2; - - if (deathmatch.value != 0) - damage= 6; - else - damage= 8; - - if (ent.client.ps.gunframe == 5) - gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnu1a.wav"), 1, ATTN_IDLE, 0); - - if ((ent.client.ps.gunframe == 14) && 0 == (ent.client.buttons & BUTTON_ATTACK)) { - ent.client.ps.gunframe= 32; - ent.client.weapon_sound= 0; - return true; - } else if ( - (ent.client.ps.gunframe == 21) - && (ent.client.buttons & BUTTON_ATTACK) != 0 - && 0 != ent.client.pers.inventory[ent.client.ammo_index]) { - ent.client.ps.gunframe= 15; - } else { - ent.client.ps.gunframe++; - } - - if (ent.client.ps.gunframe == 22) { - ent.client.weapon_sound= 0; - gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnd1a.wav"), 1, ATTN_IDLE, 0); - } else { - ent.client.weapon_sound= gi.soundindex("weapons/chngnl1a.wav"); - } - - ent.client.anim_priority= ANIM_ATTACK; - if ((ent.client.ps.pmove.pm_flags & PMF_DUCKED) != 0) { - ent.s.frame= FRAME_crattak1 - (ent.client.ps.gunframe & 1); - ent.client.anim_end= FRAME_crattak9; - } else { - ent.s.frame= FRAME_attack1 - (ent.client.ps.gunframe & 1); - ent.client.anim_end= FRAME_attack8; - } - - if (ent.client.ps.gunframe <= 9) - shots= 1; - else if (ent.client.ps.gunframe <= 14) { - if ((ent.client.buttons & BUTTON_ATTACK) != 0) - shots= 2; - else - shots= 1; - } else - shots= 3; - - if (ent.client.pers.inventory[ent.client.ammo_index] < shots) - shots= ent.client.pers.inventory[ent.client.ammo_index]; - - if (0 == shots) { - if (level.time >= ent.pain_debounce_time) { - gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0); - ent.pain_debounce_time= level.time + 1; - } - NoAmmoWeaponChange(ent); - return true; - } - - if (is_quad) { - damage *= 4; - kick *= 4; - } - - for (i= 0; i < 3; i++) { - ent.client.kick_origin[i]= Lib.crandom() * 0.35f; - ent.client.kick_angles[i]= Lib.crandom() * 0.7f; - } - - for (i= 0; i < shots; i++) { - // get start / end positions - Math3D.AngleVectors(ent.client.v_angle, forward, right, up); - r= 7 + Lib.crandom() * 4; - u= Lib.crandom() * 4; - Math3D.VectorSet(offset, 0, r, u + ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - - Fire.fire_bullet( - ent, - start, - forward, - damage, - kick, - DEFAULT_BULLET_HSPREAD, - DEFAULT_BULLET_VSPREAD, - MOD_CHAINGUN); - } - - // send muzzle flash - gi.WriteByte(svc_muzzleflash); - //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte((MZ_CHAINGUN1 + shots - 1) | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) - ent.client.pers.inventory[ent.client.ammo_index] -= shots; - + + GamePWeapon.Weapon_Generic(ent, 3, 5, 45, 49, pause_frames, fire_frames, GamePWeapon.Machinegun_Fire); return true; } }; - - static EntThinkAdapter Weapon_Chaingun= new EntThinkAdapter() { + public static EntThinkAdapter Weapon_Chaingun= new EntThinkAdapter() { public boolean think(edict_t ent) { - + int pause_frames[]= { 38, 43, 51, 61, 0 }; int fire_frames[]= { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0 }; - - Weapon_Generic(ent, 4, 31, 61, 64, pause_frames, fire_frames, Chaingun_Fire); + + GamePWeapon.Weapon_Generic(ent, 4, 31, 61, 64, pause_frames, fire_frames, GamePWeapon.Chaingun_Fire); return true; } }; - /* ====================================================================== @@ -1128,36 +401,36 @@ public class GamePWeapon extends M_Player { ====================================================================== */ - - static EntThinkAdapter weapon_shotgun_fire= new EntThinkAdapter() { - + + public static EntThinkAdapter weapon_shotgun_fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + float[] start= { 0, 0, 0 }; float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; float[] offset= { 0, 0, 0 }; int damage= 4; int kick= 8; - + if (ent.client.ps.gunframe == 9) { ent.client.ps.gunframe++; return true; } - + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - + Math3D.VectorScale(forward, -2, ent.client.kick_origin); ent.client.kick_angles[0]= -2; - + Math3D.VectorSet(offset, 0, 8, ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - - if (is_quad) { + GamePWeapon.P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + + if (GamePWeapon.is_quad) { damage *= 4; kick *= 4; } - - if (deathmatch.value != 0) + + if (GameBase.deathmatch.value != 0) Fire.fire_shotgun( ent, start, @@ -1166,8 +439,8 @@ public class GamePWeapon extends M_Player { kick, 500, 500, - DEFAULT_DEATHMATCH_SHOTGUN_COUNT, - MOD_SHOTGUN); + Defines.DEFAULT_DEATHMATCH_SHOTGUN_COUNT, + Defines.MOD_SHOTGUN); else Fire.fire_shotgun( ent, @@ -1177,63 +450,61 @@ public class GamePWeapon extends M_Player { kick, 500, 500, - DEFAULT_SHOTGUN_COUNT, - MOD_SHOTGUN); - + Defines.DEFAULT_SHOTGUN_COUNT, + Defines.MOD_SHOTGUN); + // send muzzle flash - gi.WriteByte(svc_muzzleflash); + GameBase.gi.WriteByte(Defines.svc_muzzleflash); //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_SHOTGUN | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_SHOTGUN | GamePWeapon.is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + ent.client.ps.gunframe++; - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index]--; - + return true; } }; - - static EntThinkAdapter Weapon_Shotgun= new EntThinkAdapter() { + public static EntThinkAdapter Weapon_Shotgun= new EntThinkAdapter() { public boolean think(edict_t ent) { int pause_frames[]= { 22, 28, 34, 0 }; int fire_frames[]= { 8, 9, 0 }; - - Weapon_Generic(ent, 7, 18, 36, 39, pause_frames, fire_frames, weapon_shotgun_fire); + + GamePWeapon.Weapon_Generic(ent, 7, 18, 36, 39, pause_frames, fire_frames, weapon_shotgun_fire); return true; } }; - - static EntThinkAdapter weapon_supershotgun_fire= new EntThinkAdapter() { - + public static EntThinkAdapter weapon_supershotgun_fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + float[] start= { 0, 0, 0 }; float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; float[] offset= { 0, 0, 0 }; float[] v= { 0, 0, 0 }; int damage= 6; int kick= 12; - + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - + Math3D.VectorScale(forward, -2, ent.client.kick_origin); ent.client.kick_angles[0]= -2; - + Math3D.VectorSet(offset, 0, 8, ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); - - if (is_quad) { + GamePWeapon.P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + + if (GamePWeapon.is_quad) { damage *= 4; kick *= 4; } - - v[PITCH]= ent.client.v_angle[PITCH]; - v[YAW]= ent.client.v_angle[YAW] - 5; - v[ROLL]= ent.client.v_angle[ROLL]; + + v[Defines.PITCH]= ent.client.v_angle[Defines.PITCH]; + v[Defines.YAW]= ent.client.v_angle[Defines.YAW] - 5; + v[Defines.ROLL]= ent.client.v_angle[Defines.ROLL]; Math3D.AngleVectors(v, forward, null, null); Fire.fire_shotgun( ent, @@ -1241,11 +512,11 @@ public class GamePWeapon extends M_Player { forward, damage, kick, - DEFAULT_SHOTGUN_HSPREAD, - DEFAULT_SHOTGUN_VSPREAD, - DEFAULT_SSHOTGUN_COUNT / 2, - MOD_SSHOTGUN); - v[YAW]= ent.client.v_angle[YAW] + 5; + Defines.DEFAULT_SHOTGUN_HSPREAD, + Defines.DEFAULT_SHOTGUN_VSPREAD, + Defines.DEFAULT_SSHOTGUN_COUNT / 2, + Defines.MOD_SSHOTGUN); + v[Defines.YAW]= ent.client.v_angle[Defines.YAW] + 5; Math3D.AngleVectors(v, forward, null, null); Fire.fire_shotgun( ent, @@ -1253,39 +524,37 @@ public class GamePWeapon extends M_Player { forward, damage, kick, - DEFAULT_SHOTGUN_HSPREAD, - DEFAULT_SHOTGUN_VSPREAD, - DEFAULT_SSHOTGUN_COUNT / 2, - MOD_SSHOTGUN); - + Defines.DEFAULT_SHOTGUN_HSPREAD, + Defines.DEFAULT_SHOTGUN_VSPREAD, + Defines.DEFAULT_SSHOTGUN_COUNT / 2, + Defines.MOD_SSHOTGUN); + // send muzzle flash - gi.WriteByte(svc_muzzleflash); + GameBase.gi.WriteByte(Defines.svc_muzzleflash); //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_SSHOTGUN | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_SSHOTGUN | GamePWeapon.is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + ent.client.ps.gunframe++; - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index] -= 2; - + return true; } }; - - static EntThinkAdapter Weapon_SuperShotgun= new EntThinkAdapter() { + public static EntThinkAdapter Weapon_SuperShotgun= new EntThinkAdapter() { public boolean think(edict_t ent) { - + int pause_frames[]= { 29, 42, 57, 0 }; int fire_frames[]= { 7, 0 }; - - Weapon_Generic(ent, 6, 17, 57, 61, pause_frames, fire_frames, weapon_supershotgun_fire); + + GamePWeapon.Weapon_Generic(ent, 6, 17, 57, 61, pause_frames, fire_frames, weapon_supershotgun_fire); return true; } }; - /* ====================================================================== @@ -1293,66 +562,64 @@ public class GamePWeapon extends M_Player { ====================================================================== */ - static EntThinkAdapter weapon_railgun_fire= new EntThinkAdapter() { - + public static EntThinkAdapter weapon_railgun_fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + float[] start= { 0, 0, 0 }; float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; float[] offset= { 0, 0, 0 }; int damage; int kick; - - if (deathmatch.value != 0) { // normal damage is too extreme in dm + + if (GameBase.deathmatch.value != 0) { // normal damage is too extreme in dm damage= 100; kick= 200; } else { damage= 150; kick= 250; } - - if (is_quad) { + + if (GamePWeapon.is_quad) { damage *= 4; kick *= 4; } - + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - + Math3D.VectorScale(forward, -3, ent.client.kick_origin); ent.client.kick_angles[0]= -3; - + Math3D.VectorSet(offset, 0, 7, ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + GamePWeapon.P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); Fire.fire_rail(ent, start, forward, damage, kick); - + // send muzzle flash - gi.WriteByte(svc_muzzleflash); + GameBase.gi.WriteByte(Defines.svc_muzzleflash); //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_RAILGUN | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_RAILGUN | GamePWeapon.is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + ent.client.ps.gunframe++; - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index]--; - + return true; } }; - - static EntThinkAdapter Weapon_Railgun= new EntThinkAdapter() { - + public static EntThinkAdapter Weapon_Railgun= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + int pause_frames[]= { 56, 0 }; int fire_frames[]= { 4, 0 }; - Weapon_Generic(ent, 3, 18, 56, 61, pause_frames, fire_frames, weapon_railgun_fire); + GamePWeapon.Weapon_Generic(ent, 3, 18, 56, 61, pause_frames, fire_frames, weapon_railgun_fire); return true; } }; - /* ====================================================================== @@ -1360,78 +627,780 @@ public class GamePWeapon extends M_Player { ====================================================================== */ - - static EntThinkAdapter weapon_bfg_fire= new EntThinkAdapter() { - + + public static EntThinkAdapter weapon_bfg_fire= new EntThinkAdapter() { + public boolean think(edict_t ent) { - + float[] offset= { 0, 0, 0 }, start= { 0, 0, 0 }; float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; int damage; float damage_radius= 1000; - - if (deathmatch.value != 0) + + if (GameBase.deathmatch.value != 0) damage= 200; else damage= 500; - + if (ent.client.ps.gunframe == 9) { // send muzzle flash - gi.WriteByte(svc_muzzleflash); + GameBase.gi.WriteByte(Defines.svc_muzzleflash); //gi.WriteShort(ent - g_edicts); - gi.WriteShort(ent.index); - gi.WriteByte(MZ_BFG | is_silenced); - gi.multicast(ent.s.origin, MULTICAST_PVS); - + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_BFG | GamePWeapon.is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + ent.client.ps.gunframe++; - - PlayerNoise(ent, start, PNOISE_WEAPON); + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); return true; } - + // cells can go down during windup (from power armor hits), so // check again and abort firing if we don't have enough now if (ent.client.pers.inventory[ent.client.ammo_index] < 50) { ent.client.ps.gunframe++; return true; } - - if (is_quad) + + if (GamePWeapon.is_quad) damage *= 4; - + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); - + Math3D.VectorScale(forward, -2, ent.client.kick_origin); - + // make a big pitch kick with an inverse fall ent.client.v_dmg_pitch= -40; ent.client.v_dmg_roll= Lib.crandom() * 8; - ent.client.v_dmg_time= level.time + DAMAGE_TIME; - + ent.client.v_dmg_time= GameBase.level.time + Defines.DAMAGE_TIME; + Math3D.VectorSet(offset, 8, 8, ent.viewheight - 8); - P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + GamePWeapon.P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); Fire.fire_bfg(ent, start, forward, damage, 400, damage_radius); - + ent.client.ps.gunframe++; - - PlayerNoise(ent, start, PNOISE_WEAPON); - - if (0 == ((int) dmflags.value & DF_INFINITE_AMMO)) + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) ent.client.pers.inventory[ent.client.ammo_index] -= 50; - + return true; } }; - - static int pause_frames[]= { 39, 45, 50, 55, 0 }; - static int fire_frames[]= { 9, 17, 0 }; - - static EntThinkAdapter Weapon_BFG= new EntThinkAdapter() { - + public static EntThinkAdapter Weapon_BFG= new EntThinkAdapter() { public boolean think(edict_t ent) { - - Weapon_Generic(ent, 8, 32, 55, 58, pause_frames, fire_frames, weapon_bfg_fire); + + GamePWeapon.Weapon_Generic(ent, 8, 32, 55, 58, GamePWeapon.pause_frames, GamePWeapon.fire_frames, weapon_bfg_fire); + return true; + } + }; + public static boolean is_quad; + public static byte is_silenced; + public static EntInteractAdapter Pickup_Weapon= new EntInteractAdapter() { + public boolean interact(edict_t ent, edict_t other) { + int index; + gitem_t ammo; + + index= GameUtil.ITEM_INDEX(ent.item); + + if ((((int) (GameBase.dmflags.value) & Defines.DF_WEAPONS_STAY) != 0 || GameBase.coop.value != 0) + && 0 != other.client.pers.inventory[index]) { + if (0 == (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM))) + return false; // leave the weapon for others to pickup + } + + other.client.pers.inventory[index]++; + + if (0 == (ent.spawnflags & Defines.DROPPED_ITEM)) { + // give them some ammo with it + ammo= GameUtil.FindItem(ent.item.ammo); + if (((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO) != 0) + GameAI.Add_Ammo(other, ammo, 1000); + else + GameAI.Add_Ammo(other, ammo, ammo.quantity); + + if (0 == (ent.spawnflags & Defines.DROPPED_PLAYER_ITEM)) { + if (GameBase.deathmatch.value != 0) { + if (((int) (GameBase.dmflags.value) & Defines.DF_WEAPONS_STAY) != 0) + ent.flags |= Defines.FL_RESPAWN; + else + GameUtil.SetRespawn(ent, 30); + } + if (GameBase.coop.value != 0) + ent.flags |= Defines.FL_RESPAWN; + } + } + + if (other.client.pers.weapon != ent.item + && (other.client.pers.inventory[index] == 1) + && (0 == GameBase.deathmatch.value || other.client.pers.weapon == GameUtil.FindItem("blaster"))) + other.client.newweapon= ent.item; + + return true; + } + }; + /* + ================ + Use_Weapon + + Make the weapon ready if there is ammo + ================ + */ + public static ItemUseAdapter Use_Weapon= new ItemUseAdapter() { + + public void use(edict_t ent, gitem_t item) { + int ammo_index; + gitem_t ammo_item; + + // see if we're already using it + if (item == ent.client.pers.weapon) + return; + + if (item.ammo != null && 0 == GameBase.g_select_empty.value && 0 == (item.flags & Defines.IT_AMMO)) { + ammo_item= GameUtil.FindItem(item.ammo); + ammo_index= GameUtil.ITEM_INDEX(ammo_item); + + if (0 == ent.client.pers.inventory[ammo_index]) { + GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "No " + ammo_item.pickup_name + " for " + ".\n"); + return; + } + + if (ent.client.pers.inventory[ammo_index] < item.quantity) { + GameBase.gi.cprintf( + ent, + Defines.PRINT_HIGH, + "Not enough " + ammo_item.pickup_name + " for " + item.pickup_name + ".\n"); + return; + } + } + + // change to this weapon when down + ent.client.newweapon= item; + } + }; + /* + ================ + Drop_Weapon + ================ + */ + + public static ItemDropAdapter Drop_Weapon= new ItemDropAdapter() { + public void drop(edict_t ent, gitem_t item) { + int index; + + if (0 != ((int) (GameBase.dmflags.value) & Defines.DF_WEAPONS_STAY)) + return; + + index= GameUtil.ITEM_INDEX(item); + // see if we're already using it + if (((item == ent.client.pers.weapon) || (item == ent.client.newweapon)) + && (ent.client.pers.inventory[index] == 1)) { + GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Can't drop current weapon\n"); + return; + } + + GameUtil.Drop_Item(ent, item); + ent.client.pers.inventory[index]--; + } + }; + /* + ====================================================================== + + MACHINEGUN / CHAINGUN + + ====================================================================== + */ + + public static EntThinkAdapter Machinegun_Fire= new EntThinkAdapter() { + + public boolean think(edict_t ent) { + + int i; + float[] start= { 0, 0, 0 }; + float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; + float[] angles= { 0, 0, 0 }; + int damage= 8; + int kick= 2; + float[] offset= { 0, 0, 0 }; + + if (0 == (ent.client.buttons & Defines.BUTTON_ATTACK)) { + ent.client.machinegun_shots= 0; + ent.client.ps.gunframe++; + return true; + } + + if (ent.client.ps.gunframe == 5) + ent.client.ps.gunframe= 4; + else + ent.client.ps.gunframe= 5; + + if (ent.client.pers.inventory[ent.client.ammo_index] < 1) { + ent.client.ps.gunframe= 6; + if (GameBase.level.time >= ent.pain_debounce_time) { + GameBase.gi.sound(ent, Defines.CHAN_VOICE, GameBase.gi.soundindex("weapons/noammo.wav"), 1, Defines.ATTN_NORM, 0); + ent.pain_debounce_time= GameBase.level.time + 1; + } + NoAmmoWeaponChange(ent); + return true; + } + + if (is_quad) { + damage *= 4; + kick *= 4; + } + + for (i= 1; i < 3; i++) { + ent.client.kick_origin[i]= Lib.crandom() * 0.35f; + ent.client.kick_angles[i]= Lib.crandom() * 0.7f; + } + ent.client.kick_origin[0]= Lib.crandom() * 0.35f; + ent.client.kick_angles[0]= ent.client.machinegun_shots * -1.5f; + + // raise the gun as it is firing + if (0 == GameBase.deathmatch.value) { + ent.client.machinegun_shots++; + if (ent.client.machinegun_shots > 9) + ent.client.machinegun_shots= 9; + } + + // get start / end positions + Math3D.VectorAdd(ent.client.v_angle, ent.client.kick_angles, angles); + Math3D.AngleVectors(angles, forward, right, null); + Math3D.VectorSet(offset, 0, 8, ent.viewheight - 8); + P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + Fire.fire_bullet( + ent, + start, + forward, + damage, + kick, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, + Defines.MOD_MACHINEGUN); + + GameBase.gi.WriteByte(Defines.svc_muzzleflash); + //gi.WriteShort(ent - g_edicts); + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte(Defines.MZ_MACHINEGUN | is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) + ent.client.pers.inventory[ent.client.ammo_index]--; + + ent.client.anim_priority= Defines.ANIM_ATTACK; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crattak1 - (int) (Lib.random() + 0.25); + ent.client.anim_end= M_Player.FRAME_crattak9; + } else { + ent.s.frame= M_Player.FRAME_attack1 - (int) (Lib.random() + 0.25); + ent.client.anim_end= M_Player.FRAME_attack8; + } + return true; + } + }; + public static EntThinkAdapter Chaingun_Fire= new EntThinkAdapter() { + + public boolean think(edict_t ent) { + + int i; + int shots; + float[] start= { 0, 0, 0 }; + float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }, up= { 0, 0, 0 }; + float r, u; + float[] offset= { 0, 0, 0 }; + int damage; + int kick= 2; + + if (GameBase.deathmatch.value != 0) + damage= 6; + else + damage= 8; + + if (ent.client.ps.gunframe == 5) + GameBase.gi.sound(ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("weapons/chngnu1a.wav"), 1, Defines.ATTN_IDLE, 0); + + if ((ent.client.ps.gunframe == 14) && 0 == (ent.client.buttons & Defines.BUTTON_ATTACK)) { + ent.client.ps.gunframe= 32; + ent.client.weapon_sound= 0; + return true; + } else if ( + (ent.client.ps.gunframe == 21) + && (ent.client.buttons & Defines.BUTTON_ATTACK) != 0 + && 0 != ent.client.pers.inventory[ent.client.ammo_index]) { + ent.client.ps.gunframe= 15; + } else { + ent.client.ps.gunframe++; + } + + if (ent.client.ps.gunframe == 22) { + ent.client.weapon_sound= 0; + GameBase.gi.sound(ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("weapons/chngnd1a.wav"), 1, Defines.ATTN_IDLE, 0); + } else { + ent.client.weapon_sound= GameBase.gi.soundindex("weapons/chngnl1a.wav"); + } + + ent.client.anim_priority= Defines.ANIM_ATTACK; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crattak1 - (ent.client.ps.gunframe & 1); + ent.client.anim_end= M_Player.FRAME_crattak9; + } else { + ent.s.frame= M_Player.FRAME_attack1 - (ent.client.ps.gunframe & 1); + ent.client.anim_end= M_Player.FRAME_attack8; + } + + if (ent.client.ps.gunframe <= 9) + shots= 1; + else if (ent.client.ps.gunframe <= 14) { + if ((ent.client.buttons & Defines.BUTTON_ATTACK) != 0) + shots= 2; + else + shots= 1; + } else + shots= 3; + + if (ent.client.pers.inventory[ent.client.ammo_index] < shots) + shots= ent.client.pers.inventory[ent.client.ammo_index]; + + if (0 == shots) { + if (GameBase.level.time >= ent.pain_debounce_time) { + GameBase.gi.sound(ent, Defines.CHAN_VOICE, GameBase.gi.soundindex("weapons/noammo.wav"), 1, Defines.ATTN_NORM, 0); + ent.pain_debounce_time= GameBase.level.time + 1; + } + NoAmmoWeaponChange(ent); + return true; + } + + if (is_quad) { + damage *= 4; + kick *= 4; + } + + for (i= 0; i < 3; i++) { + ent.client.kick_origin[i]= Lib.crandom() * 0.35f; + ent.client.kick_angles[i]= Lib.crandom() * 0.7f; + } + + for (i= 0; i < shots; i++) { + // get start / end positions + Math3D.AngleVectors(ent.client.v_angle, forward, right, up); + r= 7 + Lib.crandom() * 4; + u= Lib.crandom() * 4; + Math3D.VectorSet(offset, 0, r, u + ent.viewheight - 8); + P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + + Fire.fire_bullet( + ent, + start, + forward, + damage, + kick, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, + Defines.MOD_CHAINGUN); + } + + // send muzzle flash + GameBase.gi.WriteByte(Defines.svc_muzzleflash); + //gi.WriteShort(ent - g_edicts); + GameBase.gi.WriteShort(ent.index); + GameBase.gi.WriteByte((Defines.MZ_CHAINGUN1 + shots - 1) | is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) + ent.client.pers.inventory[ent.client.ammo_index] -= shots; + return true; } }; + public static int pause_frames[]= { 39, 45, 50, 55, 0 }; + public static int fire_frames[]= { 9, 17, 0 }; + public static void P_ProjectSource( + gclient_t client, + float[] point, + float[] distance, + float[] forward, + float[] right, + float[] result) { + float[] _distance= { 0, 0, 0 }; + + Math3D.VectorCopy(distance, _distance); + if (client.pers.hand == Defines.LEFT_HANDED) + _distance[1] *= -1; + else if (client.pers.hand == Defines.CENTER_HANDED) + _distance[1]= 0; + Math3D.G_ProjectSource(point, _distance, forward, right, result); + } + /* + =============== + ChangeWeapon + + The old weapon has been dropped all the way, so make the new one + current + =============== + */ + public static void ChangeWeapon(edict_t ent) { + int i; + + if (ent.client.grenade_time != 0) { + ent.client.grenade_time= GameBase.level.time; + ent.client.weapon_sound= 0; + weapon_grenade_fire(ent, false); + ent.client.grenade_time= 0; + } + + ent.client.pers.lastweapon= ent.client.pers.weapon; + ent.client.pers.weapon= ent.client.newweapon; + ent.client.newweapon= null; + ent.client.machinegun_shots= 0; + + // set visible model + if (ent.s.modelindex == 255) { + if (ent.client.pers.weapon != null) + i= ((ent.client.pers.weapon.weapmodel & 0xff) << 8); + else + i= 0; + //ent.s.skinnum = (ent - g_edicts - 1) | i; + ent.s.skinnum= (ent.index - 1) | i; + } + + if (ent.client.pers.weapon != null && ent.client.pers.weapon.ammo != null) + ent.client.ammo_index= GameUtil.ITEM_INDEX(GameUtil.FindItem(ent.client.pers.weapon.ammo)); + else + ent.client.ammo_index= 0; + + if (ent.client.pers.weapon == null) { // dead + ent.client.ps.gunindex= 0; + return; + } + + ent.client.weaponstate= Defines.WEAPON_ACTIVATING; + ent.client.ps.gunframe= 0; + ent.client.ps.gunindex= GameBase.gi.modelindex(ent.client.pers.weapon.view_model); + + ent.client.anim_priority= Defines.ANIM_PAIN; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crpain1; + ent.client.anim_end= M_Player.FRAME_crpain4; + } else { + ent.s.frame= M_Player.FRAME_pain301; + ent.client.anim_end= M_Player.FRAME_pain304; + + } + } + /* + ================= + NoAmmoWeaponChange + ================= + */ + public static void NoAmmoWeaponChange(edict_t ent) { + if (0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("slugs"))] + && 0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("railgun"))]) { + ent.client.newweapon= GameUtil.FindItem("railgun"); + return; + } + if (0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("cells"))] + && 0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("hyperblaster"))]) { + ent.client.newweapon= GameUtil.FindItem("hyperblaster"); + return; + } + if (0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("bullets"))] + && 0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("chaingun"))]) { + ent.client.newweapon= GameUtil.FindItem("chaingun"); + return; + } + if (0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("bullets"))] + && 0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("machinegun"))]) { + ent.client.newweapon= GameUtil.FindItem("machinegun"); + return; + } + if (ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("shells"))] > 1 + && 0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("super shotgun"))]) { + ent.client.newweapon= GameUtil.FindItem("super shotgun"); + return; + } + if (0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("shells"))] + && 0 != ent.client.pers.inventory[GameUtil.ITEM_INDEX(GameUtil.FindItem("shotgun"))]) { + ent.client.newweapon= GameUtil.FindItem("shotgun"); + return; + } + ent.client.newweapon= GameUtil.FindItem("blaster"); + } + /* + ================= + Think_Weapon + + Called by ClientBeginServerFrame and ClientThink + ================= + */ + public static void Think_Weapon(edict_t ent) { + // if just died, put the weapon away + if (ent.health < 1) { + ent.client.newweapon= null; + ChangeWeapon(ent); + } + + // call active weapon think routine + if (null != ent.client.pers.weapon && null != ent.client.pers.weapon.weaponthink) { + is_quad= (ent.client.quad_framenum > GameBase.level.framenum); + if (ent.client.silencer_shots != 0) + is_silenced= (byte) Defines.MZ_SILENCED; + else + is_silenced= 0; + ent.client.pers.weapon.weaponthink.think(ent); + } + } + /* + ================ + Weapon_Generic + + A generic function to handle the basics of weapon thinking + ================ + */ + + public static void Weapon_Generic( + edict_t ent, + int FRAME_ACTIVATE_LAST, + int FRAME_FIRE_LAST, + int FRAME_IDLE_LAST, + int FRAME_DEACTIVATE_LAST, + int pause_frames[], + int fire_frames[], + EntThinkAdapter fire) { + int FRAME_FIRE_FIRST= (FRAME_ACTIVATE_LAST + 1); + int FRAME_IDLE_FIRST= (FRAME_FIRE_LAST + 1); + int FRAME_DEACTIVATE_FIRST= (FRAME_IDLE_LAST + 1); + + int n; + + if (ent.deadflag != 0 || ent.s.modelindex != 255) // VWep animations screw up corpses + { + return; + } + + if (ent.client.weaponstate == Defines.WEAPON_DROPPING) { + if (ent.client.ps.gunframe == FRAME_DEACTIVATE_LAST) { + ChangeWeapon(ent); + return; + } else if ((FRAME_DEACTIVATE_LAST - ent.client.ps.gunframe) == 4) { + ent.client.anim_priority= Defines.ANIM_REVERSE; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crpain4 + 1; + ent.client.anim_end= M_Player.FRAME_crpain1; + } else { + ent.s.frame= M_Player.FRAME_pain304 + 1; + ent.client.anim_end= M_Player.FRAME_pain301; + + } + } + + ent.client.ps.gunframe++; + return; + } + + if (ent.client.weaponstate == Defines.WEAPON_ACTIVATING) { + if (ent.client.ps.gunframe == FRAME_ACTIVATE_LAST) { + ent.client.weaponstate= Defines.WEAPON_READY; + ent.client.ps.gunframe= FRAME_IDLE_FIRST; + return; + } + + ent.client.ps.gunframe++; + return; + } + + if ((ent.client.newweapon != null) && (ent.client.weaponstate != Defines.WEAPON_FIRING)) { + ent.client.weaponstate= Defines.WEAPON_DROPPING; + ent.client.ps.gunframe= FRAME_DEACTIVATE_FIRST; + + if ((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4) { + ent.client.anim_priority= Defines.ANIM_REVERSE; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crpain4 + 1; + ent.client.anim_end= M_Player.FRAME_crpain1; + } else { + ent.s.frame= M_Player.FRAME_pain304 + 1; + ent.client.anim_end= M_Player.FRAME_pain301; + + } + } + return; + } + + if (ent.client.weaponstate == Defines.WEAPON_READY) { + if (((ent.client.latched_buttons | ent.client.buttons) & Defines.BUTTON_ATTACK) != 0) { + ent.client.latched_buttons &= ~Defines.BUTTON_ATTACK; + if ((0 != ent.client.ammo_index) + || (ent.client.pers.inventory[ent.client.ammo_index] + >= ent.client.pers.weapon.quantity)) { + ent.client.ps.gunframe= FRAME_FIRE_FIRST; + ent.client.weaponstate= Defines.WEAPON_FIRING; + + // start the animation + ent.client.anim_priority= Defines.ANIM_ATTACK; + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.s.frame= M_Player.FRAME_crattak1 - 1; + ent.client.anim_end= M_Player.FRAME_crattak9; + } else { + ent.s.frame= M_Player.FRAME_attack1 - 1; + ent.client.anim_end= M_Player.FRAME_attack8; + } + } else { + if (GameBase.level.time >= ent.pain_debounce_time) { + GameBase.gi.sound( + ent, + Defines.CHAN_VOICE, + GameBase.gi.soundindex("weapons/noammo.wav"), + 1, + Defines.ATTN_NORM, + 0); + ent.pain_debounce_time= GameBase.level.time + 1; + } + NoAmmoWeaponChange(ent); + } + } else { + if (ent.client.ps.gunframe == FRAME_IDLE_LAST) { + ent.client.ps.gunframe= FRAME_IDLE_FIRST; + return; + } + + if (pause_frames != null) { + for (n= 0; pause_frames[n] != 0; n++) { + if (ent.client.ps.gunframe == pause_frames[n]) { + if ((Lib.rand() & 15) != 0) + return; + } + } + } + + ent.client.ps.gunframe++; + return; + } + } + + if (ent.client.weaponstate == Defines.WEAPON_FIRING) { + for (n= 0; fire_frames[n] != 0; n++) { + if (ent.client.ps.gunframe == fire_frames[n]) { + if (ent.client.quad_framenum > GameBase.level.framenum) + GameBase.gi.sound( + ent, + Defines.CHAN_ITEM, + GameBase.gi.soundindex("items/damage3.wav"), + 1, + Defines.ATTN_NORM, + 0); + + fire.think(ent); + break; + } + } + + if (0 == fire_frames[n]) + ent.client.ps.gunframe++; + + if (ent.client.ps.gunframe == FRAME_IDLE_FIRST + 1) + ent.client.weaponstate= Defines.WEAPON_READY; + } + } + /* + ====================================================================== + + GRENADE + + ====================================================================== + */ + + public static void weapon_grenade_fire(edict_t ent, boolean held) { + float[] offset= { 0, 0, 0 }; + float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; + float[] start= { 0, 0, 0 }; + int damage= 125; + float timer; + int speed; + float radius; + + radius= damage + 40; + if (is_quad) + damage *= 4; + + Math3D.VectorSet(offset, 8, 8, ent.viewheight - 8); + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); + P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + + timer= ent.client.grenade_time - GameBase.level.time; + speed= + (int) (Defines.GRENADE_MINSPEED + + (Defines.GRENADE_TIMER - timer) * ((Defines.GRENADE_MAXSPEED - Defines.GRENADE_MINSPEED) / Defines.GRENADE_TIMER)); + Fire.fire_grenade2(ent, start, forward, damage, speed, timer, radius, held); + + if (0 == ((int) GameBase.dmflags.value & Defines.DF_INFINITE_AMMO)) + ent.client.pers.inventory[ent.client.ammo_index]--; + + ent.client.grenade_time= GameBase.level.time + 1.0f; + + if (ent.deadflag != 0 || ent.s.modelindex != 255) // VWep animations screw up corpses + { + return; + } + + if (ent.health <= 0) + return; + + if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0) { + ent.client.anim_priority= Defines.ANIM_ATTACK; + ent.s.frame= M_Player.FRAME_crattak1 - 1; + ent.client.anim_end= M_Player.FRAME_crattak3; + } else { + ent.client.anim_priority= Defines.ANIM_REVERSE; + ent.s.frame= M_Player.FRAME_wave08; + ent.client.anim_end= M_Player.FRAME_wave01; + } + } + /* + ====================================================================== + + BLASTER / HYPERBLASTER + + ====================================================================== + */ + + public static void Blaster_Fire( + edict_t ent, + float[] g_offset, + int damage, + boolean hyper, + int effect) { + float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 }; + float[] start= { 0, 0, 0 }; + float[] offset= { 0, 0, 0 }; + + if (is_quad) + damage *= 4; + Math3D.AngleVectors(ent.client.v_angle, forward, right, null); + Math3D.VectorSet(offset, 24, 8, ent.viewheight - 8); + Math3D.VectorAdd(offset, g_offset, offset); + P_ProjectSource(ent.client, ent.s.origin, offset, forward, right, start); + + Math3D.VectorScale(forward, -2, ent.client.kick_origin); + ent.client.kick_angles[0]= -1; + + Fire.fire_blaster(ent, start, forward, damage, 1000, effect, hyper); + + // send muzzle flash + GameBase.gi.WriteByte(Defines.svc_muzzleflash); + //gi.WriteShort(ent - g_edicts); + GameBase.gi.WriteShort(ent.index); + if (hyper) + GameBase.gi.WriteByte(Defines.MZ_HYPERBLASTER | is_silenced); + else + GameBase.gi.WriteByte(Defines.MZ_BLASTER | is_silenced); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + + GameWeapon.PlayerNoise(ent, start, Defines.PNOISE_WEAPON); + } } diff --git a/src/jake2/game/GameSpawn.java b/src/jake2/game/GameSpawn.java index 2966f06..edb8cab 100644 --- a/src/jake2/game/GameSpawn.java +++ b/src/jake2/game/GameSpawn.java @@ -19,42 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 18.11.2003 by RST. -// $Id: GameSpawn.java,v 1.1 2004-07-07 19:59:02 hzi Exp $ +// $Id: GameSpawn.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; +import jake2.Defines; import jake2.util.*; import jake2.qcommon.*; -import jake2.game.*; public class GameSpawn extends GameSave { - static EntThinkAdapter SP_item_health = new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_item_health(ent);return true;}}; - - static EntThinkAdapter SP_item_health_small = new EntThinkAdapter() {public boolean think(edict_t ent){ Game.SP_item_health_small(ent);return true;}}; - static EntThinkAdapter SP_item_health_large = new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_item_health_large(ent); return true;}}; - static EntThinkAdapter SP_item_health_mega = new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_item_health_mega(ent); return true;}}; - - static EntThinkAdapter SP_info_player_start = new EntThinkAdapter() {public boolean think(edict_t ent){ SP_info_player_start(ent);return true;}}; - static EntThinkAdapter SP_info_player_deathmatch = new EntThinkAdapter() {public boolean think(edict_t ent){ SP_info_player_deathmatch(ent);return true;}}; - static EntThinkAdapter SP_info_player_coop = new EntThinkAdapter() {public boolean think(edict_t ent){SP_info_player_coop(ent); return true;}}; - static EntThinkAdapter SP_info_player_intermission = new EntThinkAdapter() {public boolean think(edict_t ent){SP_info_player_intermission(); return true;}}; - - static EntThinkAdapter SP_func_plat = new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_func_plat(ent); return true;}}; - //static EntThinkAdapter SP_func_rotating = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_button = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_door = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_door_secret = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_door_rotating = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; - static EntThinkAdapter SP_func_water = new EntThinkAdapter() {public boolean think(edict_t ent){SP_func_water(ent); return true;}}; - static EntThinkAdapter SP_func_train = new EntThinkAdapter() {public boolean think(edict_t ent){SP_func_train(ent); return true;}}; -// static EntThinkAdapter SP_func_conveyor = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_wall = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_object = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_explosive = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_timer = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; -// static EntThinkAdapter SP_func_areaportal = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; - static EntThinkAdapter SP_func_clock = new EntThinkAdapter() {public boolean think(edict_t ent){SP_func_clock(ent); return true;}}; // static EntThinkAdapter SP_func_killbox = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; // // static EntThinkAdapter SP_trigger_always = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; @@ -157,7 +131,7 @@ public class GameSpawn extends GameSave { //String newb, new_p; int i, l; - l = Lib.strlen(string) + 1; + l = string.length() + 1; //newb = gi.TagMalloc(l, TAG_LEVEL); StringBuffer newb = new StringBuffer(l); @@ -194,6 +168,8 @@ public class GameSpawn extends GameSave { float v; float[] vec = { 0, 0, 0 }; + if (key.equals("nextmap")) + Com.p("nextmap: " + value); if (!st.set(key, value)) if (!ent.set(key, value)) gi.dprintf("??? The key [" + key + "] is not a field\n"); @@ -258,7 +234,8 @@ public class GameSpawn extends GameSave { String keyname; String com_token; init = false; - + + st = new spawn_temp_t(); while (true) { // parse key @@ -291,7 +268,9 @@ public class GameSpawn extends GameSave { } if (!init) - ent.clear(); + { + GameUtil.G_ClearEdict(ent); + } return; } @@ -344,9 +323,8 @@ public class GameSpawn extends GameSave { } } - } - - gi.dprintf("" + c + " teams with " + c2 + " entities\n"); + } + //gi.dprintf("" + c + " teams with " + c2 + " entities\n"); } /* @@ -377,7 +355,6 @@ public class GameSpawn extends GameSave { PlayerClient.SaveClientData(); //level.clear(); - Com.Printf("game.maxentities=" + game.maxentities + "\n"); level = new level_locals_t(); for (int n=0; n < game.maxentities; n++) { @@ -449,7 +426,7 @@ public class GameSpawn extends GameSave { ED_CallSpawn(ent); } - gi.dprintf("player skill level:" +skill.value + "\n"); + //gi.dprintf("player skill level:" +skill.value + "\n"); gi.dprintf(inhibit + " entities inhibited\n"); i = 1; G_FindTeams(); @@ -482,197 +459,32 @@ public class GameSpawn extends GameSave { +"if 16 " + "xv 0 " + "yb -68 " + "string \"Chasing\" " + "xv 64 " + "stat_string 16 " + "endif "; - /*QUAKED worldspawn (0 0 0) ? - - Only used for the world. - "sky" environment map name - "skyaxis" vector axis for rotating sky - "skyrotate" speed of rotation in degrees/second - "sounds" music cd track number - "gravity" 800 is default gravity - "message" text to print at user logon - */ - - static EntThinkAdapter SP_worldspawn = new EntThinkAdapter() { - - public boolean think(edict_t ent) { - ent.movetype = MOVETYPE_PUSH; - ent.solid = SOLID_BSP; - ent.inuse = true; - // since the world doesn't use G_Spawn() - ent.s.modelindex = 1; - // world model is always index 1 - //--------------- - // reserve some spots for dead player bodies for coop / deathmatch - InitBodyQue(); - // set configstrings for items - SetItemNames(); - if (st.nextmap != null) - level.nextmap = st.nextmap; - // make some data visible to the server - if (ent.message != null && ent.message.length() > 0) { - gi.configstring(CS_NAME, ent.message); - level.level_name = ent.message; - } - else - level.level_name = level.mapname; - if (st.sky != null && st.sky.length() > 0) - gi.configstring(CS_SKY, st.sky); - else - gi.configstring(CS_SKY, "unit1_"); - gi.configstring(CS_SKYROTATE, "" + st.skyrotate); - gi.configstring(CS_SKYAXIS, Lib.vtos(st.skyaxis)); - gi.configstring(CS_CDTRACK, "" + ent.sounds); - gi.configstring(CS_MAXCLIENTS, "" + (int) (maxclients.value)); - // status bar program - if (deathmatch.value != 0) - gi.configstring(CS_STATUSBAR, "" + dm_statusbar); - else - gi.configstring(CS_STATUSBAR, "" + single_statusbar); - //--------------- - // help icon for statusbar - gi.imageindex("i_help"); - level.pic_health = gi.imageindex("i_health"); - gi.imageindex("help"); - gi.imageindex("field_3"); - if (st.gravity != null) - gi.cvar_set("sv_gravity", "800"); - else - gi.cvar_set("sv_gravity", st.gravity); - snd_fry = gi.soundindex("player/fry.wav"); - // standing in lava / slime - PrecacheItem(FindItem("Blaster")); - gi.soundindex("player/lava1.wav"); - gi.soundindex("player/lava2.wav"); - gi.soundindex("misc/pc_up.wav"); - gi.soundindex("misc/talk1.wav"); - gi.soundindex("misc/udeath.wav"); - // gibs - gi.soundindex("items/respawn1.wav"); - // sexed sounds - gi.soundindex("*death1.wav"); - gi.soundindex("*death2.wav"); - gi.soundindex("*death3.wav"); - gi.soundindex("*death4.wav"); - gi.soundindex("*fall1.wav"); - gi.soundindex("*fall2.wav"); - gi.soundindex("*gurp1.wav"); - // drowning damage - gi.soundindex("*gurp2.wav"); - gi.soundindex("*jump1.wav"); - // player jump - gi.soundindex("*pain25_1.wav"); - gi.soundindex("*pain25_2.wav"); - gi.soundindex("*pain50_1.wav"); - gi.soundindex("*pain50_2.wav"); - gi.soundindex("*pain75_1.wav"); - gi.soundindex("*pain75_2.wav"); - gi.soundindex("*pain100_1.wav"); - gi.soundindex("*pain100_2.wav"); - // sexed models - // THIS ORDER MUST MATCH THE DEFINES IN g_local.h - // you can add more, max 15 - gi.modelindex("#w_blaster.md2"); - gi.modelindex("#w_shotgun.md2"); - gi.modelindex("#w_sshotgun.md2"); - gi.modelindex("#w_machinegun.md2"); - gi.modelindex("#w_chaingun.md2"); - gi.modelindex("#a_grenades.md2"); - gi.modelindex("#w_glauncher.md2"); - gi.modelindex("#w_rlauncher.md2"); - gi.modelindex("#w_hyperblaster.md2"); - gi.modelindex("#w_railgun.md2"); - gi.modelindex("#w_bfg.md2"); - //------------------- - gi.soundindex("player/gasp1.wav"); - // gasping for air - gi.soundindex("player/gasp2.wav"); - // head breaking surface, not gasping - gi.soundindex("player/watr_in.wav"); - // feet hitting water - gi.soundindex("player/watr_out.wav"); - // feet leaving water - gi.soundindex("player/watr_un.wav"); - // head going underwater - gi.soundindex("player/u_breath1.wav"); - gi.soundindex("player/u_breath2.wav"); - gi.soundindex("items/pkup.wav"); - // bonus item pickup - gi.soundindex("world/land.wav"); - // landing thud - gi.soundindex("misc/h2ohit1.wav"); - // landing splash - gi.soundindex("items/damage.wav"); - gi.soundindex("items/protect.wav"); - gi.soundindex("items/protect4.wav"); - gi.soundindex("weapons/noammo.wav"); - gi.soundindex("infantry/inflies1.wav"); - sm_meat_index = gi.modelindex("models/objects/gibs/sm_meat/tris.md2"); - gi.modelindex("models/objects/gibs/arm/tris.md2"); - gi.modelindex("models/objects/gibs/bone/tris.md2"); - gi.modelindex("models/objects/gibs/bone2/tris.md2"); - gi.modelindex("models/objects/gibs/chest/tris.md2"); - gi.modelindex("models/objects/gibs/skull/tris.md2"); - gi.modelindex("models/objects/gibs/head2/tris.md2"); - // - // Setup light animation tables. 'a' is total darkness, 'z' is doublebright. - // - // 0 normal - gi.configstring(CS_LIGHTS + 0, "m"); - // 1 FLICKER (first variety) - gi.configstring(CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo"); - // 2 SLOW STRONG PULSE - gi.configstring(CS_LIGHTS + 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); - // 3 CANDLE (first variety) - gi.configstring(CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); - // 4 FAST STROBE - gi.configstring(CS_LIGHTS + 4, "mamamamamama"); - // 5 GENTLE PULSE 1 - gi.configstring(CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); - // 6 FLICKER (second variety) - gi.configstring(CS_LIGHTS + 6, "nmonqnmomnmomomno"); - // 7 CANDLE (second variety) - gi.configstring(CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm"); - // 8 CANDLE (third variety) - gi.configstring(CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); - // 9 SLOW STROBE (fourth variety) - gi.configstring(CS_LIGHTS + 9, "aaaaaaaazzzzzzzz"); - // 10 FLUORESCENT FLICKER - gi.configstring(CS_LIGHTS + 10, "mmamammmmammamamaaamammma"); - // 11 SLOW PULSE NOT FADE TO BLACK - gi.configstring(CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); - // styles 32-62 are assigned by the light program for switchable lights - // 63 testing - gi.configstring(CS_LIGHTS + 63, "a"); - return true; - } - }; static spawn_t spawns[] = { - new spawn_t("item_health", SP_item_health), - new spawn_t("item_health_small", SP_item_health_small), - new spawn_t("item_health_large", SP_item_health_large), - new spawn_t("item_health_mega", SP_item_health_mega), - new spawn_t("info_player_start", SP_info_player_start), - new spawn_t("info_player_deathmatch", SP_info_player_deathmatch), - new spawn_t("info_player_coop", SP_info_player_coop), - new spawn_t("info_player_intermission", SP_info_player_intermission), - new spawn_t("func_plat", SP_func_plat), - new spawn_t("func_button", SP_func_button), - new spawn_t("func_door", SP_func_door), - new spawn_t("func_door_secret", SP_func_door_secret), - new spawn_t("func_door_rotating", SP_func_door_rotating), - new spawn_t("func_rotating", SP_func_rotating), - new spawn_t("func_train", SP_func_train), - new spawn_t("func_water", SP_func_water), - new spawn_t("func_conveyor", SP_func_conveyor), - new spawn_t("func_areaportal", SP_func_areaportal), - new spawn_t("func_clock", SP_func_clock), + new spawn_t("item_health", GameSpawnAdapters.SP_item_health), + new spawn_t("item_health_small", GameSpawnAdapters.SP_item_health_small), + new spawn_t("item_health_large", GameSpawnAdapters.SP_item_health_large), + new spawn_t("item_health_mega", GameSpawnAdapters.SP_item_health_mega), + new spawn_t("info_player_start", GameSpawnAdapters.SP_info_player_start), + new spawn_t("info_player_deathmatch", GameSpawnAdapters.SP_info_player_deathmatch), + new spawn_t("info_player_coop", GameSpawnAdapters.SP_info_player_coop), + new spawn_t("info_player_intermission", GameSpawnAdapters.SP_info_player_intermission), + new spawn_t("func_plat", GameSpawnAdapters.SP_func_plat), + new spawn_t("func_button", GameFuncAdapters.SP_func_button), + new spawn_t("func_door", GameFuncAdapters.SP_func_door), + new spawn_t("func_door_secret", GameFuncAdapters.SP_func_door_secret), + new spawn_t("func_door_rotating", GameFuncAdapters.SP_func_door_rotating), + new spawn_t("func_rotating", GameFuncAdapters.SP_func_rotating), + new spawn_t("func_train", GameSpawnAdapters.SP_func_train), + new spawn_t("func_water", GameSpawnAdapters.SP_func_water), + new spawn_t("func_conveyor", GameFuncAdapters.SP_func_conveyor), + new spawn_t("func_areaportal", GameMiscAdapters.SP_func_areaportal), + new spawn_t("func_clock", GameSpawnAdapters.SP_func_clock), new spawn_t("func_wall", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_func_wall(ent);return true;}}), new spawn_t("func_object", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_func_object(ent);return true;}}), new spawn_t("func_timer", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_func_timer(ent);return true;}}), new spawn_t("func_explosive", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_func_explosive(ent);return true;}}), - new spawn_t("func_killbox", SP_func_killbox), + new spawn_t("func_killbox", GameFuncAdapters.SP_func_killbox), new spawn_t("trigger_always", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_always(ent);return true;}}), new spawn_t("trigger_once", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_once(ent);return true;}}), new spawn_t("trigger_multiple", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_multiple(ent);return true;}}), @@ -681,7 +493,7 @@ public class GameSpawn extends GameSave { new spawn_t("trigger_hurt", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_hurt(ent);return true;}}), new spawn_t("trigger_key", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_key(ent);return true;}}), new spawn_t("trigger_counter", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_trigger_counter(ent);return true;}}), - new spawn_t("trigger_elevator", SP_trigger_elevator ), + new spawn_t("trigger_elevator", GameFuncAdapters.SP_trigger_elevator ), new spawn_t("trigger_gravity", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_gravity(ent);return true;}}), new spawn_t("trigger_monsterjump", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_trigger_monsterjump(ent);return true;}}), new spawn_t("target_temp_entity", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_target_temp_entity(ent);return true;}}), @@ -702,7 +514,7 @@ public class GameSpawn extends GameSave { new spawn_t("target_earthquake", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_target_earthquake(ent);return true;}}), new spawn_t("target_character", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_target_character(ent);return true;}}), new spawn_t("target_string", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_target_string(ent);return true;}}), - new spawn_t("worldspawn", SP_worldspawn ), + new spawn_t("worldspawn", GameSpawnAdapters.SP_worldspawn ), new spawn_t("viewthing", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_viewthing(ent);return true;}}), new spawn_t("light", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_light(ent);return true;}}), new spawn_t("light_mine1", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_light_mine1(ent);return true;}}), @@ -726,7 +538,7 @@ public class GameSpawn extends GameSave { new spawn_t("misc_bigviper", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_misc_bigviper(ent);return true;}}), new spawn_t("misc_strogg_ship", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_misc_strogg_ship(ent);return true;}}), new spawn_t("misc_teleporter", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_misc_teleporter(ent);return true;}}), - new spawn_t("misc_teleporter_dest", SP_misc_teleporter_dest ), + new spawn_t("misc_teleporter_dest", GameMiscAdapters.SP_misc_teleporter_dest ), new spawn_t("misc_blackhole", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_misc_blackhole(ent);return true;}}), new spawn_t("misc_eastertank", new EntThinkAdapter() {public boolean think(edict_t ent){Game. SP_misc_eastertank(ent);return true;}}), new spawn_t("misc_easterchick", new EntThinkAdapter() {public boolean think(edict_t ent){Game.SP_misc_easterchick(ent);return true;}}), @@ -735,9 +547,9 @@ public class GameSpawn extends GameSave { new spawn_t("monster_gladiator", new EntThinkAdapter() {public boolean think(edict_t ent){M_Gladiator.SP_monster_gladiator(ent);return true;}}), new spawn_t("monster_gunner", new EntThinkAdapter() {public boolean think(edict_t ent){M_Gunner.SP_monster_gunner(ent);return true;}}), new spawn_t("monster_infantry", new EntThinkAdapter() {public boolean think(edict_t ent){M_Infantry.SP_monster_infantry(ent);return true;}}), - new spawn_t("monster_soldier_light", M_Soldier.SP_monster_soldier_light), - new spawn_t("monster_soldier", M_Soldier.SP_monster_soldier), - new spawn_t("monster_soldier_ss", M_Soldier.SP_monster_soldier_ss), + new spawn_t("monster_soldier_light", M_SoldierAdapters.SP_monster_soldier_light), + new spawn_t("monster_soldier", M_SoldierAdapters.SP_monster_soldier), + new spawn_t("monster_soldier_ss", M_SoldierAdapters.SP_monster_soldier_ss), new spawn_t("monster_tank", M_Tank.SP_monster_tank), new spawn_t("monster_tank_commander", M_Tank.SP_monster_tank), new spawn_t("monster_medic", new EntThinkAdapter() {public boolean think(edict_t ent){M_Medic.SP_monster_medic(ent);return true;}}), @@ -776,21 +588,21 @@ public class GameSpawn extends GameSave { } // check item spawn functions for (i = 1; i < game.num_items; i++) { - item = itemlist[i]; + item = GameAI.itemlist[i]; if (item == null) gi.error("ED_CallSpawn: null item in pos " + i); if (item.classname == null) continue; - if (0 == Lib.strcmp(item.classname, ent.classname)) { // found it + if (0 == Lib.stricmp(item.classname, ent.classname)) { // found it SpawnItem(ent, item); return; } } // check normal spawn functions for (i=0; (s = spawns[i]) !=null && s.name != null; i++) { - if (0 == Lib.strcmp(s.name, ent.classname)) { // found it + if (0 == Lib.stricmp(s.name, ent.classname)) { // found it if (s.spawn == null) gi.error("ED_CallSpawn: null-spawn on index=" + i); diff --git a/src/jake2/game/GameSpawnAdapters.java b/src/jake2/game/GameSpawnAdapters.java new file mode 100644 index 0000000..0a8f06d --- /dev/null +++ b/src/jake2/game/GameSpawnAdapters.java @@ -0,0 +1,220 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameSpawnAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.Defines; +import jake2.util.*; +import jake2.qcommon.*; + +public class GameSpawnAdapters { + + static EntThinkAdapter SP_item_health = new EntThinkAdapter() {public boolean think(edict_t ent){GameAI.SP_item_health(ent);return true;}}; + static EntThinkAdapter SP_item_health_small = new EntThinkAdapter() {public boolean think(edict_t ent){ GameAI.SP_item_health_small(ent);return true;}}; + static EntThinkAdapter SP_item_health_large = new EntThinkAdapter() {public boolean think(edict_t ent){GameAI.SP_item_health_large(ent); return true;}}; + static EntThinkAdapter SP_item_health_mega = new EntThinkAdapter() {public boolean think(edict_t ent){GameAI.SP_item_health_mega(ent); return true;}}; + static EntThinkAdapter SP_info_player_start = new EntThinkAdapter() {public boolean think(edict_t ent){ PlayerClient.SP_info_player_start(ent);return true;}}; + static EntThinkAdapter SP_info_player_deathmatch = new EntThinkAdapter() {public boolean think(edict_t ent){ PlayerClient.SP_info_player_deathmatch(ent);return true;}}; + static EntThinkAdapter SP_info_player_coop = new EntThinkAdapter() {public boolean think(edict_t ent){PlayerClient.SP_info_player_coop(ent); return true;}}; + static EntThinkAdapter SP_info_player_intermission = new EntThinkAdapter() {public boolean think(edict_t ent){PlayerClient.SP_info_player_intermission(); return true;}}; + static EntThinkAdapter SP_func_plat = new EntThinkAdapter() {public boolean think(edict_t ent){GameFunc.SP_func_plat(ent); return true;}}; + //static EntThinkAdapter SP_func_rotating = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_button = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_door = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_door_secret = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_door_rotating = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + static EntThinkAdapter SP_func_water = new EntThinkAdapter() {public boolean think(edict_t ent){GameFunc.SP_func_water(ent); return true;}}; + static EntThinkAdapter SP_func_train = new EntThinkAdapter() {public boolean think(edict_t ent){GameFunc.SP_func_train(ent); return true;}}; + // static EntThinkAdapter SP_func_conveyor = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_wall = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_object = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_explosive = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_timer = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + // static EntThinkAdapter SP_func_areaportal = new EntThinkAdapter() {public boolean think(edict_t ent){ return true;}}; + static EntThinkAdapter SP_func_clock = new EntThinkAdapter() {public boolean think(edict_t ent){GameMisc.SP_func_clock(ent); return true;}}; + /*QUAKED worldspawn (0 0 0) ? + + Only used for the world. + "sky" environment map name + "skyaxis" vector axis for rotating sky + "skyrotate" speed of rotation in degrees/second + "sounds" music cd track number + "gravity" 800 is default gravity + "message" text to print at user logon + */ + + static EntThinkAdapter SP_worldspawn = new EntThinkAdapter() { + + public boolean think(edict_t ent) { + ent.movetype = Defines.MOVETYPE_PUSH; + ent.solid = Defines.SOLID_BSP; + ent.inuse = true; + // since the world doesn't use G_Spawn() + ent.s.modelindex = 1; + // world model is always index 1 + //--------------- + // reserve some spots for dead player bodies for coop / deathmatch + PlayerClient.InitBodyQue(); + // set configstrings for items + GameAI.SetItemNames(); + if (GameBase.st.nextmap != null) + GameBase.level.nextmap = GameBase.st.nextmap; + // make some data visible to the server + if (ent.message != null && ent.message.length() > 0) { + GameBase.gi.configstring(Defines.CS_NAME, ent.message); + GameBase.level.level_name = ent.message; + } + else + GameBase.level.level_name = GameBase.level.mapname; + if (GameBase.st.sky != null && GameBase.st.sky.length() > 0) + GameBase.gi.configstring(Defines.CS_SKY, GameBase.st.sky); + else + GameBase.gi.configstring(Defines.CS_SKY, "unit1_"); + GameBase.gi.configstring(Defines.CS_SKYROTATE, "" + GameBase.st.skyrotate); + GameBase.gi.configstring(Defines.CS_SKYAXIS, Lib.vtos(GameBase.st.skyaxis)); + GameBase.gi.configstring(Defines.CS_CDTRACK, "" + ent.sounds); + GameBase.gi.configstring(Defines.CS_MAXCLIENTS, "" + (int) (GameBase.maxclients.value)); + // status bar program + if (GameBase.deathmatch.value != 0) + GameBase.gi.configstring(Defines.CS_STATUSBAR, "" + GameSpawn.dm_statusbar); + else + GameBase.gi.configstring(Defines.CS_STATUSBAR, "" + GameSpawn.single_statusbar); + //--------------- + // help icon for statusbar + GameBase.gi.imageindex("i_help"); + GameBase.level.pic_health = GameBase.gi.imageindex("i_health"); + GameBase.gi.imageindex("help"); + GameBase.gi.imageindex("field_3"); + if (GameBase.st.gravity != null) + GameBase.gi.cvar_set("sv_gravity", "800"); + else + GameBase.gi.cvar_set("sv_gravity", GameBase.st.gravity); + GameBase.snd_fry = GameBase.gi.soundindex("player/fry.wav"); + // standing in lava / slime + GameAI.PrecacheItem(GameUtil.FindItem("Blaster")); + GameBase.gi.soundindex("player/lava1.wav"); + GameBase.gi.soundindex("player/lava2.wav"); + GameBase.gi.soundindex("misc/pc_up.wav"); + GameBase.gi.soundindex("misc/talk1.wav"); + GameBase.gi.soundindex("misc/udeath.wav"); + // gibs + GameBase.gi.soundindex("items/respawn1.wav"); + // sexed sounds + GameBase.gi.soundindex("*death1.wav"); + GameBase.gi.soundindex("*death2.wav"); + GameBase.gi.soundindex("*death3.wav"); + GameBase.gi.soundindex("*death4.wav"); + GameBase.gi.soundindex("*fall1.wav"); + GameBase.gi.soundindex("*fall2.wav"); + GameBase.gi.soundindex("*gurp1.wav"); + // drowning damage + GameBase.gi.soundindex("*gurp2.wav"); + GameBase.gi.soundindex("*jump1.wav"); + // player jump + GameBase.gi.soundindex("*pain25_1.wav"); + GameBase.gi.soundindex("*pain25_2.wav"); + GameBase.gi.soundindex("*pain50_1.wav"); + GameBase.gi.soundindex("*pain50_2.wav"); + GameBase.gi.soundindex("*pain75_1.wav"); + GameBase.gi.soundindex("*pain75_2.wav"); + GameBase.gi.soundindex("*pain100_1.wav"); + GameBase.gi.soundindex("*pain100_2.wav"); + // sexed models + // THIS ORDER MUST MATCH THE DEFINES IN g_local.h + // you can add more, max 15 + GameBase.gi.modelindex("#w_blaster.md2"); + GameBase.gi.modelindex("#w_shotgun.md2"); + GameBase.gi.modelindex("#w_sshotgun.md2"); + GameBase.gi.modelindex("#w_machinegun.md2"); + GameBase.gi.modelindex("#w_chaingun.md2"); + GameBase.gi.modelindex("#a_grenades.md2"); + GameBase.gi.modelindex("#w_glauncher.md2"); + GameBase.gi.modelindex("#w_rlauncher.md2"); + GameBase.gi.modelindex("#w_hyperblaster.md2"); + GameBase.gi.modelindex("#w_railgun.md2"); + GameBase.gi.modelindex("#w_bfg.md2"); + //------------------- + GameBase.gi.soundindex("player/gasp1.wav"); + // gasping for air + GameBase.gi.soundindex("player/gasp2.wav"); + // head breaking surface, not gasping + GameBase.gi.soundindex("player/watr_in.wav"); + // feet hitting water + GameBase.gi.soundindex("player/watr_out.wav"); + // feet leaving water + GameBase.gi.soundindex("player/watr_un.wav"); + // head going underwater + GameBase.gi.soundindex("player/u_breath1.wav"); + GameBase.gi.soundindex("player/u_breath2.wav"); + GameBase.gi.soundindex("items/pkup.wav"); + // bonus item pickup + GameBase.gi.soundindex("world/land.wav"); + // landing thud + GameBase.gi.soundindex("misc/h2ohit1.wav"); + // landing splash + GameBase.gi.soundindex("items/damage.wav"); + GameBase.gi.soundindex("items/protect.wav"); + GameBase.gi.soundindex("items/protect4.wav"); + GameBase.gi.soundindex("weapons/noammo.wav"); + GameBase.gi.soundindex("infantry/inflies1.wav"); + GameBase.sm_meat_index = GameBase.gi.modelindex("models/objects/gibs/sm_meat/tris.md2"); + GameBase.gi.modelindex("models/objects/gibs/arm/tris.md2"); + GameBase.gi.modelindex("models/objects/gibs/bone/tris.md2"); + GameBase.gi.modelindex("models/objects/gibs/bone2/tris.md2"); + GameBase.gi.modelindex("models/objects/gibs/chest/tris.md2"); + GameBase.gi.modelindex("models/objects/gibs/skull/tris.md2"); + GameBase.gi.modelindex("models/objects/gibs/head2/tris.md2"); + // + // Setup light animation tables. 'a' is total darkness, 'z' is doublebright. + // + // 0 normal + GameBase.gi.configstring(Defines.CS_LIGHTS + 0, "m"); + // 1 FLICKER (first variety) + GameBase.gi.configstring(Defines.CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo"); + // 2 SLOW STRONG PULSE + GameBase.gi.configstring(Defines.CS_LIGHTS + 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); + // 3 CANDLE (first variety) + GameBase.gi.configstring(Defines.CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); + // 4 FAST STROBE + GameBase.gi.configstring(Defines.CS_LIGHTS + 4, "mamamamamama"); + // 5 GENTLE PULSE 1 + GameBase.gi.configstring(Defines.CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); + // 6 FLICKER (second variety) + GameBase.gi.configstring(Defines.CS_LIGHTS + 6, "nmonqnmomnmomomno"); + // 7 CANDLE (second variety) + GameBase.gi.configstring(Defines.CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm"); + // 8 CANDLE (third variety) + GameBase.gi.configstring(Defines.CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); + // 9 SLOW STROBE (fourth variety) + GameBase.gi.configstring(Defines.CS_LIGHTS + 9, "aaaaaaaazzzzzzzz"); + // 10 FLUORESCENT FLICKER + GameBase.gi.configstring(Defines.CS_LIGHTS + 10, "mmamammmmammamamaaamammma"); + // 11 SLOW PULSE NOT FADE TO BLACK + GameBase.gi.configstring(Defines.CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); + // styles 32-62 are assigned by the light program for switchable lights + // 63 testing + GameBase.gi.configstring(Defines.CS_LIGHTS + 63, "a"); + return true; + } + }; +} diff --git a/src/jake2/game/GameTarget.java b/src/jake2/game/GameTarget.java index c28e1d3..8a13ade 100644 --- a/src/jake2/game/GameTarget.java +++ b/src/jake2/game/GameTarget.java @@ -19,77 +19,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.12.2003 by RST. -// $Id: GameTarget.java,v 1.1 2004-07-07 19:59:03 hzi Exp $ +// $Id: GameTarget.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; import jake2.*; import jake2.client.*; -import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.server.*; +import jake2.util.Lib; +import jake2.util.Math3D; public class GameTarget extends GameTurret { - /*QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8) - Fire an origin based temp entity event to the clients. - "style" type byte - */ - public static EntUseAdapter Use_Target_Tent = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - gi.WriteByte(svc_temp_entity); - gi.WriteByte(ent.style); - gi.WritePosition(ent.s.origin); - gi.multicast(ent.s.origin, MULTICAST_PVS); - } - }; - public static void SP_target_temp_entity(edict_t ent) { - ent.use = Use_Target_Tent; + ent.use = GameTargetAdapters.Use_Target_Tent; } - //========================================================== - - //========================================================== - - /*QUAKED target_speaker (1 0 0) (-8 -8 -8) (8 8 8) looped-on looped-off reliable - "noise" wav file to play - "attenuation" - -1 = none, send to whole level - 1 = normal fighting sounds - 2 = idle sound level - 3 = ambient sound level - "volume" 0.0 to 1.0 - - Normal sounds play each time the target is used. The reliable flag can be set for crucial voiceovers. - - Looped sounds are always atten 3 / vol 1, and the use function toggles it on/off. - Multiple identical looping sounds will just increase volume without any speed cost. - */ - public static EntUseAdapter Use_Target_Speaker = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - int chan; - - if ((ent.spawnflags & 3) != 0) { // looping sound toggles - if (ent.s.sound != 0) - ent.s.sound = 0; // turn it off - else - ent.s.sound = ent.noise_index; // start it - } - else { // normal sound - if ((ent.spawnflags & 4) != 0) - chan = CHAN_VOICE | CHAN_RELIABLE; - else - chan = CHAN_VOICE; - // use a positioned_sound, because this entity won't normally be - // sent to any clients because it is invisible - gi.positioned_sound(ent.s.origin, ent, chan, ent.noise_index, ent.volume, ent.attenuation, 0); - } - - } - }; - public static void SP_target_speaker(edict_t ent) { //char buffer[MAX_QPATH]; String buffer; @@ -119,28 +66,13 @@ public class GameTarget extends GameTurret { if ((ent.spawnflags & 1) != 0) ent.s.sound = ent.noise_index; - ent.use = Use_Target_Speaker; + ent.use = GameTargetAdapters.Use_Target_Speaker; // must link the entity so we get areas and clusters so // the server can determine who to send updates to gi.linkentity(ent); } - //========================================================== - public static EntUseAdapter Use_Target_Help = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - - if ((ent.spawnflags & 1) != 0) - //strncpy(game.helpmessage1, ent.message, sizeof(game.helpmessage2) - 1); - ent.message = game.helpmessage1; - else - //strncpy(game.helpmessage2, ent.message, sizeof(game.helpmessage1) - 1); - ent.message = game.helpmessage2; - - game.helpchanged++; - } - }; - /*QUAKED target_help (1 0 1) (-16 -16 -24) (16 16 24) help1 When fired, the "message" key becomes the current personal computer string, and the message light will be set on all clients status bars. */ @@ -155,33 +87,16 @@ public class GameTarget extends GameTurret { G_FreeEdict(ent); return; } - ent.use = Use_Target_Help; + ent.use = GameTargetAdapters.Use_Target_Help; } - //========================================================== - - /*QUAKED target_secret (1 0 1) (-8 -8 -8) (8 8 8) - Counts a secret found. - These are single use targets. - */ - static EntUseAdapter use_target_secret = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - gi.sound(ent, CHAN_VOICE, ent.noise_index, 1, ATTN_NORM, 0); - - level.found_secrets++; - - G_UseTargets(ent, activator); - G_FreeEdict(ent); - } - }; - public static void SP_target_secret(edict_t ent) { if (deathmatch.value != 0) { // auto-remove for deathmatch G_FreeEdict(ent); return; } - ent.use = use_target_secret; + ent.use = GameTargetAdapters.use_target_secret; if (st.noise == null) st.noise = "misc/secret.wav"; ent.noise_index = gi.soundindex(st.noise); @@ -192,33 +107,13 @@ public class GameTarget extends GameTurret { ent.message = "You have found a secret area."; } - //========================================================== - - /*QUAKED target_goal (1 0 1) (-8 -8 -8) (8 8 8) - Counts a goal completed. - These are single use targets. - */ - static EntUseAdapter use_target_goal = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - gi.sound(ent, CHAN_VOICE, ent.noise_index, 1, ATTN_NORM, 0); - - level.found_goals++; - - if (level.found_goals == level.total_goals) - gi.configstring(CS_CDTRACK, "0"); - - G_UseTargets(ent, activator); - G_FreeEdict(ent); - } - }; - public static void SP_target_goal(edict_t ent) { if (deathmatch.value != 0) { // auto-remove for deathmatch G_FreeEdict(ent); return; } - ent.use = use_target_goal; + ent.use = GameTargetAdapters.use_target_goal; if (st.noise == null) st.noise = "misc/secret.wav"; ent.noise_index = gi.soundindex(st.noise); @@ -226,89 +121,11 @@ public class GameTarget extends GameTurret { level.total_goals++; } - //========================================================== - - /*QUAKED target_explosion (1 0 0) (-8 -8 -8) (8 8 8) - Spawns an explosion temporary entity when used. - - "delay" wait this long before going off - "dmg" how much radius damage should be done, defaults to 0 - */ - static EntThinkAdapter target_explosion_explode = new EntThinkAdapter() { - public boolean think(edict_t self) { - - float save; - - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_EXPLOSION1); - gi.WritePosition(self.s.origin); - gi.multicast(self.s.origin, MULTICAST_PHS); - - T_RadiusDamage(self, self.activator, self.dmg, null, self.dmg + 40, MOD_EXPLOSIVE); - - save = self.delay; - self.delay = 0; - G_UseTargets(self, self.activator); - self.delay = save; - return true; - } - }; - - static EntUseAdapter use_target_explosion = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.activator = activator; - - if (0 == self.delay) { - target_explosion_explode.think(self); - return; - } - - self.think = target_explosion_explode; - self.nextthink = level.time + self.delay; - } - }; - public static void SP_target_explosion(edict_t ent) { - ent.use = use_target_explosion; + ent.use = GameTargetAdapters.use_target_explosion; ent.svflags = SVF_NOCLIENT; } - //========================================================== - - /*QUAKED target_changelevel (1 0 0) (-8 -8 -8) (8 8 8) - Changes level to "map" when fired - */ - static EntUseAdapter use_target_changelevel = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - if (level.intermissiontime != 0) - return; // already activated - - if (0 == deathmatch.value && 0 == coop.value) { - if (g_edicts[1].health <= 0) - return; - } - - // if noexit, do a ton of damage to other - if (deathmatch.value != 0 && 0 == ((int) dmflags.value & DF_ALLOW_EXIT) && other != g_edicts[0] /*world*/ - ) { - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, 10 * other.max_health, 1000, 0, MOD_EXIT); - return; - } - - // if multiplayer, let everyone know who hit the exit - if (deathmatch.value != 0) { - if (activator != null && activator.client != null) - gi.bprintf(PRINT_HIGH, activator.client.pers.netname + " exited the level.\n"); - } - - // if going to a new unit, clear cross triggers - if (self.map.indexOf('*') > -1) - game.serverflags &= ~(SFL_CROSS_TRIGGER_MASK); - - PlayerHud.BeginIntermission(self); - } - }; - public static void SP_target_changelevel(edict_t ent) { if (ent.map == null) { gi.dprintf("target_changelevel with no map at " + vtos(ent.s.origin) + "\n"); @@ -320,44 +137,12 @@ public class GameTarget extends GameTurret { if ((Q_stricmp(level.mapname, "fact1") == 0) && (Q_stricmp(ent.map, "fact3") == 0)) ent.map = "fact3$secret1"; - ent.use = use_target_changelevel; + ent.use = GameTargetAdapters.use_target_changelevel; ent.svflags = SVF_NOCLIENT; } - //========================================================== - - /*QUAKED target_splash (1 0 0) (-8 -8 -8) (8 8 8) - Creates a particle splash effect when used. - - Set "sounds" to one of the following: - 1) sparks - 2) blue water - 3) brown water - 4) slime - 5) lava - 6) blood - - "count" how many pixels in the splash - "dmg" if set, does a radius damage at this location when it splashes - useful for lava/sparks - */ - static EntUseAdapter use_target_splash = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_SPLASH); - gi.WriteByte(self.count); - gi.WritePosition(self.s.origin); - gi.WriteDir(self.movedir); - gi.WriteByte(self.sounds); - gi.multicast(self.s.origin, MULTICAST_PVS); - - if (self.dmg != 0) - T_RadiusDamage(self, activator, self.dmg, null, self.dmg + 40, MOD_SPLASH); - } - }; - public static void SP_target_splash(edict_t self) { - self.use = use_target_splash; + self.use = GameTargetAdapters.use_target_splash; G_SetMovedir(self.s.angles, self.movedir); if (0 == self.count) @@ -366,40 +151,8 @@ public class GameTarget extends GameTurret { self.svflags = SVF_NOCLIENT; } - //========================================================== - - /*QUAKED target_spawner (1 0 0) (-8 -8 -8) (8 8 8) - Set target to the type of entity you want spawned. - Useful for spawning monsters and gibs in the factory levels. - - For monsters: - Set direction to the facing you want it to have. - - For gibs: - Set direction if you want it moving and - speed how fast it should be moving otherwise it - will just be dropped - */ - - static EntUseAdapter use_target_spawner = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - edict_t ent; - - ent = G_Spawn(); - ent.classname = self.target; - VectorCopy(self.s.origin, ent.s.origin); - VectorCopy(self.s.angles, ent.s.angles); - GameSpawn.ED_CallSpawn(ent); - gi.unlinkentity(ent); - KillBox(ent); - gi.linkentity(ent); - if (self.speed != 0) - VectorCopy(self.movedir, ent.velocity); - } - }; - public static void SP_target_spawner(edict_t self) { - self.use = use_target_spawner; + self.use = GameTargetAdapters.use_target_spawner; self.svflags = SVF_NOCLIENT; if (self.speed != 0) { G_SetMovedir(self.s.angles, self.movedir); @@ -407,34 +160,8 @@ public class GameTarget extends GameTurret { } } - //========================================================== - - /*QUAKED target_blaster (1 0 0) (-8 -8 -8) (8 8 8) NOTRAIL NOEFFECTS - Fires a blaster bolt in the set direction when triggered. - - dmg default is 15 - speed default is 1000 - */ - public static EntUseAdapter use_target_blaster = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - int effect; - - if ((self.spawnflags & 2) != 0) - effect = 0; - else if ((self.spawnflags & 1) != 0) - effect = EF_HYPERBLASTER; - else - effect = EF_BLASTER; - - Fire.fire_blaster(self, self.s.origin, self.movedir, self.dmg, (int) self.speed, EF_BLASTER, MOD_TARGET_BLASTER != 0 - /*true*/ - ); - gi.sound(self, CHAN_VOICE, self.noise_index, 1, ATTN_NORM, 0); - } - }; - public static void SP_target_blaster(edict_t self) { - self.use = use_target_blaster; + self.use = GameTargetAdapters.use_target_blaster; G_SetMovedir(self.s.angles, self.movedir); self.noise_index = gi.soundindex("weapons/laser2.wav"); @@ -446,134 +173,26 @@ public class GameTarget extends GameTurret { self.svflags = SVF_NOCLIENT; } - //========================================================== - - /*QUAKED target_crosslevel_trigger (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1 trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 - Once this trigger is touched/used, any trigger_crosslevel_target with the same trigger number is automatically used when a level is started within the same unit. It is OK to check multiple triggers. Message, delay, target, and killtarget also work. - */ - public static EntUseAdapter trigger_crosslevel_trigger_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - game.serverflags |= self.spawnflags; - G_FreeEdict(self); - } - }; - public static void SP_target_crosslevel_trigger(edict_t self) { self.svflags = SVF_NOCLIENT; - self.use = trigger_crosslevel_trigger_use; + self.use = GameTargetAdapters.trigger_crosslevel_trigger_use; } - /*QUAKED target_crosslevel_target (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1 trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 - Triggered by a trigger_crosslevel elsewhere within a unit. If multiple triggers are checked, all must be true. Delay, target and - killtarget also work. - - "delay" delay before using targets if the trigger has been activated (default 1) - */ - static EntThinkAdapter target_crosslevel_target_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.spawnflags == (game.serverflags & SFL_CROSS_TRIGGER_MASK & self.spawnflags)) { - G_UseTargets(self, self); - G_FreeEdict(self); - } - return true; - } - }; - public static void SP_target_crosslevel_target(edict_t self) { if (0 == self.delay) self.delay = 1; self.svflags = SVF_NOCLIENT; - self.think = target_crosslevel_target_think; + self.think = GameTargetAdapters.target_crosslevel_target_think; self.nextthink = level.time + self.delay; } - //========================================================== - - /*QUAKED target_laser (0 .5 .8) (-8 -8 -8) (8 8 8) START_ON RED GREEN BLUE YELLOW ORANGE FAT - When triggered, fires a laser. You can either set a target - or a direction. - */ - public static EntThinkAdapter target_laser_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - edict_t ignore; - float[] start = { 0, 0, 0 }; - float[] end = { 0, 0, 0 }; - trace_t tr; - float[] point = { 0, 0, 0 }; - float[] last_movedir = { 0, 0, 0 }; - int count; - - if ((self.spawnflags & 0x80000000) != 0) - count = 8; - else - count = 4; - - if (self.enemy != null) { - VectorCopy(self.movedir, last_movedir); - VectorMA(self.enemy.absmin, 0.5f, self.enemy.size, point); - VectorSubtract(point, self.s.origin, self.movedir); - VectorNormalize(self.movedir); - if (0 == VectorCompare(self.movedir, last_movedir)) - self.spawnflags |= 0x80000000; - } - - ignore = self; - VectorCopy(self.s.origin, start); - VectorMA(start, 2048, self.movedir, end); - while (true) { - tr = gi.trace(start, null, null, end, ignore, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER); - - if (tr.ent == null) - break; - - // hurt it if we can - if ((tr.ent.takedamage != 0) && 0 == (tr.ent.flags & FL_IMMUNE_LASER)) - T_Damage( - tr.ent, - self, - self.activator, - self.movedir, - tr.endpos, - vec3_origin, - self.dmg, - 1, - DAMAGE_ENERGY, - MOD_TARGET_LASER); - - // if we hit something that's not a monster or player or is immune to lasers, we're done - if (0 == (tr.ent.svflags & SVF_MONSTER) && (null == tr.ent.client)) { - if ((self.spawnflags & 0x80000000) != 0) { - self.spawnflags &= ~0x80000000; - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_LASER_SPARKS); - gi.WriteByte(count); - gi.WritePosition(tr.endpos); - gi.WriteDir(tr.plane.normal); - gi.WriteByte(self.s.skinnum); - gi.multicast(tr.endpos, MULTICAST_PVS); - } - break; - } - - ignore = tr.ent; - VectorCopy(tr.endpos, start); - } - - VectorCopy(tr.endpos, self.s.old_origin); - - self.nextthink = level.time + FRAMETIME; - return true; - } - }; - public static void target_laser_on(edict_t self) { if (null == self.activator) self.activator = self; self.spawnflags |= 0x80000001; self.svflags &= ~SVF_NOCLIENT; - target_laser_think.think(self); + GameTargetAdapters.target_laser_think.think(self); } public static void target_laser_off(edict_t self) { @@ -582,151 +201,15 @@ public class GameTarget extends GameTurret { self.nextthink = 0; } - public static EntUseAdapter target_laser_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - self.activator = activator; - if ((self.spawnflags & 1) != 0) - target_laser_off(self); - else - target_laser_on(self); - } - }; - - static EntThinkAdapter target_laser_start = new EntThinkAdapter() { - public boolean think(edict_t self) { - - edict_t ent; - - self.movetype = MOVETYPE_NONE; - self.solid = SOLID_NOT; - self.s.renderfx |= RF_BEAM | RF_TRANSLUCENT; - self.s.modelindex = 1; // must be non-zero - - // set the beam diameter - if ((self.spawnflags & 64) != 0) - self.s.frame = 16; - else - self.s.frame = 4; - - // set the color - if ((self.spawnflags & 2) != 0) - self.s.skinnum = 0xf2f2f0f0; - else if ((self.spawnflags & 4) != 0) - self.s.skinnum = 0xd0d1d2d3; - else if ((self.spawnflags & 8) != 0) - self.s.skinnum = 0xf3f3f1f1; - else if ((self.spawnflags & 16) != 0) - self.s.skinnum = 0xdcdddedf; - else if ((self.spawnflags & 32) != 0) - self.s.skinnum = 0xe0e1e2e3; - - if (null == self.enemy) { - if (self.target != null) { - ent = G_Find(null, findByTarget, self.target).o; - if (ent == null) - gi.dprintf(self.classname + " at " + vtos(self.s.origin) + ": " + self.target + " is a bad target\n"); - self.enemy = ent; - } - else { - G_SetMovedir(self.s.angles, self.movedir); - } - } - self.use = target_laser_use; - self.think = target_laser_think; - - if (0 == self.dmg) - self.dmg = 1; - - VectorSet(self.mins, -8, -8, -8); - VectorSet(self.maxs, 8, 8, 8); - gi.linkentity(self); - - if ((self.spawnflags & 1) != 0) - target_laser_on(self); - else - target_laser_off(self); - return true; - } - }; - public static void SP_target_laser(edict_t self) { // let everything else get spawned before we start firing - self.think = target_laser_start; + self.think = GameTargetAdapters.target_laser_start; self.nextthink = level.time + 1; } - //========================================================== - - /*QUAKED target_lightramp (0 .5 .8) (-8 -8 -8) (8 8 8) TOGGLE - speed How many seconds the ramping will take - message two letters; starting lightlevel and ending lightlevel - */ - - static EntThinkAdapter target_lightramp_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - char style[] = { ' ', ' ' }; - - style[0] = (char) ('a' + (int) (self.movedir[0] + (level.time - self.timestamp) / FRAMETIME * self.movedir[2])); - style[1] = 0; - gi.configstring(CS_LIGHTS + self.enemy.style, new String(style)); - - if ((level.time - self.timestamp) < self.speed) { - self.nextthink = level.time + FRAMETIME; - } - else if ((self.spawnflags & 1) != 0) { - char temp; - - temp = (char) self.movedir[0]; - self.movedir[0] = self.movedir[1]; - self.movedir[1] = temp; - self.movedir[2] *= -1; - } - - return true; - } - }; - - static EntUseAdapter target_lightramp_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - if (self.enemy == null) { - edict_t e; - - // check all the targets - e = null; - EdictIterator es = null; - - while (true) { - es = G_Find(es, findByTarget, self.target); - e = es.o; - - if (e == null) - break; - if (strcmp(e.classname, "light") != 0) { - gi.dprintf(self.classname + " at " + vtos(self.s.origin)); - gi.dprintf("target " + self.target + " (" + e.classname + " at " + vtos(e.s.origin) + ") is not a light\n"); - } - else { - self.enemy = e; - } - } - - if (null == self.enemy) { - gi.dprintf(self.classname + " target " + self.target + " not found at " + vtos(self.s.origin) + "\n"); - G_FreeEdict(self); - return; - } - } - - self.timestamp = level.time; - target_lightramp_think.think(self); - } - }; - public static void SP_target_lightramp(edict_t self) { if (self.message == null - || strlen(self.message) != 2 + || self.message.length() != 2 || self.message.charAt(0) < 'a' || self.message.charAt(0) > 'z' || self.message.charAt(1) < 'a' @@ -749,66 +232,14 @@ public class GameTarget extends GameTurret { } self.svflags |= SVF_NOCLIENT; - self.use = target_lightramp_use; - self.think = target_lightramp_think; + self.use = GameTargetAdapters.target_lightramp_use; + self.think = GameTargetAdapters.target_lightramp_think; self.movedir[0] = self.message.charAt(0) - 'a'; self.movedir[1] = self.message.charAt(1) - 'a'; self.movedir[2] = (self.movedir[1] - self.movedir[0]) / (self.speed / FRAMETIME); } - //========================================================== - - /*QUAKED target_earthquake (1 0 0) (-8 -8 -8) (8 8 8) - When triggered, this initiates a level-wide earthquake. - All players and monsters are affected. - "speed" severity of the quake (default:200) - "count" duration of the quake (default:5) - */ - - static EntThinkAdapter target_earthquake_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - int i; - edict_t e; - - if (self.last_move_time < level.time) { - gi.positioned_sound(self.s.origin, self, CHAN_AUTO, self.noise_index, 1.0f, ATTN_NONE, 0); - self.last_move_time = level.time + 0.5f; - } - - for (i = 1; i < globals.num_edicts; i++) { - e = g_edicts[i]; - - if (!e.inuse) - continue; - if (null == e.client) - continue; - if (null == e.groundentity) - continue; - - e.groundentity = null; - e.velocity[0] += crandom() * 150; - e.velocity[1] += crandom() * 150; - e.velocity[2] = self.speed * (100.0f / e.mass); - } - - if (level.time < self.timestamp) - self.nextthink = level.time + FRAMETIME; - - return true; - } - }; - - static EntUseAdapter target_earthquake_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.timestamp = level.time + self.count; - self.nextthink = level.time + FRAMETIME; - self.activator = activator; - self.last_move_time = 0; - } - }; - public static void SP_target_earthquake(edict_t self) { if (null == self.targetname) gi.dprintf("untargeted " + self.classname + " at " + vtos(self.s.origin) + "\n"); @@ -820,8 +251,8 @@ public class GameTarget extends GameTurret { self.speed = 200; self.svflags |= SVF_NOCLIENT; - self.think = target_earthquake_think; - self.use = target_earthquake_use; + self.think = GameTargetAdapters.target_earthquake_think; + self.use = GameTargetAdapters.target_earthquake_use; self.noise_index = gi.soundindex("world/quake.wav"); } diff --git a/src/jake2/game/GameTargetAdapters.java b/src/jake2/game/GameTargetAdapters.java new file mode 100644 index 0000000..31c85a9 --- /dev/null +++ b/src/jake2/game/GameTargetAdapters.java @@ -0,0 +1,586 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameTargetAdapters.java,v 1.1 2004-07-08 15:58:43 hzi Exp $ + +package jake2.game; + +import jake2.*; +import jake2.client.*; +import jake2.qcommon.*; +import jake2.render.*; +import jake2.server.*; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class GameTargetAdapters { + + /*QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8) + Fire an origin based temp entity event to the clients. + "style" type byte + */ + public static EntUseAdapter Use_Target_Tent = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(ent.style); + GameBase.gi.WritePosition(ent.s.origin); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + } + }; + //========================================================== + + //========================================================== + + /*QUAKED target_speaker (1 0 0) (-8 -8 -8) (8 8 8) looped-on looped-off reliable + "noise" wav file to play + "attenuation" + -1 = none, send to whole level + 1 = normal fighting sounds + 2 = idle sound level + 3 = ambient sound level + "volume" 0.0 to 1.0 + + Normal sounds play each time the target is used. The reliable flag can be set for crucial voiceovers. + + Looped sounds are always atten 3 / vol 1, and the use function toggles it on/off. + Multiple identical looping sounds will just increase volume without any speed cost. + */ + public static EntUseAdapter Use_Target_Speaker = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + int chan; + + if ((ent.spawnflags & 3) != 0) { // looping sound toggles + if (ent.s.sound != 0) + ent.s.sound = 0; // turn it off + else + ent.s.sound = ent.noise_index; // start it + } + else { // normal sound + if ((ent.spawnflags & 4) != 0) + chan = Defines.CHAN_VOICE | Defines.CHAN_RELIABLE; + else + chan = Defines.CHAN_VOICE; + // use a positioned_sound, because this entity won't normally be + // sent to any clients because it is invisible + GameBase.gi.positioned_sound(ent.s.origin, ent, chan, ent.noise_index, ent.volume, ent.attenuation, 0); + } + + } + }; + //========================================================== + public static EntUseAdapter Use_Target_Help = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + + if ((ent.spawnflags & 1) != 0) + //strncpy(game.helpmessage1, ent.message, sizeof(game.helpmessage2) - 1); + ent.message = GameBase.game.helpmessage1; + else + //strncpy(game.helpmessage2, ent.message, sizeof(game.helpmessage1) - 1); + ent.message = GameBase.game.helpmessage2; + + GameBase.game.helpchanged++; + } + }; + //========================================================== + + /*QUAKED target_secret (1 0 1) (-8 -8 -8) (8 8 8) + Counts a secret found. + These are single use targets. + */ + static EntUseAdapter use_target_secret = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + GameBase.gi.sound(ent, Defines.CHAN_VOICE, ent.noise_index, 1, Defines.ATTN_NORM, 0); + + GameBase.level.found_secrets++; + + GameUtil.G_UseTargets(ent, activator); + GameUtil.G_FreeEdict(ent); + } + }; + //========================================================== + + /*QUAKED target_goal (1 0 1) (-8 -8 -8) (8 8 8) + Counts a goal completed. + These are single use targets. + */ + static EntUseAdapter use_target_goal = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + GameBase.gi.sound(ent, Defines.CHAN_VOICE, ent.noise_index, 1, Defines.ATTN_NORM, 0); + + GameBase.level.found_goals++; + + if (GameBase.level.found_goals == GameBase.level.total_goals) + GameBase.gi.configstring(Defines.CS_CDTRACK, "0"); + + GameUtil.G_UseTargets(ent, activator); + GameUtil.G_FreeEdict(ent); + } + }; + //========================================================== + + /*QUAKED target_explosion (1 0 0) (-8 -8 -8) (8 8 8) + Spawns an explosion temporary entity when used. + + "delay" wait this long before going off + "dmg" how much radius damage should be done, defaults to 0 + */ + static EntThinkAdapter target_explosion_explode = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float save; + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_EXPLOSION1); + GameBase.gi.WritePosition(self.s.origin); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PHS); + + GameUtil.T_RadiusDamage(self, self.activator, self.dmg, null, self.dmg + 40, Defines.MOD_EXPLOSIVE); + + save = self.delay; + self.delay = 0; + GameUtil.G_UseTargets(self, self.activator); + self.delay = save; + return true; + } + }; + static EntUseAdapter use_target_explosion = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + self.activator = activator; + + if (0 == self.delay) { + target_explosion_explode.think(self); + return; + } + + self.think = target_explosion_explode; + self.nextthink = GameBase.level.time + self.delay; + } + }; + //========================================================== + + /*QUAKED target_changelevel (1 0 0) (-8 -8 -8) (8 8 8) + Changes level to "map" when fired + */ + static EntUseAdapter use_target_changelevel = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + if (GameBase.level.intermissiontime != 0) + return; // already activated + + if (0 == GameBase.deathmatch.value && 0 == GameBase.coop.value) { + if (GameBase.g_edicts[1].health <= 0) + return; + } + + // if noexit, do a ton of damage to other + if (GameBase.deathmatch.value != 0 && 0 == ((int) GameBase.dmflags.value & Defines.DF_ALLOW_EXIT) && other != GameBase.g_edicts[0] /*world*/ + ) { + GameUtil.T_Damage(other, self, self, Globals.vec3_origin, other.s.origin, Globals.vec3_origin, 10 * other.max_health, 1000, 0, Defines.MOD_EXIT); + return; + } + + // if multiplayer, let everyone know who hit the exit + if (GameBase.deathmatch.value != 0) { + if (activator != null && activator.client != null) + GameBase.gi.bprintf(Defines.PRINT_HIGH, activator.client.pers.netname + " exited the level.\n"); + } + + // if going to a new unit, clear cross triggers + if (self.map.indexOf('*') > -1) + GameBase.game.serverflags &= ~(Defines.SFL_CROSS_TRIGGER_MASK); + + PlayerHud.BeginIntermission(self); + } + }; + //========================================================== + + /*QUAKED target_splash (1 0 0) (-8 -8 -8) (8 8 8) + Creates a particle splash effect when used. + + Set "sounds" to one of the following: + 1) sparks + 2) blue water + 3) brown water + 4) slime + 5) lava + 6) blood + + "count" how many pixels in the splash + "dmg" if set, does a radius damage at this location when it splashes + useful for lava/sparks + */ + static EntUseAdapter use_target_splash = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_SPLASH); + GameBase.gi.WriteByte(self.count); + GameBase.gi.WritePosition(self.s.origin); + GameBase.gi.WriteDir(self.movedir); + GameBase.gi.WriteByte(self.sounds); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + + if (self.dmg != 0) + GameUtil.T_RadiusDamage(self, activator, self.dmg, null, self.dmg + 40, Defines.MOD_SPLASH); + } + }; + //========================================================== + + /*QUAKED target_spawner (1 0 0) (-8 -8 -8) (8 8 8) + Set target to the type of entity you want spawned. + Useful for spawning monsters and gibs in the factory levels. + + For monsters: + Set direction to the facing you want it to have. + + For gibs: + Set direction if you want it moving and + speed how fast it should be moving otherwise it + will just be dropped + */ + + static EntUseAdapter use_target_spawner = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + edict_t ent; + + ent = GameUtil.G_Spawn(); + ent.classname = self.target; + Math3D.VectorCopy(self.s.origin, ent.s.origin); + Math3D.VectorCopy(self.s.angles, ent.s.angles); + GameSpawn.ED_CallSpawn(ent); + GameBase.gi.unlinkentity(ent); + GameUtil.KillBox(ent); + GameBase.gi.linkentity(ent); + if (self.speed != 0) + Math3D.VectorCopy(self.movedir, ent.velocity); + } + }; + //========================================================== + + /*QUAKED target_blaster (1 0 0) (-8 -8 -8) (8 8 8) NOTRAIL NOEFFECTS + Fires a blaster bolt in the set direction when triggered. + + dmg default is 15 + speed default is 1000 + */ + public static EntUseAdapter use_target_blaster = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + int effect; + + if ((self.spawnflags & 2) != 0) + effect = 0; + else if ((self.spawnflags & 1) != 0) + effect = Defines.EF_HYPERBLASTER; + else + effect = Defines.EF_BLASTER; + + Fire.fire_blaster(self, self.s.origin, self.movedir, self.dmg, (int) self.speed, Defines.EF_BLASTER, Defines.MOD_TARGET_BLASTER != 0 + /*true*/ + ); + GameBase.gi.sound(self, Defines.CHAN_VOICE, self.noise_index, 1, Defines.ATTN_NORM, 0); + } + }; + //========================================================== + + /*QUAKED target_crosslevel_trigger (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1 trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 + Once this trigger is touched/used, any trigger_crosslevel_target with the same trigger number is automatically used when a level is started within the same unit. It is OK to check multiple triggers. Message, delay, target, and killtarget also work. + */ + public static EntUseAdapter trigger_crosslevel_trigger_use = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + GameBase.game.serverflags |= self.spawnflags; + GameUtil.G_FreeEdict(self); + } + }; + /*QUAKED target_crosslevel_target (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1 trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 + Triggered by a trigger_crosslevel elsewhere within a unit. If multiple triggers are checked, all must be true. Delay, target and + killtarget also work. + + "delay" delay before using targets if the trigger has been activated (default 1) + */ + static EntThinkAdapter target_crosslevel_target_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.spawnflags == (GameBase.game.serverflags & Defines.SFL_CROSS_TRIGGER_MASK & self.spawnflags)) { + GameUtil.G_UseTargets(self, self); + GameUtil.G_FreeEdict(self); + } + return true; + } + }; + //========================================================== + + /*QUAKED target_laser (0 .5 .8) (-8 -8 -8) (8 8 8) START_ON RED GREEN BLUE YELLOW ORANGE FAT + When triggered, fires a laser. You can either set a target + or a direction. + */ + public static EntThinkAdapter target_laser_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + + edict_t ignore; + float[] start = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + trace_t tr; + float[] point = { 0, 0, 0 }; + float[] last_movedir = { 0, 0, 0 }; + int count; + + if ((self.spawnflags & 0x80000000) != 0) + count = 8; + else + count = 4; + + if (self.enemy != null) { + Math3D.VectorCopy(self.movedir, last_movedir); + Math3D.VectorMA(self.enemy.absmin, 0.5f, self.enemy.size, point); + Math3D.VectorSubtract(point, self.s.origin, self.movedir); + Math3D.VectorNormalize(self.movedir); + if (0 == Math3D.VectorCompare(self.movedir, last_movedir)) + self.spawnflags |= 0x80000000; + } + + ignore = self; + Math3D.VectorCopy(self.s.origin, start); + Math3D.VectorMA(start, 2048, self.movedir, end); + while (true) { + tr = GameBase.gi.trace(start, null, null, end, ignore, Defines.CONTENTS_SOLID | Defines.CONTENTS_MONSTER | Defines.CONTENTS_DEADMONSTER); + + if (tr.ent == null) + break; + + // hurt it if we can + if ((tr.ent.takedamage != 0) && 0 == (tr.ent.flags & Defines.FL_IMMUNE_LASER)) + GameUtil.T_Damage( + tr.ent, + self, + self.activator, + self.movedir, + tr.endpos, + Globals.vec3_origin, + self.dmg, + 1, + Defines.DAMAGE_ENERGY, + Defines.MOD_TARGET_LASER); + + // if we hit something that's not a monster or player or is immune to lasers, we're done + if (0 == (tr.ent.svflags & Defines.SVF_MONSTER) && (null == tr.ent.client)) { + if ((self.spawnflags & 0x80000000) != 0) { + self.spawnflags &= ~0x80000000; + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_LASER_SPARKS); + GameBase.gi.WriteByte(count); + GameBase.gi.WritePosition(tr.endpos); + GameBase.gi.WriteDir(tr.plane.normal); + GameBase.gi.WriteByte(self.s.skinnum); + GameBase.gi.multicast(tr.endpos, Defines.MULTICAST_PVS); + } + break; + } + + ignore = tr.ent; + Math3D.VectorCopy(tr.endpos, start); + } + + Math3D.VectorCopy(tr.endpos, self.s.old_origin); + + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; + public static EntUseAdapter target_laser_use = new EntUseAdapter() { + + public void use(edict_t self, edict_t other, edict_t activator) { + self.activator = activator; + if ((self.spawnflags & 1) != 0) + GameTarget.target_laser_off(self); + else + GameTarget.target_laser_on(self); + } + }; + static EntThinkAdapter target_laser_start = new EntThinkAdapter() { + public boolean think(edict_t self) { + + edict_t ent; + + self.movetype = Defines.MOVETYPE_NONE; + self.solid = Defines.SOLID_NOT; + self.s.renderfx |= Defines.RF_BEAM | Defines.RF_TRANSLUCENT; + self.s.modelindex = 1; // must be non-zero + + // set the beam diameter + if ((self.spawnflags & 64) != 0) + self.s.frame = 16; + else + self.s.frame = 4; + + // set the color + if ((self.spawnflags & 2) != 0) + self.s.skinnum = 0xf2f2f0f0; + else if ((self.spawnflags & 4) != 0) + self.s.skinnum = 0xd0d1d2d3; + else if ((self.spawnflags & 8) != 0) + self.s.skinnum = 0xf3f3f1f1; + else if ((self.spawnflags & 16) != 0) + self.s.skinnum = 0xdcdddedf; + else if ((self.spawnflags & 32) != 0) + self.s.skinnum = 0xe0e1e2e3; + + if (null == self.enemy) { + if (self.target != null) { + ent = GameBase.G_Find(null, GameBase.findByTarget, self.target).o; + if (ent == null) + GameBase.gi.dprintf(self.classname + " at " + Lib.vtos(self.s.origin) + ": " + self.target + " is a bad target\n"); + self.enemy = ent; + } + else { + GameBase.G_SetMovedir(self.s.angles, self.movedir); + } + } + self.use = target_laser_use; + self.think = target_laser_think; + + if (0 == self.dmg) + self.dmg = 1; + + Math3D.VectorSet(self.mins, -8, -8, -8); + Math3D.VectorSet(self.maxs, 8, 8, 8); + GameBase.gi.linkentity(self); + + if ((self.spawnflags & 1) != 0) + GameTarget.target_laser_on(self); + else + GameTarget.target_laser_off(self); + return true; + } + }; + //========================================================== + + /*QUAKED target_lightramp (0 .5 .8) (-8 -8 -8) (8 8 8) TOGGLE + speed How many seconds the ramping will take + message two letters; starting lightlevel and ending lightlevel + */ + + static EntThinkAdapter target_lightramp_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + + char style[] = { ' ', ' ' }; + + style[0] = (char) ('a' + (int) (self.movedir[0] + (GameBase.level.time - self.timestamp) / Defines.FRAMETIME * self.movedir[2])); + style[1] = 0; + GameBase.gi.configstring(Defines.CS_LIGHTS + self.enemy.style, new String(style)); + + if ((GameBase.level.time - self.timestamp) < self.speed) { + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + else if ((self.spawnflags & 1) != 0) { + char temp; + + temp = (char) self.movedir[0]; + self.movedir[0] = self.movedir[1]; + self.movedir[1] = temp; + self.movedir[2] *= -1; + } + + return true; + } + }; + static EntUseAdapter target_lightramp_use = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + if (self.enemy == null) { + edict_t e; + + // check all the targets + e = null; + EdictIterator es = null; + + while (true) { + es = GameBase.G_Find(es, GameBase.findByTarget, self.target); + e = es.o; + + if (e == null) + break; + if (Lib.strcmp(e.classname, "light") != 0) { + GameBase.gi.dprintf(self.classname + " at " + Lib.vtos(self.s.origin)); + GameBase.gi.dprintf("target " + self.target + " (" + e.classname + " at " + Lib.vtos(e.s.origin) + ") is not a light\n"); + } + else { + self.enemy = e; + } + } + + if (null == self.enemy) { + GameBase.gi.dprintf(self.classname + " target " + self.target + " not found at " + Lib.vtos(self.s.origin) + "\n"); + GameUtil.G_FreeEdict(self); + return; + } + } + + self.timestamp = GameBase.level.time; + target_lightramp_think.think(self); + } + }; + //========================================================== + + /*QUAKED target_earthquake (1 0 0) (-8 -8 -8) (8 8 8) + When triggered, this initiates a level-wide earthquake. + All players and monsters are affected. + "speed" severity of the quake (default:200) + "count" duration of the quake (default:5) + */ + + static EntThinkAdapter target_earthquake_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + + int i; + edict_t e; + + if (self.last_move_time < GameBase.level.time) { + GameBase.gi.positioned_sound(self.s.origin, self, Defines.CHAN_AUTO, self.noise_index, 1.0f, Defines.ATTN_NONE, 0); + self.last_move_time = GameBase.level.time + 0.5f; + } + + for (i = 1; i < GameBase.globals.num_edicts; i++) { + e = GameBase.g_edicts[i]; + + if (!e.inuse) + continue; + if (null == e.client) + continue; + if (null == e.groundentity) + continue; + + e.groundentity = null; + e.velocity[0] += Lib.crandom() * 150; + e.velocity[1] += Lib.crandom() * 150; + e.velocity[2] = self.speed * (100.0f / e.mass); + } + + if (GameBase.level.time < self.timestamp) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + + return true; + } + }; + static EntUseAdapter target_earthquake_use = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + self.timestamp = GameBase.level.time + self.count; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + self.activator = activator; + self.last_move_time = 0; + } + }; +} diff --git a/src/jake2/game/GameTrigger.java b/src/jake2/game/GameTrigger.java index c4bac9e..281fa4c 100644 --- a/src/jake2/game/GameTrigger.java +++ b/src/jake2/game/GameTrigger.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 27.12.2003 by RST. -// $Id: GameTrigger.java,v 1.1 2004-07-07 19:59:03 hzi Exp $ +// $Id: GameTrigger.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -28,9 +28,10 @@ import jake2.client.*; import jake2.qcommon.*; import jake2.render.*; import jake2.server.*; +import jake2.util.Lib; import jake2.util.Math3D; -public class GameTrigger extends GamePWeapon { +public class GameTrigger extends M_Player { public static void InitTrigger(edict_t self) { if (Math3D.VectorCompare(self.s.angles, vec3_origin) != 0) @@ -42,15 +43,6 @@ public class GameTrigger extends GamePWeapon { self.svflags = SVF_NOCLIENT; } - // the wait time has passed, so set back up for another activation - public static EntThinkAdapter multi_wait = new EntThinkAdapter() { - public boolean think(edict_t ent) { - - ent.nextthink = 0; - return true; - } - }; - // the trigger was just activated // ent.activator should be set to the activator so it can be held through a delay // so wait for the delay time before firing @@ -61,68 +53,17 @@ public class GameTrigger extends GamePWeapon { G_UseTargets(ent, ent.activator); if (ent.wait > 0) { - ent.think = multi_wait; + ent.think = GameTriggerAdapters.multi_wait; ent.nextthink = level.time + ent.wait; } else { // we can't just remove (self) here, because this is a touch function // called while looping through area links... ent.touch = null; ent.nextthink = level.time + FRAMETIME; - ent.think = G_FreeEdictA; + ent.think = GameUtilAdapters.G_FreeEdictA; } } - static EntUseAdapter Use_Multi = new EntUseAdapter() { - public void use(edict_t ent, edict_t other, edict_t activator) { - ent.activator = activator; - multi_trigger(ent); - } - }; - - static EntTouchAdapter Touch_Multi = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (other.client != null) { - if ((self.spawnflags & 2) != 0) - return; - } - else if ((other.svflags & SVF_MONSTER) != 0) { - if (0 == (self.spawnflags & 1)) - return; - } - else - return; - - if (0 == VectorCompare(self.movedir, vec3_origin)) { - float[] forward = { 0, 0, 0 }; - - AngleVectors(other.s.angles, forward, null, null); - if (DotProduct(forward, self.movedir) < 0) - return; - } - - self.activator = other; - multi_trigger(self); - } - }; - - /*QUAKED trigger_multiple (.5 .5 .5) ? MONSTER NOT_PLAYER TRIGGERED - Variable sized repeatable trigger. Must be targeted at one or more entities. - If "delay" is set, the trigger waits some time after activating before firing. - "wait" : Seconds between triggerings. (.2 default) - sounds - 1) secret - 2) beep beep - 3) large switch - 4) - set "message" to text string - */ - static EntUseAdapter trigger_enable = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - self.solid = SOLID_TRIGGER; - self.use = Use_Multi; - gi.linkentity(self); - } - }; public static void SP_trigger_multiple(edict_t ent) { if (ent.sounds == 1) ent.noise_index = gi.soundindex("misc/secret.wav"); @@ -134,17 +75,17 @@ public class GameTrigger extends GamePWeapon { if (ent.wait == 0) ent.wait = 0.2f; - ent.touch = Touch_Multi; + ent.touch = GameTriggerAdapters.Touch_Multi; ent.movetype = MOVETYPE_NONE; ent.svflags |= SVF_NOCLIENT; if ((ent.spawnflags & 4) != 0) { ent.solid = SOLID_NOT; - ent.use = trigger_enable; + ent.use = GameTriggerAdapters.trigger_enable; } else { ent.solid = SOLID_TRIGGER; - ent.use = Use_Multi; + ent.use = GameTriggerAdapters.Use_Multi; } if (0 == Math3D.VectorCompare(ent.s.angles, vec3_origin)) @@ -185,95 +126,10 @@ public class GameTrigger extends GamePWeapon { SP_trigger_multiple(ent); } - /*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) - This fixed size trigger cannot be touched, it can only be fired by other events. - */ - public static EntUseAdapter trigger_relay_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - G_UseTargets(self, activator); - } - }; - public static void SP_trigger_relay(edict_t self) { - self.use = trigger_relay_use; + self.use = GameTriggerAdapters.trigger_relay_use; } - /* - ============================================================================== - - trigger_key - - ============================================================================== - */ - - /*QUAKED trigger_key (.5 .5 .5) (-8 -8 -8) (8 8 8) - A relay trigger that only fires it's targets if player has the proper key. - Use "item" to specify the required key, for example "key_data_cd" - */ - - static EntUseAdapter trigger_key_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - int index; - - if (self.item == null) - return; - if (activator.client == null) - return; - - index = ITEM_INDEX(self.item); - if (activator.client.pers.inventory[index] == 0) { - if (level.time < self.touch_debounce_time) - return; - self.touch_debounce_time = level.time + 5.0f; - gi.centerprintf(activator, "You need the " + self.item.pickup_name); - gi.sound(activator, CHAN_AUTO, gi.soundindex("misc/keytry.wav"), 1, ATTN_NORM, 0); - return; - } - - gi.sound(activator, CHAN_AUTO, gi.soundindex("misc/keyuse.wav"), 1, ATTN_NORM, 0); - if (coop.value != 0) { - int player; - edict_t ent; - - if (strcmp(self.item.classname, "key_power_cube") == 0) { - int cube; - - for (cube = 0; cube < 8; cube++) - if ((activator.client.pers.power_cubes & (1 << cube)) != 0) - break; - for (player = 1; player <= game.maxclients; player++) { - ent = g_edicts[player]; - if (!ent.inuse) - continue; - if (null == ent.client) - continue; - if ((ent.client.pers.power_cubes & (1 << cube)) != 0) { - ent.client.pers.inventory[index]--; - ent.client.pers.power_cubes &= ~(1 << cube); - } - } - } - else { - for (player = 1; player <= game.maxclients; player++) { - ent = g_edicts[player]; - if (!ent.inuse) - continue; - if (ent.client == null) - continue; - ent.client.pers.inventory[index] = 0; - } - } - } - else { - activator.client.pers.inventory[index]--; - } - - G_UseTargets(self, activator); - - self.use = null; - } - }; - public static void SP_trigger_key(edict_t self) { if (st.item == null) { gi.dprintf("no key item for trigger_key at " + vtos(self.s.origin) + "\n"); @@ -294,55 +150,15 @@ public class GameTrigger extends GamePWeapon { gi.soundindex("misc/keytry.wav"); gi.soundindex("misc/keyuse.wav"); - self.use = trigger_key_use; + self.use = GameTriggerAdapters.trigger_key_use; } - /* - ============================================================================== - - trigger_counter - - ============================================================================== - */ - - /*QUAKED trigger_counter (.5 .5 .5) ? nomessage - Acts as an intermediary for an action that takes multiple inputs. - - If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished. - - After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. - */ - static EntUseAdapter trigger_counter_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - if (self.count == 0) - return; - - self.count--; - - if (self.count == 0) { - if (0 == (self.spawnflags & 1)) { - gi.centerprintf(activator, self.count + " more to go..."); - gi.sound(activator, CHAN_AUTO, gi.soundindex("misc/talk1.wav"), 1, ATTN_NORM, 0); - } - return; - } - - if (0 == (self.spawnflags & 1)) { - gi.centerprintf(activator, "Sequence completed!"); - gi.sound(activator, CHAN_AUTO, gi.soundindex("misc/talk1.wav"), 1, ATTN_NORM, 0); - } - self.activator = activator; - multi_trigger(self); - } - }; - public static void SP_trigger_counter(edict_t self) { self.wait = -1; if (0 == self.count) self.count = 2; - self.use = trigger_counter_use; + self.use = GameTriggerAdapters.trigger_counter_use; } /* @@ -363,119 +179,24 @@ public class GameTrigger extends GamePWeapon { G_UseTargets(ent, ent); } - /* - ============================================================================== - - trigger_push - - ============================================================================== - */ - - public static final int PUSH_ONCE = 1; - - public static int windsound; - - static EntTouchAdapter trigger_push_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (strcmp(other.classname, "grenade") == 0) { - VectorScale(self.movedir, self.speed * 10, other.velocity); - } - else if (other.health > 0) { - VectorScale(self.movedir, self.speed * 10, other.velocity); - - if (other.client != null) { - // don't take falling damage immediately from this - VectorCopy(other.velocity, other.client.oldvelocity); - if (other.fly_sound_debounce_time < level.time) { - other.fly_sound_debounce_time = level.time + 1.5f; - gi.sound(other, CHAN_AUTO, windsound, 1, ATTN_NORM, 0); - } - } - } - if ((self.spawnflags & PUSH_ONCE) != 0) - G_FreeEdict(self); - } - }; - /*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE Pushes the player "speed" defaults to 1000 */ public static void SP_trigger_push(edict_t self) { InitTrigger(self); - windsound = gi.soundindex("misc/windfly.wav"); - self.touch = trigger_push_touch; + GameTriggerAdapters.windsound = gi.soundindex("misc/windfly.wav"); + self.touch = GameTriggerAdapters.trigger_push_touch; if (0 == self.speed) self.speed = 1000; gi.linkentity(self); } - /* - ============================================================================== - - trigger_hurt - - ============================================================================== - */ - - /*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF TOGGLE SILENT NO_PROTECTION SLOW - Any entity that touches this will be hurt. - - It does dmg points of damage each server frame - - SILENT supresses playing the sound - SLOW changes the damage rate to once per second - NO_PROTECTION *nothing* stops the damage - - "dmg" default 5 (whole numbers only) - - */ - static EntUseAdapter hurt_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - if (self.solid == SOLID_NOT) - self.solid = SOLID_TRIGGER; - else - self.solid = SOLID_NOT; - gi.linkentity(self); - - if (0 == (self.spawnflags & 2)) - self.use = null; - } - }; - static EntTouchAdapter hurt_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - int dflags; - - if (other.takedamage == 0) - return; - - if (self.timestamp > level.time) - return; - - if ((self.spawnflags & 16) != 0) - self.timestamp = level.time + 1; - else - self.timestamp = level.time + FRAMETIME; - - if (0 == (self.spawnflags & 4)) { - if ((level.framenum % 10) == 0) - gi.sound(other, CHAN_AUTO, self.noise_index, 1, ATTN_NORM, 0); - } - - if ((self.spawnflags & 8) != 0) - dflags = DAMAGE_NO_PROTECTION; - else - dflags = 0; - T_Damage(other, self, self, vec3_origin, other.s.origin, vec3_origin, self.dmg, self.dmg, dflags, MOD_TRIGGER_HURT); - } - }; - public static void SP_trigger_hurt(edict_t self) { InitTrigger(self); self.noise_index = gi.soundindex("world/electro.wav"); - self.touch = hurt_touch; + self.touch = GameTriggerAdapters.hurt_touch; if (0 == self.dmg) self.dmg = 5; @@ -486,32 +207,11 @@ public class GameTrigger extends GamePWeapon { self.solid = SOLID_TRIGGER; if ((self.spawnflags & 2) != 0) - self.use = hurt_use; + self.use = GameTriggerAdapters.hurt_use; gi.linkentity(self); } - /* - ============================================================================== - - trigger_gravity - - ============================================================================== - */ - - /*QUAKED trigger_gravity (.5 .5 .5) ? - Changes the touching entites gravity to - the value of "gravity". 1.0 is standard - gravity for the level. - */ - - static EntTouchAdapter trigger_gravity_touch = new EntTouchAdapter() { - - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - other.gravity = self.gravity; - } - }; - public static void SP_trigger_gravity(edict_t self) { if (st.gravity == null) { gi.dprintf("trigger_gravity without gravity set at " + vtos(self.s.origin) + "\n"); @@ -521,44 +221,9 @@ public class GameTrigger extends GamePWeapon { InitTrigger(self); self.gravity = atoi(st.gravity); - self.touch = trigger_gravity_touch; + self.touch = GameTriggerAdapters.trigger_gravity_touch; } - /* - ============================================================================== - - trigger_monsterjump - - ============================================================================== - */ - - /*QUAKED trigger_monsterjump (.5 .5 .5) ? - Walking monsters that touch this will jump in the direction of the trigger's angle - "speed" default to 200, the speed thrown forward - "height" default to 200, the speed thrown upwards - */ - - static EntTouchAdapter trigger_monsterjump_touch = new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if ((other.flags & (FL_FLY | FL_SWIM)) != 0) - return; - if ((other.svflags & SVF_DEADMONSTER) != 0) - return; - if (0 == (other.svflags & SVF_MONSTER)) - return; - - // set XY even if not on ground, so the jump will clear lips - other.velocity[0] = self.movedir[0] * self.speed; - other.velocity[1] = self.movedir[1] * self.speed; - - if (other.groundentity != null) - return; - - other.groundentity = null; - other.velocity[2] = self.movedir[2]; - } - }; - public static void SP_trigger_monsterjump(edict_t self) { if (0 == self.speed) self.speed = 200; @@ -567,7 +232,7 @@ public class GameTrigger extends GamePWeapon { if (self.s.angles[YAW] == 0) self.s.angles[YAW] = 360; InitTrigger(self); - self.touch = trigger_monsterjump_touch; + self.touch = GameTriggerAdapters.trigger_monsterjump_touch; self.movedir[2] = st.height; } diff --git a/src/jake2/game/GameTriggerAdapters.java b/src/jake2/game/GameTriggerAdapters.java new file mode 100644 index 0000000..8d3622a --- /dev/null +++ b/src/jake2/game/GameTriggerAdapters.java @@ -0,0 +1,361 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameTriggerAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.*; +import jake2.client.*; +import jake2.qcommon.*; +import jake2.render.*; +import jake2.server.*; +import jake2.util.*; + +public class GameTriggerAdapters { + + // the wait time has passed, so set back up for another activation + public static EntThinkAdapter multi_wait = new EntThinkAdapter() { + public boolean think(edict_t ent) { + + ent.nextthink = 0; + return true; + } + }; + static EntUseAdapter Use_Multi = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + ent.activator = activator; + GameTrigger.multi_trigger(ent); + } + }; + static EntTouchAdapter Touch_Multi = new EntTouchAdapter() { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + if (other.client != null) { + if ((self.spawnflags & 2) != 0) + return; + } + else if ((other.svflags & Defines.SVF_MONSTER) != 0) { + if (0 == (self.spawnflags & 1)) + return; + } + else + return; + + if (0 == Math3D.VectorCompare(self.movedir, Globals.vec3_origin)) { + float[] forward = { 0, 0, 0 }; + + Math3D.AngleVectors(other.s.angles, forward, null, null); + if (Math3D.DotProduct(forward, self.movedir) < 0) + return; + } + + self.activator = other; + GameTrigger.multi_trigger(self); + } + }; + /*QUAKED trigger_multiple (.5 .5 .5) ? MONSTER NOT_PLAYER TRIGGERED + Variable sized repeatable trigger. Must be targeted at one or more entities. + If "delay" is set, the trigger waits some time after activating before firing. + "wait" : Seconds between triggerings. (.2 default) + sounds + 1) secret + 2) beep beep + 3) large switch + 4) + set "message" to text string + */ + static EntUseAdapter trigger_enable = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + self.solid = Defines.SOLID_TRIGGER; + self.use = Use_Multi; + GameBase.gi.linkentity(self); + } + }; + /*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) + This fixed size trigger cannot be touched, it can only be fired by other events. + */ + public static EntUseAdapter trigger_relay_use = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + GameUtil.G_UseTargets(self, activator); + } + }; + /* + ============================================================================== + + trigger_key + + ============================================================================== + */ + + /*QUAKED trigger_key (.5 .5 .5) (-8 -8 -8) (8 8 8) + A relay trigger that only fires it's targets if player has the proper key. + Use "item" to specify the required key, for example "key_data_cd" + */ + + static EntUseAdapter trigger_key_use = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + int index; + + Com.p("trigger_key_use!"); + if (self.item == null) + return; + if (activator.client == null) + return; + + index = GameUtil.ITEM_INDEX(self.item); + if (activator.client.pers.inventory[index] == 0) { + if (GameBase.level.time < self.touch_debounce_time) + return; + self.touch_debounce_time = GameBase.level.time + 5.0f; + GameBase.gi.centerprintf(activator, "You need the " + self.item.pickup_name); + GameBase.gi.sound(activator, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/keytry.wav"), 1, Defines.ATTN_NORM, 0); + return; + } + + GameBase.gi.sound(activator, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/keyuse.wav"), 1, Defines.ATTN_NORM, 0); + if (GameBase.coop.value != 0) { + int player; + edict_t ent; + + if (Lib.strcmp(self.item.classname, "key_power_cube") == 0) { + int cube; + + for (cube = 0; cube < 8; cube++) + if ((activator.client.pers.power_cubes & (1 << cube)) != 0) + break; + for (player = 1; player <= GameBase.game.maxclients; player++) { + ent = GameBase.g_edicts[player]; + if (!ent.inuse) + continue; + if (null == ent.client) + continue; + if ((ent.client.pers.power_cubes & (1 << cube)) != 0) { + ent.client.pers.inventory[index]--; + ent.client.pers.power_cubes &= ~(1 << cube); + } + } + } + else { + for (player = 1; player <= GameBase.game.maxclients; player++) { + ent = GameBase.g_edicts[player]; + if (!ent.inuse) + continue; + if (ent.client == null) + continue; + ent.client.pers.inventory[index] = 0; + } + } + } + else { + activator.client.pers.inventory[index]--; + } + + GameUtil.G_UseTargets(self, activator); + + self.use = null; + } + }; + /* + ============================================================================== + + trigger_counter + + ============================================================================== + */ + + /*QUAKED trigger_counter (.5 .5 .5) ? nomessage + Acts as an intermediary for an action that takes multiple inputs. + + If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished. + + After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. + */ + static EntUseAdapter trigger_counter_use = new EntUseAdapter() { + + public void use(edict_t self, edict_t other, edict_t activator) { + if (self.count == 0) + return; + + self.count--; + + if (self.count == 0) { + if (0 == (self.spawnflags & 1)) { + GameBase.gi.centerprintf(activator, self.count + " more to go..."); + GameBase.gi.sound(activator, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/talk1.wav"), 1, Defines.ATTN_NORM, 0); + } + return; + } + + if (0 == (self.spawnflags & 1)) { + GameBase.gi.centerprintf(activator, "Sequence completed!"); + GameBase.gi.sound(activator, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/talk1.wav"), 1, Defines.ATTN_NORM, 0); + } + self.activator = activator; + GameTrigger.multi_trigger(self); + } + }; + /* + ============================================================================== + + trigger_push + + ============================================================================== + */ + + public static final int PUSH_ONCE = 1; + public static int windsound; + static EntTouchAdapter trigger_push_touch = new EntTouchAdapter() { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + Com.p("TRIGGER TOUCH!"); + if (Lib.strcmp(other.classname, "grenade") == 0) { + Math3D.VectorScale(self.movedir, self.speed * 10, other.velocity); + } + else if (other.health > 0) { + Math3D.VectorScale(self.movedir, self.speed * 10, other.velocity); + + if (other.client != null) { + // don't take falling damage immediately from this + Math3D.VectorCopy(other.velocity, other.client.oldvelocity); + if (other.fly_sound_debounce_time < GameBase.level.time) { + other.fly_sound_debounce_time = GameBase.level.time + 1.5f; + GameBase.gi.sound(other, Defines.CHAN_AUTO, windsound, 1, Defines.ATTN_NORM, 0); + } + } + } + if ((self.spawnflags & PUSH_ONCE) != 0) + GameUtil.G_FreeEdict(self); + } + }; + /* + ============================================================================== + + trigger_hurt + + ============================================================================== + */ + + /*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF TOGGLE SILENT NO_PROTECTION SLOW + Any entity that touches this will be hurt. + + It does dmg points of damage each server frame + + SILENT supresses playing the sound + SLOW changes the damage rate to once per second + NO_PROTECTION *nothing* stops the damage + + "dmg" default 5 (whole numbers only) + + */ + static EntUseAdapter hurt_use = new EntUseAdapter() { + + public void use(edict_t self, edict_t other, edict_t activator) { + if (self.solid == Defines.SOLID_NOT) + self.solid = Defines.SOLID_TRIGGER; + else + self.solid = Defines.SOLID_NOT; + GameBase.gi.linkentity(self); + + if (0 == (self.spawnflags & 2)) + self.use = null; + } + }; + static EntTouchAdapter hurt_touch = new EntTouchAdapter() { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + int dflags; + + if (other.takedamage == 0) + return; + + if (self.timestamp > GameBase.level.time) + return; + + if ((self.spawnflags & 16) != 0) + self.timestamp = GameBase.level.time + 1; + else + self.timestamp = GameBase.level.time + Defines.FRAMETIME; + + if (0 == (self.spawnflags & 4)) { + if ((GameBase.level.framenum % 10) == 0) + GameBase.gi.sound(other, Defines.CHAN_AUTO, self.noise_index, 1, Defines.ATTN_NORM, 0); + } + + if ((self.spawnflags & 8) != 0) + dflags = Defines.DAMAGE_NO_PROTECTION; + else + dflags = 0; + GameUtil.T_Damage(other, self, self, Globals.vec3_origin, other.s.origin, Globals.vec3_origin, self.dmg, self.dmg, dflags, Defines.MOD_TRIGGER_HURT); + } + }; + /* + ============================================================================== + + trigger_gravity + + ============================================================================== + */ + + /*QUAKED trigger_gravity (.5 .5 .5) ? + Changes the touching entites gravity to + the value of "gravity". 1.0 is standard + gravity for the level. + */ + + static EntTouchAdapter trigger_gravity_touch = new EntTouchAdapter() { + + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + other.gravity = self.gravity; + } + }; + /* + ============================================================================== + + trigger_monsterjump + + ============================================================================== + */ + + /*QUAKED trigger_monsterjump (.5 .5 .5) ? + Walking monsters that touch this will jump in the direction of the trigger's angle + "speed" default to 200, the speed thrown forward + "height" default to 200, the speed thrown upwards + */ + + static EntTouchAdapter trigger_monsterjump_touch = new EntTouchAdapter() { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + if ((other.flags & (Defines.FL_FLY | Defines.FL_SWIM)) != 0) + return; + if ((other.svflags & Defines.SVF_DEADMONSTER) != 0) + return; + if (0 == (other.svflags & Defines.SVF_MONSTER)) + return; + + // set XY even if not on ground, so the jump will clear lips + other.velocity[0] = self.movedir[0] * self.speed; + other.velocity[1] = self.movedir[1] * self.speed; + + if (other.groundentity != null) + return; + + other.groundentity = null; + other.velocity[2] = self.movedir[2]; + } + }; +} diff --git a/src/jake2/game/GameTurret.java b/src/jake2/game/GameTurret.java index fd22a37..d0bfdbb 100644 --- a/src/jake2/game/GameTurret.java +++ b/src/jake2/game/GameTurret.java @@ -19,16 +19,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.12.2003 by RST. -// $Id: GameTurret.java,v 1.1 2004-07-07 19:59:04 hzi Exp $ +// $Id: GameTurret.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.*; import jake2.client.*; -import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.server.*; +import jake2.util.Lib; +import jake2.util.Math3D; public class GameTurret extends GameMisc { @@ -52,21 +53,6 @@ public class GameTurret extends GameMisc { return 0.125f * (int) x; } - static EntBlockedAdapter turret_blocked = new EntBlockedAdapter() { - - public void blocked(edict_t self, edict_t other) { - edict_t attacker; - - if (other.takedamage != 0) { - if (self.teammaster.owner != null) - attacker = self.teammaster.owner; - else - attacker = self.teammaster; - T_Damage(other, self, attacker, vec3_origin, other.s.origin, vec3_origin, self.teammaster.dmg, 10, 0, MOD_CRUSH); - } - } - }; - /*QUAKED turret_breach (0 0 0) ? This portion of the turret can change both pitch and yaw. The model should be made with a flat pitch. @@ -100,132 +86,6 @@ public class GameTurret extends GameMisc { gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/rocklf1a.wav"), 1, ATTN_NORM, 0); } - static EntThinkAdapter turret_breach_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - edict_t ent; - float[] current_angles = { 0, 0, 0 }; - float[] delta = { 0, 0, 0 }; - - VectorCopy(self.s.angles, current_angles); - AnglesNormalize(current_angles); - - AnglesNormalize(self.move_angles); - if (self.move_angles[PITCH] > 180) - self.move_angles[PITCH] -= 360; - - // clamp angles to mins & maxs - if (self.move_angles[PITCH] > self.pos1[PITCH]) - self.move_angles[PITCH] = self.pos1[PITCH]; - else if (self.move_angles[PITCH] < self.pos2[PITCH]) - self.move_angles[PITCH] = self.pos2[PITCH]; - - if ((self.move_angles[YAW] < self.pos1[YAW]) || (self.move_angles[YAW] > self.pos2[YAW])) { - float dmin, dmax; - - dmin = Math.abs(self.pos1[YAW] - self.move_angles[YAW]); - if (dmin < -180) - dmin += 360; - else if (dmin > 180) - dmin -= 360; - dmax = Math.abs(self.pos2[YAW] - self.move_angles[YAW]); - if (dmax < -180) - dmax += 360; - else if (dmax > 180) - dmax -= 360; - if (Math.abs(dmin) < Math.abs(dmax)) - self.move_angles[YAW] = self.pos1[YAW]; - else - self.move_angles[YAW] = self.pos2[YAW]; - } - - VectorSubtract(self.move_angles, current_angles, delta); - if (delta[0] < -180) - delta[0] += 360; - else if (delta[0] > 180) - delta[0] -= 360; - if (delta[1] < -180) - delta[1] += 360; - else if (delta[1] > 180) - delta[1] -= 360; - delta[2] = 0; - - if (delta[0] > self.speed * FRAMETIME) - delta[0] = self.speed * FRAMETIME; - if (delta[0] < -1 * self.speed * FRAMETIME) - delta[0] = -1 * self.speed * FRAMETIME; - if (delta[1] > self.speed * FRAMETIME) - delta[1] = self.speed * FRAMETIME; - if (delta[1] < -1 * self.speed * FRAMETIME) - delta[1] = -1 * self.speed * FRAMETIME; - - VectorScale(delta, 1.0f / FRAMETIME, self.avelocity); - - self.nextthink = level.time + FRAMETIME; - - for (ent = self.teammaster; ent != null; ent = ent.teamchain) - ent.avelocity[1] = self.avelocity[1]; - - // if we have adriver, adjust his velocities - if (self.owner != null) { - float angle; - float target_z; - float diff; - float[] target = { 0, 0, 0 }; - float[] dir = { 0, 0, 0 }; - - // angular is easy, just copy ours - self.owner.avelocity[0] = self.avelocity[0]; - self.owner.avelocity[1] = self.avelocity[1]; - - // x & y - angle = self.s.angles[1] + self.owner.move_origin[1]; - angle *= (Math.PI * 2 / 360); - target[0] = SnapToEights((float) (self.s.origin[0] + Math.cos(angle) * self.owner.move_origin[0])); - target[1] = SnapToEights((float) (self.s.origin[1] + Math.sin(angle) * self.owner.move_origin[0])); - target[2] = self.owner.s.origin[2]; - - VectorSubtract(target, self.owner.s.origin, dir); - self.owner.velocity[0] = dir[0] * 1.0f / FRAMETIME; - self.owner.velocity[1] = dir[1] * 1.0f / FRAMETIME; - - // z - angle = self.s.angles[PITCH] * (float) (Math.PI * 2f / 360f); - target_z = - SnapToEights((float) (self.s.origin[2] + self.owner.move_origin[0] * Math.tan(angle) + self.owner.move_origin[2])); - - diff = target_z - self.owner.s.origin[2]; - self.owner.velocity[2] = diff * 1.0f / FRAMETIME; - - if ((self.spawnflags & 65536) != 0) { - turret_breach_fire(self); - self.spawnflags &= ~65536; - } - } - return true; - } - }; - - static EntThinkAdapter turret_breach_finish_init = new EntThinkAdapter() { - public boolean think(edict_t self) { - - // get and save info for muzzle location - if (self.target == null) { - gi.dprintf(self.classname + " at " + vtos(self.s.origin) + " needs a target\n"); - } - else { - self.target_ent = G_PickTarget(self.target); - VectorSubtract(self.target_ent.s.origin, self.s.origin, self.move_origin); - G_FreeEdict(self.target_ent); - } - - self.teammaster.dmg = self.dmg; - self.think = turret_breach_think; - self.think.think(self); - return true; - } - }; - public static void SP_turret_breach(edict_t self) { self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; @@ -251,9 +111,9 @@ public class GameTurret extends GameMisc { self.ideal_yaw = self.s.angles[YAW]; self.move_angles[YAW] = self.ideal_yaw; - self.blocked = turret_blocked; + self.blocked = GameTurretAdapters.turret_blocked; - self.think = turret_breach_finish_init; + self.think = GameTurretAdapters.turret_breach_finish_init; self.nextthink = level.time + FRAMETIME; gi.linkentity(self); } @@ -267,123 +127,10 @@ public class GameTurret extends GameMisc { self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; gi.setmodel(self, self.model); - self.blocked = turret_blocked; + self.blocked = GameTurretAdapters.turret_blocked; gi.linkentity(self); } - /*QUAKED turret_driver (1 .5 0) (-16 -16 -24) (16 16 32) - Must NOT be on the team with the rest of the turret parts. - Instead it must target the turret_breach. - */ - static EntDieAdapter turret_driver_die = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - - edict_t ent; - - // level the gun - self.target_ent.move_angles[0] = 0; - - // remove the driver from the end of them team chain - for (ent = self.target_ent.teammaster; ent.teamchain != self; ent = ent.teamchain); - ent.teamchain = null; - self.teammaster = null; - self.flags &= ~FL_TEAMSLAVE; - - self.target_ent.owner = null; - self.target_ent.teammaster.owner = null; - - //TODO: null appended as last missing argument, was unclean. rst - M_Infantry.infantry_die.die(self, inflictor, attacker, damage, null); - } - }; - - static EntThinkAdapter turret_driver_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - float[] target = { 0, 0, 0 }; - float[] dir = { 0, 0, 0 }; - float reaction_time; - - self.nextthink = level.time + FRAMETIME; - - if (self.enemy != null && (!self.enemy.inuse || self.enemy.health <= 0)) - self.enemy = null; - - if (null == self.enemy) { - if (!FindTarget(self)) - return true; - self.monsterinfo.trail_time = level.time; - self.monsterinfo.aiflags &= ~AI_LOST_SIGHT; - } - else { - if (visible(self, self.enemy)) { - if ((self.monsterinfo.aiflags & AI_LOST_SIGHT) != 0) { - self.monsterinfo.trail_time = level.time; - self.monsterinfo.aiflags &= ~AI_LOST_SIGHT; - } - } - else { - self.monsterinfo.aiflags |= AI_LOST_SIGHT; - return true; - } - } - - // let the turret know where we want it to aim - VectorCopy(self.enemy.s.origin, target); - target[2] += self.enemy.viewheight; - VectorSubtract(target, self.target_ent.s.origin, dir); - vectoangles(dir, self.target_ent.move_angles); - - // decide if we should shoot - if (level.time < self.monsterinfo.attack_finished) - return true; - - reaction_time = (3 - skill.value) * 1.0f; - if ((level.time - self.monsterinfo.trail_time) < reaction_time) - return true; - - self.monsterinfo.attack_finished = level.time + reaction_time + 1.0f; - //FIXME how do we really want to pass this along? - self.target_ent.spawnflags |= 65536; - return true; - } - }; - - public static EntThinkAdapter turret_driver_link = new EntThinkAdapter() { - public boolean think(edict_t self) { - - float[] vec = { 0, 0, 0 }; - edict_t ent; - - self.think = turret_driver_think; - self.nextthink = level.time + FRAMETIME; - - self.target_ent = G_PickTarget(self.target); - self.target_ent.owner = self; - self.target_ent.teammaster.owner = self; - VectorCopy(self.target_ent.s.angles, self.s.angles); - - vec[0] = self.target_ent.s.origin[0] - self.s.origin[0]; - vec[1] = self.target_ent.s.origin[1] - self.s.origin[1]; - vec[2] = 0; - self.move_origin[0] = VectorLength(vec); - - VectorSubtract(self.s.origin, self.target_ent.s.origin, vec); - vectoangles(vec, vec); - AnglesNormalize(vec); - self.move_origin[1] = vec[1]; - - self.move_origin[2] = self.s.origin[2] - self.target_ent.s.origin[2]; - - // add the driver to the end of them team chain - for (ent = self.target_ent.teammaster; ent.teamchain != null; ent = ent.teamchain); - ent.teamchain = self; - self.teammaster = self.target_ent.teammaster; - self.flags |= FL_TEAMSLAVE; - return true; - } - }; - public static void SP_turret_driver(edict_t self) { if (deathmatch.value != 0) { G_FreeEdict(self); @@ -401,7 +148,7 @@ public class GameTurret extends GameMisc { self.mass = 200; self.viewheight = 24; - self.die = turret_driver_die; + self.die = GameTurretAdapters.turret_driver_die; self.monsterinfo.stand = M_Infantry.infantry_stand; self.flags |= FL_NO_KNOCKBACK; @@ -411,7 +158,7 @@ public class GameTurret extends GameMisc { self.svflags |= SVF_MONSTER; self.s.renderfx |= RF_FRAMELERP; self.takedamage = DAMAGE_AIM; - self.use = monster_use; + self.use = GameUtilAdapters.monster_use; self.clipmask = MASK_MONSTERSOLID; VectorCopy(self.s.origin, self.s.old_origin); self.monsterinfo.aiflags |= AI_STAND_GROUND | AI_DUCKED; @@ -422,7 +169,7 @@ public class GameTurret extends GameMisc { gi.dprintf(self.classname + " at " + vtos(self.s.origin) + " has bad item: " + st.item + "\n"); } - self.think = turret_driver_link; + self.think = GameTurretAdapters.turret_driver_link; self.nextthink = level.time + FRAMETIME; gi.linkentity(self); diff --git a/src/jake2/game/GameTurretAdapters.java b/src/jake2/game/GameTurretAdapters.java new file mode 100644 index 0000000..e78a1fd --- /dev/null +++ b/src/jake2/game/GameTurretAdapters.java @@ -0,0 +1,283 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameTurretAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.*; +import jake2.client.*; +import jake2.qcommon.*; +import jake2.render.*; +import jake2.server.*; +import jake2.util.*; + +public class GameTurretAdapters { + + static EntBlockedAdapter turret_blocked = new EntBlockedAdapter() { + + public void blocked(edict_t self, edict_t other) { + edict_t attacker; + + if (other.takedamage != 0) { + if (self.teammaster.owner != null) + attacker = self.teammaster.owner; + else + attacker = self.teammaster; + GameUtil.T_Damage(other, self, attacker, Globals.vec3_origin, other.s.origin, Globals.vec3_origin, self.teammaster.dmg, 10, 0, Defines.MOD_CRUSH); + } + } + }; + static EntThinkAdapter turret_breach_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + + edict_t ent; + float[] current_angles = { 0, 0, 0 }; + float[] delta = { 0, 0, 0 }; + + Math3D.VectorCopy(self.s.angles, current_angles); + GameTurret.AnglesNormalize(current_angles); + + GameTurret.AnglesNormalize(self.move_angles); + if (self.move_angles[Defines.PITCH] > 180) + self.move_angles[Defines.PITCH] -= 360; + + // clamp angles to mins & maxs + if (self.move_angles[Defines.PITCH] > self.pos1[Defines.PITCH]) + self.move_angles[Defines.PITCH] = self.pos1[Defines.PITCH]; + else if (self.move_angles[Defines.PITCH] < self.pos2[Defines.PITCH]) + self.move_angles[Defines.PITCH] = self.pos2[Defines.PITCH]; + + if ((self.move_angles[Defines.YAW] < self.pos1[Defines.YAW]) || (self.move_angles[Defines.YAW] > self.pos2[Defines.YAW])) { + float dmin, dmax; + + dmin = Math.abs(self.pos1[Defines.YAW] - self.move_angles[Defines.YAW]); + if (dmin < -180) + dmin += 360; + else if (dmin > 180) + dmin -= 360; + dmax = Math.abs(self.pos2[Defines.YAW] - self.move_angles[Defines.YAW]); + if (dmax < -180) + dmax += 360; + else if (dmax > 180) + dmax -= 360; + if (Math.abs(dmin) < Math.abs(dmax)) + self.move_angles[Defines.YAW] = self.pos1[Defines.YAW]; + else + self.move_angles[Defines.YAW] = self.pos2[Defines.YAW]; + } + + Math3D.VectorSubtract(self.move_angles, current_angles, delta); + if (delta[0] < -180) + delta[0] += 360; + else if (delta[0] > 180) + delta[0] -= 360; + if (delta[1] < -180) + delta[1] += 360; + else if (delta[1] > 180) + delta[1] -= 360; + delta[2] = 0; + + if (delta[0] > self.speed * Defines.FRAMETIME) + delta[0] = self.speed * Defines.FRAMETIME; + if (delta[0] < -1 * self.speed * Defines.FRAMETIME) + delta[0] = -1 * self.speed * Defines.FRAMETIME; + if (delta[1] > self.speed * Defines.FRAMETIME) + delta[1] = self.speed * Defines.FRAMETIME; + if (delta[1] < -1 * self.speed * Defines.FRAMETIME) + delta[1] = -1 * self.speed * Defines.FRAMETIME; + + Math3D.VectorScale(delta, 1.0f / Defines.FRAMETIME, self.avelocity); + + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + + for (ent = self.teammaster; ent != null; ent = ent.teamchain) + ent.avelocity[1] = self.avelocity[1]; + + // if we have adriver, adjust his velocities + if (self.owner != null) { + float angle; + float target_z; + float diff; + float[] target = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + + // angular is easy, just copy ours + self.owner.avelocity[0] = self.avelocity[0]; + self.owner.avelocity[1] = self.avelocity[1]; + + // x & y + angle = self.s.angles[1] + self.owner.move_origin[1]; + angle *= (Math.PI * 2 / 360); + target[0] = GameTurret.SnapToEights((float) (self.s.origin[0] + Math.cos(angle) * self.owner.move_origin[0])); + target[1] = GameTurret.SnapToEights((float) (self.s.origin[1] + Math.sin(angle) * self.owner.move_origin[0])); + target[2] = self.owner.s.origin[2]; + + Math3D.VectorSubtract(target, self.owner.s.origin, dir); + self.owner.velocity[0] = dir[0] * 1.0f / Defines.FRAMETIME; + self.owner.velocity[1] = dir[1] * 1.0f / Defines.FRAMETIME; + + // z + angle = self.s.angles[Defines.PITCH] * (float) (Math.PI * 2f / 360f); + target_z = + GameTurret.SnapToEights((float) (self.s.origin[2] + self.owner.move_origin[0] * Math.tan(angle) + self.owner.move_origin[2])); + + diff = target_z - self.owner.s.origin[2]; + self.owner.velocity[2] = diff * 1.0f / Defines.FRAMETIME; + + if ((self.spawnflags & 65536) != 0) { + GameTurret.turret_breach_fire(self); + self.spawnflags &= ~65536; + } + } + return true; + } + }; + static EntThinkAdapter turret_breach_finish_init = new EntThinkAdapter() { + public boolean think(edict_t self) { + + // get and save info for muzzle location + if (self.target == null) { + GameBase.gi.dprintf(self.classname + " at " + Lib.vtos(self.s.origin) + " needs a target\n"); + } + else { + self.target_ent = GameBase.G_PickTarget(self.target); + Math3D.VectorSubtract(self.target_ent.s.origin, self.s.origin, self.move_origin); + GameUtil.G_FreeEdict(self.target_ent); + } + + self.teammaster.dmg = self.dmg; + self.think = turret_breach_think; + self.think.think(self); + return true; + } + }; + /*QUAKED turret_driver (1 .5 0) (-16 -16 -24) (16 16 32) + Must NOT be on the team with the rest of the turret parts. + Instead it must target the turret_breach. + */ + static EntDieAdapter turret_driver_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { + + edict_t ent; + + // level the gun + self.target_ent.move_angles[0] = 0; + + // remove the driver from the end of them team chain + for (ent = self.target_ent.teammaster; ent.teamchain != self; ent = ent.teamchain); + ent.teamchain = null; + self.teammaster = null; + self.flags &= ~Defines.FL_TEAMSLAVE; + + self.target_ent.owner = null; + self.target_ent.teammaster.owner = null; + + //TODO: null appended as last missing argument, was unclean. rst + M_Infantry.infantry_die.die(self, inflictor, attacker, damage, null); + } + }; + static EntThinkAdapter turret_driver_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float[] target = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + float reaction_time; + + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + + if (self.enemy != null && (!self.enemy.inuse || self.enemy.health <= 0)) + self.enemy = null; + + if (null == self.enemy) { + if (!GameUtil.FindTarget(self)) + return true; + self.monsterinfo.trail_time = GameBase.level.time; + self.monsterinfo.aiflags &= ~Defines.AI_LOST_SIGHT; + } + else { + if (GameUtil.visible(self, self.enemy)) { + if ((self.monsterinfo.aiflags & Defines.AI_LOST_SIGHT) != 0) { + self.monsterinfo.trail_time = GameBase.level.time; + self.monsterinfo.aiflags &= ~Defines.AI_LOST_SIGHT; + } + } + else { + self.monsterinfo.aiflags |= Defines.AI_LOST_SIGHT; + return true; + } + } + + // let the turret know where we want it to aim + Math3D.VectorCopy(self.enemy.s.origin, target); + target[2] += self.enemy.viewheight; + Math3D.VectorSubtract(target, self.target_ent.s.origin, dir); + Math3D.vectoangles(dir, self.target_ent.move_angles); + + // decide if we should shoot + if (GameBase.level.time < self.monsterinfo.attack_finished) + return true; + + reaction_time = (3 - GameBase.skill.value) * 1.0f; + if ((GameBase.level.time - self.monsterinfo.trail_time) < reaction_time) + return true; + + self.monsterinfo.attack_finished = GameBase.level.time + reaction_time + 1.0f; + //FIXME how do we really want to pass this along? + self.target_ent.spawnflags |= 65536; + return true; + } + }; + public static EntThinkAdapter turret_driver_link = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float[] vec = { 0, 0, 0 }; + edict_t ent; + + self.think = turret_driver_think; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + + self.target_ent = GameBase.G_PickTarget(self.target); + self.target_ent.owner = self; + self.target_ent.teammaster.owner = self; + Math3D.VectorCopy(self.target_ent.s.angles, self.s.angles); + + vec[0] = self.target_ent.s.origin[0] - self.s.origin[0]; + vec[1] = self.target_ent.s.origin[1] - self.s.origin[1]; + vec[2] = 0; + self.move_origin[0] = Math3D.VectorLength(vec); + + Math3D.VectorSubtract(self.s.origin, self.target_ent.s.origin, vec); + Math3D.vectoangles(vec, vec); + GameTurret.AnglesNormalize(vec); + self.move_origin[1] = vec[1]; + + self.move_origin[2] = self.s.origin[2] - self.target_ent.s.origin[2]; + + // add the driver to the end of them team chain + for (ent = self.target_ent.teammaster; ent.teamchain != null; ent = ent.teamchain); + ent.teamchain = self; + self.teammaster = self.target_ent.teammaster; + self.flags |= Defines.FL_TEAMSLAVE; + return true; + } + }; +} diff --git a/src/jake2/game/GameUtil.java b/src/jake2/game/GameUtil.java index e959106..ee52a89 100644 --- a/src/jake2/game/GameUtil.java +++ b/src/jake2/game/GameUtil.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 01.11.2003 by RST. -// $Id: GameUtil.java,v 1.1 2004-07-07 19:59:05 hzi Exp $ +// $Id: GameUtil.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -30,23 +30,16 @@ import jake2.client.M; import jake2.qcommon.Com; import jake2.util.*; -public class GameUtil extends GameBase { +public class GameUtil extends GameBase +{ - public static EntThinkAdapter Think_Delay = new EntThinkAdapter() { - public boolean think(edict_t ent) { - G_UseTargets(ent, ent.activator); - G_FreeEdict(ent); - return true; - } - }; - public static void checkClassname(edict_t ent) { - - if (ent.classname ==null) - { - Com.Printf("edict with classname = null: " + ent.index); - } + + if (ent.classname == null) + { + Com.Printf("edict with classname = null: " + ent.index); + } } /** @@ -61,21 +54,22 @@ public class GameUtil extends GameBase { match (string)self.target and call their .use function */ - public static void G_UseTargets(edict_t ent, edict_t activator) { + public static void G_UseTargets(edict_t ent, edict_t activator) + { edict_t t; - - checkClassname(ent); + checkClassname(ent); // // check for a delay // - if (ent.delay != 0) { + if (ent.delay != 0) + { // create a temp object to fire at a later time t = G_Spawn(); t.classname = "DelayedUse"; t.nextthink = level.time + ent.delay; - t.think = Think_Delay; + t.think = GameUtilAdapters.Think_Delay; t.activator = activator; if (activator == null) gi.dprintf("Think_Delay with no activator\n"); @@ -88,7 +82,8 @@ public class GameUtil extends GameBase { // // print the message // - if ((ent.message != null) && (activator.svflags & SVF_MONSTER) == 0) { + if ((ent.message != null) && (activator.svflags & SVF_MONSTER) == 0) + { gi.centerprintf(activator, "" + ent.message); if (ent.noise_index != 0) gi.sound(activator, CHAN_AUTO, ent.noise_index, 1, ATTN_NORM, 0); @@ -102,11 +97,14 @@ public class GameUtil extends GameBase { EdictIterator edit = null; - if (ent.killtarget != null) { - while ((edit = G_Find(edit, findByTarget, ent.killtarget)) != null) { + if (ent.killtarget != null) + { + while ((edit = G_Find(edit, findByTarget, ent.killtarget)) != null) + { t = edit.o; G_FreeEdict(t); - if (!ent.inuse) { + if (!ent.inuse) + { gi.dprintf("entity was removed while using killtargets\n"); return; } @@ -115,23 +113,28 @@ public class GameUtil extends GameBase { // fire targets - if (ent.target != null) { + if (ent.target != null) + { edit = null; - while ((edit = G_Find(edit, findByTarget, ent.target)) != null) { + while ((edit = G_Find(edit, findByTarget, ent.target)) != null) + { t = edit.o; // doors fire area portals in a specific way if (Lib.Q_stricmp("func_areaportal", t.classname) == 0 && (Lib.Q_stricmp("func_door", ent.classname) == 0 || Lib.Q_stricmp("func_door_rotating", ent.classname) == 0)) continue; - if (t == ent) { + if (t == ent) + { gi.dprintf("WARNING: Entity used itself.\n"); } - else { + else + { if (t.use != null) t.use.use(t, ent, activator); } - if (!ent.inuse) { + if (!ent.inuse) + { gi.dprintf("entity was removed while using targets\n"); return; } @@ -139,12 +142,14 @@ public class GameUtil extends GameBase { } } - public static void G_InitEdict(edict_t e, int i) { + public static void G_InitEdict(edict_t e, int i) + { e.inuse = true; e.classname = "noclass"; e.gravity = 1.0f; - //e.s.number= e - g_edicts;� - e.s.number= i; + //e.s.number= e - g_edicts; + e.s = new entity_state_t(e); + e.s.number = i; e.index = i; } @@ -155,15 +160,19 @@ public class GameUtil extends GameBase { * instead of being removed and recreated, which can cause interpolated * angles and bad trails. */ - public static edict_t G_Spawn() { + public static edict_t G_Spawn() + { int i; edict_t e = null; - for (i = (int) maxclients.value + 1; i < globals.num_edicts; i++) { + for (i = (int) maxclients.value + 1; i < globals.num_edicts; i++) + { e = g_edicts[i]; // the first couple seconds of server time can involve a lot of // freeing and allocating, so relax the replacement policy - if (!e.inuse && (e.freetime < 2 || level.time - e.freetime > 0.5)) { + if (!e.inuse && (e.freetime < 2 || level.time - e.freetime > 0.5)) + { + e = g_edicts[i] = new edict_t(i); G_InitEdict(e, i); return e; } @@ -172,33 +181,29 @@ public class GameUtil extends GameBase { if (i == game.maxentities) gi.error("ED_Alloc: no free edicts"); - e = g_edicts[i]; + e = g_edicts[i] = new edict_t(i); globals.num_edicts++; G_InitEdict(e, i); return e; } - public static EntThinkAdapter G_FreeEdictA = new EntThinkAdapter() { - public boolean think(edict_t ent) { - G_FreeEdict(ent); - return false; - } - }; - /** * Marks the edict as free */ - public static void G_FreeEdict(edict_t ed) { + public static void G_FreeEdict(edict_t ed) + { gi.unlinkentity(ed); // unlink from world //if ((ed - g_edicts) <= (maxclients.value + BODY_QUEUE_SIZE)) - if (ed.index <= (maxclients.value + BODY_QUEUE_SIZE)) { + if (ed.index <= (maxclients.value + BODY_QUEUE_SIZE)) + { // gi.dprintf("tried to free special edict\n"); return; } //memset(ed, 0, sizeof(* ed)); - ed.clear(); + g_edicts[ed.index] = new edict_t(ed.index); + //ed.clear(); ed.classname = "freed"; ed.freetime = level.time; ed.inuse = false; @@ -209,7 +214,15 @@ public class GameUtil extends GameBase { * to force all entities it covers to immediately touch it. */ - public static void G_TouchSolids(edict_t ent) { + public static void G_ClearEdict(edict_t ent) + { + int i= ent.index; + g_edicts[i] = new edict_t(i); + } + + + public static void G_TouchSolids(edict_t ent) + { int i, num; edict_t touch[] = new edict_t[MAX_EDICTS], hit; @@ -217,12 +230,15 @@ public class GameUtil extends GameBase { // be careful, it is possible to have an entity in this // list removed before we get to it (killtriggered) - for (i = 0; i < num; i++) { + for (i = 0; i < num; i++) + { hit = touch[i]; if (!hit.inuse) continue; if (ent.touch != null) - ent.touch.touch(hit, ent, null, null); + { + ent.touch.touch(hit, ent, GameBase.dummyplane, null); + } if (!ent.inuse) break; } @@ -233,10 +249,12 @@ public class GameUtil extends GameBase { * of ent. Ent should be unlinked before calling this! */ - public static boolean KillBox(edict_t ent) { + public static boolean KillBox(edict_t ent) + { trace_t tr; - while (true) { + while (true) + { tr = gi.trace(ent.s.origin, ent.mins, ent.maxs, ent.s.origin, null, MASK_PLAYERSOLID); if (tr.ent == null || tr.ent == g_edicts[0]) break; @@ -252,7 +270,8 @@ public class GameUtil extends GameBase { return true; // all clear } - public static boolean OnSameTeam(edict_t ent1, edict_t ent2) { + public static boolean OnSameTeam(edict_t ent1, edict_t ent2) + { if (0 == ((int) (dmflags.value) & (DF_MODELTEAMS | DF_SKINTEAMS))) return false; @@ -262,7 +281,8 @@ public class GameUtil extends GameBase { } /** TODO: test, / replaced the string operations. */ - static String ClientTeam(edict_t ent) { + static String ClientTeam(edict_t ent) + { String value; if (ent.client == null) @@ -275,264 +295,31 @@ public class GameUtil extends GameBase { if (p == -1) return value; - if (((int) (dmflags.value) & DF_MODELTEAMS) != 0) { + if (((int) (dmflags.value) & DF_MODELTEAMS) != 0) + { return value.substring(0, p); } return value.substring(p + 1, value.length()); } - static EntThinkAdapter MegaHealth_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.owner.health > self.owner.max_health) { - self.nextthink = level.time + 1; - self.owner.health -= 1; - return false; - } - - if (!((self.spawnflags & DROPPED_ITEM) != 0) && (deathmatch.value != 0)) - SetRespawn(self, 20); - else - G_FreeEdict(self); - - return false; - } - }; - - static EntThinkAdapter DoRespawn = new EntThinkAdapter() { - public boolean think(edict_t ent) { - if (ent.team != null) { - edict_t master; - int count; - int choice = 0; - - master = ent.teammaster; - - // tiefe z�hlen - // count the depth - for (count = 0, ent = master; ent != null; ent = ent.chain, count++); - - choice = Lib.rand() % count; - - for (count = 0, ent = master; count < choice; ent = ent.chain, count++); - } - - ent.svflags &= ~SVF_NOCLIENT; - ent.solid = SOLID_TRIGGER; - gi.linkentity(ent); - - // send an effect - ent.s.event = EV_ITEM_RESPAWN; - - return false; - } - }; - - static void SetRespawn(edict_t ent, float delay) { + static void SetRespawn(edict_t ent, float delay) + { ent.flags |= FL_RESPAWN; ent.svflags |= SVF_NOCLIENT; ent.solid = SOLID_NOT; ent.nextthink = level.time + delay; - ent.think = DoRespawn; + ent.think = GameUtilAdapters.DoRespawn; gi.linkentity(ent); } - static EntInteractAdapter Pickup_Pack = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - - gitem_t item; - int index; - - if (other.client.pers.max_bullets < 300) - other.client.pers.max_bullets = 300; - if (other.client.pers.max_shells < 200) - other.client.pers.max_shells = 200; - if (other.client.pers.max_rockets < 100) - other.client.pers.max_rockets = 100; - if (other.client.pers.max_grenades < 100) - other.client.pers.max_grenades = 100; - if (other.client.pers.max_cells < 300) - other.client.pers.max_cells = 300; - if (other.client.pers.max_slugs < 100) - other.client.pers.max_slugs = 100; - - 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; - } - - item = FindItem("Cells"); - if (item != null) { - index = ITEM_INDEX(item); - other.client.pers.inventory[index] += item.quantity; - if (other.client.pers.inventory[index] > other.client.pers.max_cells) - other.client.pers.inventory[index] = other.client.pers.max_cells; - } - - item = FindItem("Grenades"); - if (item != null) { - index = ITEM_INDEX(item); - other.client.pers.inventory[index] += item.quantity; - if (other.client.pers.inventory[index] > other.client.pers.max_grenades) - other.client.pers.inventory[index] = other.client.pers.max_grenades; - } - - item = FindItem("Rockets"); - if (item != null) { - index = ITEM_INDEX(item); - other.client.pers.inventory[index] += item.quantity; - if (other.client.pers.inventory[index] > other.client.pers.max_rockets) - other.client.pers.inventory[index] = other.client.pers.max_rockets; - } - - item = FindItem("Slugs"); - if (item != null) { - index = ITEM_INDEX(item); - other.client.pers.inventory[index] += item.quantity; - if (other.client.pers.inventory[index] > other.client.pers.max_slugs) - other.client.pers.inventory[index] = other.client.pers.max_slugs; - } - - if (0 == (ent.spawnflags & DROPPED_ITEM) && (deathmatch.value != 0)) - SetRespawn(ent, ent.item.quantity); - - return true; - } - }; - - final static EntInteractAdapter Pickup_Health = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - - if (0 == (ent.style & HEALTH_IGNORE_MAX)) - if (other.health >= other.max_health) - return false; - - other.health += ent.count; - - if (0 == (ent.style & HEALTH_IGNORE_MAX)) { - if (other.health > other.max_health) - other.health = other.max_health; - } - - if (0 != (ent.style & HEALTH_TIMED)) { - ent.think = MegaHealth_think; - ent.nextthink = level.time + 5f; - ent.owner = other; - ent.flags |= FL_RESPAWN; - ent.svflags |= SVF_NOCLIENT; - ent.solid = SOLID_NOT; - } - else { - if (!((ent.spawnflags & DROPPED_ITEM) != 0) && (deathmatch.value != 0)) - SetRespawn(ent, 30); - } - - return true; - } - - }; - - static int ITEM_INDEX(gitem_t item) { + static int ITEM_INDEX(gitem_t item) + { return item.index; } - /* - =============== - Touch_Item - =============== - */ - - static EntTouchAdapter Touch_Item = new EntTouchAdapter() { - public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { - boolean taken; - - if (other.client == null) - return; - if (other.health < 1) - return; // dead people can't pickup - if (ent.item.pickup == null) - return; // not a grabbable item? - - taken = ent.item.pickup.interact(ent, other); - - if (taken) { - // flash the screen - other.client.bonus_alpha = 0.25f; - - // show icon and name on status bar - other.client.ps.stats[STAT_PICKUP_ICON] = (short) gi.imageindex(ent.item.icon); - other.client.ps.stats[STAT_PICKUP_STRING] = (short) (CS_ITEMS + ITEM_INDEX(ent.item)); - other.client.pickup_msg_time = level.time + 3.0f; - - // change selected item - 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.count == 2) - gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0); - else if (ent.count == 10) - gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0); - else if (ent.count == 25) - gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0); - 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) { - gi.sound(other, CHAN_ITEM, gi.soundindex(ent.item.pickup_sound), 1, ATTN_NORM, 0); - } - } - - if (0 == (ent.spawnflags & ITEM_TARGETS_USED)) { - G_UseTargets(ent, other); - ent.spawnflags |= ITEM_TARGETS_USED; - } - - if (!taken) - return; - - if (!((coop.value != 0) && (ent.item.flags & IT_STAY_COOP) != 0) - || 0 != (ent.spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM))) { - if ((ent.flags & FL_RESPAWN) != 0) - ent.flags &= ~FL_RESPAWN; - else - G_FreeEdict(ent); - } - } - }; - - static EntTouchAdapter drop_temp_touch = new EntTouchAdapter() { - public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { - if (other == ent.owner) - return; - - Touch_Item.touch(ent, other, plane, surf); - } - }; - - static EntThinkAdapter drop_make_touchable = new EntThinkAdapter() { - public boolean think(edict_t ent) { - ent.touch = Touch_Item; - if (deathmatch.value != 0) { - ent.nextthink = level.time + 29; - ent.think = G_FreeEdictA; - } - return false; - } - }; - - static edict_t Drop_Item(edict_t ent, gitem_t item) { + static edict_t Drop_Item(edict_t ent, gitem_t item) + { edict_t dropped; float[] forward = { 0, 0, 0 }; float[] right = { 0, 0, 0 }; @@ -551,11 +338,12 @@ public class GameUtil extends GameBase { dropped.solid = SOLID_TRIGGER; dropped.movetype = MOVETYPE_TOSS; - dropped.touch = drop_temp_touch; + dropped.touch = GameUtilAdapters.drop_temp_touch; dropped.owner = ent; - if (ent.client != null) { + if (ent.client != null) + { trace_t trace; Math3D.AngleVectors(ent.client.v_angle, forward, right, null); @@ -564,7 +352,8 @@ public class GameUtil extends GameBase { trace = gi.trace(ent.s.origin, dropped.mins, dropped.maxs, dropped.s.origin, ent, CONTENTS_SOLID); Math3D.VectorCopy(trace.endpos, dropped.s.origin); } - else { + else + { Math3D.AngleVectors(ent.s.angles, forward, right, null); Math3D.VectorCopy(ent.s.origin, dropped.s.origin); } @@ -572,7 +361,7 @@ public class GameUtil extends GameBase { Math3D.VectorScale(forward, 100, dropped.velocity); dropped.velocity[2] = 300; - dropped.think = drop_make_touchable; + dropped.think = GameUtilAdapters.drop_make_touchable; dropped.nextthink = level.time + 1; gi.linkentity(dropped); @@ -580,7 +369,8 @@ public class GameUtil extends GameBase { return dropped; } - static void ValidateSelectedItem(edict_t ent) { + static void ValidateSelectedItem(edict_t ent) + { gclient_t cl; cl = ent.client; @@ -591,151 +381,25 @@ public class GameUtil extends GameBase { GameAI.SelectNextItem(ent, -1); } - static int quad_drop_timeout_hack = 0; - - static ItemUseAdapter Use_Quad = new ItemUseAdapter() { - - public void use(edict_t ent, gitem_t item) { - int timeout; - - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); - - if (quad_drop_timeout_hack != 0) { - timeout = quad_drop_timeout_hack; - quad_drop_timeout_hack = 0; - } - else { - timeout = 300; - } - - if (ent.client.quad_framenum > level.framenum) - ent.client.quad_framenum += timeout; - else - ent.client.quad_framenum = level.framenum + timeout; - - gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); - } - }; - - static ItemUseAdapter Use_Invulnerability = new ItemUseAdapter() { - public void use(edict_t ent, gitem_t item) { - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); - - if (ent.client.invincible_framenum > level.framenum) - ent.client.invincible_framenum += 300; - else - ent.client.invincible_framenum = level.framenum + 300; - - gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0); - } - }; - - static void Use_Item(edict_t ent, edict_t other, edict_t activator) { + static void Use_Item(edict_t ent, edict_t other, edict_t activator) + { ent.svflags &= ~SVF_NOCLIENT; ent.use = null; - if ((ent.spawnflags & ITEM_NO_TOUCH) != 0) { + if ((ent.spawnflags & ITEM_NO_TOUCH) != 0) + { ent.solid = SOLID_BBOX; ent.touch = null; } - else { + else + { ent.solid = SOLID_TRIGGER; - ent.touch = Touch_Item; + ent.touch = GameUtilAdapters.Touch_Item; } gi.linkentity(ent); } - // ====================================================================== - - static ItemUseAdapter Use_Breather = new ItemUseAdapter() { - public void use(edict_t ent, gitem_t item) { - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); - - if (ent.client.breather_framenum > level.framenum) - ent.client.breather_framenum += 300; - else - ent.client.breather_framenum = level.framenum + 300; - - // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); - } - }; - - // ====================================================================== - - static ItemUseAdapter Use_Envirosuit = new ItemUseAdapter() { - public void use(edict_t ent, gitem_t item) { - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); - - if (ent.client.enviro_framenum > level.framenum) - ent.client.enviro_framenum += 300; - else - ent.client.enviro_framenum = level.framenum + 300; - - // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); - } - }; - - // ====================================================================== - /* - static ItemUseAdapter Use_Invulnerability = new ItemUseAdapter() - { - public void use(edict_t ent, gitem_t item) - { - - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); - - if (ent.client.invincible_framenum > level.framenum) - ent.client.invincible_framenum += 300; - else - ent.client.invincible_framenum = level.framenum + 300; - - gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0); - } - }; - */ - - // ====================================================================== - - static ItemUseAdapter Use_Silencer = new ItemUseAdapter() { - public void use(edict_t ent, gitem_t item) { - - ent.client.pers.inventory[ITEM_INDEX(item)]--; - ValidateSelectedItem(ent); - ent.client.silencer_shots += 30; - - // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); - } - }; - - // ====================================================================== - - static EntInteractAdapter Pickup_Key = new EntInteractAdapter() { - public boolean interact(edict_t ent, edict_t other) { - if (coop.value != 0) { - if (Lib.strcmp(ent.classname, "key_power_cube") == 0) { - if ((other.client.pers.power_cubes & ((ent.spawnflags & 0x0000ff00) >> 8)) != 0) - return false; - other.client.pers.inventory[ITEM_INDEX(ent.item)]++; - other.client.pers.power_cubes |= ((ent.spawnflags & 0x0000ff00) >> 8); - } - else { - if (other.client.pers.inventory[ITEM_INDEX(ent.item)] != 0) - return false; - other.client.pers.inventory[ITEM_INDEX(ent.item)] = 1; - } - return true; - } - other.client.pers.inventory[ITEM_INDEX(ent.item)]++; - return true; - } - }; - /* ============ CanDamage @@ -744,12 +408,14 @@ public class GameUtil extends GameBase { explosions and melee attacks. ============ */ - static boolean CanDamage(edict_t targ, edict_t inflictor) { + static boolean CanDamage(edict_t targ, edict_t inflictor) + { float[] dest = { 0, 0, 0 }; trace_t trace; // bmodels need special checking because their origin is 0,0,0 - if (targ.movetype == MOVETYPE_PUSH) { + if (targ.movetype == MOVETYPE_PUSH) + { Math3D.VectorAdd(targ.absmin, targ.absmax, dest); Math3D.VectorScale(dest, 0.5f, dest); trace = gi.trace(inflictor.s.origin, vec3_origin, vec3_origin, dest, inflictor, MASK_SOLID); @@ -805,7 +471,8 @@ public class GameUtil extends GameBase { int damage, int knockback, int dflags, - int mod) { + int mod) + { gclient_t client; int take; int save; @@ -813,15 +480,17 @@ public class GameUtil extends GameBase { int psave; int te_sparks; - if (targ.takedamage != 0) + if (targ.takedamage == 0) return; // friendly fire avoidance // if enabled you can't hurt teammates (but you can hurt yourself) // knockback still occurs if ((targ != attacker) - && ((deathmatch.value != 0 && 0 != ((int) (dmflags.value) & (DF_MODELTEAMS | DF_SKINTEAMS))) || coop.value != 0)) { - if (OnSameTeam(targ, attacker)) { + && ((deathmatch.value != 0 && 0 != ((int) (dmflags.value) & (DF_MODELTEAMS | DF_SKINTEAMS))) || coop.value != 0)) + { + if (OnSameTeam(targ, attacker)) + { if (((int) (dmflags.value) & DF_NO_FRIENDLY_FIRE) != 0) damage = 0; else @@ -831,7 +500,8 @@ public class GameUtil extends GameBase { meansOfDeath = mod; // easy mode takes half damage - if (skill.value == 0 && deathmatch.value == 0 && targ.client != null) { + if (skill.value == 0 && deathmatch.value == 0 && targ.client != null) + { damage *= 0.5; if (damage == 0) damage = 1; @@ -858,12 +528,14 @@ public class GameUtil extends GameBase { knockback = 0; // figure momentum add - if (0 == (dflags & DAMAGE_NO_KNOCKBACK)) { + if (0 == (dflags & DAMAGE_NO_KNOCKBACK)) + { if ((knockback != 0) && (targ.movetype != MOVETYPE_NONE) && (targ.movetype != MOVETYPE_BOUNCE) && (targ.movetype != MOVETYPE_PUSH) - && (targ.movetype != MOVETYPE_STOP)) { + && (targ.movetype != MOVETYPE_STOP)) + { float[] kvel = { 0, 0, 0 }; float mass; @@ -886,15 +558,18 @@ public class GameUtil extends GameBase { save = 0; // check for godmode - if ((targ.flags & FL_GODMODE) != 0 && 0 == (dflags & DAMAGE_NO_PROTECTION)) { + if ((targ.flags & FL_GODMODE) != 0 && 0 == (dflags & DAMAGE_NO_PROTECTION)) + { take = 0; save = damage; SpawnDamage(te_sparks, point, normal, save); } // check for invincibility - if ((client != null && client.invincible_framenum > level.framenum) && 0 == (dflags & DAMAGE_NO_PROTECTION)) { - if (targ.pain_debounce_time < level.time) { + if ((client != null && client.invincible_framenum > level.framenum) && 0 == (dflags & DAMAGE_NO_PROTECTION)) + { + if (targ.pain_debounce_time < level.time) + { gi.sound(targ, CHAN_ITEM, gi.soundindex("items/protect4.wav"), 1, ATTN_NORM, 0); targ.pain_debounce_time = level.time + 2; } @@ -916,7 +591,8 @@ public class GameUtil extends GameBase { return; // do the damage - if (take != 0) { + if (take != 0) + { if (0 != (targ.svflags & SVF_MONSTER) || (client != null)) SpawnDamage(TE_BLOOD, point, normal, take); else @@ -924,7 +600,8 @@ public class GameUtil extends GameBase { targ.health = targ.health - take; - if (targ.health <= 0) { + if (targ.health <= 0) + { if ((targ.svflags & SVF_MONSTER) != 0 || (client != null)) targ.flags |= FL_NO_KNOCKBACK; Killed(targ, inflictor, attacker, take, point); @@ -932,20 +609,24 @@ public class GameUtil extends GameBase { } } - if ((targ.svflags & SVF_MONSTER) != 0) { + if ((targ.svflags & SVF_MONSTER) != 0) + { M.M_ReactToDamage(targ, attacker); - if (0 != (targ.monsterinfo.aiflags & AI_DUCKED) && (take != 0)) { + if (0 == (targ.monsterinfo.aiflags & AI_DUCKED) && (take != 0)) + { targ.pain.pain(targ, attacker, knockback, take); // nightmare mode monsters don't go into pain frames often if (skill.value == 3) targ.pain_debounce_time = level.time + 5; } } - else if (client != null) { + else if (client != null) + { if (((targ.flags & FL_GODMODE) == 0) && (take != 0)) targ.pain.pain(targ, attacker, knockback, take); } - else if (take != 0) { + else if (take != 0) + { if (targ.pain != null) targ.pain.pain(targ, attacker, knockback, take); } @@ -953,7 +634,8 @@ public class GameUtil extends GameBase { // add to the damage inflicted on a player this frame // the total will be turned into screen blends and view angle kicks // at the end of the frame - if (client != null) { + if (client != null) + { client.damage_parmor += psave; client.damage_armor += asave; client.damage_blood += take; @@ -967,18 +649,21 @@ public class GameUtil extends GameBase { Killed ============ */ - public static void Killed(edict_t targ, edict_t inflictor, edict_t attacker, int damage, float[] point) { + public static void Killed(edict_t targ, edict_t inflictor, edict_t attacker, int damage, float[] point) + { if (targ.health < -999) targ.health = -999; - Com.Println("Killed:" + targ.classname); + //Com.Println("Killed:" + targ.classname); targ.enemy = attacker; - if ((targ.svflags & SVF_MONSTER) != 0 && (targ.deadflag != DEAD_DEAD)) { + if ((targ.svflags & SVF_MONSTER) != 0 && (targ.deadflag != DEAD_DEAD)) + { // targ.svflags |= SVF_DEADMONSTER; // now treat as a different content type - if (0 == (targ.monsterinfo.aiflags & AI_GOOD_GUY)) { + if (0 == (targ.monsterinfo.aiflags & AI_GOOD_GUY)) + { level.killed_monsters++; - if (!(coop.value != 0 && attacker.client != null)) + if (coop.value != 0 && attacker.client != null) attacker.client.resp.score++; // medics won't heal monsters that they kill themselves if (attacker.classname.equals("monster_medic")) @@ -986,14 +671,14 @@ public class GameUtil extends GameBase { } } - if (targ.movetype == MOVETYPE_PUSH - || targ.movetype == MOVETYPE_STOP - || targ.movetype == MOVETYPE_NONE) { // doors, triggers, etc + if (targ.movetype == MOVETYPE_PUSH || targ.movetype == MOVETYPE_STOP || targ.movetype == MOVETYPE_NONE) + { // doors, triggers, etc targ.die.die(targ, inflictor, attacker, damage, point); return; } - if ((targ.svflags & SVF_MONSTER) != 0 && (targ.deadflag != DEAD_DEAD)) { + if ((targ.svflags & SVF_MONSTER) != 0 && (targ.deadflag != DEAD_DEAD)) + { targ.touch = null; Monster.monster_death_use(targ); } @@ -1006,7 +691,8 @@ public class GameUtil extends GameBase { SpawnDamage ================ */ - static void SpawnDamage(int type, float[] origin, float[] normal, int damage) { + static void SpawnDamage(int type, float[] origin, float[] normal, int damage) + { if (damage > 255) damage = 255; gi.WriteByte(svc_temp_entity); @@ -1017,29 +703,25 @@ public class GameUtil extends GameBase { gi.multicast(origin, MULTICAST_PVS); } - static int PowerArmorType(edict_t ent) { + static int PowerArmorType(edict_t ent) + { if (ent.client == null) return POWER_ARMOR_NONE; if (0 == (ent.flags & FL_POWER_ARMOR)) return POWER_ARMOR_NONE; - if (ent.client.pers.inventory[power_shield_index] > 0) + if (ent.client.pers.inventory[GameUtilAdapters.power_shield_index] > 0) return POWER_ARMOR_SHIELD; - if (ent.client.pers.inventory[power_screen_index] > 0) + if (ent.client.pers.inventory[GameUtilAdapters.power_screen_index] > 0) return POWER_ARMOR_SCREEN; return POWER_ARMOR_NONE; } - static int jacket_armor_index; - static int combat_armor_index; - static int body_armor_index; - static int power_screen_index; - static int power_shield_index; - - static int CheckPowerArmor(edict_t ent, float[] point, float[] normal, int damage, int dflags) { + static int CheckPowerArmor(edict_t ent, float[] point, float[] normal, int damage, int dflags) + { gclient_t client; int save; int power_armor_type; @@ -1057,14 +739,17 @@ public class GameUtil extends GameBase { if ((dflags & DAMAGE_NO_ARMOR) != 0) return 0; - if (client != null) { + if (client != null) + { power_armor_type = PowerArmorType(ent); - if (power_armor_type != POWER_ARMOR_NONE) { + if (power_armor_type != POWER_ARMOR_NONE) + { index = ITEM_INDEX(FindItem("Cells")); power = client.pers.inventory[index]; } } - else if ((ent.svflags & SVF_MONSTER) != 0) { + else if ((ent.svflags & SVF_MONSTER) != 0) + { power_armor_type = ent.monsterinfo.power_armor_type; power = ent.monsterinfo.power_armor_power; } @@ -1076,7 +761,8 @@ public class GameUtil extends GameBase { if (power == 0) return 0; - if (power_armor_type == POWER_ARMOR_SCREEN) { + if (power_armor_type == POWER_ARMOR_SCREEN) + { float[] vec = { 0, 0, 0 }; float dot; float[] forward = { 0, 0, 0 }; @@ -1093,7 +779,8 @@ public class GameUtil extends GameBase { pa_te_type = TE_SCREEN_SPARKS; damage = damage / 3; } - else { + else + { damagePerCell = 2; pa_te_type = TE_SHIELD_SPARKS; damage = (2 * damage) / 3; @@ -1122,19 +809,23 @@ public class GameUtil extends GameBase { * The monster is walking it's beat. * */ - static void ai_walk(edict_t self, float dist) { + static void ai_walk(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) { + 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 { + else + { self.monsterinfo.idle_time = level.time + Lib.random() * 15; } } @@ -1144,195 +835,6 @@ public class GameUtil extends GameBase { ============= range - returns the range catagorization of an entity reletive to self. - 0 melee range, will become hostile even if back is turned - 1 visibility and infront, or visibility and show hostile - 2 infront and show hostile - 3 only triggered by damage - - */ - // static int range(edict_t self, edict_t other) - // { - // float[] v= { 0, 0, 0 }; - // float len; - // - // VectorSubtract(self.s.origin, other.s.origin, v); - // len= VectorLength(v); - // if (len < MELEE_DISTANCE) - // return RANGE_MELEE; - // if (len < 500) - // return RANGE_NEAR; - // if (len < 1000) - // return RANGE_MID; - // return RANGE_FAR; - // } - - // ============================================================================ - - static EntThinkAdapter M_CheckAttack = new EntThinkAdapter() { - - public boolean think(edict_t self) { - float[] spot1 = { 0, 0, 0 }; - - float[] spot2 = { 0, 0, 0 }; - float chance; - trace_t tr; - - if (self.enemy.health > 0) { - // see if any entities are in the way of the shot - Math3D.VectorCopy(self.s.origin, spot1); - spot1[2] += self.viewheight; - Math3D.VectorCopy(self.enemy.s.origin, spot2); - spot2[2] += self.enemy.viewheight; - - tr = - gi.trace( - spot1, - null, - null, - spot2, - self, - CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_SLIME | CONTENTS_LAVA | CONTENTS_WINDOW); - - // do we have a clear shot? - if (tr.ent != self.enemy) - return false; - } - - // melee attack - if (enemy_range == RANGE_MELEE) { - // don't always melee in easy mode - if (skill.value == 0 && (Lib.rand() & 3) != 0) - return false; - if (self.monsterinfo.melee != null) - self.monsterinfo.attack_state = AS_MELEE; - else - self.monsterinfo.attack_state = AS_MISSILE; - return true; - } - - // missile attack - if (self.monsterinfo.attack == null) - return false; - - if (level.time < self.monsterinfo.attack_finished) - return false; - - if (enemy_range == RANGE_FAR) - return false; - - if ((self.monsterinfo.aiflags & AI_STAND_GROUND) != 0) { - chance = 0.4f; - } - else if (enemy_range == RANGE_MELEE) { - chance = 0.2f; - } - else if (enemy_range == RANGE_NEAR) { - chance = 0.1f; - } - else if (enemy_range == RANGE_MID) { - chance = 0.02f; - } - else { - return false; - } - - if (skill.value == 0) - chance *= 0.5; - else if (skill.value >= 2) - chance *= 2; - - if (Lib.random() < chance) { - self.monsterinfo.attack_state = AS_MISSILE; - self.monsterinfo.attack_finished = level.time + 2 * Lib.random(); - return true; - } - - if ((self.flags & FL_FLY) != 0) { - if (Lib.random() < 0.3f) - self.monsterinfo.attack_state = AS_SLIDING; - else - self.monsterinfo.attack_state = AS_STRAIGHT; - } - - return false; - - } - }; - - static EntUseAdapter monster_use = new EntUseAdapter() { - public void use(edict_t self, edict_t other, edict_t activator) { - if (self.enemy != null) - return; - if (self.health <= 0) - return; - if ((activator.flags & FL_NOTARGET) != 0) - return; - if ((null == activator.client) && 0 == (activator.monsterinfo.aiflags & AI_GOOD_GUY)) - return; - - // delay reaction so if the monster is teleported, its sound is still heard - self.enemy = activator; - FoundTarget(self); - } - }; - - static boolean monster_start(edict_t self) { - if (deathmatch.value != 0) { - G_FreeEdict(self); - return false; - } - - if ((self.spawnflags & 4) != 0 && 0 == (self.monsterinfo.aiflags & AI_GOOD_GUY)) { - self.spawnflags &= ~4; - self.spawnflags |= 1; - // gi.dprintf("fixed spawnflags on %s at %s\n", self.classname, vtos(self.s.origin)); - } - - if (0 == (self.monsterinfo.aiflags & AI_GOOD_GUY)) - level.total_monsters++; - - self.nextthink = level.time + FRAMETIME; - self.svflags |= SVF_MONSTER; - self.s.renderfx |= RF_FRAMELERP; - self.takedamage = DAMAGE_AIM; - self.air_finished = level.time + 12; - - // monster_use() - self.use = monster_use; - - self.max_health = self.health; - self.clipmask = MASK_MONSTERSOLID; - - self.s.skinnum = 0; - self.deadflag = DEAD_NO; - self.svflags &= ~SVF_DEADMONSTER; - - if (self.monsterinfo.checkattack == null) - // M_CheckAttack; - self.monsterinfo.checkattack = M_CheckAttack; - - Math3D.VectorCopy(self.s.origin, self.s.old_origin); - - if (st.item != null) { - self.item = FindItemByClassname(st.item); - if (self.item == null) - gi.dprintf("" + self.classname + " at " + Lib.vtos(self.s.origin) + " has bad item: " + st.item + "\n"); - } - - // randomize what frame they start on - if (self.monsterinfo.currentmove != null) - self.s.frame = - self.monsterinfo.currentmove.firstframe - + (Lib.rand() % (self.monsterinfo.currentmove.lastframe - self.monsterinfo.currentmove.firstframe + 1)); - - return true; - } - - /* - ============= - range - returns the range catagorization of an entity reletive to self 0 melee range, will become hostile even if back is turned 1 visibility and infront, or visibility and show hostile @@ -1340,7 +842,8 @@ public class GameUtil extends GameBase { 3 only triggered by damage ============= */ - static int range(edict_t self, edict_t other) { + static int range(edict_t self, edict_t other) + { float[] v = { 0, 0, 0 }; float len; @@ -1361,9 +864,11 @@ public class GameUtil extends GameBase { =============== */ - static gitem_t FindItemByClassname(String classname) { + static gitem_t FindItemByClassname(String classname) + { - for (int i = 1; i < game.num_items; i++) { + for (int i = 1; i < game.num_items; i++) + { gitem_t it = GameAI.itemlist[i]; if (it.classname == null) @@ -1381,9 +886,11 @@ public class GameUtil extends GameBase { =============== */ //geht. - static gitem_t FindItem(String pickup_name) { - Com.Printf("FindItem:" + pickup_name + "\n"); - for (int i = 1; i < game.num_items; i++) { + static gitem_t FindItem(String pickup_name) + { + //Com.Printf("FindItem:" + pickup_name + "\n"); + for (int i = 1; i < game.num_items; i++) + { gitem_t it = GameAI.itemlist[i]; if (it.pickup_name == null) @@ -1391,27 +898,29 @@ public class GameUtil extends GameBase { if (it.pickup_name.equalsIgnoreCase(pickup_name)) return it; } - Com.p("Item not found:" +pickup_name); + Com.p("Item not found:" + pickup_name); return null; } - static int ArmorIndex(edict_t ent) { + static int ArmorIndex(edict_t ent) + { if (ent.client == null) return 0; - if (ent.client.pers.inventory[jacket_armor_index] > 0) - return jacket_armor_index; + if (ent.client.pers.inventory[GameUtilAdapters.jacket_armor_index] > 0) + return GameUtilAdapters.jacket_armor_index; - if (ent.client.pers.inventory[combat_armor_index] > 0) - return combat_armor_index; + if (ent.client.pers.inventory[GameUtilAdapters.combat_armor_index] > 0) + return GameUtilAdapters.combat_armor_index; - if (ent.client.pers.inventory[body_armor_index] > 0) - return body_armor_index; + if (ent.client.pers.inventory[GameUtilAdapters.body_armor_index] > 0) + return GameUtilAdapters.body_armor_index; return 0; } - static int CheckArmor(edict_t ent, float[] point, float[] normal, int damage, int te_sparks, int dflags) { + static int CheckArmor(edict_t ent, float[] point, float[] normal, int damage, int te_sparks, int dflags) + { gclient_t client; int save; int index; @@ -1453,12 +962,8 @@ public class GameUtil extends GameBase { return save; } - static boolean enemy_vis; - static boolean enemy_infront; - static int enemy_range; - static float enemy_yaw; - - static void AttackFinished(edict_t self, float time) { + static void AttackFinished(edict_t self, float time) + { self.monsterinfo.attack_finished = level.time + time; } @@ -1469,7 +974,8 @@ public class GameUtil extends GameBase { returns true if the entity is in front (in sight) of self ============= */ - static boolean infront(edict_t self, edict_t other) { + static boolean infront(edict_t self, edict_t other) + { float[] vec = { 0, 0, 0 }; float dot; float[] forward = { 0, 0, 0 }; @@ -1491,7 +997,8 @@ public class GameUtil extends GameBase { returns 1 if the entity is visible to self, even if not infront () ============= */ - public static boolean visible(edict_t self, edict_t other) { + public static boolean visible(edict_t self, edict_t other) + { float[] spot1 = { 0, 0, 0 }; float[] spot2 = { 0, 0, 0 }; trace_t trace; @@ -1520,7 +1027,8 @@ public class GameUtil extends GameBase { In coop games, sight_client will cycle between the clients. ================= */ - static void AI_SetSightClient() { + static void AI_SetSightClient() + { edict_t ent; int start, check; @@ -1530,17 +1038,20 @@ public class GameUtil extends GameBase { start = level.sight_client.index; check = start; - while (true) { + while (true) + { check++; if (check > game.maxclients) check = 1; ent = g_edicts[check]; - if (ent.inuse && ent.health > 0 && (ent.flags & FL_NOTARGET) == 0) { + if (ent.inuse && ent.health > 0 && (ent.flags & FL_NOTARGET) == 0) + { level.sight_client = ent; return; // got one } - if (check == start) { + if (check == start) + { level.sight_client = null; return; // nobody to see } @@ -1555,7 +1066,8 @@ public class GameUtil extends GameBase { This replaces the QC functions: ai_forward, ai_back, ai_pain, and ai_painforward ============== */ - static void ai_move(edict_t self, float dist) { + static void ai_move(edict_t self, float dist) + { M.M_walkmove(self, self.s.angles[YAW], dist); } @@ -1576,13 +1088,16 @@ public class GameUtil extends GameBase { slower noticing monsters. ============ */ - static boolean FindTarget(edict_t self) { + static boolean FindTarget(edict_t self) + { edict_t client; boolean heardit; int r; - if ((self.monsterinfo.aiflags & AI_GOOD_GUY) != 0) { - if (self.goalentity != null && self.goalentity.inuse && self.goalentity.classname != null) { + if ((self.monsterinfo.aiflags & AI_GOOD_GUY) != 0) + { + if (self.goalentity != null && self.goalentity.inuse && self.goalentity.classname != null) + { if (self.goalentity.classname.equals("target_actor")) return false; } @@ -1603,21 +1118,26 @@ public class GameUtil extends GameBase { // but not weapon impact/explosion noises heardit = false; - if ((level.sight_entity_framenum >= (level.framenum - 1)) && 0 == (self.spawnflags & 1)) { + if ((level.sight_entity_framenum >= (level.framenum - 1)) && 0 == (self.spawnflags & 1)) + { client = level.sight_entity; - if (client.enemy == self.enemy) { + if (client.enemy == self.enemy) + { return false; } } - else if (level.sound_entity_framenum >= (level.framenum - 1)) { + else if (level.sound_entity_framenum >= (level.framenum - 1)) + { client = level.sound_entity; heardit = true; } - else if (null != (self.enemy) && (level.sound2_entity_framenum >= (level.framenum - 1)) && 0 != (self.spawnflags & 1)) { + else if (null != (self.enemy) && (level.sound2_entity_framenum >= (level.framenum - 1)) && 0 != (self.spawnflags & 1)) + { client = level.sound2_entity; heardit = true; } - else { + else + { client = level.sight_client; if (client == null) return false; // no clients to get mad at @@ -1630,24 +1150,28 @@ public class GameUtil extends GameBase { if (client == self.enemy) return true; // JDC false; - if (client.client != null) { + if (client.client != null) + { if ((client.flags & FL_NOTARGET) != 0) return false; } - else if ((client.svflags & SVF_MONSTER) != 0) { + else if ((client.svflags & SVF_MONSTER) != 0) + { if (client.enemy == null) return false; if ((client.enemy.flags & FL_NOTARGET) != 0) return false; } - else if (heardit) { + else if (heardit) + { if ((client.owner.flags & FL_NOTARGET) != 0) return false; } else return false; - if (!heardit) { + if (!heardit) + { r = range(self, client); if (r == RANGE_FAR) @@ -1659,44 +1183,55 @@ public class GameUtil extends GameBase { if (client.light_level <= 5) return false; - if (!visible(self, client)) { + if (!visible(self, client)) + { return false; } - if (r == RANGE_NEAR) { - if (client.show_hostile < level.time && !infront(self, client)) { + if (r == RANGE_NEAR) + { + if (client.show_hostile < level.time && !infront(self, client)) + { return false; } } - else if (r == RANGE_MID) { - if (!infront(self, client)) { + else if (r == RANGE_MID) + { + if (!infront(self, client)) + { return false; } } self.enemy = client; - if (!self.enemy.classname.equals("player_noise")) { + if (!self.enemy.classname.equals("player_noise")) + { self.monsterinfo.aiflags &= ~AI_SOUND_TARGET; - if (self.enemy.client == null) { + if (self.enemy.client == null) + { self.enemy = self.enemy.enemy; - if (self.enemy.client == null) { + if (self.enemy.client == null) + { self.enemy = null; return false; } } } } - else // heardit - { + else + { + // heard it float[] temp = { 0, 0, 0 }; - if ((self.spawnflags & 1) != 0) { + if ((self.spawnflags & 1) != 0) + { if (!visible(self, client)) return false; } - else { + else + { if (!gi.inPHS(self.s.origin, client.s.origin)) return false; } @@ -1704,7 +1239,7 @@ public class GameUtil extends GameBase { Math3D.VectorSubtract(client.s.origin, self.s.origin, temp); if (Math3D.VectorLength(temp) > 1000) // too far to hear - { + { return false; } @@ -1733,8 +1268,9 @@ public class GameUtil extends GameBase { } // ============================================================================ - - static void HuntTarget(edict_t self) { + //ok + static void HuntTarget(edict_t self) + { float[] vec = { 0, 0, 0 }; self.goalentity = self.enemy; @@ -1749,9 +1285,11 @@ public class GameUtil extends GameBase { AttackFinished(self, 1); } - public static void FoundTarget(edict_t self) { + public static void FoundTarget(edict_t self) + { // let other monsters see this monster for a while - if (self.enemy.client != null) { + if (self.enemy.client != null) + { level.sight_entity = self; level.sight_entity_framenum = level.framenum; level.sight_entity.light_level = 128; @@ -1762,13 +1300,15 @@ public class GameUtil extends GameBase { Math3D.VectorCopy(self.enemy.s.origin, self.monsterinfo.last_sighting); self.monsterinfo.trail_time = level.time; - if (self.combattarget == null) { + if (self.combattarget == null) + { HuntTarget(self); return; } self.goalentity = self.movetarget = G_PickTarget(self.combattarget); - if (self.movetarget == null) { + if (self.movetarget == null) + { self.goalentity = self.movetarget = self.enemy; HuntTarget(self); gi.dprintf("" + self.classname + "at " + Lib.vtos(self.s.origin) + ", combattarget " + self.combattarget + " not found\n"); @@ -1787,7 +1327,8 @@ public class GameUtil extends GameBase { self.monsterinfo.run.think(self); } - static boolean CheckTeamDamage(edict_t targ, edict_t attacker) { + static boolean CheckTeamDamage(edict_t targ, edict_t attacker) + { //FIXME make the next line real and uncomment this block // if ((ability to damage a teammate == OFF) && (targ's team == attacker's team)) return false; @@ -1798,7 +1339,8 @@ public class GameUtil extends GameBase { T_RadiusDamage ============ */ - static void T_RadiusDamage(edict_t inflictor, edict_t attacker, float damage, edict_t ignore, float radius, int mod) { + static void T_RadiusDamage(edict_t inflictor, edict_t attacker, float damage, edict_t ignore, float radius, int mod) + { float points; EdictIterator edictit = null; @@ -1806,7 +1348,8 @@ public class GameUtil extends GameBase { float[] dir = { 0, 0, 0 }; ; - while ((edictit = findradius(edictit, inflictor.s.origin, radius)) != null) { + while ((edictit = findradius(edictit, inflictor.s.origin, radius)) != null) + { edict_t ent = edictit.o; if (ent == ignore) continue; @@ -1819,8 +1362,10 @@ public class GameUtil extends GameBase { points = damage - 0.5f * Math3D.VectorLength(v); if (ent == attacker) points = points * 0.5f; - if (points > 0) { - if (CanDamage(ent, inflictor)) { + if (points > 0) + { + if (CanDamage(ent, inflictor)) + { Math3D.VectorSubtract(ent.s.origin, inflictor.s.origin, dir); T_Damage( ent, diff --git a/src/jake2/game/GameUtilAdapters.java b/src/jake2/game/GameUtilAdapters.java new file mode 100644 index 0000000..4a3c320 --- /dev/null +++ b/src/jake2/game/GameUtilAdapters.java @@ -0,0 +1,652 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameUtilAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.*; +import jake2.qcommon.Com; +import jake2.util.*; + +public class GameUtilAdapters +{ + + public static EntThinkAdapter Think_Delay = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + GameUtil.G_UseTargets(ent, ent.activator); + GameUtil.G_FreeEdict(ent); + return true; + } + }; + public static EntThinkAdapter G_FreeEdictA = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + GameUtil.G_FreeEdict(ent); + return false; + } + }; + static EntThinkAdapter MegaHealth_think = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.owner.health > self.owner.max_health) + { + self.nextthink = GameBase.level.time + 1; + self.owner.health -= 1; + return false; + } + + if (!((self.spawnflags & Defines.DROPPED_ITEM) != 0) && (GameBase.deathmatch.value != 0)) + GameUtil.SetRespawn(self, 20); + else + GameUtil.G_FreeEdict(self); + + return false; + } + }; + static EntThinkAdapter DoRespawn = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + if (ent.team != null) + { + edict_t master; + int count; + int choice = 0; + + master = ent.teammaster; + + // tiefe z�hlen + // count the depth + for (count = 0, ent = master; ent != null; ent = ent.chain, count++); + + choice = Lib.rand() % count; + + for (count = 0, ent = master; count < choice; ent = ent.chain, count++); + } + + ent.svflags &= ~Defines.SVF_NOCLIENT; + ent.solid = Defines.SOLID_TRIGGER; + GameBase.gi.linkentity(ent); + + // send an effect + ent.s.event = Defines.EV_ITEM_RESPAWN; + + return false; + } + }; + static EntInteractAdapter Pickup_Pack = new EntInteractAdapter() + { + public boolean interact(edict_t ent, edict_t other) + { + + gitem_t item; + int index; + + if (other.client.pers.max_bullets < 300) + other.client.pers.max_bullets = 300; + if (other.client.pers.max_shells < 200) + other.client.pers.max_shells = 200; + if (other.client.pers.max_rockets < 100) + other.client.pers.max_rockets = 100; + if (other.client.pers.max_grenades < 100) + other.client.pers.max_grenades = 100; + if (other.client.pers.max_cells < 300) + other.client.pers.max_cells = 300; + if (other.client.pers.max_slugs < 100) + other.client.pers.max_slugs = 100; + + item = GameUtil.FindItem("Bullets"); + if (item != null) + { + index = GameUtil.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 = GameUtil.FindItem("Shells"); + if (item != null) + { + index = GameUtil.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; + } + + item = GameUtil.FindItem("Cells"); + if (item != null) + { + index = GameUtil.ITEM_INDEX(item); + other.client.pers.inventory[index] += item.quantity; + if (other.client.pers.inventory[index] > other.client.pers.max_cells) + other.client.pers.inventory[index] = other.client.pers.max_cells; + } + + item = GameUtil.FindItem("Grenades"); + if (item != null) + { + index = GameUtil.ITEM_INDEX(item); + other.client.pers.inventory[index] += item.quantity; + if (other.client.pers.inventory[index] > other.client.pers.max_grenades) + other.client.pers.inventory[index] = other.client.pers.max_grenades; + } + + item = GameUtil.FindItem("Rockets"); + if (item != null) + { + index = GameUtil.ITEM_INDEX(item); + other.client.pers.inventory[index] += item.quantity; + if (other.client.pers.inventory[index] > other.client.pers.max_rockets) + other.client.pers.inventory[index] = other.client.pers.max_rockets; + } + + item = GameUtil.FindItem("Slugs"); + if (item != null) + { + index = GameUtil.ITEM_INDEX(item); + other.client.pers.inventory[index] += item.quantity; + if (other.client.pers.inventory[index] > other.client.pers.max_slugs) + other.client.pers.inventory[index] = other.client.pers.max_slugs; + } + + if (0 == (ent.spawnflags & Defines.DROPPED_ITEM) && (GameBase.deathmatch.value != 0)) + GameUtil.SetRespawn(ent, ent.item.quantity); + + return true; + } + }; + final static EntInteractAdapter Pickup_Health = new EntInteractAdapter() + { + public boolean interact(edict_t ent, edict_t other) + { + + if (0 == (ent.style & Defines.HEALTH_IGNORE_MAX)) + if (other.health >= other.max_health) + return false; + + other.health += ent.count; + + if (0 == (ent.style & Defines.HEALTH_IGNORE_MAX)) + { + if (other.health > other.max_health) + other.health = other.max_health; + } + + if (0 != (ent.style & Defines.HEALTH_TIMED)) + { + ent.think = MegaHealth_think; + ent.nextthink = GameBase.level.time + 5f; + ent.owner = other; + ent.flags |= Defines.FL_RESPAWN; + ent.svflags |= Defines.SVF_NOCLIENT; + ent.solid = Defines.SOLID_NOT; + } + else + { + if (!((ent.spawnflags & Defines.DROPPED_ITEM) != 0) && (GameBase.deathmatch.value != 0)) + GameUtil.SetRespawn(ent, 30); + } + + return true; + } + + }; + /* + =============== + Touch_Item + =============== + */ + + static EntTouchAdapter Touch_Item = new EntTouchAdapter() + { + public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) + { + boolean taken; + + if (ent.classname.equals("item_breather")) + taken = false; + + + if (other.client == null) + return; + if (other.health < 1) + return; // dead people can't pickup + if (ent.item.pickup == null) + return; // not a grabbable item? + + + taken = ent.item.pickup.interact(ent, other); + + if (taken) + { + // flash the screen + other.client.bonus_alpha = 0.25f; + + // show icon and name on status bar + other.client.ps.stats[Defines.STAT_PICKUP_ICON] = (short) GameBase.gi.imageindex(ent.item.icon); + other.client.ps.stats[Defines.STAT_PICKUP_STRING] = (short) (Defines.CS_ITEMS + GameUtil.ITEM_INDEX(ent.item)); + other.client.pickup_msg_time = GameBase.level.time + 3.0f; + + // change selected item + if (ent.item.use != null) + other.client.pers.selected_item = + other.client.ps.stats[Defines.STAT_SELECTED_ITEM] = (short) GameUtil.ITEM_INDEX(ent.item); + + if (ent.item.pickup == Pickup_Health) + { + if (ent.count == 2) + GameBase.gi.sound( + other, + Defines.CHAN_ITEM, + GameBase.gi.soundindex("items/s_health.wav"), + 1, + Defines.ATTN_NORM, + 0); + else if (ent.count == 10) + GameBase.gi.sound( + other, + Defines.CHAN_ITEM, + GameBase.gi.soundindex("items/n_health.wav"), + 1, + Defines.ATTN_NORM, + 0); + else if (ent.count == 25) + GameBase.gi.sound( + other, + Defines.CHAN_ITEM, + GameBase.gi.soundindex("items/l_health.wav"), + 1, + Defines.ATTN_NORM, + 0); + else // (ent.count == 100) + GameBase.gi.sound( + other, + Defines.CHAN_ITEM, + GameBase.gi.soundindex("items/m_health.wav"), + 1, + Defines.ATTN_NORM, + 0); + } + else if (ent.item.pickup_sound != null) + { + GameBase.gi.sound( + other, + Defines.CHAN_ITEM, + GameBase.gi.soundindex(ent.item.pickup_sound), + 1, + Defines.ATTN_NORM, + 0); + } + } + + if (0 == (ent.spawnflags & Defines.ITEM_TARGETS_USED)) + { + GameUtil.G_UseTargets(ent, other); + ent.spawnflags |= Defines.ITEM_TARGETS_USED; + } + + if (!taken) + return; + Com.p("Picked up:" + ent.classname); + + if (!((GameBase.coop.value != 0) && (ent.item.flags & Defines.IT_STAY_COOP) != 0) + || 0 != (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM))) + { + if ((ent.flags & Defines.FL_RESPAWN) != 0) + ent.flags &= ~Defines.FL_RESPAWN; + else + GameUtil.G_FreeEdict(ent); + } + } + }; + static EntTouchAdapter drop_temp_touch = new EntTouchAdapter() + { + public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) + { + if (other == ent.owner) + return; + + Touch_Item.touch(ent, other, plane, surf); + } + }; + static EntThinkAdapter drop_make_touchable = new EntThinkAdapter() + { + public boolean think(edict_t ent) + { + ent.touch = Touch_Item; + if (GameBase.deathmatch.value != 0) + { + ent.nextthink = GameBase.level.time + 29; + ent.think = G_FreeEdictA; + } + return false; + } + }; + static int quad_drop_timeout_hack = 0; + static ItemUseAdapter Use_Quad = new ItemUseAdapter() + { + + public void use(edict_t ent, gitem_t item) + { + int timeout; + + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--; + GameUtil.ValidateSelectedItem(ent); + + if (quad_drop_timeout_hack != 0) + { + timeout = quad_drop_timeout_hack; + quad_drop_timeout_hack = 0; + } + else + { + timeout = 300; + } + + if (ent.client.quad_framenum > GameBase.level.framenum) + ent.client.quad_framenum += timeout; + else + ent.client.quad_framenum = GameBase.level.framenum + timeout; + + GameBase.gi.sound(ent, Defines.CHAN_ITEM, GameBase.gi.soundindex("items/damage.wav"), 1, Defines.ATTN_NORM, 0); + } + }; + static ItemUseAdapter Use_Invulnerability = new ItemUseAdapter() + { + public void use(edict_t ent, gitem_t item) + { + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--; + GameUtil.ValidateSelectedItem(ent); + + if (ent.client.invincible_framenum > GameBase.level.framenum) + ent.client.invincible_framenum += 300; + else + ent.client.invincible_framenum = GameBase.level.framenum + 300; + + GameBase.gi.sound(ent, Defines.CHAN_ITEM, GameBase.gi.soundindex("items/protect.wav"), 1, Defines.ATTN_NORM, 0); + } + }; + // ====================================================================== + + static ItemUseAdapter Use_Breather = new ItemUseAdapter() + { + public void use(edict_t ent, gitem_t item) + { + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--; + + //TODO: remove this line + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]=0; + + GameUtil.ValidateSelectedItem(ent); + + if (ent.client.breather_framenum > GameBase.level.framenum) + ent.client.breather_framenum += 300; + else + ent.client.breather_framenum = GameBase.level.framenum + 300; + + // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); + } + }; + // ====================================================================== + + static ItemUseAdapter Use_Envirosuit = new ItemUseAdapter() + { + public void use(edict_t ent, gitem_t item) + { + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--; + GameUtil.ValidateSelectedItem(ent); + + if (ent.client.enviro_framenum > GameBase.level.framenum) + ent.client.enviro_framenum += 300; + else + ent.client.enviro_framenum = GameBase.level.framenum + 300; + + // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); + } + }; + // ====================================================================== + /* + static ItemUseAdapter Use_Invulnerability = new ItemUseAdapter() + { + public void use(edict_t ent, gitem_t item) + { + + ent.client.pers.inventory[ITEM_INDEX(item)]--; + ValidateSelectedItem(ent); + + if (ent.client.invincible_framenum > level.framenum) + ent.client.invincible_framenum += 300; + else + ent.client.invincible_framenum = level.framenum + 300; + + gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0); + } + }; + */ + + // ====================================================================== + + static ItemUseAdapter Use_Silencer = new ItemUseAdapter() + { + public void use(edict_t ent, gitem_t item) + { + + ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--; + GameUtil.ValidateSelectedItem(ent); + ent.client.silencer_shots += 30; + + // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); + } + }; + // ====================================================================== + + static EntInteractAdapter Pickup_Key = new EntInteractAdapter() + { + public boolean interact(edict_t ent, edict_t other) + { + if (GameBase.coop.value != 0) + { + if (Lib.strcmp(ent.classname, "key_power_cube") == 0) + { + if ((other.client.pers.power_cubes & ((ent.spawnflags & 0x0000ff00) >> 8)) != 0) + return false; + other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)]++; + other.client.pers.power_cubes |= ((ent.spawnflags & 0x0000ff00) >> 8); + } + else + { + if (other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)] != 0) + return false; + other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)] = 1; + } + return true; + } + other.client.pers.inventory[GameUtil.ITEM_INDEX(ent.item)]++; + return true; + } + }; + static int jacket_armor_index; + static int combat_armor_index; + static int body_armor_index; + static int power_screen_index; + static int power_shield_index; + /* + ============= + range + + returns the range catagorization of an entity reletive to self. + 0 melee range, will become hostile even if back is turned + 1 visibility and infront, or visibility and show hostile + 2 infront and show hostile + 3 only triggered by damage + + */ + // static int range(edict_t self, edict_t other) + // { + // float[] v= { 0, 0, 0 }; + // float len; + // + // VectorSubtract(self.s.origin, other.s.origin, v); + // len= VectorLength(v); + // if (len < MELEE_DISTANCE) + // return RANGE_MELEE; + // if (len < 500) + // return RANGE_NEAR; + // if (len < 1000) + // return RANGE_MID; + // return RANGE_FAR; + // } + + // ============================================================================ + + static EntThinkAdapter M_CheckAttack = new EntThinkAdapter() + { + + public boolean think(edict_t self) + { + float[] spot1 = { 0, 0, 0 }; + + float[] spot2 = { 0, 0, 0 }; + float chance; + trace_t tr; + + if (self.enemy.health > 0) + { + // see if any entities are in the way of the shot + Math3D.VectorCopy(self.s.origin, spot1); + spot1[2] += self.viewheight; + Math3D.VectorCopy(self.enemy.s.origin, spot2); + spot2[2] += self.enemy.viewheight; + + tr = + GameBase.gi.trace( + spot1, + null, + null, + spot2, + self, + Defines.CONTENTS_SOLID + | Defines.CONTENTS_MONSTER + | Defines.CONTENTS_SLIME + | Defines.CONTENTS_LAVA + | Defines.CONTENTS_WINDOW); + + // do we have a clear shot? + if (tr.ent != self.enemy) + return false; + } + + // melee attack + if (enemy_range == Defines.RANGE_MELEE) + { + // don't always melee in easy mode + if (GameBase.skill.value == 0 && (Lib.rand() & 3) != 0) + return false; + if (self.monsterinfo.melee != null) + self.monsterinfo.attack_state = Defines.AS_MELEE; + else + self.monsterinfo.attack_state = Defines.AS_MISSILE; + return true; + } + + // missile attack + if (self.monsterinfo.attack == null) + return false; + + if (GameBase.level.time < self.monsterinfo.attack_finished) + return false; + + if (enemy_range == Defines.RANGE_FAR) + return false; + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + { + chance = 0.4f; + } + else if (enemy_range == Defines.RANGE_MELEE) + { + chance = 0.2f; + } + else if (enemy_range == Defines.RANGE_NEAR) + { + chance = 0.1f; + } + else if (enemy_range == Defines.RANGE_MID) + { + chance = 0.02f; + } + else + { + return false; + } + + if (GameBase.skill.value == 0) + chance *= 0.5; + else if (GameBase.skill.value >= 2) + chance *= 2; + + if (Lib.random() < chance) + { + self.monsterinfo.attack_state = Defines.AS_MISSILE; + self.monsterinfo.attack_finished = GameBase.level.time + 2 * Lib.random(); + return true; + } + + if ((self.flags & Defines.FL_FLY) != 0) + { + if (Lib.random() < 0.3f) + self.monsterinfo.attack_state = Defines.AS_SLIDING; + else + self.monsterinfo.attack_state = Defines.AS_STRAIGHT; + } + + return false; + + } + }; + static EntUseAdapter monster_use = new EntUseAdapter() + { + public void use(edict_t self, edict_t other, edict_t activator) + { + if (self.enemy != null) + return; + if (self.health <= 0) + return; + if ((activator.flags & Defines.FL_NOTARGET) != 0) + return; + if ((null == activator.client) && 0 == (activator.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) + return; + + // delay reaction so if the monster is teleported, its sound is still heard + self.enemy = activator; + GameUtil.FoundTarget(self); + } + }; + static boolean enemy_vis; + static boolean enemy_infront; + static int enemy_range; + static float enemy_yaw; +} diff --git a/src/jake2/game/GameWeapon.java b/src/jake2/game/GameWeapon.java index 1d855a0..5431584 100644 --- a/src/jake2/game/GameWeapon.java +++ b/src/jake2/game/GameWeapon.java @@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 12.11.2003 by RST. -// $Id: GameWeapon.java,v 1.1 2004-07-07 19:59:06 hzi Exp $ +// $Id: GameWeapon.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.Defines; +import jake2.Globals; import jake2.util.*; public class GameWeapon extends GameAI { @@ -125,442 +126,4 @@ public class GameWeapon extends GameAI { } } - /* - ================= - fire_blaster - - Fires a single blaster bolt. Used by the blaster and hyper blaster. - ================= - */ - static EntTouchAdapter blaster_touch= new EntTouchAdapter() { - - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - int mod; - - if (other == self.owner) - return; - - if (surf != null && (surf.flags & SURF_SKY) != 0) { - G_FreeEdict(self); - return; - } - - if (self.owner.client != null) - PlayerNoise(self.owner, self.s.origin, PNOISE_IMPACT); - - if (other.takedamage != 0) { - if ((self.spawnflags & 1) != 0) - mod= MOD_HYPERBLASTER; - else - mod= MOD_BLASTER; - T_Damage( - other, - self, - self.owner, - self.velocity, - self.s.origin, - plane.normal, - self.dmg, - 1, - DAMAGE_ENERGY, - mod); - } else { - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_BLASTER); - gi.WritePosition(self.s.origin); - if (plane == null) - gi.WriteDir(vec3_origin); - else - gi.WriteDir(plane.normal); - gi.multicast(self.s.origin, MULTICAST_PVS); - } - - G_FreeEdict(self); - } - }; - - static EntThinkAdapter Grenade_Explode= new EntThinkAdapter() { - public boolean think(edict_t ent) { - float[] origin= { 0, 0, 0 }; - int mod; - - if (ent.owner.client != null) - PlayerNoise(ent.owner, ent.s.origin, PNOISE_IMPACT); - - //FIXME: if we are onground then raise our Z just a bit since we are a point? - if (ent.enemy != null) { - float points= 0; - float[] v= { 0, 0, 0 }; - float[] dir= { 0, 0, 0 }; - - Math3D.VectorAdd(ent.enemy.mins, ent.enemy.maxs, v); - Math3D.VectorMA(ent.enemy.s.origin, 0.5f, v, v); - Math3D.VectorSubtract(ent.s.origin, v, v); - points= ent.dmg - 0.5f * Math3D.VectorLength(v); - Math3D.VectorSubtract(ent.enemy.s.origin, ent.s.origin, dir); - if ((ent.spawnflags & 1) != 0) - mod= MOD_HANDGRENADE; - else - mod= MOD_GRENADE; - T_Damage( - ent.enemy, - ent, - ent.owner, - dir, - ent.s.origin, - vec3_origin, - (int) points, - (int) points, - DAMAGE_RADIUS, - mod); - } - - if ((ent.spawnflags & 2) != 0) - mod= MOD_HELD_GRENADE; - else if ((ent.spawnflags & 1) != 0) - mod= MOD_HG_SPLASH; - else - mod= MOD_G_SPLASH; - T_RadiusDamage(ent, ent.owner, ent.dmg, ent.enemy, ent.dmg_radius, mod); - - Math3D.VectorMA(ent.s.origin, -0.02f, ent.velocity, origin); - gi.WriteByte(svc_temp_entity); - if (ent.waterlevel != 0) { - if (ent.groundentity != null) - gi.WriteByte(TE_GRENADE_EXPLOSION_WATER); - else - gi.WriteByte(TE_ROCKET_EXPLOSION_WATER); - } else { - if (ent.groundentity != null) - gi.WriteByte(TE_GRENADE_EXPLOSION); - else - gi.WriteByte(TE_ROCKET_EXPLOSION); - } - gi.WritePosition(origin); - gi.multicast(ent.s.origin, MULTICAST_PHS); - - G_FreeEdict(ent); - return true; - } - }; - - static EntTouchAdapter Grenade_Touch= new EntTouchAdapter() { - public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { - if (other == ent.owner) - return; - - if (surf != null && 0 != (surf.flags & SURF_SKY)) { - G_FreeEdict(ent); - return; - } - - if (other.takedamage == 0) { - if ((ent.spawnflags & 1) != 0) { - if (Lib.random() > 0.5f) - gi.sound( - ent, - CHAN_VOICE, - gi.soundindex("weapons/hgrenb1a.wav"), - 1, - ATTN_NORM, - 0); - else - gi.sound( - ent, - CHAN_VOICE, - gi.soundindex("weapons/hgrenb2a.wav"), - 1, - ATTN_NORM, - 0); - } else { - gi.sound( - ent, - CHAN_VOICE, - gi.soundindex("weapons/grenlb1b.wav"), - 1, - ATTN_NORM, - 0); - } - return; - } - - ent.enemy= other; - Grenade_Explode.think(ent); - } - }; - - /* - ================= - fire_rocket - ================= - */ - static EntTouchAdapter rocket_touch= new EntTouchAdapter() { - public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { - float[] origin= { 0, 0, 0 }; - int n; - - if (other == ent.owner) - return; - - if (surf != null && (surf.flags & SURF_SKY) != 0) { - G_FreeEdict(ent); - return; - } - - if (ent.owner.client != null) - PlayerNoise(ent.owner, ent.s.origin, PNOISE_IMPACT); - - // calculate position for the explosion entity - Math3D.VectorMA(ent.s.origin, -0.02f, ent.velocity, origin); - - if (other.takedamage != 0) { - T_Damage( - other, - ent, - ent.owner, - ent.velocity, - ent.s.origin, - plane.normal, - ent.dmg, - 0, - 0, - MOD_ROCKET); - } else { - // don't throw any debris in net games - if (deathmatch.value == 0 && 0 == coop.value) { - if ((surf != null) - && 0 - == (surf.flags - & (SURF_WARP | SURF_TRANS33 | SURF_TRANS66 | SURF_FLOWING))) { - n= Lib.rand() % 5; - while (n-- > 0) - ThrowDebris(ent, "models/objects/debris2/tris.md2", 2, ent.s.origin); - } - } - } - - T_RadiusDamage(ent, ent.owner, ent.radius_dmg, other, ent.dmg_radius, MOD_R_SPLASH); - - gi.WriteByte(svc_temp_entity); - if (ent.waterlevel != 0) - gi.WriteByte(TE_ROCKET_EXPLOSION_WATER); - else - gi.WriteByte(TE_ROCKET_EXPLOSION); - gi.WritePosition(origin); - gi.multicast(ent.s.origin, MULTICAST_PHS); - - G_FreeEdict(ent); - } - }; - - /* - ================= - fire_bfg - ================= - */ - static EntThinkAdapter bfg_explode= new EntThinkAdapter() { - public boolean think(edict_t self) { - edict_t ent; - float points; - float[] v= { 0, 0, 0 }; - float dist; - - EdictIterator edit= null; - - if (self.s.frame == 0) { - // the BFG effect - ent= null; - while ((edit= findradius(edit, self.s.origin, self.dmg_radius)) != null) { - ent= edit.o; - if (ent.takedamage == 0) - continue; - if (ent == self.owner) - continue; - if (!CanDamage(ent, self)) - continue; - if (!CanDamage(ent, self.owner)) - continue; - - Math3D.VectorAdd(ent.mins, ent.maxs, v); - Math3D.VectorMA(ent.s.origin, 0.5f, v, v); - Math3D.VectorSubtract(self.s.origin, v, v); - dist= Math3D.VectorLength(v); - points= (float) (self.radius_dmg * (1.0 - Math.sqrt(dist / self.dmg_radius))); - if (ent == self.owner) - points= points * 0.5f; - - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_BFG_EXPLOSION); - gi.WritePosition(ent.s.origin); - gi.multicast(ent.s.origin, MULTICAST_PHS); - T_Damage( - ent, - self, - self.owner, - self.velocity, - ent.s.origin, - vec3_origin, - (int) points, - 0, - DAMAGE_ENERGY, - MOD_BFG_EFFECT); - } - } - - self.nextthink= level.time + FRAMETIME; - self.s.frame++; - if (self.s.frame == 5) - self.think= G_FreeEdictA; - return true; - - } - }; - - static EntTouchAdapter bfg_touch= new EntTouchAdapter() { - public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { - if (other == self.owner) - return; - - if (surf != null && (surf.flags & SURF_SKY) != 0) { - G_FreeEdict(self); - return; - } - - if (self.owner.client != null) - PlayerNoise(self.owner, self.s.origin, PNOISE_IMPACT); - - // core explosion - prevents firing it into the wall/floor - if (other.takedamage != 0) - T_Damage( - other, - self, - self.owner, - self.velocity, - self.s.origin, - plane.normal, - 200, - 0, - 0, - MOD_BFG_BLAST); - T_RadiusDamage(self, self.owner, 200, other, 100, MOD_BFG_BLAST); - - gi.sound(self, CHAN_VOICE, gi.soundindex("weapons/bfg__x1b.wav"), 1, ATTN_NORM, 0); - self.solid= SOLID_NOT; - self.touch= null; - Math3D.VectorMA(self.s.origin, -1 * FRAMETIME, self.velocity, self.s.origin); - Math3D.VectorClear(self.velocity); - self.s.modelindex= gi.modelindex("sprites/s_bfg3.sp2"); - self.s.frame= 0; - self.s.sound= 0; - self.s.effects &= ~EF_ANIM_ALLFAST; - self.think= bfg_explode; - self.nextthink= level.time + FRAMETIME; - self.enemy= other; - - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_BFG_BIGEXPLOSION); - gi.WritePosition(self.s.origin); - gi.multicast(self.s.origin, MULTICAST_PVS); - } - }; - - static EntThinkAdapter bfg_think= new EntThinkAdapter() { - public boolean think(edict_t self) { - edict_t ent; - edict_t ignore; - float[] point= { 0, 0, 0 }; - float[] dir= { 0, 0, 0 }; - float[] start= { 0, 0, 0 }; - float[] end= { 0, 0, 0 }; - int dmg; - trace_t tr; - - if (deathmatch.value != 0) - dmg= 5; - else - dmg= 10; - - EdictIterator edit= null; - while ((edit= findradius(edit, self.s.origin, 256)) != null) { - ent= edit.o; - - if (ent == self) - continue; - - if (ent == self.owner) - continue; - - if (ent.takedamage == 0) - continue; - - if (0 == (ent.svflags & SVF_MONSTER) - && (null == ent.client) - && (Lib.strcmp(ent.classname, "misc_explobox") != 0)) - continue; - - Math3D.VectorMA(ent.absmin, 0.5f, ent.size, point); - - Math3D.VectorSubtract(point, self.s.origin, dir); - Math3D.VectorNormalize(dir); - - ignore= self; - Math3D.VectorCopy(self.s.origin, start); - Math3D.VectorMA(start, 2048, dir, end); - while (true) { - tr= - gi.trace( - start, - null, - null, - end, - ignore, - CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER); - - if (null == tr.ent) - break; - - // hurt it if we can - if ((tr.ent.takedamage != 0) - && 0 == (tr.ent.flags & FL_IMMUNE_LASER) - && (tr.ent != self.owner)) - T_Damage( - tr.ent, - self, - self.owner, - dir, - tr.endpos, - vec3_origin, - dmg, - 1, - DAMAGE_ENERGY, - MOD_BFG_LASER); - - // if we hit something that's not a monster or player we're done - if (0 == (tr.ent.svflags & SVF_MONSTER) && (null == tr.ent.client)) { - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_LASER_SPARKS); - gi.WriteByte(4); - gi.WritePosition(tr.endpos); - gi.WriteDir(tr.plane.normal); - gi.WriteByte(self.s.skinnum); - gi.multicast(tr.endpos, MULTICAST_PVS); - break; - } - - ignore= tr.ent; - Math3D.VectorCopy(tr.endpos, start); - } - - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_BFG_LASER); - gi.WritePosition(self.s.origin); - gi.WritePosition(tr.endpos); - gi.multicast(self.s.origin, MULTICAST_PHS); - } - - self.nextthink= level.time + FRAMETIME; - return true; - } - }; - } diff --git a/src/jake2/game/GameWeaponAdapters.java b/src/jake2/game/GameWeaponAdapters.java new file mode 100644 index 0000000..1a37948 --- /dev/null +++ b/src/jake2/game/GameWeaponAdapters.java @@ -0,0 +1,474 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: GameWeaponAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.util.Lib; +import jake2.util.Math3D; +import jake2.Defines; +import jake2.Globals; +import jake2.util.*; + +public class GameWeaponAdapters { + + /* + ================= + fire_blaster + + Fires a single blaster bolt. Used by the blaster and hyper blaster. + ================= + */ + static EntTouchAdapter blaster_touch= new EntTouchAdapter() { + + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + int mod; + + if (other == self.owner) + return; + + if (surf != null && (surf.flags & Defines.SURF_SKY) != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + if (self.owner.client != null) + GameWeapon.PlayerNoise(self.owner, self.s.origin, Defines.PNOISE_IMPACT); + + if (other.takedamage != 0) { + if ((self.spawnflags & 1) != 0) + mod= Defines.MOD_HYPERBLASTER; + else + mod= Defines.MOD_BLASTER; + + // bugfix null plane rst + float [] normal; + if (plane ==null) + normal = new float[3]; + else + normal = plane.normal; + + GameUtil.T_Damage( + other, + self, + self.owner, + self.velocity, + self.s.origin, + normal, + self.dmg, + 1, + Defines.DAMAGE_ENERGY, + mod); + + } else { + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_BLASTER); + GameBase.gi.WritePosition(self.s.origin); + if (plane == null) + GameBase.gi.WriteDir(Globals.vec3_origin); + else + GameBase.gi.WriteDir(plane.normal); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + } + + GameUtil.G_FreeEdict(self); + } + }; + static EntThinkAdapter Grenade_Explode= new EntThinkAdapter() { + public boolean think(edict_t ent) { + float[] origin= { 0, 0, 0 }; + int mod; + + if (ent.owner.client != null) + GameWeapon.PlayerNoise(ent.owner, ent.s.origin, Defines.PNOISE_IMPACT); + + //FIXME: if we are onground then raise our Z just a bit since we are a point? + if (ent.enemy != null) { + float points= 0; + float[] v= { 0, 0, 0 }; + float[] dir= { 0, 0, 0 }; + + Math3D.VectorAdd(ent.enemy.mins, ent.enemy.maxs, v); + Math3D.VectorMA(ent.enemy.s.origin, 0.5f, v, v); + Math3D.VectorSubtract(ent.s.origin, v, v); + points= ent.dmg - 0.5f * Math3D.VectorLength(v); + Math3D.VectorSubtract(ent.enemy.s.origin, ent.s.origin, dir); + if ((ent.spawnflags & 1) != 0) + mod= Defines.MOD_HANDGRENADE; + else + mod= Defines.MOD_GRENADE; + GameUtil.T_Damage( + ent.enemy, + ent, + ent.owner, + dir, + ent.s.origin, + Globals.vec3_origin, + (int) points, + (int) points, + Defines.DAMAGE_RADIUS, + mod); + } + + if ((ent.spawnflags & 2) != 0) + mod= Defines.MOD_HELD_GRENADE; + else if ((ent.spawnflags & 1) != 0) + mod= Defines.MOD_HG_SPLASH; + else + mod= Defines.MOD_G_SPLASH; + GameUtil.T_RadiusDamage(ent, ent.owner, ent.dmg, ent.enemy, ent.dmg_radius, mod); + + Math3D.VectorMA(ent.s.origin, -0.02f, ent.velocity, origin); + GameBase.gi.WriteByte(Defines.svc_temp_entity); + if (ent.waterlevel != 0) { + if (ent.groundentity != null) + GameBase.gi.WriteByte(Defines.TE_GRENADE_EXPLOSION_WATER); + else + GameBase.gi.WriteByte(Defines.TE_ROCKET_EXPLOSION_WATER); + } else { + if (ent.groundentity != null) + GameBase.gi.WriteByte(Defines.TE_GRENADE_EXPLOSION); + else + GameBase.gi.WriteByte(Defines.TE_ROCKET_EXPLOSION); + } + GameBase.gi.WritePosition(origin); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PHS); + + GameUtil.G_FreeEdict(ent); + return true; + } + }; + static EntTouchAdapter Grenade_Touch= new EntTouchAdapter() { + public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { + if (other == ent.owner) + return; + + if (surf != null && 0 != (surf.flags & Defines.SURF_SKY)) { + GameUtil.G_FreeEdict(ent); + return; + } + + if (other.takedamage == 0) { + if ((ent.spawnflags & 1) != 0) { + if (Lib.random() > 0.5f) + GameBase.gi.sound( + ent, + Defines.CHAN_VOICE, + GameBase.gi.soundindex("weapons/hgrenb1a.wav"), + 1, + Defines.ATTN_NORM, + 0); + else + GameBase.gi.sound( + ent, + Defines.CHAN_VOICE, + GameBase.gi.soundindex("weapons/hgrenb2a.wav"), + 1, + Defines.ATTN_NORM, + 0); + } else { + GameBase.gi.sound( + ent, + Defines.CHAN_VOICE, + GameBase.gi.soundindex("weapons/grenlb1b.wav"), + 1, + Defines.ATTN_NORM, + 0); + } + return; + } + + ent.enemy= other; + Grenade_Explode.think(ent); + } + }; + /* + ================= + fire_rocket + ================= + */ + static EntTouchAdapter rocket_touch= new EntTouchAdapter() { + public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf) { + float[] origin= { 0, 0, 0 }; + int n; + + if (other == ent.owner) + return; + + if (surf != null && (surf.flags & Defines.SURF_SKY) != 0) { + GameUtil.G_FreeEdict(ent); + return; + } + + if (ent.owner.client != null) + GameWeapon.PlayerNoise(ent.owner, ent.s.origin, Defines.PNOISE_IMPACT); + + // calculate position for the explosion entity + Math3D.VectorMA(ent.s.origin, -0.02f, ent.velocity, origin); + + if (other.takedamage != 0) { + GameUtil.T_Damage( + other, + ent, + ent.owner, + ent.velocity, + ent.s.origin, + plane.normal, + ent.dmg, + 0, + 0, + Defines.MOD_ROCKET); + } else { + // don't throw any debris in net games + if (GameBase.deathmatch.value == 0 && 0 == GameBase.coop.value) { + if ((surf != null) + && 0 + == (surf.flags + & (Defines.SURF_WARP | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_FLOWING))) { + n= Lib.rand() % 5; + while (n-- > 0) + GameAI.ThrowDebris(ent, "models/objects/debris2/tris.md2", 2, ent.s.origin); + } + } + } + + GameUtil.T_RadiusDamage(ent, ent.owner, ent.radius_dmg, other, ent.dmg_radius, Defines.MOD_R_SPLASH); + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + if (ent.waterlevel != 0) + GameBase.gi.WriteByte(Defines.TE_ROCKET_EXPLOSION_WATER); + else + GameBase.gi.WriteByte(Defines.TE_ROCKET_EXPLOSION); + GameBase.gi.WritePosition(origin); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PHS); + + GameUtil.G_FreeEdict(ent); + } + }; + /* + ================= + fire_bfg + ================= + */ + static EntThinkAdapter bfg_explode= new EntThinkAdapter() { + public boolean think(edict_t self) { + edict_t ent; + float points; + float[] v= { 0, 0, 0 }; + float dist; + + EdictIterator edit= null; + + if (self.s.frame == 0) { + // the BFG effect + ent= null; + while ((edit= GameBase.findradius(edit, self.s.origin, self.dmg_radius)) != null) { + ent= edit.o; + if (ent.takedamage == 0) + continue; + if (ent == self.owner) + continue; + if (!GameUtil.CanDamage(ent, self)) + continue; + if (!GameUtil.CanDamage(ent, self.owner)) + continue; + + Math3D.VectorAdd(ent.mins, ent.maxs, v); + Math3D.VectorMA(ent.s.origin, 0.5f, v, v); + Math3D.VectorSubtract(self.s.origin, v, v); + dist= Math3D.VectorLength(v); + points= (float) (self.radius_dmg * (1.0 - Math.sqrt(dist / self.dmg_radius))); + if (ent == self.owner) + points= points * 0.5f; + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_BFG_EXPLOSION); + GameBase.gi.WritePosition(ent.s.origin); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PHS); + GameUtil.T_Damage( + ent, + self, + self.owner, + self.velocity, + ent.s.origin, + Globals.vec3_origin, + (int) points, + 0, + Defines.DAMAGE_ENERGY, + Defines.MOD_BFG_EFFECT); + } + } + + self.nextthink= GameBase.level.time + Defines.FRAMETIME; + self.s.frame++; + if (self.s.frame == 5) + self.think= GameUtilAdapters.G_FreeEdictA; + return true; + + } + }; + static EntTouchAdapter bfg_touch= new EntTouchAdapter() { + public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { + if (other == self.owner) + return; + + if (surf != null && (surf.flags & Defines.SURF_SKY) != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + if (self.owner.client != null) + GameWeapon.PlayerNoise(self.owner, self.s.origin, Defines.PNOISE_IMPACT); + + // core explosion - prevents firing it into the wall/floor + if (other.takedamage != 0) + GameUtil.T_Damage( + other, + self, + self.owner, + self.velocity, + self.s.origin, + plane.normal, + 200, + 0, + 0, + Defines.MOD_BFG_BLAST); + GameUtil.T_RadiusDamage(self, self.owner, 200, other, 100, Defines.MOD_BFG_BLAST); + + GameBase.gi.sound(self, Defines.CHAN_VOICE, GameBase.gi.soundindex("weapons/bfg__x1b.wav"), 1, Defines.ATTN_NORM, 0); + self.solid= Defines.SOLID_NOT; + self.touch= null; + Math3D.VectorMA(self.s.origin, -1 * Defines.FRAMETIME, self.velocity, self.s.origin); + Math3D.VectorClear(self.velocity); + self.s.modelindex= GameBase.gi.modelindex("sprites/s_bfg3.sp2"); + self.s.frame= 0; + self.s.sound= 0; + self.s.effects &= ~Defines.EF_ANIM_ALLFAST; + self.think= bfg_explode; + self.nextthink= GameBase.level.time + Defines.FRAMETIME; + self.enemy= other; + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_BFG_BIGEXPLOSION); + GameBase.gi.WritePosition(self.s.origin); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + } + }; + static EntThinkAdapter bfg_think= new EntThinkAdapter() { + public boolean think(edict_t self) { + edict_t ent; + edict_t ignore; + float[] point= { 0, 0, 0 }; + float[] dir= { 0, 0, 0 }; + float[] start= { 0, 0, 0 }; + float[] end= { 0, 0, 0 }; + int dmg; + trace_t tr; + + if (GameBase.deathmatch.value != 0) + dmg= 5; + else + dmg= 10; + + EdictIterator edit= null; + while ((edit= GameBase.findradius(edit, self.s.origin, 256)) != null) { + ent= edit.o; + + if (ent == self) + continue; + + if (ent == self.owner) + continue; + + if (ent.takedamage == 0) + continue; + + if (0 == (ent.svflags & Defines.SVF_MONSTER) + && (null == ent.client) + && (Lib.strcmp(ent.classname, "misc_explobox") != 0)) + continue; + + Math3D.VectorMA(ent.absmin, 0.5f, ent.size, point); + + Math3D.VectorSubtract(point, self.s.origin, dir); + Math3D.VectorNormalize(dir); + + ignore= self; + Math3D.VectorCopy(self.s.origin, start); + Math3D.VectorMA(start, 2048, dir, end); + while (true) { + tr= + GameBase.gi.trace( + start, + null, + null, + end, + ignore, + Defines.CONTENTS_SOLID | Defines.CONTENTS_MONSTER | Defines.CONTENTS_DEADMONSTER); + + if (null == tr.ent) + break; + + // hurt it if we can + if ((tr.ent.takedamage != 0) + && 0 == (tr.ent.flags & Defines.FL_IMMUNE_LASER) + && (tr.ent != self.owner)) + GameUtil.T_Damage( + tr.ent, + self, + self.owner, + dir, + tr.endpos, + Globals.vec3_origin, + dmg, + 1, + Defines.DAMAGE_ENERGY, + Defines.MOD_BFG_LASER); + + // if we hit something that's not a monster or player we're done + if (0 == (tr.ent.svflags & Defines.SVF_MONSTER) && (null == tr.ent.client)) { + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_LASER_SPARKS); + GameBase.gi.WriteByte(4); + GameBase.gi.WritePosition(tr.endpos); + GameBase.gi.WriteDir(tr.plane.normal); + GameBase.gi.WriteByte(self.s.skinnum); + GameBase.gi.multicast(tr.endpos, Defines.MULTICAST_PVS); + break; + } + + ignore= tr.ent; + Math3D.VectorCopy(tr.endpos, start); + } + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_BFG_LASER); + GameBase.gi.WritePosition(self.s.origin); + GameBase.gi.WritePosition(tr.endpos); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PHS); + } + + self.nextthink= GameBase.level.time + Defines.FRAMETIME; + return true; + } + }; +} diff --git a/src/jake2/game/Info.java b/src/jake2/game/Info.java index 7b23ed6..b81322c 100644 --- a/src/jake2/game/Info.java +++ b/src/jake2/game/Info.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 27.12.2003 by RST. -// $Id: Info.java,v 1.1 2004-07-07 19:59:07 hzi Exp $ +// $Id: Info.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -75,7 +75,7 @@ public class Info extends PlayerView { return s; } - if (strlen(key) > MAX_INFO_KEY - 1 || strlen(value) > MAX_INFO_KEY - 1) { + if (key.length() > MAX_INFO_KEY - 1 || value.length() > MAX_INFO_KEY - 1) { Com.Printf("Keys and values must be < 64 characters.\n"); return s; } diff --git a/src/jake2/game/M_Actor.java b/src/jake2/game/M_Actor.java index 3eb2eb6..f48ff77 100644 --- a/src/jake2/game/M_Actor.java +++ b/src/jake2/game/M_Actor.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 11.11.2003 by RST. -// $Id: M_Actor.java,v 1.1 2004-07-07 19:59:07 hzi Exp $ +// $Id: M_Actor.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -544,63 +544,63 @@ public class M_Actor extends GameAI { static mframe_t actor_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null), - new mframe_t(ai_stand, 0f, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null), + new mframe_t(GameAIAdapters.ai_stand, 0f, null)}; static mmove_t actor_move_stand= new mmove_t(FRAME_stand101, FRAME_stand140, actor_frames_stand, null); static mframe_t actor_frames_walk[]= { - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null)}; + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null)}; static mmove_t actor_move_walk= new mmove_t(FRAME_walk01, FRAME_walk08, actor_frames_walk, null); @@ -614,18 +614,18 @@ public class M_Actor extends GameAI { static mframe_t actor_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 4, null), - new mframe_t(ai_run, 15, null), - new mframe_t(ai_run, 15, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 20, null), - new mframe_t(ai_run, 15, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 17, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, -2, null), - new mframe_t(ai_run, -2, null), - new mframe_t(ai_run, -1, null)}; + new mframe_t(GameAIAdapters.ai_run, 4, null), + new mframe_t(GameAIAdapters.ai_run, 15, null), + new mframe_t(GameAIAdapters.ai_run, 15, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 20, null), + new mframe_t(GameAIAdapters.ai_run, 15, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 17, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, -2, null), + new mframe_t(GameAIAdapters.ai_run, -2, null), + new mframe_t(GameAIAdapters.ai_run, -1, null)}; static mmove_t actor_move_run= new mmove_t(FRAME_run02, FRAME_run07, actor_frames_run, null); @@ -652,68 +652,68 @@ public class M_Actor extends GameAI { static mframe_t actor_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 1, null)}; + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 1, null)}; static mmove_t actor_move_pain1= new mmove_t(FRAME_pain101, FRAME_pain103, actor_frames_pain1, actor_run); static mframe_t actor_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t actor_move_pain2= new mmove_t(FRAME_pain201, FRAME_pain203, actor_frames_pain2, actor_run); static mframe_t actor_frames_pain3[]= new mframe_t[] { - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t actor_move_pain3= new mmove_t(FRAME_pain301, FRAME_pain303, actor_frames_pain3, actor_run); static mframe_t actor_frames_flipoff[]= new mframe_t[] { - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null)}; + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null)}; static mmove_t actor_move_flipoff= new mmove_t(FRAME_flip01, FRAME_flip14, actor_frames_flipoff, actor_run); static mframe_t actor_frames_taunt[]= new mframe_t[] { - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null), - new mframe_t(ai_turn, 0, null)}; + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null), + new mframe_t(GameAIAdapters.ai_turn, 0, null)}; static mmove_t actor_move_taunt= new mmove_t(FRAME_taunt01, FRAME_taunt17, actor_frames_taunt, actor_run); @@ -801,7 +801,7 @@ public class M_Actor extends GameAI { } static EntThinkAdapter actor_dead= new EntThinkAdapter() { - public boolean actor_dead(edict_t self) { + public boolean think(edict_t self) { Math3D.VectorSet(self.mins, -16, -16, -24); Math3D.VectorSet(self.maxs, 16, 16, -8); self.movetype= MOVETYPE_TOSS; @@ -814,32 +814,32 @@ public class M_Actor extends GameAI { static mframe_t actor_frames_death1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -13, null), - new mframe_t(ai_move, 14, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 1, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -13, null), + new mframe_t(GameAIAdapters.ai_move, 14, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null)}; static mmove_t actor_move_death1= new mmove_t(FRAME_death101, FRAME_death107, actor_frames_death1, actor_dead); static mframe_t actor_frames_death2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 7, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -9, null), - new mframe_t(ai_move, -13, null), - new mframe_t(ai_move, -13, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 7, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -9, null), + new mframe_t(GameAIAdapters.ai_move, -13, null), + new mframe_t(GameAIAdapters.ai_move, -13, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t actor_move_death2= new mmove_t(FRAME_death201, FRAME_death213, actor_frames_death2, actor_dead); @@ -896,10 +896,10 @@ public class M_Actor extends GameAI { static mframe_t actor_frames_attack[]= new mframe_t[] { - new mframe_t(ai_charge, -2, actor_fire), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 2, null)}; + new mframe_t(GameAIAdapters.ai_charge, -2, actor_fire), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null)}; static mmove_t actor_move_attack= new mmove_t(FRAME_attak01, FRAME_attak04, actor_frames_attack, actor_run); @@ -992,7 +992,7 @@ public class M_Actor extends GameAI { self.monsterinfo.currentmove= actor_move_stand; self.monsterinfo.scale= MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); // actors always start in a dormant state, they *must* be used to get going self.use= actor_use; diff --git a/src/jake2/game/M_Berserk.java b/src/jake2/game/M_Berserk.java index 0998059..62c0d72 100644 --- a/src/jake2/game/M_Berserk.java +++ b/src/jake2/game/M_Berserk.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 11.11.2003 by RST -// $Id: M_Berserk.java,v 1.1 2004-07-07 19:59:08 hzi Exp $ +// $Id: M_Berserk.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -283,8 +283,9 @@ public class M_Berserk extends GameWeapon { static int sound_search; static EntInteractAdapter berserk_sight= new EntInteractAdapter() { - public void interact(edict_t self) { + public boolean interact(edict_t self, edict_t other) { gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); + return true; } }; @@ -311,11 +312,11 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, berserk_fidget), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, berserk_fidget), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t berserk_move_stand= new mmove_t(FRAME_stand1, FRAME_stand5, berserk_frames_stand, null); @@ -329,44 +330,44 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_stand_fidget[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t berserk_move_stand_fidget= new mmove_t(FRAME_standb1, FRAME_standb20, berserk_frames_stand_fidget, berserk_stand); static mframe_t berserk_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 9.1f, null), - new mframe_t(ai_walk, 6.3f, null), - new mframe_t(ai_walk, 4.9f, null), - new mframe_t(ai_walk, 6.7f, null), - new mframe_t(ai_walk, 6.0f, null), - new mframe_t(ai_walk, 8.2f, null), - new mframe_t(ai_walk, 7.2f, null), - new mframe_t(ai_walk, 6.1f, null), - new mframe_t(ai_walk, 4.9f, null), - new mframe_t(ai_walk, 4.7f, null), - new mframe_t(ai_walk, 4.7f, null), - new mframe_t(ai_walk, 4.8f, null)}; + new mframe_t(GameAIAdapters.ai_walk, 9.1f, null), + new mframe_t(GameAIAdapters.ai_walk, 6.3f, null), + new mframe_t(GameAIAdapters.ai_walk, 4.9f, null), + new mframe_t(GameAIAdapters.ai_walk, 6.7f, null), + new mframe_t(GameAIAdapters.ai_walk, 6.0f, null), + new mframe_t(GameAIAdapters.ai_walk, 8.2f, null), + new mframe_t(GameAIAdapters.ai_walk, 7.2f, null), + new mframe_t(GameAIAdapters.ai_walk, 6.1f, null), + new mframe_t(GameAIAdapters.ai_walk, 4.9f, null), + new mframe_t(GameAIAdapters.ai_walk, 4.7f, null), + new mframe_t(GameAIAdapters.ai_walk, 4.7f, null), + new mframe_t(GameAIAdapters.ai_walk, 4.8f, null)}; static mmove_t berserk_move_walk= new mmove_t(FRAME_walkc1, FRAME_walkc11, berserk_frames_walk, null); @@ -404,12 +405,12 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_run1[]= new mframe_t[] { - new mframe_t(ai_run, 21, null), - new mframe_t(ai_run, 11, null), - new mframe_t(ai_run, 21, null), - new mframe_t(ai_run, 25, null), - new mframe_t(ai_run, 18, null), - new mframe_t(ai_run, 19, null)}; + new mframe_t(GameAIAdapters.ai_run, 21, null), + new mframe_t(GameAIAdapters.ai_run, 11, null), + new mframe_t(GameAIAdapters.ai_run, 21, null), + new mframe_t(GameAIAdapters.ai_run, 25, null), + new mframe_t(GameAIAdapters.ai_run, 18, null), + new mframe_t(GameAIAdapters.ai_run, 19, null)}; static mmove_t berserk_move_run1= new mmove_t(FRAME_run1, FRAME_run6, berserk_frames_run1, null); @@ -443,14 +444,14 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_attack_spike[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, berserk_swing), - new mframe_t(ai_charge, 0, berserk_attack_spike), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, berserk_swing), + new mframe_t(GameAIAdapters.ai_charge, 0, berserk_attack_spike), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t berserk_move_attack_spike= new mmove_t(FRAME_att_c1, FRAME_att_c8, berserk_frames_attack_spike, berserk_run); @@ -467,18 +468,18 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_attack_club[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, berserk_swing), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, berserk_attack_club), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, berserk_swing), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, berserk_attack_club), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t berserk_move_attack_club= new mmove_t(FRAME_att_c9, FRAME_att_c20, berserk_frames_attack_club, berserk_run); @@ -490,20 +491,20 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_attack_strike[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, berserk_swing), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, berserk_strike), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 9.7f, null), - new mframe_t(ai_move, 13.6f, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, berserk_swing), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, berserk_strike), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 9.7f, null), + new mframe_t(GameAIAdapters.ai_move, 13.6f, null)}; static mmove_t berserk_move_attack_strike= new mmove_t(FRAME_att_c21, FRAME_att_c34, berserk_frames_attack_strike, berserk_run); @@ -541,36 +542,36 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t berserk_move_pain1= new mmove_t(FRAME_painc1, FRAME_painc4, berserk_frames_pain1, berserk_run); static mframe_t berserk_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t berserk_move_pain2= new mmove_t(FRAME_painb1, FRAME_painb20, berserk_frames_pain2, berserk_run); @@ -610,33 +611,33 @@ public class M_Berserk extends GameWeapon { static mframe_t berserk_frames_death1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t berserk_move_death1= new mmove_t(FRAME_death1, FRAME_death13, berserk_frames_death1, berserk_dead); static mframe_t berserk_frames_death2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t berserk_move_death2= new mmove_t(FRAME_deathc1, FRAME_deathc8, berserk_frames_death2, berserk_dead); @@ -646,7 +647,7 @@ public class M_Berserk extends GameWeapon { edict_t inflictor, edict_t attacker, int damage, - float point) { + float point[]) { int n; if (self.health <= self.gib_health) { @@ -718,7 +719,7 @@ public class M_Berserk extends GameWeapon { gi.linkentity(self); - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Boss2.java b/src/jake2/game/M_Boss2.java index 735a370..8743764 100644 --- a/src/jake2/game/M_Boss2.java +++ b/src/jake2/game/M_Boss2.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Boss2.java,v 1.1 2004-07-07 19:59:09 hzi Exp $ +// $Id: M_Boss2.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -587,257 +587,257 @@ public class M_Boss2 extends GameWeapon { static mframe_t boss2_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t boss2_move_stand= new mmove_t(FRAME_stand30, FRAME_stand50, boss2_frames_stand, null); static mframe_t boss2_frames_fidget[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t boss2_move_fidget= new mmove_t(FRAME_stand1, FRAME_stand30, boss2_frames_fidget, null); static mframe_t boss2_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null)}; + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null)}; static mmove_t boss2_move_walk= new mmove_t(FRAME_walk1, FRAME_walk20, boss2_frames_walk, null); static mframe_t boss2_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null)}; + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null)}; static mmove_t boss2_move_run= new mmove_t(FRAME_walk1, FRAME_walk20, boss2_frames_run, null); static mframe_t boss2_frames_attack_pre_mg[]= new mframe_t[] { - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, boss2_attack_mg)}; + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, boss2_attack_mg)}; static mmove_t boss2_move_attack_pre_mg= new mmove_t(FRAME_attack1, FRAME_attack9, boss2_frames_attack_pre_mg, null); // Loop this static mframe_t boss2_frames_attack_mg[]= new mframe_t[] { - new mframe_t(ai_charge, 1, Boss2MachineGun), - new mframe_t(ai_charge, 1, Boss2MachineGun), - new mframe_t(ai_charge, 1, Boss2MachineGun), - new mframe_t(ai_charge, 1, Boss2MachineGun), - new mframe_t(ai_charge, 1, Boss2MachineGun), - new mframe_t(ai_charge, 1, boss2_reattack_mg)}; + new mframe_t(GameAIAdapters.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAIAdapters.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAIAdapters.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAIAdapters.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAIAdapters.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAIAdapters.ai_charge, 1, boss2_reattack_mg)}; static mmove_t boss2_move_attack_mg= new mmove_t(FRAME_attack10, FRAME_attack15, boss2_frames_attack_mg, null); static mframe_t boss2_frames_attack_post_mg[]= new mframe_t[] { - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null)}; + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null)}; static mmove_t boss2_move_attack_post_mg= new mmove_t(FRAME_attack16, FRAME_attack19, boss2_frames_attack_post_mg, boss2_run); static mframe_t boss2_frames_attack_rocket[]= new mframe_t[] { - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_move, -20, Boss2Rocket), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null)}; + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_move, -20, Boss2Rocket), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null)}; static mmove_t boss2_move_attack_rocket= new mmove_t(FRAME_attack20, FRAME_attack40, boss2_frames_attack_rocket, boss2_run); static mframe_t boss2_frames_pain_heavy[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t boss2_move_pain_heavy= new mmove_t(FRAME_pain2, FRAME_pain19, boss2_frames_pain_heavy, boss2_run); static mframe_t boss2_frames_pain_light[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t boss2_move_pain_light= new mmove_t(FRAME_pain20, FRAME_pain23, boss2_frames_pain_light, boss2_run); static mframe_t boss2_frames_death[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, BossExplode)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, GameAIAdapters.BossExplode)}; /* static EntThinkAdapter xxx = new EntThinkAdapter() @@ -894,6 +894,6 @@ public class M_Boss2 extends GameWeapon { self.monsterinfo.currentmove= boss2_move_stand; self.monsterinfo.scale= MODEL_SCALE; - flymonster_start.think(self); + GameAIAdapters.flymonster_start.think(self); } } diff --git a/src/jake2/game/M_Boss31.java b/src/jake2/game/M_Boss31.java index 7350c3b..193ea3a 100644 --- a/src/jake2/game/M_Boss31.java +++ b/src/jake2/game/M_Boss31.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Boss31.java,v 1.1 2004-07-07 19:59:09 hzi Exp $ +// $Id: M_Boss31.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -652,82 +652,82 @@ public class M_Boss31 extends GameWeapon { static mframe_t jorg_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, jorg_idle), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, jorg_idle), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 10 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 20 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 30 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 19, null), - new mframe_t(ai_stand, 11, jorg_step_left), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 6, null), - new mframe_t(ai_stand, 9, jorg_step_right), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 19, null), + new mframe_t(GameAIAdapters.ai_stand, 11, jorg_step_left), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 6, null), + new mframe_t(GameAIAdapters.ai_stand, 9, jorg_step_right), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 40 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -2, null), - new mframe_t(ai_stand, -17, jorg_step_left), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -12, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -2, null), + new mframe_t(GameAIAdapters.ai_stand, -17, jorg_step_left), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -12, null), // 50 - new mframe_t(ai_stand, -14, jorg_step_right) // 51 + new mframe_t(GameAIAdapters.ai_stand, -14, jorg_step_right) // 51 }; static mmove_t jorg_move_stand= new mmove_t(FRAME_stand01, FRAME_stand51, jorg_frames_stand, null); static mframe_t jorg_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 17, jorg_step_left), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 33, jorg_step_right), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 9, null)}; + new mframe_t(GameAIAdapters.ai_run, 17, jorg_step_left), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 33, jorg_step_right), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 9, null)}; static mmove_t jorg_move_run= new mmove_t(FRAME_walk06, FRAME_walk19, jorg_frames_run, null); // @@ -736,40 +736,40 @@ public class M_Boss31 extends GameWeapon { static mframe_t jorg_frames_start_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 15, null)}; + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 15, null)}; static mmove_t jorg_move_start_walk= new mmove_t(FRAME_walk01, FRAME_walk05, jorg_frames_start_walk, null); static mframe_t jorg_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 17, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 12, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 33, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 9, null)}; + new mframe_t(GameAIAdapters.ai_walk, 17, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 12, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 33, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null)}; static mmove_t jorg_move_walk= new mmove_t(FRAME_walk06, FRAME_walk19, jorg_frames_walk, null); static mframe_t jorg_frames_end_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 11, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, -8, null)}; + new mframe_t(GameAIAdapters.ai_walk, 11, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, -8, null)}; static mmove_t jorg_move_end_walk= new mmove_t(FRAME_walk20, FRAME_walk25, jorg_frames_end_walk, null); @@ -792,108 +792,108 @@ public class M_Boss31 extends GameWeapon { static mframe_t jorg_frames_pain3[]= new mframe_t[] { - new mframe_t(ai_move, -28, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -3, jorg_step_left), - new mframe_t(ai_move, -9, null), - new mframe_t(ai_move, 0, jorg_step_right), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, -11, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 10, null), - new mframe_t(ai_move, 11, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 10, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 10, null), - new mframe_t(ai_move, 7, jorg_step_left), - new mframe_t(ai_move, 17, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, jorg_step_right)}; + new mframe_t(GameAIAdapters.ai_move, -28, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -3, jorg_step_left), + new mframe_t(GameAIAdapters.ai_move, -9, null), + new mframe_t(GameAIAdapters.ai_move, 0, jorg_step_right), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, -11, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 10, null), + new mframe_t(GameAIAdapters.ai_move, 11, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 10, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 10, null), + new mframe_t(GameAIAdapters.ai_move, 7, jorg_step_left), + new mframe_t(GameAIAdapters.ai_move, 17, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, jorg_step_right)}; static mmove_t jorg_move_pain3= new mmove_t(FRAME_pain301, FRAME_pain325, jorg_frames_pain3, jorg_run); static mframe_t jorg_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t jorg_move_pain2= new mmove_t(FRAME_pain201, FRAME_pain203, jorg_frames_pain2, jorg_run); static mframe_t jorg_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t jorg_move_pain1= new mmove_t(FRAME_pain101, FRAME_pain103, jorg_frames_pain1, jorg_run); static mframe_t jorg_frames_death1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 10 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 20 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 30 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 40 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, M_Boss32.MakronToss), - new mframe_t(ai_move, 0, BossExplode) // 50 + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, M_Boss32.MakronToss), + new mframe_t(GameAIAdapters.ai_move, 0, GameAIAdapters.BossExplode) // 50 }; static mmove_t jorg_move_death= @@ -901,55 +901,55 @@ public class M_Boss31 extends GameWeapon { static mframe_t jorg_frames_attack2[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, jorgBFG), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, jorgBFG), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t jorg_move_attack2= new mmove_t(FRAME_attak201, FRAME_attak213, jorg_frames_attack2, jorg_run); static mframe_t jorg_frames_start_attack1[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t jorg_move_start_attack1= new mmove_t(FRAME_attak101, FRAME_attak108, jorg_frames_start_attack1, jorg_attack1); static mframe_t jorg_frames_attack1[]= new mframe_t[] { - new mframe_t(ai_charge, 0, jorg_firebullet), - new mframe_t(ai_charge, 0, jorg_firebullet), - new mframe_t(ai_charge, 0, jorg_firebullet), - new mframe_t(ai_charge, 0, jorg_firebullet), - new mframe_t(ai_charge, 0, jorg_firebullet), - new mframe_t(ai_charge, 0, jorg_firebullet)}; + new mframe_t(GameAIAdapters.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAIAdapters.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAIAdapters.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAIAdapters.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAIAdapters.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAIAdapters.ai_charge, 0, jorg_firebullet)}; static mmove_t jorg_move_attack1= new mmove_t(FRAME_attak109, FRAME_attak114, jorg_frames_attack1, jorg_reattack1); static mframe_t jorg_frames_end_attack1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t jorg_move_end_attack1= new mmove_t(FRAME_attak115, FRAME_attak118, jorg_frames_end_attack1, jorg_run); @@ -1006,7 +1006,7 @@ public class M_Boss31 extends GameWeapon { self.monsterinfo.currentmove= jorg_move_stand; self.monsterinfo.scale= MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Boss32.java b/src/jake2/game/M_Boss32.java index fef2a14..8ba4382 100644 --- a/src/jake2/game/M_Boss32.java +++ b/src/jake2/game/M_Boss32.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Boss32.java,v 1.1 2004-07-07 19:59:10 hzi Exp $ +// $Id: M_Boss32.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -617,71 +617,71 @@ public class M_Boss32 extends GameWeapon { static mframe_t makron_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 10 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 20 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 30 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 40 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 50 - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null) // 60 + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null) // 60 }; static mmove_t makron_move_stand= @@ -689,32 +689,32 @@ public class M_Boss32 extends GameWeapon { static mframe_t makron_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 3, makron_step_left), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, makron_step_right), - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 12, null)}; + new mframe_t(GameAIAdapters.ai_run, 3, makron_step_left), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, makron_step_right), + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 12, null)}; static mmove_t makron_move_run= new mmove_t(FRAME_walk204, FRAME_walk213, makron_frames_run, null); static mframe_t makron_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 3, makron_step_left), - new mframe_t(ai_walk, 12, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 8, makron_step_right), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 12, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 12, null)}; + new mframe_t(GameAIAdapters.ai_walk, 3, makron_step_left), + new mframe_t(GameAIAdapters.ai_walk, 12, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 8, makron_step_right), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 12, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 12, null)}; static mmove_t makron_move_walk= new mmove_t(FRAME_walk204, FRAME_walk213, makron_frames_run, null); @@ -753,163 +753,163 @@ public class M_Boss32 extends GameWeapon { static mframe_t makron_frames_pain6[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 10 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, makron_popup), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, makron_popup), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 20 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, makron_taunt), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, makron_taunt), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_pain6= new mmove_t(FRAME_pain601, FRAME_pain627, makron_frames_pain6, makron_run); static mframe_t makron_frames_pain5[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_pain5= new mmove_t(FRAME_pain501, FRAME_pain504, makron_frames_pain5, makron_run); static mframe_t makron_frames_pain4[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_pain4= new mmove_t(FRAME_pain401, FRAME_pain404, makron_frames_pain4, makron_run); static mframe_t makron_frames_death2[]= new mframe_t[] { - new mframe_t(ai_move, -15, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, -12, null), - new mframe_t(ai_move, 0, makron_step_left), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -15, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, -12, null), + new mframe_t(GameAIAdapters.ai_move, 0, makron_step_left), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 10 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 11, null), - new mframe_t(ai_move, 12, null), - new mframe_t(ai_move, 11, makron_step_right), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 11, null), + new mframe_t(GameAIAdapters.ai_move, 12, null), + new mframe_t(GameAIAdapters.ai_move, 11, makron_step_right), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 20 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 30 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 7, null), - new mframe_t(ai_move, 6, makron_step_left), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 7, null), + new mframe_t(GameAIAdapters.ai_move, 6, makron_step_left), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), // 40 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 50 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -6, makron_step_right), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -4, makron_step_left), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -6, makron_step_right), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -4, makron_step_left), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 60 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -3, makron_step_right), - new mframe_t(ai_move, -8, null), - new mframe_t(ai_move, -3, makron_step_left), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -4, makron_step_right), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -3, makron_step_right), + new mframe_t(GameAIAdapters.ai_move, -8, null), + new mframe_t(GameAIAdapters.ai_move, -3, makron_step_left), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -4, makron_step_right), // 70 - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, 0, makron_step_left), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, 0, makron_step_left), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 80 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 90 - new mframe_t(ai_move, 27, makron_hit), - new mframe_t(ai_move, 26, null), - new mframe_t(ai_move, 0, makron_brainsplorch), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null) // 95 + new mframe_t(GameAIAdapters.ai_move, 27, makron_hit), + new mframe_t(GameAIAdapters.ai_move, 26, null), + new mframe_t(GameAIAdapters.ai_move, 0, makron_brainsplorch), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null) // 95 }; static mmove_t makron_move_death2= @@ -917,44 +917,44 @@ public class M_Boss32 extends GameWeapon { static mframe_t makron_frames_death3[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_death3= new mmove_t(FRAME_death301, FRAME_death320, makron_frames_death3, null); static mframe_t makron_frames_sight[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_sight= new mmove_t(FRAME_active01, FRAME_active13, makron_frames_sight, makron_run); @@ -1062,7 +1062,7 @@ public class M_Boss32 extends GameWeapon { }; static EntPainAdapter makron_pain= new EntPainAdapter() { - public void makron_pain(edict_t self, edict_t other, float kick, int damage) { + public void pain(edict_t self, edict_t other, float kick, int damage) { if (self.health < (self.max_health / 2)) self.s.skinnum= 1; @@ -1100,7 +1100,7 @@ public class M_Boss32 extends GameWeapon { }; static EntInteractAdapter makron_sight= new EntInteractAdapter() { - public boolean think(edict_t self) { + public boolean interact(edict_t self, edict_t other) { self.monsterinfo.currentmove= makron_move_sight; return true; } @@ -1315,70 +1315,70 @@ public class M_Boss32 extends GameWeapon { static mframe_t makron_frames_attack3[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, makronBFG), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, makronBFG), // FIXME: BFG Attack here - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_attack3= new mmove_t(FRAME_attak301, FRAME_attak308, makron_frames_attack3, makron_run); static mframe_t makron_frames_attack4[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_move, 0, MakronHyperblaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, MakronHyperblaster), // fire - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_attack4= new mmove_t(FRAME_attak401, FRAME_attak426, makron_frames_attack4, makron_run); static mframe_t makron_frames_attack5[]= new mframe_t[] { - new mframe_t(ai_charge, 0, makron_prerailgun), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, MakronSaveloc), - new mframe_t(ai_move, 0, MakronRailgun), + new mframe_t(GameAIAdapters.ai_charge, 0, makron_prerailgun), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, MakronSaveloc), + new mframe_t(GameAIAdapters.ai_move, 0, MakronRailgun), // Fire railgun - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t makron_move_attack5= new mmove_t(FRAME_attak501, FRAME_attak516, makron_frames_attack5, makron_run); @@ -1420,7 +1420,7 @@ public class M_Boss32 extends GameWeapon { self.monsterinfo.currentmove= makron_move_sight; self.monsterinfo.scale= MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } /* diff --git a/src/jake2/game/M_Brain.java b/src/jake2/game/M_Brain.java index fa2b444..4fa31ee 100644 --- a/src/jake2/game/M_Brain.java +++ b/src/jake2/game/M_Brain.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Brain.java,v 1.1 2004-07-07 19:59:11 hzi Exp $ +// $Id: M_Brain.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -288,36 +288,36 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t brain_move_stand= new mmove_t(FRAME_stand01, FRAME_stand30, brain_frames_stand, null); @@ -334,36 +334,36 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_idle[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t brain_move_idle= new mmove_t(FRAME_stand31, FRAME_stand60, brain_frames_idle, brain_stand); @@ -390,17 +390,17 @@ public class M_Brain extends GameWeapon { // static mframe_t brain_frames_walk1[]= new mframe_t[] { - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, -4, null), - new mframe_t(ai_walk, -1, null), - new mframe_t(ai_walk, 2, null)}; + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, -4, null), + new mframe_t(GameAIAdapters.ai_walk, -1, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null)}; static mmove_t brain_move_walk1= new mmove_t(FRAME_walk101, FRAME_walk111, brain_frames_walk1, null); @@ -508,26 +508,26 @@ public class M_Brain extends GameWeapon { }; static EntDodgeAdapter brain_dodge= new EntDodgeAdapter() { - public boolean brain_dodge(edict_t self, edict_t attacker, float eta) { + public void dodge(edict_t self, edict_t attacker, float eta) { if (Lib.random() > 0.25) - return true; + return; if (self.enemy == null) self.enemy= attacker; self.monsterinfo.pausetime= level.time + eta + 0.5f; self.monsterinfo.currentmove= brain_move_duck; - return true; + return; } }; static mframe_t brain_frames_death2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 9, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 9, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static EntThinkAdapter brain_dead= new EntThinkAdapter() { public boolean think(edict_t self) { @@ -546,24 +546,24 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_death1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 9, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 9, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t brain_move_death1= new mmove_t(FRAME_death101, FRAME_death118, brain_frames_death1, brain_dead); @@ -640,24 +640,24 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_attack1[]= new mframe_t[] { - new mframe_t(ai_charge, 8, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -3, brain_swing_right), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -5, null), - new mframe_t(ai_charge, -7, brain_hit_right), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 6, brain_swing_left), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 2, brain_hit_left), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, -11, null)}; + new mframe_t(GameAIAdapters.ai_charge, 8, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -3, brain_swing_right), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -5, null), + new mframe_t(GameAIAdapters.ai_charge, -7, brain_hit_right), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 6, brain_swing_left), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 2, brain_hit_left), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, -11, null)}; static EntThinkAdapter brain_chest_closed= new EntThinkAdapter() { public boolean think(edict_t self) { @@ -673,23 +673,23 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_attack2[]= new mframe_t[] { - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, -4, null), - new mframe_t(ai_charge, -4, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 0, brain_chest_open), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 13, brain_tentacle_attack), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -9, brain_chest_closed), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, -6, null)}; + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, -4, null), + new mframe_t(GameAIAdapters.ai_charge, -4, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 0, brain_chest_open), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 13, brain_tentacle_attack), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -9, brain_chest_closed), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, -6, null)}; static EntThinkAdapter brain_melee= new EntThinkAdapter() { public boolean think(edict_t self) { @@ -708,17 +708,17 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 2, null), - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 1, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, -4, null), - new mframe_t(ai_run, -1, null), - new mframe_t(ai_run, 2, null)}; + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 2, null), + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 1, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, -4, null), + new mframe_t(GameAIAdapters.ai_run, -1, null), + new mframe_t(GameAIAdapters.ai_run, 2, null)}; static mmove_t brain_move_run= new mmove_t(FRAME_walk101, FRAME_walk111, brain_frames_run, null); @@ -736,79 +736,79 @@ public class M_Brain extends GameWeapon { static mframe_t brain_frames_defense[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t brain_move_defense= new mmove_t(FRAME_defens01, FRAME_defens08, brain_frames_defense, null); static mframe_t brain_frames_pain3[]= new mframe_t[] { - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -4, null)}; + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -4, null)}; static mmove_t brain_move_pain3= new mmove_t(FRAME_pain301, FRAME_pain306, brain_frames_pain3, brain_run); static mframe_t brain_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, -2, null)}; + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, -2, null)}; static mmove_t brain_move_pain2= new mmove_t(FRAME_pain201, FRAME_pain208, brain_frames_pain2, brain_run); static mframe_t brain_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 7, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, -1, null)}; + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 7, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, -1, null)}; static mmove_t brain_move_pain1= new mmove_t(FRAME_pain101, FRAME_pain121, brain_frames_pain1, brain_run); static mframe_t brain_frames_duck[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, brain_duck_down), - new mframe_t(ai_move, 17, brain_duck_hold), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -1, brain_duck_up), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -6, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, brain_duck_down), + new mframe_t(GameAIAdapters.ai_move, 17, brain_duck_hold), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -1, brain_duck_up), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -6, null)}; static mmove_t brain_move_duck= new mmove_t(FRAME_duck01, FRAME_duck08, brain_frames_duck, brain_run); @@ -939,6 +939,6 @@ public class M_Brain extends GameWeapon { self.monsterinfo.currentmove= brain_move_stand; self.monsterinfo.scale= MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Chick.java b/src/jake2/game/M_Chick.java index 0fd006c..5e577fb 100644 --- a/src/jake2/game/M_Chick.java +++ b/src/jake2/game/M_Chick.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Chick.java,v 1.1 2004-07-07 19:59:11 hzi Exp $ +// $Id: M_Chick.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -347,36 +347,36 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_fidget[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, ChickMoan), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, ChickMoan), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static EntThinkAdapter chick_stand= new EntThinkAdapter() { public boolean think(edict_t self) { self.monsterinfo.currentmove= chick_move_stand; @@ -398,36 +398,36 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, chick_fidget), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, chick_fidget), }; static mmove_t chick_move_stand= new mmove_t(FRAME_stand101, FRAME_stand130, chick_frames_stand, null); @@ -451,46 +451,46 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_start_run[]= new mframe_t[] { - new mframe_t(ai_run, 1, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, -1, null), - new mframe_t(ai_run, -1, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 1, null), - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 3, null)}; + new mframe_t(GameAIAdapters.ai_run, 1, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, -1, null), + new mframe_t(GameAIAdapters.ai_run, -1, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 1, null), + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 3, null)}; static mmove_t chick_move_start_run= new mmove_t(FRAME_walk01, FRAME_walk10, chick_frames_start_run, chick_run); static mframe_t chick_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 7, null), - new mframe_t(ai_run, 4, null), - new mframe_t(ai_run, 11, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 7, null)}; + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 7, null), + new mframe_t(GameAIAdapters.ai_run, 4, null), + new mframe_t(GameAIAdapters.ai_run, 11, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 7, null)}; static mmove_t chick_move_run= new mmove_t(FRAME_walk11, FRAME_walk20, chick_frames_run, null); static mframe_t chick_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 13, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 11, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 7, null)}; + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 13, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 11, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null)}; static mmove_t chick_move_walk= new mmove_t(FRAME_walk11, FRAME_walk20, chick_frames_walk, null); @@ -504,47 +504,47 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t chick_move_pain1= new mmove_t(FRAME_pain101, FRAME_pain105, chick_frames_pain1, chick_run); static mframe_t chick_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t chick_move_pain2= new mmove_t(FRAME_pain201, FRAME_pain205, chick_frames_pain2, chick_run); static mframe_t chick_frames_pain3[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 11, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 7, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -8, null), - new mframe_t(ai_move, 2, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 11, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 7, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -8, null), + new mframe_t(GameAIAdapters.ai_move, 2, null)}; static mmove_t chick_move_pain3= new mmove_t(FRAME_pain301, FRAME_pain321, chick_frames_pain3, chick_run); @@ -596,46 +596,46 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_death2[]= new mframe_t[] { - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 10, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 15, null), - new mframe_t(ai_move, 14, null), - new mframe_t(ai_move, 1, null)}; + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 10, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 15, null), + new mframe_t(GameAIAdapters.ai_move, 14, null), + new mframe_t(GameAIAdapters.ai_move, 1, null)}; static mmove_t chick_move_death2= new mmove_t(FRAME_death201, FRAME_death223, chick_frames_death2, chick_dead); static mframe_t chick_frames_death1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 11, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 11, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t chick_move_death1= new mmove_t(FRAME_death101, FRAME_death112, chick_frames_death1, chick_dead); @@ -714,13 +714,13 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_duck[]= new mframe_t[] { - new mframe_t(ai_move, 0, chick_duck_down), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 4, chick_duck_hold), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -5, chick_duck_up), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 1, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, chick_duck_down), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 4, chick_duck_hold), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -5, chick_duck_up), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null)}; static mmove_t chick_move_duck= new mmove_t(FRAME_duck01, FRAME_duck07, chick_frames_duck, chick_run); @@ -810,48 +810,48 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_start_attack1[]= new mframe_t[] { - new mframe_t(ai_charge, 0, Chick_PreAttack1), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 7, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, chick_attack1)}; + new mframe_t(GameAIAdapters.ai_charge, 0, Chick_PreAttack1), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 7, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, chick_attack1)}; static mmove_t chick_move_start_attack1= new mmove_t(FRAME_attak101, FRAME_attak113, chick_frames_start_attack1, null); static mframe_t chick_frames_attack1[]= new mframe_t[] { - new mframe_t(ai_charge, 19, ChickRocket), - new mframe_t(ai_charge, -6, null), - new mframe_t(ai_charge, -5, null), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -7, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 10, ChickReload), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 3, chick_rerocket)}; + new mframe_t(GameAIAdapters.ai_charge, 19, ChickRocket), + new mframe_t(GameAIAdapters.ai_charge, -6, null), + new mframe_t(GameAIAdapters.ai_charge, -5, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -7, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 10, ChickReload), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 3, chick_rerocket)}; static mmove_t chick_move_attack1= new mmove_t(FRAME_attak114, FRAME_attak127, chick_frames_attack1, null); static mframe_t chick_frames_end_attack1[]= new mframe_t[] { - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -6, null), - new mframe_t(ai_charge, -4, null), - new mframe_t(ai_charge, -2, null)}; + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -6, null), + new mframe_t(GameAIAdapters.ai_charge, -4, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null)}; static mmove_t chick_move_end_attack1= new mmove_t(FRAME_attak128, FRAME_attak132, chick_frames_end_attack1, chick_run); @@ -874,24 +874,24 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_slash[]= new mframe_t[] { - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 7, ChickSlash), - new mframe_t(ai_charge, -7, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, -2, chick_reslash)}; + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 7, ChickSlash), + new mframe_t(GameAIAdapters.ai_charge, -7, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, -2, chick_reslash)}; static mmove_t chick_move_slash= new mmove_t(FRAME_attak204, FRAME_attak212, chick_frames_slash, null); static mframe_t chick_frames_end_slash[]= new mframe_t[] { - new mframe_t(ai_charge, -6, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -6, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, -6, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -6, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t chick_move_end_slash= new mmove_t(FRAME_attak213, FRAME_attak216, chick_frames_end_slash, chick_run); @@ -904,9 +904,9 @@ public class M_Chick extends GameWeapon { static mframe_t chick_frames_start_slash[]= new mframe_t[] { - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 8, null), - new mframe_t(ai_charge, 3, null)}; + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 8, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null)}; static mmove_t chick_move_start_slash= new mmove_t(FRAME_attak201, FRAME_attak203, chick_frames_start_slash, chick_slash); @@ -925,7 +925,7 @@ public class M_Chick extends GameWeapon { }; static EntInteractAdapter chick_sight= new EntInteractAdapter() { - public boolean think(edict_t self) { + public boolean interact(edict_t self, edict_t other) { gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); return true; } @@ -981,7 +981,7 @@ public class M_Chick extends GameWeapon { self.monsterinfo.currentmove= chick_move_stand; self.monsterinfo.scale= MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Flipper.java b/src/jake2/game/M_Flipper.java index a1e019d..e3b7648 100644 --- a/src/jake2/game/M_Flipper.java +++ b/src/jake2/game/M_Flipper.java @@ -19,179 +19,180 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Flipper.java,v 1.1 2004-07-07 19:59:12 hzi Exp $ +// $Id: M_Flipper.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.util.*; import jake2.util.*; -public class M_Flipper extends Game { +public class M_Flipper extends Game +{ // This file generated by ModelGen - Do NOT Modify - public final static int FRAME_flpbit01= 0; - public final static int FRAME_flpbit02= 1; - public final static int FRAME_flpbit03= 2; - public final static int FRAME_flpbit04= 3; - public final static int FRAME_flpbit05= 4; - public final static int FRAME_flpbit06= 5; - public final static int FRAME_flpbit07= 6; - public final static int FRAME_flpbit08= 7; - public final static int FRAME_flpbit09= 8; - public final static int FRAME_flpbit10= 9; - public final static int FRAME_flpbit11= 10; - public final static int FRAME_flpbit12= 11; - public final static int FRAME_flpbit13= 12; - public final static int FRAME_flpbit14= 13; - public final static int FRAME_flpbit15= 14; - public final static int FRAME_flpbit16= 15; - public final static int FRAME_flpbit17= 16; - public final static int FRAME_flpbit18= 17; - public final static int FRAME_flpbit19= 18; - public final static int FRAME_flpbit20= 19; - public final static int FRAME_flptal01= 20; - public final static int FRAME_flptal02= 21; - public final static int FRAME_flptal03= 22; - public final static int FRAME_flptal04= 23; - public final static int FRAME_flptal05= 24; - public final static int FRAME_flptal06= 25; - public final static int FRAME_flptal07= 26; - public final static int FRAME_flptal08= 27; - public final static int FRAME_flptal09= 28; - public final static int FRAME_flptal10= 29; - public final static int FRAME_flptal11= 30; - public final static int FRAME_flptal12= 31; - public final static int FRAME_flptal13= 32; - public final static int FRAME_flptal14= 33; - public final static int FRAME_flptal15= 34; - public final static int FRAME_flptal16= 35; - public final static int FRAME_flptal17= 36; - public final static int FRAME_flptal18= 37; - public final static int FRAME_flptal19= 38; - public final static int FRAME_flptal20= 39; - public final static int FRAME_flptal21= 40; - public final static int FRAME_flphor01= 41; - public final static int FRAME_flphor02= 42; - public final static int FRAME_flphor03= 43; - public final static int FRAME_flphor04= 44; - public final static int FRAME_flphor05= 45; - public final static int FRAME_flphor06= 46; - public final static int FRAME_flphor07= 47; - public final static int FRAME_flphor08= 48; - public final static int FRAME_flphor09= 49; - public final static int FRAME_flphor10= 50; - public final static int FRAME_flphor11= 51; - public final static int FRAME_flphor12= 52; - public final static int FRAME_flphor13= 53; - public final static int FRAME_flphor14= 54; - public final static int FRAME_flphor15= 55; - public final static int FRAME_flphor16= 56; - public final static int FRAME_flphor17= 57; - public final static int FRAME_flphor18= 58; - public final static int FRAME_flphor19= 59; - public final static int FRAME_flphor20= 60; - public final static int FRAME_flphor21= 61; - public final static int FRAME_flphor22= 62; - public final static int FRAME_flphor23= 63; - public final static int FRAME_flphor24= 64; - public final static int FRAME_flpver01= 65; - public final static int FRAME_flpver02= 66; - public final static int FRAME_flpver03= 67; - public final static int FRAME_flpver04= 68; - public final static int FRAME_flpver05= 69; - public final static int FRAME_flpver06= 70; - public final static int FRAME_flpver07= 71; - public final static int FRAME_flpver08= 72; - public final static int FRAME_flpver09= 73; - public final static int FRAME_flpver10= 74; - public final static int FRAME_flpver11= 75; - public final static int FRAME_flpver12= 76; - public final static int FRAME_flpver13= 77; - public final static int FRAME_flpver14= 78; - public final static int FRAME_flpver15= 79; - public final static int FRAME_flpver16= 80; - public final static int FRAME_flpver17= 81; - public final static int FRAME_flpver18= 82; - public final static int FRAME_flpver19= 83; - public final static int FRAME_flpver20= 84; - public final static int FRAME_flpver21= 85; - public final static int FRAME_flpver22= 86; - public final static int FRAME_flpver23= 87; - public final static int FRAME_flpver24= 88; - public final static int FRAME_flpver25= 89; - public final static int FRAME_flpver26= 90; - public final static int FRAME_flpver27= 91; - public final static int FRAME_flpver28= 92; - public final static int FRAME_flpver29= 93; - public final static int FRAME_flppn101= 94; - public final static int FRAME_flppn102= 95; - public final static int FRAME_flppn103= 96; - public final static int FRAME_flppn104= 97; - public final static int FRAME_flppn105= 98; - public final static int FRAME_flppn201= 99; - public final static int FRAME_flppn202= 100; - public final static int FRAME_flppn203= 101; - public final static int FRAME_flppn204= 102; - public final static int FRAME_flppn205= 103; - public final static int FRAME_flpdth01= 104; - public final static int FRAME_flpdth02= 105; - public final static int FRAME_flpdth03= 106; - public final static int FRAME_flpdth04= 107; - public final static int FRAME_flpdth05= 108; - public final static int FRAME_flpdth06= 109; - public final static int FRAME_flpdth07= 110; - public final static int FRAME_flpdth08= 111; - public final static int FRAME_flpdth09= 112; - public final static int FRAME_flpdth10= 113; - public final static int FRAME_flpdth11= 114; - public final static int FRAME_flpdth12= 115; - public final static int FRAME_flpdth13= 116; - public final static int FRAME_flpdth14= 117; - public final static int FRAME_flpdth15= 118; - public final static int FRAME_flpdth16= 119; - public final static int FRAME_flpdth17= 120; - public final static int FRAME_flpdth18= 121; - public final static int FRAME_flpdth19= 122; - public final static int FRAME_flpdth20= 123; - public final static int FRAME_flpdth21= 124; - public final static int FRAME_flpdth22= 125; - public final static int FRAME_flpdth23= 126; - public final static int FRAME_flpdth24= 127; - public final static int FRAME_flpdth25= 128; - public final static int FRAME_flpdth26= 129; - public final static int FRAME_flpdth27= 130; - public final static int FRAME_flpdth28= 131; - public final static int FRAME_flpdth29= 132; - public final static int FRAME_flpdth30= 133; - public final static int FRAME_flpdth31= 134; - public final static int FRAME_flpdth32= 135; - public final static int FRAME_flpdth33= 136; - public final static int FRAME_flpdth34= 137; - public final static int FRAME_flpdth35= 138; - public final static int FRAME_flpdth36= 139; - public final static int FRAME_flpdth37= 140; - public final static int FRAME_flpdth38= 141; - public final static int FRAME_flpdth39= 142; - public final static int FRAME_flpdth40= 143; - public final static int FRAME_flpdth41= 144; - public final static int FRAME_flpdth42= 145; - public final static int FRAME_flpdth43= 146; - public final static int FRAME_flpdth44= 147; - public final static int FRAME_flpdth45= 148; - public final static int FRAME_flpdth46= 149; - public final static int FRAME_flpdth47= 150; - public final static int FRAME_flpdth48= 151; - public final static int FRAME_flpdth49= 152; - public final static int FRAME_flpdth50= 153; - public final static int FRAME_flpdth51= 154; - public final static int FRAME_flpdth52= 155; - public final static int FRAME_flpdth53= 156; - public final static int FRAME_flpdth54= 157; - public final static int FRAME_flpdth55= 158; - public final static int FRAME_flpdth56= 159; - - public final static float MODEL_SCALE= 1.000000f; + public final static int FRAME_flpbit01 = 0; + public final static int FRAME_flpbit02 = 1; + public final static int FRAME_flpbit03 = 2; + public final static int FRAME_flpbit04 = 3; + public final static int FRAME_flpbit05 = 4; + public final static int FRAME_flpbit06 = 5; + public final static int FRAME_flpbit07 = 6; + public final static int FRAME_flpbit08 = 7; + public final static int FRAME_flpbit09 = 8; + public final static int FRAME_flpbit10 = 9; + public final static int FRAME_flpbit11 = 10; + public final static int FRAME_flpbit12 = 11; + public final static int FRAME_flpbit13 = 12; + public final static int FRAME_flpbit14 = 13; + public final static int FRAME_flpbit15 = 14; + public final static int FRAME_flpbit16 = 15; + public final static int FRAME_flpbit17 = 16; + public final static int FRAME_flpbit18 = 17; + public final static int FRAME_flpbit19 = 18; + public final static int FRAME_flpbit20 = 19; + public final static int FRAME_flptal01 = 20; + public final static int FRAME_flptal02 = 21; + public final static int FRAME_flptal03 = 22; + public final static int FRAME_flptal04 = 23; + public final static int FRAME_flptal05 = 24; + public final static int FRAME_flptal06 = 25; + public final static int FRAME_flptal07 = 26; + public final static int FRAME_flptal08 = 27; + public final static int FRAME_flptal09 = 28; + public final static int FRAME_flptal10 = 29; + public final static int FRAME_flptal11 = 30; + public final static int FRAME_flptal12 = 31; + public final static int FRAME_flptal13 = 32; + public final static int FRAME_flptal14 = 33; + public final static int FRAME_flptal15 = 34; + public final static int FRAME_flptal16 = 35; + public final static int FRAME_flptal17 = 36; + public final static int FRAME_flptal18 = 37; + public final static int FRAME_flptal19 = 38; + public final static int FRAME_flptal20 = 39; + public final static int FRAME_flptal21 = 40; + public final static int FRAME_flphor01 = 41; + public final static int FRAME_flphor02 = 42; + public final static int FRAME_flphor03 = 43; + public final static int FRAME_flphor04 = 44; + public final static int FRAME_flphor05 = 45; + public final static int FRAME_flphor06 = 46; + public final static int FRAME_flphor07 = 47; + public final static int FRAME_flphor08 = 48; + public final static int FRAME_flphor09 = 49; + public final static int FRAME_flphor10 = 50; + public final static int FRAME_flphor11 = 51; + public final static int FRAME_flphor12 = 52; + public final static int FRAME_flphor13 = 53; + public final static int FRAME_flphor14 = 54; + public final static int FRAME_flphor15 = 55; + public final static int FRAME_flphor16 = 56; + public final static int FRAME_flphor17 = 57; + public final static int FRAME_flphor18 = 58; + public final static int FRAME_flphor19 = 59; + public final static int FRAME_flphor20 = 60; + public final static int FRAME_flphor21 = 61; + public final static int FRAME_flphor22 = 62; + public final static int FRAME_flphor23 = 63; + public final static int FRAME_flphor24 = 64; + public final static int FRAME_flpver01 = 65; + public final static int FRAME_flpver02 = 66; + public final static int FRAME_flpver03 = 67; + public final static int FRAME_flpver04 = 68; + public final static int FRAME_flpver05 = 69; + public final static int FRAME_flpver06 = 70; + public final static int FRAME_flpver07 = 71; + public final static int FRAME_flpver08 = 72; + public final static int FRAME_flpver09 = 73; + public final static int FRAME_flpver10 = 74; + public final static int FRAME_flpver11 = 75; + public final static int FRAME_flpver12 = 76; + public final static int FRAME_flpver13 = 77; + public final static int FRAME_flpver14 = 78; + public final static int FRAME_flpver15 = 79; + public final static int FRAME_flpver16 = 80; + public final static int FRAME_flpver17 = 81; + public final static int FRAME_flpver18 = 82; + public final static int FRAME_flpver19 = 83; + public final static int FRAME_flpver20 = 84; + public final static int FRAME_flpver21 = 85; + public final static int FRAME_flpver22 = 86; + public final static int FRAME_flpver23 = 87; + public final static int FRAME_flpver24 = 88; + public final static int FRAME_flpver25 = 89; + public final static int FRAME_flpver26 = 90; + public final static int FRAME_flpver27 = 91; + public final static int FRAME_flpver28 = 92; + public final static int FRAME_flpver29 = 93; + public final static int FRAME_flppn101 = 94; + public final static int FRAME_flppn102 = 95; + public final static int FRAME_flppn103 = 96; + public final static int FRAME_flppn104 = 97; + public final static int FRAME_flppn105 = 98; + public final static int FRAME_flppn201 = 99; + public final static int FRAME_flppn202 = 100; + public final static int FRAME_flppn203 = 101; + public final static int FRAME_flppn204 = 102; + public final static int FRAME_flppn205 = 103; + public final static int FRAME_flpdth01 = 104; + public final static int FRAME_flpdth02 = 105; + public final static int FRAME_flpdth03 = 106; + public final static int FRAME_flpdth04 = 107; + public final static int FRAME_flpdth05 = 108; + public final static int FRAME_flpdth06 = 109; + public final static int FRAME_flpdth07 = 110; + public final static int FRAME_flpdth08 = 111; + public final static int FRAME_flpdth09 = 112; + public final static int FRAME_flpdth10 = 113; + public final static int FRAME_flpdth11 = 114; + public final static int FRAME_flpdth12 = 115; + public final static int FRAME_flpdth13 = 116; + public final static int FRAME_flpdth14 = 117; + public final static int FRAME_flpdth15 = 118; + public final static int FRAME_flpdth16 = 119; + public final static int FRAME_flpdth17 = 120; + public final static int FRAME_flpdth18 = 121; + public final static int FRAME_flpdth19 = 122; + public final static int FRAME_flpdth20 = 123; + public final static int FRAME_flpdth21 = 124; + public final static int FRAME_flpdth22 = 125; + public final static int FRAME_flpdth23 = 126; + public final static int FRAME_flpdth24 = 127; + public final static int FRAME_flpdth25 = 128; + public final static int FRAME_flpdth26 = 129; + public final static int FRAME_flpdth27 = 130; + public final static int FRAME_flpdth28 = 131; + public final static int FRAME_flpdth29 = 132; + public final static int FRAME_flpdth30 = 133; + public final static int FRAME_flpdth31 = 134; + public final static int FRAME_flpdth32 = 135; + public final static int FRAME_flpdth33 = 136; + public final static int FRAME_flpdth34 = 137; + public final static int FRAME_flpdth35 = 138; + public final static int FRAME_flpdth36 = 139; + public final static int FRAME_flpdth37 = 140; + public final static int FRAME_flpdth38 = 141; + public final static int FRAME_flpdth39 = 142; + public final static int FRAME_flpdth40 = 143; + public final static int FRAME_flpdth41 = 144; + public final static int FRAME_flpdth42 = 145; + public final static int FRAME_flpdth43 = 146; + public final static int FRAME_flpdth44 = 147; + public final static int FRAME_flpdth45 = 148; + public final static int FRAME_flpdth46 = 149; + public final static int FRAME_flpdth47 = 150; + public final static int FRAME_flpdth48 = 151; + public final static int FRAME_flpdth49 = 152; + public final static int FRAME_flpdth50 = 153; + public final static int FRAME_flpdth51 = 154; + public final static int FRAME_flpdth52 = 155; + public final static int FRAME_flpdth53 = 156; + public final static int FRAME_flpdth54 = 157; + public final static int FRAME_flpdth55 = 158; + public final static int FRAME_flpdth56 = 159; + + public final static float MODEL_SCALE = 1.000000f; static int sound_chomp; static int sound_attack; @@ -202,171 +203,158 @@ public class M_Flipper extends Game { static int sound_search; static int sound_sight; - static mframe_t flipper_frames_stand[]= - new mframe_t[] { new mframe_t(ai_stand, 0, null)}; + static mframe_t flipper_frames_stand[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_stand, 0, null)}; - static mmove_t flipper_move_stand= - new mmove_t(FRAME_flphor01, FRAME_flphor01, flipper_frames_stand, null); + static mmove_t flipper_move_stand = new mmove_t(FRAME_flphor01, FRAME_flphor01, flipper_frames_stand, null); - static EntThinkAdapter flipper_stand= new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.currentmove= flipper_move_stand; + static EntThinkAdapter flipper_stand = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.currentmove = flipper_move_stand; return true; } }; - public final static int FLIPPER_RUN_SPEED= 24; + public final static int FLIPPER_RUN_SPEED = 24; - static mframe_t flipper_frames_run[]= - new mframe_t[] { new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), // 6 - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), + static mframe_t flipper_frames_run[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), // 6 + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), // 10 - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), // 20 - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null), - new mframe_t(ai_run, FLIPPER_RUN_SPEED, null) // 29 + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null), + new mframe_t(GameAIAdapters.ai_run, FLIPPER_RUN_SPEED, null) // 29 }; - static mmove_t flipper_move_run_loop= - new mmove_t(FRAME_flpver06, FRAME_flpver29, flipper_frames_run, null); + static mmove_t flipper_move_run_loop = new mmove_t(FRAME_flpver06, FRAME_flpver29, flipper_frames_run, null); - static EntThinkAdapter flipper_run_loop= new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.currentmove= flipper_move_run_loop; + static EntThinkAdapter flipper_run_loop = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.currentmove = flipper_move_run_loop; return true; } }; - static mframe_t flipper_frames_run_start[]= + static mframe_t flipper_frames_run_start[] = new mframe_t[] { - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null)}; - static mmove_t flipper_move_run_start= - new mmove_t( - FRAME_flpver01, - FRAME_flpver06, - flipper_frames_run_start, - flipper_run_loop); - - static EntThinkAdapter flipper_run= new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.currentmove= flipper_move_run_start; + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null)}; + static mmove_t flipper_move_run_start = new mmove_t(FRAME_flpver01, FRAME_flpver06, flipper_frames_run_start, flipper_run_loop); + + static EntThinkAdapter flipper_run = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.currentmove = flipper_move_run_start; return true; } }; /* Standard Swimming */ - static mframe_t flipper_frames_walk[]= + static mframe_t flipper_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null)}; - static mmove_t flipper_move_walk= - new mmove_t(FRAME_flphor01, FRAME_flphor24, flipper_frames_walk, null); - - static EntThinkAdapter flipper_walk= new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.currentmove= flipper_move_walk; + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null)}; + static mmove_t flipper_move_walk = new mmove_t(FRAME_flphor01, FRAME_flphor24, flipper_frames_walk, null); + + static EntThinkAdapter flipper_walk = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.currentmove = flipper_move_walk; return true; } }; - static mframe_t flipper_frames_start_run[]= + static mframe_t flipper_frames_start_run[] = new mframe_t[] { - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 8, flipper_run)}; - static mmove_t flipper_move_start_run= - new mmove_t( - FRAME_flphor01, - FRAME_flphor05, - flipper_frames_start_run, - null); - - static EntThinkAdapter flipper_start_run= new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.currentmove= flipper_move_start_run; + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 8, flipper_run)}; + static mmove_t flipper_move_start_run = new mmove_t(FRAME_flphor01, FRAME_flphor05, flipper_frames_start_run, null); + + static EntThinkAdapter flipper_start_run = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.currentmove = flipper_move_start_run; return true; } }; - static mframe_t flipper_frames_pain2[]= + static mframe_t flipper_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t flipper_move_pain2= - new mmove_t( - FRAME_flppn101, - FRAME_flppn105, - flipper_frames_pain2, - flipper_run); - - static mframe_t flipper_frames_pain1[]= + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t flipper_move_pain2 = new mmove_t(FRAME_flppn101, FRAME_flppn105, flipper_frames_pain2, flipper_run); + + static mframe_t flipper_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t flipper_move_pain1= - new mmove_t( - FRAME_flppn201, - FRAME_flppn205, - flipper_frames_pain1, - flipper_run); - static EntThinkAdapter flipper_bite= new EntThinkAdapter() { - public boolean think(edict_t self) { - float[] aim= { 0, 0, 0 }; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t flipper_move_pain1 = new mmove_t(FRAME_flppn201, FRAME_flppn205, flipper_frames_pain1, flipper_run); + static EntThinkAdapter flipper_bite = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + float[] aim = { 0, 0, 0 }; Math3D.VectorSet(aim, MELEE_DISTANCE, 0, 0); Fire.fire_hit(self, aim, 5, 0); @@ -374,198 +362,181 @@ public class M_Flipper extends Game { } }; - static EntThinkAdapter flipper_preattack= new EntThinkAdapter() { + static EntThinkAdapter flipper_preattack = new EntThinkAdapter() + { - public boolean think(edict_t self) { + public boolean think(edict_t self) + { gi.sound(self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0); return true; } }; - static mframe_t flipper_frames_attack[]= + static mframe_t flipper_frames_attack[] = new mframe_t[] { - new mframe_t(ai_charge, 0, flipper_preattack), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, flipper_bite), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, flipper_bite), - new mframe_t(ai_charge, 0, null)}; - static mmove_t flipper_move_attack= - new mmove_t( - FRAME_flpbit01, - FRAME_flpbit20, - flipper_frames_attack, - flipper_run); - - static EntThinkAdapter flipper_melee= new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.currentmove= flipper_move_attack; + new mframe_t(GameAIAdapters.ai_charge, 0, flipper_preattack), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, flipper_bite), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, flipper_bite), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; + static mmove_t flipper_move_attack = new mmove_t(FRAME_flpbit01, FRAME_flpbit20, flipper_frames_attack, flipper_run); + + static EntThinkAdapter flipper_melee = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.currentmove = flipper_move_attack; return true; } }; - static EntPainAdapter flipper_pain= new EntPainAdapter() { - public void pain(edict_t self, edict_t other, float kick, int damage) { + static EntPainAdapter flipper_pain = new EntPainAdapter() + { + public void pain(edict_t self, edict_t other, float kick, int damage) + { int n; if (self.health < (self.max_health / 2)) - self.s.skinnum= 1; + self.s.skinnum = 1; if (level.time < self.pain_debounce_time) return; - self.pain_debounce_time= level.time + 3; + self.pain_debounce_time = level.time + 3; if (skill.value == 3) return; // no pain anims in nightmare - n= (Lib.rand() + 1) % 2; - if (n == 0) { + n = (Lib.rand() + 1) % 2; + if (n == 0) + { gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); - self.monsterinfo.currentmove= flipper_move_pain1; - } else { + self.monsterinfo.currentmove = flipper_move_pain1; + } + else + { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); - self.monsterinfo.currentmove= flipper_move_pain2; + self.monsterinfo.currentmove = flipper_move_pain2; } return; } }; - static EntThinkAdapter flipper_dead= new EntThinkAdapter() { - public boolean think(edict_t self) { + static EntThinkAdapter flipper_dead = new EntThinkAdapter() + { + public boolean think(edict_t self) + { Math3D.VectorSet(self.mins, -16, -16, -24); Math3D.VectorSet(self.maxs, 16, 16, -8); - self.movetype= MOVETYPE_TOSS; + self.movetype = MOVETYPE_TOSS; self.svflags |= SVF_DEADMONSTER; - self.nextthink= 0; + self.nextthink = 0; gi.linkentity(self); return true; } }; - static mframe_t flipper_frames_death[]= + static mframe_t flipper_frames_death[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t flipper_move_death= - new mmove_t( - FRAME_flpdth01, - FRAME_flpdth56, - flipper_frames_death, - flipper_dead); - - static EntInteractAdapter flipper_sight= new EntInteractAdapter() { - public boolean interact(edict_t self, edict_t other) { + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t flipper_move_death = new mmove_t(FRAME_flpdth01, FRAME_flpdth56, flipper_frames_death, flipper_dead); + + static EntInteractAdapter flipper_sight = new EntInteractAdapter() + { + public boolean interact(edict_t self, edict_t other) + { gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); return true; } }; - static EntDieAdapter flipper_die= new EntDieAdapter() { + static EntDieAdapter flipper_die = new EntDieAdapter() + { - public void flipper_die( - edict_t self, - edict_t inflictor, - edict_t attacker, - int damage, - float[] point) { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { int n; // check for gib - if (self.health <= self.gib_health) { - gi.sound( - self, - CHAN_VOICE, - gi.soundindex("misc/udeath.wav"), - 1, - ATTN_NORM, - 0); - for (n= 0; n < 2; n++) - ThrowGib( - self, - "models/objects/gibs/bone/tris.md2", - damage, - GIB_ORGANIC); - for (n= 0; n < 2; n++) - ThrowGib( - self, - "models/objects/gibs/sm_meat/tris.md2", - damage, - GIB_ORGANIC); - ThrowHead( - self, - "models/objects/gibs/sm_meat/tris.md2", - damage, - GIB_ORGANIC); - self.deadflag= DEAD_DEAD; + if (self.health <= self.gib_health) + { + gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); + for (n = 0; n < 2; n++) + ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + for (n = 0; n < 2; n++) + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + self.deadflag = DEAD_DEAD; return; } @@ -574,54 +545,56 @@ public class M_Flipper extends Game { // regular death gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); - self.deadflag= DEAD_DEAD; - self.takedamage= DAMAGE_YES; - self.monsterinfo.currentmove= flipper_move_death; + self.deadflag = DEAD_DEAD; + self.takedamage = DAMAGE_YES; + self.monsterinfo.currentmove = flipper_move_death; } }; /*QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight */ - public static void SP_monster_flipper(edict_t self) { - if (deathmatch.value != 0) { + public static void SP_monster_flipper(edict_t self) + { + if (deathmatch.value != 0) + { G_FreeEdict(self); return; } - sound_pain1= gi.soundindex("flipper/flppain1.wav"); - sound_pain2= gi.soundindex("flipper/flppain2.wav"); - sound_death= gi.soundindex("flipper/flpdeth1.wav"); - sound_chomp= gi.soundindex("flipper/flpatck1.wav"); - sound_attack= gi.soundindex("flipper/flpatck2.wav"); - sound_idle= gi.soundindex("flipper/flpidle1.wav"); - sound_search= gi.soundindex("flipper/flpsrch1.wav"); - sound_sight= gi.soundindex("flipper/flpsght1.wav"); - - self.movetype= MOVETYPE_STEP; - self.solid= SOLID_BBOX; - self.s.modelindex= gi.modelindex("models/monsters/flipper/tris.md2"); + sound_pain1 = gi.soundindex("flipper/flppain1.wav"); + sound_pain2 = gi.soundindex("flipper/flppain2.wav"); + sound_death = gi.soundindex("flipper/flpdeth1.wav"); + sound_chomp = gi.soundindex("flipper/flpatck1.wav"); + sound_attack = gi.soundindex("flipper/flpatck2.wav"); + sound_idle = gi.soundindex("flipper/flpidle1.wav"); + sound_search = gi.soundindex("flipper/flpsrch1.wav"); + sound_sight = gi.soundindex("flipper/flpsght1.wav"); + + self.movetype = MOVETYPE_STEP; + self.solid = SOLID_BBOX; + self.s.modelindex = gi.modelindex("models/monsters/flipper/tris.md2"); Math3D.VectorSet(self.mins, -16, -16, 0); Math3D.VectorSet(self.maxs, 16, 16, 32); - self.health= 50; - self.gib_health= -30; - self.mass= 100; + self.health = 50; + self.gib_health = -30; + self.mass = 100; - self.pain= flipper_pain; - self.die= flipper_die; + self.pain = flipper_pain; + self.die = flipper_die; - self.monsterinfo.stand= flipper_stand; - self.monsterinfo.walk= flipper_walk; - self.monsterinfo.run= flipper_start_run; - self.monsterinfo.melee= flipper_melee; - self.monsterinfo.sight= flipper_sight; + self.monsterinfo.stand = flipper_stand; + self.monsterinfo.walk = flipper_walk; + self.monsterinfo.run = flipper_start_run; + self.monsterinfo.melee = flipper_melee; + self.monsterinfo.sight = flipper_sight; gi.linkentity(self); - self.monsterinfo.currentmove= flipper_move_stand; - self.monsterinfo.scale= MODEL_SCALE; + self.monsterinfo.currentmove = flipper_move_stand; + self.monsterinfo.scale = MODEL_SCALE; - swimmonster_start.think(self); + GameAIAdapters.swimmonster_start.think(self); } } diff --git a/src/jake2/game/M_Float.java b/src/jake2/game/M_Float.java index 0640105..dcf00ae 100644 --- a/src/jake2/game/M_Float.java +++ b/src/jake2/game/M_Float.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Float.java,v 1.1 2004-07-07 19:59:13 hzi Exp $ +// $Id: M_Float.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -343,58 +343,58 @@ public class M_Float extends Game { static mframe_t floater_frames_stand1[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t floater_move_stand1= new mmove_t( FRAME_stand101, @@ -404,58 +404,58 @@ public class M_Float extends Game { static mframe_t floater_frames_stand2[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t floater_move_stand2= new mmove_t( FRAME_stand201, @@ -475,36 +475,36 @@ public class M_Float extends Game { static mframe_t floater_frames_activate[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t floater_move_activate= new mmove_t( @@ -526,21 +526,21 @@ public class M_Float extends Game { }; static mframe_t floater_frames_attack1[]= - new mframe_t[] { new mframe_t(ai_charge, 0, null), // Blaster attack) - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, floater_fire_blaster), + new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, 0, null), // Blaster attack) + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), // BOOM (0, -25.8, 32.5) -- LOOP Starts - new mframe_t(ai_charge, 0, floater_fire_blaster), - new mframe_t(ai_charge, 0, floater_fire_blaster), - new mframe_t(ai_charge, 0, floater_fire_blaster), - new mframe_t(ai_charge, 0, floater_fire_blaster), - new mframe_t(ai_charge, 0, floater_fire_blaster), - new mframe_t(ai_charge, 0, floater_fire_blaster), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null) + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null) // -- LOOP Ends }; static mmove_t floater_move_attack1= @@ -562,33 +562,33 @@ public class M_Float extends Game { }; static mframe_t floater_frames_attack2[]= - new mframe_t[] { new mframe_t(ai_charge, 0, null), // Claws - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, floater_wham), + new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, 0, null), // Claws + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_wham), // WHAM (0, -45, 29.6) -- LOOP Starts - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), // -- LOOP Ends - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t floater_move_attack2= new mmove_t( FRAME_attak201, @@ -638,42 +638,42 @@ public class M_Float extends Game { }; static mframe_t floater_frames_attack3[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, floater_zap), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, floater_zap), // -- LOOP Starts - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), // -- LOOP Ends - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t floater_move_attack3= new mmove_t( @@ -684,19 +684,19 @@ public class M_Float extends Game { static mframe_t floater_frames_death[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static EntThinkAdapter floater_dead= new EntThinkAdapter() { public boolean think(edict_t self) { @@ -719,13 +719,13 @@ public class M_Float extends Game { static mframe_t floater_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t floater_move_pain1= new mmove_t( @@ -736,14 +736,14 @@ public class M_Float extends Game { static mframe_t floater_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t floater_move_pain2= new mmove_t( FRAME_pain201, @@ -753,18 +753,18 @@ public class M_Float extends Game { static mframe_t floater_frames_pain3[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t floater_move_pain3= new mmove_t( FRAME_pain301, @@ -774,115 +774,115 @@ public class M_Float extends Game { static mframe_t floater_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null)}; + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null)}; static mmove_t floater_move_walk= new mmove_t(FRAME_stand101, FRAME_stand152, floater_frames_walk, null); static mframe_t floater_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 13, null)}; + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 13, null)}; static mmove_t floater_move_run= new mmove_t(FRAME_stand101, FRAME_stand152, floater_frames_run, null); @@ -1002,6 +1002,6 @@ public class M_Float extends Game { self.monsterinfo.scale= MODEL_SCALE; - flymonster_start.think(self); + GameAIAdapters.flymonster_start.think(self); } } diff --git a/src/jake2/game/M_Flyer.java b/src/jake2/game/M_Flyer.java index acdeefc..7cfc66b 100644 --- a/src/jake2/game/M_Flyer.java +++ b/src/jake2/game/M_Flyer.java @@ -19,14 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Flyer.java,v 1.1 2004-07-07 19:59:14 hzi Exp $ +// $Id: M_Flyer.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.util.*; import jake2.util.*; -public class M_Flyer extends GamePWeapon { +public class M_Flyer extends M_Player { // This file generated by ModelGen - Do NOT Modify public final static int ACTION_nothing= 0; @@ -222,152 +222,152 @@ public class M_Flyer extends GamePWeapon { static mframe_t flyer_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t flyer_move_stand= new mmove_t(FRAME_stand01, FRAME_stand45, flyer_frames_stand, null); static mframe_t flyer_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null)}; + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null)}; static mmove_t flyer_move_walk= new mmove_t(FRAME_stand01, FRAME_stand45, flyer_frames_walk, null); static mframe_t flyer_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null)}; + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null)}; static mmove_t flyer_move_run= new mmove_t(FRAME_stand01, FRAME_stand45, flyer_frames_run, null); @@ -407,24 +407,24 @@ public class M_Flyer extends GamePWeapon { }; static mframe_t flyer_frames_start[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, flyer_nextmove)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, flyer_nextmove)}; static mmove_t flyer_move_start= new mmove_t(FRAME_start01, FRAME_start06, flyer_frames_start, null); static mframe_t flyer_frames_stop[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, flyer_nextmove)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, flyer_nextmove)}; static mmove_t flyer_move_stop= new mmove_t(FRAME_stop01, FRAME_stop07, flyer_frames_stop, null); static EntThinkAdapter flyer_stop= new EntThinkAdapter() { @@ -443,97 +443,97 @@ public class M_Flyer extends GamePWeapon { static mframe_t flyer_frames_rollright[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_rollright= new mmove_t(FRAME_rollr01, FRAME_rollr09, flyer_frames_rollright, null); static mframe_t flyer_frames_rollleft[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_rollleft= new mmove_t(FRAME_rollf01, FRAME_rollf09, flyer_frames_rollleft, null); static mframe_t flyer_frames_pain3[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_pain3= new mmove_t(FRAME_pain301, FRAME_pain304, flyer_frames_pain3, flyer_run); static mframe_t flyer_frames_pain2[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_pain2= new mmove_t(FRAME_pain201, FRAME_pain204, flyer_frames_pain2, flyer_run); static mframe_t flyer_frames_pain1[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_pain1= new mmove_t(FRAME_pain101, FRAME_pain109, flyer_frames_pain1, flyer_run); static mframe_t flyer_frames_defense[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // Hold this frame - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_defense= new mmove_t(FRAME_defens01, FRAME_defens06, flyer_frames_defense, null); static mframe_t flyer_frames_bankright[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_bankright= new mmove_t(FRAME_bankr01, FRAME_bankr07, flyer_frames_bankright, null); static mframe_t flyer_frames_bankleft[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t flyer_move_bankleft= new mmove_t(FRAME_bankl01, FRAME_bankl07, flyer_frames_bankleft, null); @@ -576,24 +576,24 @@ public class M_Flyer extends GamePWeapon { static mframe_t flyer_frames_attack2[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -10, flyer_fireleft), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireleft), // left gun - new mframe_t(ai_charge, -10, flyer_fireright), // right gun - new mframe_t(ai_charge, -10, flyer_fireleft), // left gun - new mframe_t(ai_charge, -10, flyer_fireright), // right gun - new mframe_t(ai_charge, -10, flyer_fireleft), // left gun - new mframe_t(ai_charge, -10, flyer_fireright), // right gun - new mframe_t(ai_charge, -10, flyer_fireleft), // left gun - new mframe_t(ai_charge, -10, flyer_fireright), // right gun - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireleft), // left gun + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireleft), // left gun + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireleft), // left gun + new mframe_t(GameAIAdapters.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t flyer_move_attack2= new mmove_t(FRAME_attak201, FRAME_attak217, flyer_frames_attack2, flyer_run); @@ -630,36 +630,36 @@ public class M_Flyer extends GamePWeapon { static mframe_t flyer_frames_start_melee[]= new mframe_t[] { - new mframe_t(ai_charge, 0, flyer_pop_blades), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, flyer_pop_blades), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t flyer_move_start_melee= new mmove_t(FRAME_attak101, FRAME_attak106, flyer_frames_start_melee, flyer_loop_melee); static mframe_t flyer_frames_end_melee[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t flyer_move_end_melee= new mmove_t(FRAME_attak119, FRAME_attak121, flyer_frames_end_melee, flyer_run); static mframe_t flyer_frames_loop_melee[]= - new mframe_t[] { new mframe_t(ai_charge, 0, null), // Loop Start - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, flyer_slash_left), // Left Wing Strike - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, flyer_slash_right), // Right Wing Strike - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null) // Loop Ends + new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, 0, null), // Loop Start + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, flyer_slash_left), // Left Wing Strike + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, flyer_slash_right), // Right Wing Strike + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null) // Loop Ends }; @@ -802,7 +802,7 @@ public class M_Flyer extends GamePWeapon { self.monsterinfo.currentmove= flyer_move_stand; self.monsterinfo.scale= MODEL_SCALE; - flymonster_start.think(self); + GameAIAdapters.flymonster_start.think(self); } } diff --git a/src/jake2/game/M_Gladiator.java b/src/jake2/game/M_Gladiator.java index 9acfd73..aec33f7 100644 --- a/src/jake2/game/M_Gladiator.java +++ b/src/jake2/game/M_Gladiator.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Gladiator.java,v 1.1 2004-07-07 19:59:14 hzi Exp $ +// $Id: M_Gladiator.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -167,13 +167,13 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_stand[]= new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t gladiator_move_stand= new mmove_t(FRAME_stand1, FRAME_stand7, gladiator_frames_stand, null); @@ -187,22 +187,22 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_walk[]= new mframe_t[] { - new mframe_t(ai_walk, 15, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 12, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 8, null)}; + new mframe_t(GameAIAdapters.ai_walk, 15, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 12, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null)}; static mmove_t gladiator_move_walk= new mmove_t(FRAME_walk1, FRAME_walk16, gladiator_frames_walk, null); @@ -217,12 +217,12 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_run[]= new mframe_t[] { - new mframe_t(ai_run, 23, null), - new mframe_t(ai_run, 14, null), - new mframe_t(ai_run, 14, null), - new mframe_t(ai_run, 21, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 13, null)}; + new mframe_t(GameAIAdapters.ai_run, 23, null), + new mframe_t(GameAIAdapters.ai_run, 14, null), + new mframe_t(GameAIAdapters.ai_run, 14, null), + new mframe_t(GameAIAdapters.ai_run, 21, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 13, null)}; static mmove_t gladiator_move_run= new mmove_t(FRAME_run1, FRAME_run6, gladiator_frames_run, null); @@ -254,23 +254,23 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_attack_melee[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, gladiator_cleaver_swing), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GaldiatorMelee), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, gladiator_cleaver_swing), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GaldiatorMelee), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, gladiator_cleaver_swing), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GaldiatorMelee), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, gladiator_cleaver_swing), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GaldiatorMelee), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t gladiator_move_attack_melee= new mmove_t( @@ -321,15 +321,15 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_attack_gun[]= new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GladiatorGun), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GladiatorGun), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t gladiator_move_attack_gun= new mmove_t( FRAME_attack1, @@ -362,12 +362,12 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_pain[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t gladiator_move_pain= new mmove_t( FRAME_pain1, @@ -377,13 +377,13 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_pain_air[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t gladiator_move_pain_air= new mmove_t( FRAME_painup1, @@ -437,28 +437,28 @@ public class M_Gladiator extends Game { static mframe_t gladiator_frames_death[]= new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t gladiator_move_death= new mmove_t( FRAME_death1, @@ -564,7 +564,7 @@ public class M_Gladiator extends Game { self.monsterinfo.currentmove= gladiator_move_stand; self.monsterinfo.scale= MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Gunner.java b/src/jake2/game/M_Gunner.java index cdff1a0..1625353 100644 --- a/src/jake2/game/M_Gunner.java +++ b/src/jake2/game/M_Gunner.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Gunner.java,v 1.1 2004-07-07 19:59:14 hzi Exp $ +// $Id: M_Gunner.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -277,55 +277,55 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_fidget[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, gunner_idlesound), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, gunner_idlesound), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static EntThinkAdapter gunner_stand = new EntThinkAdapter() { public boolean think(edict_t self) { @@ -347,53 +347,53 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, gunner_fidget), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, gunner_fidget), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, gunner_fidget)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, gunner_fidget), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, gunner_fidget), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, gunner_fidget)}; static mmove_t gunner_move_stand = new mmove_t(FRAME_stand01, FRAME_stand30, gunner_frames_stand, null); static mframe_t gunner_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 4, null)}; + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null)}; static mmove_t gunner_move_walk = new mmove_t(FRAME_walk07, FRAME_walk19, gunner_frames_walk, null); static EntThinkAdapter gunner_walk = new EntThinkAdapter() { @@ -405,14 +405,14 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 26, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 9, null), - new mframe_t(ai_run, 15, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 13, null), - new mframe_t(ai_run, 6, null)}; + new mframe_t(GameAIAdapters.ai_run, 26, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 9, null), + new mframe_t(GameAIAdapters.ai_run, 15, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 13, null), + new mframe_t(GameAIAdapters.ai_run, 6, null)}; static mmove_t gunner_move_run = new mmove_t(FRAME_run01, FRAME_run08, gunner_frames_run, null); @@ -428,12 +428,12 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_runandshoot[] = new mframe_t[] { - new mframe_t(ai_run, 32, null), - new mframe_t(ai_run, 15, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 18, null), - new mframe_t(ai_run, 8, null), - new mframe_t(ai_run, 20, null)}; + new mframe_t(GameAIAdapters.ai_run, 32, null), + new mframe_t(GameAIAdapters.ai_run, 15, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 18, null), + new mframe_t(GameAIAdapters.ai_run, 8, null), + new mframe_t(GameAIAdapters.ai_run, 20, null)}; static mmove_t gunner_move_runandshoot = new mmove_t(FRAME_runs01, FRAME_runs06, gunner_frames_runandshoot, null); @@ -446,45 +446,45 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_pain3[] = new mframe_t[] { - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null)}; + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null)}; static mmove_t gunner_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain305, gunner_frames_pain3, gunner_run); static mframe_t gunner_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 11, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -7, null)}; + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 11, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -7, null)}; static mmove_t gunner_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain208, gunner_frames_pain2, gunner_run); static mframe_t gunner_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t gunner_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain118, gunner_frames_pain1, gunner_run); static EntPainAdapter gunner_pain = new EntPainAdapter() { @@ -529,17 +529,17 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_death[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 8, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 8, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t gunner_move_death = new mmove_t(FRAME_death01, FRAME_death11, gunner_frames_death, gunner_dead); static EntDieAdapter gunner_die = new EntDieAdapter() { @@ -608,14 +608,14 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_duck[] = new mframe_t[] { - new mframe_t(ai_move, 1, gunner_duck_down), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, gunner_duck_hold), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 0, gunner_duck_up), - new mframe_t(ai_move, -1, null)}; + new mframe_t(GameAIAdapters.ai_move, 1, gunner_duck_down), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, gunner_duck_hold), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 0, gunner_duck_up), + new mframe_t(GameAIAdapters.ai_move, -1, null)}; static mmove_t gunner_move_duck = new mmove_t(FRAME_duck01, FRAME_duck08, gunner_frames_duck, gunner_run); static EntDodgeAdapter gunner_dodge = new EntDodgeAdapter() { @@ -713,26 +713,26 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_attack_chain[] = new mframe_t[] { - new mframe_t(ai_charge, 0, gunner_opengun), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, gunner_opengun), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t gunner_move_attack_chain = new mmove_t(FRAME_attak209, FRAME_attak215, gunner_frames_attack_chain, gunner_fire_chain); static mframe_t gunner_frames_fire_chain[] = new mframe_t[] { - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire), - new mframe_t(ai_charge, 0, GunnerFire)}; + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerFire)}; static EntThinkAdapter gunner_refire_chain = new EntThinkAdapter() { public boolean think(edict_t self) { @@ -751,38 +751,38 @@ public class M_Gunner extends Game { static mframe_t gunner_frames_endfire_chain[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t gunner_move_endfire_chain = new mmove_t(FRAME_attak224, FRAME_attak230, gunner_frames_endfire_chain, gunner_run); static mframe_t gunner_frames_attack_grenade[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GunnerGrenade), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GunnerGrenade), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GunnerGrenade), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, GunnerGrenade), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerGrenade), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerGrenade), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerGrenade), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, GunnerGrenade), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t gunner_move_attack_grenade = new mmove_t(FRAME_attak101, FRAME_attak121, gunner_frames_attack_grenade, gunner_run); /*QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight @@ -831,7 +831,7 @@ public class M_Gunner extends Game { self.monsterinfo.currentmove = gunner_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Hover.java b/src/jake2/game/M_Hover.java index 354437a..d11fa00 100644 --- a/src/jake2/game/M_Hover.java +++ b/src/jake2/game/M_Hover.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Hover.java,v 1.1 2004-07-07 19:59:15 hzi Exp $ +// $Id: M_Hover.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -324,7 +324,7 @@ public class M_Hover extends Game { }; static EntPainAdapter hover_pain = new EntPainAdapter() { - public void hover_pain(edict_t self, edict_t other, float kick, int damage) { + public void pain(edict_t self, edict_t other, float kick, int damage) { if (self.health < (self.max_health / 2)) self.s.skinnum = 1; @@ -423,334 +423,334 @@ public class M_Hover extends Game { static mframe_t hover_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t hover_move_stand = new mmove_t(FRAME_stand01, FRAME_stand30, hover_frames_stand, null); static mframe_t hover_frames_stop1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_stop1 = new mmove_t(FRAME_stop101, FRAME_stop109, hover_frames_stop1, null); static mframe_t hover_frames_stop2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_stop2 = new mmove_t(FRAME_stop201, FRAME_stop208, hover_frames_stop2, null); static mframe_t hover_frames_takeoff[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -9, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -9, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_takeoff = new mmove_t(FRAME_takeof01, FRAME_takeof30, hover_frames_takeoff, null); static mframe_t hover_frames_pain3[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain309, hover_frames_pain3, hover_run); static mframe_t hover_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain212, hover_frames_pain2, hover_run); static mframe_t hover_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, -8, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 7, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 4, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, -8, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 7, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 4, null)}; static mmove_t hover_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain128, hover_frames_pain1, hover_run); - static mframe_t hover_frames_land[] = new mframe_t[] { new mframe_t(ai_move, 0, null)}; + static mframe_t hover_frames_land[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_land = new mmove_t(FRAME_land01, FRAME_land01, hover_frames_land, null); static mframe_t hover_frames_forward[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_forward = new mmove_t(FRAME_forwrd01, FRAME_forwrd35, hover_frames_forward, null); static mframe_t hover_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null)}; + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null)}; static mmove_t hover_move_walk = new mmove_t(FRAME_forwrd01, FRAME_forwrd35, hover_frames_walk, null); static mframe_t hover_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 10, null)}; + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 10, null)}; static mmove_t hover_move_run = new mmove_t(FRAME_forwrd01, FRAME_forwrd35, hover_frames_run, null); static mframe_t hover_frames_death1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 7, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 7, null)}; static mmove_t hover_move_death1 = new mmove_t(FRAME_death101, FRAME_death111, hover_frames_death1, hover_dead); static mframe_t hover_frames_backward[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t hover_move_backward = new mmove_t(FRAME_backwd01, FRAME_backwd24, hover_frames_backward, null); static mframe_t hover_frames_start_attack[] = - new mframe_t[] { new mframe_t(ai_charge, 1, null), new mframe_t(ai_charge, 1, null), new mframe_t(ai_charge, 1, null)}; + new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, 1, null), new mframe_t(GameAIAdapters.ai_charge, 1, null), new mframe_t(GameAIAdapters.ai_charge, 1, null)}; static mmove_t hover_move_start_attack = new mmove_t(FRAME_attak101, FRAME_attak103, hover_frames_start_attack, hover_attack); static mframe_t hover_frames_attack1[] = new mframe_t[] { - new mframe_t(ai_charge, -10, hover_fire_blaster), - new mframe_t(ai_charge, -10, hover_fire_blaster), - new mframe_t(ai_charge, 0, hover_reattack), + new mframe_t(GameAIAdapters.ai_charge, -10, hover_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, -10, hover_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, hover_reattack), }; static mmove_t hover_move_attack1 = new mmove_t(FRAME_attak104, FRAME_attak106, hover_frames_attack1, null); - static mframe_t hover_frames_end_attack[] = new mframe_t[] { new mframe_t(ai_charge, 1, null), new mframe_t(ai_charge, 1, null)}; + static mframe_t hover_frames_end_attack[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, 1, null), new mframe_t(GameAIAdapters.ai_charge, 1, null)}; static mmove_t hover_move_end_attack = new mmove_t(FRAME_attak107, FRAME_attak108, hover_frames_end_attack, hover_run); /*QUAKED monster_hover (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight @@ -799,7 +799,7 @@ public class M_Hover extends Game { self.monsterinfo.currentmove = hover_move_stand; self.monsterinfo.scale = MODEL_SCALE; - flymonster_start.think(self); + GameAIAdapters.flymonster_start.think(self); } } diff --git a/src/jake2/game/M_Infantry.java b/src/jake2/game/M_Infantry.java index 385af76..813b543 100644 --- a/src/jake2/game/M_Infantry.java +++ b/src/jake2/game/M_Infantry.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Infantry.java,v 1.1 2004-07-07 19:59:15 hzi Exp $ +// $Id: M_Infantry.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; @@ -255,28 +255,28 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t infantry_move_stand = new mmove_t(FRAME_stand50, FRAME_stand71, infantry_frames_stand, null); static EntThinkAdapter infantry_stand = new EntThinkAdapter() { @@ -288,55 +288,55 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_fidget[] = new mframe_t[] { - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 3, null), - new mframe_t(ai_stand, 6, null), - new mframe_t(ai_stand, 3, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -2, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, -1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -1, null), - new mframe_t(ai_stand, -1, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, -3, null), - new mframe_t(ai_stand, -2, null), - new mframe_t(ai_stand, -3, null), - new mframe_t(ai_stand, -3, null), - new mframe_t(ai_stand, -2, null)}; + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 3, null), + new mframe_t(GameAIAdapters.ai_stand, 6, null), + new mframe_t(GameAIAdapters.ai_stand, 3, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -2, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, -1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -1, null), + new mframe_t(GameAIAdapters.ai_stand, -1, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, -3, null), + new mframe_t(GameAIAdapters.ai_stand, -2, null), + new mframe_t(GameAIAdapters.ai_stand, -3, null), + new mframe_t(GameAIAdapters.ai_stand, -3, null), + new mframe_t(GameAIAdapters.ai_stand, -2, null)}; static mmove_t infantry_move_fidget = new mmove_t(FRAME_stand01, FRAME_stand49, infantry_frames_fidget, infantry_stand); static EntThinkAdapter infantry_fidget = new EntThinkAdapter() { @@ -349,18 +349,18 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 5, null)}; + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null)}; static mmove_t infantry_move_walk = new mmove_t(FRAME_walk03, FRAME_walk14, infantry_frames_walk, null); static EntThinkAdapter infantry_walk = new EntThinkAdapter() { @@ -372,14 +372,14 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 20, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 7, null), - new mframe_t(ai_run, 30, null), - new mframe_t(ai_run, 35, null), - new mframe_t(ai_run, 2, null), - new mframe_t(ai_run, 6, null)}; + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 20, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 7, null), + new mframe_t(GameAIAdapters.ai_run, 30, null), + new mframe_t(GameAIAdapters.ai_run, 35, null), + new mframe_t(GameAIAdapters.ai_run, 2, null), + new mframe_t(GameAIAdapters.ai_run, 6, null)}; static mmove_t infantry_move_run = new mmove_t(FRAME_run01, FRAME_run08, infantry_frames_run, null); static EntThinkAdapter infantry_run = new EntThinkAdapter() { @@ -394,30 +394,30 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 2, null)}; + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 2, null)}; static mmove_t infantry_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain110, infantry_frames_pain1, infantry_run); static mframe_t infantry_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 2, null)}; + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 2, null)}; static mmove_t infantry_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain210, infantry_frames_pain2, infantry_run); static EntPainAdapter infantry_pain = new EntPainAdapter() { @@ -518,69 +518,69 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_death1[] = new mframe_t[] { - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 9, null), - new mframe_t(ai_move, 9, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -3, null)}; + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 9, null), + new mframe_t(GameAIAdapters.ai_move, 9, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -3, null)}; static mmove_t infantry_move_death1 = new mmove_t(FRAME_death101, FRAME_death120, infantry_frames_death1, infantry_dead); // Off with his head static mframe_t infantry_frames_death2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, InfantryMachineGun), - new mframe_t(ai_move, -2, InfantryMachineGun), - new mframe_t(ai_move, -3, InfantryMachineGun), - new mframe_t(ai_move, -1, InfantryMachineGun), - new mframe_t(ai_move, -2, InfantryMachineGun), - new mframe_t(ai_move, 0, InfantryMachineGun), - new mframe_t(ai_move, 2, InfantryMachineGun), - new mframe_t(ai_move, 2, InfantryMachineGun), - new mframe_t(ai_move, 3, InfantryMachineGun), - new mframe_t(ai_move, -10, InfantryMachineGun), - new mframe_t(ai_move, -7, InfantryMachineGun), - new mframe_t(ai_move, -8, InfantryMachineGun), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -2, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -3, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -1, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -2, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, 0, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, 2, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, 2, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, 3, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -10, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -7, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -8, InfantryMachineGun), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t infantry_move_death2 = new mmove_t(FRAME_death201, FRAME_death225, infantry_frames_death2, infantry_dead); static mframe_t infantry_frames_death3[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -11, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -11, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -11, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -11, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t infantry_move_death3 = new mmove_t(FRAME_death301, FRAME_death309, infantry_frames_death3, infantry_dead); static EntDieAdapter infantry_die = new EntDieAdapter() { @@ -656,11 +656,11 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_duck[] = new mframe_t[] { - new mframe_t(ai_move, -2, infantry_duck_down), - new mframe_t(ai_move, -5, infantry_duck_hold), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 4, infantry_duck_up), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, -2, infantry_duck_down), + new mframe_t(GameAIAdapters.ai_move, -5, infantry_duck_hold), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 4, infantry_duck_up), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t infantry_move_duck = new mmove_t(FRAME_duck01, FRAME_duck05, infantry_frames_duck, infantry_run); static EntDodgeAdapter infantry_dodge = new EntDodgeAdapter() { @@ -700,21 +700,21 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_attack1[] = new mframe_t[] { - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, 0, infantry_cock_gun), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 1, infantry_fire), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -3, null)}; + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, 0, infantry_cock_gun), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 1, infantry_fire), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null)}; static mmove_t infantry_move_attack1 = new mmove_t(FRAME_attak101, FRAME_attak115, infantry_frames_attack1, infantry_run); static EntThinkAdapter infantry_swing = new EntThinkAdapter() { @@ -738,14 +738,14 @@ public class M_Infantry extends Game { static mframe_t infantry_frames_attack2[] = new mframe_t[] { - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, 0, infantry_swing), - new mframe_t(ai_charge, 8, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 8, infantry_smack), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, 0, infantry_swing), + new mframe_t(GameAIAdapters.ai_charge, 8, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 8, infantry_smack), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), }; static mmove_t infantry_move_attack2 = new mmove_t(FRAME_attak201, FRAME_attak208, infantry_frames_attack2, infantry_run); @@ -808,7 +808,7 @@ public class M_Infantry extends Game { self.monsterinfo.currentmove = infantry_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Insane.java b/src/jake2/game/M_Insane.java index a11e990..3c8fe9b 100644 --- a/src/jake2/game/M_Insane.java +++ b/src/jake2/game/M_Insane.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Insane.java,v 1.1 2004-07-07 19:59:16 hzi Exp $ +// $Id: M_Insane.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -535,238 +535,238 @@ public class M_Insane extends Game { static mframe_t insane_frames_stand_normal[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, insane_checkdown)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, insane_checkdown)}; static mmove_t insane_move_stand_normal = new mmove_t(FRAME_stand60, FRAME_stand65, insane_frames_stand_normal, insane_stand); static mframe_t insane_frames_stand_insane[] = new mframe_t[] { - new mframe_t(ai_stand, 0, insane_shake), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, insane_checkdown)}; + new mframe_t(GameAIAdapters.ai_stand, 0, insane_shake), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, insane_checkdown)}; static mmove_t insane_move_stand_insane = new mmove_t(FRAME_stand65, FRAME_stand94, insane_frames_stand_insane, insane_stand); static mframe_t insane_frames_uptodown[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, insane_moan), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2.7f, null), - new mframe_t(ai_move, 4.1f, null), - new mframe_t(ai_move, 6f, null), - new mframe_t(ai_move, 7.6f, null), - new mframe_t(ai_move, 3.6f, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, insane_fist), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, insane_fist), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, insane_moan), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2.7f, null), + new mframe_t(GameAIAdapters.ai_move, 4.1f, null), + new mframe_t(GameAIAdapters.ai_move, 6f, null), + new mframe_t(GameAIAdapters.ai_move, 7.6f, null), + new mframe_t(GameAIAdapters.ai_move, 3.6f, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, insane_fist), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, insane_fist), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_uptodown = new mmove_t(FRAME_stand1, FRAME_stand40, insane_frames_uptodown, insane_onground); - static mframe_t insane_frames_downtoup[] = new mframe_t[] { new mframe_t(ai_move, -0.7f, null), // 41 - new mframe_t(ai_move, -1.2f, null), // 42 - new mframe_t(ai_move, -1.5f, null), // 43 - new mframe_t(ai_move, -4.5f, null), // 44 - new mframe_t(ai_move, -3.5f, null), // 45 - new mframe_t(ai_move, -0.2f, null), // 46 - new mframe_t(ai_move, 0, null), // 47 - new mframe_t(ai_move, -1.3f, null), // 48 - new mframe_t(ai_move, -3, null), // 49 - new mframe_t(ai_move, -2, null), // 50 - new mframe_t(ai_move, 0, null), // 51 - new mframe_t(ai_move, 0, null), // 52 - new mframe_t(ai_move, 0, null), // 53 - new mframe_t(ai_move, -3.3f, null), // 54 - new mframe_t(ai_move, -1.6f, null), // 55 - new mframe_t(ai_move, -0.3f, null), // 56 - new mframe_t(ai_move, 0, null), // 57 - new mframe_t(ai_move, 0, null), // 58 - new mframe_t(ai_move, 0, null) // 59 + static mframe_t insane_frames_downtoup[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_move, -0.7f, null), // 41 + new mframe_t(GameAIAdapters.ai_move, -1.2f, null), // 42 + new mframe_t(GameAIAdapters.ai_move, -1.5f, null), // 43 + new mframe_t(GameAIAdapters.ai_move, -4.5f, null), // 44 + new mframe_t(GameAIAdapters.ai_move, -3.5f, null), // 45 + new mframe_t(GameAIAdapters.ai_move, -0.2f, null), // 46 + new mframe_t(GameAIAdapters.ai_move, 0, null), // 47 + new mframe_t(GameAIAdapters.ai_move, -1.3f, null), // 48 + new mframe_t(GameAIAdapters.ai_move, -3, null), // 49 + new mframe_t(GameAIAdapters.ai_move, -2, null), // 50 + new mframe_t(GameAIAdapters.ai_move, 0, null), // 51 + new mframe_t(GameAIAdapters.ai_move, 0, null), // 52 + new mframe_t(GameAIAdapters.ai_move, 0, null), // 53 + new mframe_t(GameAIAdapters.ai_move, -3.3f, null), // 54 + new mframe_t(GameAIAdapters.ai_move, -1.6f, null), // 55 + new mframe_t(GameAIAdapters.ai_move, -0.3f, null), // 56 + new mframe_t(GameAIAdapters.ai_move, 0, null), // 57 + new mframe_t(GameAIAdapters.ai_move, 0, null), // 58 + new mframe_t(GameAIAdapters.ai_move, 0, null) // 59 }; static mmove_t insane_move_downtoup = new mmove_t(FRAME_stand41, FRAME_stand59, insane_frames_downtoup, insane_stand); static mframe_t insane_frames_jumpdown[] = new mframe_t[] { - new mframe_t(ai_move, 0.2f, null), - new mframe_t(ai_move, 11.5f, null), - new mframe_t(ai_move, 5.1f, null), - new mframe_t(ai_move, 7.1f, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0.2f, null), + new mframe_t(GameAIAdapters.ai_move, 11.5f, null), + new mframe_t(GameAIAdapters.ai_move, 5.1f, null), + new mframe_t(GameAIAdapters.ai_move, 7.1f, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_jumpdown = new mmove_t(FRAME_stand96, FRAME_stand100, insane_frames_jumpdown, insane_onground); - static mframe_t insane_frames_down[] = new mframe_t[] { new mframe_t(ai_move, 0, null), // 100) - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + static mframe_t insane_frames_down[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_move, 0, null), // 100) + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 110) - new mframe_t(ai_move, -1.7f, null), - new mframe_t(ai_move, -1.6f, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, insane_fist), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1.7f, null), + new mframe_t(GameAIAdapters.ai_move, -1.6f, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, insane_fist), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 120) - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 130 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, insane_moan), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, insane_moan), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 140 - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), // 150 - new mframe_t(ai_move, 0.5f, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -0.2f, insane_scream), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0.2f, null), - new mframe_t(ai_move, 0.4f, null), - new mframe_t(ai_move, 0.6f, null), - new mframe_t(ai_move, 0.8f, null), - new mframe_t(ai_move, 0.7f, null), - new mframe_t(ai_move, 0, insane_checkup) // 160 + new mframe_t(GameAIAdapters.ai_move, 0.5f, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -0.2f, insane_scream), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0.2f, null), + new mframe_t(GameAIAdapters.ai_move, 0.4f, null), + new mframe_t(GameAIAdapters.ai_move, 0.6f, null), + new mframe_t(GameAIAdapters.ai_move, 0.8f, null), + new mframe_t(GameAIAdapters.ai_move, 0.7f, null), + new mframe_t(GameAIAdapters.ai_move, 0, insane_checkup) // 160 }; static mmove_t insane_move_down = new mmove_t(FRAME_stand100, FRAME_stand160, insane_frames_down, insane_onground); static mframe_t insane_frames_walk_normal[] = new mframe_t[] { - new mframe_t(ai_walk, 0, insane_scream), - new mframe_t(ai_walk, 2.5f, null), - new mframe_t(ai_walk, 3.5f, null), - new mframe_t(ai_walk, 1.7f, null), - new mframe_t(ai_walk, 2.3f, null), - new mframe_t(ai_walk, 2.4f, null), - new mframe_t(ai_walk, 2.2f, null), - new mframe_t(ai_walk, 4.2f, null), - new mframe_t(ai_walk, 5.6f, null), - new mframe_t(ai_walk, 3.3f, null), - new mframe_t(ai_walk, 2.4f, null), - new mframe_t(ai_walk, 0.9f, null), - new mframe_t(ai_walk, 0, null)}; + new mframe_t(GameAIAdapters.ai_walk, 0, insane_scream), + new mframe_t(GameAIAdapters.ai_walk, 2.5f, null), + new mframe_t(GameAIAdapters.ai_walk, 3.5f, null), + new mframe_t(GameAIAdapters.ai_walk, 1.7f, null), + new mframe_t(GameAIAdapters.ai_walk, 2.3f, null), + new mframe_t(GameAIAdapters.ai_walk, 2.4f, null), + new mframe_t(GameAIAdapters.ai_walk, 2.2f, null), + new mframe_t(GameAIAdapters.ai_walk, 4.2f, null), + new mframe_t(GameAIAdapters.ai_walk, 5.6f, null), + new mframe_t(GameAIAdapters.ai_walk, 3.3f, null), + new mframe_t(GameAIAdapters.ai_walk, 2.4f, null), + new mframe_t(GameAIAdapters.ai_walk, 0.9f, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null)}; static mmove_t insane_move_walk_normal = new mmove_t(FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_walk); static mmove_t insane_move_run_normal = new mmove_t(FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_run); - static mframe_t insane_frames_walk_insane[] = new mframe_t[] { new mframe_t(ai_walk, 0, insane_scream), // walk 1 - new mframe_t(ai_walk, 3.4f, null), // walk 2 - new mframe_t(ai_walk, 3.6f, null), // 3 - new mframe_t(ai_walk, 2.9f, null), // 4 - new mframe_t(ai_walk, 2.2f, null), // 5 - new mframe_t(ai_walk, 2.6f, null), // 6 - new mframe_t(ai_walk, 0, null), // 7 - new mframe_t(ai_walk, 0.7f, null), // 8 - new mframe_t(ai_walk, 4.8f, null), // 9 - new mframe_t(ai_walk, 5.3f, null), // 10 - new mframe_t(ai_walk, 1.1f, null), // 11 - new mframe_t(ai_walk, 2, null), // 12 - new mframe_t(ai_walk, 0.5f, null), // 13 - new mframe_t(ai_walk, 0, null), // 14 - new mframe_t(ai_walk, 0, null), // 15 - new mframe_t(ai_walk, 4.9f, null), // 16 - new mframe_t(ai_walk, 6.7f, null), // 17 - new mframe_t(ai_walk, 3.8f, null), // 18 - new mframe_t(ai_walk, 2, null), // 19 - new mframe_t(ai_walk, 0.2f, null), // 20 - new mframe_t(ai_walk, 0, null), // 21 - new mframe_t(ai_walk, 3.4f, null), // 22 - new mframe_t(ai_walk, 6.4f, null), // 23 - new mframe_t(ai_walk, 5, null), // 24 - new mframe_t(ai_walk, 1.8f, null), // 25 - new mframe_t(ai_walk, 0, null) // 26 + static mframe_t insane_frames_walk_insane[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_walk, 0, insane_scream), // walk 1 + new mframe_t(GameAIAdapters.ai_walk, 3.4f, null), // walk 2 + new mframe_t(GameAIAdapters.ai_walk, 3.6f, null), // 3 + new mframe_t(GameAIAdapters.ai_walk, 2.9f, null), // 4 + new mframe_t(GameAIAdapters.ai_walk, 2.2f, null), // 5 + new mframe_t(GameAIAdapters.ai_walk, 2.6f, null), // 6 + new mframe_t(GameAIAdapters.ai_walk, 0, null), // 7 + new mframe_t(GameAIAdapters.ai_walk, 0.7f, null), // 8 + new mframe_t(GameAIAdapters.ai_walk, 4.8f, null), // 9 + new mframe_t(GameAIAdapters.ai_walk, 5.3f, null), // 10 + new mframe_t(GameAIAdapters.ai_walk, 1.1f, null), // 11 + new mframe_t(GameAIAdapters.ai_walk, 2, null), // 12 + new mframe_t(GameAIAdapters.ai_walk, 0.5f, null), // 13 + new mframe_t(GameAIAdapters.ai_walk, 0, null), // 14 + new mframe_t(GameAIAdapters.ai_walk, 0, null), // 15 + new mframe_t(GameAIAdapters.ai_walk, 4.9f, null), // 16 + new mframe_t(GameAIAdapters.ai_walk, 6.7f, null), // 17 + new mframe_t(GameAIAdapters.ai_walk, 3.8f, null), // 18 + new mframe_t(GameAIAdapters.ai_walk, 2, null), // 19 + new mframe_t(GameAIAdapters.ai_walk, 0.2f, null), // 20 + new mframe_t(GameAIAdapters.ai_walk, 0, null), // 21 + new mframe_t(GameAIAdapters.ai_walk, 3.4f, null), // 22 + new mframe_t(GameAIAdapters.ai_walk, 6.4f, null), // 23 + new mframe_t(GameAIAdapters.ai_walk, 5, null), // 24 + new mframe_t(GameAIAdapters.ai_walk, 1.8f, null), // 25 + new mframe_t(GameAIAdapters.ai_walk, 0, null) // 26 }; static mmove_t insane_move_walk_insane = new mmove_t(FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_walk); @@ -774,115 +774,115 @@ public class M_Insane extends Game { static mframe_t insane_frames_stand_pain[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_stand_pain = new mmove_t(FRAME_st_pain2, FRAME_st_pain12, insane_frames_stand_pain, insane_run); static mframe_t insane_frames_stand_death[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_stand_death = new mmove_t(FRAME_st_death2, FRAME_st_death18, insane_frames_stand_death, insane_dead); static mframe_t insane_frames_crawl[] = new mframe_t[] { - new mframe_t(ai_walk, 0, insane_scream), - new mframe_t(ai_walk, 1.5f, null), - new mframe_t(ai_walk, 2.1f, null), - new mframe_t(ai_walk, 3.6f, null), - new mframe_t(ai_walk, 2f, null), - new mframe_t(ai_walk, 0.9f, null), - new mframe_t(ai_walk, 3f, null), - new mframe_t(ai_walk, 3.4f, null), - new mframe_t(ai_walk, 2.4f, null)}; + new mframe_t(GameAIAdapters.ai_walk, 0, insane_scream), + new mframe_t(GameAIAdapters.ai_walk, 1.5f, null), + new mframe_t(GameAIAdapters.ai_walk, 2.1f, null), + new mframe_t(GameAIAdapters.ai_walk, 3.6f, null), + new mframe_t(GameAIAdapters.ai_walk, 2f, null), + new mframe_t(GameAIAdapters.ai_walk, 0.9f, null), + new mframe_t(GameAIAdapters.ai_walk, 3f, null), + new mframe_t(GameAIAdapters.ai_walk, 3.4f, null), + new mframe_t(GameAIAdapters.ai_walk, 2.4f, null)}; static mmove_t insane_move_crawl = new mmove_t(FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, null); static mmove_t insane_move_runcrawl = new mmove_t(FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, null); static mframe_t insane_frames_crawl_pain[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_crawl_pain = new mmove_t(FRAME_cr_pain2, FRAME_cr_pain10, insane_frames_crawl_pain, insane_run); static mframe_t insane_frames_crawl_death[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_crawl_death = new mmove_t(FRAME_cr_death10, FRAME_cr_death16, insane_frames_crawl_death, insane_dead); static mframe_t insane_frames_cross[] = new mframe_t[] { - new mframe_t(ai_move, 0, insane_moan), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, insane_moan), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_cross = new mmove_t(FRAME_cross1, FRAME_cross15, insane_frames_cross, insane_cross); static mframe_t insane_frames_struggle_cross[] = new mframe_t[] { - new mframe_t(ai_move, 0, insane_scream), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, insane_scream), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t insane_move_struggle_cross = new mmove_t(FRAME_cross16, FRAME_cross30, insane_frames_struggle_cross, insane_cross); /*QUAKED misc_insane (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn CRAWL CRUCIFIED STAND_GROUND ALWAYS_STAND @@ -949,9 +949,9 @@ public class M_Insane extends Game { Math3D.VectorSet(self.mins, -16, 0, 0); Math3D.VectorSet(self.maxs, 16, 8, 32); self.flags |= FL_NO_KNOCKBACK; - flymonster_start.think(self); + GameAIAdapters.flymonster_start.think(self); } else { - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); self.s.skinnum = Lib.rand() % 3; } } diff --git a/src/jake2/game/M_Medic.java b/src/jake2/game/M_Medic.java index 322cc4d..6d5d01b 100644 --- a/src/jake2/game/M_Medic.java +++ b/src/jake2/game/M_Medic.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Medic.java,v 1.1 2004-07-07 19:59:17 hzi Exp $ +// $Id: M_Medic.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -359,96 +359,96 @@ public class M_Medic extends Game { static mframe_t medic_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, medic_idle), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, medic_idle), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), }; static mmove_t medic_move_stand = new mmove_t(FRAME_wait1, FRAME_wait90, medic_frames_stand, null); @@ -461,18 +461,18 @@ public class M_Medic extends Game { static mframe_t medic_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 6.2f, null), - new mframe_t(ai_walk, 18.1f, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 11, null), - new mframe_t(ai_walk, 11.6f, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 9.9f, null), - new mframe_t(ai_walk, 14, null), - new mframe_t(ai_walk, 9.3f, null)}; + new mframe_t(GameAIAdapters.ai_walk, 6.2f, null), + new mframe_t(GameAIAdapters.ai_walk, 18.1f, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 11, null), + new mframe_t(GameAIAdapters.ai_walk, 11.6f, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 9.9f, null), + new mframe_t(GameAIAdapters.ai_walk, 14, null), + new mframe_t(GameAIAdapters.ai_walk, 9.3f, null)}; static mmove_t medic_move_walk = new mmove_t(FRAME_walk1, FRAME_walk12, medic_frames_walk, null); static EntThinkAdapter medic_walk = new EntThinkAdapter() { @@ -484,12 +484,12 @@ public class M_Medic extends Game { static mframe_t medic_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 18, null), - new mframe_t(ai_run, 22.5f, null), - new mframe_t(ai_run, 25.4f, null), - new mframe_t(ai_run, 23.4f, null), - new mframe_t(ai_run, 24, null), - new mframe_t(ai_run, 35.6f, null)}; + new mframe_t(GameAIAdapters.ai_run, 18, null), + new mframe_t(GameAIAdapters.ai_run, 22.5f, null), + new mframe_t(GameAIAdapters.ai_run, 25.4f, null), + new mframe_t(GameAIAdapters.ai_run, 23.4f, null), + new mframe_t(GameAIAdapters.ai_run, 24, null), + new mframe_t(GameAIAdapters.ai_run, 35.6f, null)}; static mmove_t medic_move_run = new mmove_t(FRAME_run1, FRAME_run6, medic_frames_run, null); static EntThinkAdapter medic_run = new EntThinkAdapter() { @@ -518,33 +518,33 @@ public class M_Medic extends Game { static mframe_t medic_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t medic_move_pain1 = new mmove_t(FRAME_paina1, FRAME_paina8, medic_frames_pain1, medic_run); static mframe_t medic_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t medic_move_pain2 = new mmove_t(FRAME_painb1, FRAME_painb15, medic_frames_pain2, medic_run); static EntPainAdapter medic_pain = new EntPainAdapter() { public void pain(edict_t self, edict_t other, float kick, int damage) { @@ -615,36 +615,36 @@ public class M_Medic extends Game { static mframe_t medic_frames_death[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t medic_move_death = new mmove_t(FRAME_death1, FRAME_death30, medic_frames_death, medic_dead); static EntDieAdapter medic_die = new EntDieAdapter() { @@ -715,22 +715,22 @@ public class M_Medic extends Game { static mframe_t medic_frames_duck[] = new mframe_t[] { - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, medic_duck_down), - new mframe_t(ai_move, -1, medic_duck_hold), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, medic_duck_up), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null)}; + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, medic_duck_down), + new mframe_t(GameAIAdapters.ai_move, -1, medic_duck_hold), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, medic_duck_up), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null)}; static mmove_t medic_move_duck = new mmove_t(FRAME_duck1, FRAME_duck16, medic_frames_duck, medic_run); static EntDodgeAdapter medic_dodge = new EntDodgeAdapter() { @@ -747,22 +747,22 @@ public class M_Medic extends Game { static mframe_t medic_frames_attackHyperBlaster[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, medic_fire_blaster)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster)}; static mmove_t medic_move_attackHyperBlaster = new mmove_t(FRAME_attack15, FRAME_attack30, medic_frames_attackHyperBlaster, medic_run); @@ -777,20 +777,20 @@ public class M_Medic extends Game { static mframe_t medic_frames_attackBlaster[] = { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, medic_fire_blaster), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, medic_continue) // Change to medic_continue... Else, go to frame 32 + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, medic_continue) // Change to medic_continue... Else, go to frame 32 }; static mmove_t medic_move_attackBlaster = new mmove_t(FRAME_attack1, FRAME_attack14, medic_frames_attackBlaster, medic_run); @@ -898,34 +898,34 @@ public class M_Medic extends Game { static mframe_t medic_frames_attackCable[] = new mframe_t[] { - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 4.4f, null), - new mframe_t(ai_charge, 4.7f, null), - new mframe_t(ai_charge, 5, null), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_move, 0, medic_hook_launch), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, 0, medic_cable_attack), - new mframe_t(ai_move, -15, medic_hook_retract), - new mframe_t(ai_move, -1.5f, null), - new mframe_t(ai_move, -1.2f, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0.3f, null), - new mframe_t(ai_move, 0.7f, null), - new mframe_t(ai_move, 1.2f, null), - new mframe_t(ai_move, 1.3f, null)}; + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 4.4f, null), + new mframe_t(GameAIAdapters.ai_charge, 4.7f, null), + new mframe_t(GameAIAdapters.ai_charge, 5, null), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, medic_hook_launch), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, 0, medic_cable_attack), + new mframe_t(GameAIAdapters.ai_move, -15, medic_hook_retract), + new mframe_t(GameAIAdapters.ai_move, -1.5f, null), + new mframe_t(GameAIAdapters.ai_move, -1.2f, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0.3f, null), + new mframe_t(GameAIAdapters.ai_move, 0.7f, null), + new mframe_t(GameAIAdapters.ai_move, 1.2f, null), + new mframe_t(GameAIAdapters.ai_move, 1.3f, null)}; static mmove_t medic_move_attackCable = new mmove_t(FRAME_attack33, FRAME_attack60, medic_frames_attackCable, medic_run); static EntThinkAdapter medic_attack = new EntThinkAdapter() { @@ -945,7 +945,7 @@ public class M_Medic extends Game { return true; } - return M_CheckAttack.think(self); + return GameUtilAdapters.M_CheckAttack.think(self); } }; @@ -1000,7 +1000,7 @@ public class M_Medic extends Game { self.monsterinfo.currentmove = medic_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); } } diff --git a/src/jake2/game/M_Mutant.java b/src/jake2/game/M_Mutant.java index b25ffc9..6e387b0 100644 --- a/src/jake2/game/M_Mutant.java +++ b/src/jake2/game/M_Mutant.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Mutant.java,v 1.1 2004-07-07 19:59:17 hzi Exp $ +// $Id: M_Mutant.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -240,67 +240,67 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 10) - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 20) - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 30) - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 40) - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // 50) - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t mutant_move_stand = new mmove_t(FRAME_stand101, FRAME_stand151, mutant_frames_stand, null); @@ -325,19 +325,19 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_idle[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), // scratch loop start - new mframe_t(ai_stand, 0, null), new mframe_t(ai_stand, 0, null), new mframe_t(ai_stand, 0, mutant_idle_loop), + new mframe_t(GameAIAdapters.ai_stand, 0, null), new mframe_t(GameAIAdapters.ai_stand, 0, null), new mframe_t(GameAIAdapters.ai_stand, 0, mutant_idle_loop), // scratch loop end - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t mutant_move_idle = new mmove_t(FRAME_stand152, FRAME_stand164, mutant_frames_idle, mutant_stand); @@ -355,18 +355,18 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 13, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 16, null), - new mframe_t(ai_walk, 15, null), - new mframe_t(ai_walk, 6, null)}; + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 13, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 16, null), + new mframe_t(GameAIAdapters.ai_walk, 15, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null)}; static mmove_t mutant_move_walk = new mmove_t(FRAME_walk05, FRAME_walk16, mutant_frames_walk, null); static EntThinkAdapter mutant_walk_loop = new EntThinkAdapter() { @@ -378,10 +378,10 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_start_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, -2, null), - new mframe_t(ai_walk, 1, null)}; + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, -2, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null)}; static mmove_t mutant_move_start_walk = new mmove_t(FRAME_walk01, FRAME_walk04, mutant_frames_start_walk, mutant_walk_loop); @@ -399,12 +399,12 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 40, null), - new mframe_t(ai_run, 40, mutant_step), - new mframe_t(ai_run, 24, null), - new mframe_t(ai_run, 5, mutant_step), - new mframe_t(ai_run, 17, null), - new mframe_t(ai_run, 10, null)}; + new mframe_t(GameAIAdapters.ai_run, 40, null), + new mframe_t(GameAIAdapters.ai_run, 40, mutant_step), + new mframe_t(GameAIAdapters.ai_run, 24, null), + new mframe_t(GameAIAdapters.ai_run, 5, mutant_step), + new mframe_t(GameAIAdapters.ai_run, 17, null), + new mframe_t(GameAIAdapters.ai_run, 10, null)}; static mmove_t mutant_move_run = new mmove_t(FRAME_run03, FRAME_run08, mutant_frames_run, null); static EntThinkAdapter mutant_run = new EntThinkAdapter() { @@ -461,13 +461,13 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_attack[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, mutant_hit_left), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, mutant_hit_right), - new mframe_t(ai_charge, 0, mutant_check_refire)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, mutant_hit_left), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, mutant_hit_right), + new mframe_t(GameAIAdapters.ai_charge, 0, mutant_check_refire)}; static mmove_t mutant_move_attack = new mmove_t(FRAME_attack09, FRAME_attack15, mutant_frames_attack, mutant_run); static EntThinkAdapter mutant_melee = new EntThinkAdapter() { @@ -552,14 +552,14 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_jump[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 17, null), - new mframe_t(ai_charge, 15, mutant_jump_takeoff), - new mframe_t(ai_charge, 15, null), - new mframe_t(ai_charge, 15, mutant_check_landing), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 17, null), + new mframe_t(GameAIAdapters.ai_charge, 15, mutant_jump_takeoff), + new mframe_t(GameAIAdapters.ai_charge, 15, null), + new mframe_t(GameAIAdapters.ai_charge, 15, mutant_check_landing), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t mutant_move_jump = new mmove_t(FRAME_attack01, FRAME_attack08, mutant_frames_jump, mutant_run); static EntThinkAdapter mutant_jump = new EntThinkAdapter() { @@ -637,36 +637,36 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -8, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 5, null)}; + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -8, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 5, null)}; static mmove_t mutant_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain105, mutant_frames_pain1, mutant_run); static mframe_t mutant_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, -24, null), - new mframe_t(ai_move, 11, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 4, null)}; + new mframe_t(GameAIAdapters.ai_move, -24, null), + new mframe_t(GameAIAdapters.ai_move, 11, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 4, null)}; static mmove_t mutant_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain206, mutant_frames_pain2, mutant_run); static mframe_t mutant_frames_pain3[] = new mframe_t[] { - new mframe_t(ai_move, -22, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null)}; + new mframe_t(GameAIAdapters.ai_move, -22, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null)}; static mmove_t mutant_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain311, mutant_frames_pain3, mutant_run); static EntPainAdapter mutant_pain = new EntPainAdapter() { @@ -716,29 +716,29 @@ public class M_Mutant extends Game { static mframe_t mutant_frames_death1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t mutant_move_death1 = new mmove_t(FRAME_death101, FRAME_death109, mutant_frames_death1, mutant_dead); static mframe_t mutant_frames_death2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t mutant_move_death2 = new mmove_t(FRAME_death201, FRAME_death210, mutant_frames_death2, mutant_dead); static EntDieAdapter mutant_die = new EntDieAdapter() { @@ -827,7 +827,7 @@ public class M_Mutant extends Game { self.monsterinfo.currentmove = mutant_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); return true; } }; diff --git a/src/jake2/game/M_Parasite.java b/src/jake2/game/M_Parasite.java index 78d6d34..1ba4f5a 100644 --- a/src/jake2/game/M_Parasite.java +++ b/src/jake2/game/M_Parasite.java @@ -19,14 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Parasite.java,v 1.1 2004-07-07 19:59:18 hzi Exp $ +// $Id: M_Parasite.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; import jake2.util.*; import jake2.util.*; -public class M_Parasite extends GamePWeapon { +public class M_Parasite extends M_Player { // This file generated by ModelGen - Do NOT Modify @@ -279,121 +279,121 @@ public class M_Parasite extends GamePWeapon { }; static mframe_t parasite_frames_start_fidget[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t parasite_move_start_fidget = new mmove_t(FRAME_stand18, FRAME_stand21, parasite_frames_start_fidget, parasite_do_fidget); static mframe_t parasite_frames_fidget[] = new mframe_t[] { - new mframe_t(ai_stand, 0, parasite_scratch), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_scratch), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_scratch), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_scratch), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t parasite_move_fidget = new mmove_t(FRAME_stand22, FRAME_stand27, parasite_frames_fidget, parasite_refidget); static mframe_t parasite_frames_end_fidget[] = new mframe_t[] { - new mframe_t(ai_stand, 0, parasite_scratch), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_scratch), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t parasite_move_end_fidget = new mmove_t(FRAME_stand28, FRAME_stand35, parasite_frames_end_fidget, parasite_stand); static mframe_t parasite_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_tap), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_tap), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_tap), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_tap), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_tap), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, parasite_tap)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_tap), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_tap), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_tap), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_tap), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_tap), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, parasite_tap)}; static mmove_t parasite_move_stand = new mmove_t(FRAME_stand01, FRAME_stand17, parasite_frames_stand, parasite_stand); static mframe_t parasite_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 30, null), - new mframe_t(ai_run, 30, null), - new mframe_t(ai_run, 22, null), - new mframe_t(ai_run, 19, null), - new mframe_t(ai_run, 24, null), - new mframe_t(ai_run, 28, null), - new mframe_t(ai_run, 25, null)}; + new mframe_t(GameAIAdapters.ai_run, 30, null), + new mframe_t(GameAIAdapters.ai_run, 30, null), + new mframe_t(GameAIAdapters.ai_run, 22, null), + new mframe_t(GameAIAdapters.ai_run, 19, null), + new mframe_t(GameAIAdapters.ai_run, 24, null), + new mframe_t(GameAIAdapters.ai_run, 28, null), + new mframe_t(GameAIAdapters.ai_run, 25, null)}; static mmove_t parasite_move_run = new mmove_t(FRAME_run03, FRAME_run09, parasite_frames_run, null); - static mframe_t parasite_frames_start_run[] = new mframe_t[] { new mframe_t(ai_run, 0, null), new mframe_t(ai_run, 30, null), }; + static mframe_t parasite_frames_start_run[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_run, 0, null), new mframe_t(GameAIAdapters.ai_run, 30, null), }; static mmove_t parasite_move_start_run = new mmove_t(FRAME_run01, FRAME_run02, parasite_frames_start_run, parasite_run); static mframe_t parasite_frames_stop_run[] = new mframe_t[] { - new mframe_t(ai_run, 20, null), - new mframe_t(ai_run, 20, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 0, null)}; + new mframe_t(GameAIAdapters.ai_run, 20, null), + new mframe_t(GameAIAdapters.ai_run, 20, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 0, null)}; static mmove_t parasite_move_stop_run = new mmove_t(FRAME_run10, FRAME_run15, parasite_frames_stop_run, null); static mframe_t parasite_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 30, null), - new mframe_t(ai_walk, 30, null), - new mframe_t(ai_walk, 22, null), - new mframe_t(ai_walk, 19, null), - new mframe_t(ai_walk, 24, null), - new mframe_t(ai_walk, 28, null), - new mframe_t(ai_walk, 25, null)}; + new mframe_t(GameAIAdapters.ai_walk, 30, null), + new mframe_t(GameAIAdapters.ai_walk, 30, null), + new mframe_t(GameAIAdapters.ai_walk, 22, null), + new mframe_t(GameAIAdapters.ai_walk, 19, null), + new mframe_t(GameAIAdapters.ai_walk, 24, null), + new mframe_t(GameAIAdapters.ai_walk, 28, null), + new mframe_t(GameAIAdapters.ai_walk, 25, null)}; static mmove_t parasite_move_walk = new mmove_t(FRAME_run03, FRAME_run09, parasite_frames_walk, parasite_walk); static mframe_t parasite_frames_start_walk[] = - new mframe_t[] { new mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 30, parasite_walk)}; + new mframe_t[] { new mframe_t(GameAIAdapters.ai_walk, 0, null), new mframe_t(GameAIAdapters.ai_walk, 30, parasite_walk)}; static mmove_t parasite_move_start_walk = new mmove_t(FRAME_run01, FRAME_run02, parasite_frames_start_walk, null); static mframe_t parasite_frames_stop_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 20, null), - new mframe_t(ai_walk, 20, null), - new mframe_t(ai_walk, 12, null), - new mframe_t(ai_walk, 10, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null)}; + new mframe_t(GameAIAdapters.ai_walk, 20, null), + new mframe_t(GameAIAdapters.ai_walk, 20, null), + new mframe_t(GameAIAdapters.ai_walk, 12, null), + new mframe_t(GameAIAdapters.ai_walk, 10, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null)}; static mmove_t parasite_move_stop_walk = new mmove_t(FRAME_run10, FRAME_run15, parasite_frames_stop_walk, null); static mframe_t parasite_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 16, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 16, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t parasite_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain111, parasite_frames_pain1, parasite_start_run); static EntPainAdapter parasite_pain = new EntPainAdapter() { public void pain(edict_t self, edict_t other, float kick, int damage) { @@ -484,62 +484,62 @@ public class M_Parasite extends GamePWeapon { static mframe_t parasite_frames_drain[] = new mframe_t[] { - new mframe_t(ai_charge, 0, parasite_launch), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 15, parasite_drain_attack), + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_launch), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 15, parasite_drain_attack), // Target hits) - new mframe_t(ai_charge, 0, parasite_drain_attack), // drain) - new mframe_t(ai_charge, 0, parasite_drain_attack), // drain) - new mframe_t(ai_charge, 0, parasite_drain_attack), // drain) - new mframe_t(ai_charge, 0, parasite_drain_attack), // drain) - new mframe_t(ai_charge, -2, parasite_drain_attack), // drain) - new mframe_t(ai_charge, -2, parasite_drain_attack), // drain) - new mframe_t(ai_charge, -3, parasite_drain_attack), // drain) - new mframe_t(ai_charge, -2, parasite_drain_attack), // drain) - new mframe_t(ai_charge, 0, parasite_drain_attack), // drain) - new mframe_t(ai_charge, -1, parasite_drain_attack), // drain) - new mframe_t(ai_charge, 0, parasite_reel_in), // let go) - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, -2, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, -2, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, -3, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, -2, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, -1, parasite_drain_attack), // drain) + new mframe_t(GameAIAdapters.ai_charge, 0, parasite_reel_in), // let go) + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t parasite_move_drain = new mmove_t(FRAME_drain01, FRAME_drain18, parasite_frames_drain, parasite_start_run); static mframe_t parasite_frames_break[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, -3, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -18, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 9, null), - new mframe_t(ai_charge, 6, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -18, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 8, null), - new mframe_t(ai_charge, 9, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -18, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, -3, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -18, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 9, null), + new mframe_t(GameAIAdapters.ai_charge, 6, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -18, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 8, null), + new mframe_t(GameAIAdapters.ai_charge, 9, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -18, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), /* airborne */ - new mframe_t(ai_charge, 0, null), /* slides */ - new mframe_t(ai_charge, 0, null), /* slides */ - new mframe_t(ai_charge, 0, null), /* slides */ - new mframe_t(ai_charge, 0, null), /* slides */ - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 11, null), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -5, null), - new mframe_t(ai_charge, 1, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), /* slides */ + new mframe_t(GameAIAdapters.ai_charge, 0, null), /* slides */ + new mframe_t(GameAIAdapters.ai_charge, 0, null), /* slides */ + new mframe_t(GameAIAdapters.ai_charge, 0, null), /* slides */ + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 11, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -5, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null)}; static mmove_t parasite_move_break = new mmove_t(FRAME_break01, FRAME_break32, parasite_frames_break, parasite_start_run); /* @@ -578,13 +578,13 @@ public class M_Parasite extends GamePWeapon { static mframe_t parasite_frames_death[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t parasite_move_death = new mmove_t(FRAME_death101, FRAME_death107, parasite_frames_death, parasite_dead); static EntDieAdapter parasite_die = new EntDieAdapter() { @@ -667,7 +667,7 @@ public class M_Parasite extends GamePWeapon { self.monsterinfo.currentmove = parasite_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); return true; } diff --git a/src/jake2/game/M_Soldier.java b/src/jake2/game/M_Soldier.java index df9af8c..6cdf19c 100644 --- a/src/jake2/game/M_Soldier.java +++ b/src/jake2/game/M_Soldier.java @@ -19,14 +19,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Soldier.java,v 1.1 2004-07-07 19:59:19 hzi Exp $ +// $Id: M_Soldier.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; +import jake2.Defines; import jake2.util.*; import jake2.util.*; -public class M_Soldier extends GamePWeapon { +public class M_Soldier extends M_Player { // This file generated by ModelGen - Do NOT Modify @@ -519,231 +520,154 @@ public class M_Soldier extends GamePWeapon { static int sound_death_ss; static int sound_cock; - static EntThinkAdapter soldier_idle = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (Lib.random() > 0.8) - gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); - return true; - } - }; - - static EntThinkAdapter soldier_cock = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.s.frame == FRAME_stand322) - gi.sound(self, CHAN_WEAPON, sound_cock, 1, ATTN_IDLE, 0); - else - gi.sound(self, CHAN_WEAPON, sound_cock, 1, ATTN_NORM, 0); - return true; - } - }; - - // ATTACK6 (run & shoot) - static EntThinkAdapter soldier_fire8 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_fire(self, 7); - return true; - } - }; - - - static EntThinkAdapter soldier_stand = new EntThinkAdapter() { - public boolean think(edict_t self) { - if ((self.monsterinfo.currentmove == soldier_move_stand3) || (Lib.random() < 0.8)) - self.monsterinfo.currentmove = soldier_move_stand1; - else - self.monsterinfo.currentmove = soldier_move_stand3; - return true; - } - }; - - // - // WALK - // - - static EntThinkAdapter soldier_walk1_random = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (Lib.random() > 0.1) - self.monsterinfo.nextframe = FRAME_walk101; - return true; - } - }; - - - static EntThinkAdapter soldier_walk = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (Lib.random() < 0.5) - self.monsterinfo.currentmove = soldier_move_walk1; - else - self.monsterinfo.currentmove = soldier_move_walk2; - return true; - } - }; - // STAND static mframe_t soldier_frames_stand1[] = new mframe_t[] { - new mframe_t(ai_stand, 0, soldier_idle), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; - static mmove_t soldier_move_stand1 = new mmove_t(FRAME_stand101, FRAME_stand130, soldier_frames_stand1, soldier_stand); + new mframe_t(GameAIAdapters.ai_stand, 0, M_SoldierAdapters.soldier_idle), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; + static mmove_t soldier_move_stand1 = new mmove_t(FRAME_stand101, FRAME_stand130, soldier_frames_stand1, M_SoldierAdapters.soldier_stand); static mframe_t soldier_frames_stand3[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, soldier_cock), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, M_SoldierAdapters.soldier_cock), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; - static mmove_t soldier_move_stand3 = new mmove_t(FRAME_stand301, FRAME_stand339, soldier_frames_stand3, soldier_stand); + static mmove_t soldier_move_stand3 = new mmove_t(FRAME_stand301, FRAME_stand339, soldier_frames_stand3, M_SoldierAdapters.soldier_stand); static mframe_t soldier_frames_walk1[] = new mframe_t[] { - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, -1, soldier_walk1_random), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null)}; + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, -1, M_SoldierAdapters.soldier_walk1_random), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null)}; static mmove_t soldier_move_walk1 = new mmove_t(FRAME_walk101, FRAME_walk133, soldier_frames_walk1, null); static mframe_t soldier_frames_walk2[] = new mframe_t[] { - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 9, null), - new mframe_t(ai_walk, 8, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 1, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 7, null)}; + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 9, null), + new mframe_t(GameAIAdapters.ai_walk, 8, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 1, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null)}; static mmove_t soldier_move_walk2 = new mmove_t(FRAME_walk209, FRAME_walk218, soldier_frames_walk2, null); - static EntThinkAdapter soldier_run = new EntThinkAdapter() { - public boolean think(edict_t self) { - if ((self.monsterinfo.aiflags & AI_STAND_GROUND)!=0) { - self.monsterinfo.currentmove = soldier_move_stand1; - return true; - } - - if (self.monsterinfo.currentmove == soldier_move_walk1 - || self.monsterinfo.currentmove == soldier_move_walk2 - || self.monsterinfo.currentmove == soldier_move_start_run) { - self.monsterinfo.currentmove = soldier_move_run; - } else { - self.monsterinfo.currentmove = soldier_move_start_run; - } - return true; - } - }; - // // RUN // - static mframe_t soldier_frames_start_run[] = new mframe_t[] { new mframe_t(ai_run, 7, null), new mframe_t(ai_run, 5, null)}; - static mmove_t soldier_move_start_run = new mmove_t(FRAME_run01, FRAME_run02, soldier_frames_start_run, soldier_run); + static mframe_t soldier_frames_start_run[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_run, 7, null), new mframe_t(GameAIAdapters.ai_run, 5, null)}; + static mmove_t soldier_move_start_run = new mmove_t(FRAME_run01, FRAME_run02, soldier_frames_start_run, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 11, null), - new mframe_t(ai_run, 11, null), - new mframe_t(ai_run, 16, null), - new mframe_t(ai_run, 10, null), - new mframe_t(ai_run, 15, null)}; + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 11, null), + new mframe_t(GameAIAdapters.ai_run, 11, null), + new mframe_t(GameAIAdapters.ai_run, 16, null), + new mframe_t(GameAIAdapters.ai_run, 10, null), + new mframe_t(GameAIAdapters.ai_run, 15, null)}; + static mmove_t soldier_move_run = new mmove_t(FRAME_run03, FRAME_run08, soldier_frames_run, null); @@ -754,112 +678,66 @@ public class M_Soldier extends GamePWeapon { static mframe_t soldier_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain105, soldier_frames_pain1, soldier_run); + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain105, soldier_frames_pain1, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, -13, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null)}; - static mmove_t soldier_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain207, soldier_frames_pain2, soldier_run); + new mframe_t(GameAIAdapters.ai_move, -13, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null)}; + static mmove_t soldier_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain207, soldier_frames_pain2, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_pain3[] = new mframe_t[] { - new mframe_t(ai_move, -8, null), - new mframe_t(ai_move, 10, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null)}; - static mmove_t soldier_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain318, soldier_frames_pain3, soldier_run); + new mframe_t(GameAIAdapters.ai_move, -8, null), + new mframe_t(GameAIAdapters.ai_move, 10, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null)}; + static mmove_t soldier_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain318, soldier_frames_pain3, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_pain4[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, 8, null), - new mframe_t(ai_move, 4, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 5, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_pain4 = new mmove_t(FRAME_pain401, FRAME_pain417, soldier_frames_pain4, soldier_run); - - static EntPainAdapter soldier_pain = new EntPainAdapter() { - public void pain(edict_t self, edict_t other, float kick, int damage) { - float r; - int n; - - if (self.health < (self.max_health / 2)) - self.s.skinnum |= 1; - - if (level.time < self.pain_debounce_time) { - if ((self.velocity[2] > 100) - && ((self.monsterinfo.currentmove == soldier_move_pain1) - || (self.monsterinfo.currentmove == soldier_move_pain2) - || (self.monsterinfo.currentmove == soldier_move_pain3))) - self.monsterinfo.currentmove = soldier_move_pain4; - return; - } - - self.pain_debounce_time = level.time + 3; - - n = self.s.skinnum | 1; - if (n == 1) - gi.sound(self, CHAN_VOICE, sound_pain_light, 1, ATTN_NORM, 0); - else if (n == 3) - gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, sound_pain_ss, 1, ATTN_NORM, 0); - - if (self.velocity[2] > 100) { - self.monsterinfo.currentmove = soldier_move_pain4; - return; - } - - if (skill.value == 3) - return; // no pain anims in nightmare - - r = Lib.random(); - - if (r < 0.33) - self.monsterinfo.currentmove = soldier_move_pain1; - else if (r < 0.66) - self.monsterinfo.currentmove = soldier_move_pain2; - else - self.monsterinfo.currentmove = soldier_move_pain3; - } - }; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, 8, null), + new mframe_t(GameAIAdapters.ai_move, 4, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 5, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_pain4 = new mmove_t(FRAME_pain401, FRAME_pain417, soldier_frames_pain4, M_SoldierAdapters.soldier_run); // // ATTACK @@ -960,747 +838,322 @@ public class M_Soldier extends GamePWeapon { } } - // ATTACK1 (blaster/shotgun) - - static EntThinkAdapter soldier_fire1 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_fire(self, 0); - return true; - } - }; - - static EntThinkAdapter soldier_attack1_refire1 = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.s.skinnum > 1) - return true; - - if (self.enemy.health <= 0) - return true; - - if (((skill.value == 3) && (Lib.random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE)) - self.monsterinfo.nextframe = FRAME_attak102; - else - self.monsterinfo.nextframe = FRAME_attak110; - return true; - } - }; - - static EntThinkAdapter soldier_attack1_refire2 = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.s.skinnum < 2) - return true; - - if (self.enemy.health <= 0) - return true; - - if (((skill.value == 3) && (Lib.random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE)) - self.monsterinfo.nextframe = FRAME_attak102; - return true; - } - }; - static mframe_t soldier_frames_attack1[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_fire1), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_attack1_refire1), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_cock), - new mframe_t(ai_charge, 0, soldier_attack1_refire2), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; - static mmove_t soldier_move_attack1 = new mmove_t(FRAME_attak101, FRAME_attak112, soldier_frames_attack1, soldier_run); - - // ATTACK2 (blaster/shotgun) - - static EntThinkAdapter soldier_fire2 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_fire(self, 1); - return true; - } - }; - - static EntThinkAdapter soldier_attack2_refire1 = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.s.skinnum > 1) - return true; - - if (self.enemy.health <= 0) - return true; - - if (((skill.value == 3) && (Lib.random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE)) - self.monsterinfo.nextframe = FRAME_attak204; - else - self.monsterinfo.nextframe = FRAME_attak216; - return true; - } - }; - - static EntThinkAdapter soldier_attack2_refire2 = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.s.skinnum < 2) - return true; - - if (self.enemy.health <= 0) - return true ; - - if (((skill.value == 3) && (Lib.random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE)) - self.monsterinfo.nextframe = FRAME_attak204; - return true; - } - }; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_fire1), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_attack1_refire1), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_cock), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_attack1_refire2), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; + static mmove_t soldier_move_attack1 = new mmove_t(FRAME_attak101, FRAME_attak112, soldier_frames_attack1, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_attack2[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_fire2), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_attack2_refire1), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_cock), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_attack2_refire2), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; - static mmove_t soldier_move_attack2 = new mmove_t(FRAME_attak201, FRAME_attak218, soldier_frames_attack2, soldier_run); - - // ATTACK3 (duck and shoot) - - static EntThinkAdapter soldier_duck_down = new EntThinkAdapter() { - public boolean think(edict_t self) { - if ((self.monsterinfo.aiflags & AI_DUCKED)!=0) - return true; - self.monsterinfo.aiflags |= AI_DUCKED; - self.maxs[2] -= 32; - self.takedamage = DAMAGE_YES; - self.monsterinfo.pausetime = level.time + 1; - gi.linkentity(self); - return true; - } - }; - - static EntThinkAdapter soldier_duck_up = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.monsterinfo.aiflags &= ~AI_DUCKED; - self.maxs[2] += 32; - self.takedamage = DAMAGE_AIM; - gi.linkentity(self); - return true; - } - }; - - static EntThinkAdapter soldier_fire3 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_duck_down.think(self); - soldier_fire(self, 2); - return true; - } - }; - - static EntThinkAdapter soldier_attack3_refire = new EntThinkAdapter() { - public boolean think(edict_t self) { - if ((level.time + 0.4) < self.monsterinfo.pausetime) - self.monsterinfo.nextframe = FRAME_attak303; - return true; - } - }; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_fire2), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_attack2_refire1), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_cock), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_attack2_refire2), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; + static mmove_t soldier_move_attack2 = new mmove_t(FRAME_attak201, FRAME_attak218, soldier_frames_attack2, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_attack3[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_fire3), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_attack3_refire), - new mframe_t(ai_charge, 0, soldier_duck_up), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; - static mmove_t soldier_move_attack3 = new mmove_t(FRAME_attak301, FRAME_attak309, soldier_frames_attack3, soldier_run); - - // ATTACK4 (machinegun) - - static EntThinkAdapter soldier_fire4 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_fire(self, 3); - // - // if (self.enemy.health <= 0) - // return; - // - // if ( ((skill.value == 3) && (random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE) ) - // self.monsterinfo.nextframe = FRAME_attak402; - return true; - } - }; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_fire3), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_attack3_refire), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_duck_up), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; + static mmove_t soldier_move_attack3 = new mmove_t(FRAME_attak301, FRAME_attak309, soldier_frames_attack3, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_attack4[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, soldier_fire4), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; - static mmove_t soldier_move_attack4 = new mmove_t(FRAME_attak401, FRAME_attak406, soldier_frames_attack4, soldier_run); + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, M_SoldierAdapters.soldier_fire4), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; + static mmove_t soldier_move_attack4 = new mmove_t(FRAME_attak401, FRAME_attak406, soldier_frames_attack4, M_SoldierAdapters.soldier_run); - static EntThinkAdapter soldier_attack6_refire = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.enemy.health <= 0) - return true; - - if (range(self, self.enemy) < RANGE_MID) - return true; - - if (skill.value == 3) - self.monsterinfo.nextframe = FRAME_runs03; - return true; - } - }; - static mframe_t soldier_frames_attack6[] = new mframe_t[] { - new mframe_t(ai_charge, 10, null), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 12, null), - new mframe_t(ai_charge, 11, soldier_fire8), - new mframe_t(ai_charge, 13, null), - new mframe_t(ai_charge, 18, null), - new mframe_t(ai_charge, 15, null), - new mframe_t(ai_charge, 14, null), - new mframe_t(ai_charge, 11, null), - new mframe_t(ai_charge, 8, null), - new mframe_t(ai_charge, 11, null), - new mframe_t(ai_charge, 12, null), - new mframe_t(ai_charge, 12, null), - new mframe_t(ai_charge, 17, soldier_attack6_refire)}; - static mmove_t soldier_move_attack6 = new mmove_t(FRAME_runs01, FRAME_runs14, soldier_frames_attack6, soldier_run); - - static EntThinkAdapter soldier_attack = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (self.s.skinnum < 4) { - if (Lib.random() < 0.5) - self.monsterinfo.currentmove = soldier_move_attack1; - else - self.monsterinfo.currentmove = soldier_move_attack2; - } else { - self.monsterinfo.currentmove = soldier_move_attack4; - } - return true; - } - }; - - // - // SIGHT - // - - static EntInteractAdapter soldier_sight = new EntInteractAdapter() { - public boolean interact(edict_t self, edict_t other) { - if (Lib.random() < 0.5) - gi.sound(self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0); - - if ((skill.value > 0) && (range(self, self.enemy) >= RANGE_MID)) { - if (Lib.random() > 0.5) - self.monsterinfo.currentmove = soldier_move_attack6; - } - return true; - } - }; - - // - // DUCK - // - - static EntThinkAdapter soldier_duck_hold = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (level.time >= self.monsterinfo.pausetime) - self.monsterinfo.aiflags &= ~AI_HOLD_FRAME; - else - self.monsterinfo.aiflags |= AI_HOLD_FRAME; - return true; - } - }; + new mframe_t(GameAIAdapters.ai_charge, 10, null), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 12, null), + new mframe_t(GameAIAdapters.ai_charge, 11, M_SoldierAdapters.soldier_fire8), + new mframe_t(GameAIAdapters.ai_charge, 13, null), + new mframe_t(GameAIAdapters.ai_charge, 18, null), + new mframe_t(GameAIAdapters.ai_charge, 15, null), + new mframe_t(GameAIAdapters.ai_charge, 14, null), + new mframe_t(GameAIAdapters.ai_charge, 11, null), + new mframe_t(GameAIAdapters.ai_charge, 8, null), + new mframe_t(GameAIAdapters.ai_charge, 11, null), + new mframe_t(GameAIAdapters.ai_charge, 12, null), + new mframe_t(GameAIAdapters.ai_charge, 12, null), + new mframe_t(GameAIAdapters.ai_charge, 17, M_SoldierAdapters.soldier_attack6_refire)}; + static mmove_t soldier_move_attack6 = new mmove_t(FRAME_runs01, FRAME_runs14, soldier_frames_attack6, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_duck[] = new mframe_t[] { - new mframe_t(ai_move, 5, soldier_duck_down), - new mframe_t(ai_move, -1, soldier_duck_hold), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 0, soldier_duck_up), - new mframe_t(ai_move, 5, null)}; - static mmove_t soldier_move_duck = new mmove_t(FRAME_duck01, FRAME_duck05, soldier_frames_duck, soldier_run); - - static EntDodgeAdapter soldier_dodge = new EntDodgeAdapter() { - public void dodge(edict_t self, edict_t attacker, float eta) { - float r; - - r = Lib.random(); - if (r > 0.25) - return; - - if (self.enemy== null) - self.enemy = attacker; - - if (skill.value == 0) { - self.monsterinfo.currentmove = soldier_move_duck; - return; - } - - self.monsterinfo.pausetime = level.time + eta + 0.3f; - r = Lib.random(); - - if (skill.value == 1) { - if (r > 0.33) - self.monsterinfo.currentmove = soldier_move_duck; - else - self.monsterinfo.currentmove = soldier_move_attack3; - return; - } - - if (skill.value >= 2) { - if (r > 0.66) - self.monsterinfo.currentmove = soldier_move_duck; - else - self.monsterinfo.currentmove = soldier_move_attack3; - return; - } - - self.monsterinfo.currentmove = soldier_move_attack3; - } - }; - - // - // DEATH - // - - static EntThinkAdapter soldier_fire6 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_fire(self, 5); - return true; - } - }; - - static EntThinkAdapter soldier_fire7 = new EntThinkAdapter() { - public boolean think(edict_t self) { - soldier_fire(self, 6); - return true; - } - }; - - static EntThinkAdapter soldier_dead = new EntThinkAdapter() { - public boolean think(edict_t self) { - - Math3D.VectorSet(self.mins, -16, -16, -24); - Math3D.VectorSet(self.maxs, 16, 16, -8); - self.movetype = MOVETYPE_TOSS; - self.svflags |= SVF_DEADMONSTER; - self.nextthink = 0; - gi.linkentity(self); - return true; - } - }; + new mframe_t(GameAIAdapters.ai_move, 5, M_SoldierAdapters.soldier_duck_down), + new mframe_t(GameAIAdapters.ai_move, -1, M_SoldierAdapters.soldier_duck_hold), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 0, M_SoldierAdapters.soldier_duck_up), + new mframe_t(GameAIAdapters.ai_move, 5, null)}; + static mmove_t soldier_move_duck = new mmove_t(FRAME_duck01, FRAME_duck05, soldier_frames_duck, M_SoldierAdapters.soldier_run); static mframe_t soldier_frames_death1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, soldier_fire6), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, soldier_fire7), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_death1 = new mmove_t(FRAME_death101, FRAME_death136, soldier_frames_death1, soldier_dead); + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, M_SoldierAdapters.soldier_fire6), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, M_SoldierAdapters.soldier_fire7), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_death1 = new mmove_t(FRAME_death101, FRAME_death136, soldier_frames_death1, M_SoldierAdapters.soldier_dead); static mframe_t soldier_frames_death2[] = new mframe_t[] { - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_death2 = new mmove_t(FRAME_death201, FRAME_death235, soldier_frames_death2, soldier_dead); + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_death2 = new mmove_t(FRAME_death201, FRAME_death235, soldier_frames_death2, M_SoldierAdapters.soldier_dead); static mframe_t soldier_frames_death3[] = new mframe_t[] { - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), }; - static mmove_t soldier_move_death3 = new mmove_t(FRAME_death301, FRAME_death345, soldier_frames_death3, soldier_dead); + static mmove_t soldier_move_death3 = new mmove_t(FRAME_death301, FRAME_death345, soldier_frames_death3, M_SoldierAdapters.soldier_dead); static mframe_t soldier_frames_death4[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_death4 = new mmove_t(FRAME_death401, FRAME_death453, soldier_frames_death4, soldier_dead); + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_death4 = new mmove_t(FRAME_death401, FRAME_death453, soldier_frames_death4, M_SoldierAdapters.soldier_dead); static mframe_t soldier_frames_death5[] = new mframe_t[] { - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_death5 = new mmove_t(FRAME_death501, FRAME_death524, soldier_frames_death5, soldier_dead); + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_death5 = new mmove_t(FRAME_death501, FRAME_death524, soldier_frames_death5, M_SoldierAdapters.soldier_dead); static mframe_t soldier_frames_death6[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; - static mmove_t soldier_move_death6 = new mmove_t(FRAME_death601, FRAME_death610, soldier_frames_death6, soldier_dead); - - static EntDieAdapter soldier_die = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - int n; - - // check for gib - if (self.health <= self.gib_health) { - gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); - for (n = 0; n < 3; n++) - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); - ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC); - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); - self.deadflag = DEAD_DEAD; - return; - } - - if (self.deadflag == DEAD_DEAD) - return; - - // regular death - self.deadflag = DEAD_DEAD; - self.takedamage = DAMAGE_YES; - self.s.skinnum |= 1; - - if (self.s.skinnum == 1) - gi.sound(self, CHAN_VOICE, sound_death_light, 1, ATTN_NORM, 0); - else if (self.s.skinnum == 3) - gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0); - else // (self.s.skinnum == 5) - gi.sound(self, CHAN_VOICE, sound_death_ss, 1, ATTN_NORM, 0); - - if (Math.abs((self.s.origin[2] + self.viewheight) - point[2]) <= 4) { - // head shot - self.monsterinfo.currentmove = soldier_move_death3; - return; - } - - n = Lib.rand() % 5; - if (n == 0) - self.monsterinfo.currentmove = soldier_move_death1; - else if (n == 1) - self.monsterinfo.currentmove = soldier_move_death2; - else if (n == 2) - self.monsterinfo.currentmove = soldier_move_death4; - else if (n == 3) - self.monsterinfo.currentmove = soldier_move_death5; - else - self.monsterinfo.currentmove = soldier_move_death6; - } - }; - - // - // SPAWN - // - - static EntThinkAdapter SP_monster_soldier_x = new EntThinkAdapter() { - public boolean think(edict_t self) { - - self.s.modelindex = gi.modelindex("models/monsters/soldier/tris.md2"); - self.monsterinfo.scale = MODEL_SCALE; - Math3D.VectorSet(self.mins, -16, -16, -24); - Math3D.VectorSet(self.maxs, 16, 16, 32); - self.movetype = MOVETYPE_STEP; - self.solid = SOLID_BBOX; - - sound_idle = gi.soundindex("soldier/solidle1.wav"); - sound_sight1 = gi.soundindex("soldier/solsght1.wav"); - sound_sight2 = gi.soundindex("soldier/solsrch1.wav"); - sound_cock = gi.soundindex("infantry/infatck3.wav"); - - self.mass = 100; - - self.pain = soldier_pain; - self.die = soldier_die; - - self.monsterinfo.stand = soldier_stand; - self.monsterinfo.walk = soldier_walk; - self.monsterinfo.run = soldier_run; - self.monsterinfo.dodge = soldier_dodge; - self.monsterinfo.attack = soldier_attack; - self.monsterinfo.melee = null; - self.monsterinfo.sight = soldier_sight; - - gi.linkentity(self); - - self.monsterinfo.stand.think(self); - - walkmonster_start.think(self); - return true; - } - }; - - /*QUAKED monster_soldier_light (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight - */ - static EntThinkAdapter SP_monster_soldier_light = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (deathmatch.value!=0) { - G_FreeEdict(self); - return true; - } - - SP_monster_soldier_x.think(self); - - sound_pain_light = gi.soundindex("soldier/solpain2.wav"); - sound_death_light = gi.soundindex("soldier/soldeth2.wav"); - gi.modelindex("models/objects/laser/tris.md2"); - gi.soundindex("misc/lasfly.wav"); - gi.soundindex("soldier/solatck2.wav"); - - self.s.skinnum = 0; - self.health = 20; - self.gib_health = -30; - return true; - } - }; - - /*QUAKED monster_soldier (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight - */ - - static EntThinkAdapter SP_monster_soldier = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (deathmatch.value!=0) { - G_FreeEdict(self); - return true; - } - - SP_monster_soldier_x.think(self); - - sound_pain = gi.soundindex("soldier/solpain1.wav"); - sound_death = gi.soundindex("soldier/soldeth1.wav"); - gi.soundindex("soldier/solatck1.wav"); - - self.s.skinnum = 2; - self.health = 30; - self.gib_health = -30; - return true; - } - }; - - /*QUAKED monster_soldier_ss (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight - */ - static EntThinkAdapter SP_monster_soldier_ss = new EntThinkAdapter() { - public boolean think(edict_t self) { - if (deathmatch.value != 0) { - G_FreeEdict(self); - return true; - } - - SP_monster_soldier_x.think(self); - - sound_pain_ss = gi.soundindex("soldier/solpain3.wav"); - sound_death_ss = gi.soundindex("soldier/soldeth3.wav"); - gi.soundindex("soldier/solatck3.wav"); - - self.s.skinnum = 4; - self.health = 40; - self.gib_health = -30; - return true; - } - }; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; + static mmove_t soldier_move_death6 = new mmove_t(FRAME_death601, FRAME_death610, soldier_frames_death6, M_SoldierAdapters.soldier_dead); } diff --git a/src/jake2/game/M_SoldierAdapters.java b/src/jake2/game/M_SoldierAdapters.java new file mode 100644 index 0000000..eab1171 --- /dev/null +++ b/src/jake2/game/M_SoldierAdapters.java @@ -0,0 +1,654 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: M_SoldierAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.Defines; +import jake2.qcommon.Com; +import jake2.util.*; + +public class M_SoldierAdapters +{ + + static EntThinkAdapter soldier_cock = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.s.frame == M_Soldier.FRAME_stand322) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, M_Soldier.sound_cock, 1, Defines.ATTN_IDLE, 0); + else + GameBase.gi.sound(self, Defines.CHAN_WEAPON, M_Soldier.sound_cock, 1, Defines.ATTN_NORM, 0); + return true; + } + }; + // ATTACK3 (duck and shoot) + + static EntThinkAdapter soldier_duck_down = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.pausetime = GameBase.level.time + 1; + GameBase.gi.linkentity(self); + return true; + } + }; + static EntThinkAdapter soldier_duck_up = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + static EntThinkAdapter soldier_attack = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.s.skinnum < 4) + { + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack1; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack2; + } + else + { + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack4; + } + return true; + } + }; + // + // DUCK + // + + static EntThinkAdapter soldier_duck_hold = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + static EntDodgeAdapter soldier_dodge = new EntDodgeAdapter() + { + public void dodge(edict_t self, edict_t attacker, float eta) + { + float r; + + r = Lib.random(); + if (r > 0.25) + return; + + if (self.enemy == null) + self.enemy = attacker; + + if (GameBase.skill.value == 0) + { + self.monsterinfo.currentmove = M_Soldier.soldier_move_duck; + return; + } + + self.monsterinfo.pausetime = GameBase.level.time + eta + 0.3f; + r = Lib.random(); + + if (GameBase.skill.value == 1) + { + if (r > 0.33) + self.monsterinfo.currentmove = M_Soldier.soldier_move_duck; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack3; + return; + } + + if (GameBase.skill.value >= 2) + { + if (r > 0.66) + self.monsterinfo.currentmove = M_Soldier.soldier_move_duck; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack3; + return; + } + + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack3; + } + }; + static EntThinkAdapter soldier_dead = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, -8); + self.movetype = Defines.MOVETYPE_TOSS; + self.svflags |= Defines.SVF_DEADMONSTER; + self.nextthink = 0; + GameBase.gi.linkentity(self); + return true; + } + }; + static EntDieAdapter soldier_die = new EntDieAdapter() + { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) + { + int n; + + // check for gib + if (self.health <= self.gib_health) + { + GameBase.gi.sound(self, Defines.CHAN_VOICE, GameBase.gi.soundindex("misc/udeath.wav"), 1, Defines.ATTN_NORM, 0); + for (n = 0; n < 3; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); + GameAI.ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, Defines.GIB_ORGANIC); + GameAI.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); + self.deadflag = Defines.DEAD_DEAD; + return; + } + + if (self.deadflag == Defines.DEAD_DEAD) + return; + + // regular death + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + self.s.skinnum |= 1; + + if (self.s.skinnum == 1) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_death_light, 1, Defines.ATTN_NORM, 0); + else if (self.s.skinnum == 3) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_death, 1, Defines.ATTN_NORM, 0); + else // (self.s.skinnum == 5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_death_ss, 1, Defines.ATTN_NORM, 0); + + if (Math.abs((self.s.origin[2] + self.viewheight) - point[2]) <= 4) + { + // head shot + self.monsterinfo.currentmove = M_Soldier.soldier_move_death3; + return; + } + + n = Lib.rand() % 5; + if (n == 0) + self.monsterinfo.currentmove = M_Soldier.soldier_move_death1; + else if (n == 1) + self.monsterinfo.currentmove = M_Soldier.soldier_move_death2; + else if (n == 2) + self.monsterinfo.currentmove = M_Soldier.soldier_move_death4; + else if (n == 3) + self.monsterinfo.currentmove = M_Soldier.soldier_move_death5; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_death6; + } + }; + + static EntThinkAdapter soldier_attack1_refire1 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.s.skinnum > 1) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = M_Soldier.FRAME_attak102; + else + self.monsterinfo.nextframe = M_Soldier.FRAME_attak110; + return true; + } + }; + + static EntThinkAdapter soldier_attack1_refire2 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.s.skinnum < 2) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = M_Soldier.FRAME_attak102; + return true; + } + }; + + static EntThinkAdapter soldier_attack2_refire1 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.s.skinnum > 1) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = M_Soldier.FRAME_attak204; + else + self.monsterinfo.nextframe = M_Soldier.FRAME_attak216; + return true; + } + }; + + static EntThinkAdapter soldier_attack2_refire2 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.s.skinnum < 2) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = M_Soldier.FRAME_attak204; + return true; + } + }; + + static EntThinkAdapter soldier_attack3_refire = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if ((GameBase.level.time + 0.4) < self.monsterinfo.pausetime) + self.monsterinfo.nextframe = M_Soldier.FRAME_attak303; + return true; + } + }; + + static EntThinkAdapter soldier_attack6_refire = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (self.enemy.health <= 0) + return true; + + if (GameUtil.range(self, self.enemy) < Defines.RANGE_MID) + return true; + + if (GameBase.skill.value == 3) + self.monsterinfo.nextframe = M_Soldier.FRAME_runs03; + return true; + } + }; + + // ATTACK6 (run & shoot) + static EntThinkAdapter soldier_fire8 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_Soldier.soldier_fire(self, 7); + return true; + } + }; + + // ATTACK1 (blaster/shotgun) + + static EntThinkAdapter soldier_fire1 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_Soldier.soldier_fire(self, 0); + return true; + } + }; + + // ATTACK2 (blaster/shotgun) + + static EntThinkAdapter soldier_fire2 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_Soldier.soldier_fire(self, 1); + return true; + } + }; + + static EntThinkAdapter soldier_fire3 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_SoldierAdapters.soldier_duck_down.think(self); + M_Soldier.soldier_fire(self, 2); + return true; + } + }; + + // ATTACK4 (machinegun) + + static EntThinkAdapter soldier_fire4 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_Soldier.soldier_fire(self, 3); + // + // if (self.enemy.health <= 0) + // return; + // + // if ( ((skill.value == 3) && (random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE) ) + // self.monsterinfo.nextframe = FRAME_attak402; + return true; + } + }; + + // + // DEATH + // + + static EntThinkAdapter soldier_fire6 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_Soldier.soldier_fire(self, 5); + return true; + } + }; + + static EntThinkAdapter soldier_fire7 = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + M_Soldier.soldier_fire(self, 6); + return true; + } + }; + + static EntThinkAdapter soldier_idle = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (Lib.random() > 0.8) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_idle, 1, Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter soldier_stand = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if ((self.monsterinfo.currentmove == M_Soldier.soldier_move_stand3) || (Lib.random() < 0.8)) + self.monsterinfo.currentmove = M_Soldier.soldier_move_stand1; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_stand3; + return true; + } + }; + + // + // WALK + // + static EntThinkAdapter soldier_walk1_random = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (Lib.random() > 0.1) + self.monsterinfo.nextframe = M_Soldier.FRAME_walk101; + return true; + } + }; + + static EntThinkAdapter soldier_walk = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = M_Soldier.soldier_move_walk1; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_walk2; + return true; + } + }; + + static EntThinkAdapter soldier_run = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + { + self.monsterinfo.currentmove = M_Soldier.soldier_move_stand1; + return true; + } + + if (self.monsterinfo.currentmove == M_Soldier.soldier_move_walk1 + || self.monsterinfo.currentmove == M_Soldier.soldier_move_walk2 + || self.monsterinfo.currentmove == M_Soldier.soldier_move_start_run) + { + self.monsterinfo.currentmove = M_Soldier.soldier_move_run; + int a = 2; + } + else + { + self.monsterinfo.currentmove = M_Soldier.soldier_move_start_run; + } + return true; + } + }; + + static EntPainAdapter soldier_pain = new EntPainAdapter() + { + public void pain(edict_t self, edict_t other, float kick, int damage) + { + float r; + int n; + + if (self.health < (self.max_health / 2)) + self.s.skinnum |= 1; + + if (GameBase.level.time < self.pain_debounce_time) + { + if ((self.velocity[2] > 100) + && ((self.monsterinfo.currentmove == M_Soldier.soldier_move_pain1) + || (self.monsterinfo.currentmove == M_Soldier.soldier_move_pain2) + || (self.monsterinfo.currentmove == M_Soldier.soldier_move_pain3))) + self.monsterinfo.currentmove = M_Soldier.soldier_move_pain4; + return; + } + + self.pain_debounce_time = GameBase.level.time + 3; + + n = self.s.skinnum | 1; + if (n == 1) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_pain_light, 1, Defines.ATTN_NORM, 0); + else if (n == 3) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_pain, 1, Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_pain_ss, 1, Defines.ATTN_NORM, 0); + + if (self.velocity[2] > 100) + { + self.monsterinfo.currentmove = M_Soldier.soldier_move_pain4; + return; + } + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + r = Lib.random(); + + if (r < 0.33) + self.monsterinfo.currentmove = M_Soldier.soldier_move_pain1; + else if (r < 0.66) + self.monsterinfo.currentmove = M_Soldier.soldier_move_pain2; + else + self.monsterinfo.currentmove = M_Soldier.soldier_move_pain3; + } + }; + + // + // SIGHT + // + + static EntInteractAdapter soldier_sight = new EntInteractAdapter() + { + public boolean interact(edict_t self, edict_t other) + { + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_sight1, 1, Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, M_Soldier.sound_sight2, 1, Defines.ATTN_NORM, 0); + + if ((GameBase.skill.value > 0) && (GameUtil.range(self, self.enemy) >= Defines.RANGE_MID)) + { + if (Lib.random() > 0.5) + self.monsterinfo.currentmove = M_Soldier.soldier_move_attack6; + } + return true; + } + }; + + // + // SPAWN + // + + static EntThinkAdapter SP_monster_soldier_x = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + + self.s.modelindex = GameBase.gi.modelindex("models/monsters/soldier/tris.md2"); + self.monsterinfo.scale = M_Soldier.MODEL_SCALE; + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + + M_Soldier.sound_idle = GameBase.gi.soundindex("soldier/solidle1.wav"); + M_Soldier.sound_sight1 = GameBase.gi.soundindex("soldier/solsght1.wav"); + M_Soldier.sound_sight2 = GameBase.gi.soundindex("soldier/solsrch1.wav"); + M_Soldier.sound_cock = GameBase.gi.soundindex("infantry/infatck3.wav"); + + self.mass = 100; + + self.pain = soldier_pain; + self.die = M_SoldierAdapters.soldier_die; + + self.monsterinfo.stand = soldier_stand; + self.monsterinfo.walk = soldier_walk; + self.monsterinfo.run = soldier_run; + self.monsterinfo.dodge = M_SoldierAdapters.soldier_dodge; + self.monsterinfo.attack = M_SoldierAdapters.soldier_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = soldier_sight; + + GameBase.gi.linkentity(self); + + self.monsterinfo.stand.think(self); + + GameAIAdapters.walkmonster_start.think(self); + return true; + } + }; + + /*QUAKED monster_soldier_light (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight + */ + static EntThinkAdapter SP_monster_soldier_light = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (GameBase.deathmatch.value != 0) + { + GameUtil.G_FreeEdict(self); + return true; + } + + SP_monster_soldier_x.think(self); + + M_Soldier.sound_pain_light = GameBase.gi.soundindex("soldier/solpain2.wav"); + M_Soldier.sound_death_light = GameBase.gi.soundindex("soldier/soldeth2.wav"); + GameBase.gi.modelindex("models/objects/laser/tris.md2"); + GameBase.gi.soundindex("misc/lasfly.wav"); + GameBase.gi.soundindex("soldier/solatck2.wav"); + + self.s.skinnum = 0; + self.health = 20; + self.gib_health = -30; + return true; + } + }; + + /*QUAKED monster_soldier (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight + */ + + static EntThinkAdapter SP_monster_soldier = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (GameBase.deathmatch.value != 0) + { + GameUtil.G_FreeEdict(self); + return true; + } + + SP_monster_soldier_x.think(self); + + M_Soldier.sound_pain = GameBase.gi.soundindex("soldier/solpain1.wav"); + M_Soldier.sound_death = GameBase.gi.soundindex("soldier/soldeth1.wav"); + GameBase.gi.soundindex("soldier/solatck1.wav"); + + self.s.skinnum = 2; + self.health = 30; + self.gib_health = -30; + return true; + } + }; + + /*QUAKED monster_soldier_ss (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight + */ + static EntThinkAdapter SP_monster_soldier_ss = new EntThinkAdapter() + { + public boolean think(edict_t self) + { + if (GameBase.deathmatch.value != 0) + { + GameUtil.G_FreeEdict(self); + return true; + } + + SP_monster_soldier_x.think(self); + + M_Soldier.sound_pain_ss = GameBase.gi.soundindex("soldier/solpain3.wav"); + M_Soldier.sound_death_ss = GameBase.gi.soundindex("soldier/soldeth3.wav"); + GameBase.gi.soundindex("soldier/solatck3.wav"); + + self.s.skinnum = 4; + self.health = 40; + self.gib_health = -30; + return true; + } + }; +} diff --git a/src/jake2/game/M_Supertank.java b/src/jake2/game/M_Supertank.java index a70d8f2..1b8f030 100644 --- a/src/jake2/game/M_Supertank.java +++ b/src/jake2/game/M_Supertank.java @@ -19,14 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Supertank.java,v 1.1 2004-07-07 19:59:19 hzi Exp $ +// $Id: M_Supertank.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.util.*; import jake2.util.*; -public class M_Supertank extends GamePWeapon { +public class M_Supertank extends M_Player { // This file generated by ModelGen - Do NOT Modify @@ -319,66 +319,66 @@ public class M_Supertank extends GamePWeapon { static mframe_t supertank_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t supertank_move_stand = new mmove_t(FRAME_stand_1, FRAME_stand_60, supertank_frames_stand, null); static EntThinkAdapter supertank_stand = new EntThinkAdapter() { @@ -392,24 +392,24 @@ public class M_Supertank extends GamePWeapon { static mframe_t supertank_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 12, TreadSound), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null), - new mframe_t(ai_run, 12, null)}; + new mframe_t(GameAIAdapters.ai_run, 12, TreadSound), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null), + new mframe_t(GameAIAdapters.ai_run, 12, null)}; static mmove_t supertank_move_run = new mmove_t(FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, null); // @@ -418,24 +418,24 @@ public class M_Supertank extends GamePWeapon { static mframe_t supertank_frames_forward[] = new mframe_t[] { - new mframe_t(ai_walk, 4, TreadSound), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, null)}; + new mframe_t(GameAIAdapters.ai_walk, 4, TreadSound), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null)}; static mmove_t supertank_move_forward = new mmove_t(FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, null); static EntThinkAdapter supertank_forward = new EntThinkAdapter() { @@ -565,192 +565,192 @@ public class M_Supertank extends GamePWeapon { static mframe_t supertank_frames_turn_right[] = new mframe_t[] { - new mframe_t(ai_move, 0, TreadSound), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, TreadSound), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_turn_right = new mmove_t(FRAME_right_1, FRAME_right_18, supertank_frames_turn_right, supertank_run); static mframe_t supertank_frames_turn_left[] = new mframe_t[] { - new mframe_t(ai_move, 0, TreadSound), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, TreadSound), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_turn_left = new mmove_t(FRAME_left_1, FRAME_left_18, supertank_frames_turn_left, supertank_run); static mframe_t supertank_frames_pain3[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_pain3 = new mmove_t(FRAME_pain3_9, FRAME_pain3_12, supertank_frames_pain3, supertank_run); static mframe_t supertank_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_pain2 = new mmove_t(FRAME_pain2_5, FRAME_pain2_8, supertank_frames_pain2, supertank_run); static mframe_t supertank_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_pain1 = new mmove_t(FRAME_pain1_1, FRAME_pain1_4, supertank_frames_pain1, supertank_run); static mframe_t supertank_frames_death1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, BossExplode)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, GameAIAdapters.BossExplode)}; static mmove_t supertank_move_death = new mmove_t(FRAME_death_1, FRAME_death_24, supertank_frames_death1, supertank_dead); static mframe_t supertank_frames_backward[] = new mframe_t[] { - new mframe_t(ai_walk, 0, TreadSound), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 0, null)}; + new mframe_t(GameAIAdapters.ai_walk, 0, TreadSound), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 0, null)}; static mmove_t supertank_move_backward = new mmove_t(FRAME_backwd_1, FRAME_backwd_18, supertank_frames_backward, null); static mframe_t supertank_frames_attack4[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_attack4 = new mmove_t(FRAME_attak4_1, FRAME_attak4_6, supertank_frames_attack4, supertank_run); static mframe_t supertank_frames_attack3[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_attack3 = new mmove_t(FRAME_attak3_1, FRAME_attak3_27, supertank_frames_attack3, supertank_run); static mframe_t supertank_frames_attack2[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, supertankRocket), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, supertankRocket), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, supertankRocket), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankRocket), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, supertankRocket), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, supertankRocket), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_attack2 = new mmove_t(FRAME_attak2_1, FRAME_attak2_27, supertank_frames_attack2, supertank_run); static EntThinkAdapter supertank_reattack1 = new EntThinkAdapter() { @@ -770,31 +770,31 @@ public class M_Supertank extends GamePWeapon { static mframe_t supertank_frames_attack1[] = new mframe_t[] { - new mframe_t(ai_charge, 0, supertankMachineGun), - new mframe_t(ai_charge, 0, supertankMachineGun), - new mframe_t(ai_charge, 0, supertankMachineGun), - new mframe_t(ai_charge, 0, supertankMachineGun), - new mframe_t(ai_charge, 0, supertankMachineGun), - new mframe_t(ai_charge, 0, supertankMachineGun), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAIAdapters.ai_charge, 0, supertankMachineGun), }; static mmove_t supertank_move_attack1 = new mmove_t(FRAME_attak1_1, FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1); static mframe_t supertank_frames_end_attack1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t supertank_move_end_attack1 = new mmove_t(FRAME_attak1_7, FRAME_attak1_20, supertank_frames_end_attack1, supertank_run); @@ -840,7 +840,7 @@ public class M_Supertank extends GamePWeapon { float[] org={0,0,0}; int n; - self.think = BossExplode; + self.think = GameAIAdapters.BossExplode; Math3D.VectorCopy(self.s.origin, org); org[2] += 24 + (Lib.rand() & 15); switch (self.count++) { @@ -955,7 +955,7 @@ public class M_Supertank extends GamePWeapon { self.monsterinfo.currentmove = supertank_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); return true; } }; diff --git a/src/jake2/game/M_Tank.java b/src/jake2/game/M_Tank.java index a91b760..26669a3 100644 --- a/src/jake2/game/M_Tank.java +++ b/src/jake2/game/M_Tank.java @@ -19,14 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Tank.java,v 1.1 2004-07-07 19:59:20 hzi Exp $ +// $Id: M_Tank.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; import jake2.util.*; import jake2.util.*; -public class M_Tank extends GamePWeapon { +public class M_Tank extends M_Player { // G:\quake2\baseq2\models/monsters/tank // This file generated by qdata - Do NOT Modify @@ -342,7 +342,7 @@ public class M_Tank extends GamePWeapon { // static EntInteractAdapter tank_sight = new EntInteractAdapter() { - public boolean think(edict_t self, edict_t other) { + public boolean interact(edict_t self, edict_t other) { gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); return true; } @@ -382,36 +382,36 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_stand[] = new mframe_t[] { - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null), - new mframe_t(ai_stand, 0, null)}; + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null), + new mframe_t(GameAIAdapters.ai_stand, 0, null)}; static mmove_t tank_move_stand = new mmove_t(FRAME_stand01, FRAME_stand30, tank_frames_stand, null); static EntThinkAdapter tank_stand = new EntThinkAdapter() { @@ -454,39 +454,39 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_start_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 0, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 11, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_walk, 0, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 11, tank_footstep)}; static mmove_t tank_move_start_walk = new mmove_t(FRAME_walk01, FRAME_walk04, tank_frames_start_walk, tank_walk); static mframe_t tank_frames_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 4, tank_footstep), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 4, null), - new mframe_t(ai_walk, 5, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 7, null), - new mframe_t(ai_walk, 6, null), - new mframe_t(ai_walk, 6, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 4, tank_footstep), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 4, null), + new mframe_t(GameAIAdapters.ai_walk, 5, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 7, null), + new mframe_t(GameAIAdapters.ai_walk, 6, null), + new mframe_t(GameAIAdapters.ai_walk, 6, tank_footstep)}; static mmove_t tank_move_walk = new mmove_t(FRAME_walk05, FRAME_walk20, tank_frames_walk, null); static mframe_t tank_frames_stop_walk[] = new mframe_t[] { - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 3, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 2, null), - new mframe_t(ai_walk, 4, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 3, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 2, null), + new mframe_t(GameAIAdapters.ai_walk, 4, tank_footstep)}; static mmove_t tank_move_stop_walk = new mmove_t(FRAME_walk21, FRAME_walk25, tank_frames_stop_walk, tank_stand); // @@ -495,39 +495,39 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_start_run[] = new mframe_t[] { - new mframe_t(ai_run, 0, null), - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 11, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_run, 0, null), + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 11, tank_footstep)}; static mmove_t tank_move_start_run = new mmove_t(FRAME_walk01, FRAME_walk04, tank_frames_start_run, tank_run); static mframe_t tank_frames_run[] = new mframe_t[] { - new mframe_t(ai_run, 4, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 2, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 4, null), - new mframe_t(ai_run, 4, tank_footstep), - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 4, null), - new mframe_t(ai_run, 5, null), - new mframe_t(ai_run, 7, null), - new mframe_t(ai_run, 7, null), - new mframe_t(ai_run, 6, null), - new mframe_t(ai_run, 6, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_run, 4, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 2, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 4, null), + new mframe_t(GameAIAdapters.ai_run, 4, tank_footstep), + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 4, null), + new mframe_t(GameAIAdapters.ai_run, 5, null), + new mframe_t(GameAIAdapters.ai_run, 7, null), + new mframe_t(GameAIAdapters.ai_run, 7, null), + new mframe_t(GameAIAdapters.ai_run, 6, null), + new mframe_t(GameAIAdapters.ai_run, 6, tank_footstep)}; static mmove_t tank_move_run = new mmove_t(FRAME_walk05, FRAME_walk20, tank_frames_run, null); static mframe_t tank_frames_stop_run[] = new mframe_t[] { - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 3, null), - new mframe_t(ai_run, 2, null), - new mframe_t(ai_run, 2, null), - new mframe_t(ai_run, 4, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 3, null), + new mframe_t(GameAIAdapters.ai_run, 2, null), + new mframe_t(GameAIAdapters.ai_run, 2, null), + new mframe_t(GameAIAdapters.ai_run, 4, tank_footstep)}; static mmove_t tank_move_stop_run = new mmove_t(FRAME_walk21, FRAME_walk25, tank_frames_stop_run, tank_walk); // @@ -536,39 +536,39 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_pain1[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t tank_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain104, tank_frames_pain1, tank_run); static mframe_t tank_frames_pain2[] = new mframe_t[] { - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t tank_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain205, tank_frames_pain2, tank_run); static mframe_t tank_frames_pain3[] = new mframe_t[] { - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, tank_footstep)}; static mmove_t tank_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain316, tank_frames_pain3, tank_run); static EntPainAdapter tank_pain = new EntPainAdapter() { @@ -729,45 +729,45 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_attack_blast[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -2, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, TankBlaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -2, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, TankBlaster), // 10 - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, TankBlaster), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, TankBlaster) // 16 + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, TankBlaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, TankBlaster) // 16 }; static mmove_t tank_move_attack_blast = new mmove_t(FRAME_attak101, FRAME_attak116, tank_frames_attack_blast, tank_reattack_blaster); static mframe_t tank_frames_reattack_blast[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, TankBlaster), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, TankBlaster) // 16) + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, TankBlaster), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, TankBlaster) // 16) }; static mmove_t tank_move_reattack_blast = new mmove_t(FRAME_attak111, FRAME_attak116, tank_frames_reattack_blast, tank_reattack_blaster); - static mframe_t tank_frames_attack_post_blast[] = new mframe_t[] { new mframe_t(ai_move, 0, null), // 17) - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, -2, tank_footstep) // 22 + static mframe_t tank_frames_attack_post_blast[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_move, 0, null), // 17) + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, -2, tank_footstep) // 22 }; static mmove_t tank_move_attack_post_blast = new mmove_t(FRAME_attak117, FRAME_attak122, tank_frames_attack_post_blast, tank_run); @@ -803,123 +803,123 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_attack_strike[] = new mframe_t[] { - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 7, null), - new mframe_t(ai_move, 9, tank_footstep), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 2, tank_footstep), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0, tank_windup), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, TankStrike), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -1, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, -10, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, -2, tank_footstep)}; + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 7, null), + new mframe_t(GameAIAdapters.ai_move, 9, tank_footstep), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 2, tank_footstep), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0, tank_windup), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, TankStrike), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -1, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, -10, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, -2, tank_footstep)}; static mmove_t tank_move_attack_strike = new mmove_t(FRAME_attak201, FRAME_attak238, tank_frames_attack_strike, tank_poststrike); static mframe_t tank_frames_attack_pre_rocket[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), // 10) - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 1, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, 7, null), - new mframe_t(ai_charge, 7, null), - new mframe_t(ai_charge, 7, tank_footstep), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 1, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, 7, null), + new mframe_t(GameAIAdapters.ai_charge, 7, null), + new mframe_t(GameAIAdapters.ai_charge, 7, tank_footstep), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), // 20) - new mframe_t(ai_charge, -3, null)}; + new mframe_t(GameAIAdapters.ai_charge, -3, null)}; static mmove_t tank_move_attack_pre_rocket = new mmove_t(FRAME_attak301, FRAME_attak321, tank_frames_attack_pre_rocket, tank_doattack_rocket); - static mframe_t tank_frames_attack_fire_rocket[] = new mframe_t[] { new mframe_t(ai_charge, -3, null), // Loop Start 22 ) - new mframe_t(ai_charge, 0, null), new mframe_t(ai_charge, 0, TankRocket), // 24) - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, TankRocket), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -1, TankRocket) // 30 Loop End + static mframe_t tank_frames_attack_fire_rocket[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, -3, null), // Loop Start 22 ) + new mframe_t(GameAIAdapters.ai_charge, 0, null), new mframe_t(GameAIAdapters.ai_charge, 0, TankRocket), // 24) + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, TankRocket), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -1, TankRocket) // 30 Loop End }; static mmove_t tank_move_attack_fire_rocket = new mmove_t(FRAME_attak322, FRAME_attak330, tank_frames_attack_fire_rocket, tank_refire_rocket); - static mframe_t tank_frames_attack_post_rocket[] = new mframe_t[] { new mframe_t(ai_charge, 0, null), // 31) - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, 3, null), - new mframe_t(ai_charge, 4, null), - new mframe_t(ai_charge, 2, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + static mframe_t tank_frames_attack_post_rocket[] = new mframe_t[] { new mframe_t(GameAIAdapters.ai_charge, 0, null), // 31) + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, 3, null), + new mframe_t(GameAIAdapters.ai_charge, 4, null), + new mframe_t(GameAIAdapters.ai_charge, 2, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), // 40) - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, -9, null), - new mframe_t(ai_charge, -8, null), - new mframe_t(ai_charge, -7, null), - new mframe_t(ai_charge, -1, null), - new mframe_t(ai_charge, -1, tank_footstep), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, -9, null), + new mframe_t(GameAIAdapters.ai_charge, -8, null), + new mframe_t(GameAIAdapters.ai_charge, -7, null), + new mframe_t(GameAIAdapters.ai_charge, -1, null), + new mframe_t(GameAIAdapters.ai_charge, -1, tank_footstep), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), // 50) - new mframe_t(ai_charge, 0, null), new mframe_t(ai_charge, 0, null), new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), new mframe_t(GameAIAdapters.ai_charge, 0, null), new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t tank_move_attack_post_rocket = new mmove_t(FRAME_attak331, FRAME_attak353, tank_frames_attack_post_rocket, tank_run); static mframe_t tank_frames_attack_chain[] = new mframe_t[] { - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), @@ -939,11 +939,11 @@ public class M_Tank extends GamePWeapon { new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null), - new mframe_t(ai_charge, 0, null)}; + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null), + new mframe_t(GameAIAdapters.ai_charge, 0, null)}; static mmove_t tank_move_attack_chain = new mmove_t(FRAME_attak401, FRAME_attak429, tank_frames_attack_chain, tank_run); @@ -1004,38 +1004,38 @@ public class M_Tank extends GamePWeapon { static mframe_t tank_frames_death1[] = new mframe_t[] { - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 3, null), - new mframe_t(ai_move, 6, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 1, null), - new mframe_t(ai_move, 2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -2, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -3, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -6, null), - new mframe_t(ai_move, -4, null), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, -7, null), - new mframe_t(ai_move, -15, tank_thud), - new mframe_t(ai_move, -5, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null), - new mframe_t(ai_move, 0, null)}; + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 3, null), + new mframe_t(GameAIAdapters.ai_move, 6, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 1, null), + new mframe_t(GameAIAdapters.ai_move, 2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -2, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -3, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -6, null), + new mframe_t(GameAIAdapters.ai_move, -4, null), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, -7, null), + new mframe_t(GameAIAdapters.ai_move, -15, tank_thud), + new mframe_t(GameAIAdapters.ai_move, -5, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null), + new mframe_t(GameAIAdapters.ai_move, 0, null)}; static mmove_t tank_move_death = new mmove_t(FRAME_death101, FRAME_death132, tank_frames_death1, tank_dead); static EntDieAdapter tank_die = new EntDieAdapter() { @@ -1132,7 +1132,7 @@ public class M_Tank extends GamePWeapon { self.monsterinfo.currentmove = tank_move_stand; self.monsterinfo.scale = MODEL_SCALE; - walkmonster_start.think(self); + GameAIAdapters.walkmonster_start.think(self); if (Lib.strcmp(self.classname, "monster_tank_commander") == 0) self.s.skinnum = 2; diff --git a/src/jake2/game/Monster.java b/src/jake2/game/Monster.java index 0b28f4c..5b47fff 100644 --- a/src/jake2/game/Monster.java +++ b/src/jake2/game/Monster.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 17.12.2003 by RST. -// $Id: Monster.java,v 1.1 2004-07-07 19:59:21 hzi Exp $ +// $Id: Monster.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -31,7 +31,8 @@ import jake2.util.*; import java.util.*; -public class Monster extends GameAI{ +public class Monster extends GameAI +{ // FIXME mosnters should call these with a totally accurate direction // and we can mess it up based on skill. Spread should be for normal @@ -45,7 +46,8 @@ public class Monster extends GameAI{ int kick, int hspread, int vspread, - int flashtype) { + int flashtype) + { Fire.fire_bullet(self, start, dir, damage, kick, hspread, vspread, Defines.MOD_UNKNOWN); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -63,7 +65,8 @@ public class Monster extends GameAI{ int hspread, int vspread, int count, - int flashtype) { + int flashtype) + { Fire.fire_shotgun(self, start, aimdir, damage, kick, hspread, vspread, count, Defines.MOD_UNKNOWN); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -79,7 +82,8 @@ public class Monster extends GameAI{ int damage, int speed, int flashtype, - int effect) { + int effect) + { Fire.fire_blaster(self, start, dir, damage, speed, effect, false); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -88,7 +92,8 @@ public class Monster extends GameAI{ GameBase.gi.multicast(start, Defines.MULTICAST_PVS); } /** The Moster fires the grenade. */ - public static void monster_fire_grenade(edict_t self, float[] start, float[] aimdir, int damage, int speed, int flashtype) { + public static void monster_fire_grenade(edict_t self, float[] start, float[] aimdir, int damage, int speed, int flashtype) + { Fire.fire_grenade(self, start, aimdir, damage, speed, 2.5f, damage + 40); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -97,7 +102,8 @@ public class Monster extends GameAI{ GameBase.gi.multicast(start, Defines.MULTICAST_PVS); } /** The Moster fires the rocket. */ - public static void monster_fire_rocket(edict_t self, float[] start, float[] dir, int damage, int speed, int flashtype) { + public static void monster_fire_rocket(edict_t self, float[] start, float[] dir, int damage, int speed, int flashtype) + { Fire.fire_rocket(self, start, dir, damage, speed, damage + 20, damage); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -106,7 +112,8 @@ public class Monster extends GameAI{ GameBase.gi.multicast(start, Defines.MULTICAST_PVS); } /** The Moster fires the railgun. */ - public static void monster_fire_railgun(edict_t self, float[] start, float[] aimdir, int damage, int kick, int flashtype) { + public static void monster_fire_railgun(edict_t self, float[] start, float[] aimdir, int damage, int kick, int flashtype) + { Fire.fire_rail(self, start, aimdir, damage, kick); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -123,7 +130,8 @@ public class Monster extends GameAI{ int speed, int kick, float damage_radius, - int flashtype) { + int flashtype) + { Fire.fire_bfg(self, start, aimdir, damage, speed, damage_radius); GameBase.gi.WriteByte(Defines.svc_muzzleflash2); @@ -139,11 +147,13 @@ public class Monster extends GameAI{ enemy as activator. ================ */ - public static void monster_death_use(edict_t self) { + public static void monster_death_use(edict_t self) + { self.flags &= ~(Defines.FL_FLY | Defines.FL_SWIM); self.monsterinfo.aiflags &= Defines.AI_GOOD_GUY; - if (self.item != null) { + if (self.item != null) + { GameUtil.Drop_Item(self, self.item); self.item = null; } @@ -157,14 +167,16 @@ public class Monster extends GameAI{ GameUtil.G_UseTargets(self, self.enemy); } // ============================================================================ - public static boolean monster_start(edict_t self) { - - if (GameBase.deathmatch.value != 0) { + public static boolean monster_start(edict_t self) + { + if (GameBase.deathmatch.value != 0) + { GameUtil.G_FreeEdict(self); return false; } - if ((self.spawnflags & 4) != 0 && 0 == (self.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) { + if ((self.spawnflags & 4) != 0 && 0 == (self.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) + { self.spawnflags &= ~4; self.spawnflags |= 1; // gi.dprintf("fixed spawnflags on %s at %s\n", self.classname, vtos(self.s.origin)); @@ -178,7 +190,7 @@ public class Monster extends GameAI{ self.s.renderfx |= Defines.RF_FRAMELERP; self.takedamage = Defines.DAMAGE_AIM; self.air_finished = GameBase.level.time + 12; - self.use = GameUtil.monster_use; + self.use = GameUtilAdapters.monster_use; self.max_health = self.health; self.clipmask = Defines.MASK_MONSTERSOLID; @@ -187,13 +199,21 @@ public class Monster extends GameAI{ self.svflags &= ~Defines.SVF_DEADMONSTER; if (null == self.monsterinfo.checkattack) - self.monsterinfo.checkattack = GameUtil.M_CheckAttack; + self.monsterinfo.checkattack = GameUtilAdapters.M_CheckAttack; Math3D.VectorCopy(self.s.origin, self.s.old_origin); - if (GameBase.st.item != null) { + if (GameBase.st.item != null && GameBase.st.item.length()>0 ) + { self.item = GameUtil.FindItemByClassname(GameBase.st.item); - if (self.item != null) - GameBase.gi.dprintf(self.classname + " at " + Lib.vtos(self.s.origin) + " has bad item: " + GameBase.st.item + "\n"); + if (self.item == null) + GameBase.gi.dprintf( + "monster_start:" + + self.classname + + " at " + + Lib.vtos(self.s.origin) + + " has bad item: " + + GameBase.st.item + + "\n"); } // randomize what frame they start on @@ -204,28 +224,27 @@ public class Monster extends GameAI{ return true; } - - - public static void monster_start_go(edict_t self) { + + public static void monster_start_go(edict_t self) + { + float[] v = { 0, 0, 0 }; if (self.health <= 0) return; // check for target to combat_point and change to combattarget - if (self.target != null) { + if (self.target != null) + { boolean notcombat; boolean fixup; edict_t target = null; notcombat = false; fixup = false; - - EdictIterator edit = null; - /* if (true) { Com.Printf("all entities:\n"); - + for (int n = 0; n < Game.globals.num_edicts; n++) { edict_t ent = GameBase.g_edicts[n]; Com.Printf( @@ -235,18 +254,22 @@ public class Monster extends GameAI{ .add(ent.mins[0]).add(ent.mins[1]).add(ent.mins[2]) .add(ent.maxs[0]).add(ent.maxs[1]).add(ent.maxs[2])); } + sleep(10); } - - sleep(10); */ - - while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, self.target)) != null) { + + EdictIterator edit = null; + + while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, self.target)) != null) + { target = edit.o; - if (Lib.strcmp(target.classname, "point_combat") == 0) { + if (Lib.strcmp(target.classname, "point_combat") == 0) + { self.combattarget = self.target; fixup = true; } - else { + else + { notcombat = true; } } @@ -257,14 +280,17 @@ public class Monster extends GameAI{ } // validate combattarget - if (self.combattarget != null) { + if (self.combattarget != null) + { edict_t target = null; EdictIterator edit = null; - while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, self.combattarget)) != null) { + while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, self.combattarget)) != null) + { target = edit.o; - if (Lib.strcmp(target.classname, "point_combat") != 0) { + if (Lib.strcmp(target.classname, "point_combat") != 0) + { GameBase.gi.dprintf( self.classname + " at " @@ -279,90 +305,37 @@ public class Monster extends GameAI{ } } - if (self.target != null) { + if (self.target != null) + { self.goalentity = self.movetarget = GameBase.G_PickTarget(self.target); - if (null == self.movetarget) { + if (null == self.movetarget) + { GameBase.gi.dprintf(self.classname + " can't find target " + self.target + " at " + Lib.vtos(self.s.origin) + "\n"); self.target = null; self.monsterinfo.pausetime = 100000000; self.monsterinfo.stand.think(self); } - else if (Lib.strcmp(self.movetarget.classname, "path_corner") == 0) { + else if (Lib.strcmp(self.movetarget.classname, "path_corner") == 0) + { Math3D.VectorSubtract(self.goalentity.s.origin, self.s.origin, v); self.ideal_yaw = self.s.angles[Defines.YAW] = Math3D.vectoyaw(v); self.monsterinfo.walk.think(self); self.target = null; } - else { + else + { self.goalentity = self.movetarget = null; self.monsterinfo.pausetime = 100000000; self.monsterinfo.stand.think(self); } } - else { + else + { self.monsterinfo.pausetime = 100000000; self.monsterinfo.stand.think(self); } - self.think = Monster.monster_think; + self.think = MonsterAdapters.monster_think; self.nextthink = GameBase.level.time + Defines.FRAMETIME; } - public static EntThinkAdapter monster_think = new EntThinkAdapter() { - public boolean think(edict_t self) { - - M.M_MoveFrame(self); - if (self.linkcount != self.monsterinfo.linkcount) { - self.monsterinfo.linkcount = self.linkcount; - M.M_CheckGround(self); - } - M.M_CatagorizePosition(self); - M.M_WorldEffects(self); - M.M_SetEffects(self); - return true; - } - }; - public static EntThinkAdapter monster_triggered_spawn = new EntThinkAdapter() { - public boolean think(edict_t self) { - - self.s.origin[2] += 1; - GameUtil.KillBox(self); - - self.solid = Defines.SOLID_BBOX; - self.movetype = Defines.MOVETYPE_STEP; - self.svflags &= ~Defines.SVF_NOCLIENT; - self.air_finished = GameBase.level.time + 12; - GameBase.gi.linkentity(self); - - Monster.monster_start_go(self); - - if (self.enemy != null && 0 == (self.spawnflags & 1) && 0 == (self.enemy.flags & Defines.FL_NOTARGET)) { - GameUtil.FoundTarget(self); - } - else { - self.enemy = null; - } - return true; - } - }; - // we have a one frame delay here so we don't telefrag the guy who activated us - public static EntUseAdapter monster_triggered_spawn_use = new EntUseAdapter() { - - public void use(edict_t self, edict_t other, edict_t activator) { - self.think = monster_triggered_spawn; - self.nextthink = GameBase.level.time + Defines.FRAMETIME; - if (activator.client != null) - self.enemy = activator; - self.use = GameUtil.monster_use; - } - }; - public static EntThinkAdapter monster_triggered_start = new EntThinkAdapter() { - public boolean think(edict_t self) { - self.solid = Defines.SOLID_NOT; - self.movetype = Defines.MOVETYPE_NONE; - self.svflags |= Defines.SVF_NOCLIENT; - self.nextthink = 0; - self.use = monster_triggered_spawn_use; - return true; - } - }; } diff --git a/src/jake2/game/MonsterAdapters.java b/src/jake2/game/MonsterAdapters.java new file mode 100644 index 0000000..918ddc4 --- /dev/null +++ b/src/jake2/game/MonsterAdapters.java @@ -0,0 +1,92 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: MonsterAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $ + +package jake2.game; + +import jake2.Defines; +import jake2.client.M; +import jake2.qcommon.Com; + +public class MonsterAdapters { + + public static EntThinkAdapter monster_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + + M.M_MoveFrame(self); + if (self.linkcount != self.monsterinfo.linkcount) { + self.monsterinfo.linkcount = self.linkcount; + M.M_CheckGround(self); + } + M.M_CatagorizePosition(self); + M.M_WorldEffects(self); + M.M_SetEffects(self); + return true; + } + }; + public static EntThinkAdapter monster_triggered_spawn = new EntThinkAdapter() { + public boolean think(edict_t self) { + + self.s.origin[2] += 1; + GameUtil.KillBox(self); + + self.solid = Defines.SOLID_BBOX; + self.movetype = Defines.MOVETYPE_STEP; + self.svflags &= ~Defines.SVF_NOCLIENT; + self.air_finished = GameBase.level.time + 12; + GameBase.gi.linkentity(self); + + Monster.monster_start_go(self); + + if (self.enemy != null && 0 == (self.spawnflags & 1) && 0 == (self.enemy.flags & Defines.FL_NOTARGET)) { + GameUtil.FoundTarget(self); + } + else { + self.enemy = null; + } + return true; + } + }; + // we have a one frame delay here so we don't telefrag the guy who activated us + public static EntUseAdapter monster_triggered_spawn_use = new EntUseAdapter() { + + public void use(edict_t self, edict_t other, edict_t activator) { + self.think = monster_triggered_spawn; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + if (activator.client != null) + self.enemy = activator; + self.use = GameUtilAdapters.monster_use; + } + }; + public static EntThinkAdapter monster_triggered_start = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.index ==312) + Com.p("monster_triggered_start"); + self.solid = Defines.SOLID_NOT; + self.movetype = Defines.MOVETYPE_NONE; + self.svflags |= Defines.SVF_NOCLIENT; + self.nextthink = 0; + self.use = monster_triggered_spawn_use; + return true; + } + }; +} diff --git a/src/jake2/game/PlayerClient.java b/src/jake2/game/PlayerClient.java index 5cf627d..ba75cde 100644 --- a/src/jake2/game/PlayerClient.java +++ b/src/jake2/game/PlayerClient.java @@ -19,98 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.12.2003 by RST. -// $Id: PlayerClient.java,v 1.1 2004-07-07 19:59:22 hzi Exp $ +// $Id: PlayerClient.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; -import jake2.*; -import jake2.client.*; -import jake2.game.*; -import jake2.qcommon.*; -import jake2.render.*; -import jake2.server.*; +import jake2.Defines; +import jake2.util.Lib; +import jake2.util.Math3D; public class PlayerClient extends PlayerHud { - // - // Gross, ugly, disgustuing hack section - // - - // this function is an ugly as hell hack to fix some map flaws - // - // the coop spawn spots on some maps are SNAFU. There are coop spots - // with the wrong targetname as well as spots with no name at all - // - // we use carnal knowledge of the maps to fix the coop spot targetnames to match - // that of the nearest named single player spot - - static EntThinkAdapter SP_FixCoopSpots = new EntThinkAdapter() { - public boolean think(edict_t self) { - - edict_t spot; - float[] d = { 0, 0, 0 }; - - spot = null; - EdictIterator es = null; - - while (true) { - es = G_Find(es, findByClass, "info_player_start"); - spot = es.o; - if (spot == null) - return true; - if (spot.targetname == null) - continue; - VectorSubtract(self.s.origin, spot.s.origin, d); - if (VectorLength(d) < 384) { - if ((self.targetname == null) || Q_stricmp(self.targetname, spot.targetname) != 0) { - // gi.dprintf("FixCoopSpots changed %s at %s targetname from %s to %s\n", self.classname, vtos(self.s.origin), self.targetname, spot.targetname); - self.targetname = spot.targetname; - } - return true; - } - } - return true; - } - }; - - // now if that one wasn't ugly enough for you then try this one on for size - // some maps don't have any coop spots at all, so we need to create them - // where they should have been - - static EntThinkAdapter SP_CreateCoopSpots = new EntThinkAdapter() { - public boolean think(edict_t self) { - - edict_t spot; - - if (Q_stricmp(level.mapname, "security") == 0) { - spot = G_Spawn(); - spot.classname = "info_player_coop"; - spot.s.origin[0] = 188 - 64; - spot.s.origin[1] = -164; - spot.s.origin[2] = 80; - spot.targetname = "jail3"; - spot.s.angles[1] = 90; - - spot = G_Spawn(); - spot.classname = "info_player_coop"; - spot.s.origin[0] = 188 + 64; - spot.s.origin[1] = -164; - spot.s.origin[2] = 80; - spot.targetname = "jail3"; - spot.s.angles[1] = 90; - - spot = G_Spawn(); - spot.classname = "info_player_coop"; - spot.s.origin[0] = 188 + 128; - spot.s.origin[1] = -164; - spot.s.origin[2] = 80; - spot.targetname = "jail3"; - spot.s.angles[1] = 90; - } - return true; - } - }; - /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 32) The normal starting point for a level. */ @@ -119,7 +37,7 @@ public class PlayerClient extends PlayerHud { return; if (Q_stricmp(level.mapname, "security") == 0) { // invoke one of our gross, ugly, disgusting hacks - self.think = SP_CreateCoopSpots; + self.think = PlayerClientAdapters.SP_CreateCoopSpots; self.nextthink = level.time + FRAMETIME; } } @@ -132,7 +50,7 @@ public class PlayerClient extends PlayerHud { G_FreeEdict(self); return; } - SP_misc_teleporter_dest.think(self); + GameMiscAdapters.SP_misc_teleporter_dest.think(self); } /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 32) @@ -160,7 +78,7 @@ public class PlayerClient extends PlayerHud { || (Q_stricmp(level.mapname, "power2") == 0) || (Q_stricmp(level.mapname, "strike") == 0)) { // invoke one of our gross, ugly, disgusting hacks - self.think = SP_FixCoopSpots; + self.think = PlayerClientAdapters.SP_FixCoopSpots; self.nextthink = level.time + FRAMETIME; } } @@ -172,14 +90,6 @@ public class PlayerClient extends PlayerHud { public static void SP_info_player_intermission() { } - //======================================================================= - - static EntPainAdapter player_pain = new EntPainAdapter() { - public void pain(edict_t self, edict_t other, float kick, int damage) { - // player pain is handled at the end of the frame in P_DamageFeedback - } - }; - public static void ClientObituary(edict_t self, edict_t inflictor, edict_t attacker) { int mod; String message; @@ -400,6 +310,10 @@ public class PlayerClient extends PlayerHud { item = FindItem("Blaster"); client.pers.selected_item = ITEM_INDEX(item); client.pers.inventory[client.pers.selected_item] = 1; + + item = FindItem("Shotgun"); + client.pers.selected_item = ITEM_INDEX(item); + client.pers.inventory[client.pers.selected_item] = 1; client.pers.weapon = item; @@ -634,7 +548,6 @@ public class PlayerClient extends PlayerHud { } } - return spot; } /* @@ -695,22 +608,6 @@ public class PlayerClient extends PlayerHud { } } - static EntDieAdapter body_die = new EntDieAdapter() { - public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { - - int n; - - if (self.health < -40) { - 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); - self.s.origin[2] -= 48; - ThrowClientHead(self, damage); - self.takedamage = DAMAGE_NO; - } - } - }; - public static void CopyToBodyQue(edict_t ent) { edict_t body; @@ -739,7 +636,7 @@ public class PlayerClient extends PlayerHud { body.owner = ent.owner; body.movetype = ent.movetype; - body.die = body_die; + body.die = PlayerClientAdapters.body_die; body.takedamage = DAMAGE_YES; gi.linkentity(body); @@ -872,7 +769,7 @@ public class PlayerClient extends PlayerHud { float[] spawn_origin = { 0, 0, 0 }, spawn_angles = { 0, 0, 0 }; gclient_t client; int i; - client_persistant_t saved; + client_persistant_t saved = new client_persistant_t(); client_respawn_t resp = new client_respawn_t(); // find a spawn point @@ -888,7 +785,7 @@ public class PlayerClient extends PlayerHud { String userinfo; //char userinfo[MAX_INFO_STRING]; - resp = client.resp; + resp.set(client.resp); userinfo = client.pers.userinfo; //memcpy(userinfo, client.pers.userinfo, sizeof(userinfo)); @@ -900,7 +797,7 @@ public class PlayerClient extends PlayerHud { //char userinfo[MAX_INFO_STRING]; String userinfo; - resp = client.resp; + resp.set(client.resp); //memcpy(userinfo, client.pers.userinfo, sizeof(userinfo)); userinfo = client.pers.userinfo; // this is kind of ugly, but it's how we want to handle keys in coop @@ -911,7 +808,7 @@ public class PlayerClient extends PlayerHud { // } resp.coop_respawn.game_helpchanged = client.pers.game_helpchanged; resp.coop_respawn.helpchanged = client.pers.helpchanged; - client.pers = resp.coop_respawn; + client.pers.set(resp.coop_respawn); userinfo = ClientUserinfoChanged(ent, userinfo); if (resp.score > client.pers.score) client.pers.score = resp.score; @@ -922,13 +819,14 @@ public class PlayerClient extends PlayerHud { } // clear everything but the persistant data - saved = client.pers; + saved.set(client.pers); //memset(client, 0, sizeof(* client)); client.clear(); - client.pers = saved; + client.pers.set(saved); if (client.pers.health <= 0) InitClientPersistant(client); - client.resp = resp; + + client.resp.set(resp); // copy some data from the client to the entity FetchClientEntData(ent); @@ -947,8 +845,8 @@ public class PlayerClient extends PlayerHud { ent.air_finished = level.time + 12; ent.clipmask = MASK_PLAYERSOLID; ent.model = "players/male/tris.md2"; - ent.pain = player_pain; - ent.die = player_die; + ent.pain = PlayerClientAdapters.player_pain; + ent.die = GameAIAdapters.player_die; ent.waterlevel = 0; ent.watertype = 0; ent.flags &= ~FL_NO_KNOCKBACK; @@ -1026,7 +924,7 @@ public class PlayerClient extends PlayerHud { // force the current weapon up client.newweapon = client.pers.weapon; - ChangeWeapon(ent); + GamePWeapon.ChangeWeapon(ent); } /* @@ -1178,7 +1076,7 @@ public class PlayerClient extends PlayerHud { // handedness s = Info.Info_ValueForKey(userinfo, "hand"); - if (strlen(s) > 0) { + if (s.length() > 0) { ent.client.pers.hand = atoi(s); } @@ -1295,22 +1193,6 @@ public class PlayerClient extends PlayerHud { gi.configstring(CS_PLAYERSKINS + playernum, ""); } - //============================================================== - - private static edict_t pm_passent; - - // pmove doesn't need to know about passent and contentmask - public static pmove_t.TraceAdapter PM_trace = new pmove_t.TraceAdapter() { - - public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end) { - if (pm_passent.health > 0) - return gi.trace(start, mins, maxs, end, pm_passent, MASK_PLAYERSOLID); - else - return gi.trace(start, mins, maxs, end, pm_passent, MASK_DEADSOLID); - } - - }; - /* static int CheckBlock(, int c) { int v, i; @@ -1354,7 +1236,7 @@ public class PlayerClient extends PlayerHud { return; } - pm_passent = ent; + PlayerClientAdapters.pm_passent = ent; if (ent.client.chase_target != null) { @@ -1394,7 +1276,7 @@ public class PlayerClient extends PlayerHud { // this should be a copy pm.cmd.set(ucmd); - pm.trace = PM_trace; // adds default parms + pm.trace = PlayerClientAdapters.PM_trace; // adds default parms pm.pointcontents = gi.pointcontents; // perform a pmove @@ -1453,7 +1335,7 @@ public class PlayerClient extends PlayerHud { continue; // duplicated if (other.touch == null) continue; - other.touch.touch(other, ent, null, null); + other.touch.touch(other, ent, GameBase.dummyplane, null); } } @@ -1482,7 +1364,7 @@ public class PlayerClient extends PlayerHud { } else if (!client.weapon_thunk) { client.weapon_thunk = true; - Think_Weapon(ent); + GamePWeapon.Think_Weapon(ent); } } @@ -1534,7 +1416,7 @@ public class PlayerClient extends PlayerHud { // run weapon animations if it hasn't been done by a ucmd_t if (!client.weapon_thunk && !client.resp.spectator) - Think_Weapon(ent); + GamePWeapon.Think_Weapon(ent); else client.weapon_thunk = false; diff --git a/src/jake2/game/PlayerClientAdapters.java b/src/jake2/game/PlayerClientAdapters.java new file mode 100644 index 0000000..1f29b88 --- /dev/null +++ b/src/jake2/game/PlayerClientAdapters.java @@ -0,0 +1,146 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 26.02.2004 by RST. +// $Id: PlayerClientAdapters.java,v 1.1 2004-07-08 15:58:43 hzi Exp $ + +package jake2.game; + +import jake2.game.pmove_t.TraceAdapter; + +import jake2.Defines; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class PlayerClientAdapters extends PlayerClient { + + // + // Gross, ugly, disgustuing hack section + // + + // this function is an ugly as hell hack to fix some map flaws + // + // the coop spawn spots on some maps are SNAFU. There are coop spots + // with the wrong targetname as well as spots with no name at all + // + // we use carnal knowledge of the maps to fix the coop spot targetnames to match + // that of the nearest named single player spot + + static EntThinkAdapter SP_FixCoopSpots = new EntThinkAdapter() { + public boolean think(edict_t self) { + + edict_t spot; + float[] d = { 0, 0, 0 }; + + spot = null; + EdictIterator es = null; + + while (true) { + es = GameBase.G_Find(es, GameBase.findByClass, "info_player_start"); + spot = es.o; + if (spot == null) + return true; + if (spot.targetname == null) + continue; + Math3D.VectorSubtract(self.s.origin, spot.s.origin, d); + if (Math3D.VectorLength(d) < 384) { + if ((self.targetname == null) || Lib.Q_stricmp(self.targetname, spot.targetname) != 0) { + // gi.dprintf("FixCoopSpots changed %s at %s targetname from %s to %s\n", self.classname, vtos(self.s.origin), self.targetname, spot.targetname); + self.targetname = spot.targetname; + } + return true; + } + } + } + }; + // now if that one wasn't ugly enough for you then try this one on for size + // some maps don't have any coop spots at all, so we need to create them + // where they should have been + + static EntThinkAdapter SP_CreateCoopSpots = new EntThinkAdapter() { + public boolean think(edict_t self) { + + edict_t spot; + + if (Lib.Q_stricmp(GameBase.level.mapname, "security") == 0) { + spot = GameUtil.G_Spawn(); + spot.classname = "info_player_coop"; + spot.s.origin[0] = 188 - 64; + spot.s.origin[1] = -164; + spot.s.origin[2] = 80; + spot.targetname = "jail3"; + spot.s.angles[1] = 90; + + spot = GameUtil.G_Spawn(); + spot.classname = "info_player_coop"; + spot.s.origin[0] = 188 + 64; + spot.s.origin[1] = -164; + spot.s.origin[2] = 80; + spot.targetname = "jail3"; + spot.s.angles[1] = 90; + + spot = GameUtil.G_Spawn(); + spot.classname = "info_player_coop"; + spot.s.origin[0] = 188 + 128; + spot.s.origin[1] = -164; + spot.s.origin[2] = 80; + spot.targetname = "jail3"; + spot.s.angles[1] = 90; + } + return true; + } + }; + //======================================================================= + + static EntPainAdapter player_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + // player pain is handled at the end of the frame in P_DamageFeedback + } + }; + static EntDieAdapter body_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { + + int n; + + if (self.health < -40) { + GameBase.gi.sound(self, Defines.CHAN_BODY, GameBase.gi.soundindex("misc/udeath.wav"), 1, Defines.ATTN_NORM, 0); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); + self.s.origin[2] -= 48; + GameAI.ThrowClientHead(self, damage); + self.takedamage = Defines.DAMAGE_NO; + } + } + }; + //============================================================== + + static edict_t pm_passent; + // pmove doesn't need to know about passent and contentmask + public static pmove_t.TraceAdapter PM_trace = new pmove_t.TraceAdapter() { + + public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end) { + if (pm_passent.health > 0) + return GameBase.gi.trace(start, mins, maxs, end, pm_passent, Defines.MASK_PLAYERSOLID); + else + return GameBase.gi.trace(start, mins, maxs, end, pm_passent, Defines.MASK_DEADSOLID); + } + + }; +} diff --git a/src/jake2/game/PlayerHud.java b/src/jake2/game/PlayerHud.java index ff02e75..b9622e3 100644 --- a/src/jake2/game/PlayerHud.java +++ b/src/jake2/game/PlayerHud.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.12.2003 by RST. -// $Id: PlayerHud.java,v 1.1 2004-07-07 19:59:23 hzi Exp $ +// $Id: PlayerHud.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -98,7 +98,14 @@ public class PlayerHud extends GameTarget { } level.intermissiontime = level.time; - level.changemap = targ.map; + + // TODO: BIG HACK TO IGNORE CINEMATIC + String xxx = targ.map; + int pos = xxx.indexOf(".cin"); + if (pos != -1) + level.changemap = xxx.substring(pos + 5); // including "+" + else + level.changemap = xxx; if (level.changemap.indexOf('*') > -1) { if (coop.value != 0) { @@ -107,8 +114,8 @@ public class PlayerHud extends GameTarget { if (!client.inuse) continue; // strip players of all keys between units - for (n = 0; n < MAX_ITEMS; n++) { - if ((itemlist[n].flags & IT_KEY) != 0) + for (n = 1; n < MAX_ITEMS; n++) { + if ((GameAI.itemlist[n].flags & IT_KEY) != 0) client.client.pers.inventory[n] = 0; } } @@ -410,7 +417,7 @@ public class PlayerHud extends GameTarget { ent.client.ps.stats[STAT_AMMO] = 0; } else { - item = itemlist[ent.client.ammo_index]; + item = GameAI.itemlist[ent.client.ammo_index]; ent.client.ps.stats[STAT_AMMO_ICON] = (short) gi.imageindex(item.icon); ent.client.ps.stats[STAT_AMMO] = (short) ent.client.pers.inventory[ent.client.ammo_index]; } @@ -483,7 +490,7 @@ public class PlayerHud extends GameTarget { if (ent.client.pers.selected_item <= 0) ent.client.ps.stats[STAT_SELECTED_ICON] = 0; else - ent.client.ps.stats[STAT_SELECTED_ICON] = (short) gi.imageindex(itemlist[ent.client.pers.selected_item].icon); + ent.client.ps.stats[STAT_SELECTED_ICON] = (short) gi.imageindex(GameAI.itemlist[ent.client.pers.selected_item].icon); ent.client.ps.stats[STAT_SELECTED_ITEM] = (short) ent.client.pers.selected_item; diff --git a/src/jake2/game/client_persistant_t.java b/src/jake2/game/client_persistant_t.java index 50ee120..944767e 100644 --- a/src/jake2/game/client_persistant_t.java +++ b/src/jake2/game/client_persistant_t.java @@ -19,17 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: client_persistant_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ +// $Id: client_persistant_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; +import jake2.Defines; +import jake2.util.Lib; + import java.io.IOException; import java.nio.ByteBuffer; -import jake2.*; -import jake2.*; -import jake2.util.Lib; - public class client_persistant_t implements Cloneable { public client_persistant_t getClone() { @@ -40,6 +39,32 @@ public class client_persistant_t implements Cloneable { return null; } } + + public void set(client_persistant_t from) + { + userinfo = from.userinfo; + netname = from.netname; + hand = from.hand; + connected = from.connected; + health = from.health; + max_health = from.max_health; + savedFlags = from.savedFlags; + selected_item = from.selected_item; + inventory = Lib.clone(from.inventory); + max_bullets = from.max_bullets; + max_shells = from.max_shells; + max_rockets = from.max_rockets; + max_grenades = from.max_grenades; + max_cells = from.max_cells; + max_slugs = from.max_slugs; + weapon = from.weapon; + lastweapon = from.lastweapon; + power_cubes = from.power_cubes; + score = from.score; + game_helpchanged = from.game_helpchanged; + helpchanged = from.helpchanged; + spectator = from.spectator; + } // client data that stays across multiple level loads String userinfo = ""; @@ -64,18 +89,14 @@ public class client_persistant_t implements Cloneable { int max_grenades; int max_cells; int max_slugs; - //pointer gitem_t weapon; //pointer gitem_t lastweapon; - int power_cubes; // used for tracking the cubes in coop games int score; // for calculating total unit score in coop games - int game_helpchanged; int helpchanged; - boolean spectator; // client is a spectator public void load(ByteBuffer bb) throws IOException { @@ -103,8 +124,8 @@ public class client_persistant_t implements Cloneable { max_cells = bb.getInt(); max_slugs = bb.getInt(); - weapon = GameTarget.itemlist[bb.getInt()]; - lastweapon = GameTarget.itemlist[bb.getInt()]; + weapon = GameAI.itemlist[bb.getInt()]; + lastweapon = GameAI.itemlist[bb.getInt()]; power_cubes = bb.getInt(); score = bb.getInt(); diff --git a/src/jake2/game/client_respawn_t.java b/src/jake2/game/client_respawn_t.java index ae89e89..f24a15c 100644 --- a/src/jake2/game/client_respawn_t.java +++ b/src/jake2/game/client_respawn_t.java @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: client_respawn_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ +// $Id: client_respawn_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -31,14 +31,24 @@ import java.nio.ByteBuffer; public class client_respawn_t // client data that stays across deathmatch respawns { - client_persistant_t coop_respawn= new client_persistant_t(); // what to set client->pers to on a respawn + client_persistant_t coop_respawn = new client_persistant_t(); // what to set client->pers to on a respawn int enterframe; // level.framenum the client entered the game int score; // frags, etc float cmd_angles[] = { 0, 0, 0 }; // angles sent over in the last command boolean spectator; // client is a spectator + public void set(client_respawn_t from) + { + coop_respawn.set(from.coop_respawn); + enterframe = from.enterframe; + score = from.score; + cmd_angles = Lib.clone(cmd_angles); + spectator = from.spectator; + } + //ok - public void clear() { + public void clear() + { coop_respawn = new client_persistant_t(); enterframe = 0; score = 0; @@ -46,25 +56,22 @@ public class client_respawn_t spectator = false; } - public void load(ByteBuffer bb) throws IOException { + public void load(ByteBuffer bb) throws IOException + { coop_respawn.load(bb); - enterframe = bb.getInt(); score = bb.getInt(); - cmd_angles[0] = bb.getFloat(); cmd_angles[1] = bb.getFloat(); cmd_angles[2] = bb.getFloat(); - spectator = bb.getInt() != 0; } - public void dump() { + public void dump() + { coop_respawn.dump(); - Com.Println("enterframe: " + enterframe); Com.Println("score: " + score); - Lib.printv("cmd_angles", cmd_angles); Com.Println("spectator: " + spectator); } diff --git a/src/jake2/game/cmdalias_t.java b/src/jake2/game/cmdalias_t.java index c52356b..2468c9d 100644 --- a/src/jake2/game/cmdalias_t.java +++ b/src/jake2/game/cmdalias_t.java @@ -18,15 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created by HOZ. -// $Id: cmdalias_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ +// $Id: cmdalias_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -/** - * cmdalias_t - */ -public final class cmdalias_t { +public final class cmdalias_t +{ public cmdalias_t next; - public String name=""; + public String name = ""; public String value; } diff --git a/src/jake2/game/cmodel_t.java b/src/jake2/game/cmodel_t.java index 47d8243..bac0f31 100644 --- a/src/jake2/game/cmodel_t.java +++ b/src/jake2/game/cmodel_t.java @@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.11.2003 by RST. -// $Id: cmodel_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ - +// $Id: cmodel_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class cmodel_t { +public class cmodel_t +{ public float[] mins = { 0, 0, 0 }; public float[] maxs = { 0, 0, 0 }; public float[] origin = { 0, 0, 0 }; // for sounds or lights diff --git a/src/jake2/game/cplane_t.java b/src/jake2/game/cplane_t.java index ab1f5ac..2eb29e9 100644 --- a/src/jake2/game/cplane_t.java +++ b/src/jake2/game/cplane_t.java @@ -19,22 +19,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: cplane_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ +// $Id: cplane_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; import jake2.util.Lib; import jake2.util.Math3D; -public class cplane_t { - +public class cplane_t +{ public float normal[] = new float[3]; public float dist; public byte type; // for fast side tests public byte signbits; // signx + (signy<<1) + (signz<<1) public byte pad[] = { 0, 0 }; - public cplane_t getClone() { + public cplane_t getClone() + { cplane_t out = new cplane_t(); out.normal = Lib.clone(normal); out.dist = dist; @@ -45,7 +46,8 @@ public class cplane_t { return out; } - public void set(cplane_t c) { + public void set(cplane_t c) + { Math3D.set(normal, c.normal); dist = c.dist; diff --git a/src/jake2/game/csurface_t.java b/src/jake2/game/csurface_t.java index deb877f..9fa4bfa 100644 --- a/src/jake2/game/csurface_t.java +++ b/src/jake2/game/csurface_t.java @@ -19,10 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: csurface_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ +// $Id: csurface_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class csurface_t { +public class csurface_t +{ public String name = ""; public int flags; public int value; diff --git a/src/jake2/game/cvar_t.java b/src/jake2/game/cvar_t.java index d7b1ebd..d343bef 100644 --- a/src/jake2/game/cvar_t.java +++ b/src/jake2/game/cvar_t.java @@ -2,9 +2,9 @@ * cvar_t.java * Copyright (C) 2003 * - * $Id: cvar_t.java,v 1.1 2004-07-07 19:59:24 hzi Exp $ + * $Id: cvar_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ */ - /* +/* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or @@ -26,10 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.game; /** - * cvar_t implements the struct cvar_t of the - * C version + * cvar_t implements the struct cvar_t of the C version */ -public final class cvar_t { +public final class cvar_t +{ public String name; public String string; public String latched_string; diff --git a/src/jake2/game/edict_t.java b/src/jake2/game/edict_t.java index 0c89c87..229b18b 100644 --- a/src/jake2/game/edict_t.java +++ b/src/jake2/game/edict_t.java @@ -26,7 +26,6 @@ import jake2.util.*; public class edict_t { public edict_t(int i) { - s.number = i; index = i; } @@ -67,13 +66,13 @@ public class edict_t { public int movetype; public int flags; - public String model = ""; + public String model = null; public float freetime; // sv.time when the object was freed // // only used locally in game, not by server // - public String message = ""; + public String message = null; public String classname = ""; public int spawnflags; diff --git a/src/jake2/game/entity_state_t.java b/src/jake2/game/entity_state_t.java index a606b74..25c3162 100644 --- a/src/jake2/game/entity_state_t.java +++ b/src/jake2/game/entity_state_t.java @@ -19,21 +19,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 08.11.2003 by RST. -// $Id: entity_state_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: entity_state_t.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ package jake2.game; import jake2.util.Math3D; -public class entity_state_t implements Cloneable { +public class entity_state_t implements Cloneable +{ // entity_state_t is the information conveyed from the server // in an update message about entities that the client will // need to render in some way - public entity_state_t(edict_t ent) { - this.surrounding_ent = ent; + this.surrounding_ent = ent; } public int number = -99999; // edict index @@ -63,7 +63,8 @@ public class entity_state_t implements Cloneable { return out; } - public void set(entity_state_t from) { + public void set(entity_state_t from) + { number = from.number; Math3D.VectorCopy(from.origin, origin); Math3D.VectorCopy(from.angles, angles); diff --git a/src/jake2/game/field_t.java b/src/jake2/game/field_t.java index c880a05..ecdf156 100644 --- a/src/jake2/game/field_t.java +++ b/src/jake2/game/field_t.java @@ -18,20 +18,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 20.11.2003 by RST -// $Id: field_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: field_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -public class field_t { - - public field_t(String name, int type, int flags) { - +public class field_t +{ + public field_t(String name, int type, int flags) + { this.name = name; this.type = type; this.flags = flags; } - public field_t(String name, int type) { + public field_t(String name, int type) + { this.name = name; this.type = type; diff --git a/src/jake2/game/game_export_t.java b/src/jake2/game/game_export_t.java index 4f8369c..792b785 100644 --- a/src/jake2/game/game_export_t.java +++ b/src/jake2/game/game_export_t.java @@ -19,34 +19,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: game_export_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: game_export_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; -import jake2.Defines; import jake2.qcommon.Com; - // //functions exported by the game subsystem // -public class game_export_t { +public class game_export_t +{ public int apiversion; // the init function will only be called when a game starts, // not each time a level is loaded. Persistant data for clients // and the server can be allocated in init - public void Init() { + public void Init() + { Game.InitGame(); } - public void Shutdown() { + public void Shutdown() + { Game.ShutdownGame(); } // each new level entered will cause a call to SpawnEntities - public void SpawnEntities(String mapname, String entstring, String spawnpoint) { + public void SpawnEntities(String mapname, String entstring, String spawnpoint) + { Game.SpawnEntities(mapname, entstring, spawnpoint); } @@ -54,45 +56,59 @@ public class game_export_t { // about the world state and the clients. // WriteGame is called every time a level is exited. // ReadGame is called on a loadgame. - public void WriteGame(String filename, boolean autosave) { - Com.Error(Defines.ERR_FATAL, "WriteGame not implemnted!"); + public void WriteGame(String filename, boolean autosave) + { + // TODO WriteGame not implemnted! + Com.Println("WriteGame not implemnted!"); } - - public void ReadGame(String filename) { + + public void ReadGame(String filename) + { Game.ReadGame(filename); } // ReadLevel is called after the default map information has been // loaded with SpawnEntities - public void WriteLevel(String filename) { - Com.Error(Defines.ERR_FATAL, "WriteLevel not implemnted!"); + public void WriteLevel(String filename) + { + // TODO WriteLevel not implemented! + Com.Println("WriteLevel not implemented!"); } - public void ReadLevel(String filename) { - Com.Error(Defines.ERR_FATAL, "ReadLevel not implemnted!"); + public void ReadLevel(String filename) + { + // TODO ReadLevel not implemnted! + Com.Println("ReadLevel not implemnted!"); } - public boolean ClientConnect(edict_t ent, String userinfo) { + public boolean ClientConnect(edict_t ent, String userinfo) + { return PlayerClient.ClientConnect(ent, userinfo); } - public void ClientBegin(edict_t ent) { + public void ClientBegin(edict_t ent) + { PlayerClient.ClientBegin(ent); } - public void ClientUserinfoChanged(edict_t ent, String userinfo) { + public void ClientUserinfoChanged(edict_t ent, String userinfo) + { PlayerClient.ClientUserinfoChanged(ent, userinfo); } - public void ClientDisconnect(edict_t ent) { + public void ClientDisconnect(edict_t ent) + { PlayerClient.ClientDisconnect(ent); } - public void ClientCommand(edict_t ent) { + public void ClientCommand(edict_t ent) + { PlayerClient.ClientCommand(ent); } - - public void ClientThink(edict_t ent, usercmd_t cmd) { + + public void ClientThink(edict_t ent, usercmd_t cmd) + { PlayerClient.ClientThink(ent, cmd); } - public void RunFrame() { + public void RunFrame() + { Game.G_RunFrame(); } @@ -100,7 +116,8 @@ public class game_export_t { // server console. // the game can issue gi.argc() / gi.argv() commands to get the rest // of the parameters - public void ServerCommand() { + public void ServerCommand() + { Game.ServerCommand(); } @@ -110,7 +127,7 @@ public class game_export_t { // the edict array is allocated in the game dll so it // can vary in size from one game to another. - + // the size will be fixed when ge.Init() is called public edict_t edicts[] = Game.g_edicts; public int num_edicts; // current number, <= max_edicts diff --git a/src/jake2/game/game_import_t.java b/src/jake2/game/game_import_t.java index 7ac52d5..8c7bd5f 100644 --- a/src/jake2/game/game_import_t.java +++ b/src/jake2/game/game_import_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: game_import_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: game_import_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -30,7 +30,6 @@ import jake2.qcommon.Cbuf; import jake2.qcommon.Com; import jake2.qcommon.Cvar; import jake2.qcommon.PMove; -import jake2.server.SV; import jake2.server.SV_GAME; import jake2.server.SV_INIT; import jake2.server.SV_SEND; @@ -39,23 +38,29 @@ import jake2.server.SV_WORLD; // // collection of functions provided by the main engine // -public class game_import_t { +public class game_import_t +{ // R S T: SEE SV_InitGameProgs() ! // special messages - public void bprintf(int printlevel, String s) { + public void bprintf(int printlevel, String s) + { SV_SEND.SV_BroadcastPrintf(printlevel, s); } - public void dprintf(String s) { + public void dprintf(String s) + { SV_SEND.PF_dprintf(s); } - public void cprintf(edict_t ent, int printlevel, String s) { + public void cprintf(edict_t ent, int printlevel, String s) + { SV_GAME.PF_cprintf(ent, printlevel, s); } - public void centerprintf(edict_t ent, String s) { + public void centerprintf(edict_t ent, String s) + { SV_GAME.PF_centerprintf(ent, s); } - public void sound(edict_t ent, int channel, int soundindex, float volume, float attenuation, float timeofs) { + public void sound(edict_t ent, int channel, int soundindex, float volume, float attenuation, float timeofs) + { SV_GAME.PF_StartSound(ent, channel, soundindex, volume, attenuation, timeofs); } public void positioned_sound( @@ -65,7 +70,8 @@ public class game_import_t { int soundinedex, float volume, float attenuation, - float timeofs) { + float timeofs) + { SV_SEND.SV_StartSound(origin, ent, channel, soundinedex, volume, attenuation, timeofs); } @@ -74,164 +80,202 @@ public class game_import_t { // and misc data like the sky definition and cdtrack. // All of the current configstrings are sent to clients when // they connect, and changes are sent to all connected clients. - public void configstring(int num, String string) { + public void configstring(int num, String string) + { //Com.Error(Defines.ERR_FATAL,"method is not implemented!"); SV_GAME.PF_Configstring(num, string); } - public void error(String err) { + public void error(String err) + { Com.Error(Defines.ERR_FATAL, err); } - public void error(int level, String err) { + public void error(int level, String err) + { SV_GAME.PF_error(level, err); } // the *index functions create configstrings and some internal server state - public int modelindex(String name) { + public int modelindex(String name) + { return SV_INIT.SV_ModelIndex(name); } - public int soundindex(String name) { + public int soundindex(String name) + { return SV_INIT.SV_SoundIndex(name); } - public int imageindex(String name) { + public int imageindex(String name) + { return SV_INIT.SV_ImageIndex(name); } - public void setmodel(edict_t ent, String name) { + public void setmodel(edict_t ent, String name) + { SV_GAME.PF_setmodel(ent, name); } // collision detection - public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passent, int contentmask) { + public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passent, int contentmask) + { return SV_WORLD.SV_Trace(start, mins, maxs, end, passent, contentmask); } public pmove_t.PointContentsAdapter pointcontents; - public boolean inPVS(float[] p1, float[] p2) { + public boolean inPVS(float[] p1, float[] p2) + { return SV_GAME.PF_inPVS(p1, p2); } - public boolean inPHS(float[] p1, float[] p2) { + public boolean inPHS(float[] p1, float[] p2) + { return SV_GAME.PF_inPHS(p1, p2); } - public void SetAreaPortalState(int portalnum, boolean open) { + public void SetAreaPortalState(int portalnum, boolean open) + { CM.CM_SetAreaPortalState(portalnum, open); } - public boolean AreasConnected(int area1, int area2) { + public boolean AreasConnected(int area1, int area2) + { return CM.CM_AreasConnected(area1, area2); } // an entity will never be sent to a client or used for collision // if it is not passed to linkentity. If the size, position, or // solidity changes, it must be relinked. - public void linkentity(edict_t ent) { + public void linkentity(edict_t ent) + { SV_WORLD.SV_LinkEdict(ent); } - public void unlinkentity(edict_t ent) { + public void unlinkentity(edict_t ent) + { SV_WORLD.SV_UnlinkEdict(ent); } // call before removing an interactive edict - public int BoxEdicts(float[] mins, float[] maxs, edict_t list[], int maxcount, int areatype) { + public int BoxEdicts(float[] mins, float[] maxs, edict_t list[], int maxcount, int areatype) + { return SV_WORLD.SV_AreaEdicts(mins, maxs, list, maxcount, areatype); } - public void Pmove(pmove_t pmove) { + public void Pmove(pmove_t pmove) + { PMove.Pmove(pmove); } // player movement code common with client prediction // network messaging - public void multicast(float[] origin, int to) { + public void multicast(float[] origin, int to) + { SV_SEND.SV_Multicast(origin, to); } - public void unicast(edict_t ent, boolean reliable) { + public void unicast(edict_t ent, boolean reliable) + { SV_GAME.PF_Unicast(ent, reliable); } - public void WriteChar(int c) { + public void WriteChar(int c) + { SV_GAME.PF_WriteChar(c); } - public void WriteByte(int c) { + public void WriteByte(int c) + { SV_GAME.PF_WriteByte(c); } - public void WriteShort(int c) { + public void WriteShort(int c) + { SV_GAME.PF_WriteShort(c); } - public void WriteLong(int c) { + public void WriteLong(int c) + { SV_GAME.PF_WriteLong(c); } - public void WriteFloat(float f) { + public void WriteFloat(float f) + { SV_GAME.PF_WriteFloat(f); } - public void WriteString(String s) { + public void WriteString(String s) + { SV_GAME.PF_WriteString(s); } - public void WritePosition(float[] pos) { + public void WritePosition(float[] pos) + { SV_GAME.PF_WritePos(pos); } // some fractional bits - public void WriteDir(float[] pos) { + public void WriteDir(float[] pos) + { SV_GAME.PF_WriteDir(pos); } // single byte encoded, very coarse - public void WriteAngle(float f) { + public void WriteAngle(float f) + { Com.Error(Defines.ERR_FATAL, "method is not implemented!"); } // managed memory allocation - public void TagMalloc(int size, int tag) { + public void TagMalloc(int size, int tag) + { Com.Error(Defines.ERR_FATAL, "method is not implemented!"); } - public void TagFree(Object block) { + public void TagFree(Object block) + { Com.Error(Defines.ERR_FATAL, "method is not implemented!"); } - public void FreeTags(int tag) { + public void FreeTags(int tag) + { Com.Error(Defines.ERR_FATAL, "method is not implemented!"); } // console variable interaction - public cvar_t cvar(String var_name, String value, int flags) { + public cvar_t cvar(String var_name, String value, int flags) + { return Cvar.Get(var_name, value, flags); } - public cvar_t cvar_set(String var_name, String value) { + public cvar_t cvar_set(String var_name, String value) + { return Cvar.Set(var_name, value); //return null; } - public cvar_t cvar_forceset(String var_name, String value) { + public cvar_t cvar_forceset(String var_name, String value) + { return Cvar.ForceSet(var_name, value); } // ClientCommand and ServerCommand parameter access - public int argc() { + public int argc() + { return Cmd.Argc(); } - public String argv(int n) { + public String argv(int n) + { return Cmd.Argv(n); } // concatenation of all argv >= 1 - public String args() { + public String args() + { return Cmd.Args(); } // add commands to the server console as if they were typed in // for map changing, etc - public void AddCommandString(String text) { + public void AddCommandString(String text) + { Cbuf.AddText(text); } - public void DebugGraph(float value, int color) { + public void DebugGraph(float value, int color) + { SCR.DebugGraph(value, color); } } diff --git a/src/jake2/game/game_locals_t.java b/src/jake2/game/game_locals_t.java index 00d56d5..3a04445 100644 --- a/src/jake2/game/game_locals_t.java +++ b/src/jake2/game/game_locals_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: game_locals_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: game_locals_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -30,15 +30,16 @@ import jake2.util.Lib; import java.io.IOException; import java.nio.ByteBuffer; -public class game_locals_t extends Defines { +public class game_locals_t extends Defines +{ // // this structure is left intact through an entire game // it should be initialized at dll load time, and read/written to // the server.ssv file for savegames // - public String helpmessage1=""; - public String helpmessage2=""; + public String helpmessage1 = ""; + public String helpmessage2 = ""; public int helpchanged; // flash F1 icon if non 0, play sound // and increment only if 1, 2, or 3 @@ -59,7 +60,8 @@ public class game_locals_t extends Defines { public int num_items; public boolean autosaved; - public void load(ByteBuffer bb) throws IOException { + public void load(ByteBuffer bb) throws IOException + { String date = Lib.readString(bb, 16); helpmessage1 = Lib.readString(bb, 512); @@ -77,7 +79,8 @@ public class game_locals_t extends Defines { } - public void dump() { + public void dump() + { Com.Println("String helpmessage1: " + helpmessage1); Com.Println("String helpmessage2: " + helpmessage2); diff --git a/src/jake2/game/gclient_t.java b/src/jake2/game/gclient_t.java index ccad5aa..ce0a491 100644 --- a/src/jake2/game/gclient_t.java +++ b/src/jake2/game/gclient_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: gclient_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: gclient_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -30,9 +30,11 @@ import java.awt.event.ItemListener; import java.io.IOException; import java.nio.ByteBuffer; -public class gclient_t { +public class gclient_t +{ - public gclient_t(int index) { + public gclient_t(int index) + { this.index = index; } // this structure is cleared on each PutClientInServer(), @@ -43,9 +45,9 @@ public class gclient_t { public int ping; // private to game - public client_persistant_t pers= new client_persistant_t(); - public client_respawn_t resp= new client_respawn_t(); - public pmove_state_t old_pmove= new pmove_state_t(); // for detecting out-of-pmove changes + public client_persistant_t pers = new client_persistant_t(); + public client_respawn_t resp = new client_respawn_t(); + public pmove_state_t old_pmove = new pmove_state_t(); // for detecting out-of-pmove changes public boolean showscores; // set layout stat public boolean showinventory; // set layout stat @@ -121,10 +123,48 @@ public class gclient_t { public int index; - public void clear() { + public void clear() + { + player_state_t ps = new player_state_t(); + pers = new client_persistant_t(); + resp = new client_respawn_t(); + old_pmove = new pmove_state_t(); + + buttons = oldbuttons = latched_buttons = 0; + weapon_thunk = false; + newweapon = null; + damage_armor = 0; + damage_parmor = 0; + damage_blood = 0; + damage_knockback = 0; + killer_yaw = 0; + damage_from = new float[3]; + kick_angles = new float[3]; + kick_origin = new float[3]; + v_dmg_roll = v_dmg_pitch = v_dmg_time = 0; + fall_time = fall_value = 0; + damage_alpha = 0; + bonus_alpha = 0; + damage_blend = new float[3]; + v_angle = new float[3]; + bobtime = 0; + + oldviewangles = new float[3]; + + oldvelocity = new float[3]; + + next_drown_time = 0; + + old_waterlevel = 0; + anim_end = 0; + anim_priority = 0; + anim_duck = false; + anim_run = false; + } - public void load(ByteBuffer bb) throws IOException{ + public void load(ByteBuffer bb) throws IOException + { ps.load(bb); @@ -135,107 +175,107 @@ public class gclient_t { old_pmove.load(bb); - showscores=bb.getInt()!=0; - showinventory=bb.getInt()!=0; - showhelp=bb.getInt()!=0; - showhelpicon=bb.getInt()!=0; - ammo_index=bb.getInt(); + showscores = bb.getInt() != 0; + showinventory = bb.getInt() != 0; + showhelp = bb.getInt() != 0; + showhelpicon = bb.getInt() != 0; + ammo_index = bb.getInt(); - buttons=bb.getInt(); - oldbuttons=bb.getInt(); - latched_buttons=bb.getInt(); + buttons = bb.getInt(); + oldbuttons = bb.getInt(); + latched_buttons = bb.getInt(); - //weapon_thunk=bb.getInt()!=0; bb.getInt(); //newweapon=GameTarget.itemlist[bb.getInt()]; bb.getInt(); - damage_armor=bb.getInt(); - damage_parmor=bb.getInt(); - damage_blood=bb.getInt(); - damage_knockback=bb.getInt(); - - damage_from[0]=bb.getFloat(); - damage_from[1]=bb.getFloat(); - damage_from[2]=bb.getFloat(); - - killer_yaw=bb.getFloat(); - - weaponstate=bb.getInt(); - - kick_angles[0]=bb.getFloat(); - kick_angles[1]=bb.getFloat(); - kick_angles[2]=bb.getFloat(); - - kick_origin[0]=bb.getFloat(); - kick_origin[1]=bb.getFloat(); - kick_origin[2]=bb.getFloat(); - - v_dmg_roll=bb.getFloat(); - v_dmg_pitch=bb.getFloat(); - v_dmg_time=bb.getFloat(); - fall_time=bb.getFloat(); - fall_value=bb.getFloat(); - damage_alpha=bb.getFloat(); - bonus_alpha=bb.getFloat(); - - damage_blend[0]=bb.getFloat(); - damage_blend[1]=bb.getFloat(); - damage_blend[2]=bb.getFloat(); - - v_angle[0]=bb.getFloat(); - v_angle[1]=bb.getFloat(); - v_angle[2]=bb.getFloat(); - - bobtime=bb.getFloat(); - - oldviewangles[0]=bb.getFloat(); - oldviewangles[1]=bb.getFloat(); - oldviewangles[2]=bb.getFloat(); - - oldvelocity[0]=bb.getFloat(); - oldvelocity[1]=bb.getFloat(); - oldvelocity[2]=bb.getFloat(); - - next_drown_time=bb.getFloat(); - - old_waterlevel=bb.getInt(); - breather_sound=bb.getInt(); - machinegun_shots=bb.getInt(); - anim_end=bb.getInt(); - anim_priority=bb.getInt(); - anim_duck=bb.getInt()!=0; - anim_run=bb.getInt()!=0; - - quad_framenum=bb.getFloat(); - invincible_framenum=bb.getFloat(); - breather_framenum=bb.getFloat(); - enviro_framenum=bb.getFloat(); - - grenade_blew_up= bb.getInt()!=0; - grenade_time=bb.getFloat(); - silencer_shots=bb.getInt(); - weapon_sound=bb.getInt(); - pickup_msg_time=bb.getFloat(); - flood_locktill=bb.getFloat(); - flood_when [0]=bb.getFloat(); - flood_when [1]=bb.getFloat(); - flood_when [2]=bb.getFloat(); - flood_when [3]=bb.getFloat(); - flood_when [4]=bb.getFloat(); - flood_when [5]=bb.getFloat(); - flood_when [6]=bb.getFloat(); - flood_when [7]=bb.getFloat(); - flood_when [8]=bb.getFloat(); - flood_when [9]=bb.getFloat(); - flood_whenhead=bb.getInt(); - respawn_time=bb.getFloat(); - chase_target=GameUtil.g_edicts[bb.getInt()]; - update_chase=bb.getInt()!=0; + damage_armor = bb.getInt(); + damage_parmor = bb.getInt(); + damage_blood = bb.getInt(); + damage_knockback = bb.getInt(); + + damage_from[0] = bb.getFloat(); + damage_from[1] = bb.getFloat(); + damage_from[2] = bb.getFloat(); + + killer_yaw = bb.getFloat(); + + weaponstate = bb.getInt(); + + kick_angles[0] = bb.getFloat(); + kick_angles[1] = bb.getFloat(); + kick_angles[2] = bb.getFloat(); + + kick_origin[0] = bb.getFloat(); + kick_origin[1] = bb.getFloat(); + kick_origin[2] = bb.getFloat(); + + v_dmg_roll = bb.getFloat(); + v_dmg_pitch = bb.getFloat(); + v_dmg_time = bb.getFloat(); + fall_time = bb.getFloat(); + fall_value = bb.getFloat(); + damage_alpha = bb.getFloat(); + bonus_alpha = bb.getFloat(); + + damage_blend[0] = bb.getFloat(); + damage_blend[1] = bb.getFloat(); + damage_blend[2] = bb.getFloat(); + + v_angle[0] = bb.getFloat(); + v_angle[1] = bb.getFloat(); + v_angle[2] = bb.getFloat(); + + bobtime = bb.getFloat(); + + oldviewangles[0] = bb.getFloat(); + oldviewangles[1] = bb.getFloat(); + oldviewangles[2] = bb.getFloat(); + + oldvelocity[0] = bb.getFloat(); + oldvelocity[1] = bb.getFloat(); + oldvelocity[2] = bb.getFloat(); + + next_drown_time = bb.getFloat(); + + old_waterlevel = bb.getInt(); + breather_sound = bb.getInt(); + machinegun_shots = bb.getInt(); + anim_end = bb.getInt(); + anim_priority = bb.getInt(); + anim_duck = bb.getInt() != 0; + anim_run = bb.getInt() != 0; + + quad_framenum = bb.getFloat(); + invincible_framenum = bb.getFloat(); + breather_framenum = bb.getFloat(); + enviro_framenum = bb.getFloat(); + + grenade_blew_up = bb.getInt() != 0; + grenade_time = bb.getFloat(); + silencer_shots = bb.getInt(); + weapon_sound = bb.getInt(); + pickup_msg_time = bb.getFloat(); + flood_locktill = bb.getFloat(); + flood_when[0] = bb.getFloat(); + flood_when[1] = bb.getFloat(); + flood_when[2] = bb.getFloat(); + flood_when[3] = bb.getFloat(); + flood_when[4] = bb.getFloat(); + flood_when[5] = bb.getFloat(); + flood_when[6] = bb.getFloat(); + flood_when[7] = bb.getFloat(); + flood_when[8] = bb.getFloat(); + flood_when[9] = bb.getFloat(); + flood_whenhead = bb.getInt(); + respawn_time = bb.getFloat(); + chase_target = GameUtil.g_edicts[bb.getInt()]; + update_chase = bb.getInt() != 0; } - public void dump() { - + public void dump() + { + Com.Println("ping: " + ping); pers.dump(); diff --git a/src/jake2/game/gitem_t.java b/src/jake2/game/gitem_t.java index 2f28e1a..6849809 100644 --- a/src/jake2/game/gitem_t.java +++ b/src/jake2/game/gitem_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 20.11.2003 by RST. -// $Id: gitem_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ +// $Id: gitem_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -28,6 +28,7 @@ import jake2.*; public class gitem_t { + private static int id=0; public gitem_t(int xxx) { index = xxx; @@ -82,6 +83,8 @@ public class gitem_t this.info = info; this.tag = tag; this.precaches = precaches; + + this.index = id++; } String classname; // spawning name @@ -120,7 +123,7 @@ public class gitem_t gitem_t i2 = new gitem_t( "item_armor_combat", - GameAI.Pickup_Armor, + GameAIAdapters.Pickup_Armor, null, null, null, @@ -133,7 +136,7 @@ public class gitem_t /* pickup */ "Combat Armor", /* width */ - 3, 0, null, Defines.IT_ARMOR, 0, GameAI.combatarmor_info, Defines.ARMOR_COMBAT, + 3, 0, null, Defines.IT_ARMOR, 0, GameAIAdapters.combatarmor_info, Defines.ARMOR_COMBAT, /* precache */ ""); } diff --git a/src/jake2/game/trace_t.java b/src/jake2/game/trace_t.java index 5c97aa5..efb65fb 100644 --- a/src/jake2/game/trace_t.java +++ b/src/jake2/game/trace_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: trace_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $ +// $Id: trace_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -39,6 +39,18 @@ public class trace_t implements Cloneable { // pointer public edict_t ent; // not set by CM_*() functions + public void set(trace_t from) + { + allsolid = from.allsolid; + startsolid = from.allsolid; + fraction = from.fraction; + endpos = Lib.clone(endpos); + plane = from.plane.getClone(); + surface = from.surface; + contents = from.contents; + ent = from.ent; + } + // ============= public trace_t getClone() { trace_t out = null; diff --git a/src/jake2/game/usercmd_t.java b/src/jake2/game/usercmd_t.java index f28c7cf..2e5ae5c 100644 --- a/src/jake2/game/usercmd_t.java +++ b/src/jake2/game/usercmd_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 31.10.2003 by RST. -// $Id: usercmd_t.java,v 1.1 2004-07-07 19:59:27 hzi Exp $ +// $Id: usercmd_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ package jake2.game; @@ -71,16 +71,16 @@ public class usercmd_t implements Cloneable { return this; } - public usercmd_t getClone() - { - try { - usercmd_t u1 = (usercmd_t) this.clone(); - u1.angles = Lib.clone(angles); - return u1; - } - catch (CloneNotSupportedException e) { - return null; - } - } +// public usercmd_t getClone() +// { +// try { +// usercmd_t u1 = (usercmd_t) this.clone(); +// u1.angles = Lib.clone(angles); +// return u1; +// } +// catch (CloneNotSupportedException e) { +// return null; +// } +// } }
\ No newline at end of file diff --git a/src/jake2/qcommon/CM.java b/src/jake2/qcommon/CM.java index 6cb141f..8c5a203 100644 --- a/src/jake2/qcommon/CM.java +++ b/src/jake2/qcommon/CM.java @@ -19,17 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 02.01.2004 by RST. -// $Id: CM.java,v 1.1 2004-07-07 19:59:29 hzi Exp $ +// $Id: CM.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ package jake2.qcommon; import jake2.Defines; import jake2.game.*; -import jake2.util.Lib; -import jake2.util.Math3D; -import jake2.util.Vargs; +import jake2.util.*; -import java.io.FileNotFoundException; import java.io.RandomAccessFile; import java.nio.*; import java.util.Arrays; @@ -171,9 +168,6 @@ public class CM extends Game { public static cvar_t map_noareas; - public static int c_pointcontents; - public static int c_traces, c_brush_traces; - /* =============================================================================== @@ -282,15 +276,15 @@ public class CM extends Game { map_name = name; - // debug (rst) + // debug (rst) + /* Com.p("Testing pointleafes:"); for (int n = 0; n < 20; n++) { float pos[] = new float[] {(float) (Math.random() * 1000), (float) (Math.random() * 1000), 0 }; int x = CM_PointLeafnum(pos); - Com.p(Lib.vtofsbeaty(pos) + " ---> leaf=" + x + " area = " +map_leafs[x].area); } - + */ return map_cmodels[0]; } @@ -785,6 +779,7 @@ public class CM extends Game { } } + /* ================= CMod_LoadVisibility @@ -1052,7 +1047,8 @@ public class CM extends Game { while (true) { if (nodenum < 0) { if (leaf_count >= leaf_maxcount) { - Com.DPrintf("CM_BoxLeafnums_r: overflow\n"); + //TODO: here is still an error. + //Com.DPrintf("CM_BoxLeafnums_r: overflow\n"); return; } leaf_list[leaf_count++] = -1 - nodenum; @@ -1728,7 +1724,7 @@ public class CM extends Game { */ public static void FloodArea_r(carea_t area, int floodnum) { - Com.DPrintf("FloodArea_r(" + floodnum + ")...\n"); + //Com.Printf("FloodArea_r(" + floodnum + ")...\n"); int i; qfiles.dareaportal_t p; @@ -1880,16 +1876,12 @@ public class CM extends Game { byte buf[] = new byte[len]; - try { - FS.Read(buf, len, f); - } - catch (FileNotFoundException e) { - Com.Printf("ERROR:" + e); - } + + FS.Read(buf, len, f); + ByteBuffer bb = ByteBuffer.wrap(buf); IntBuffer ib = bb.asIntBuffer(); - //TODO: i assume upward counting (rst) for (int n = 0; n < portalopen.length; n++) portalopen[n] = ib.get() != 0; diff --git a/src/jake2/qcommon/Cbuf.java b/src/jake2/qcommon/Cbuf.java index 7a28a6c..5281081 100644 --- a/src/jake2/qcommon/Cbuf.java +++ b/src/jake2/qcommon/Cbuf.java @@ -2,7 +2,7 @@ * Cbuf.java * Copyright (C) 2003 * - * $Id: Cbuf.java,v 1.1 2004-07-07 19:59:27 hzi Exp $ + * $Id: Cbuf.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -155,7 +155,7 @@ public final class Cbuf { byte[] line = new byte[1024]; Globals.alias_count = 0; // don't allow infinite alias loops - + while (Globals.cmd_text.cursize != 0) { // find a \n or ; line break text = Globals.cmd_text.data; @@ -194,11 +194,8 @@ public final class Cbuf { // execute the command line int len = jake2.util.Lib.strlen(line); - //System.out.println("Cbuf.executelen:" + Globals.cmd_text.cursize + "/" + len); String cmd = new String(line, 0, len); - //System.out.println("Cbuf.data :" + new String(text,0,16).replace('\n','.').replace('\r','.')); - //System.out.println("Cbuf.execute:" + xxx.replace('\n','.').replace('\r','.') ); Cmd.ExecuteString(cmd); if (Globals.cmd_wait) { diff --git a/src/jake2/qcommon/Com.java b/src/jake2/qcommon/Com.java index 63b7d0e..c938fdb 100644 --- a/src/jake2/qcommon/Com.java +++ b/src/jake2/qcommon/Com.java @@ -2,7 +2,7 @@ * Com.java * Copyright (C) 2003 * - * $Id: Com.java,v 1.1 2004-07-07 19:59:30 hzi Exp $ + * $Id: Com.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -30,27 +30,23 @@ import jake2.Globals; import jake2.client.CL; import jake2.client.Console; import jake2.game.Cmd; -import jake2.server.SV; import jake2.server.SV_MAIN; import jake2.sys.Sys; -import jake2.util.Lib; -import jake2.util.PrintfFormat; -import jake2.util.Vargs; +import jake2.util.*; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.logging.Logger; +import java.io.*; /** * Com * TODO complete Com interface */ public final class Com { - - public static class RD_Flusher { - public void rd_flush(int target, byte [] buffer) { - } + + static int com_argc; + static String[] com_argv = new String[Defines.MAX_NUM_ARGVS]; + + public abstract static class RD_Flusher { + public abstract void rd_flush(int target, byte [] buffer); } static int rd_target; @@ -83,8 +79,6 @@ public final class Com { static String msg = ""; - private static Logger logger = Logger.getLogger(Com.class.getName()); - // helper class to replace the pointer-pointer public static class ParseHelp { @@ -211,7 +205,7 @@ public final class Com { c = hlp.nextchar(); if (c == '\"' || c == 0) { - char xxx = hlp.nextchar(); + hlp.nextchar(); com_token[len] = '?'; return new String(com_token, 0, len); } @@ -276,7 +270,7 @@ public final class Com { SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false); CL.Drop(); recursive = false; - //throw new longjmpException(); + throw new longjmpException(); } else { SV_MAIN.SV_Shutdown("Server fatal crashed: %s" + msg + "\n", false); @@ -296,12 +290,12 @@ public final class Com { Com.Error(Globals.ERR_FATAL, "argc > MAX_NUM_ARGVS"); } - Globals.com_argc = args.length; - for (int i = 0; i < Globals.com_argc; i++) { + Com.com_argc = args.length; + for (int i = 0; i < Com.com_argc; i++) { if (args[i].length() >= Globals.MAX_TOKEN_CHARS) - Globals.com_argv[i] = ""; + Com.com_argv[i] = ""; else - Globals.com_argv[i] = args[i]; + Com.com_argv[i] = args[i]; } } @@ -417,19 +411,19 @@ public final class Com { } public static int Argc() { - return Globals.com_argc; + return Com.com_argc; } public static String Argv(int arg) { - if (arg < 0 || arg >= Globals.com_argc || Globals.com_argv[arg].length() < 1) + if (arg < 0 || arg >= Com.com_argc || Com.com_argv[arg].length() < 1) return ""; - return Globals.com_argv[arg]; + return Com.com_argv[arg]; } public static void ClearArgv(int arg) { - if (arg < 0 || arg >= Globals.com_argc || Globals.com_argv[arg].length() < 1) + if (arg < 0 || arg >= Com.com_argc || Com.com_argv[arg].length() < 1) return; - Globals.com_argv[arg] = ""; + Com.com_argv[arg] = ""; } public static void Quit() { diff --git a/src/jake2/qcommon/FS.java b/src/jake2/qcommon/FS.java index 47d760c..98975a6 100644 --- a/src/jake2/qcommon/FS.java +++ b/src/jake2/qcommon/FS.java @@ -2,7 +2,7 @@ * FS.java * Copyright (C) 2003 * - * $Id: FS.java,v 1.1 2004-07-07 19:59:31 hzi Exp $ + * $Id: FS.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -376,7 +376,7 @@ public final class FS extends Globals { ============= */ public static void FreeFile(byte[] buffer) { - Z.Free(buffer); + buffer = null; } static final int IDPAKHEADER = (('K' << 24) + ('C' << 16) + ('A' << 8) + 'P'); diff --git a/src/jake2/qcommon/MSG.java b/src/jake2/qcommon/MSG.java index cdad707..3d18798 100644 --- a/src/jake2/qcommon/MSG.java +++ b/src/jake2/qcommon/MSG.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 29.11.2003 by RST. -// $Id: MSG.java,v 1.1 2004-07-07 19:59:31 hzi Exp $ +// $Id: MSG.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ package jake2.qcommon; @@ -479,19 +479,17 @@ public class MSG extends GameBase { public static byte readbuf[] = new byte[2048]; public static String ReadString(sizebuf_t msg_read) { - String string = ""; byte c; int l = 0; do { - c = (byte) ReadByte(msg_read); + c = (byte)ReadByte(msg_read); if (c == -1 || c == 0) break; readbuf[l] = c; l++; - } - while (l < 2047); + } while (l < 2047); //readbuf[l] = 0; return new String(readbuf, 0, l); diff --git a/src/jake2/qcommon/Netchan.java b/src/jake2/qcommon/Netchan.java index d949588..31699c3 100644 --- a/src/jake2/qcommon/Netchan.java +++ b/src/jake2/qcommon/Netchan.java @@ -2,7 +2,7 @@ * NetChannel.java * Copyright (C) 2003 * - * $Id: Netchan.java,v 1.1 2004-07-07 19:59:32 hzi Exp $ + * $Id: Netchan.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -158,9 +158,9 @@ public final class Netchan extends SV_MAIN { chan.clear(); chan.sock = sock; - chan.remote_address = adr.copy(); + chan.remote_address.set(adr); chan.qport = qport; - chan.last_received = (int) Globals.curtime; + chan.last_received = Globals.curtime; chan.incoming_sequence = 0; chan.outgoing_sequence = 1; diff --git a/src/jake2/qcommon/PMove.java b/src/jake2/qcommon/PMove.java index ed82432..75459fc 100644 --- a/src/jake2/qcommon/PMove.java +++ b/src/jake2/qcommon/PMove.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 25.01.2004 by RST. -// $Id: PMove.java,v 1.1 2004-07-07 19:59:33 hzi Exp $ +// $Id: PMove.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ package jake2.qcommon; @@ -160,8 +160,8 @@ public class PMove extends Game // save entity for contact if (pm.numtouch < MAXTOUCH && trace.ent != null) { - if (trace.ent.index != -1) - Com.p("touch: " + trace.ent.classname + " (" + trace.ent.index + ")" ); + //if (trace.ent.index != -1 && trace.ent.index != 0) + //Com.p("touch: " + trace.ent.classname + " (" + trace.ent.index + ")" ); pm.touchents[pm.numtouch] = trace.ent; pm.numtouch++; @@ -646,7 +646,6 @@ public class PMove extends Game else { pm.groundentity = trace.ent; - // hitting solid ground will end a waterjump if ((pm.s.pm_flags & PMF_TIME_WATERJUMP) != 0) { @@ -655,7 +654,7 @@ public class PMove extends Game } if (0 == (pm.s.pm_flags & PMF_ON_GROUND)) - { // just hit the ground + { // just hit the ground pm.s.pm_flags |= PMF_ON_GROUND; // don't do landing time if we were just going down a slope if (pml.velocity[2] < -200) diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java index b55f4d9..bf7771c 100644 --- a/src/jake2/qcommon/Qcommon.java +++ b/src/jake2/qcommon/Qcommon.java @@ -2,7 +2,7 @@ * Qcommon.java * Copyright 2003 * - * $Id: Qcommon.java,v 1.1 2004-07-07 19:59:33 hzi Exp $ + * $Id: Qcommon.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,6 +28,8 @@ package jake2.qcommon; import jake2.Globals; import jake2.client.*; import jake2.game.Cmd; +import jake2.game.EntThinkAdapter; +import jake2.game.GamePWeapon; import jake2.game.Swap; import jake2.server.SV_MAIN; import jake2.sys.NET; @@ -43,6 +45,9 @@ import java.io.IOException; */ public final class Qcommon extends Globals { + public static final String BUILDSTRING = "Java"; + public static final String CPUSTRING = "jvm"; + /** * This function initializes the different subsystems of * the game engine. The setjmp/longjmp mechanism of the original @@ -51,7 +56,6 @@ public final class Qcommon extends Globals { */ public static void InitForTestMap(String[] args) { try { - Z.chain.next= Z.chain.prev= Z.chain; // prepare enough of the subsystems to handle // cvar and command buffer management @@ -83,7 +87,6 @@ public final class Qcommon extends Globals { // // init commands and vars // - Cmd.AddCommand("z_stats", Z.Stats_f); Cmd.AddCommand("error", Com.Error_f); Globals.host_speeds= Cvar.Get("host_speeds", "0", 0); @@ -98,9 +101,9 @@ public final class Qcommon extends Globals { String s = Com.sprintf("%4.2f %s %s %s", new Vargs(4) .add(Globals.VERSION) - .add(Globals.CPUSTRING) + .add(CPUSTRING) .add(Globals.__DATE__) - .add(Globals.BUILDSTRING)); + .add(BUILDSTRING)); Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET); @@ -144,7 +147,9 @@ public final class Qcommon extends Globals { Swap.Init(); Cbuf.Init(); - + //rst bugfix + //GamePWeapon xxx = new GamePWeapon(); + Cmd.Init(); Cvar.Init(); @@ -168,7 +173,6 @@ public final class Qcommon extends Globals { // // init commands and vars // - Cmd.AddCommand("z_stats", Z.Stats_f); Cmd.AddCommand("error", Com.Error_f); Globals.host_speeds= Cvar.Get("host_speeds", "0", 0); @@ -179,13 +183,13 @@ public final class Qcommon extends Globals { Globals.logfile_active= Cvar.Get("logfile", "0", 0); Globals.showtrace= Cvar.Get("showtrace", "0", 0); Globals.dedicated= Cvar.Get("dedicated", "0", CVAR_NOSET); - + Globals.slomo= Cvar.Get("slomo", "1", 0); String s = Com.sprintf("%4.2f %s %s %s", new Vargs(4) .add(Globals.VERSION) - .add(Globals.CPUSTRING) + .add(CPUSTRING) .add(Globals.__DATE__) - .add(Globals.BUILDSTRING)); + .add(BUILDSTRING)); Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET); @@ -198,7 +202,7 @@ public final class Qcommon extends Globals { // add + commands from command line if (!Cbuf.AddLateCommands()) { // if the user didn't give any commands, run default action -// Cbuf.AddText("d1\n"); + Cbuf.AddText("d1\n"); Cbuf.Execute(); } else { // the user asked for something explicit @@ -277,7 +281,7 @@ public final class Qcommon extends Globals { Globals.c_pointcontents= 0; } - Cbuf.Execute (); + Cbuf.Execute(); int time_before= 0; int time_between= 0; @@ -312,4 +316,5 @@ public final class Qcommon extends Globals { } } + } diff --git a/src/jake2/qcommon/SZ.java b/src/jake2/qcommon/SZ.java index f17daa2..08ec6dc 100644 --- a/src/jake2/qcommon/SZ.java +++ b/src/jake2/qcommon/SZ.java @@ -2,7 +2,7 @@ * SZ.java * Copyright (C) 2003 * - * $Id: SZ.java,v 1.1 2004-07-07 19:59:33 hzi Exp $ + * $Id: SZ.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.qcommon; -import java.util.Arrays; - import jake2.Defines; /** @@ -42,10 +40,10 @@ public final class SZ { public static void Init(sizebuf_t buf, byte data[], int length) { //memset (buf, 0, sizeof(*buf)); - //TODO: slow but safe; - Arrays.fill(data,(byte)0); buf.data = data; buf.maxsize = length; + buf.cursize = 0; + buf.allowoverflow = buf.overflowed = false; } diff --git a/src/jake2/qcommon/Z.java b/src/jake2/qcommon/Z.java deleted file mode 100644 index f25e4eb..0000000 --- a/src/jake2/qcommon/Z.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Z.java - * Copyright (C) 2003 - * - * $Id: Z.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ - */ - /* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -package jake2.qcommon; - -import java.nio.ByteBuffer; - - -/** - * Z implements special memory management. - */ -public final class Z { - - public static xcommand_t Stats_f = new xcommand_t() { - public void execute() { - Com.Printf("abstract xccommand_t not overloaded."); - } - }; - - static final zhead_t chain = new zhead_t(); - static final short MAGIC = 0x1d1d; - - static int count = 0; - static int bytes = 0; - - public static byte[] Malloc(int size) { - return TagMalloc(size, 0); - } - - static byte [] TagMalloc(int size, int tag) { - return new byte[size]; - } - - public static void Free(byte[] ptr) { - } - - public static void Free(ByteBuffer buffer) { - buffer.clear(); - buffer.limit(0); - } -} diff --git a/src/jake2/qcommon/netadr_t.java b/src/jake2/qcommon/netadr_t.java index 3d45b0c..b448861 100644 --- a/src/jake2/qcommon/netadr_t.java +++ b/src/jake2/qcommon/netadr_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 27.11.2003 by RST. -// $Id: netadr_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ +// $Id: netadr_t.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ package jake2.qcommon; @@ -27,23 +27,10 @@ import java.net.InetAddress; import java.net.UnknownHostException; public class netadr_t { - - public netadr_t() - {} - public netadr_t(netadr_t from) - { - type = from.type; - port = from.port; - ip= new byte [4]; - ip[0] = from.ip[0]; - ip[1] = from.ip[1]; - ip[2] = from.ip[2]; - ip[3] = from.ip[3]; - } public int type; public int port; - public byte ip[] = {1,2,3,4}; + public byte ip[] = {0,0,0,0}; //public byte ipx[] = new byte[10]; InetAddress ia = null; @@ -55,11 +42,13 @@ public class netadr_t { return ia; } - - public netadr_t copy() - { - - // TODO Auto-generated method stub - return new netadr_t(this); - } + + public void set(netadr_t from) { + type = from.type; + port = from.port; + ip[0] = from.ip[0]; + ip[1] = from.ip[1]; + ip[2] = from.ip[2]; + ip[3] = from.ip[3]; + } } diff --git a/src/jake2/qcommon/qfiles.java b/src/jake2/qcommon/qfiles.java index 6a51fd4..bda2233 100644 --- a/src/jake2/qcommon/qfiles.java +++ b/src/jake2/qcommon/qfiles.java @@ -2,7 +2,7 @@ * qfiles.java * Copyright (C) 2003 * - * $Id: qfiles.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ + * $Id: qfiles.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -625,9 +625,8 @@ public class qfiles { public dareaportal_t(ByteBuffer bb) { bb.order(ByteOrder.LITTLE_ENDIAN); - - portalnum = bb.getShort(); - otherarea = bb.getShort(); + portalnum = bb.getInt(); + otherarea = bb.getInt(); } int portalnum; diff --git a/src/jake2/qcommon/texinfo_t.java b/src/jake2/qcommon/texinfo_t.java index aa23894..81b32b2 100644 --- a/src/jake2/qcommon/texinfo_t.java +++ b/src/jake2/qcommon/texinfo_t.java @@ -19,17 +19,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 02.01.2004 by RST. -// $Id: texinfo_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ +// $Id: texinfo_t.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ package jake2.qcommon; -import jake2.game.EndianHandler; +import jake2.util.Lib; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import jake2.util.*; - public class texinfo_t { // works fine. diff --git a/src/jake2/qcommon/zhead_t.java b/src/jake2/qcommon/zhead_t.java deleted file mode 100644 index f2f1119..0000000 --- a/src/jake2/qcommon/zhead_t.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * zhead_t.java - * Copyright (C) 2003 - * - * $Id: zhead_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ - */ -/* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -package jake2.qcommon; - -/** - * zhead_t - */ -public final class zhead_t { - zhead_t prev = null; - zhead_t next = null; - short magic = 0; - short tag = 0; - int size = 0; - byte[] buf = null; -} diff --git a/src/jake2/render/JoglRenderer.java b/src/jake2/render/JoglRenderer.java index 4b7074b..2829a96 100644 --- a/src/jake2/render/JoglRenderer.java +++ b/src/jake2/render/JoglRenderer.java @@ -2,7 +2,7 @@ * JoglRenderer.java * Copyright (C) 2003 * - * $Id: JoglRenderer.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ + * $Id: JoglRenderer.java,v 1.2 2004-07-08 15:58:48 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,6 +28,7 @@ package jake2.render; import java.awt.Dimension; import jake2.Defines; +import jake2.qcommon.xcommand_t; import jake2.render.jogl.*; import jake2.client.refdef_t; @@ -81,25 +82,65 @@ final class JoglRenderer extends Impl implements refexport_t, Ref { R_BeginRegistration(map); } + + private model_t model = null; + private String name = null; + /** * @see jake2.client.refexport_t#RegisterModel(java.lang.String) */ public model_t RegisterModel(String name) { - return R_RegisterModel(name); + + if (contextInUse) + return R_RegisterModel(name); + + model = null; + this.name = name; + + updateScreen(new xcommand_t() { + public void execute() { + JoglRenderer.this.model = R_RegisterModel(JoglRenderer.this.name); + } + }); + return model; } /** * @see jake2.client.refexport_t#RegisterSkin(java.lang.String) */ public image_t RegisterSkin(String name) { - return R_RegisterSkin(name); + if (contextInUse) + return R_RegisterSkin(name); + + this.image = null; + this.name = name; + + updateScreen(new xcommand_t() { + public void execute() { + JoglRenderer.this.image = R_RegisterSkin(JoglRenderer.this.name); + } + }); + return image; } + + private image_t image = null; /** * @see jake2.client.refexport_t#RegisterPic(java.lang.String) */ public image_t RegisterPic(String name) { - return Draw_FindPic(name); + if (contextInUse) + return Draw_FindPic(name); + + this.image = null; + this.name = name; + + updateScreen(new xcommand_t() { + public void execute() { + JoglRenderer.this.image = Draw_FindPic(JoglRenderer.this.name); + } + }); + return image; } /** diff --git a/src/jake2/render/jogl/Draw.java b/src/jake2/render/jogl/Draw.java index 528425f..eac0a1e 100644 --- a/src/jake2/render/jogl/Draw.java +++ b/src/jake2/render/jogl/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.1 2004-07-07 19:59:36 hzi Exp $ + * $Id: Draw.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; -import jake2.Enum; import jake2.Globals; import jake2.render.image_t; diff --git a/src/jake2/render/jogl/Impl.java b/src/jake2/render/jogl/Impl.java index 8b40c40..48241db 100644 --- a/src/jake2/render/jogl/Impl.java +++ b/src/jake2/render/jogl/Impl.java @@ -2,7 +2,7 @@ * Impl.java * Copyright (C) 2003 * - * $Id: Impl.java,v 1.1 2004-07-07 19:59:38 hzi Exp $ + * $Id: Impl.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,12 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.render.jogl; -import jake2.*; +import jake2.Defines; +import jake2.Globals; import jake2.qcommon.xcommand_t; import jake2.sys.KBD; import java.awt.Dimension; -import java.awt.event.FocusAdapter; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -55,6 +55,7 @@ public class Impl extends Misc implements GLEventListener { // switch to updateScreen callback private boolean switchToCallback = false; private xcommand_t callback = null; + protected boolean contextInUse = false; GLCanvas canvas; JFrame window; @@ -94,7 +95,7 @@ public class Impl extends Misc implements GLEventListener { if (!ri.Vid_GetModeInfo(newDim, mode)) { ri.Con_Printf(Defines.PRINT_ALL, " invalid mode\n"); - return Enum.rserr_invalid_mode; + return rserr_invalid_mode; } ri.Con_Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n'); @@ -149,7 +150,7 @@ public class Impl extends Misc implements GLEventListener { // let the sound and input subsystems know about the new window ri.Vid_NewWindow(vid.width, vid.height); - return Enum.rserr_ok; + return rserr_ok; } void GLimp_BeginFrame(float camera_separation) { @@ -217,6 +218,8 @@ public class Impl extends Misc implements GLEventListener { public void display(GLDrawable drawable) { this.gl = drawable.getGL(); this.glu = drawable.getGLU(); + + this.contextInUse = true; if (switchToCallback) { if (callback == null) @@ -242,6 +245,8 @@ public class Impl extends Misc implements GLEventListener { GLimp_EndFrame(); } + + contextInUse = false; } /* diff --git a/src/jake2/render/jogl/Main.java b/src/jake2/render/jogl/Main.java index 36d8fad..32442ba 100644 --- a/src/jake2/render/jogl/Main.java +++ b/src/jake2/render/jogl/Main.java @@ -2,7 +2,7 @@ * Main.java * Copyright (C) 2003 * - * $Id: Main.java,v 1.1 2004-07-07 19:59:40 hzi Exp $ + * $Id: Main.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -958,7 +958,7 @@ public abstract class Main extends Base { protected void R_Register() { r_lefthand = ri.Cvar_Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); r_norefresh = ri.Cvar_Get("r_norefresh", "0", 0); - r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0); + r_fullbright = ri.Cvar_Get("r_fullbright", "1", 0); r_drawentities = ri.Cvar_Get("r_drawentities", "1", 0); r_drawworld = ri.Cvar_Get("r_drawworld", "1", 0); r_novis = ri.Cvar_Get("r_novis", "0", 0); @@ -966,7 +966,7 @@ public abstract class Main extends Base { r_lerpmodels = ri.Cvar_Get("r_lerpmodels", "1", 0); r_speeds = ri.Cvar_Get("r_speeds", "0", 0); - r_lightlevel = ri.Cvar_Get("r_lightlevel", "0", 0); + r_lightlevel = ri.Cvar_Get("r_lightlevel", "1", 0); gl_nosubimage = ri.Cvar_Get("gl_nosubimage", "0", 0); gl_allow_software = ri.Cvar_Get("gl_allow_software", "0", 0); @@ -1069,25 +1069,25 @@ public abstract class Main extends Base { Dimension dim = new Dimension(vid.width, vid.height); - if ((err = GLimp_SetMode(dim, (int) gl_mode.value, fullscreen)) == Enum.rserr_ok) { + if ((err = GLimp_SetMode(dim, (int) gl_mode.value, fullscreen)) == rserr_ok) { gl_state.prev_mode = (int) gl_mode.value; } else { - if (err == Enum.rserr_invalid_fullscreen) { + if (err == rserr_invalid_fullscreen) { ri.Cvar_SetValue("vid_fullscreen", 0); vid_fullscreen.modified = false; ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); - if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == Enum.rserr_ok) + if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == rserr_ok) return true; } - else if (err == Enum.rserr_invalid_mode) { + else if (err == rserr_invalid_mode) { ri.Cvar_SetValue("gl_mode", gl_state.prev_mode); gl_mode.modified = false; ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); } // try setting it back to something safe - if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != Enum.rserr_ok) { + if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) { ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); return false; } diff --git a/src/jake2/render/jogl/Mesh.java b/src/jake2/render/jogl/Mesh.java index da7017d..45d28bb 100644 --- a/src/jake2/render/jogl/Mesh.java +++ b/src/jake2/render/jogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.1 2004-07-07 19:59:41 hzi Exp $ + * $Id: Mesh.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -237,7 +237,7 @@ public abstract class Mesh extends Light { for ( i = 0; i < paliashdr.num_xyz; i++ ) { l = shadedots[verts[i].lightnormalindex]; - colorArrayBuf.put(l * shadelight[0]).put(l * shadelight[2]).put(l * shadelight[2]); + colorArrayBuf.put(l * shadelight[0]).put(l * shadelight[1]).put(l * shadelight[2]); } } diff --git a/src/jake2/render/jogl/Warp.java b/src/jake2/render/jogl/Warp.java index 770d50b..f02acbb 100644 --- a/src/jake2/render/jogl/Warp.java +++ b/src/jake2/render/jogl/Warp.java @@ -2,7 +2,7 @@ * Warp.java * Copyright (C) 2003 * - * $Id: Warp.java,v 1.1 2004-07-07 19:59:44 hzi Exp $ + * $Id: Warp.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -446,7 +446,7 @@ public abstract class Warp extends Model { float[] dists = new float[MAX_CLIP_VERTS]; int[] sides = new int[MAX_CLIP_VERTS]; - float[][][] newv = new float[2][MAX_CLIP_VERTS][3]; + float[][][][] newv = new float[6][2][MAX_CLIP_VERTS][3]; void ClipSkyPolygon(int nump, float[][] vecs, int stage) { @@ -503,17 +503,17 @@ public abstract class Warp extends Model { switch (sides[i]) { case SIDE_FRONT: - Math3D.VectorCopy(v, newv[0][newc[0]]); + Math3D.VectorCopy(v, newv[stage][0][newc[0]]); newc[0]++; break; case SIDE_BACK: - Math3D.VectorCopy(v, newv[1][newc[1]]); + Math3D.VectorCopy(v, newv[stage][1][newc[1]]); newc[1]++; break; case SIDE_ON: - Math3D.VectorCopy(v, newv[0][newc[0]]); + Math3D.VectorCopy(v, newv[stage][0][newc[0]]); newc[0]++; - Math3D.VectorCopy (v, newv[1][newc[1]]); + Math3D.VectorCopy (v, newv[stage][1][newc[1]]); newc[1]++; break; } @@ -525,16 +525,16 @@ public abstract class Warp extends Model { for (j=0 ; j<3 ; j++) { e = v[j] + d * (vecs[i + 1][j] - v[j]); - newv[0][newc[0]][j] = e; - newv[1][newc[1]][j] = e; + newv[stage][0][newc[0]][j] = e; + newv[stage][1][newc[1]][j] = e; } newc[0]++; newc[1]++; } // continue - ClipSkyPolygon(newc[0], newv[0], stage+1); - ClipSkyPolygon(newc[1], newv[1], stage+1); + ClipSkyPolygon(newc[0], newv[stage][0], stage+1); + ClipSkyPolygon(newc[1], newv[stage][1], stage+1); } float[][] verts = new float[MAX_CLIP_VERTS][3]; diff --git a/src/jake2/render/model_t.java b/src/jake2/render/model_t.java index 9e55865..5807568 100644 --- a/src/jake2/render/model_t.java +++ b/src/jake2/render/model_t.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 20.11.2003 by RST. -// $Id: model_t.java,v 1.1 2004-07-07 19:59:35 hzi Exp $ +// $Id: model_t.java,v 1.2 2004-07-08 15:58:48 hzi Exp $ package jake2.render; @@ -182,6 +182,7 @@ public class model_t implements Cloneable { extradata = null; } + // TODO replace with set(model_t from) public model_t copy() { model_t theClone = null; try diff --git a/src/jake2/server/SV.java b/src/jake2/server/SV.java index d00b104..def4112 100644 --- a/src/jake2/server/SV.java +++ b/src/jake2/server/SV.java @@ -2,7 +2,7 @@ * SV.java * Copyright (C) 2003 * - * $Id: SV.java,v 1.1 2004-07-07 19:59:46 hzi Exp $ + * $Id: SV.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -119,7 +119,7 @@ public final class SV { float[] dir = { 0.0f, 0.0f, 0.0f }; float d; int numplanes; - float[][] planes = new float[3][GameBase.MAX_CLIP_PLANES]; + float[][] planes = new float[GameBase.MAX_CLIP_PLANES][3]; float[] primal_velocity = { 0.0f, 0.0f, 0.0f }; float[] original_velocity = { 0.0f, 0.0f, 0.0f }; float[] new_velocity = { 0.0f, 0.0f, 0.0f }; diff --git a/src/jake2/server/SV_CCMDS.java b/src/jake2/server/SV_CCMDS.java index baa1478..6c71224 100644 --- a/src/jake2/server/SV_CCMDS.java +++ b/src/jake2/server/SV_CCMDS.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 18.01.2004 by RST. -// $Id: SV_CCMDS.java,v 1.1 2004-07-07 19:59:47 hzi Exp $ +// $Id: SV_CCMDS.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; @@ -297,7 +297,7 @@ public class SV_CCMDS extends SV_ENTS { CopyFile(name, name2); String name1 = FS.Gamedir() + "/save/" + src + "/"; - len = strlen(name1); + len = name1.length(); name = FS.Gamedir() + "/save/" + src + "/*.sav"; found = Sys.FindFirst(name, 0, 0); @@ -458,7 +458,7 @@ public class SV_CCMDS extends SV_ENTS { for (var = Globals.cvar_vars; var != null; var = var.next) { if (0 == (var.flags & CVAR_LATCH)) continue; - if (strlen(var.name) >= MAX_OSPATH - 1 || strlen(var.string) >= 128 - 1) { + if (var.name.length() >= MAX_OSPATH - 1 || var.string.length() >= 128 - 1) { Com.Printf("Cvar too long: " + var.name + " = " + var.string + "\n"); continue; } @@ -851,7 +851,7 @@ public class SV_CCMDS extends SV_ENTS { } Com.Printf("%s", new Vargs().add(cl.name)); - l = 16 - strlen(cl.name); + l = 16 - cl.name.length(); for (j = 0; j < l; j++) Com.Printf(" "); @@ -859,7 +859,7 @@ public class SV_CCMDS extends SV_ENTS { s = NET.AdrToString(cl.netchan.remote_address); Com.Printf(s); - l = 22 - strlen(s); + l = 22 - s.length(); for (j = 0; j < l; j++) Com.Printf(" "); diff --git a/src/jake2/server/SV_ENTS.java b/src/jake2/server/SV_ENTS.java index de27378..6437dff 100644 --- a/src/jake2/server/SV_ENTS.java +++ b/src/jake2/server/SV_ENTS.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 17.01.2004 by RST. -// $Id: SV_ENTS.java,v 1.1 2004-07-07 19:59:45 hzi Exp $ +// $Id: SV_ENTS.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; @@ -129,7 +129,9 @@ public class SV_ENTS extends SV_USER { static void SV_WritePlayerstateToClient(client_frame_t from, client_frame_t to, sizebuf_t msg) { int i; int pflags; + // ptr player_state_t ps, ops; + // mem player_state_t dummy; int statbits; @@ -301,13 +303,13 @@ public class SV_ENTS extends SV_USER { ================== */ public static void SV_WriteFrameToClient(client_t client, sizebuf_t msg) { + //ptr client_frame_t frame, oldframe; int lastframe; //Com.Printf ("%i . %i\n", new Vargs().add(client.lastframe).add(sv.framenum)); // this is the frame we are creating frame = client.frames[sv.framenum & UPDATE_MASK]; - if (client.lastframe <= 0) { // client is asking for a retransmit oldframe = null; lastframe = -1; @@ -447,7 +449,7 @@ public class SV_ENTS extends SV_USER { frame.areabytes = CM.CM_WriteAreaBits(frame.areabits, clientarea); // grab the current player_state_t - frame.ps = clent.client.ps; + frame.ps.set(clent.client.ps); SV_FatPVS(org); clientphs = CM.CM_ClusterPHS(clientcluster); @@ -529,7 +531,7 @@ public class SV_ENTS extends SV_USER { } //*state = ent.s; - svs.client_entities[ix] = ent.s; + svs.client_entities[ix].set(ent.s); // don't mark players missiles as solid if (ent.owner == client.edict) diff --git a/src/jake2/server/SV_GAME.java b/src/jake2/server/SV_GAME.java index eba5a84..c6d433b 100644 --- a/src/jake2/server/SV_GAME.java +++ b/src/jake2/server/SV_GAME.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 14.01.2004 by RST. -// $Id: SV_GAME.java,v 1.1 2004-07-07 19:59:47 hzi Exp $ +// $Id: SV_GAME.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; @@ -174,7 +174,7 @@ public class SV_GAME extends SV_INIT { i = SV_ModelIndex(name); - // ent.model = name; + //ent.model = name; ent.s.modelindex = i; // if it is an inline model, get the size information for it @@ -262,7 +262,7 @@ public class SV_GAME extends SV_INIT { cluster = CM.CM_LeafCluster(leafnum); area2 = CM.CM_LeafArea(leafnum); - if (mask != null && (0 == (mask[cluster >> 3] & (1 << (cluster & 7))))) + if (mask != null && (0 == (mask[cluster >>> 3] & (1 << (cluster & 7))))) return false; if (!CM.CM_AreasConnected(area1, area2)) @@ -293,7 +293,7 @@ public class SV_GAME extends SV_INIT { cluster = CM.CM_LeafCluster(leafnum); area2 = CM.CM_LeafArea(leafnum); - if (mask != null && (0 == (mask[cluster >> 3] & (1 << (cluster & 7))))) + if (mask != null && (0 == (mask[cluster >>> 3] & (1 << (cluster & 7))))) return false; // more than one bounce away if (!CM.CM_AreasConnected(area1, area2)) return false; // a door blocks hearing diff --git a/src/jake2/server/SV_INIT.java b/src/jake2/server/SV_INIT.java index 021c60c..8fcfa37 100644 --- a/src/jake2/server/SV_INIT.java +++ b/src/jake2/server/SV_INIT.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 14.01.2004 by RST. -// $Id: SV_INIT.java,v 1.1 2004-07-07 19:59:47 hzi Exp $ +// $Id: SV_INIT.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; @@ -469,7 +469,7 @@ public class SV_INIT extends Globals { if (level.charAt(0) == '*') level = level.substring(1); - l = strlen(level); + l = level.length(); if (l > 4 && level.endsWith(".cin")) { SCR.BeginLoadingPlaque(); // for local system SV_SEND.SV_BroadcastCommand("changing\n"); diff --git a/src/jake2/server/SV_MAIN.java b/src/jake2/server/SV_MAIN.java index e3059ec..464b056 100644 --- a/src/jake2/server/SV_MAIN.java +++ b/src/jake2/server/SV_MAIN.java @@ -19,22 +19,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.01.2004 by RST. -// $Id: SV_MAIN.java,v 1.1 2004-07-07 19:59:49 hzi Exp $ +// $Id: SV_MAIN.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; -import java.io.DataOutputStream; -import java.io.IOException; - -import jake2.*; -import jake2.client.*; +import jake2.Defines; +import jake2.Globals; import jake2.game.*; import jake2.qcommon.*; -import jake2.render.*; import jake2.sys.NET; import jake2.sys.Sys; import jake2.util.Lib; +import java.io.IOException; + public class SV_MAIN extends SV_GAME { static netadr_t master_adr[] = new netadr_t[MAX_MASTERS]; // address of group servers @@ -401,7 +399,7 @@ public class SV_MAIN extends SV_GAME { } public static int Rcon_Validate() { - if (0 == strlen(rcon_password.string)) + if (0 == rcon_password.string.length()) return 0; if (0 != strcmp(Cmd.Argv(1), rcon_password.string)) @@ -702,7 +700,7 @@ public class SV_MAIN extends SV_GAME { // never get more than one tic behind if (sv.time < svs.realtime) { - //if (sv_showclamp.value != 0) + if (sv_showclamp.value != 0) Com.Printf("sv highclamp\n"); svs.realtime = sv.time; } @@ -744,7 +742,7 @@ public class SV_MAIN extends SV_GAME { if (0== sv_timedemo.value && svs.realtime < sv.time) { // never let the time get too far off if (sv.time - svs.realtime > 100) { - //if (sv_showclamp.value != 0) + if (sv_showclamp.value != 0) Com.Printf("sv lowclamp\n"); svs.realtime = sv.time - 100; } @@ -889,7 +887,7 @@ public class SV_MAIN extends SV_GAME { // msg command val = Info.Info_ValueForKey(cl.userinfo, "msg"); - if (strlen(val) > 0) { + if (val.length() > 0) { cl.messagelevel = atoi(val); } @@ -914,7 +912,8 @@ public class SV_MAIN extends SV_GAME { Cvar.Get("dmflags", "" + DF_INSTANT_ITEMS, CVAR_SERVERINFO); Cvar.Get("fraglimit", "0", CVAR_SERVERINFO); Cvar.Get("timelimit", "0", CVAR_SERVERINFO); - Cvar.Get("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); + //TODO: set cheats 0 + Cvar.Get("cheats", "1", CVAR_SERVERINFO | CVAR_LATCH); Cvar.Get("protocol", "" + PROTOCOL_VERSION, CVAR_SERVERINFO | CVAR_NOSET); SV_MAIN.maxclients = Cvar.Get("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH); diff --git a/src/jake2/server/SV_USER.java b/src/jake2/server/SV_USER.java index 7662c30..1136d20 100644 --- a/src/jake2/server/SV_USER.java +++ b/src/jake2/server/SV_USER.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 17.01.2004 by RST. -// $Id: SV_USER.java,v 1.1 2004-07-07 19:59:50 hzi Exp $ +// $Id: SV_USER.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; @@ -331,7 +331,7 @@ public class SV_USER extends SV_SEND { sv_client.downloadcount = sv_client.downloadsize; if (sv_client.download == null // special check for maps, if it came from a pak file, don't allow - // download ZOID + // download ZOID || (strncmp(name, "maps/", 5) == 0 && FS.file_from_pak != 0)) { Com.DPrintf("Couldn't download " + name + " to " + sv_client.name + "\n"); if (sv_client.download != null) { @@ -482,14 +482,16 @@ public class SV_USER extends SV_SEND { // SV_BeginRedirect (RD_CLIENT); - for (int i = 0; i < ucmds.length; i++) { + int i=0; + for (; i < ucmds.length; i++) { u = ucmds[i]; if (0 == strcmp(Cmd.Argv(0), u.name)) { u.r.run(); break; } } - if (u.name == null && sv.state == ss_game) + + if (i == ucmds.length && sv.state == ss_game) SV_GAME.ge.ClientCommand(sv_player); // SV_EndRedirect (); @@ -526,8 +528,8 @@ public class SV_USER extends SV_SEND { int c; String s; - usercmd_t nullcmd=new usercmd_t(); - usercmd_t oldest=new usercmd_t(), oldcmd=new usercmd_t(), newcmd=new usercmd_t(); + usercmd_t nullcmd = new usercmd_t(); + usercmd_t oldest = new usercmd_t(), oldcmd = new usercmd_t(), newcmd = new usercmd_t(); int net_drop; int stringCmdCount; int checksum, calculatedChecksum; @@ -576,7 +578,7 @@ public class SV_USER extends SV_SEND { checksumIndex = net_message.readcount; checksum = MSG.ReadByte(net_message); lastframe = MSG.ReadLong(net_message); - + if (lastframe != cl.lastframe) { cl.lastframe = lastframe; if (cl.lastframe > 0) { @@ -597,7 +599,7 @@ public class SV_USER extends SV_SEND { } // if the checksum fails, ignore the rest of the packet - + calculatedChecksum = 0; /* = Com.BlockSequenceCRCByte( diff --git a/src/jake2/server/SV_WORLD.java b/src/jake2/server/SV_WORLD.java index 6df2512..a400959 100644 --- a/src/jake2/server/SV_WORLD.java +++ b/src/jake2/server/SV_WORLD.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 07.01.2000 by RST. -// $Id: SV_WORLD.java,v 1.1 2004-07-07 19:59:50 hzi Exp $ +// $Id: SV_WORLD.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ package jake2.server; @@ -33,31 +33,24 @@ import jake2.qcommon.*; import jake2.render.*; import jake2.util.Vargs; -public class SV_WORLD extends SV_CCMDS { +public class SV_WORLD extends SV_CCMDS +{ // world.c -- world query functions // - ///* + // //=============================================================================== // //ENTITY AREA CHECKING // //FIXME: this use of "area" is different from the bsp file use //=============================================================================== - //*/ - - //// (type *)STRUCT_FROM_LINK(link_t *link, type, member) - //// ent = STRUCT_FROM_LINK(link,entity_t,order) - - //// FIXME: remove this mess! - //#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0).m))) // - //#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) - // - public static void initNodes() { + public static void initNodes() + { for (int n = 0; n < AREA_NODES; n++) sv_areanodes[n] = new areanode_t(); } @@ -75,16 +68,19 @@ public class SV_WORLD extends SV_CCMDS { public static int area_type; // ClearLink is used for new headnodes - public static void ClearLink(link_t l) { + public static void ClearLink(link_t l) + { l.prev = l.next = l; } - public static void RemoveLink(link_t l) { + public static void RemoveLink(link_t l) + { l.next.prev = l.prev; l.prev.next = l.next; } - public static void InsertLinkBefore(link_t l, link_t before) { + public static void InsertLinkBefore(link_t l, link_t before) + { l.next = before; l.prev = before.prev; l.prev.next = l; @@ -98,24 +94,25 @@ public class SV_WORLD extends SV_CCMDS { Builds a uniformly subdivided tree for the given world size =============== */ - public static areanode_t SV_CreateAreaNode(int depth, float[] mins, float[] maxs) { + public static areanode_t SV_CreateAreaNode(int depth, float[] mins, float[] maxs) + { areanode_t anode; float[] size = { 0, 0, 0 }; float[] mins1 = { 0, 0, 0 }, maxs1 = { 0, 0, 0 }, mins2 = { 0, 0, 0 }, maxs2 = { 0, 0, 0 }; - Com.Printf("SV_CreateAreaNode " + depth + "\n"); anode = sv_areanodes[sv_numareanodes]; - + // just for debugging (rst) VectorCopy(mins, anode.mins_rst); VectorCopy(maxs, anode.maxs_rst); - + sv_numareanodes++; ClearLink(anode.trigger_edicts); ClearLink(anode.solid_edicts); - if (depth == AREA_DEPTH) { + if (depth == AREA_DEPTH) + { anode.axis = -1; anode.children[0] = anode.children[1] = null; return anode; @@ -147,12 +144,14 @@ public class SV_WORLD extends SV_CCMDS { =============== */ - public static void SV_ClearWorld() { + public static void SV_ClearWorld() + { initNodes(); sv_numareanodes = 0; SV_CreateAreaNode(0, sv.models[1].mins, sv.models[1].maxs); - Com.Println("areanodes:" + sv_numareanodes + " (sollten 32 sein)."); + /* + Com.p("areanodes:" + sv_numareanodes + " (sollten 32 sein)."); for (int n = 0; n < sv_numareanodes; n++) { Com.Printf( "|%3i|%2i|%8.2f |%8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f|\n", @@ -167,15 +166,15 @@ public class SV_WORLD extends SV_CCMDS { .add(sv_areanodes[n].maxs_rst[1]) .add(sv_areanodes[n].maxs_rst[2])); } + */ } - /* =============== SV_UnlinkEdict - =============== */ - public static void SV_UnlinkEdict(edict_t ent) { + public static void SV_UnlinkEdict(edict_t ent) + { if (null == ent.area.prev) return; // not linked in anywhere RemoveLink(ent.area); @@ -185,12 +184,12 @@ public class SV_WORLD extends SV_CCMDS { /* =============== SV_LinkEdict - =============== */ public static final int MAX_TOTAL_ENT_LEAFS = 128; - public static void SV_LinkEdict(edict_t ent) { + public static void SV_LinkEdict(edict_t ent) + { areanode_t node; // TODO: make static instead of new int leafs[] = new int[MAX_TOTAL_ENT_LEAFS]; @@ -213,7 +212,8 @@ public class SV_WORLD extends SV_CCMDS { VectorSubtract(ent.maxs, ent.mins, ent.size); // encode the size into the entity_state for client prediction - if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER)) { // assume that x/y are equal and symetric + if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER)) + { // assume that x/y are equal and symetric int i = (int) (ent.maxs[0] / 8); if (i < 1) i = 1; @@ -236,18 +236,21 @@ public class SV_WORLD extends SV_CCMDS { ent.s.solid = (k << 10) | (j << 5) | i; } - else if (ent.solid == SOLID_BSP) { + else if (ent.solid == SOLID_BSP) + { ent.s.solid = 31; // a solid_bbox will never create this value } else ent.s.solid = 0; // set the abs box - if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0)) { // expand for rotation + if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0)) + { // expand for rotation float max, v; max = 0; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) + { v = Math.abs(ent.mins[i]); if (v > max) max = v; @@ -255,12 +258,14 @@ public class SV_WORLD extends SV_CCMDS { if (v > max) max = v; } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) + { ent.absmin[i] = ent.s.origin[i] - max; ent.absmax[i] = ent.s.origin[i] + max; } } - else { // normal + else + { // normal VectorAdd(ent.s.origin, ent.mins, ent.absmin); VectorAdd(ent.s.origin, ent.maxs, ent.absmax); } @@ -289,12 +294,15 @@ public class SV_WORLD extends SV_CCMDS { topnode = iw.i; // set areas - for (int i = 0; i < num_leafs; i++) { + for (int i = 0; i < num_leafs; i++) + { clusters[i] = CM.CM_LeafCluster(leafs[i]); area = CM.CM_LeafArea(leafs[i]); - if (area != 0) { // doors may legally straggle two areas, + if (area != 0) + { // doors may legally straggle two areas, // but nothing should evern need more than that - if (ent.areanum != 0 && ent.areanum != area) { + if (ent.areanum != 0 && ent.areanum != area) + { if (ent.areanum2 != 0 && ent.areanum2 != area && sv.state == ss_loading) Com.DPrintf("Object touching 3 areas at " + ent.absmin[0] + " " + ent.absmin[1] + " " + ent.absmin[2] + "\n"); ent.areanum2 = area; @@ -304,20 +312,25 @@ public class SV_WORLD extends SV_CCMDS { } } - if (num_leafs >= MAX_TOTAL_ENT_LEAFS) { // assume we missed some leafs, and mark by headnode + if (num_leafs >= MAX_TOTAL_ENT_LEAFS) + { // assume we missed some leafs, and mark by headnode ent.num_clusters = -1; ent.headnode = topnode; } - else { + else + { ent.num_clusters = 0; - for (int i = 0; i < num_leafs; i++) { + for (int i = 0; i < num_leafs; i++) + { if (clusters[i] == -1) continue; // not a visible leaf for (j = 0; j < i; j++) if (clusters[j] == clusters[i]) break; - if (j == i) { - if (ent.num_clusters == MAX_ENT_CLUSTERS) { // assume we missed some leafs, and mark by headnode + if (j == i) + { + if (ent.num_clusters == MAX_ENT_CLUSTERS) + { // assume we missed some leafs, and mark by headnode ent.num_clusters = -1; ent.headnode = topnode; break; @@ -329,7 +342,8 @@ public class SV_WORLD extends SV_CCMDS { } // if first time, make sure old_origin is valid - if (0 == ent.linkcount) { + if (0 == ent.linkcount) + { VectorCopy(ent.s.origin, ent.s.old_origin); } ent.linkcount++; @@ -340,7 +354,8 @@ public class SV_WORLD extends SV_CCMDS { // find the first node that the ent's box crosses node = sv_areanodes[0]; - while (true) { + while (true) + { if (node.axis == -1) break; if (ent.absmin[node.axis] > node.dist) @@ -365,7 +380,8 @@ public class SV_WORLD extends SV_CCMDS { ==================== */ - public static void SV_AreaEdicts_r(areanode_t node) { + public static void SV_AreaEdicts_r(areanode_t node) + { link_t l, next, start; edict_t check; int count; @@ -378,7 +394,8 @@ public class SV_WORLD extends SV_CCMDS { else start = node.trigger_edicts; - for (l = start.next; l != start; l = next) { + for (l = start.next; l != start; l = next) + { next = l.next; check = //EDICT_FROM_AREA(l); (edict_t) l.o; @@ -393,7 +410,8 @@ public class SV_WORLD extends SV_CCMDS { || check.absmax[2] < area_mins[2]) continue; // not touching - if (area_count == area_maxcount) { + if (area_count == area_maxcount) + { Com.Printf("SV_AreaEdicts: MAXCOUNT\n"); return; } @@ -418,7 +436,8 @@ public class SV_WORLD extends SV_CCMDS { SV_AreaEdicts ================ */ - public static int SV_AreaEdicts(float[] mins, float[] maxs, edict_t list[], int maxcount, int areatype) { + public static int SV_AreaEdicts(float[] mins, float[] maxs, edict_t list[], int maxcount, int areatype) + { area_mins = mins; area_maxs = maxs; area_list = list; @@ -427,7 +446,7 @@ public class SV_WORLD extends SV_CCMDS { area_type = areatype; SV_AreaEdicts_r(sv_areanodes[0]); - + /* Com.Printf("found edicts in area:" + area_count + "\n"); for (int n = 0; n < area_count; n++) { @@ -444,7 +463,8 @@ public class SV_WORLD extends SV_CCMDS { SV_PointContents ============= */ - public static int SV_PointContents(float[] p) { + public static int SV_PointContents(float[] p) + { // TODO: make static instead new edict_t touch[] = new edict_t[MAX_EDICTS], hit; int i, num; @@ -458,7 +478,8 @@ public class SV_WORLD extends SV_CCMDS { // or in contents from all the other entities num = SV_AreaEdicts(p, p, touch, MAX_EDICTS, AREA_SOLID); - for (i = 0; i < num; i++) { + for (i = 0; i < num; i++) + { hit = touch[i]; // might intersect, so do an exact clip @@ -485,12 +506,14 @@ public class SV_WORLD extends SV_CCMDS { testing object's origin to get a point to use with the returned hull. ================ */ - public static int SV_HullForEntity(edict_t ent) { + public static int SV_HullForEntity(edict_t ent) + { cmodel_t model; // decide which clipping hull to use, based on the size - if (ent.solid == SOLID_BSP) { // explicit hulls in the BSP model + if (ent.solid == SOLID_BSP) + { // explicit hulls in the BSP model model = sv.models[ent.s.modelindex]; if (null == model) @@ -512,7 +535,8 @@ public class SV_WORLD extends SV_CCMDS { ==================== */ - public static void SV_ClipMoveToEntities(moveclip_t clip) { + public static void SV_ClipMoveToEntities(moveclip_t clip) + { int i, num; // TODO: make static instead of new edict_t touchlist[] = new edict_t[MAX_EDICTS]; @@ -525,7 +549,8 @@ public class SV_WORLD extends SV_CCMDS { // be careful, it is possible to have an entity in this // list removed before we get to it (killtriggered) - for (i = 0; i < num; i++) { + for (i = 0; i < num; i++) + { touch = touchlist[i]; if (touch.solid == SOLID_NOT) continue; @@ -533,7 +558,8 @@ public class SV_WORLD extends SV_CCMDS { continue; if (clip.trace.allsolid) return; - if (clip.passedict != null) { + if (clip.passedict != null) + { if (touch.owner == clip.passedict) continue; // don't clip against own missiles if (clip.passedict.owner == touch) @@ -572,9 +598,11 @@ public class SV_WORLD extends SV_CCMDS { touch.s.origin, angles); - if (trace.allsolid || trace.startsolid || trace.fraction < clip.trace.fraction) { + if (trace.allsolid || trace.startsolid || trace.fraction < clip.trace.fraction) + { trace.ent = touch; - if (clip.trace.startsolid) { + if (clip.trace.startsolid) + { clip.trace = trace; clip.trace.startsolid = true; } @@ -591,15 +619,19 @@ public class SV_WORLD extends SV_CCMDS { SV_TraceBounds ================== */ - public static void SV_TraceBounds(float[] start, float[] mins, float[] maxs, float[] end, float[] boxmins, float[] boxmaxs) { + public static void SV_TraceBounds(float[] start, float[] mins, float[] maxs, float[] end, float[] boxmins, float[] boxmaxs) + { int i; - for (i = 0; i < 3; i++) { - if (end[i] > start[i]) { + for (i = 0; i < 3; i++) + { + if (end[i] > start[i]) + { boxmins[i] = start[i] + mins[i] - 1; boxmaxs[i] = end[i] + maxs[i] + 1; } - else { + else + { boxmins[i] = end[i] + mins[i] - 1; boxmaxs[i] = start[i] + maxs[i] + 1; } @@ -617,7 +649,8 @@ public class SV_WORLD extends SV_CCMDS { ================== */ - public static trace_t SV_Trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passedict, int contentmask) { + public static trace_t SV_Trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passedict, int contentmask) + { moveclip_t clip = new moveclip_t(); if (mins == null) diff --git a/src/jake2/sys/IN.java b/src/jake2/sys/IN.java index db88226..5935a0a 100644 --- a/src/jake2/sys/IN.java +++ b/src/jake2/sys/IN.java @@ -2,7 +2,7 @@ * IN.java * Copyright (C) 2003 * - * $Id: IN.java,v 1.1 2004-07-07 19:59:51 hzi Exp $ + * $Id: IN.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,8 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.sys; import jake2.Globals; +import jake2.client.CL_input; +import jake2.client.Key; +import jake2.game.Cmd; import jake2.game.usercmd_t; import jake2.qcommon.Cvar; +import jake2.qcommon.xcommand_t; import java.awt.*; @@ -44,9 +48,17 @@ public final class IN extends Globals { static boolean mouse_avail = true; static boolean mouse_active = false; static boolean ignorefirst = false; + + static int mouse_buttonstate; + static int mouse_oldbuttonstate; + + static int old_mouse_x; + static int old_mouse_y; + + static boolean mlooking; public static void ActivateMouse() { - // if (!mouse_avail || c == null) return; + if (!mouse_avail || c == null) return; if (!mouse_active) { KBD.mx = KBD.my = 0; // don't spazz install_grabs(); @@ -55,7 +67,7 @@ public final class IN extends Globals { } public static void DeactivateMouse() { - // if (!mouse_avail || c == null) return; + // if (!mouse_avail || c == null) return; if (mouse_active) { uninstall_grabs(); mouse_active = false; @@ -78,10 +90,13 @@ public final class IN extends Globals { } public static void toggleMouse() { - if (mouse_active) + if (mouse_active) { + mouse_avail=false; DeactivateMouse(); - else + } else { + mouse_avail=true; ActivateMouse(); + } } public static void Init() { @@ -90,25 +105,57 @@ public final class IN extends Globals { } public static void Shutdown() { - RW.IN_Shutdown(); + mouse_avail = false; } public static void Real_IN_Init() { - RW.IN_Init(); + // mouse variables + Globals.m_filter = Cvar.Get("m_filter", "0", 0); + Globals.in_mouse = Cvar.Get("in_mouse", "1", CVAR_ARCHIVE); + Globals.freelook = Cvar.Get("freelook", "0", 0 ); + Globals.lookstrafe = Cvar.Get("lookstrafe", "0", 0); + Globals.sensitivity = Cvar.Get("sensitivity", "3", 0); + Globals.m_pitch = Cvar.Get("m_pitch", "0.022", 0); + Globals.m_yaw = Cvar.Get("m_yaw", "0.022", 0); + Globals.m_forward = Cvar.Get("m_forward", "1", 0); + Globals.m_side = Cvar.Get("m_side", "0.8", 0); + + Cmd.AddCommand("+mlook", new xcommand_t() { + public void execute() {MLookDown();}}); + Cmd.AddCommand("-mlook", new xcommand_t() { + public void execute() {MLookUp();}}); + + Cmd.AddCommand ("force_centerview", new xcommand_t() { + public void execute() {Force_CenterView_f();}}); + + Cmd.AddCommand ("togglemouse", new xcommand_t() { + public void execute() {toggleMouse();}}); + + IN.mouse_avail = true; } public static void Commands() { - RW.IN_Commands(); + int i; + + if (!IN.mouse_avail) + return; + + for (i=0 ; i<3 ; i++) { + if ( (IN.mouse_buttonstate & (1<<i)) != 0 && (IN.mouse_oldbuttonstate & (1<<i)) == 0 ) + KBD.Do_Key_Event(Key.K_MOUSE1 + i, true); + + if ( (IN.mouse_buttonstate & (1<<i)) == 0 && (IN.mouse_oldbuttonstate & (1<<i)) != 0 ) + KBD.Do_Key_Event(Key.K_MOUSE1 + i, false); + } + IN.mouse_oldbuttonstate = IN.mouse_buttonstate; } public static void Frame() { if ( !cl.refresh_prepped || cls.key_dest == key_console || cls.key_dest == key_menu) - RW.IN_Activate(false); + DeactivateMouse(); else - RW.IN_Activate(true); - - RW.IN_Frame(); + ActivateMouse(); } public static void CenterView() { @@ -116,7 +163,46 @@ public final class IN extends Globals { } public static void Move(usercmd_t cmd) { - RW.IN_Move(cmd); + if (!IN.mouse_avail) + return; + + if (Globals.m_filter.value != 0.0f) { + KBD.mx = (KBD.mx + IN.old_mouse_x) / 2; + KBD.my = (KBD.my + IN.old_mouse_y) / 2; + } + + IN.old_mouse_x = KBD.mx; + IN.old_mouse_y = KBD.my; + + KBD.mx = (int)(KBD.mx * Globals.sensitivity.value); + KBD.my = (int)(KBD.my * Globals.sensitivity.value); + + // add mouse X/Y movement to cmd + if ( (CL_input.in_strafe.state & 1) != 0 || ((Globals.lookstrafe.value != 0) && IN.mlooking )) { + cmd.sidemove += Globals.m_side.value * KBD.mx; + } else { + Globals.cl.viewangles[YAW] -= Globals.m_yaw.value * KBD.mx; + } + + if ( (IN.mlooking || Globals.freelook.value != 0.0f) && (CL_input.in_strafe.state & 1) == 0) { + Globals.cl.viewangles[PITCH] += Globals.m_pitch.value * KBD.my; + } else { + cmd.forwardmove -= Globals.m_forward.value * KBD.my; + } + KBD.mx = KBD.my = 0; + } + + static void MLookDown() { + mlooking = true; + } + + static void MLookUp() { + mlooking = false; + CenterView(); + } + + static void Force_CenterView_f() { + Globals.cl.viewangles[PITCH] = 0; } } diff --git a/src/jake2/sys/RW.java b/src/jake2/sys/RW.java deleted file mode 100644 index 31ca7ca..0000000 --- a/src/jake2/sys/RW.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * RW.java - * Copyright (C) 2004 - * - * $Id: RW.java,v 1.1 2004-07-07 19:59:52 hzi Exp $ - */ -/* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -package jake2.sys; - -import jake2.Globals; -import jake2.client.CL; -import jake2.client.Key; -import jake2.game.Cmd; -import jake2.game.usercmd_t; -import jake2.qcommon.Cvar; -import jake2.qcommon.xcommand_t; - -/** - * RW - */ -public final class RW extends Globals { - static int mouse_buttonstate; - static int mouse_oldbuttonstate; - static int old_mouse_x; - static int old_mouse_y; - static boolean mlooking; - - static void IN_MLookDown() { - mlooking = true; - } - - static void IN_MLookUp() { - mlooking = false; - IN.CenterView(); - } - - static void IN_Init(/*in_state_t in_state_p*/) { - int mtype; - int i; - -// in_state = in_state_p; - - // mouse variables - m_filter = Cvar.Get("m_filter", "0", 0); - in_mouse = Cvar.Get("in_mouse", "1", CVAR_ARCHIVE); - freelook = Cvar.Get("freelook", "0", 0 ); - lookstrafe = Cvar.Get("lookstrafe", "0", 0); - sensitivity = Cvar.Get("sensitivity", "3", 0); - m_pitch = Cvar.Get("m_pitch", "0.022", 0); - m_yaw = Cvar.Get("m_yaw", "0.022", 0); - m_forward = Cvar.Get("m_forward", "1", 0); - m_side = Cvar.Get("m_side", "0.8", 0); - - Cmd.AddCommand("+mlook", new xcommand_t() { - public void execute() {IN_MLookDown();}}); - Cmd.AddCommand("-mlook", new xcommand_t() { - public void execute() {IN_MLookUp();}}); - - Cmd.AddCommand ("force_centerview", new xcommand_t() { - public void execute() {Force_CenterView_f();}}); - - IN.mouse_avail = true; - } - - static void Force_CenterView_f() { - cl.viewangles[PITCH] = 0; - } - - public static void IN_Shutdown() { - IN.mouse_avail = false; - } - - static void IN_Frame() { - } - - static void IN_Activate(boolean active) { - if (active) - IN.ActivateMouse(); - else - IN.DeactivateMouse (); - } - - static void IN_Commands() { - int i; - - if (!IN.mouse_avail) - return; - - for (i=0 ; i<3 ; i++) { - if ( (mouse_buttonstate & (1<<i)) != 0 && (mouse_oldbuttonstate & (1<<i)) == 0 ) - KBD.Do_Key_Event(Key.K_MOUSE1 + i, true); - - if ( (mouse_buttonstate & (1<<i)) == 0 && (mouse_oldbuttonstate & (1<<i)) != 0 ) - KBD.Do_Key_Event(Key.K_MOUSE1 + i, false); - } - mouse_oldbuttonstate = mouse_buttonstate; - } - - /* - =========== - IN_Move - =========== - */ - static void IN_Move(usercmd_t cmd) { - if (!IN.mouse_avail) - return; - - if (m_filter.value != 0.0f) { - KBD.mx = (KBD.mx + old_mouse_x) / 2; - KBD.my = (KBD.my + old_mouse_y) / 2; - } - - old_mouse_x = KBD.mx; - old_mouse_y = KBD.my; - - KBD.mx = (int)(KBD.mx * sensitivity.value); - KBD.my = (int)(KBD.my * sensitivity.value); - - // add mouse X/Y movement to cmd - if ( (CL.in_strafe.state & 1) != 0 || ((lookstrafe.value != 0) && mlooking )) { - cmd.sidemove += m_side.value * KBD.mx; - } else { - cl.viewangles[YAW] -= m_yaw.value * KBD.mx; - } - - if ( (mlooking || freelook.value != 0.0f) && (CL.in_strafe.state & 1) == 0) { - cl.viewangles[PITCH] += m_pitch.value * KBD.my; - } else { - cmd.forwardmove -= m_forward.value * KBD.my; - } - KBD.mx = KBD.my = 0; - } -} diff --git a/src/jake2/sys/Sys.java b/src/jake2/sys/Sys.java index 6327531..5e8c0df 100644 --- a/src/jake2/sys/Sys.java +++ b/src/jake2/sys/Sys.java @@ -2,7 +2,7 @@ * Sys.java * Copyright (C) 2003 * - * $Id: Sys.java,v 1.1 2004-07-07 19:59:52 hzi Exp $ + * $Id: Sys.java,v 1.2 2004-07-08 15:58:47 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -201,7 +201,9 @@ public final class Sys extends Defines { secbase = System.currentTimeMillis(); return 0; } - return Globals.curtime = (int)(System.currentTimeMillis() - secbase); + + return Globals.curtime = (int) (Globals.slomo.value * (System.currentTimeMillis() - secbase)); + } //============================================ diff --git a/src/jake2/util/Lib.java b/src/jake2/util/Lib.java index 8ec58e1..bab5ff0 100644 --- a/src/jake2/util/Lib.java +++ b/src/jake2/util/Lib.java @@ -19,25 +19,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 09.12.2003 by RST. -// $Id: Lib.java,v 1.1 2004-07-07 19:59:52 hzi Exp $ +// $Id: Lib.java,v 1.2 2004-07-08 15:58:48 hzi Exp $ package jake2.util; -import java.io.File; -import java.io.IOException; -import java.io.RandomAccessFile; +import jake2.Globals; +import jake2.qcommon.Com; +import jake2.qcommon.FS; + +import java.io.*; import java.nio.ByteBuffer; -import java.text.BreakIterator; import java.util.Arrays; import java.util.StringTokenizer; -import java.util.Vector; - -import jake2.*; -import jake2.client.*; -import jake2.game.*; -import jake2.qcommon.*; -import jake2.render.*; -import jake2.server.*; public class Lib { @@ -86,19 +79,21 @@ public class Lib { return Com.sprintf("%8.2f %8.2f %8.2f", new Vargs().add(v[0]).add(v[1]).add(v[2])); } public static short rand() { - return (short) (Math.random() * 0x8000); + //return (short) (Math.random() * 0x8000); + return (short)Globals.rnd.nextInt(Short.MAX_VALUE+1); } public static float crandom() { - return (float) (Math.random() - 0.5) * 2.0f; + return (Globals.rnd.nextFloat() - 0.5f) * 2.0f; + //return (float) (Math.random() - 0.5) * 2.0f; } public static float random() { - return (float) Math.random(); + return Globals.rnd.nextFloat(); } public static float crand() { - return (float) (Math.random() - 0.5) * 2.0f; + return (Globals.rnd.nextFloat() - 0.5f) * 2.0f; } public static float frand() { - return (float) Math.random(); + return Globals.rnd.nextFloat(); } public static int strcmp(String in1, String in2) { @@ -172,9 +167,9 @@ public class Lib { return res; } - public static int strlen(String in) { - return in.length(); - } +// public static int strlen(String in) { +// return in.length(); +// } public static int strlen(char in[]) { for (int i = 0; i < in.length; i++) @@ -427,7 +422,6 @@ public class Lib { catch (Exception e) { return 1; } - return 0; } public static byte[] getIntBytes(int c) { diff --git a/src/jake2/util/Math3D.java b/src/jake2/util/Math3D.java index 117487c..6c607b3 100644 --- a/src/jake2/util/Math3D.java +++ b/src/jake2/util/Math3D.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 09.12.2003 by RST. -// $Id: Math3D.java,v 1.1 2004-07-07 19:59:53 hzi Exp $ +// $Id: Math3D.java,v 1.2 2004-07-08 15:58:48 hzi Exp $ package jake2.util; @@ -29,10 +29,12 @@ import jake2.qcommon.Com; public class Math3D extends Lib { - public static void set(float v1[], float v2[]) - { - for (int i=0; i < v1.length; i++) - v1[i]=v2[i]; + static final float shortratio = 360.0f / 65536.0f; + static final float piratio = (float)(Math.PI / 360.0); + + public static void set(float v1[], float v2[]) { + for (int i = 0; i < v1.length; i++) + v1[i] = v2[i]; } @@ -114,18 +116,18 @@ public class Math3D extends Lib { } return length; } - public static final float VectorNormalize2(float[] v, float[] to) { - float length, ilength; - - length = VectorLength(v); - if (length != 0.0f) { - ilength = 1.0f / length; - to[0] = v[0] * length; - to[1] = v[1] * length; - to[2] = v[2] * length; - } - return length; - } +// public static final float VectorNormalize2(float[] v, float[] to) { +// float length, ilength; +// +// length = VectorLength(v); +// if (length != 0.0f) { +// ilength = 1.0f / length; +// to[0] = v[0] * ilength; +// to[1] = v[1] * ilength; +// to[2] = v[2] * ilength; +// } +// return length; +// } public static final float VectorLength(float v[]) { return (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); } @@ -265,7 +267,7 @@ public class Math3D extends Lib { public static float SHORT2ANGLE(int x) { - return ((x) * (360.0f / 65536)); + return (x * shortratio); } /* @@ -450,13 +452,13 @@ public class Math3D extends Lib { float angle; float sr, sp, sy, cr, cp, cy; - angle = (float) (angles[Defines.YAW] * (Math.PI * 2 / 360)); + angle = (float) (angles[Defines.YAW] * (2.0f * piratio)); sy = (float) Math.sin(angle); cy = (float) Math.cos(angle); - angle = (float) (angles[Defines.PITCH] * (Math.PI * 2 / 360)); + angle = (float) (angles[Defines.PITCH] * (2.0f * piratio)); sp = (float) Math.sin(angle); cp = (float) Math.cos(angle); - angle = (float) (angles[Defines.ROLL] * (Math.PI * 2 / 360)); + angle = (float) (angles[Defines.ROLL] * (2.0f * piratio)); sr = (float) Math.sin(angle); cr = (float) Math.cos(angle); @@ -481,11 +483,16 @@ public class Math3D extends Lib { m[0][0] = m[0][1] = m[0][2] = m[1][0] = m[1][1] = m[1][2] = m[2][0] = m[2][1] = m[2][2] = 0.0f; } - public static final void MatCopy(float src[][], float dst[][]) { - for (int i = 0; i < 3; i++) - { - VectorCopy(src[i], dst[i]); - } + private static final void MatCopy(float src[][], float dst[][]) { + dst[0][0]=src[0][0]; + dst[0][1]=src[0][1]; + dst[0][2]=src[0][2]; + dst[1][0]=src[1][0]; + dst[1][1]=src[1][1]; + dst[1][2]=src[1][2]; + dst[2][0]=src[2][0]; + dst[2][1]=src[2][1]; + dst[2][2]=src[2][2]; } public static void G_ProjectSource(float[] point, float[] distance, float[] forward, float[] right, float[] result) { @@ -526,13 +533,13 @@ public class Math3D extends Lib { public static float anglemod(float a) { - return (float) (360.0f / 65536) * ((int) (a * (65536 / 360.0f)) & 65535); + return (float) (shortratio) * ((int) (a / (shortratio)) & 65535); } public static int ANGLE2SHORT(float x) { - return ((int) ((x) * 65536f / 360f) & 65535); + return ((int) ((x) / shortratio) & 65535); } @@ -553,11 +560,11 @@ public class Math3D extends Lib { if (fov_x < 1.0f || fov_x > 179.0f) Com.Error(Defines.ERR_DROP, "Bad fov: " + fov_x); - x = width / Math.tan(fov_x / 360.0 * Math.PI); + x = width / Math.tan(fov_x * piratio); a = Math.atan(height / x); - a = a * 360 / Math.PI; + a = a / piratio; return (float)a; } |