You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(52) |
Aug
(34) |
Sep
(99) |
Oct
(110) |
Nov
(21) |
Dec
(69) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(117) |
Feb
(90) |
Mar
(1) |
Apr
(22) |
May
(96) |
Jun
(25) |
Jul
(22) |
Aug
|
Sep
|
Oct
(18) |
Nov
(43) |
Dec
(71) |
2006 |
Jan
(20) |
Feb
(10) |
Mar
|
Apr
(4) |
May
(2) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
(60) |
Nov
(63) |
Dec
(35) |
2007 |
Jan
(18) |
Feb
(40) |
Mar
(14) |
Apr
(18) |
May
(33) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
(1) |
Mar
(25) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Carsten W. <ca...@us...> - 2005-11-21 19:39:51
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20627/src/jake2/client Modified Files: CL.java Log Message: add SCR.RunCinematics() (see C code) Index: CL.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CL.java 1 Jul 2005 14:20:48 -0000 1.23 --- CL.java 21 Nov 2005 19:39:43 -0000 1.24 *************** *** 1573,1577 **** CL_fx.RunDLights(); CL_fx.RunLightStyles(); ! SCR.RunConsole(); --- 1573,1577 ---- CL_fx.RunDLights(); CL_fx.RunLightStyles(); ! SCR.RunCinematic(); SCR.RunConsole(); |
From: Carsten W. <ca...@us...> - 2005-11-21 19:38:46
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20447/src/jake2/client Modified Files: client_state_t.java Log Message: use a memory mapped file as video source (ByteBuffer) Index: client_state_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/client_state_t.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** client_state_t.java 26 Oct 2004 18:18:19 -0000 1.4 --- client_state_t.java 21 Nov 2005 19:38:38 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- import java.io.RandomAccessFile; + import java.nio.ByteBuffer; public class client_state_t { *************** *** 107,111 **** // non-gameserver infornamtion // FIXME: move this cinematic stuff into the cin_t structure ! RandomAccessFile cinematic_file; int cinematictime; // cls.realtime for first cinematic frame --- 108,112 ---- // non-gameserver infornamtion // FIXME: move this cinematic stuff into the cin_t structure ! ByteBuffer cinematic_file; int cinematictime; // cls.realtime for first cinematic frame |
From: Rene S. <sa...@us...> - 2005-11-20 22:25:36
|
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27958/src/jake2/game Modified Files: SuperAdapter.java Log Message: cosmetic Index: SuperAdapter.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/SuperAdapter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SuperAdapter.java 20 Nov 2005 22:18:33 -0000 1.8 --- SuperAdapter.java 20 Nov 2005 22:25:28 -0000 1.9 *************** *** 38,43 **** /** Adapter registration. */ private static void register(SuperAdapter sa, String id) { - if (id.length()==0) - Math.sin(0.1); adapters.put(id, sa); } --- 38,41 ---- |
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25864/src/jake2/game Modified Files: ItemUseAdapter.java GameWeapon.java GameFunc.java GameUtil.java GameTrigger.java GameSave.java ItemDropAdapter.java GameTarget.java SuperAdapter.java PlayerClient.java PlayerHud.java Cmd.java GameSpawn.java GameMisc.java Monster.java PlayerWeapon.java GameItems.java GameAI.java GameTurret.java Added Files: GameItemList.java Log Message: savegames are now independend from different jake2 builds and releases Index: GameTrigger.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameTrigger.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GameTrigger.java 16 Nov 2005 22:24:52 -0000 1.5 --- GameTrigger.java 20 Nov 2005 22:18:33 -0000 1.6 *************** *** 244,247 **** --- 244,248 ---- // the wait time has passed, so set back up for another activation public static EntThinkAdapter multi_wait = new EntThinkAdapter() { + public String getID(){ return "multi_wait"; } public boolean think(edict_t ent) { *************** *** 252,255 **** --- 253,257 ---- static EntUseAdapter Use_Multi = new EntUseAdapter() { + public String getID(){ return "Use_Multi"; } public void use(edict_t ent, edict_t other, edict_t activator) { ent.activator = activator; *************** *** 259,262 **** --- 261,265 ---- static EntTouchAdapter Touch_Multi = new EntTouchAdapter() { + public String getID(){ return "Touch_Multi"; } public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { *************** *** 291,294 **** --- 294,298 ---- */ static EntUseAdapter trigger_enable = new EntUseAdapter() { + public String getID(){ return "trigger_enable"; } public void use(edict_t self, edict_t other, edict_t activator) { self.solid = Defines.SOLID_TRIGGER; *************** *** 303,306 **** --- 307,311 ---- */ public static EntUseAdapter trigger_relay_use = new EntUseAdapter() { + public String getID(){ return "trigger_relay_use"; } public void use(edict_t self, edict_t other, edict_t activator) { GameUtil.G_UseTargets(self, activator); *************** *** 323,326 **** --- 328,332 ---- static EntUseAdapter trigger_key_use = new EntUseAdapter() { + public String getID(){ return "trigger_key_use"; } public void use(edict_t self, edict_t other, edict_t activator) { int index; *************** *** 407,410 **** --- 413,417 ---- */ static EntUseAdapter trigger_counter_use = new EntUseAdapter() { + public String getID(){ return "trigger_counter_use"; } public void use(edict_t self, edict_t other, edict_t activator) { *************** *** 448,451 **** --- 455,459 ---- static EntTouchAdapter trigger_push_touch = new EntTouchAdapter() { + public String getID(){ return "trigger_push_touch"; } public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { *************** *** 493,496 **** --- 501,505 ---- */ static EntUseAdapter hurt_use = new EntUseAdapter() { + public String getID(){ return "hurt_use"; } public void use(edict_t self, edict_t other, edict_t activator) { *************** *** 507,510 **** --- 516,520 ---- static EntTouchAdapter hurt_touch = new EntTouchAdapter() { + public String getID(){ return "hurt_touch"; } public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { *************** *** 552,555 **** --- 562,566 ---- static EntTouchAdapter trigger_gravity_touch = new EntTouchAdapter() { + public String getID(){ return "trigger_gravity_touch"; } public void touch(edict_t self, edict_t other, cplane_t plane, *************** *** 575,578 **** --- 586,590 ---- static EntTouchAdapter trigger_monsterjump_touch = new EntTouchAdapter() { + public String getID(){ return "trigger_monsterjump_touch"; } public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { Index: GameAI.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameAI.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GameAI.java 16 Nov 2005 22:24:53 -0000 1.8 --- GameAI.java 20 Nov 2005 22:18:33 -0000 1.9 *************** *** 358,361 **** --- 358,362 ---- public static EntThinkAdapter walkmonster_start_go = new EntThinkAdapter() { + public String getID() { return "walkmonster_start_go"; } public boolean think(edict_t self) { *************** *** 382,385 **** --- 383,388 ---- public static EntThinkAdapter walkmonster_start = new EntThinkAdapter() { + public String getID() { return "walkmonster_start";} + public boolean think(edict_t self) { *************** *** 391,394 **** --- 394,398 ---- public static EntThinkAdapter flymonster_start_go = new EntThinkAdapter() { + public String getID() { return "flymonster_start_go";} public boolean think(edict_t self) { if (!M.M_walkmove(self, 0, 0)) *************** *** 409,412 **** --- 413,417 ---- public static EntThinkAdapter flymonster_start = new EntThinkAdapter() { + public String getID() { return "flymonster_start";} public boolean think(edict_t self) { self.flags |= Defines.FL_FLY; *************** *** 418,421 **** --- 423,427 ---- public static EntThinkAdapter swimmonster_start_go = new EntThinkAdapter() { + public String getID() { return "swimmonster_start_go";} public boolean think(edict_t self) { if (0 == self.yaw_speed) *************** *** 432,435 **** --- 438,442 ---- public static EntThinkAdapter swimmonster_start = new EntThinkAdapter() { + public String getID() { return "swimmonster_start";} public boolean think(edict_t self) { self.flags |= Defines.FL_SWIM; *************** *** 444,450 **** * * 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) { --- 451,459 ---- * * 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 String getID() { return "ai_turn";} public void ai(edict_t self, float dist) { *************** *** 468,471 **** --- 477,481 ---- */ public static AIAdapter ai_move = new AIAdapter() { + public String getID() { return "ai_move";} public void ai(edict_t self, float dist) { M.M_walkmove(self, self.s.angles[Defines.YAW], dist); *************** *** 481,484 **** --- 491,495 ---- */ public static AIAdapter ai_walk = new AIAdapter() { + public String getID() { return "ai_walk";} public void ai(edict_t self, float dist) { if (self.index == 312) *************** *** 515,518 **** --- 526,530 ---- public static AIAdapter ai_stand = new AIAdapter() { + public String getID() { return "ai_stand";} public void ai(edict_t self, float dist) { float[] v = { 0, 0, 0 }; *************** *** 570,574 **** */ public static AIAdapter ai_charge = new AIAdapter() { ! public void ai(edict_t self, float dist) { float[] v = { 0, 0, 0 }; --- 582,586 ---- */ public static AIAdapter ai_charge = new AIAdapter() { ! public String getID() { return "ai_charge";} public void ai(edict_t self, float dist) { float[] v = { 0, 0, 0 }; *************** *** 591,594 **** --- 603,607 ---- */ public static AIAdapter ai_run = new AIAdapter() { + public String getID() { return "ai_run";} public void ai(edict_t self, float dist) { float[] v = { 0, 0, 0 }; Index: GameItems.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameItems.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameItems.java 16 Nov 2005 22:24:53 -0000 1.1 --- GameItems.java 20 Nov 2005 22:18:33 -0000 1.2 *************** *** 39,765 **** public class GameItems { - public static gitem_t itemlist[] = { - //leave index 0 alone - new gitem_t(null, null, null, null, null, null, null, 0, null, - null, null, 0, 0, null, 0, 0, null, 0, null), - - // - // ARMOR - // [...1007 lines suppressed...] continue; --- 1033,1037 ---- if (0 == cl.pers.inventory[index]) continue; ! it = GameItemList.itemlist[index]; if (it.use == null) continue; *************** *** 1760,1764 **** if (0 == cl.pers.inventory[index]) continue; ! it = itemlist[index]; if (null == it.use) continue; --- 1064,1068 ---- if (0 == cl.pers.inventory[index]) continue; ! it = GameItemList.itemlist[index]; if (null == it.use) continue; Index: ItemUseAdapter.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/ItemUseAdapter.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ItemUseAdapter.java 7 Jul 2004 19:59:07 -0000 1.1.1.1 --- ItemUseAdapter.java 20 Nov 2005 22:18:33 -0000 1.2 *************** *** 24,28 **** package jake2.game; ! class ItemUseAdapter extends SuperAdapter { public void use(edict_t ent, gitem_t item) { } --- 24,28 ---- package jake2.game; ! public abstract class ItemUseAdapter extends SuperAdapter { public void use(edict_t ent, gitem_t item) { } Index: PlayerClient.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/PlayerClient.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PlayerClient.java 16 Nov 2005 22:24:52 -0000 1.10 --- PlayerClient.java 20 Nov 2005 22:18:33 -0000 1.11 *************** *** 40,43 **** --- 40,44 ---- */ static EntDieAdapter player_die = new EntDieAdapter() { + public String getID() { return "player_die"; } public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { *************** *** 76,80 **** for (n = 0; n < GameBase.game.num_items; n++) { if (GameBase.coop.value != 0 ! && (GameItems.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; --- 77,81 ---- for (n = 0; n < GameBase.game.num_items; n++) { if (GameBase.coop.value != 0 ! && (GameItemList.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; *************** *** 137,140 **** --- 138,142 ---- }; static EntThinkAdapter SP_FixCoopSpots = new EntThinkAdapter() { + public String getID() { return "SP_FixCoopSpots"; } public boolean think(edict_t self) { *************** *** 172,175 **** --- 174,178 ---- }; static EntThinkAdapter SP_CreateCoopSpots = new EntThinkAdapter() { + public String getID() { return "SP_CreateCoopSpots"; } public boolean think(edict_t self) { *************** *** 206,213 **** --- 209,218 ---- // player pain is handled at the end of the frame in P_DamageFeedback static EntPainAdapter player_pain = new EntPainAdapter() { + public String getID() { return "player_pain"; } public void pain(edict_t self, edict_t other, float kick, int damage) { } }; static EntDieAdapter body_die = new EntDieAdapter() { + public String getID() { return "body_die"; } public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { Index: SuperAdapter.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/SuperAdapter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SuperAdapter.java 8 Feb 2005 17:58:46 -0000 1.7 --- SuperAdapter.java 20 Nov 2005 22:18:33 -0000 1.8 *************** *** 29,36 **** import java.util.Vector; ! public class SuperAdapter { /** Adapter registration. */ private static void register(SuperAdapter sa, String id) { adapters.put(id, sa); } --- 29,43 ---- import java.util.Vector; ! public abstract class SuperAdapter { ! ! /** Constructor, does the adapter registration. */ ! public SuperAdapter() { ! register(this, getID()); ! } /** Adapter registration. */ private static void register(SuperAdapter sa, String id) { + if (id.length()==0) + Math.sin(0.1); adapters.put(id, sa); } *************** *** 46,68 **** if (sa == null) { Com.DPrintf("SuperAdapter.getFromID():adapter not found->" + key + "\n"); - int pos= key.indexOf('$'); - String classname= key; - if (pos != -1) - classname= key.substring(0, pos); - - // load class and instantiate - try { - Com.DPrintf("SuperAdapter.getFromID():loading class->" + classname + "\n"); - Class.forName(classname); - } - catch (Exception e) { - Com.DPrintf("SuperAdapter.getFromID():class not found->" + classname + "\n"); - } - - // try it again... - sa= (SuperAdapter) adapters.get(key); - - if (sa == null) - Com.DPrintf("jake2: could not load adapter:" + key + "\n"); } --- 53,56 ---- *************** *** 70,89 **** } - /** Constructor, does the adapter registration. */ - public SuperAdapter() { - StackTraceElement tr[]= new Throwable().getStackTrace(); - adapterid= tr[2].getClassName(); - if (adapterid.length() == 0) - new Throwable("error in creating an adapter id!").printStackTrace(); - else - register(this, adapterid); - } - /** Returns the Adapter-ID. */ ! public String getID() { ! return adapterid; ! } ! ! /** Adapter id. */ ! private String adapterid; } --- 58,62 ---- } /** Returns the Adapter-ID. */ ! public abstract String getID(); } Index: ItemDropAdapter.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/ItemDropAdapter.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ItemDropAdapter.java 7 Jul 2004 19:59:07 -0000 1.1.1.1 --- ItemDropAdapter.java 20 Nov 2005 22:18:33 -0000 1.2 *************** *** 24,29 **** package jake2.game; ! public class ItemDropAdapter extends SuperAdapter { ! void drop(edict_t ent, gitem_t item) { } } --- 24,29 ---- package jake2.game; ! public abstract class ItemDropAdapter extends SuperAdapter { ! public void drop(edict_t ent, gitem_t item) { } } Index: Cmd.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/Cmd.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Cmd.java 16 Nov 2005 22:24:52 -0000 1.15 --- Cmd.java 20 Nov 2005 22:18:33 -0000 1.16 *************** *** 504,508 **** if (give_all || 0 == Lib.Q_stricmp(name, "weapons")) { for (i = 1; i < GameBase.game.num_items; i++) { ! it = GameItems.itemlist[i]; if (null == it.pickup) continue; --- 504,508 ---- if (give_all || 0 == Lib.Q_stricmp(name, "weapons")) { for (i = 1; i < GameBase.game.num_items; i++) { ! it = GameItemList.itemlist[i]; if (null == it.pickup) continue; *************** *** 517,521 **** if (give_all || 0 == Lib.Q_stricmp(name, "ammo")) { for (i = 1; i < GameBase.game.num_items; i++) { ! it = GameItems.itemlist[i]; if (null == it.pickup) continue; --- 517,521 ---- if (give_all || 0 == Lib.Q_stricmp(name, "ammo")) { for (i = 1; i < GameBase.game.num_items; i++) { ! it = GameItemList.itemlist[i]; if (null == it.pickup) continue; *************** *** 560,564 **** if (give_all) { for (i = 1; i < GameBase.game.num_items; i++) { ! it = GameItems.itemlist[i]; if (it.pickup != null) continue; --- 560,564 ---- if (give_all) { for (i = 1; i < GameBase.game.num_items; i++) { ! it = GameItemList.itemlist[i]; if (it.pickup != null) continue; *************** *** 799,803 **** } ! it = GameItems.itemlist[ent.client.pers.selected_item]; if (it.use == null) { SV_GAME --- 799,803 ---- } ! it = GameItemList.itemlist[ent.client.pers.selected_item]; if (it.use == null) { SV_GAME *************** *** 835,839 **** continue; ! it = GameItems.itemlist[index]; if (it.use == null) continue; --- 835,839 ---- continue; ! it = GameItemList.itemlist[index]; if (it.use == null) continue; *************** *** 876,880 **** if (0 == cl.pers.inventory[index]) continue; ! it = GameItems.itemlist[index]; if (null == it.use) continue; --- 876,880 ---- if (0 == cl.pers.inventory[index]) continue; ! it = GameItemList.itemlist[index]; if (null == it.use) continue; *************** *** 907,911 **** if (0 == cl.pers.inventory[index]) return; ! it = GameItems.itemlist[index]; if (null == it.use) return; --- 907,911 ---- if (0 == cl.pers.inventory[index]) return; ! it = GameItemList.itemlist[index]; if (null == it.use) return; *************** *** 932,936 **** } ! it = GameItems.itemlist[ent.client.pers.selected_item]; if (it.drop == null) { SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, --- 932,936 ---- } ! it = GameItemList.itemlist[ent.client.pers.selected_item]; if (it.drop == null) { SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, Index: GameSpawn.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameSpawn.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GameSpawn.java 16 Nov 2005 22:24:53 -0000 1.13 --- GameSpawn.java 20 Nov 2005 22:18:33 -0000 1.14 *************** *** 34,37 **** --- 34,38 ---- static EntThinkAdapter SP_item_health = new EntThinkAdapter() { + public String getID(){ return "SP_item_health"; } public boolean think(edict_t ent) { GameItems.SP_item_health(ent); *************** *** 41,44 **** --- 42,46 ---- static EntThinkAdapter SP_item_health_small = new EntThinkAdapter() { + public String getID(){ return "SP_item_health_small"; } public boolean think(edict_t ent) { GameItems.SP_item_health_small(ent); *************** *** 48,51 **** --- 50,54 ---- static EntThinkAdapter SP_item_health_large = new EntThinkAdapter() { + public String getID(){ return "SP_item_health_large"; } public boolean think(edict_t ent) { GameItems.SP_item_health_large(ent); *************** *** 55,58 **** --- 58,62 ---- static EntThinkAdapter SP_item_health_mega = new EntThinkAdapter() { + public String getID(){ return "SP_item_health_mega"; } public boolean think(edict_t ent) { GameItems.SP_item_health_mega(ent); *************** *** 62,65 **** --- 66,70 ---- static EntThinkAdapter SP_info_player_start = new EntThinkAdapter() { + public String getID(){ return "SP_info_player_start"; } public boolean think(edict_t ent) { PlayerClient.SP_info_player_start(ent); *************** *** 69,72 **** --- 74,78 ---- static EntThinkAdapter SP_info_player_deathmatch = new EntThinkAdapter() { + public String getID(){ return "SP_info_player_deathmatch"; } public boolean think(edict_t ent) { PlayerClient.SP_info_player_deathmatch(ent); *************** *** 76,79 **** --- 82,86 ---- static EntThinkAdapter SP_info_player_coop = new EntThinkAdapter() { + public String getID(){ return "SP_info_player_coop"; } public boolean think(edict_t ent) { PlayerClient.SP_info_player_coop(ent); *************** *** 83,86 **** --- 90,94 ---- static EntThinkAdapter SP_info_player_intermission = new EntThinkAdapter() { + public String getID(){ return "SP_info_player_intermission"; } public boolean think(edict_t ent) { PlayerClient.SP_info_player_intermission(); *************** *** 90,93 **** --- 98,102 ---- static EntThinkAdapter SP_func_plat = new EntThinkAdapter() { + public String getID(){ return "SP_func_plat"; } public boolean think(edict_t ent) { GameFunc.SP_func_plat(ent); *************** *** 107,110 **** --- 116,120 ---- // {public boolean think(edict_t ent){ return true;}}; static EntThinkAdapter SP_func_water = new EntThinkAdapter() { + public String getID(){ return "SP_func_water"; } public boolean think(edict_t ent) { GameFunc.SP_func_water(ent); *************** *** 114,117 **** --- 124,128 ---- static EntThinkAdapter SP_func_train = new EntThinkAdapter() { + public String getID(){ return "SP_func_train"; } public boolean think(edict_t ent) { GameFunc.SP_func_train(ent); *************** *** 133,136 **** --- 144,148 ---- // boolean think(edict_t ent){ return true;}}; static EntThinkAdapter SP_func_clock = new EntThinkAdapter() { + public String getID(){ return "SP_func_clock"; } public boolean think(edict_t ent) { GameMisc.SP_func_clock(ent); *************** *** 149,152 **** --- 161,165 ---- static EntThinkAdapter SP_worldspawn = new EntThinkAdapter() { + public String getID(){ return "SP_worldspawn"; } public boolean think(edict_t ent) { *************** *** 649,652 **** --- 662,666 ---- new spawn_t("func_clock", SP_func_clock), new spawn_t("func_wall", new EntThinkAdapter() { + public String getID(){ return "func_wall"; } public boolean think(edict_t ent) { GameMisc.SP_func_wall(ent); *************** *** 655,658 **** --- 669,673 ---- }), new spawn_t("func_object", new EntThinkAdapter() { + public String getID(){ return "SP_func_object"; } public boolean think(edict_t ent) { GameMisc.SP_func_object(ent); *************** *** 661,664 **** --- 676,680 ---- }), new spawn_t("func_timer", new EntThinkAdapter() { + public String getID(){ return "SP_func_timer"; } public boolean think(edict_t ent) { GameFunc.SP_func_timer(ent); *************** *** 667,670 **** --- 683,687 ---- }), new spawn_t("func_explosive", new EntThinkAdapter() { + public String getID(){ return "SP_func_explosive"; } public boolean think(edict_t ent) { GameMisc.SP_func_explosive(ent); *************** *** 674,677 **** --- 691,695 ---- new spawn_t("func_killbox", GameFunc.SP_func_killbox), new spawn_t("trigger_always", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_always"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_always(ent); *************** *** 680,683 **** --- 698,702 ---- }), new spawn_t("trigger_once", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_once"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_once(ent); *************** *** 686,689 **** --- 705,709 ---- }), new spawn_t("trigger_multiple", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_multiple"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_multiple(ent); *************** *** 692,695 **** --- 712,716 ---- }), new spawn_t("trigger_relay", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_relay"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_relay(ent); *************** *** 698,701 **** --- 719,724 ---- }), new spawn_t("trigger_push", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_push"; } + public boolean think(edict_t ent) { GameTrigger.SP_trigger_push(ent); *************** *** 704,707 **** --- 727,731 ---- }), new spawn_t("trigger_hurt", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_hurt"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_hurt(ent); *************** *** 710,713 **** --- 734,738 ---- }), new spawn_t("trigger_key", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_key"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_key(ent); *************** *** 716,719 **** --- 741,745 ---- }), new spawn_t("trigger_counter", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_counter"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_counter(ent); *************** *** 723,726 **** --- 749,753 ---- new spawn_t("trigger_elevator", GameFunc.SP_trigger_elevator), new spawn_t("trigger_gravity", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_gravity"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_gravity(ent); *************** *** 729,732 **** --- 756,760 ---- }), new spawn_t("trigger_monsterjump", new EntThinkAdapter() { + public String getID(){ return "SP_trigger_monsterjump"; } public boolean think(edict_t ent) { GameTrigger.SP_trigger_monsterjump(ent); *************** *** 735,738 **** --- 763,767 ---- }), new spawn_t("target_temp_entity", new EntThinkAdapter() { + public String getID(){ return "SP_target_temp_entity"; } public boolean think(edict_t ent) { GameTarget.SP_target_temp_entity(ent); *************** *** 741,744 **** --- 770,774 ---- }), new spawn_t("target_speaker", new EntThinkAdapter() { + public String getID(){ return "SP_target_speaker"; } public boolean think(edict_t ent) { GameTarget.SP_target_speaker(ent); *************** *** 747,750 **** --- 777,781 ---- }), new spawn_t("target_explosion", new EntThinkAdapter() { + public String getID(){ return "SP_target_explosion"; } public boolean think(edict_t ent) { GameTarget.SP_target_explosion(ent); *************** *** 753,756 **** --- 784,788 ---- }), new spawn_t("target_changelevel", new EntThinkAdapter() { + public String getID(){ return "SP_target_changelevel"; } public boolean think(edict_t ent) { GameTarget.SP_target_changelevel(ent); *************** *** 759,762 **** --- 791,795 ---- }), new spawn_t("target_secret", new EntThinkAdapter() { + public String getID(){ return "SP_target_secret"; } public boolean think(edict_t ent) { GameTarget.SP_target_secret(ent); *************** *** 765,768 **** --- 798,802 ---- }), new spawn_t("target_goal", new EntThinkAdapter() { + public String getID(){ return "SP_target_goal"; } public boolean think(edict_t ent) { GameTarget.SP_target_goal(ent); *************** *** 771,774 **** --- 805,809 ---- }), new spawn_t("target_splash", new EntThinkAdapter() { + public String getID(){ return "SP_target_splash"; } public boolean think(edict_t ent) { GameTarget.SP_target_splash(ent); *************** *** 777,780 **** --- 812,816 ---- }), new spawn_t("target_spawner", new EntThinkAdapter() { + public String getID(){ return "SP_target_spawner"; } public boolean think(edict_t ent) { GameTarget.SP_target_spawner(ent); *************** *** 783,786 **** --- 819,823 ---- }), new spawn_t("target_blaster", new EntThinkAdapter() { + public String getID(){ return "SP_target_blaster"; } public boolean think(edict_t ent) { GameTarget.SP_target_blaster(ent); *************** *** 789,792 **** --- 826,830 ---- }), new spawn_t("target_crosslevel_trigger", new EntThinkAdapter() { + public String getID(){ return "SP_target_crosslevel_trigger"; } public boolean think(edict_t ent) { GameTarget.SP_target_crosslevel_trigger(ent); *************** *** 795,798 **** --- 833,837 ---- }), new spawn_t("target_crosslevel_target", new EntThinkAdapter() { + public String getID(){ return "SP_target_crosslevel_target"; } public boolean think(edict_t ent) { GameTarget.SP_target_crosslevel_target(ent); *************** *** 801,804 **** --- 840,844 ---- }), new spawn_t("target_laser", new EntThinkAdapter() { + public String getID(){ return "SP_target_laser"; } public boolean think(edict_t ent) { GameTarget.SP_target_laser(ent); *************** *** 807,810 **** --- 847,851 ---- }), new spawn_t("target_help", new EntThinkAdapter() { + public String getID(){ return "SP_target_help"; } public boolean think(edict_t ent) { GameTarget.SP_target_help(ent); *************** *** 813,816 **** --- 854,858 ---- }), new spawn_t("target_actor", new EntThinkAdapter() { + public String getID(){ return "SP_target_actor"; } public boolean think(edict_t ent) { M_Actor.SP_target_actor(ent); *************** *** 819,822 **** --- 861,865 ---- }), new spawn_t("target_lightramp", new EntThinkAdapter() { + public String getID(){ return "SP_target_lightramp"; } public boolean think(edict_t ent) { GameTarget.SP_target_lightramp(ent); *************** *** 825,828 **** --- 868,872 ---- }), new spawn_t("target_earthquake", new EntThinkAdapter() { + public String getID(){ return "SP_target_earthquake"; } public boolean think(edict_t ent) { GameTarget.SP_target_earthquake(ent); *************** *** 831,834 **** --- 875,879 ---- }), new spawn_t("target_character", new EntThinkAdapter() { + public String getID(){ return "SP_target_character"; } public boolean think(edict_t ent) { GameMisc.SP_target_character(ent); *************** *** 837,840 **** --- 882,886 ---- }), new spawn_t("target_string", new EntThinkAdapter() { + public String getID(){ return "SP_target_string"; } public boolean think(edict_t ent) { GameMisc.SP_target_string(ent); *************** *** 844,847 **** --- 890,894 ---- new spawn_t("worldspawn", SP_worldspawn), new spawn_t("viewthing", new EntThinkAdapter() { + public String getID(){ return "SP_viewthing"; } public boolean think(edict_t ent) { GameMisc.SP_viewthing(ent); *************** *** 850,853 **** --- 897,901 ---- }), new spawn_t("light", new EntThinkAdapter() { + public String getID(){ return "SP_light"; } public boolean think(edict_t ent) { GameMisc.SP_light(ent); *************** *** 856,859 **** --- 904,908 ---- }), new spawn_t("light_mine1", new EntThinkAdapter() { + public String getID(){ return "SP_light_mine1"; } public boolean think(edict_t ent) { GameMisc.SP_light_mine1(ent); *************** *** 862,865 **** --- 911,915 ---- }), new spawn_t("light_mine2", new EntThinkAdapter() { + public String getID(){ return "SP_light_mine2"; } public boolean think(edict_t ent) { GameMisc.SP_light_mine2(ent); *************** *** 868,871 **** --- 918,922 ---- }), new spawn_t("info_null", new EntThinkAdapter() { + public String getID(){ return "SP_info_null"; } public boolean think(edict_t ent) { GameMisc.SP_info_null(ent); *************** *** 874,877 **** --- 925,929 ---- }), new spawn_t("func_group", new EntThinkAdapter() { + public String getID(){ return "SP_info_null"; } public boolean think(edict_t ent) { GameMisc.SP_info_null(ent); *************** *** 880,883 **** --- 932,936 ---- }), new spawn_t("info_notnull", new EntThinkAdapter() { + public String getID(){ return "info_notnull"; } public boolean think(edict_t ent) { GameMisc.SP_info_notnull(ent); *************** *** 886,889 **** --- 939,943 ---- }), new spawn_t("path_corner", new EntThinkAdapter() { + public String getID(){ return "SP_path_corner"; } public boolean think(edict_t ent) { GameMisc.SP_path_corner(ent); *************** *** 892,895 **** --- 946,950 ---- }), new spawn_t("point_combat", new EntThinkAdapter() { + public String getID(){ return "SP_point_combat"; } public boolean think(edict_t ent) { GameMisc.SP_point_combat(ent); *************** *** 898,901 **** --- 953,957 ---- }), new spawn_t("misc_explobox", new EntThinkAdapter() { + public String getID(){ return "SP_misc_explobox"; } public boolean think(edict_t ent) { GameMisc.SP_misc_explobox(ent); *************** *** 904,907 **** --- 960,964 ---- }), new spawn_t("misc_banner", new EntThinkAdapter() { + public String getID(){ return "SP_misc_banner"; } public boolean think(edict_t ent) { GameMisc.SP_misc_banner(ent); *************** *** 910,913 **** --- 967,971 ---- }), new spawn_t("misc_satellite_dish", new EntThinkAdapter() { + public String getID(){ return "SP_misc_satellite_dish"; } public boolean think(edict_t ent) { GameMisc.SP_misc_satellite_dish(ent); *************** *** 916,919 **** --- 974,978 ---- }), new spawn_t("misc_actor", new EntThinkAdapter() { + public String getID(){ return "SP_misc_actor"; } public boolean think(edict_t ent) { M_Actor.SP_misc_actor(ent); *************** *** 922,925 **** --- 981,985 ---- }), new spawn_t("misc_gib_arm", new EntThinkAdapter() { + public String getID(){ return "SP_misc_gib_arm"; } public boolean think(edict_t ent) { GameMisc.SP_misc_gib_arm(ent); *************** *** 928,931 **** --- 988,992 ---- }), new spawn_t("misc_gib_leg", new EntThinkAdapter() { + public String getID(){ return "SP_misc_gib_leg"; } public boolean think(edict_t ent) { GameMisc.SP_misc_gib_leg(ent); *************** *** 934,937 **** --- 995,999 ---- }), new spawn_t("misc_gib_head", new EntThinkAdapter() { + public String getID(){ return "SP_misc_gib_head"; } public boolean think(edict_t ent) { GameMisc.SP_misc_gib_head(ent); *************** *** 940,943 **** --- 1002,1006 ---- }), new spawn_t("misc_insane", new EntThinkAdapter() { + public String getID(){ return "SP_misc_insane"; } public boolean think(edict_t ent) { M_Insane.SP_misc_insane(ent); *************** *** 946,949 **** --- 1009,1013 ---- }), new spawn_t("misc_deadsoldier", new EntThinkAdapter() { + public String getID(){ return "SP_misc_deadsoldier"; } public boolean think(edict_t ent) { GameMisc.SP_misc_deadsoldier(ent); *************** *** 952,955 **** --- 1016,1020 ---- }), new spawn_t("misc_viper", new EntThinkAdapter() { + public String getID(){ return "SP_misc_viper"; } public boolean think(edict_t ent) { GameMisc.SP_misc_viper(ent); *************** *** 958,961 **** --- 1023,1027 ---- }), new spawn_t("misc_viper_bomb", new EntThinkAdapter() { + public String getID(){ return "SP_misc_viper_bomb"; } public boolean think(edict_t ent) { GameMisc.SP_misc_viper_bomb(ent); *************** *** 964,967 **** --- 1030,1034 ---- }), new spawn_t("misc_bigviper", new EntThinkAdapter() { + public String getID(){ return "SP_misc_bigviper"; } public boolean think(edict_t ent) { GameMisc.SP_misc_bigviper(ent); *************** *** 970,973 **** --- 1037,1041 ---- }), new spawn_t("misc_strogg_ship", new EntThinkAdapter() { + public String getID(){ return "SP_misc_strogg_ship"; } public boolean think(edict_t ent) { GameMisc.SP_misc_strogg_ship(ent); *************** *** 976,979 **** --- 1044,1048 ---- }), new spawn_t("misc_teleporter", new EntThinkAdapter() { + public String getID(){ return "SP_misc_teleporter"; } public boolean think(edict_t ent) { GameMisc.SP_misc_teleporter(ent); *************** *** 984,987 **** --- 1053,1057 ---- GameMisc.SP_misc_teleporter_dest), new spawn_t("misc_blackhole", new EntThinkAdapter() { + public String getID(){ return "SP_misc_blackhole"; } public boolean think(edict_t ent) { GameMisc.SP_misc_blackhole(ent); *************** *** 990,993 **** --- 1060,1064 ---- }), new spawn_t("misc_eastertank", new EntThinkAdapter() { + public String getID(){ return "SP_misc_eastertank"; } public boolean think(edict_t ent) { GameMisc.SP_misc_eastertank(ent); *************** *** 996,999 **** --- 1067,1071 ---- }), new spawn_t("misc_easterchick", new EntThinkAdapter() { + public String getID(){ return "SP_misc_easterchick"; } public boolean think(edict_t ent) { GameMisc.SP_misc_easterchick(ent); *************** *** 1002,1005 **** --- 1074,1078 ---- }), new spawn_t("misc_easterchick2", new EntThinkAdapter() { + public String getID(){ return "SP_misc_easterchick2"; } public boolean think(edict_t ent) { GameMisc.SP_misc_easterchick2(ent); *************** *** 1008,1011 **** --- 1081,1085 ---- }), new spawn_t("monster_berserk", new EntThinkAdapter() { + public String getID(){ return "SP_monster_berserk"; } public boolean think(edict_t ent) { M_Berserk.SP_monster_berserk(ent); *************** *** 1014,1017 **** --- 1088,1092 ---- }), new spawn_t("monster_gladiator", new EntThinkAdapter() { + public String getID(){ return "SP_monster_gladiator"; } public boolean think(edict_t ent) { M_Gladiator.SP_monster_gladiator(ent); *************** *** 1020,1023 **** --- 1095,1099 ---- }), new spawn_t("monster_gunner", new EntThinkAdapter() { + public String getID(){ return "SP_monster_gunner"; } public boolean think(edict_t ent) { M_Gunner.SP_monster_gunner(ent); *************** *** 1026,1029 **** --- 1102,1106 ---- }), new spawn_t("monster_infantry", new EntThinkAdapter() { + public String getID(){ return "SP_monster_infantry"; } public boolean think(edict_t ent) { M_Infantry.SP_monster_infantry(ent); *************** *** 1038,1041 **** --- 1115,1119 ---- new spawn_t("monster_tank_commander", M_Tank.SP_monster_tank), new spawn_t("monster_medic", new EntThinkAdapter() { + public String getID(){ return "SP_monster_medic"; } public boolean think(edict_t ent) { M_Medic.SP_monster_medic(ent); *************** *** 1043,1046 **** --- 1121,1125 ---- } }), new spawn_t("monster_flipper", new EntThinkAdapter() { + public String getID(){ return "SP_monster_flipper"; } public boolean think(edict_t ent) { M_Flipper.SP_monster_flipper(ent); *************** *** 1048,1051 **** --- 1127,1131 ---- } }), new spawn_t("monster_chick", new EntThinkAdapter() { + public String getID(){ return "SP_monster_chick"; } public boolean think(edict_t ent) { M_Chick.SP_monster_chick(ent); *************** *** 1055,1058 **** --- 1135,1139 ---- new spawn_t("monster_parasite", M_Parasite.SP_monster_parasite), new spawn_t("monster_flyer", new EntThinkAdapter() { + public String getID(){ return "SP_monster_flyer"; } public boolean think(edict_t ent) { M_Flyer.SP_monster_flyer(ent); *************** *** 1060,1063 **** --- 1141,1145 ---- } }), new spawn_t("monster_brain", new EntThinkAdapter() { + public String getID(){ return "SP_monster_brain"; } public boolean think(edict_t ent) { M_Brain.SP_monster_brain(ent); *************** *** 1065,1068 **** --- 1147,1151 ---- } }), new spawn_t("monster_floater", new EntThinkAdapter() { + public String getID(){ return "SP_monster_floater"; } public boolean think(edict_t ent) { M_Float.SP_monster_floater(ent); *************** *** 1070,1073 **** --- 1153,1157 ---- } }), new spawn_t("monster_hover", new EntThinkAdapter() { + public String getID(){ return "SP_monster_hover"; } public boolean think(edict_t ent) { M_Hover.SP_monster_hover(ent); *************** *** 1077,1080 **** --- 1161,1165 ---- new spawn_t("monster_supertank", M_Supertank.SP_monster_supertank), new spawn_t("monster_boss2", new EntThinkAdapter() { + public String getID(){ return "SP_monster_boss2"; } public boolean think(edict_t ent) { M_Boss2.SP_monster_boss2(ent); *************** *** 1082,1085 **** --- 1167,1171 ---- } }), new spawn_t("monster_boss3_stand", new EntThinkAdapter() { + public String getID(){ return "SP_monster_boss3_stand"; } public boolean think(edict_t ent) { M_Boss3.SP_monster_boss3_stand(ent); *************** *** 1087,1090 **** --- 1173,1177 ---- } }), new spawn_t("monster_jorg", new EntThinkAdapter() { + public String getID(){ return "SP_monster_jorg"; } public boolean think(edict_t ent) { M_Boss31.SP_monster_jorg(ent); *************** *** 1092,1095 **** --- 1179,1183 ---- } }), new spawn_t("monster_commander_body", new EntThinkAdapter() { + public String getID(){ return "SP_monster_commander_body"; } public boolean think(edict_t ent) { GameMisc.SP_monster_commander_body(ent); *************** *** 1097,1100 **** --- 1185,1189 ---- } }), new spawn_t("turret_breach", new EntThinkAdapter() { + public String getID(){ return "SP_turret_breach"; } public boolean think(edict_t ent) { GameTurret.SP_turret_breach(ent); *************** *** 1102,1105 **** --- 1191,1195 ---- } }), new spawn_t("turret_base", new EntThinkAdapter() { + public String getID(){ return "SP_turret_base"; } public boolean think(edict_t ent) { GameTurret.SP_turret_base(ent); *************** *** 1107,1110 **** --- 1197,1201 ---- } }), new spawn_t("turret_driver", new EntThinkAdapter() { + public String getID(){ return "SP_turret_driver"; } public boolean think(edict_t ent) { GameTurret.SP_turret_driver(ent); *************** *** 1131,1135 **** for (i = 1; i < GameBase.game.num_items; i++) { ! item = GameItems.itemlist[i]; if (item == null) --- 1222,1226 ---- for (i = 1; i < GameBase.game.num_items; i++) { ! item = GameItemList.itemlist[i]; if (item == null) --- NEW FILE: GameItemList.java --- /* 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 20.11.2005 by RST. // $Id: GameItemList.java,v 1.1 2005/11/20 22:18:34 salomo Exp $ package jake2.game; import jake2.Defines; public class GameItemList { // RST: this was separated in the java conversion from the g_item.c // because all adapters have to be created in the other // classes before this class can be loaded. public static gitem_t itemlist[] = { //leave index 0 alone new gitem_t(null, null, null, null, null, null, null, 0, null, null, null, 0, 0, null, 0, 0, null, 0, null), // // ARMOR // new gitem_t( /* * QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16) */ "item_armor_body", GameItems.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, Defines.IT_ARMOR, 0, GameItems.bodyarmor_info, Defines.ARMOR_BODY, /* precache */ ""), /* * QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("item_armor_combat", GameItems.Pickup_Armor, null, null, null, "misc/ar1_pkup.wav", "models/items/armor/combat/tris.md2", Defines.EF_ROTATE, null, /* icon */ "i_combatarmor", /* pickup */ "Combat Armor", /* width */ 3, 0, null, Defines.IT_ARMOR, 0, GameItems.combatarmor_info, Defines.ARMOR_COMBAT, /* precache */ ""), /* * QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("item_armor_jacket", GameItems.Pickup_Armor, null, null, null, "misc/ar1_pkup.wav", "models/items/armor/jacket/tris.md2", Defines.EF_ROTATE, null, /* icon */ "i_jacketarmor", /* pickup */ "Jacket Armor", /* width */ 3, 0, null, Defines.IT_ARMOR, 0, GameItems.jacketarmor_info, Defines.ARMOR_JACKET, /* precache */ ""), /* * QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("item_armor_shard", GameItems.Pickup_Armor, null, null, null, "misc/ar2_pkup.wav", "models/items/armor/shard/tris.md2", Defines.EF_ROTATE, null, /* icon */ "i_jacketarmor", /* pickup */ "Armor Shard", /* width */ 3, 0, null, Defines.IT_ARMOR, 0, null, Defines.ARMOR_SHARD, /* precache */ ""), /* * QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("item_power_screen", GameItems.Pickup_PowerArmor, GameItems.Use_PowerArmor, GameItems.Drop_PowerArmor, null, "misc/ar3_pkup.wav", "models/items/armor/screen/tris.md2", Defines.EF_ROTATE, null, /* icon */ "i_powerscreen", /* pickup */ "Power Screen", /* width */ 0, 60, null, Defines.IT_ARMOR, 0, null, 0, /* precache */ ""), /* * QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("item_power_shield", GameItems.Pickup_PowerArmor, GameItems.Use_PowerArmor, GameItems.Drop_PowerArmor, null, "misc/ar3_pkup.wav", "models/items/armor/shield/tris.md2", Defines.EF_ROTATE, null, /* icon */ "i_powershield", /* pickup */ "Power Shield", /* width */ 0, 60, null, Defines.IT_ARMOR, 0, null, 0, /* precache */ "misc/power2.wav misc/power1.wav"), // // WEAPONS // /* * weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16) always owned, * never in the world */ new gitem_t("weapon_blaster", null, PlayerWeapon.Use_Weapon, null, PlayerWeapon.Weapon_Blaster, "misc/w_pkup.wav", null, 0, "models/weapons/v_blast/tris.md2", /* icon */ "w_blaster", /* pickup */ "Blaster", 0, 0, null, Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_BLASTER, null, 0, /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"), /* * QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("weapon_shotgun", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_Shotgun, "misc/w_pkup.wav", "models/weapons/g_shotg/tris.md2", Defines.EF_ROTATE, "models/weapons/v_shotg/tris.md2", /* icon */ "w_shotgun", /* pickup */ "Shotgun", 0, 1, "Shells", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_SHOTGUN, null, 0, /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"), /* * QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("weapon_supershotgun", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_SuperShotgun, "misc/w_pkup.wav", "models/weapons/g_shotg2/tris.md2", Defines.EF_ROTATE, "models/weapons/v_shotg2/tris.md2", /* icon */ "w_sshotgun", /* pickup */ "Super Shotgun", 0, 2, "Shells", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_SUPERSHOTGUN, null, 0, /* precache */ "weapons/sshotf1b.wav"), /* * QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "weapon_machinegun", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_Machinegun, "misc/w_pkup.wav", "models/weapons/g_machn/tris.md2", Defines.EF_ROTATE, "models/weapons/v_machn/tris.md2", /* icon */ "w_machinegun", /* pickup */ "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"), /* * QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "weapon_chaingun", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_Chaingun, "misc/w_pkup.wav", "models/weapons/g_chain/tris.md2", Defines.EF_ROTATE, "models/weapons/v_chain/tris.md2", /* icon */ "w_chaingun", /* pickup */ "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"), /* * QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "ammo_grenades", GameItems.Pickup_Ammo, PlayerWeapon.Use_Weapon, GameItems.Drop_Ammo, PlayerWeapon.Weapon_Grenade, "misc/am_pkup.wav", "models/items/ammo/grenades/medium/tris.md2", 0, "models/weapons/v_handgr/tris.md2", /* icon */ "a_grenades", /* pickup */ "Grenades", /* width */ 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 "), /* * QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "weapon_grenadelauncher", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_GrenadeLauncher, "misc/w_pkup.wav", "models/weapons/g_launch/tris.md2", Defines.EF_ROTATE, "models/weapons/v_launch/tris.md2", /* icon */ "w_glauncher", /* pickup */ "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"), /* * QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "weapon_rocketlauncher", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_RocketLauncher, "misc/w_pkup.wav", "models/weapons/g_rocket/tris.md2", Defines.EF_ROTATE, "models/weapons/v_rocket/tris.md2", /* icon */ "w_rlauncher", /* pickup */ "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"), /* * QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "weapon_hyperblaster", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_HyperBlaster, "misc/w_pkup.wav", "models/weapons/g_hyperb/tris.md2", Defines.EF_ROTATE, "models/weapons/v_hyperb/tris.md2", /* icon */ "w_hyperblaster", /* pickup */ "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"), /* * QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t("weapon_railgun", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_Railgun, "misc/w_pkup.wav", "models/weapons/g_rail/tris.md2", Defines.EF_ROTATE, "models/weapons/v_rail/tris.md2", /* icon */ "w_railgun", /* pickup */ "Railgun", 0, 1, "Slugs", Defines.IT_WEAPON | Defines.IT_STAY_COOP, Defines.WEAP_RAILGUN, null, 0, /* precache */ "weapons/rg_hum.wav"), /* * QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) */ new gitem_t( "weapon_bfg", PlayerWeapon.Pickup_Weapon, PlayerWeapon.Use_Weapon, PlayerWeapon.Drop_Weapon, PlayerWeapon.Weapon_BFG, "misc/w_pkup.wav", "models/weapons/g_bfg/tris.md2", Defines.EF_ROTATE, "models/weapons/v_bfg/tris.md2", /* icon */ "w_bfg", /* pickup */ "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.... [truncated message content] |
From: Rene S. <sa...@us...> - 2005-11-20 22:18:42
|
Update of /cvsroot/jake2/jake2/src/jake2/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25864/src/jake2/util Modified Files: QuakeFile.java Log Message: savegames are now independend from different jake2 builds and releases Index: QuakeFile.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/util/QuakeFile.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QuakeFile.java 16 Nov 2005 22:24:53 -0000 1.5 --- QuakeFile.java 20 Nov 2005 22:18:34 -0000 1.6 *************** *** 157,161 **** return null; else ! return GameItems.itemlist[ndx]; } --- 157,161 ---- return null; else ! return GameItemList.itemlist[ndx]; } |
From: Rene S. <sa...@us...> - 2005-11-20 22:18:42
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25864/src/jake2/client Modified Files: M.java Log Message: savegames are now independend from different jake2 builds and releases Index: M.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/M.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** M.java 16 Nov 2005 22:24:53 -0000 1.7 --- M.java 20 Nov 2005 22:18:34 -0000 1.8 *************** *** 357,360 **** --- 357,361 ---- public static EntThinkAdapter M_droptofloor = new EntThinkAdapter() { + public String getID() { return "m_drop_to_floor";} public boolean think(edict_t ent) { float[] end = { 0, 0, 0 }; *************** *** 455,458 **** --- 456,460 ---- /** Stops the Flies. */ public static EntThinkAdapter M_FliesOff = new EntThinkAdapter() { + public String getID() { return "m_fliesoff";} public boolean think(edict_t self) { self.s.effects &= ~Defines.EF_FLIES; *************** *** 464,467 **** --- 466,470 ---- /** Starts the Flies as setting the animation flag in the entity. */ public static EntThinkAdapter M_FliesOn = new EntThinkAdapter() { + public String getID() { return "m_flies_on";} public boolean think(edict_t self) { if (self.waterlevel != 0) *************** *** 478,481 **** --- 481,485 ---- /** Adds some flies after a random time */ public static EntThinkAdapter M_FlyCheck = new EntThinkAdapter() { + public String getID() { return "m_fly_check";} public boolean think(edict_t self) { |
From: Carsten W. <ca...@us...> - 2005-11-19 23:46:40
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fast In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1718/src/jake2/render/fast Modified Files: Tag: render-refactoring Image.java Log Message: use a hash map to find the images by name (faster) Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fast/Attic/Image.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Image.java 15 Nov 2005 00:06:43 -0000 1.1.2.1 --- Image.java 19 Nov 2005 23:46:30 -0000 1.1.2.2 *************** *** 40,44 **** import java.awt.image.BufferedImage; import java.nio.*; ! import java.util.Arrays; /** --- 40,44 ---- import java.awt.image.BufferedImage; import java.nio.*; ! import java.util.*; /** *************** *** 1457,1460 **** --- 1457,1462 ---- return image; } + + Map imageCache = new HashMap(MAX_GLTEXTURES); /* *************** *** 1466,1492 **** */ image_t GL_FindImage(String name, int type) { - image_t image = null; - - // // TODO loest das grossschreibungs problem - // name = name.toLowerCase(); - // // bughack for bad strings (fuck \0) - // int index = name.indexOf('\0'); - // if (index != -1) - // name = name.substring(0, index); if (name == null || name.length() < 5) ! return null; // Com.Error (ERR_DROP, "GL_FindImage: NULL name"); ! // Com.Error (ERR_DROP, "GL_FindImage: bad name: %s", name); ! ! // look for it ! for (int i = 0; i < numgltextures; i++) ! { ! image = gltextures[i]; ! if (name.equals(image.name)) ! { ! image.registration_sequence = registration_sequence; ! return image; ! } ! } // --- 1468,1481 ---- */ image_t GL_FindImage(String name, int type) { if (name == null || name.length() < 5) ! return null; ! ! // look for it ! image_t image = (image_t) imageCache.get(name); ! if (image != null) { ! image.registration_sequence = registration_sequence; ! return image; ! } // *************** *** 1520,1524 **** } ! return image; } --- 1509,1514 ---- } ! ! imageCache.put(image.name, image); return image; } *************** *** 1564,1571 **** // free it - // TODO jogl bug texnumBuffer.clear(); texnumBuffer.put(0,image.texnum); gl.glDeleteTextures(texnumBuffer); image.clear(); } --- 1554,1562 ---- // free it texnumBuffer.clear(); texnumBuffer.put(0,image.texnum); gl.glDeleteTextures(texnumBuffer); + + imageCache.remove(image.name); image.clear(); } *************** *** 1673,1681 **** if (image.registration_sequence == 0) continue; // free image_t slot // free it - // TODO jogl bug texnumBuffer.clear(); texnumBuffer.put(0,image.texnum); gl.glDeleteTextures(texnumBuffer); image.clear(); } --- 1664,1674 ---- if (image.registration_sequence == 0) continue; // free image_t slot + // free it texnumBuffer.clear(); texnumBuffer.put(0,image.texnum); gl.glDeleteTextures(texnumBuffer); + + imageCache.remove(image.name); image.clear(); } |
From: Holger Z. <hz...@us...> - 2005-11-18 07:28:52
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19675 Modified Files: build.xml Log Message: 'else' is not supported Index: build.xml =================================================================== RCS file: /cvsroot/jake2/jake2/build.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** build.xml 7 Oct 2005 06:00:48 -0000 1.27 --- build.xml 18 Nov 2005 07:28:45 -0000 1.28 *************** *** 144,148 **** <include name="mirrors"/> </jar> ! <condition property="classes" value="${java.home}/../Classes/classes.jar" else="${java.home}/lib/rt.jar"> <os name="Mac OS X"/> </condition> --- 144,149 ---- <include name="mirrors"/> </jar> ! <property name="classes" value="${java.home}/lib/rt.jar"/> ! <condition property="classes" value="${java.home}/../Classes/classes.jar"> <os name="Mac OS X"/> </condition> |
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13343/src/jake2/game Modified Files: GameWeapon.java GameFunc.java GameUtil.java PlayerView.java GameTrigger.java GameSave.java GameTarget.java PlayerClient.java GameBase.java PlayerHud.java Cmd.java GameSpawn.java GameMisc.java Monster.java GameAI.java GameTurret.java Added Files: GameChase.java PlayerWeapon.java GameItems.java GameCombat.java Removed Files: Fire.java PlayerClientAdapters.java GamePWeapon.java Log Message: sorted the methods according to their original locations in the c files. Index: GameTrigger.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameTrigger.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GameTrigger.java 20 Feb 2005 21:49:46 -0000 1.4 --- GameTrigger.java 16 Nov 2005 22:24:52 -0000 1.5 *************** *** 20,24 **** --- 20,26 ---- // Created on 27.12.2003 by RST. + // $Id$ + package jake2.game; *************** *** 54,58 **** if (ent.wait > 0) { ! ent.think = GameTrigger.multi_wait; ent.nextthink = GameBase.level.time + ent.wait; } else { // we can't just remove (self) here, because this is a touch --- 56,60 ---- if (ent.wait > 0) { ! ent.think = multi_wait; ent.nextthink = GameBase.level.time + ent.wait; } else { // we can't just remove (self) here, because this is a touch *************** *** 76,80 **** ent.wait = 0.2f; ! ent.touch = GameTrigger.Touch_Multi; ent.movetype = Defines.MOVETYPE_NONE; ent.svflags |= Defines.SVF_NOCLIENT; --- 78,82 ---- ent.wait = 0.2f; ! ent.touch = Touch_Multi; ent.movetype = Defines.MOVETYPE_NONE; ent.svflags |= Defines.SVF_NOCLIENT; *************** *** 82,89 **** if ((ent.spawnflags & 4) != 0) { ent.solid = Defines.SOLID_NOT; ! ent.use = GameTrigger.trigger_enable; } else { ent.solid = Defines.SOLID_TRIGGER; ! ent.use = GameTrigger.Use_Multi; } --- 84,91 ---- if ((ent.spawnflags & 4) != 0) { ent.solid = Defines.SOLID_NOT; ! ent.use = trigger_enable; } else { ent.solid = Defines.SOLID_TRIGGER; ! ent.use = Use_Multi; } *************** *** 125,129 **** public static void SP_trigger_relay(edict_t self) { ! self.use = GameTrigger.trigger_relay_use; } --- 127,131 ---- public static void SP_trigger_relay(edict_t self) { ! self.use = trigger_relay_use; } *************** *** 134,138 **** return; } ! self.item = GameUtil.FindItemByClassname(GameBase.st.item); if (null == self.item) { --- 136,140 ---- return; } ! self.item = GameItems.FindItemByClassname(GameBase.st.item); if (null == self.item) { *************** *** 152,156 **** GameBase.gi.soundindex("misc/keyuse.wav"); ! self.use = GameTrigger.trigger_key_use; } --- 154,158 ---- GameBase.gi.soundindex("misc/keyuse.wav"); ! self.use = trigger_key_use; } *************** *** 160,164 **** self.count = 2; ! self.use = GameTrigger.trigger_counter_use; } --- 162,166 ---- self.count = 2; ! self.use = trigger_counter_use; } *************** *** 188,193 **** public static void SP_trigger_push(edict_t self) { InitTrigger(self); ! GameTrigger.windsound = GameBase.gi.soundindex("misc/windfly.wav"); ! self.touch = GameTrigger.trigger_push_touch; if (0 == self.speed) self.speed = 1000; --- 190,195 ---- public static void SP_trigger_push(edict_t self) { InitTrigger(self); ! windsound = GameBase.gi.soundindex("misc/windfly.wav"); ! self.touch = trigger_push_touch; if (0 == self.speed) self.speed = 1000; *************** *** 199,203 **** self.noise_index = GameBase.gi.soundindex("world/electro.wav"); ! self.touch = GameTrigger.hurt_touch; if (0 == self.dmg) --- 201,205 ---- self.noise_index = GameBase.gi.soundindex("world/electro.wav"); ! self.touch = hurt_touch; if (0 == self.dmg) *************** *** 210,214 **** if ((self.spawnflags & 2) != 0) ! self.use = GameTrigger.hurt_use; GameBase.gi.linkentity(self); --- 212,216 ---- if ((self.spawnflags & 2) != 0) ! self.use = hurt_use; GameBase.gi.linkentity(self); *************** *** 225,229 **** InitTrigger(self); self.gravity = Lib.atoi(GameBase.st.gravity); ! self.touch = GameTrigger.trigger_gravity_touch; } --- 227,231 ---- InitTrigger(self); self.gravity = Lib.atoi(GameBase.st.gravity); ! self.touch = trigger_gravity_touch; } *************** *** 236,240 **** self.s.angles[Defines.YAW] = 360; InitTrigger(self); ! self.touch = GameTrigger.trigger_monsterjump_touch; self.movedir[2] = GameBase.st.height; } --- 238,242 ---- self.s.angles[Defines.YAW] = 360; InitTrigger(self); ! self.touch = trigger_monsterjump_touch; self.movedir[2] = GameBase.st.height; } *************** *** 252,256 **** public void use(edict_t ent, edict_t other, edict_t activator) { ent.activator = activator; ! GameTrigger.multi_trigger(ent); } }; --- 254,258 ---- public void use(edict_t ent, edict_t other, edict_t activator) { ent.activator = activator; ! multi_trigger(ent); } }; *************** *** 277,281 **** self.activator = other; ! GameTrigger.multi_trigger(self); } }; --- 279,283 ---- self.activator = other; ! multi_trigger(self); } }; *************** *** 329,333 **** return; ! index = GameUtil.ITEM_INDEX(self.item); if (activator.client.pers.inventory[index] == 0) { if (GameBase.level.time < self.touch_debounce_time) --- 331,335 ---- return; ! index = GameItems.ITEM_INDEX(self.item); if (activator.client.pers.inventory[index] == 0) { if (GameBase.level.time < self.touch_debounce_time) *************** *** 429,433 **** } self.activator = activator; ! GameTrigger.multi_trigger(self); } }; --- 431,435 ---- } self.activator = activator; ! multi_trigger(self); } }; *************** *** 530,534 **** 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); --- 532,536 ---- else dflags = 0; ! GameCombat.T_Damage(other, self, self, Globals.vec3_origin, other.s.origin, Globals.vec3_origin, self.dmg, self.dmg, dflags, Defines.MOD_TRIGGER_HURT); Index: GameAI.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameAI.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GameAI.java 20 Feb 2005 16:38:36 -0000 1.7 --- GameAI.java 16 Nov 2005 22:24:53 -0000 1.8 *************** *** 20,24 **** --- 20,26 ---- // Created on 02.11.2003 by RST. + // $Id$ + package jake2.game; *************** *** 26,304 **** [...2957 lines suppressed...] ! if (anum1 < bnum1) ! return -1; ! if (anum1 > bnum1) ! return 1; ! return 0; ! } ! }; } --- 819,828 ---- }; ! static boolean enemy_vis; ! static boolean enemy_infront; ! static int enemy_range; ! static float enemy_yaw; } Index: PlayerView.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/PlayerView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PlayerView.java 6 Feb 2005 19:13:56 -0000 1.3 --- PlayerView.java 16 Nov 2005 22:24:52 -0000 1.4 *************** *** 42,46 **** /* ! * =============== SV_CalcRoll * * =============== --- 42,47 ---- /* ! * =============== ! * SV_CalcRoll * * =============== *************** *** 66,72 **** /* ! * =============== P_DamageFeedback * ! * Handles color blends and view kicks =============== */ --- 67,75 ---- /* ! * =============== ! * P_DamageFeedback * ! * Handles color blends and view kicks ! * =============== */ *************** *** 159,162 **** --- 162,167 ---- // the color of the blend will vary based on how much was absorbed // by different armors + // + Math3D.VectorClear(v); if (client.damage_parmor != 0) *************** *** 209,213 **** /* ! * =============== SV_CalcViewOffset * * Auto pitching on slopes? --- 214,219 ---- /* ! * =============== ! * SV_CalcViewOffset * * Auto pitching on slopes? *************** *** 336,340 **** /* ! * ============== SV_CalcGunOffset ============== */ public static void SV_CalcGunOffset(edict_t ent) { --- 342,348 ---- /* ! * ============== ! * SV_CalcGunOffset ! * ============== */ public static void SV_CalcGunOffset(edict_t ent) { *************** *** 381,385 **** /* ! * ============= SV_AddBlend ============= */ public static void SV_AddBlend(float r, float g, float b, float a, --- 389,395 ---- /* ! * ============= ! * SV_AddBlend ! * ============= */ public static void SV_AddBlend(float r, float g, float b, float a, *************** *** 399,403 **** /* ! * ============= SV_CalcBlend ============= */ public static void SV_CalcBlend(edict_t ent) { --- 409,415 ---- /* ! * ============= ! * SV_CalcBlend ! * ============= */ public static void SV_CalcBlend(edict_t ent) { *************** *** 483,487 **** /* ! * ================= P_FallingDamage ================= */ public static void P_FallingDamage(edict_t ent) { --- 495,501 ---- /* ! * ================= ! * P_FallingDamage ! * ================= */ public static void P_FallingDamage(edict_t ent) { *************** *** 544,548 **** if (GameBase.deathmatch.value == 0 || 0 == ((int) GameBase.dmflags.value & Defines.DF_NO_FALLING)) ! GameUtil.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], dir, ent.s.origin, Globals.vec3_origin, damage, 0, 0, Defines.MOD_FALLING); --- 558,562 ---- if (GameBase.deathmatch.value == 0 || 0 == ((int) GameBase.dmflags.value & Defines.DF_NO_FALLING)) ! GameCombat.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], dir, ent.s.origin, Globals.vec3_origin, damage, 0, 0, Defines.MOD_FALLING); *************** *** 554,558 **** /* ! * ============= P_WorldEffects ============= */ public static void P_WorldEffects() { --- 568,574 ---- /* ! * ============= ! * P_WorldEffects ! * ============= */ public static void P_WorldEffects() { *************** *** 578,582 **** // if (old_waterlevel == 0 && waterlevel != 0) { ! GameWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); if ((current_player.watertype & Defines.CONTENTS_LAVA) != 0) --- 594,598 ---- // if (old_waterlevel == 0 && waterlevel != 0) { ! PlayerWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); if ((current_player.watertype & Defines.CONTENTS_LAVA) != 0) *************** *** 602,606 **** // if (old_waterlevel != 0 && waterlevel == 0) { ! GameWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); GameBase.gi --- 618,622 ---- // if (old_waterlevel != 0 && waterlevel == 0) { ! PlayerWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); GameBase.gi *************** *** 628,632 **** GameBase.gi.soundindex("player/gasp1.wav"), 1, Defines.ATTN_NORM, 0); ! GameWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); } else if (current_player.air_finished < GameBase.level.time + 11) { // just --- 644,648 ---- GameBase.gi.soundindex("player/gasp1.wav"), 1, Defines.ATTN_NORM, 0); ! PlayerWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); } else if (current_player.air_finished < GameBase.level.time + 11) { // just *************** *** 657,661 **** 1, Defines.ATTN_NORM, 0); current_client.breather_sound ^= 1; ! GameWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); //FIXME: release a bubble? --- 673,677 ---- 1, Defines.ATTN_NORM, 0); current_client.breather_sound ^= 1; ! PlayerWeapon.PlayerNoise(current_player, current_player.s.origin, Defines.PNOISE_SELF); //FIXME: release a bubble? *************** *** 690,694 **** current_player.pain_debounce_time = GameBase.level.time; ! GameUtil.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, --- 706,710 ---- current_player.pain_debounce_time = GameBase.level.time; ! GameCombat.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, *************** *** 723,732 **** if (envirosuit) // take 1/3 damage with envirosuit ! GameUtil.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, 1 * waterlevel, 0, 0, Defines.MOD_LAVA); else ! GameUtil.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, --- 739,748 ---- if (envirosuit) // take 1/3 damage with envirosuit ! GameCombat.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, 1 * waterlevel, 0, 0, Defines.MOD_LAVA); else ! GameCombat.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, *************** *** 736,740 **** if ((current_player.watertype & Defines.CONTENTS_SLIME) != 0) { if (!envirosuit) { // no damage from slime with envirosuit ! GameUtil.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, --- 752,756 ---- if ((current_player.watertype & Defines.CONTENTS_SLIME) != 0) { if (!envirosuit) { // no damage from slime with envirosuit ! GameCombat.T_Damage(current_player, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, current_player.s.origin, Globals.vec3_origin, *************** *** 746,750 **** /* ! * =============== G_SetClientEffects =============== */ public static void G_SetClientEffects(edict_t ent) { --- 762,768 ---- /* ! * =============== ! * G_SetClientEffects ! * =============== */ public static void G_SetClientEffects(edict_t ent) { *************** *** 759,763 **** if (ent.powerarmor_time > GameBase.level.time) { ! pa_type = GameUtil.PowerArmorType(ent); if (pa_type == Defines.POWER_ARMOR_SCREEN) { ent.s.effects |= Defines.EF_POWERSCREEN; --- 777,781 ---- if (ent.powerarmor_time > GameBase.level.time) { ! pa_type = GameItems.PowerArmorType(ent); if (pa_type == Defines.POWER_ARMOR_SCREEN) { ent.s.effects |= Defines.EF_POWERSCREEN; *************** *** 790,794 **** /* ! * =============== G_SetClientEvent =============== */ public static void G_SetClientEvent(edict_t ent) { --- 808,814 ---- /* ! * =============== ! * G_SetClientEvent ! * =============== */ public static void G_SetClientEvent(edict_t ent) { *************** *** 803,807 **** /* ! * =============== G_SetClientSound =============== */ public static void G_SetClientSound(edict_t ent) { --- 823,829 ---- /* ! * =============== ! * G_SetClientSound ! * =============== */ public static void G_SetClientSound(edict_t ent) { *************** *** 841,845 **** /* ! * =============== G_SetClientFrame =============== */ public static void G_SetClientFrame(edict_t ent) { --- 863,869 ---- /* ! * =============== ! * G_SetClientFrame ! * =============== */ public static void G_SetClientFrame(edict_t ent) { *************** *** 928,935 **** /* ! * ================= ClientEndServerFrame * * Called for each player at the end of the server frame and right after ! * spawning ================= */ public static void ClientEndServerFrame(edict_t ent) { --- 952,961 ---- /* ! * ================= ! * ClientEndServerFrame * * Called for each player at the end of the server frame and right after ! * spawning ! * ================= */ public static void ClientEndServerFrame(edict_t ent) { --- NEW FILE: GameCombat.java --- /* 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 16.11.2005 by RST. // $Id: GameCombat.java,v 1.1 2005/11/16 22:24:53 salomo Exp $ package jake2.game; import jake2.Defines; import jake2.Globals; import jake2.qcommon.Com; import jake2.util.Math3D; public class GameCombat { /* * ============ CanDamage * * Returns true if the inflictor can directly damage the target. Used for * explosions and melee attacks. ============ */ 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 == Defines.MOVETYPE_PUSH) { Math3D.VectorAdd(targ.absmin, targ.absmax, dest); Math3D.VectorScale(dest, 0.5f, dest); trace = GameBase.gi.trace(inflictor.s.origin, Globals.vec3_origin, Globals.vec3_origin, dest, inflictor, Defines.MASK_SOLID); if (trace.fraction == 1.0f) return true; if (trace.ent == targ) return true; return false; } trace = GameBase.gi.trace(inflictor.s.origin, Globals.vec3_origin, Globals.vec3_origin, targ.s.origin, inflictor, Defines.MASK_SOLID); if (trace.fraction == 1.0) return true; Math3D.VectorCopy(targ.s.origin, dest); dest[0] += 15.0; dest[1] += 15.0; trace = GameBase.gi.trace(inflictor.s.origin, Globals.vec3_origin, Globals.vec3_origin, dest, inflictor, Defines.MASK_SOLID); if (trace.fraction == 1.0) return true; Math3D.VectorCopy(targ.s.origin, dest); dest[0] += 15.0; dest[1] -= 15.0; trace = GameBase.gi.trace(inflictor.s.origin, Globals.vec3_origin, Globals.vec3_origin, dest, inflictor, Defines.MASK_SOLID); if (trace.fraction == 1.0) return true; Math3D.VectorCopy(targ.s.origin, dest); dest[0] -= 15.0; dest[1] += 15.0; trace = GameBase.gi.trace(inflictor.s.origin, Globals.vec3_origin, Globals.vec3_origin, dest, inflictor, Defines.MASK_SOLID); if (trace.fraction == 1.0) return true; Math3D.VectorCopy(targ.s.origin, dest); dest[0] -= 15.0; dest[1] -= 15.0; trace = GameBase.gi.trace(inflictor.s.origin, Globals.vec3_origin, Globals.vec3_origin, dest, inflictor, Defines.MASK_SOLID); if (trace.fraction == 1.0) return true; return false; } /* * ============ Killed ============ */ public static void Killed(edict_t targ, edict_t inflictor, edict_t attacker, int damage, float[] point) { Com.DPrintf("Killing a " + targ.classname + "\n"); if (targ.health < -999) targ.health = -999; //Com.Println("Killed:" + targ.classname); targ.enemy = attacker; if ((targ.svflags & Defines.SVF_MONSTER) != 0 && (targ.deadflag != Defines.DEAD_DEAD)) { // targ.svflags |= SVF_DEADMONSTER; // now treat as a different // content type if (0 == (targ.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) { GameBase.level.killed_monsters++; if (GameBase.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")) targ.owner = attacker; } } if (targ.movetype == Defines.MOVETYPE_PUSH || targ.movetype == Defines.MOVETYPE_STOP || targ.movetype == Defines.MOVETYPE_NONE) { // doors, triggers, // etc targ.die.die(targ, inflictor, attacker, damage, point); return; } if ((targ.svflags & Defines.SVF_MONSTER) != 0 && (targ.deadflag != Defines.DEAD_DEAD)) { targ.touch = null; Monster.monster_death_use(targ); } targ.die.die(targ, inflictor, attacker, damage, point); } /* * ================ SpawnDamage ================ */ static void SpawnDamage(int type, float[] origin, float[] normal, int damage) { if (damage > 255) damage = 255; GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(type); // gi.WriteByte (damage); GameBase.gi.WritePosition(origin); GameBase.gi.WriteDir(normal); GameBase.gi.multicast(origin, Defines.MULTICAST_PVS); } static int CheckPowerArmor(edict_t ent, float[] point, float[] normal, int damage, int dflags) { gclient_t client; int save; int power_armor_type; int index = 0; int damagePerCell; int pa_te_type; int power = 0; int power_used; if (damage == 0) return 0; client = ent.client; if ((dflags & Defines.DAMAGE_NO_ARMOR) != 0) return 0; if (client != null) { power_armor_type = GameItems.PowerArmorType(ent); if (power_armor_type != Defines.POWER_ARMOR_NONE) { index = GameItems.ITEM_INDEX(GameItems.FindItem("Cells")); power = client.pers.inventory[index]; } } else if ((ent.svflags & Defines.SVF_MONSTER) != 0) { power_armor_type = ent.monsterinfo.power_armor_type; power = ent.monsterinfo.power_armor_power; } else return 0; if (power_armor_type == Defines.POWER_ARMOR_NONE) return 0; if (power == 0) return 0; if (power_armor_type == Defines.POWER_ARMOR_SCREEN) { float[] vec = { 0, 0, 0 }; float dot; float[] forward = { 0, 0, 0 }; // only works if damage point is in front Math3D.AngleVectors(ent.s.angles, forward, null, null); Math3D.VectorSubtract(point, ent.s.origin, vec); Math3D.VectorNormalize(vec); dot = Math3D.DotProduct(vec, forward); if (dot <= 0.3) return 0; damagePerCell = 1; pa_te_type = Defines.TE_SCREEN_SPARKS; damage = damage / 3; } else { damagePerCell = 2; pa_te_type = Defines.TE_SHIELD_SPARKS; damage = (2 * damage) / 3; } save = power * damagePerCell; if (save == 0) return 0; if (save > damage) save = damage; SpawnDamage(pa_te_type, point, normal, save); ent.powerarmor_time = GameBase.level.time + 0.2f; power_used = save / damagePerCell; if (client != null) client.pers.inventory[index] -= power_used; else ent.monsterinfo.power_armor_power -= power_used; return save; } static int CheckArmor(edict_t ent, float[] point, float[] normal, int damage, int te_sparks, int dflags) { gclient_t client; int save; int index; gitem_t armor; if (damage == 0) return 0; client = ent.client; if (client != null) return 0; if ((dflags & Defines.DAMAGE_NO_ARMOR) != 0) return 0; index = GameItems.ArmorIndex(ent); if (index == 0) return 0; armor = GameItems.GetItemByIndex(index); gitem_armor_t garmor = (gitem_armor_t) armor.info; if (0 != (dflags & Defines.DAMAGE_ENERGY)) save = (int) Math.ceil(garmor.energy_protection * damage); else save = (int) Math.ceil(garmor.normal_protection * damage); if (save >= client.pers.inventory[index]) save = client.pers.inventory[index]; if (save == 0) return 0; client.pers.inventory[index] -= save; SpawnDamage(te_sparks, point, normal, save); return save; } public static void M_ReactToDamage(edict_t targ, edict_t attacker) { if ((null != attacker.client) && 0 != (attacker.svflags & Defines.SVF_MONSTER)) return; if (attacker == targ || attacker == targ.enemy) return; // 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 (attacker.client != null || (attacker.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) return; } // 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) { 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)) { targ.oldenemy = attacker; return; } targ.oldenemy = targ.enemy; } targ.enemy = attacker; if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) GameUtil.FoundTarget(targ); return; } // it's the same base (walk/swim/fly) type and a different classname and // it's not a tank // (they spray too much), get mad at them if (((targ.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == (attacker.flags & (Defines.FL_FLY | Defines.FL_SWIM))) && (!(targ.classname.equals(attacker.classname))) && (!(attacker.classname.equals("monster_tank"))) && (!(attacker.classname.equals("monster_supertank"))) && (!(attacker.classname.equals("monster_makron"))) && (!(attacker.classname.equals("monster_jorg")))) { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker; if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) GameUtil.FoundTarget(targ); } // if they *meant* to shoot us, then shoot back else if (attacker.enemy == targ) { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker; if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) 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) { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker.enemy; if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) GameUtil.FoundTarget(targ); } } 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; } /* * ============ T_RadiusDamage ============ */ static void T_RadiusDamage(edict_t inflictor, edict_t attacker, float damage, edict_t ignore, float radius, int mod) { float points; EdictIterator edictit = null; float[] v = { 0, 0, 0 }; float[] dir = { 0, 0, 0 }; while ((edictit = GameBase.findradius(edictit, inflictor.s.origin, radius)) != null) { edict_t ent = edictit.o; if (ent == ignore) continue; if (ent.takedamage == 0) continue; Math3D.VectorAdd(ent.mins, ent.maxs, v); Math3D.VectorMA(ent.s.origin, 0.5f, v, v); Math3D.VectorSubtract(inflictor.s.origin, v, v); points = damage - 0.5f * Math3D.VectorLength(v); if (ent == attacker) points = points * 0.5f; if (points > 0) { if (CanDamage(ent, inflictor)) { Math3D.VectorSubtract(ent.s.origin, inflictor.s.origin, dir); T_Damage(ent, inflictor, attacker, dir, inflictor.s.origin, Globals.vec3_origin, (int) points, (int) points, Defines.DAMAGE_RADIUS, mod); } } } } public static void T_Damage(edict_t targ, edict_t inflictor, edict_t attacker, float[] dir, float[] point, float[] normal, int damage, int knockback, int dflags, int mod) { gclient_t client; int take; int save; int asave; int psave; int te_sparks; 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) && ((GameBase.deathmatch.value != 0 && 0 != ((int) (GameBase.dmflags.value) & (Defines.DF_MODELTEAMS | Defines.DF_SKINTEAMS))) || GameBase.coop.value != 0)) { if (GameUtil.OnSameTeam(targ, attacker)) { if (((int) (GameBase.dmflags.value) & Defines.DF_NO_FRIENDLY_FIRE) != 0) damage = 0; else mod |= Defines.MOD_FRIENDLY_FIRE; } } GameBase.meansOfDeath = mod; // easy mode takes half damage if (GameBase.skill.value == 0 && GameBase.deathmatch.value == 0 && targ.client != null) { damage *= 0.5; if (damage == 0) damage = 1; } client = targ.client; if ((dflags & Defines.DAMAGE_BULLET) != 0) te_sparks = Defines.TE_BULLET_SPARKS; else te_sparks = Defines.TE_SPARKS; Math3D.VectorNormalize(dir); // bonus damage for suprising a monster if (0 == (dflags & Defines.DAMAGE_RADIUS) && (targ.svflags & Defines.SVF_MONSTER) != 0 && (attacker.client != null) && (targ.enemy == null) && (targ.health > 0)) damage *= 2; if ((targ.flags & Defines.FL_NO_KNOCKBACK) != 0) knockback = 0; // figure momentum add if (0 == (dflags & Defines.DAMAGE_NO_KNOCKBACK)) { if ((knockback != 0) && (targ.movetype != Defines.MOVETYPE_NONE) && (targ.movetype != Defines.MOVETYPE_BOUNCE) && (targ.movetype != Defines.MOVETYPE_PUSH) && (targ.movetype != Defines.MOVETYPE_STOP)) { float[] kvel = { 0, 0, 0 }; float mass; if (targ.mass < 50) mass = 50; else mass = targ.mass; if (targ.client != null && attacker == targ) Math3D.VectorScale(dir, 1600.0f * (float) knockback / mass, kvel); // the rocket jump hack... else Math3D.VectorScale(dir, 500.0f * (float) knockback / mass, kvel); Math3D.VectorAdd(targ.velocity, kvel, targ.velocity); } } take = damage; save = 0; // check for godmode if ((targ.flags & Defines.FL_GODMODE) != 0 && 0 == (dflags & Defines.DAMAGE_NO_PROTECTION)) { take = 0; save = damage; SpawnDamage(te_sparks, point, normal, save); } // check for invincibility if ((client != null && client.invincible_framenum > GameBase.level.framenum) && 0 == (dflags & Defines.DAMAGE_NO_PROTECTION)) { if (targ.pain_debounce_time < GameBase.level.time) { GameBase.gi.sound(targ, Defines.CHAN_ITEM, GameBase.gi .soundindex("items/protect4.wav"), 1, Defines.ATTN_NORM, 0); targ.pain_debounce_time = GameBase.level.time + 2; } take = 0; save = damage; } psave = CheckPowerArmor(targ, point, normal, take, dflags); take -= psave; asave = CheckArmor(targ, point, normal, take, te_sparks, dflags); take -= asave; // treat cheat/powerup savings the same as armor asave += save; // team damage avoidance if (0 == (dflags & Defines.DAMAGE_NO_PROTECTION) && CheckTeamDamage(targ, attacker)) return; // do the damage if (take != 0) { if (0 != (targ.svflags & Defines.SVF_MONSTER) || (client != null)) SpawnDamage(Defines.TE_BLOOD, point, normal, take); else SpawnDamage(te_sparks, point, normal, take); targ.health = targ.health - take; if (targ.health <= 0) { if ((targ.svflags & Defines.SVF_MONSTER) != 0 || (client != null)) targ.flags |= Defines.FL_NO_KNOCKBACK; Killed(targ, inflictor, attacker, take, point); return; } } if ((targ.svflags & Defines.SVF_MONSTER) != 0) { M_ReactToDamage(targ, attacker); if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED) && (take != 0)) { targ.pain.pain(targ, attacker, knockback, take); // nightmare mode monsters don't go into pain frames often if (GameBase.skill.value == 3) targ.pain_debounce_time = GameBase.level.time + 5; } } else if (client != null) { if (((targ.flags & Defines.FL_GODMODE) == 0) && (take != 0)) targ.pain.pain(targ, attacker, knockback, take); } else if (take != 0) { if (targ.pain != null) targ.pain.pain(targ, attacker, knockback, take); } // 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) { client.damage_parmor += psave; client.damage_armor += asave; client.damage_blood += take; client.damage_knockback += knockback; Math3D.VectorCopy(point, client.damage_from); } } } --- NEW FILE: GameItems.java --- /* 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. */ [...2016 lines suppressed...] } if (0 == (ent.spawnflags & Defines.ITEM_TARGETS_USED)) { GameUtil.G_UseTargets(ent, other); ent.spawnflags |= Defines.ITEM_TARGETS_USED; } if (!taken) return; 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); } } } Index: PlayerClient.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/PlayerClient.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PlayerClient.java 19 Feb 2005 21:20:10 -0000 1.9 --- PlayerClient.java 16 Nov 2005 22:24:52 -0000 1.10 *************** *** 20,27 **** --- 20,31 ---- // Created on 28.12.2003 by RST. + // $Id$ + package jake2.game; import jake2.Defines; + import jake2.game.monsters.M_Player; + import jake2.game.pmove_t.TraceAdapter; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 29,32 **** --- 33,249 ---- public class PlayerClient { + 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; + PlayerClient.LookAtKiller(self, inflictor, attacker); + self.client.ps.pmove.pm_type = Defines.PM_DEAD; + ClientObituary(self, inflictor, attacker); + PlayerClient.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 + && (GameItems.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++) + GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, Defines.GIB_ORGANIC); + GameMisc.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 & pmove_t.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); + } + }; + 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"); + + if (es == null) + return true; + + spot = es.o; + + 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; + } + } + } + }; + 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; + } + }; + // player pain is handled at the end of the frame in P_DamageFeedback + static EntPainAdapter player_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + } + }; + 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++) + GameMisc.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + self.s.origin[2] -= 48; + GameMisc.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); + } + + }; + /* * QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 32) The normal *************** *** 38,42 **** if (Lib.Q_stricmp(GameBase.level.mapname, "security") == 0) { // invoke one of our gross, ugly, disgusting hacks ! self.think = PlayerClientAdapters.SP_CreateCoopSpots; self.nextthink = GameBase.level.time + Defines.FRAMETIME; } --- 255,259 ---- if (Lib.Q_stricmp(GameBase.level.mapname, "security") == 0) { // invoke one of our gross, ugly, disgusting hacks ! self.think = PlayerClient.SP_CreateCoopSpots; self.nextthink = GameBase.level.time + Defines.FRAMETIME; } *************** *** 81,85 **** || (Lib.Q_stricmp(GameBase.level.mapname, "strike") == 0)) { // invoke one of our gross, ugly, disgusting hacks ! self.think = PlayerClientAdapters.SP_FixCoopSpots; self.nextthink = GameBase.level.time + Defines.FRAMETIME; } --- 298,302 ---- || (Lib.Q_stricmp(GameBase.level.mapname, "strike") == 0)) { // invoke one of our gross, ugly, disgusting hacks ! self.think = PlayerClient.SP_FixCoopSpots; self.nextthink = GameBase.level.time + Defines.FRAMETIME; } *************** *** 156,162 **** case Defines.MOD_HG_SPLASH: case Defines.MOD_G_SPLASH: ! if (GameAI.IsNeutral(self)) message = "tripped on its own grenade"; ! else if (GameAI.IsFemale(self)) message = "tripped on her own grenade"; else --- 373,379 ---- case Defines.MOD_HG_SPLASH: case Defines.MOD_G_SPLASH: ! if (PlayerClient.IsNeutral(self)) message = "tripped on its own grenade"; ! else if (PlayerClient.IsFemale(self)) message = "tripped on her own grenade"; else *************** *** 164,170 **** break; case Defines.MOD_R_SPLASH: ! if (GameAI.IsNeutral(self)) message = "blew itself up"; ! else if (GameAI.IsFemale(self)) message = "blew herself up"; else --- 381,387 ---- break; case Defines.MOD_R_SPLASH: ! if (PlayerClient.IsNeutral(self)) message = "blew itself up"; ! else if (PlayerClient.IsFemale(self)) message = "blew herself up"; else *************** *** 175,181 **** break; default: ! if (GameAI.IsNeutral(self)) message = "killed itself"; ! else if (GameAI.IsFemale(self)) message = "killed herself"; else --- 392,398 ---- break; default: ! if (PlayerClient.IsNeutral(self)) message = "killed itself"; ! else if (PlayerClient.IsFemale(self)) message = "killed herself"; else *************** *** 287,300 **** } - /* - * ================== player_die ================== - */ - //======================================================================= /* ! * ============== InitClientPersistant * * This is only called when the game first initializes in single player, but ! * is called after each death and level change in deathmatch ============== */ public static void InitClientPersistant(gclient_t client) { --- 504,515 ---- } //======================================================================= /* ! * ============== ! * InitClientPersistant * * This is only called when the game first initializes in single player, but ! * is called after each death and level change in deathmatch ! * ============== */ public static void InitClientPersistant(gclient_t client) { *************** *** 303,308 **** client.pers = new client_persistant_t(); ! item = GameUtil.FindItem("Blaster"); ! client.pers.selected_item = GameUtil.ITEM_INDEX(item); client.pers.inventory[client.pers.selected_item] = 1; --- 518,523 ---- client.pers = new client_persistant_t(); ! item = GameItems.FindItem("Blaster"); ! client.pers.selected_item = GameItems.ITEM_INDEX(item); client.pers.inventory[client.pers.selected_item] = 1; *************** *** 336,344 **** /* ! * ================== SaveClientData * * Some information that should be persistant, like health, is still stored * in the edict structure, so it needs to be mirrored out to the client ! * structure before all the edicts are wiped. ================== */ public static void SaveClientData() { --- 551,561 ---- /* ! * ================== ! * SaveClientData * * Some information that should be persistant, like health, is still stored * in the edict structure, so it needs to be mirrored out to the client ! * structure before all the edicts are wiped. ! * ================== */ public static void SaveClientData() { *************** *** 370,374 **** /* ! * ================ PlayersRangeFromSpot * * Returns the distance to the nearest player from the given spot --- 587,592 ---- /* ! * ================ ! * PlayersRangeFromSpot * * Returns the distance to the nearest player from the given spot *************** *** 404,408 **** /* ! * ================ SelectRandomDeathmatchSpawnPoint * * go to a random point, but NOT the two points closest to other players --- 622,627 ---- /* ! * ================ ! * SelectRandomDeathmatchSpawnPoint * * go to a random point, but NOT the two points closest to other players *************** *** 463,467 **** /* ! * ================ SelectFarthestDeathmatchSpawnPoint * * ================ --- 682,687 ---- /* ! * ================ ! * SelectFarthestDeathmatchSpawnPoint * * ================ *************** *** 553,559 **** /* ! * =========== SelectSpawnPoint * ! * Chooses a player start, deathmatch start, coop start, etc ============ */ public static void SelectSpawnPoint(edict_t ent, float[] origin, --- 773,781 ---- /* ! * =========== ! * SelectSpawnPoint * ! * Chooses a player start, deathmatch start, coop start, etc ! * ============ */ public static void SelectSpawnPoint(edict_t ent, float[] origin, *************** *** 651,655 **** body.movetype = ent.movetype; ! body.die = PlayerClientAdapters.body_die; body.takedamage = Defines.DAMAGE_YES; --- 873,877 ---- body.movetype = ent.movetype; ! body.die = PlayerClient.body_die; body.takedamage = Defines.DAMAGE_YES; *************** *** 851,856 **** ent.clipmask = Defines.MASK_PLAYERSOLID; ent.model = "players/male/tris.md2"; ! ent.pain = PlayerClientAdapters.player_pain; ! ent.die = GameAI.player_die; ent.waterlevel = 0; ent.watertype = 0; --- 1073,1078 ---- ent.clipmask = Defines.MASK_PLAYERSOLID; ent.model = "players/male/tris.md2"; ! ent.pain = PlayerClient.player_pain; ! ent.die = PlayerClient.player_die; ent.waterlevel = 0; ent.watertype = 0; *************** *** 931,942 **** // force the current weapon up client.newweapon = client.pers.weapon; ! GamePWeapon.ChangeWeapon(ent); } /* ! * ===================== ClientBeginDeathmatch * * A client has just connected to the server in deathmatch mode, so clear ! * everything out before starting them. ===================== */ public static void ClientBeginDeathmatch(edict_t ent) { --- 1153,1166 ---- // force the current weapon up client.newweapon = client.pers.weapon; ! PlayerWeapon.ChangeWeapon(ent); } /* ! * ===================== ! * ClientBeginDeathmatch * * A client has just connected to the server in deathmatch mode, so clear ! * everything out before starting them. ! * ===================== */ public static void ClientBeginDeathmatch(edict_t ent) { *************** *** 967,974 **** /* ! * =========== ClientBegin * * called when a client has finished connecting, and is ready to be placed ! * into the game. This will happen every level load. ============ */ public static void ClientBegin(edict_t ent) { --- 1191,1200 ---- /* ! * =========== ! * ClientBegin * * called when a client has finished connecting, and is ready to be placed !... [truncated message content] |
From: Rene S. <sa...@us...> - 2005-11-16 22:25:02
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13343/src/jake2/client Modified Files: M.java Log Message: sorted the methods according to their original locations in the c files. Index: M.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/M.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** M.java 7 Oct 2004 14:13:07 -0000 1.6 --- M.java 16 Nov 2005 22:24:53 -0000 1.7 *************** *** 50,54 **** } ! // if the hull point one-quarter unit down is solid the entity is on // ground point[0] = ent.s.origin[0]; --- 50,54 ---- } ! // if the hull point one-quarter unit down is solid the entity is on // ground point[0] = ent.s.origin[0]; *************** *** 65,72 **** } ! // ent.groundentity = trace.ent; ! // ent.groundentity_linkcount = trace.ent.linkcount; ! // if (!trace.startsolid && !trace.allsolid) ! // VectorCopy (trace.endpos, ent.s.origin); if (!trace.startsolid && !trace.allsolid) { Math3D.VectorCopy(trace.endpos, ent.s.origin); --- 65,72 ---- } ! // ent.groundentity = trace.ent; ! // ent.groundentity_linkcount = trace.ent.linkcount; ! // if (!trace.startsolid && !trace.allsolid) ! // VectorCopy (trace.endpos, ent.s.origin); if (!trace.startsolid && !trace.allsolid) { Math3D.VectorCopy(trace.endpos, ent.s.origin); *************** *** 145,150 **** /* ! * =============== M_ChangeYaw ! * * =============== *///ok --- 145,150 ---- /* ! * =============== ! * M_ChangeYaw * =============== *///ok *************** *** 182,187 **** /* ! * ====================== M_MoveToGoal ====================== ! */// ok public static void M_MoveToGoal(edict_t ent, float dist) { edict_t goal = ent.goalentity; --- 182,189 ---- /* ! * ====================== ! * M_MoveToGoal ! * ====================== ! */ public static void M_MoveToGoal(edict_t ent, float dist) { edict_t goal = ent.goalentity; *************** *** 204,208 **** /* ! * =============== M_walkmove =============== */ public static boolean M_walkmove(edict_t ent, float yaw, float dist) { --- 206,212 ---- /* ! * =============== ! * M_walkmove ! * =============== */ public static boolean M_walkmove(edict_t ent, float yaw, float dist) { *************** *** 268,272 **** if (dmg > 15) dmg = 15; ! GameUtil.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, dmg, 0, --- 272,276 ---- if (dmg > 15) dmg = 15; ! GameCombat.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, dmg, 0, *************** *** 285,289 **** if (dmg > 15) dmg = 15; ! GameUtil.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, dmg, 0, --- 289,293 ---- if (dmg > 15) dmg = 15; ! GameCombat.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, dmg, 0, *************** *** 309,313 **** if (ent.damage_debounce_time < GameBase.level.time) { ent.damage_debounce_time = GameBase.level.time + 0.2f; ! GameUtil.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, 10 * ent.waterlevel, --- 313,317 ---- if (ent.damage_debounce_time < GameBase.level.time) { ent.damage_debounce_time = GameBase.level.time + 0.2f; ! GameCombat.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, 10 * ent.waterlevel, *************** *** 319,323 **** if (ent.damage_debounce_time < GameBase.level.time) { ent.damage_debounce_time = GameBase.level.time + 1; ! GameUtil.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, 4 * ent.waterlevel, --- 323,327 ---- if (ent.damage_debounce_time < GameBase.level.time) { ent.damage_debounce_time = GameBase.level.time + 1; ! GameCombat.T_Damage(ent, GameBase.g_edicts[0], GameBase.g_edicts[0], Globals.vec3_origin, ent.s.origin, Globals.vec3_origin, 4 * ent.waterlevel, *************** *** 449,525 **** } - public static void M_ReactToDamage(edict_t targ, edict_t attacker) { - if ((null != attacker.client) - && 0 != (attacker.svflags & Defines.SVF_MONSTER)) - return; - - if (attacker == targ || attacker == targ.enemy) - return; - - // 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 (attacker.client != null - || (attacker.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) - return; - } - - // 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) { - 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)) { - targ.oldenemy = attacker; - return; - } - targ.oldenemy = targ.enemy; - } - targ.enemy = attacker; - if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) - GameUtil.FoundTarget(targ); - return; - } - - // it's the same base (walk/swim/fly) type and a different classname and - // it's not a tank - // (they spray too much), get mad at them - if (((targ.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == (attacker.flags & (Defines.FL_FLY | Defines.FL_SWIM))) - && (!(targ.classname.equals(attacker.classname))) - && (!(attacker.classname.equals("monster_tank"))) - && (!(attacker.classname.equals("monster_supertank"))) - && (!(attacker.classname.equals("monster_makron"))) - && (!(attacker.classname.equals("monster_jorg")))) { - if (targ.enemy != null && targ.enemy.client != null) - targ.oldenemy = targ.enemy; - targ.enemy = attacker; - if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) - GameUtil.FoundTarget(targ); - } - // if they *meant* to shoot us, then shoot back - else if (attacker.enemy == targ) { - if (targ.enemy != null && targ.enemy.client != null) - targ.oldenemy = targ.enemy; - targ.enemy = attacker; - if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) - 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) { - if (targ.enemy != null && targ.enemy.client != null) - targ.oldenemy = targ.enemy; - targ.enemy = attacker.enemy; - if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED)) - GameUtil.FoundTarget(targ); - } - } - /** Stops the Flies. */ public static EntThinkAdapter M_FliesOff = new EntThinkAdapter() { --- 453,456 ---- |
Update of /cvsroot/jake2/jake2/src/jake2/game/monsters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13343/src/jake2/game/monsters Modified Files: M_Infantry.java M_Brain.java M_Insane.java M_Gunner.java M_Parasite.java M_Boss32.java M_Float.java M_Gladiator.java M_Berserk.java M_Supertank.java M_Boss2.java M_Tank.java M_Soldier.java M_Flipper.java M_Chick.java M_Boss31.java M_Mutant.java M_Flyer.java M_Hover.java M_Medic.java M_Actor.java Log Message: sorted the methods according to their original locations in the c files. Index: M_Infantry.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Infantry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Infantry.java 6 Feb 2005 18:48:14 -0000 1.2 --- M_Infantry.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- import jake2.Defines; import jake2.client.M; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntDodgeAdapter; *************** *** 30,34 **** import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; - import jake2.game.Fire; import jake2.game.GameAI; import jake2.game.GameBase; --- 31,34 ---- *************** *** 844,854 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 844,854 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; *************** *** 994,998 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0); ! if (Fire.fire_hit(self, aim, (5 + (Lib.rand() % 5)), 50)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_punch_hit, 1, Defines.ATTN_NORM, 0); --- 994,998 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0); ! if (GameWeapon.fire_hit(self, aim, (5 + (Lib.rand() % 5)), 50)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_punch_hit, 1, Defines.ATTN_NORM, 0); Index: M_Insane.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Insane.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Insane.java 6 Feb 2005 18:48:14 -0000 1.2 --- M_Insane.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntPainAdapter; *************** *** 809,819 **** Defines.ATTN_IDLE, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 810,820 ---- Defines.ATTN_IDLE, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Soldier.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Soldier.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Soldier.java 6 Feb 2005 18:48:15 -0000 1.2 --- M_Soldier.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntDodgeAdapter; *************** *** 1041,1050 **** 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; --- 1042,1051 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 3; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Parasite.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Parasite.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Parasite.java 6 Feb 2005 18:48:16 -0000 1.2 --- M_Parasite.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- import jake2.Defines; import jake2.Globals; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; *************** *** 626,630 **** Math3D.VectorSubtract(start, end, dir); ! GameUtil.T_Damage(self.enemy, self, self, dir, self.enemy.s.origin, Globals.vec3_origin, damage, 0, Defines.DAMAGE_NO_KNOCKBACK, Defines.MOD_UNKNOWN); --- 627,631 ---- Math3D.VectorSubtract(start, end, dir); ! GameCombat.T_Damage(self.enemy, self, self, dir, self.enemy.s.origin, Globals.vec3_origin, damage, 0, Defines.DAMAGE_NO_KNOCKBACK, Defines.MOD_UNKNOWN); *************** *** 749,759 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 750,760 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Boss31.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Boss31.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Boss31.java 6 Feb 2005 18:48:16 -0000 1.2 --- M_Boss31.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 1080,1084 **** new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, M_Boss32.MakronToss), ! new mframe_t(GameAI.ai_move, 0, GameAI.BossExplode) // 50 }; --- 1080,1084 ---- new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, M_Boss32.MakronToss), ! new mframe_t(GameAI.ai_move, 0, M_Supertank.BossExplode) // 50 }; Index: M_Float.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Float.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Float.java 6 Feb 2005 18:48:17 -0000 1.2 --- M_Float.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 25,33 **** import jake2.Defines; import jake2.Globals; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; - import jake2.game.Fire; import jake2.game.GameAI; import jake2.game.GameBase; --- 25,33 ---- import jake2.Defines; import jake2.Globals; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; import jake2.game.GameAI; import jake2.game.GameBase; *************** *** 801,805 **** GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_attack3, 1, Defines.ATTN_NORM, 0); ! Fire.fire_hit(self, aim, 5 + Lib.rand() % 6, -50); return true; } --- 801,805 ---- GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_attack3, 1, Defines.ATTN_NORM, 0); ! GameWeapon.fire_hit(self, aim, 5 + Lib.rand() % 6, -50); return true; } *************** *** 868,872 **** GameBase.gi.multicast(origin, Defines.MULTICAST_PVS); ! GameUtil.T_Damage(self.enemy, self, self, dir, self.enemy.s.origin, Globals.vec3_origin, 5 + Lib.rand() % 6, -10, Defines.DAMAGE_ENERGY, Defines.MOD_UNKNOWN); --- 868,872 ---- GameBase.gi.multicast(origin, Defines.MULTICAST_PVS); ! GameCombat.T_Damage(self.enemy, self, self, dir, self.enemy.s.origin, Globals.vec3_origin, 5 + Lib.rand() % 6, -10, Defines.DAMAGE_ENERGY, Defines.MOD_UNKNOWN); *************** *** 1161,1165 **** GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death1, 1, Defines.ATTN_NORM, 0); ! GameAI.BecomeExplosion1(self); } --- 1161,1165 ---- GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death1, 1, Defines.ATTN_NORM, 0); ! GameMisc.BecomeExplosion1(self); } Index: M_Medic.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Medic.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Medic.java 6 Feb 2005 18:48:32 -0000 1.2 --- M_Medic.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,42 **** import jake2.Defines; ! import jake2.game.EdictIterator; ! import jake2.game.EntDieAdapter; ! import jake2.game.EntDodgeAdapter; ! import jake2.game.EntInteractAdapter; ! import jake2.game.EntPainAdapter; ! import jake2.game.EntThinkAdapter; ! import jake2.game.GameAI; ! import jake2.game.GameBase; ! import jake2.game.GameSpawn; ! import jake2.game.GameUtil; ! import jake2.game.Monster; ! import jake2.game.edict_t; ! import jake2.game.mframe_t; ! import jake2.game.mmove_t; ! import jake2.game.trace_t; import jake2.util.Lib; import jake2.util.Math3D; --- 24,28 ---- import jake2.Defines; ! import jake2.game.*; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 939,949 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 925,935 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Berserk.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Berserk.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Berserk.java 6 Feb 2005 18:48:32 -0000 1.2 --- M_Berserk.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 20,38 **** // Created on 11.11.2003 by RST // $Id$ package jake2.game.monsters; import jake2.Defines; ! import jake2.game.EntDieAdapter; ! import jake2.game.EntInteractAdapter; ! import jake2.game.EntPainAdapter; ! import jake2.game.EntThinkAdapter; ! import jake2.game.Fire; ! import jake2.game.GameAI; ! import jake2.game.GameBase; ! import jake2.game.GameUtil; ! import jake2.game.edict_t; ! import jake2.game.mframe_t; ! import jake2.game.mmove_t; import jake2.util.Lib; import jake2.util.Math3D; --- 20,30 ---- // Created on 11.11.2003 by RST + // $Id$ + package jake2.game.monsters; import jake2.Defines; ! import jake2.game.*; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 686,690 **** float[] aim = { Defines.MELEE_DISTANCE, 0f, -24f }; ! Fire.fire_hit(self, aim, (15 + (Lib.rand() % 6)), 400); // Faster attack -- upwards and backwards --- 678,682 ---- float[] aim = { Defines.MELEE_DISTANCE, 0f, -24f }; ! GameWeapon.fire_hit(self, aim, (15 + (Lib.rand() % 6)), 400); // Faster attack -- upwards and backwards *************** *** 719,723 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4); ! Fire.fire_hit(self, aim, (5 + (Lib.rand() % 6)), 400); // Slower // attack --- 711,715 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4); ! GameWeapon.fire_hit(self, aim, (5 + (Lib.rand() % 6)), 400); // Slower // attack *************** *** 909,919 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 901,911 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Actor.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Actor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Actor.java 6 Feb 2005 18:48:32 -0000 1.2 --- M_Actor.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntPainAdapter; *************** *** 1298,1308 **** // 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 1299,1309 ---- // 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Tank.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Tank.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Tank.java 6 Feb 2005 18:48:15 -0000 1.2 --- M_Tank.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; *************** *** 1413,1426 **** Defines.ATTN_NORM, 0); for (n = 0; n < 1 /* 4 */; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, Defines.GIB_METALLIC); ! GameAI.ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, Defines.GIB_ORGANIC); ! GameAI.ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, Defines.GIB_METALLIC); self.deadflag = Defines.DEAD_DEAD; --- 1414,1427 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 1 /* 4 */; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, Defines.GIB_METALLIC); ! GameMisc.ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, Defines.GIB_METALLIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Boss32.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Boss32.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Boss32.java 6 Feb 2005 18:48:16 -0000 1.2 --- M_Boss32.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- import jake2.Defines; import jake2.Globals; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; *************** *** 1696,1707 **** Defines.ATTN_NORM, 0); for (n = 0; n < 1 /* 4 */; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, Defines.GIB_METALLIC); ! GameAI.ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, Defines.GIB_METALLIC); self.deadflag = Defines.DEAD_DEAD; --- 1697,1708 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 1 /* 4 */; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, Defines.GIB_METALLIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, Defines.GIB_METALLIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Flyer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Flyer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Flyer.java 6 Feb 2005 18:48:17 -0000 1.2 --- M_Flyer.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,32 **** import jake2.Defines; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; - import jake2.game.Fire; import jake2.game.GameAI; import jake2.game.GameBase; --- 24,32 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; import jake2.game.GameAI; import jake2.game.GameBase; *************** *** 757,761 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 0); ! Fire.fire_hit(self, aim, 5, 0); GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_slash, 1, Defines.ATTN_NORM, 0); --- 757,761 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 0); ! GameWeapon.fire_hit(self, aim, 5, 0); GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_slash, 1, Defines.ATTN_NORM, 0); *************** *** 769,773 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 0); ! Fire.fire_hit(self, aim, 5, 0); GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_slash, 1, Defines.ATTN_NORM, 0); --- 769,773 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 0); ! GameWeapon.fire_hit(self, aim, 5, 0); GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_slash, 1, Defines.ATTN_NORM, 0); *************** *** 906,910 **** GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die, 1, Defines.ATTN_NORM, 0); ! GameAI.BecomeExplosion1(self); } }; --- 906,910 ---- GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die, 1, Defines.ATTN_NORM, 0); ! GameMisc.BecomeExplosion1(self); } }; Index: M_Supertank.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Supertank.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Supertank.java 6 Feb 2005 18:48:32 -0000 1.2 --- M_Supertank.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntPainAdapter; *************** *** 942,946 **** new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), ! new mframe_t(GameAI.ai_move, 0, GameAI.BossExplode) }; static mmove_t supertank_move_death = new mmove_t(FRAME_death_1, --- 943,947 ---- new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), ! new mframe_t(GameAI.ai_move, 0, M_Supertank.BossExplode) }; static mmove_t supertank_move_death = new mmove_t(FRAME_death_1, *************** *** 1197,1263 **** }; ! void BossExplode(edict_t self) { ! float[] org = { 0, 0, 0 }; ! int n; ! ! self.think = GameAI.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; } ! ! 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; ! } } \ No newline at end of file --- 1198,1270 ---- }; ! /** 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++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", 500, ! Defines.GIB_ORGANIC); ! for (n = 0; n < 8; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", ! 500, Defines.GIB_METALLIC); ! GameMisc.ThrowGib(self, "models/objects/gibs/chest/tris.md2", 500, ! Defines.GIB_ORGANIC); ! GameMisc.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; } ! }; } \ No newline at end of file Index: M_Gunner.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Gunner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Gunner.java 6 Feb 2005 18:48:15 -0000 1.2 --- M_Gunner.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntDodgeAdapter; *************** *** 788,798 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 789,799 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Boss2.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Boss2.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Boss2.java 6 Feb 2005 18:48:32 -0000 1.2 --- M_Boss2.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 1014,1018 **** new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), ! new mframe_t(GameAI.ai_move, 0, GameAI.BossExplode) }; /* --- 1014,1018 ---- new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), ! new mframe_t(GameAI.ai_move, 0, M_Supertank.BossExplode) }; /* Index: M_Chick.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Chick.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Chick.java 6 Feb 2005 18:48:17 -0000 1.2 --- M_Chick.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 20,40 **** // Created on 13.11.2003 by RST. // $Id$ package jake2.game.monsters; import jake2.Defines; ! import jake2.game.EntDieAdapter; ! import jake2.game.EntDodgeAdapter; ! import jake2.game.EntInteractAdapter; ! import jake2.game.EntPainAdapter; ! import jake2.game.EntThinkAdapter; ! import jake2.game.Fire; ! import jake2.game.GameAI; ! import jake2.game.GameBase; ! import jake2.game.GameUtil; ! import jake2.game.Monster; ! import jake2.game.edict_t; ! import jake2.game.mframe_t; ! import jake2.game.mmove_t; import jake2.util.Lib; import jake2.util.Math3D; --- 20,30 ---- // Created on 13.11.2003 by RST. + // $Id$ + package jake2.game.monsters; import jake2.Defines; ! import jake2.game.*; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 970,980 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 960,970 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; *************** *** 1068,1072 **** GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee_swing, 1, Defines.ATTN_NORM, 0); ! Fire.fire_hit(self, aim, (10 + (Lib.rand() % 6)), 100); return true; } --- 1058,1062 ---- GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee_swing, 1, Defines.ATTN_NORM, 0); ! GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 6)), 100); return true; } Index: M_Hover.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Hover.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Hover.java 6 Feb 2005 18:48:17 -0000 1.2 --- M_Hover.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; *************** *** 585,589 **** return true; } ! GameAI.BecomeExplosion1(self); return true; } --- 586,590 ---- return true; } ! GameMisc.BecomeExplosion1(self); return true; } *************** *** 615,625 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameAI.ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; --- 616,626 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Flipper.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Flipper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Flipper.java 6 Feb 2005 18:48:17 -0000 1.2 --- M_Flipper.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,32 **** import jake2.Defines; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; - import jake2.game.Fire; import jake2.game.GameAI; import jake2.game.GameBase; --- 24,32 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; import jake2.game.GameAI; import jake2.game.GameBase; *************** *** 533,537 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0); ! Fire.fire_hit(self, aim, 5, 0); return true; } --- 533,537 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0); ! GameWeapon.fire_hit(self, aim, 5, 0); return true; } *************** *** 702,712 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameAI.ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; --- 702,712 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Gladiator.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Gladiator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Gladiator.java 6 Feb 2005 18:48:18 -0000 1.2 --- M_Gladiator.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 24,32 **** import jake2.Defines; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; - import jake2.game.Fire; import jake2.game.GameAI; import jake2.game.GameBase; --- 24,32 ---- import jake2.Defines; + import jake2.game.*; import jake2.game.EntDieAdapter; import jake2.game.EntInteractAdapter; import jake2.game.EntPainAdapter; import jake2.game.EntThinkAdapter; import jake2.game.GameAI; import jake2.game.GameBase; *************** *** 360,364 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4); ! if (Fire.fire_hit(self, aim, (20 + (Lib.rand() % 5)), 300)) GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_cleaver_hit, 1, Defines.ATTN_NORM, 0); --- 360,364 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4); ! if (GameWeapon.fire_hit(self, aim, (20 + (Lib.rand() % 5)), 300)) GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_cleaver_hit, 1, Defines.ATTN_NORM, 0); *************** *** 571,581 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 571,581 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Mutant.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Mutant.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Mutant.java 6 Feb 2005 18:48:17 -0000 1.2 --- M_Mutant.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 25,42 **** import jake2.Defines; import jake2.client.M; ! import jake2.game.EntDieAdapter; ! import jake2.game.EntInteractAdapter; ! import jake2.game.EntPainAdapter; ! import jake2.game.EntThinkAdapter; ! import jake2.game.EntTouchAdapter; ! import jake2.game.Fire; ! import jake2.game.GameAI; ! import jake2.game.GameBase; ! import jake2.game.GameUtil; ! import jake2.game.cplane_t; ! import jake2.game.csurface_t; ! import jake2.game.edict_t; ! import jake2.game.mframe_t; ! import jake2.game.mmove_t; import jake2.util.Lib; import jake2.util.Math3D; --- 25,29 ---- import jake2.Defines; import jake2.client.M; ! import jake2.game.*; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 613,617 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); ! if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit, 1, Defines.ATTN_NORM, 0); --- 600,604 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); ! if (GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit, 1, Defines.ATTN_NORM, 0); *************** *** 628,632 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); ! if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit2, 1, Defines.ATTN_NORM, 0); --- 615,619 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); ! if (GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit2, 1, Defines.ATTN_NORM, 0); *************** *** 693,697 **** Math3D.VectorMA(self.s.origin, self.maxs[0], normal, point); damage = (int) (40 + 10 * Lib.random()); ! GameUtil.T_Damage(other, self, self, self.velocity, point, normal, damage, damage, 0, Defines.MOD_UNKNOWN); } --- 680,684 ---- Math3D.VectorMA(self.s.origin, self.maxs[0], normal, point); damage = (int) (40 + 10 * Lib.random()); ! GameCombat.T_Damage(other, self, self, self.velocity, point, normal, damage, damage, 0, Defines.MOD_UNKNOWN); } *************** *** 958,968 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 945,955 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; Index: M_Brain.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/monsters/M_Brain.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** M_Brain.java 6 Feb 2005 18:48:14 -0000 1.2 --- M_Brain.java 16 Nov 2005 22:24:52 -0000 1.3 *************** *** 20,39 **** // Created on 13.11.2003 by RST. // $Id$ package jake2.game.monsters; import jake2.Defines; ! import jake2.game.EntDieAdapter; ! import jake2.game.EntDodgeAdapter; ! import jake2.game.EntInteractAdapter; ! import jake2.game.EntPainAdapter; ! import jake2.game.EntThinkAdapter; ! import jake2.game.Fire; ! import jake2.game.GameAI; ! import jake2.game.GameBase; ! import jake2.game.GameUtil; ! import jake2.game.edict_t; ! import jake2.game.mframe_t; ! import jake2.game.mmove_t; import jake2.util.Lib; import jake2.util.Math3D; --- 20,30 ---- // Created on 13.11.2003 by RST. + // $Id$ + package jake2.game.monsters; import jake2.Defines; ! import jake2.game.*; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 799,803 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); ! if (Fire.fire_hit(self, aim, (15 + (Lib.rand() % 5)), 40)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee3, 1, Defines.ATTN_NORM, 0); --- 790,794 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); ! if (GameWeapon.fire_hit(self, aim, (15 + (Lib.rand() % 5)), 40)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee3, 1, Defines.ATTN_NORM, 0); *************** *** 820,824 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); ! if (Fire.fire_hit(self, aim, (15 + (Lib.rand() % 5)), 40)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee3, 1, Defines.ATTN_NORM, 0); --- 811,815 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); ! if (GameWeapon.fire_hit(self, aim, (15 + (Lib.rand() % 5)), 40)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee3, 1, Defines.ATTN_NORM, 0); *************** *** 844,848 **** Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 8); ! if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), -600) && GameBase.skill.value > 0) self.spawnflags |= 65536; --- 835,839 ---- Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 8); ! if (GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 5)), -600) && GameBase.skill.value > 0) self.spawnflags |= 65536; *************** *** 1070,1080 **** Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); 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); self.deadflag = Defines.DEAD_DEAD; --- 1061,1071 ---- Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) ! GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); ! GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; |
From: Rene S. <sa...@us...> - 2005-11-16 22:25:02
|
Update of /cvsroot/jake2/jake2/src/jake2/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13343/src/jake2/server Modified Files: SV_USER.java Log Message: sorted the methods according to their original locations in the c files. Index: SV_USER.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_USER.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SV_USER.java 6 Feb 2005 19:28:16 -0000 1.8 --- SV_USER.java 16 Nov 2005 22:24:53 -0000 1.9 *************** *** 532,536 **** if (i == SV_USER.ucmds.length && SV_INIT.sv.state == Defines.ss_game) ! GameAI.ClientCommand(SV_USER.sv_player); // SV_EndRedirect (); --- 532,536 ---- if (i == SV_USER.ucmds.length && SV_INIT.sv.state == Defines.ss_game) ! Cmd.ClientCommand(SV_USER.sv_player); // SV_EndRedirect (); |
From: Rene S. <sa...@us...> - 2005-11-16 22:25:02
|
Update of /cvsroot/jake2/jake2/src/jake2/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13343/src/jake2/util Modified Files: QuakeFile.java Log Message: sorted the methods according to their original locations in the c files. Index: QuakeFile.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/util/QuakeFile.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QuakeFile.java 22 Sep 2004 19:22:13 -0000 1.4 --- QuakeFile.java 16 Nov 2005 22:24:53 -0000 1.5 *************** *** 20,36 **** // Created on 24.07.2004 by RST. // $Id$ package jake2.util; ! import jake2.game.GameAI; ! import jake2.game.GameBase; ! import jake2.game.SuperAdapter; ! import jake2.game.edict_t; ! import jake2.game.gitem_t; import jake2.qcommon.Com; ! import java.io.FileNotFoundException; ! import java.io.IOException; ! import java.io.RandomAccessFile; /** --- 20,32 ---- // Created on 24.07.2004 by RST. + // $Id$ + package jake2.util; ! import jake2.game.*; import jake2.qcommon.Com; ! import java.io.*; /** *************** *** 161,165 **** return null; else ! return GameAI.itemlist[ndx]; } --- 157,161 ---- return null; else ! return GameItems.itemlist[ndx]; } |
From: Rene S. <sa...@us...> - 2005-11-16 22:10:17
|
Update of /cvsroot/jake2/jake2/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10468/scripts Modified Files: Jake2.bat Log Message: added ressource to class path Index: Jake2.bat =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2.bat,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Jake2.bat 26 May 2005 16:56:32 -0000 1.5 --- Jake2.bat 16 Nov 2005 22:10:06 -0000 1.6 *************** *** 1,4 **** @echo off SET PATH=lib\windows;%PATH% ! SET CP=lib/jake2.jar;lib/jogl.jar;lib/windows/joal.jar java -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows -cp %CP% jake2.Jake2 \ No newline at end of file --- 1,4 ---- @echo off SET PATH=lib\windows;%PATH% ! SET CP=.;lib/jake2.jar;lib/jogl.jar;lib/windows/joal.jar;build;resources java -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows -cp %CP% jake2.Jake2 \ No newline at end of file |
From: Carsten W. <ca...@us...> - 2005-11-15 00:14:00
|
Update of /cvsroot/jake2/jake2/src/jake2/render/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5278/src/jake2/render/opengl Added Files: Tag: render-refactoring DummyGL.java CountGL.java Log Message: moved to opengl package --- NEW FILE: DummyGL.java --- package jake2.render.opengl; import java.nio.*; public class DummyGL implements QGL { private static QGL self = new DummyGL(); private DummyGL() { // singleton } public static QGL getInstance() { return self; } public void glAlphaFunc(int func, float ref) { // do nothing } public void glBegin(int mode) { // do nothing } public void glBindTexture(int target, int texture) { // do nothing } public void glBlendFunc(int sfactor, int dfactor) { // do nothing } public void glClear(int mask) { // do nothing } public void glClearColor(float red, float green, float blue, float alpha) { // do nothing } public void glColor3f(float red, float green, float blue) { // do nothing } public void glColor3ub(byte red, byte green, byte blue) { // do nothing } public void glColor4f(float red, float green, float blue, float alpha) { // do nothing } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { // do nothing } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { // do nothing } public void glColorPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glCullFace(int mode) { // do nothing } public void glDeleteTextures(IntBuffer textures) { // do nothing } public void glDepthFunc(int func) { // do nothing } public void glDepthMask(boolean flag) { // do nothing } public void glDepthRange(double zNear, double zFar) { // do nothing } public void glDisable(int cap) { // do nothing } public void glDisableClientState(int cap) { // do nothing } public void glDrawArrays(int mode, int first, int count) { // do nothing } public void glDrawBuffer(int mode) { // do nothing } public void glDrawElements(int mode, IntBuffer indices) { // do nothing } public void glEnable(int cap) { // do nothing } public void glEnableClientState(int cap) { // do nothing } public void glEnd() { // do nothing } public void glFinish() { // do nothing } public void glFlush() { // do nothing } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { // do nothing } public int glGetError() { return GL_NO_ERROR; } public void glGetFloat(int pname, FloatBuffer params) { // do nothing } public String glGetString(int name) { switch (name) { case GL_EXTENSIONS: return "GL_ARB_multitexture"; default: return ""; } } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { // do nothing } public void glLoadIdentity() { // do nothing } public void glLoadMatrix(FloatBuffer m) { // do nothing } public void glMatrixMode(int mode) { // do nothing } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { // do nothing } public void glPixelStorei(int pname, int param) { // do nothing } public void glPointSize(float size) { // do nothing } public void glPolygonMode(int face, int mode) { // do nothing } public void glPopMatrix() { // do nothing } public void glPushMatrix() { // do nothing } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { // do nothing } public void glRotatef(float angle, float x, float y, float z) { // do nothing } public void glScalef(float x, float y, float z) { // do nothing } public void glScissor(int x, int y, int width, int height) { // do nothing } public void glShadeModel(int mode) { // do nothing } public void glTexCoord2f(float s, float t) { // do nothing } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glTexEnvi(int target, int pname, int param) { // do nothing } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { // do nothing } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { // do nothing } public void glTexParameterf(int target, int pname, float param) { // do nothing } public void glTexParameteri(int target, int pname, int param) { // do nothing } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { // do nothing } public void glTranslatef(float x, float y, float z) { // do nothing } public void glVertex2f(float x, float y) { // do nothing } public void glVertex3f(float x, float y, float z) { // do nothing } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glViewport(int x, int y, int width, int height) { // do nothing } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { // do nothing } public void glActiveTextureARB(int texture) { // do nothing } public void glClientActiveTextureARB(int texture) { // do nothing } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { // do nothing } public void glPointParameterfEXT(int pname, float param) { // do nothing } public void glLockArraysEXT(int first, int count) { // do nothing } public void glArrayElement(int index) { // do nothing } public void glUnlockArraysEXT() { // do nothing } public void glMultiTexCoord2f(int target, float s, float t) { // do nothing } } --- NEW FILE: CountGL.java --- package jake2.render.opengl; import java.nio.*; public class CountGL implements QGL { private static int count = 0; private static QGL self = new CountGL(); private CountGL() { // singleton } public static QGL getInstance() { return self; } public void glAlphaFunc(int func, float ref) { count++; } public void glBegin(int mode) { count++; } public void glBindTexture(int target, int texture) { count++; } public void glBlendFunc(int sfactor, int dfactor) { count++; } public void glClear(int mask) { count++; } public void glClearColor(float red, float green, float blue, float alpha) { count++; } public void glColor3f(float red, float green, float blue) { count++; } public void glColor3ub(byte red, byte green, byte blue) { count++; } public void glColor4f(float red, float green, float blue, float alpha) { count++; } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { count++; } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { count++; } public void glColorPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glCullFace(int mode) { count++; } public void glDeleteTextures(IntBuffer textures) { count++; } public void glDepthFunc(int func) { count++; } public void glDepthMask(boolean flag) { count++; } public void glDepthRange(double zNear, double zFar) { count++; } public void glDisable(int cap) { count++; } public void glDisableClientState(int cap) { count++; } public void glDrawArrays(int mode, int first, int count) { count++; } public void glDrawBuffer(int mode) { count++; } public void glDrawElements(int mode, IntBuffer indices) { count++; } public void glEnable(int cap) { count++; } public void glEnableClientState(int cap) { count++; } public void glEnd() { count++; } public void glFinish() { count++; } public void glFlush() { System.err.println("GL calls/frame: " + (++count)); count = 0; } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { count++; } public int glGetError() { return GL_NO_ERROR; } public void glGetFloat(int pname, FloatBuffer params) { count++; } public String glGetString(int name) { switch (name) { case GL_EXTENSIONS: return "GL_ARB_multitexture"; default: return ""; } } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { count++; } public void glLoadIdentity() { count++; } public void glLoadMatrix(FloatBuffer m) { count++; } public void glMatrixMode(int mode) { count++; } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { count++; } public void glPixelStorei(int pname, int param) { count++; } public void glPointSize(float size) { count++; } public void glPolygonMode(int face, int mode) { count++; } public void glPopMatrix() { count++; } public void glPushMatrix() { count++; } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { count++; } public void glRotatef(float angle, float x, float y, float z) { count++; } public void glScalef(float x, float y, float z) { count++; } public void glScissor(int x, int y, int width, int height) { count++; } public void glShadeModel(int mode) { count++; } public void glTexCoord2f(float s, float t) { count++; } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glTexEnvi(int target, int pname, int param) { count++; } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { count++; } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { count++; } public void glTexParameterf(int target, int pname, float param) { count++; } public void glTexParameteri(int target, int pname, int param) { count++; } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { count++; } public void glTranslatef(float x, float y, float z) { count++; } public void glVertex2f(float x, float y) { count++; } public void glVertex3f(float x, float y, float z) { count++; } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glViewport(int x, int y, int width, int height) { count++; } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { count++; } public void glActiveTextureARB(int texture) { count++; } public void glClientActiveTextureARB(int texture) { count++; } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { count++; } public void glPointParameterfEXT(int pname, float param) { count++; } public void glLockArraysEXT(int first, int count) { count++; } public void glArrayElement(int index) { count++; } public void glUnlockArraysEXT() { count++; } public void glMultiTexCoord2f(int target, float s, float t) { count++; } } |
From: Carsten W. <ca...@us...> - 2005-11-15 00:12:49
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5090/src/jake2/render Modified Files: Tag: render-refactoring JoglRenderer.java Jsr231Renderer.java LwjglRenderer.java Log Message: using the fast renderer impl TODO extract an interface Index: JoglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/JoglRenderer.java,v retrieving revision 1.6.8.3 retrieving revision 1.6.8.4 diff -C2 -d -r1.6.8.3 -r1.6.8.4 *** JoglRenderer.java 14 Nov 2005 23:59:00 -0000 1.6.8.3 --- JoglRenderer.java 15 Nov 2005 00:12:40 -0000 1.6.8.4 *************** *** 48,52 **** // TODO extract a interface from render code ! private jake2.render.basic.Misc impl = new jake2.render.basic.Misc(); static { --- 48,52 ---- // TODO extract a interface from render code ! private jake2.render.fast.Misc impl = new jake2.render.fast.Misc(); static { Index: LwjglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/LwjglRenderer.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** LwjglRenderer.java 14 Nov 2005 23:59:00 -0000 1.1.2.1 --- LwjglRenderer.java 15 Nov 2005 00:12:40 -0000 1.1.2.2 *************** *** 47,51 **** // TODO extract a interface from render code ! private jake2.render.basic.Misc impl = new jake2.render.basic.Misc(); static { --- 47,51 ---- // TODO extract a interface from render code ! private jake2.render.fast.Misc impl = new jake2.render.fast.Misc(); static { Index: Jsr231Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/Jsr231Renderer.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Jsr231Renderer.java 14 Nov 2005 23:59:00 -0000 1.1.2.1 --- Jsr231Renderer.java 15 Nov 2005 00:12:40 -0000 1.1.2.2 *************** *** 47,51 **** // TODO extract a interface from render code ! private jake2.render.basic.Misc impl = new jake2.render.basic.Misc(); static { --- 47,51 ---- // TODO extract a interface from render code ! private jake2.render.fast.Misc impl = new jake2.render.fast.Misc(); static { |
From: Carsten W. <ca...@us...> - 2005-11-15 00:06:51
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fast In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4058/src/jake2/render/fast Added Files: Tag: render-refactoring Surf.java Anorms.java Image.java Misc.java Mesh.java Main.java Model.java Light.java Draw.java Warp.java Polygon.java Log Message: this is the refactored (old lwjgl) renderer impl --- NEW FILE: Image.java --- /* * Image.java * Copyright (C) 2003 * * $Id: Image.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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. [...1645 lines suppressed...] */ void GL_ShutdownImages() { image_t image; for (int i=0; i < numgltextures ; i++) { image = gltextures[i]; if (image.registration_sequence == 0) continue; // free image_t slot // free it // TODO jogl bug texnumBuffer.clear(); texnumBuffer.put(0,image.texnum); gl.glDeleteTextures(texnumBuffer); image.clear(); } } } --- NEW FILE: Surf.java --- /* * Surf.java * Copyright (C) 2003 * * $Id: Surf.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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. [...1294 lines suppressed...] // IntBuffer pix = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer(); // // int[] pixel = new int[w * h]; // // pix.get(pixel); // // BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR); // image.setRGB(0, 0, w, h, pixel, 0, w); // AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(scale, scale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR); // BufferedImage tmp = op.filter(image, null); // // if (frame == null) { // frame = new ImageFrame(null); // frame.show(); // } // frame.showImage(tmp); // // } } --- NEW FILE: Light.java --- /* * Light.java * Copyright (C) 2003 * * $Id: Light.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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.render.fast; import jake2.Defines; import jake2.Globals; import jake2.client.dlight_t; import jake2.game.cplane_t; import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Math3D; import jake2.util.Vec3Cache; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Arrays; /** * Light * * @author cwei */ public abstract class Light extends Warp { // r_light.c int r_dlightframecount; static final int DLIGHT_CUTOFF = 64; /* ============================================================================= DYNAMIC LIGHTS BLEND RENDERING ============================================================================= */ // stack variable private final float[] v = {0, 0, 0}; /** * R_RenderDlight */ void R_RenderDlight(dlight_t light) { float rad = light.intensity * 0.35f; Math3D.VectorSubtract (light.origin, r_origin, v); gl.glBegin (GL_TRIANGLE_FAN); gl.glColor3f (light.color[0]*0.2f, light.color[1]*0.2f, light.color[2]*0.2f); int i; for (i=0 ; i<3 ; i++) v[i] = light.origin[i] - vpn[i]*rad; gl.glVertex3f(v[0], v[1], v[2]); gl.glColor3f (0,0,0); int j; float a; for (i=16 ; i>=0 ; i--) { a = (float)(i/16.0f * Math.PI*2); for (j=0 ; j<3 ; j++) v[j] = (float)(light.origin[j] + vright[j]*Math.cos(a)*rad + vup[j]*Math.sin(a)*rad); gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd (); } /** * R_RenderDlights */ void R_RenderDlights() { if (gl_flashblend.value == 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame gl.glDepthMask(false); gl.glDisable(GL_TEXTURE_2D); gl.glShadeModel (GL_SMOOTH); gl.glEnable (GL_BLEND); gl.glBlendFunc (GL_ONE, GL_ONE); for (int i=0 ; i<r_newrefdef.num_dlights ; i++) { R_RenderDlight(r_newrefdef.dlights[i]); } gl.glColor3f (1,1,1); gl.glDisable(GL_BLEND); gl.glEnable(GL_TEXTURE_2D); gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl.glDepthMask(true); } /* ============================================================================= DYNAMIC LIGHTS ============================================================================= */ /** * R_MarkLights */ void R_MarkLights (dlight_t light, int bit, mnode_t node) { if (node.contents != -1) return; cplane_t splitplane = node.plane; float dist = Math3D.DotProduct (light.origin, splitplane.normal) - splitplane.dist; if (dist > light.intensity - DLIGHT_CUTOFF) { R_MarkLights (light, bit, node.children[0]); return; } if (dist < -light.intensity + DLIGHT_CUTOFF) { R_MarkLights (light, bit, node.children[1]); return; } // mark the polygons msurface_t surf; int sidebit; for (int i=0 ; i<node.numsurfaces ; i++) { surf = r_worldmodel.surfaces[node.firstsurface + i]; /* * cwei * bugfix for dlight behind the walls */ dist = Math3D.DotProduct (light.origin, surf.plane.normal) - surf.plane.dist; sidebit = (dist >= 0) ? 0 : Defines.SURF_PLANEBACK; if ( (surf.flags & Defines.SURF_PLANEBACK) != sidebit ) continue; /* * cwei * bugfix end */ if (surf.dlightframe != r_dlightframecount) { surf.dlightbits = 0; surf.dlightframe = r_dlightframecount; } surf.dlightbits |= bit; } R_MarkLights (light, bit, node.children[0]); R_MarkLights (light, bit, node.children[1]); } /** * R_PushDlights */ void R_PushDlights() { if (gl_flashblend.value != 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame dlight_t l; for (int i=0 ; i<r_newrefdef.num_dlights ; i++) { l = r_newrefdef.dlights[i]; R_MarkLights( l, 1<<i, r_worldmodel.nodes[0] ); } } /* ============================================================================= LIGHT SAMPLING ============================================================================= */ float[] pointcolor = {0, 0, 0}; // vec3_t cplane_t lightplane; // used as shadow plane float[] lightspot = {0, 0, 0}; // vec3_t /** * RecursiveLightPoint * @param node * @param start * @param end * @return */ int RecursiveLightPoint (mnode_t node, float[] start, float[] end) { if (node.contents != -1) return -1; // didn't hit anything // calculate mid point // FIXME: optimize for axial cplane_t plane = node.plane; float front = Math3D.DotProduct (start, plane.normal) - plane.dist; float back = Math3D.DotProduct (end, plane.normal) - plane.dist; boolean side = (front < 0); int sideIndex = (side) ? 1 : 0; if ( (back < 0) == side) return RecursiveLightPoint (node.children[sideIndex], start, end); float frac = front / (front-back); float[] mid = Vec3Cache.get(); mid[0] = start[0] + (end[0] - start[0])*frac; mid[1] = start[1] + (end[1] - start[1])*frac; mid[2] = start[2] + (end[2] - start[2])*frac; // go down front side int r = RecursiveLightPoint (node.children[sideIndex], start, mid); if (r >= 0) { Vec3Cache.release(); // mid return r; // hit something } if ( (back < 0) == side ) { Vec3Cache.release(); // mid return -1; // didn't hit anuthing } // check for impact on this node Math3D.VectorCopy (mid, lightspot); lightplane = plane; int surfIndex = node.firstsurface; msurface_t surf; int s, t, ds, dt; mtexinfo_t tex; ByteBuffer lightmap; int maps; for (int i=0 ; i<node.numsurfaces ; i++, surfIndex++) { surf = r_worldmodel.surfaces[surfIndex]; if ((surf.flags & (Defines.SURF_DRAWTURB | Defines.SURF_DRAWSKY)) != 0) continue; // no lightmaps tex = surf.texinfo; s = (int)(Math3D.DotProduct (mid, tex.vecs[0]) + tex.vecs[0][3]); t = (int)(Math3D.DotProduct (mid, tex.vecs[1]) + tex.vecs[1][3]); if (s < surf.texturemins[0] || t < surf.texturemins[1]) continue; ds = s - surf.texturemins[0]; dt = t - surf.texturemins[1]; if ( ds > surf.extents[0] || dt > surf.extents[1] ) continue; if (surf.samples == null) return 0; ds >>= 4; dt >>= 4; lightmap = surf.samples; int lightmapIndex = 0; Math3D.VectorCopy (Globals.vec3_origin, pointcolor); if (lightmap != null) { float[] rgb; lightmapIndex += 3 * (dt * ((surf.extents[0] >> 4) + 1) + ds); float scale0, scale1, scale2; for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255; maps++) { rgb = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb; scale0 = gl_modulate.value * rgb[0]; scale1 = gl_modulate.value * rgb[1]; scale2 = gl_modulate.value * rgb[2]; pointcolor[0] += (lightmap.get(lightmapIndex + 0) & 0xFF) * scale0 * (1.0f/255); pointcolor[1] += (lightmap.get(lightmapIndex + 1) & 0xFF) * scale1 * (1.0f/255); pointcolor[2] += (lightmap.get(lightmapIndex + 2) & 0xFF) * scale2 * (1.0f/255); lightmapIndex += 3 * ((surf.extents[0] >> 4) + 1) * ((surf.extents[1] >> 4) + 1); } } Vec3Cache.release(); // mid return 1; } // go down back side r = RecursiveLightPoint (node.children[1 - sideIndex], mid, end); Vec3Cache.release(); // mid return r; } // stack variable private final float[] end = {0, 0, 0}; /** * R_LightPoint */ void R_LightPoint (float[] p, float[] color) { assert (p.length == 3) : "vec3_t bug"; assert (color.length == 3) : "rgb bug"; if (r_worldmodel.lightdata == null) { color[0] = color[1] = color[2] = 1.0f; return; } end[0] = p[0]; end[1] = p[1]; end[2] = p[2] - 2048; float r = RecursiveLightPoint(r_worldmodel.nodes[0], p, end); if (r == -1) { Math3D.VectorCopy (Globals.vec3_origin, color); } else { Math3D.VectorCopy (pointcolor, color); } // // add dynamic lights // dlight_t dl; float add; for (int lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { dl = r_newrefdef.dlights[lnum]; Math3D.VectorSubtract (currententity.origin, dl.origin, end); add = dl.intensity - Math3D.VectorLength(end); add *= (1.0f/256); if (add > 0) { Math3D.VectorMA (color, add, dl.color, color); } } Math3D.VectorScale (color, gl_modulate.value, color); } // =================================================================== float[] s_blocklights = new float[34 * 34 * 3]; // TODO sync with jogl renderer. hoz private final float[] impact = {0, 0, 0}; /** * R_AddDynamicLights */ void R_AddDynamicLights(msurface_t surf) { int sd, td; float fdist, frad, fminlight; int s, t; dlight_t dl; float[] pfBL; float fsacc, ftacc; int smax = (surf.extents[0]>>4)+1; int tmax = (surf.extents[1]>>4)+1; mtexinfo_t tex = surf.texinfo; float local0, local1; for (int lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { if ( (surf.dlightbits & (1<<lnum)) == 0 ) continue; // not lit by this light dl = r_newrefdef.dlights[lnum]; frad = dl.intensity; fdist = Math3D.DotProduct (dl.origin, surf.plane.normal) - surf.plane.dist; frad -= Math.abs(fdist); // rad is now the highest intensity on the plane fminlight = DLIGHT_CUTOFF; // FIXME: make configurable? if (frad < fminlight) continue; fminlight = frad - fminlight; for (int i=0 ; i<3 ; i++) { impact[i] = dl.origin[i] - surf.plane.normal[i]*fdist; } local0 = Math3D.DotProduct (impact, tex.vecs[0]) + tex.vecs[0][3] - surf.texturemins[0]; local1 = Math3D.DotProduct (impact, tex.vecs[1]) + tex.vecs[1][3] - surf.texturemins[1]; pfBL = s_blocklights; int pfBLindex = 0; for (t = 0, ftacc = 0 ; t<tmax ; t++, ftacc += 16) { td = (int)(local1 - ftacc); if ( td < 0 ) td = -td; for (s=0, fsacc = 0 ; s<smax ; s++, fsacc += 16, pfBLindex += 3) { sd = (int)( local0 - fsacc ); if ( sd < 0 ) sd = -sd; if (sd > td) fdist = sd + (td>>1); else fdist = td + (sd>>1); if ( fdist < fminlight ) { pfBL[pfBLindex + 0] += ( frad - fdist ) * dl.color[0]; pfBL[pfBLindex + 1] += ( frad - fdist ) * dl.color[1]; pfBL[pfBLindex + 2] += ( frad - fdist ) * dl.color[2]; } } } } } /** * R_SetCacheState */ void R_SetCacheState( msurface_t surf ) { for (int maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255 ; maps++) { surf.cached_light[maps] = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].white; } } private Throwable gotoStore = new Throwable(); // TODO sync with jogl renderer. hoz /** * R_BuildLightMap * * Combine and scale multiple lightmaps into the floating format in blocklights */ void R_BuildLightMap(msurface_t surf, IntBuffer dest, int stride) { int r, g, b, a, max; int i, j; int nummaps; float[] bl; //lightstyle_t style; if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0) Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); int smax = (surf.extents[0] >> 4) + 1; int tmax = (surf.extents[1] >> 4) + 1; int size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4)) Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { // set to full bright if no light data if (surf.samples == null) { int maps; for (i = 0; i < size * 3; i++) s_blocklights[i] = 255; // TODO useless? hoz // for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && // surf.styles[maps] != (byte)255; maps++) // { // style = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF]; // } // goto store; throw gotoStore; } // count the # of maps for (nummaps = 0; nummaps < Defines.MAXLIGHTMAPS && surf.styles[nummaps] != (byte) 255; nummaps++) ; ByteBuffer lightmap = surf.samples; int lightmapIndex = 0; // add all the lightmaps float scale0; float scale1; float scale2; if (nummaps == 1) { int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; // for (i = 0; i < 3; i++) // scale[i] = gl_modulate.value // * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; scale0 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[0]; scale1 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[1]; scale2 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[2]; if (scale0 == 1.0F && scale1 == 1.0F && scale2 == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale0; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale1; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale2; } } //lightmap += size*3; // skip to next lightmap } } else { int maps; // memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * // 3 ); Arrays.fill(s_blocklights, 0, size * 3, 0.0f); for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; // for (i = 0; i < 3; i++) // scale[i] = gl_modulate.value // * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; scale0 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[0]; scale1 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[1]; scale2 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[2]; if (scale0 == 1.0F && scale1 == 1.0F && scale2 == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale0; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale1; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale2; } } //lightmap += size*3; // skip to next lightmap } } // add all the dynamic lights if (surf.dlightframe == r_framecount) R_AddDynamicLights(surf); // label store: } catch (Throwable store) { } // put into texture format stride -= smax; bl = s_blocklights; int blp = 0; int monolightmap = gl_monolightmap.string.charAt(0); int destp = 0; if (monolightmap == '0') { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | r); } } } else { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } /* * * So if we are doing alpha lightmaps we need to set the * R, G, and B * components to 0 and we need to set alpha to * 1-alpha. */ switch (monolightmap) { case 'L': case 'I': r = a; g = b = 0; break; case 'C': // try faking colored lighting a = 255 - ((r + g + b) / 3); float af = a / 255.0f; r *= af; g *= af; b *= af; break; case 'A': default: r = g = b = 0; a = 255 - a; break; } //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | r); } } } } } --- NEW FILE: Mesh.java --- /* * Mesh.java * Copyright (C) 2003 * * $Id: Mesh.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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.render.fast; import jake2.Defines; import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; import jake2.util.Lib; import jake2.util.Math3D; import java.nio.FloatBuffer; import java.nio.IntBuffer; /** * Mesh * * @author cwei */ public abstract class Mesh extends Light { // g_mesh.c: triangle model functions /* ============================================================= ALIAS MODELS ============================================================= */ static final int NUMVERTEXNORMALS = 162; float[][] r_avertexnormals = Anorms.VERTEXNORMALS; float[] shadevector = {0, 0, 0}; float[] shadelight = {0, 0, 0}; // precalculated dot products for quantized angles static final int SHADEDOT_QUANT = 16; float[][] r_avertexnormal_dots = Anorms.VERTEXNORMAL_DOTS; float[] shadedots = r_avertexnormal_dots[0]; /** * GL_LerpVerts * @param nverts * @param ov * @param verts * @param move * @param frontv * @param backv */ void GL_LerpVerts(int nverts, int[] ov, int[] v, float[] move, float[] frontv, float[] backv ) { FloatBuffer lerp = vertexArrayBuf; lerp.limit((nverts << 2) - nverts); // nverts * 3 int ovv, vv; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0 ) { float[] normal; int j = 0; for (int i=0 ; i < nverts; i++/* , v++, ov++, lerp+=4 */) { vv = v[i]; normal = r_avertexnormals[(vv >>> 24 ) & 0xFF]; ovv = ov[i]; lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); j += 3; } } else { int j = 0; for (int i=0 ; i < nverts; i++ /* , v++, ov++, lerp+=4 */) { ovv = ov[i]; vv = v[i]; lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); j += 3; } } } FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4); FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3); FloatBuffer textureArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 2); boolean isFilled = false; float[] tmpVec = {0, 0, 0}; float[][] vectors = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} // 3 mal vec3_t }; // stack variable private final float[] move = {0, 0, 0}; // vec3_t private final float[] frontv = {0, 0, 0}; // vec3_t private final float[] backv = {0, 0, 0}; // vec3_t /** * GL_DrawAliasFrameLerp * * interpolates between two frames and origins * FIXME: batch lerp all vertexes */ void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; int[] verts = frame.verts; qfiles.daliasframe_t oldframe = paliashdr.aliasFrames[currententity.oldframe]; int[] ov = oldframe.verts; float alpha; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) alpha = currententity.alpha; else alpha = 1.0f; // PMM - added double shell if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) gl.glDisable( GL_TEXTURE_2D ); float frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp Math3D.VectorSubtract (currententity.oldorigin, currententity.origin, frontv); Math3D.AngleVectors (currententity.angles, vectors[0], vectors[1], vectors[2]); move[0] = Math3D.DotProduct (frontv, vectors[0]); // forward move[1] = -Math3D.DotProduct (frontv, vectors[1]); // left move[2] = Math3D.DotProduct (frontv, vectors[2]); // up Math3D.VectorAdd (move, oldframe.translate, move); for (int i=0 ; i<3 ; i++) { move[i] = backlerp*move[i] + frontlerp*frame.translate[i]; frontv[i] = frontlerp*frame.scale[i]; backv[i] = backlerp*oldframe.scale[i]; } // ab hier wird optimiert GL_LerpVerts( paliashdr.num_xyz, ov, verts, move, frontv, backv ); //gl.gl.glEnableClientState( GL_VERTEX_ARRAY ); gl.glVertexPointer( 3, 0, vertexArrayBuf ); // PMM - added double damage shell if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { gl.glColor4f( shadelight[0], shadelight[1], shadelight[2], alpha ); } else { gl.glEnableClientState( GL_COLOR_ARRAY ); gl.glColorPointer( 4, 0, colorArrayBuf ); // // pre light everything // FloatBuffer color = colorArrayBuf; float l; int size = paliashdr.num_xyz; int j = 0; for (int i = 0; i < size; i++ ) { l = shadedots[(verts[i] >>> 24) & 0xFF]; color.put(j, l * shadelight[0]); color.put(j + 1, l * shadelight[1]); color.put(j + 2, l * shadelight[2]); color.put(j + 3, alpha); j += 4; } } gl.glClientActiveTextureARB(TEXTURE0); gl.glTexCoordPointer( 2, 0, textureArrayBuf); //gl.gl.glEnableClientState( GL_TEXTURE_COORD_ARRAY); int pos = 0; int[] counts = paliashdr.counts; IntBuffer srcIndexBuf = null; FloatBuffer dstTextureCoords = textureArrayBuf; FloatBuffer srcTextureCoords = paliashdr.textureCoordBuf; int dstIndex = 0; int srcIndex = 0; int count; int mode; int size = counts.length; for (int j = 0; j < size; j++) { // get the vertex count and primitive type count = counts[j]; if (count == 0) break; // done srcIndexBuf = paliashdr.indexElements[j]; mode = GL_TRIANGLE_STRIP; if (count < 0) { mode = GL_TRIANGLE_FAN; count = -count; } srcIndex = pos << 1; srcIndex--; for (int k = 0; k < count; k++) { dstIndex = srcIndexBuf.get(k) << 1; dstTextureCoords.put(dstIndex, srcTextureCoords.get(++srcIndex)); dstTextureCoords.put(++dstIndex, srcTextureCoords.get(++srcIndex)); } gl.glDrawElements(mode, srcIndexBuf); pos += count; } // PMM - added double damage shell if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0 ) gl.glEnable( GL_TEXTURE_2D ); gl.glDisableClientState( GL_COLOR_ARRAY ); } private final float[] point = {0, 0, 0}; /** * GL_DrawAliasShadow */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { float lheight = currententity.origin[2] - lightspot[2]; qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; int[] order = paliashdr.glCmds; float height = -lheight + 1.0f; int orderIndex = 0; int index = 0; // TODO shadow drawing with vertex arrays int count; while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin (GL_TRIANGLE_FAN); } else gl.glBegin (GL_TRIANGLE_STRIP); do { index = order[orderIndex + 2] * 3; point[0] = vertexArrayBuf.get(index); point[1] = vertexArrayBuf.get(index + 1); point[2] = vertexArrayBuf.get(index + 2); point[0] -= shadevector[0]*(point[2]+lheight); point[1] -= shadevector[1]*(point[2]+lheight); point[2] = height; gl.glVertex3f(point[0], point[1], point[2]); orderIndex += 3; } while (--count != 0); gl.glEnd (); } } // TODO sync with jogl renderer. hoz // stack variable private final float[] mins = { 0, 0, 0 }; private final float[] maxs = { 0, 0, 0 }; /** * R_CullAliasModel */ boolean R_CullAliasModel(entity_t e) { qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata; if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\n'); e.frame = 0; } if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } qfiles.daliasframe_t pframe = paliashdr.aliasFrames[e.frame]; qfiles.daliasframe_t poldframe = paliashdr.aliasFrames[e.oldframe]; /* ** compute axially aligned mins and maxs */ if (pframe == poldframe) { for (int i = 0; i < 3; i++) { mins[i] = pframe.translate[i]; maxs[i] = mins[i] + pframe.scale[i] * 255; } } else { float thismaxs, oldmaxs; for (int i = 0; i < 3; i++) { thismaxs = pframe.translate[i] + pframe.scale[i] * 255; oldmaxs = poldframe.translate[i] + poldframe.scale[i] * 255; if (pframe.translate[i] < poldframe.translate[i]) mins[i] = pframe.translate[i]; else mins[i] = poldframe.translate[i]; if (thismaxs > oldmaxs) maxs[i] = thismaxs; else maxs[i] = oldmaxs; } } /* ** compute a full bounding box */ float[] tmp; for (int i = 0; i < 8; i++) { tmp = bbox[i]; if ((i & 1) != 0) tmp[0] = mins[0]; else tmp[0] = maxs[0]; if ((i & 2) != 0) tmp[1] = mins[1]; else tmp[1] = maxs[1]; if ((i & 4) != 0) tmp[2] = mins[2]; else tmp[2] = maxs[2]; } /* ** rotate the bounding box */ tmp = mins; Math3D.VectorCopy(e.angles, tmp); tmp[YAW] = -tmp[YAW]; Math3D.AngleVectors(tmp, vectors[0], vectors[1], vectors[2]); for (int i = 0; i < 8; i++) { Math3D.VectorCopy(bbox[i], tmp); bbox[i][0] = Math3D.DotProduct(vectors[0], tmp); bbox[i][1] = -Math3D.DotProduct(vectors[1], tmp); bbox[i][2] = Math3D.DotProduct(vectors[2], tmp); Math3D.VectorAdd(e.origin, bbox[i], bbox[i]); } int f, mask; int aggregatemask = ~0; // 0xFFFFFFFF for (int p = 0; p < 8; p++) { mask = 0; for (f = 0; f < 4; f++) { float dp = Math3D.DotProduct(frustum[f].normal, bbox[p]); if ((dp - frustum[f].dist) < 0) { mask |= (1 << f); } } aggregatemask &= mask; } if (aggregatemask != 0) { return true; } return false; } // bounding box float[][] bbox = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }; // TODO sync with jogl renderer. hoz /** * R_DrawAliasModel */ void R_DrawAliasModel(entity_t e) { if ( ( e.flags & Defines.RF_WEAPONMODEL ) == 0) { if ( R_CullAliasModel(e) ) return; } if ( (e.flags & Defines.RF_WEAPONMODEL) != 0 ) { if ( r_lefthand.value == 2.0f ) return; } qfiles.dmdl_t paliashdr = (qfiles.dmdl_t)currentmodel.extradata; // // get lighting information // // PMM - rewrote, reordered to handle new shells & mixing // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy // int i; if ( (currententity.flags & ( Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE )) != 0 ) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56f; shadelight[1] = 0.59f; shadelight[2] = 0.45f; } if ( (currententity.flags & Defines.RF_SHELL_DOUBLE) != 0 ) { shadelight[0] = 0.9f; shadelight[1] = 0.7f; } if ( (currententity.flags & Defines.RF_SHELL_RED) != 0 ) shadelight[0] = 1.0f; if ( (currententity.flags & Defines.RF_SHELL_GREEN) != 0 ) shadelight[1] = 1.0f; if ( (currententity.flags & Defines.RF_SHELL_BLUE) != 0 ) shadelight[2] = 1.0f; } else if ( (currententity.flags & Defines.RF_FULLBRIGHT) != 0 ) { for (i=0 ; i<3 ; i++) shadelight[i] = 1.0f; } else { R_LightPoint (currententity.origin, shadelight); // player lighting hack for communication back to server // big hack! if ( (currententity.flags & Defines.RF_WEAPONMODEL) != 0 ) { // pick the greatest component, which should be the same // as the mono value returned by software if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) r_lightlevel.value = 150*shadelight[0]; else r_lightlevel.value = 150*shadelight[2]; } else { if (shadelight[1] > shadelight[2]) r_lightlevel.value = 150*shadelight[1]; else r_lightlevel.value = 150*shadelight[2]; } } if ( gl_monolightmap.string.charAt(0) != '0' ) { float s = shadelight[0]; if ( s < shadelight[1] ) s = shadelight[1]; if ( s < shadelight[2] ) s = shadelight[2]; shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ( (currententity.flags & Defines.RF_MINLIGHT) != 0 ) { for (i=0 ; i<3 ; i++) if (shadelight[i] > 0.1f) break; if (i == 3) { shadelight[0] = 0.1f; shadelight[1] = 0.1f; shadelight[2] = 0.1f; } } if ( (currententity.flags & Defines.RF_GLOW) != 0 ) { // bonus items will pulse with time float scale; float min; scale = (float)(0.1f * Math.sin(r_newrefdef.time*7)); for (i=0 ; i<3 ; i++) { min = shadelight[i] * 0.8f; shadelight[i] += scale; if (shadelight[i] < min) shadelight[i] = min; } } // ================= // PGM ir goggles color override if ( (r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1.0f; shadelight[1] = 0.0f; shadelight[2] = 0.0f; } // PGM // ================= shadedots = r_avertexnormal_dots[((int)(currententity.angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; float an = (float)(currententity.angles[1]/180*Math.PI); shadevector[0] = (float)Math.cos(-an); shadevector[1] = (float)Math.sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); // // locate the proper data // c_alias_polys += paliashdr.num_tris; // // draw all the triangles // if ( (currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls gl.glDepthRange(gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin)); if ( (currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f) ) { gl.glMatrixMode( GL_PROJECTION ); gl.glPushMatrix(); gl.glLoadIdentity(); gl.glScalef( -1, 1, 1 ); MYgluPerspective( r_newrefdef.fov_y, ( float ) r_newrefdef.width / r_newrefdef.height, 4, 4096); gl.glMatrixMode( GL_MODELVIEW ); gl.glCullFace( GL_BACK ); } gl.glPushMatrix (); e.angles[PITCH] = -e.angles[PITCH]; // sigh. R_RotateForEntity (e); e.angles[PITCH] = -e.angles[PITCH]; // sigh. image_t skin; // select skin if (currententity.skin != null) skin = currententity.skin; // custom player skin else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) skin = currentmodel.skins[0]; else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) skin = currentmodel.skins[0]; } } if (skin == null) skin = r_notexture; // fallback... GL_Bind(skin.texnum); // draw it gl.glShadeModel (GL_SMOOTH); GL_TexEnv( GL_MODULATE ); if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 ) { gl.glEnable (GL_BLEND); } if ( (currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0) ) { VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ( (currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ( r_lerpmodels.value == 0.0f) currententity.backlerp = 0; GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv( GL_REPLACE ); gl.glShadeModel (GL_FLAT); gl.glPopMatrix (); if ( ( currententity.flags & Defines.RF_WEAPONMODEL ) != 0 && ( r_lefthand.value == 1.0F ) ) { gl.glMatrixMode( GL_PROJECTION ); gl.glPopMatrix(); gl.glMatrixMode( GL_MODELVIEW ); gl.glCullFace( GL_FRONT ); } if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 ) { gl.glDisable (GL_BLEND); } if ( (currententity.flags & Defines.RF_DEPTHHACK) != 0) gl.glDepthRange (gldepthmin, gldepthmax); if ( gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { gl.glPushMatrix (); R_RotateForEntity (e); gl.glDisable (GL_TEXTURE_2D); gl.glEnable (GL_BLEND); gl.glColor4f (0,0,0,0.5f); GL_DrawAliasShadow (paliashdr, currententity.frame ); gl.glEnable (GL_TEXTURE_2D); gl.glDisable (GL_BLEND); gl.glPopMatrix (); } gl.glColor4f (1,1,1,1); } } --- NEW FILE: Model.java --- /* * Model.java * Copyright (C) 2003 * * $Id: Model.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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. [...1319 lines suppressed...] count = ((Integer)tmp.get(i)).intValue(); model.counts[i] = count; count = (count < 0) ? -count : count; model.vertexIndexBuf.position(pos); model.indexElements[i] = model.vertexIndexBuf.slice(); model.indexElements[i].limit(count); pos += count; } } static void resetModelArrays() { globalModelTextureCoordBuf.rewind(); globalModelVertexIndexBuf.rewind(); } static void modelMemoryUsage() { System.out.println("AliasModels: globalVertexBuffer size " + globalModelVertexIndexBuf.position()); } } --- NEW FILE: Main.java --- /* * Main.java * Copyright (C) 2003 * * $Id: Main.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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. [...1487 lines suppressed...] float[] v; for (int i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = start_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd(); gl.glEnable(GL_TEXTURE_2D); gl.glDisable(GL_BLEND); gl.glDepthMask(true); } } --- NEW FILE: Polygon.java --- /* * Polygon.java * Copyright (C) 2003 * * $Id: Polygon.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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.render.fast; import jake2.render.glpoly_t; import jake2.util.Lib; import java.nio.FloatBuffer; /** * Polygon * * @author cwei */ public final class Polygon extends glpoly_t { private final static int MAX_POLYS = 20000; private final static int MAX_BUFFER_VERTICES = 120000; // backup for s1 scrolling private static float[] s1_old = new float[MAX_VERTICES]; private static FloatBuffer buffer = Lib.newFloatBuffer(MAX_BUFFER_VERTICES * STRIDE); private static int bufferIndex = 0; private static int polyCount = 0; private static Polygon[] polyCache = new Polygon[MAX_POLYS]; static { for (int i = 0; i < polyCache.length; i++) { polyCache[i] = new Polygon(); } } static glpoly_t create(int numverts) { Polygon poly = polyCache[polyCount++]; poly.clear(); poly.numverts = numverts; poly.pos = bufferIndex; bufferIndex += numverts; return poly; } static void reset() { polyCount = 0; bufferIndex = 0; } static FloatBuffer getInterleavedBuffer() { return (FloatBuffer) buffer.rewind(); } private Polygon() { } private final void clear() { next = null; chain = null; numverts = 0; flags = 0; } // the interleaved buffer has the format: // textureCoord0 (index 0, 1) // vertex (index 2, 3, 4) // textureCoord1 (index 5, 6) public final float s1(int index) { return buffer.get((index + pos) * STRIDE); } public final void s1(int index, float value) { buffer.put((index + pos) * STRIDE, value); } public final float t1(int index) { return buffer.get((index + pos) * STRIDE + 1); } public final void t1(int index, float value) { buffer.put((index + pos) * STRIDE + 1, value); } public final float x(int index) { return buffer.get((index + pos) * STRIDE + 2); } public final void x(int index, float value) { buffer.put((index + pos) * STRIDE + 2, value); } public final float y(int index) { return buffer.get((index + pos) * STRIDE + 3); } public final void y(int index, float value) { buffer.put((index + pos) * STRIDE + 3, value); } public final float z(int index) { return buffer.get((index + pos) * STRIDE + 4); } public final void z(int index, float value) { buffer.put((index + pos) * STRIDE + 4, value); } public final float s2(int index) { return buffer.get((index + pos) * STRIDE + 5); } public final void s2(int index, float value) { buffer.put((index + pos) * STRIDE + 5, value); } public final float t2(int index) { return buffer.get((index + pos) * STRIDE + 6); } public final void t2(int index, float value) { buffer.put((index + pos) * STRIDE + 6, value); } public final void beginScrolling(float scroll) { int index = pos * STRIDE; for (int i = 0; i < numverts; i++, index += STRIDE) { scroll += s1_old[i] = buffer.get(index); buffer.put(index, scroll); } } public final void endScrolling() { int index = pos * STRIDE; for (int i = 0; i < numverts; i++, index += STRIDE) { buffer.put(index, s1_old[i]); } } } --- NEW FILE: Warp.java --- /* * Warp.java * Copyright (C) 2003 * * $Id: Warp.java,v 1.1.2.1 2005/11/15 00:06:43 cawe 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.render.fast; import jake2.Defines; import jake2.Globals; import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Math3D; import jake2.util.Vec3Cache; /** * Warp * * @author cwei */ public abstract class Warp extends Model { // warpsin.h public static final float[] SIN = { 0f, 0.19633f, 0.392541f, 0.588517f, 0.784137f, 0.979285f, 1.17384f, 1.3677f, 1.56072f, 1.75281f, 1.94384f, 2.1337f, 2.32228f, 2.50945f, 2.69512f, 2.87916f, 3.06147f, 3.24193f, 3.42044f, 3.59689f, 3.77117f, 3.94319f, 4.11282f, 4.27998f, 4.44456f, 4.60647f, 4.76559f, 4.92185f, 5.07515f, 5.22538f, 5.37247f, 5.51632f, 5.65685f, 5.79398f, 5.92761f, 6.05767f, 6.18408f, 6.30677f, 6.42566f, 6.54068f, 6.65176f, 6.75883f, 6.86183f, 6.9607f, 7.05537f, 7.14579f, 7.23191f, 7.31368f, 7.39104f, 7.46394f, 7.53235f, 7.59623f, 7.65552f, 7.71021f, 7.76025f, 7.80562f, 7.84628f, 7.88222f, 7.91341f, 7.93984f, 7.96148f, 7.97832f, 7.99036f, 7.99759f, 8f, 7.99759f, 7.99036f, 7.97832f, 7.96148f, 7.93984f, 7.91341f, 7.88222f, 7.84628f, 7.80562f, 7.76025f, 7.71021f, 7.65552f, 7.59623f, 7.53235f, 7.46394f, 7.39104f, 7.31368f, 7.23191f, 7.14579f, 7.05537f, 6.9607f, 6.86183f, 6.75883f, 6.65176f, 6.54068f, 6.42566f, 6.30677f, 6.18408f, 6.05767f, 5.92761f, 5.79398f, 5.65685f, 5.51632f, 5.37247f, 5.22538f, 5.07515f, 4.92185f, 4.76559f, 4.60647f, 4.44456f, 4.27998f, 4.11282f, 3.94319f, 3.77117f, 3.59689f, 3.42044f, 3.24193f, 3.06147f, 2.87916f, 2.69512f, 2.50945f, 2.32228f, 2.1337f, 1.94384f, 1.75281f, 1.56072f, 1.3677f, 1.17384f, 0.979285f, 0.784137f, 0.588517f, 0.392541f, 0.19633f, 9.79717e-16f, -0.19633f, -0.392541f, -0.588517f, -0.784137f, -0.979285f, -1.17384f, -1.3677f, -1.56072f, -1.75281f, -1.94384f, -2.1337f, -2.32228f, -2.50945f, -2.69512f, -2.87916f, -3.06147f, -3.24193f, -3.42044f, -3.59689f, -3.77117f, -3.94319f, -4.11282f, -4.27998f, -4.44456f, -4.60647f, -4.76559f, -4.92185f, -5.07515f, -5.22538f, -5.37247f, -5.51632f, -5.65685f, -5.79398f, -5.92761f, -6.05767f, -6.18408f, -6.30677f, -6.42566f, -6.54068f, -6.65176f, -6.75883f, -6.86183f, -6.9607f, -7.05537f, -7.14579f, -7.23191f, -7.31368f, -7.39104f, -7.46394f, -7.53235f, -7.59623f, -7.65552f, -7.71021f, -7.76025f, -7.80562f, -7.84628f, -7.88222f, -7.91341f, -7.93984f, -7.96148f, -7.97832f, -7.99036f, -7.99759f, -8f, -7.99759f, -7.99036f, -7.97832f, -7.96148f, -7.93984f, -7.91341f, -7.88222f, -7.84628f, -7.80562f, -7.76025f, -7.71021f, -7.65552f, -7.59623f, -7.53235f, -7.46394f, -7.39104f, -7.31368f, -7.23191f, -7.14579f, -7.05537f, -6.9607f, -6.86183f, -6.75883f, -6.65176f, -6.54068f, -6.42566f, -6.30677f, -6.18408f, -6.05767f, -5.92761f, -5.79398f, -5.65685f, -5.51632f, -5.37247f, -5.22538f, -5.07515f, -4.92185f, -4.76559f, -4.60647f, -4.44456f, -4.27998f, -4.11282f, -3.94319f, -3.77117f, -3.59689f, -3.42044f, -3.24193f, -3.06147f, -2.87916f, -2.69512f, -2.50945f, -2.32228f, -2.1337f, -1.94384f, -1.75281f, -1.56072f, -1.3677f, -1.17384f, -0.979285f, -0.784137f, -0.588517f, -0.392541f, -0.19633f }; String skyname; float skyrotate; float[] skyaxis = {0, 0, 0}; image_t[] sky_images = new image_t[6]; msurface_t warpface; static final int SUBDIVIDE_SIZE = 64; /** * BoundPoly * @param numverts * @param verts * @param mins * @param maxs */ void BoundPoly(int numverts, float[][] verts, float[] mins, float[] maxs) { mins[0] = mins[1] = mins[2] = 9999; maxs[0] = maxs[1] = maxs[2] = -9999; int j; float[] v; for (int i=0 ; i<numverts ; i++) { v = verts[i]; for (j=0 ; j<3 ; j++) { if (v[j] < mins[j]) mins[j] = v[j]; if (v[j] > maxs[j]) maxs[j] = v[j]; } } } /** * SubdividePolygon * @param numverts * @param verts */ void SubdividePolygon(int numverts, float[][] verts) { int i, j, k; float m; float[][] front = new float[64][3]; float[][] back = new float[64][3]; int f, b; float[] dist = new float[64]; float frac; if (numverts > 60) Com.Error(Defines.ERR_DROP, "numverts = " + numverts); float[] mins = Vec3Cache.get(); float[] maxs = Vec3Cache.get(); BoundPoly(numverts, verts, mins, maxs); float[] v; // x,y und z for (i=0 ; i<3 ; i++) { m = (mins[i] + maxs[i]) * 0.5f; m = SUBDIVIDE_SIZE * (float)Math.floor(m / SUBDIVIDE_SIZE + 0.5f); if (maxs[i] - m < 8) continue; if (m - mins[i] < 8) continue; // cut it for (j=0 ; j<numverts ; j++) { dist[j] = verts[j][i] - m; } // wrap cases dist[j] = dist[0]; Math3D.VectorCopy(verts[0], verts[numverts]); f = b = 0; for (j=0 ; j<numverts ; j++) { v = verts[j]; if (dist[j] >= 0) { Math3D.VectorCopy(v, front[f]); f++; } if (dist[j] <= 0) { Math3D.VectorCopy(v, back[b]); b++; } if (dist[j] == 0 || dist[j+1] == 0) continue; if ( (dist[j] > 0) != (dist[j+1] > 0) ) { // clip point frac = dist[j] / (dist[j] - dist[j+1]); for (k=0 ; k<3 ; k++) front[f][k] = back[b][k] = v[k] + frac*(verts[j+1][k] - v[k]); f++; b++; } } SubdividePolygon(f, front); SubdividePolygon(b, back); Vec3Cache.release(2); // mins, maxs return; } Vec3Cache.release(2); // mins, maxs // add a point in the center to help keep warp valid // wird im Konstruktor erschlagen // poly = Hunk_Alloc (sizeof(glpoly_t) + ((numverts-4)+2) * VERTEXSIZE*sizeof(float)); // init polys glpoly_t poly = Polygon.create(numverts + 2); poly.next = warpface.polys; warpface.polys = poly; float[] total = Vec3Cache.get(); Math3D.VectorClear(total); float total_s = 0; float total_t = 0; float s, t; for (i = 0; i < numverts; i++) { poly.x(i + 1, verts[i][0]); poly.y(i + 1, verts[i][1]); poly.z(i + 1, verts[i][2]); s = Math3D.DotProduct(verts[i], warpface.texinfo.vecs[0]); t = Math3D.DotProduct(verts[i], warpface.texinfo.vecs[1]); total_s += s; total_t += t; Math3D.VectorAdd(total, verts[i], total); poly.s1(i + 1, s); poly.t1(i + 1, t); } float scale = 1.0f / numverts; poly.x(0, total[0] * scale); poly.y(0, total[1] * scale); poly.z(0, total[2] * scale); poly.s1(0, total_s * scale); poly.t1(0, total_t * scale); poly.x(i + 1, poly.x(1)); poly.y(i + 1, poly.y(1)); poly.z(i + 1, poly.z(1)); poly.s1(i + 1, poly.s1(1)); poly.t1(i + 1, poly.t1(1)); poly.s2(i + 1, poly.s2(1)); poly.t2(i + 1, poly.t2(1)); Vec3Cache.release(); // total } private final float[][] tmpVerts = new float[64][3]; /** * GL_SubdivideSurface * Breaks a polygon up along axial 64 unit * boundaries so that turbulent and sky warps * can be done reasonably. */ void GL_SubdivideSurface(msurface_t fa) { float[][] verts = tmpVerts; float[] vec; warpface = fa; // // convert edges back to a normal polygon // int numverts = 0; for (int i = 0; i < fa.numedges; i++) { int lindex = loadmodel.surfedges[fa.firstedge + i]; if (lindex > 0) vec = loadmodel.vertexes[loadmodel.edges[lindex].v[0]].position; else vec = loadmodel.vertexes[loadmodel.edges[-lindex].v[1]].position; Math3D.VectorCopy(vec, verts[numverts]); numverts++; } SubdividePolygon(numverts, verts); } // ========================================================= static final float TURBSCALE = (float)(256.0f / (2 * Math.PI)); /** * EmitWaterPolys * Does a water warp on the pre-fragmented glpoly_t chain */ void EmitWaterPolys(msurface_t fa) { float rdt = r_newrefdef.time; float scroll; if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) scroll = -64 * ( (r_newrefdef.time*0.5f) - (int)(r_newrefdef.time*0.5f) ); else scroll = 0; int i; float s, t, os, ot; glpoly_t p, bp; for (bp = fa.polys; bp != null; bp = bp.next) { p = bp; gl.glBegin(GL_TRIANGLE_FAN); for (i = 0; i < p.numverts; i++) { os = p.s1(i); ot = p.t1(i); s = os + Warp.SIN[(int) ((ot * 0.125f + r_newrefdef.time) * TURBSCALE) & 255]; s += scroll; s *= (1.0f / 64); t = ot + Warp.SIN[(int) ((os * 0.125f + rdt) * TURBSCALE) & 255]; t *= (1.0f / 64); gl.glTexCoord2f(s, t); gl.glVertex3f(p.x(i), p.y(i), p.z(i)); } gl.glEnd(); } } // =================================================================== float[][] skyclip = { { 1, 1, 0}, { 1, -1, 0}, { 0, -1, 1}, { 0, 1, 1}, { 1, 0, 1}, {-1, 0, 1} }; int c_sky; // 1 = s, 2 = t, 3 = 2048 int[][] st_to_vec = { {3,-1,2}, {-3,1,2}, {1,3,2}, {-1,-3,2}, {-2,-1,3}, // 0 degrees yaw, look straight up {2,-1,-3} // look straight down }; int[][] vec_to_st = { {-2,3,1}, {2,3,-1}, {1,3,2}, {-1,3,-2}, {-2,-1,3}, {-2,1,-3} }; float[][] skymins = new float[2][6]; float[][] skymaxs = new float[2][6]; float sky_min, sky_max; // stack variable private final float[] v = {0, 0, 0}; private final float[] av = {0, 0, 0}; /** * DrawSkyPolygon * @param nump * @param vecs */ void DrawSkyPolygon(int nump, float[][] vecs) { c_sky++; // decide which face it maps to Math3D.VectorCopy(Globals.vec3_origin, v); int i, axis; for (i=0; i<nump ; i++) { Math3D.VectorAdd(vecs[i], v, v); } av[0] = Math.abs(v[0]); av[1] = Math.abs(v[1]); av[2] = Math.abs(v[2]); if (av[0] > av[1] && av[0] > av[2]) { if (v[0] < 0) axis = 1; else axis = 0; } else if (av[1] > av[2] && av[1] > av[0]) { if (v[1] < 0) axis = 3; else axis = 2; } else { if (v[2] < 0) axis = 5; else axis = 4; } // project new texture coords float s, t, dv; int j; for (i=0 ; i<nump ; i++) { j = vec_to_st[axis][2]; if (j > 0) dv = vecs[i][j - 1]; else d... [truncated message content] |
From: Carsten W. <ca...@us...> - 2005-11-15 00:05:22
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fast In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3878/src/jake2/render/fast Log Message: Directory /cvsroot/jake2/jake2/src/jake2/render/fast added to the repository --> Using per-directory sticky tag `render-refactoring' |
From: Carsten W. <ca...@us...> - 2005-11-15 00:04:11
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3529/src/jake2/render/fastjogl Removed Files: Tag: render-refactoring Image.java Misc.java Mesh.java Warp.java Model.java Base.java Surf.java Polygon.java Draw.java Main.java Light.java Anorms.java Log Message: package removed --- Base.java DELETED --- --- Image.java DELETED --- --- Surf.java DELETED --- --- Light.java DELETED --- --- Mesh.java DELETED --- --- Model.java DELETED --- --- Main.java DELETED --- --- Polygon.java DELETED --- --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- --- Misc.java DELETED --- |
From: Carsten W. <ca...@us...> - 2005-11-15 00:02:55
|
Update of /cvsroot/jake2/jake2/src/jake2/render/jogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3220/src/jake2/render/jogl Removed Files: Tag: render-refactoring Polygon.java Image.java Base.java Draw.java Misc.java Main.java Warp.java Model.java Anorms.java Surf.java Mesh.java Light.java Log Message: package removed and replaced with render.basic --- Base.java DELETED --- --- Image.java DELETED --- --- Surf.java DELETED --- --- Light.java DELETED --- --- Mesh.java DELETED --- --- Model.java DELETED --- --- Main.java DELETED --- --- Polygon.java DELETED --- --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- --- Misc.java DELETED --- |
From: Carsten W. <ca...@us...> - 2005-11-15 00:02:15
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3054/src/jake2/render/lwjgl Removed Files: Tag: render-refactoring Main.java Draw.java Light.java Model.java Surf.java Mesh.java Polygon.java Image.java Anorms.java Warp.java Misc.java LWJGLBase.java Base.java Log Message: package removed --- Base.java DELETED --- --- Image.java DELETED --- --- Surf.java DELETED --- --- Light.java DELETED --- --- Mesh.java DELETED --- --- Model.java DELETED --- --- Main.java DELETED --- --- Polygon.java DELETED --- --- LWJGLBase.java DELETED --- --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- --- Misc.java DELETED --- |
From: Carsten W. <ca...@us...> - 2005-11-15 00:00:52
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2674/src/jake2/render Removed Files: Tag: render-refactoring QGLConst.java LWJGLRenderer.java JoglBase.java FastJoglRenderer.java QGL.java JoglGL.java CountGL.java LwjglGL.java DummyGL.java Log Message: moved to render.opengl --- QGL.java DELETED --- --- FastJoglRenderer.java DELETED --- --- LwjglGL.java DELETED --- --- LWJGLRenderer.java DELETED --- --- JoglGL.java DELETED --- --- DummyGL.java DELETED --- --- QGLConst.java DELETED --- --- CountGL.java DELETED --- --- JoglBase.java DELETED --- |
From: Carsten W. <ca...@us...> - 2005-11-14 23:59:09
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2243/src/jake2/render Modified Files: Tag: render-refactoring Renderer.java JoglRenderer.java Added Files: Tag: render-refactoring Jsr231Renderer.java LwjglRenderer.java Log Message: new render drivers (alpha see TODO) Index: JoglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/JoglRenderer.java,v retrieving revision 1.6.8.2 retrieving revision 1.6.8.3 diff -C2 -d -r1.6.8.2 -r1.6.8.3 *** JoglRenderer.java 24 Oct 2005 22:46:04 -0000 1.6.8.2 --- JoglRenderer.java 14 Nov 2005 23:59:00 -0000 1.6.8.3 *************** *** 30,33 **** --- 30,34 ---- import jake2.client.refexport_t; import jake2.qcommon.xcommand_t; + import jake2.render.opengl.JoglDriver; import jake2.sys.JOGLKBD; import jake2.sys.KBD; *************** *** 40,48 **** * @author cwei */ ! final class JoglRenderer extends JoglBase implements refexport_t, Ref { - private JOGLKBD kbd=new JOGLKBD(); - public static final String DRIVER_NAME = "jogl"; static { --- 41,52 ---- * @author cwei */ ! final class JoglRenderer extends JoglDriver implements refexport_t, Ref { public static final String DRIVER_NAME = "jogl"; + + private KBD kbd = new JOGLKBD(); + + // TODO extract a interface from render code + private jake2.render.basic.Misc impl = new jake2.render.basic.Misc(); static { *************** *** 51,54 **** --- 55,59 ---- private JoglRenderer() { + // singleton } *************** *** 59,70 **** // ============================================================================ ! /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { // pre init ! if (!R_Init()) return false; ! // calls the R_Init2() internally ! updateScreen(); // the result from R_Init2() return post_init; --- 64,83 ---- // ============================================================================ ! ! private boolean post_init = false; ! /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { + // init the OpenGL drivers + impl.setGlImpl(this); // pre init ! if (!impl.R_Init(vid_xpos, vid_ypos)) return false; ! // calls the R_Init2() internally ! updateScreen(new xcommand_t() { ! public void execute() { ! JoglRenderer.this.post_init = impl.R_Init2(); ! } ! }); // the result from R_Init2() return post_init; *************** *** 75,79 **** */ public void Shutdown() { ! R_Shutdown(); } --- 88,92 ---- */ public void Shutdown() { ! impl.R_Shutdown(); } *************** *** 83,87 **** public void BeginRegistration(String map) { if (contextInUse) { ! R_BeginRegistration(map); return; } --- 96,100 ---- public void BeginRegistration(String map) { if (contextInUse) { ! impl.R_BeginRegistration(map); return; } *************** *** 91,95 **** updateScreen(new xcommand_t() { public void execute() { ! R_BeginRegistration(JoglRenderer.this.name); } }); --- 104,108 ---- updateScreen(new xcommand_t() { public void execute() { ! impl.R_BeginRegistration(JoglRenderer.this.name); } }); *************** *** 106,110 **** if (contextInUse) ! return R_RegisterModel(name); model = null; --- 119,123 ---- if (contextInUse) ! return impl.R_RegisterModel(name); model = null; *************** *** 113,117 **** updateScreen(new xcommand_t() { public void execute() { ! JoglRenderer.this.model = R_RegisterModel(JoglRenderer.this.name); } }); --- 126,130 ---- updateScreen(new xcommand_t() { public void execute() { ! JoglRenderer.this.model = impl.R_RegisterModel(JoglRenderer.this.name); } }); *************** *** 124,128 **** public image_t RegisterSkin(String name) { if (contextInUse) ! return R_RegisterSkin(name); this.image = null; --- 137,141 ---- public image_t RegisterSkin(String name) { if (contextInUse) ! return impl.R_RegisterSkin(name); this.image = null; *************** *** 131,135 **** updateScreen(new xcommand_t() { public void execute() { ! JoglRenderer.this.image = R_RegisterSkin(JoglRenderer.this.name); } }); --- 144,148 ---- updateScreen(new xcommand_t() { public void execute() { ! JoglRenderer.this.image = impl.R_RegisterSkin(JoglRenderer.this.name); } }); *************** *** 144,148 **** public image_t RegisterPic(String name) { if (contextInUse) ! return Draw_FindPic(name); this.image = null; --- 157,161 ---- public image_t RegisterPic(String name) { if (contextInUse) ! return impl.Draw_FindPic(name); this.image = null; *************** *** 151,155 **** updateScreen(new xcommand_t() { public void execute() { ! JoglRenderer.this.image = Draw_FindPic(JoglRenderer.this.name); } }); --- 164,168 ---- updateScreen(new xcommand_t() { public void execute() { ! JoglRenderer.this.image = impl.Draw_FindPic(JoglRenderer.this.name); } }); *************** *** 165,169 **** public void SetSky(String name, float rotate, float[] axis) { if (contextInUse) { ! R_SetSky(name, rotate, axis); return; } --- 178,182 ---- public void SetSky(String name, float rotate, float[] axis) { if (contextInUse) { ! impl.R_SetSky(name, rotate, axis); return; } *************** *** 175,179 **** updateScreen(new xcommand_t() { public void execute() { ! R_SetSky(JoglRenderer.this.name, JoglRenderer.this.rotate, JoglRenderer.this.axis); } }); --- 188,192 ---- updateScreen(new xcommand_t() { public void execute() { ! impl.R_SetSky(JoglRenderer.this.name, JoglRenderer.this.rotate, JoglRenderer.this.axis); } }); *************** *** 185,189 **** public void EndRegistration() { if (contextInUse) { ! R_EndRegistration(); return; } --- 198,202 ---- public void EndRegistration() { if (contextInUse) { ! impl.R_EndRegistration(); return; } *************** *** 191,195 **** updateScreen(new xcommand_t() { public void execute() { ! R_EndRegistration(); } }); --- 204,208 ---- updateScreen(new xcommand_t() { public void execute() { ! impl.R_EndRegistration(); } }); *************** *** 200,204 **** */ public void RenderFrame(refdef_t fd) { ! R_RenderFrame(fd); } --- 213,217 ---- */ public void RenderFrame(refdef_t fd) { ! impl.R_RenderFrame(fd); } *************** *** 207,211 **** */ public void DrawGetPicSize(Dimension dim, String name) { ! Draw_GetPicSize(dim, name); } --- 220,224 ---- */ public void DrawGetPicSize(Dimension dim, String name) { ! impl.Draw_GetPicSize(dim, name); } *************** *** 214,218 **** */ public void DrawPic(int x, int y, String name) { ! Draw_Pic(x, y, name); } --- 227,231 ---- */ public void DrawPic(int x, int y, String name) { ! impl.Draw_Pic(x, y, name); } *************** *** 221,226 **** */ public void DrawStretchPic(int x, int y, int w, int h, String name) { ! Draw_StretchPic(x, y, w, h, name); } /** --- 234,241 ---- */ public void DrawStretchPic(int x, int y, int w, int h, String name) { ! impl.Draw_StretchPic(x, y, w, h, name); } + + private int x, y, num; /** *************** *** 228,232 **** */ public void DrawChar(int x, int y, int num) { ! Draw_Char(x, y, num); } --- 243,260 ---- */ public void DrawChar(int x, int y, int num) { ! if (contextInUse) { ! impl.Draw_Char(x, y, num);; ! return; ! } ! ! this.x = x; ! this.y = y; ! this.num = num; ! ! updateScreen(new xcommand_t() { ! public void execute() { ! impl.Draw_Char(JoglRenderer.this.x, JoglRenderer.this.y, JoglRenderer.this.num); ! } ! }); } *************** *** 235,239 **** */ public void DrawTileClear(int x, int y, int w, int h, String name) { ! Draw_TileClear(x, y, w, h, name); } --- 263,267 ---- */ public void DrawTileClear(int x, int y, int w, int h, String name) { ! impl.Draw_TileClear(x, y, w, h, name); } *************** *** 242,246 **** */ public void DrawFill(int x, int y, int w, int h, int c) { ! Draw_Fill(x, y, w, h, c); } --- 270,274 ---- */ public void DrawFill(int x, int y, int w, int h, int c) { ! impl.Draw_Fill(x, y, w, h, c); } *************** *** 249,253 **** */ public void DrawFadeScreen() { ! Draw_FadeScreen(); } --- 277,281 ---- */ public void DrawFadeScreen() { ! impl.Draw_FadeScreen(); } *************** *** 256,260 **** */ public void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { ! Draw_StretchRaw(x, y, w, h, cols, rows, data); } --- 284,288 ---- */ public void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { ! impl.Draw_StretchRaw(x, y, w, h, cols, rows, data); } *************** *** 263,267 **** */ public void CinematicSetPalette(byte[] palette) { ! R_SetPalette(palette); } --- 291,295 ---- */ public void CinematicSetPalette(byte[] palette) { ! impl.R_SetPalette(palette); } *************** *** 270,274 **** */ public void BeginFrame(float camera_separation) { ! R_BeginFrame(camera_separation); } --- 298,302 ---- */ public void BeginFrame(float camera_separation) { ! impl.R_BeginFrame(camera_separation); } *************** *** 277,281 **** */ public void EndFrame() { ! GLimp_EndFrame(); } --- 305,309 ---- */ public void EndFrame() { ! endFrame(); } *************** *** 284,288 **** */ public void AppActivate(boolean activate) { ! GLimp_AppActivate(activate); } --- 312,316 ---- */ public void AppActivate(boolean activate) { ! appActivate(activate); } *************** *** 290,293 **** --- 318,325 ---- return Defines.API_VERSION; } + + public KBD getKeyboardHandler() { + return kbd; + } // ============================================================================ *************** *** 306,313 **** return this; } - - public KBD getKeyboardHandler() - { - return kbd; - } } \ No newline at end of file --- 338,340 ---- Index: Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Renderer.java,v retrieving revision 1.6 retrieving revision 1.6.6.1 diff -C2 -d -r1.6 -r1.6.6.1 *** Renderer.java 12 Jan 2005 00:37:13 -0000 1.6 --- Renderer.java 14 Nov 2005 23:59:00 -0000 1.6.6.1 *************** *** 41,62 **** static { try { ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.JoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the jogl drivers if runtime not in classpath ! } ! try { Class.forName("org.lwjgl.opengl.GL11"); ! Class.forName("jake2.render.LWJGLRenderer"); } catch (ClassNotFoundException e) { // ignore the lwjgl driver if runtime not in classpath } ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.FastJoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the fastjogl drivers if runtime not in classpath ! } } catch (Throwable e) { e.printStackTrace(); --- 41,62 ---- static { try { ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.JoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the fastjogl drivers if runtime not in classpath ! } ! try { Class.forName("org.lwjgl.opengl.GL11"); ! Class.forName("jake2.render.LwjglRenderer"); } catch (ClassNotFoundException e) { // ignore the lwjgl driver if runtime not in classpath } ! try { ! Class.forName("javax.media.opengl.GL"); ! Class.forName("jake2.render.Jsr231Renderer"); ! } catch (ClassNotFoundException e) { ! // ignore the jogl drivers if runtime not in classpath ! } } catch (Throwable e) { e.printStackTrace(); --- NEW FILE: LwjglRenderer.java --- /* * LwjglRenderer.java * Copyright (C) 2004 * * $Id: LwjglRenderer.java,v 1.1.2.1 2005/11/14 23:59:00 cawe 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.render; import jake2.Defines; import jake2.client.*; import jake2.qcommon.xcommand_t; import jake2.render.opengl.LwjglDriver; import jake2.sys.*; import java.awt.Dimension; import java.awt.DisplayMode; /** * LwjglRenderer * * @author dsanders/cwei */ final class LwjglRenderer extends LwjglDriver implements refexport_t, Ref { public static final String DRIVER_NAME = "lwjgl"; private KBD kbd = new LWJGLKBD(); // TODO extract a interface from render code private jake2.render.basic.Misc impl = new jake2.render.basic.Misc(); static { Renderer.register(new LwjglRenderer()); }; private LwjglRenderer() { } // ============================================================================ // public interface for Renderer implementations // // refexport_t (ref.h) // ============================================================================ /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers impl.setGlImpl(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; // post init return impl.R_Init2(); } /** * @see jake2.client.refexport_t#Shutdown() */ public void Shutdown() { impl.R_Shutdown(); } /** * @see jake2.client.refexport_t#BeginRegistration(java.lang.String) */ public final void BeginRegistration(String map) { impl.R_BeginRegistration(map); } /** * @see jake2.client.refexport_t#RegisterModel(java.lang.String) */ public final model_t RegisterModel(String name) { return impl.R_RegisterModel(name); } /** * @see jake2.client.refexport_t#RegisterSkin(java.lang.String) */ public final image_t RegisterSkin(String name) { return impl.R_RegisterSkin(name); } /** * @see jake2.client.refexport_t#RegisterPic(java.lang.String) */ public final image_t RegisterPic(String name) { return impl.Draw_FindPic(name); } /** * @see jake2.client.refexport_t#SetSky(java.lang.String, float, float[]) */ public final void SetSky(String name, float rotate, float[] axis) { impl.R_SetSky(name, rotate, axis); } /** * @see jake2.client.refexport_t#EndRegistration() */ public final void EndRegistration() { impl.R_EndRegistration(); } /** * @see jake2.client.refexport_t#RenderFrame(jake2.client.refdef_t) */ public final void RenderFrame(refdef_t fd) { impl.R_RenderFrame(fd); } /** * @see jake2.client.refexport_t#DrawGetPicSize(java.awt.Dimension, java.lang.String) */ public final void DrawGetPicSize(Dimension dim, String name) { impl.Draw_GetPicSize(dim, name); } /** * @see jake2.client.refexport_t#DrawPic(int, int, java.lang.String) */ public final void DrawPic(int x, int y, String name) { impl.Draw_Pic(x, y, name); } /** * @see jake2.client.refexport_t#DrawStretchPic(int, int, int, int, java.lang.String) */ public final void DrawStretchPic(int x, int y, int w, int h, String name) { impl.Draw_StretchPic(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawChar(int, int, int) */ public final void DrawChar(int x, int y, int num) { impl.Draw_Char(x, y, num); } /** * @see jake2.client.refexport_t#DrawTileClear(int, int, int, int, java.lang.String) */ public final void DrawTileClear(int x, int y, int w, int h, String name) { impl.Draw_TileClear(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawFill(int, int, int, int, int) */ public final void DrawFill(int x, int y, int w, int h, int c) { impl.Draw_Fill(x, y, w, h, c); } /** * @see jake2.client.refexport_t#DrawFadeScreen() */ public final void DrawFadeScreen() { impl.Draw_FadeScreen(); } /** * @see jake2.client.refexport_t#DrawStretchRaw(int, int, int, int, int, int, byte[]) */ public final void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { impl.Draw_StretchRaw(x, y, w, h, cols, rows, data); } /** * @see jake2.client.refexport_t#CinematicSetPalette(byte[]) */ public final void CinematicSetPalette(byte[] palette) { impl.R_SetPalette(palette); } /** * @see jake2.client.refexport_t#BeginFrame(float) */ public final void BeginFrame(float camera_separation) { impl.R_BeginFrame(camera_separation); } /** * @see jake2.client.refexport_t#EndFrame() */ public final void EndFrame() { endFrame(); /* try { Thread.sleep(1); } catch (InterruptedException e) { }*/ } /** * @see jake2.client.refexport_t#AppActivate(boolean) */ public final void AppActivate(boolean activate) { appActivate(activate); } public final int apiVersion() { return Defines.API_VERSION; } public KBD getKeyboardHandler() { return kbd; } // ============================================================================ // Ref interface // ============================================================================ public final String getName() { return DRIVER_NAME; } public final String toString() { return DRIVER_NAME; } public final refexport_t GetRefAPI() { return this; } } --- NEW FILE: Jsr231Renderer.java --- /* * Jsr231Renderer.java * Copyright (C) 2004 * * $Id: Jsr231Renderer.java,v 1.1.2.1 2005/11/14 23:59:00 cawe 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.render; import jake2.Defines; import jake2.client.refdef_t; import jake2.client.refexport_t; import jake2.render.opengl.Jsr231Driver; import jake2.sys.JOGLKBD; import jake2.sys.KBD; import java.awt.Dimension; /** * Jsr231Renderer * * @author dsanders/cwei */ final class Jsr231Renderer extends Jsr231Driver implements refexport_t, Ref { public static final String DRIVER_NAME = "jsr231"; private KBD kbd = new JOGLKBD(); // TODO extract a interface from render code private jake2.render.basic.Misc impl = new jake2.render.basic.Misc(); static { Renderer.register(new Jsr231Renderer()); }; private Jsr231Renderer() { // singleton } // ============================================================================ // public interface for Renderer implementations // // refexport_t (ref.h) // ============================================================================ /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers impl.setGlImpl(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; // activates the OpenGL context activate(); // post init return impl.R_Init2(); } /** * @see jake2.client.refexport_t#Shutdown() */ public void Shutdown() { impl.R_Shutdown(); } /** * @see jake2.client.refexport_t#BeginRegistration(java.lang.String) */ public final void BeginRegistration(String map) { activate(); impl.R_BeginRegistration(map); } /** * @see jake2.client.refexport_t#RegisterModel(java.lang.String) */ public final model_t RegisterModel(String name) { activate(); return impl.R_RegisterModel(name); } /** * @see jake2.client.refexport_t#RegisterSkin(java.lang.String) */ public final image_t RegisterSkin(String name) { activate(); return impl.R_RegisterSkin(name); } /** * @see jake2.client.refexport_t#RegisterPic(java.lang.String) */ public final image_t RegisterPic(String name) { activate(); return impl.Draw_FindPic(name); } /** * @see jake2.client.refexport_t#SetSky(java.lang.String, float, float[]) */ public final void SetSky(String name, float rotate, float[] axis) { activate(); impl.R_SetSky(name, rotate, axis); } /** * @see jake2.client.refexport_t#EndRegistration() */ public final void EndRegistration() { activate(); impl.R_EndRegistration(); } /** * @see jake2.client.refexport_t#RenderFrame(jake2.client.refdef_t) */ public final void RenderFrame(refdef_t fd) { impl.R_RenderFrame(fd); } /** * @see jake2.client.refexport_t#DrawGetPicSize(java.awt.Dimension, java.lang.String) */ public final void DrawGetPicSize(Dimension dim, String name) { impl.Draw_GetPicSize(dim, name); } /** * @see jake2.client.refexport_t#DrawPic(int, int, java.lang.String) */ public final void DrawPic(int x, int y, String name) { impl.Draw_Pic(x, y, name); } /** * @see jake2.client.refexport_t#DrawStretchPic(int, int, int, int, java.lang.String) */ public final void DrawStretchPic(int x, int y, int w, int h, String name) { impl.Draw_StretchPic(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawChar(int, int, int) */ public final void DrawChar(int x, int y, int num) { activate(); impl.Draw_Char(x, y, num); } /** * @see jake2.client.refexport_t#DrawTileClear(int, int, int, int, java.lang.String) */ public final void DrawTileClear(int x, int y, int w, int h, String name) { impl.Draw_TileClear(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawFill(int, int, int, int, int) */ public final void DrawFill(int x, int y, int w, int h, int c) { impl.Draw_Fill(x, y, w, h, c); } /** * @see jake2.client.refexport_t#DrawFadeScreen() */ public final void DrawFadeScreen() { impl.Draw_FadeScreen(); } /** * @see jake2.client.refexport_t#DrawStretchRaw(int, int, int, int, int, int, byte[]) */ public final void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { impl.Draw_StretchRaw(x, y, w, h, cols, rows, data); } /** * @see jake2.client.refexport_t#CinematicSetPalette(byte[]) */ public final void CinematicSetPalette(byte[] palette) { impl.R_SetPalette(palette); } /** * @see jake2.client.refexport_t#BeginFrame(float) */ public final void BeginFrame(float camera_separation) { impl.R_BeginFrame(camera_separation); } /** * @see jake2.client.refexport_t#EndFrame() */ public final void EndFrame() { endFrame(); } /** * @see jake2.client.refexport_t#AppActivate(boolean) */ public final void AppActivate(boolean activate) { appActivate(activate); } public final int apiVersion() { return Defines.API_VERSION; } public KBD getKeyboardHandler() { return kbd; } // ============================================================================ // Ref interface // ============================================================================ public final String getName() { return DRIVER_NAME; } public final String toString() { return DRIVER_NAME; } public final refexport_t GetRefAPI() { return this; } } |
From: Carsten W. <ca...@us...> - 2005-11-14 23:57:27
|
Update of /cvsroot/jake2/jake2/src/jake2/render/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1863/src/jake2/render/basic Added Files: Tag: render-refactoring Model.java Main.java Light.java Draw.java Anorms.java Surf.java Misc.java Image.java Mesh.java Polygon.java Warp.java Log Message: this is the refactored (old jogl) renderer impl --- NEW FILE: Image.java --- /* * Image.java * Copyright (C) 2003 * * $Id: Image.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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. [...1625 lines suppressed...] /* * =============== GL_ShutdownImages =============== */ void GL_ShutdownImages() { image_t image; for (int i = 0; i < numgltextures; i++) { image = gltextures[i]; if (image.registration_sequence == 0) continue; // free image_t slot // free it texnum.put(0, image.texnum); gl.glDeleteTextures(texnum); image.clear(); } } } --- NEW FILE: Surf.java --- /* * Surf.java * Copyright (C) 2003 * * $Id: Surf.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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. [...1651 lines suppressed...] // IntBuffer pix = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer(); // // int[] pixel = new int[w * h]; // // pix.get(pixel); // // BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR); // image.setRGB(0, 0, w, h, pixel, 0, w); // AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(scale, scale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR); // BufferedImage tmp = op.filter(image, null); // // if (frame == null) { // frame = new ImageFrame(null); // frame.show(); // } // frame.showImage(tmp); // // } } --- NEW FILE: Light.java --- /* * Light.java * Copyright (C) 2003 * * $Id: Light.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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.render.basic; import jake2.Defines; import jake2.Globals; import jake2.client.dlight_t; import jake2.client.lightstyle_t; import jake2.game.cplane_t; import jake2.qcommon.Com; import jake2.qcommon.longjmpException; import jake2.render.mnode_t; import jake2.render.msurface_t; import jake2.render.mtexinfo_t; import jake2.util.Math3D; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Arrays; /** * Light * * @author cwei */ public abstract class Light extends Warp { // r_light.c int r_dlightframecount; static final int DLIGHT_CUTOFF = 64; /* * ============================================================================= * * DYNAMIC LIGHTS BLEND RENDERING * * ============================================================================= */ void R_RenderDlight(dlight_t light) { int i, j; float a; float[] v = { 0, 0, 0 }; float rad; rad = light.intensity * 0.35f; Math3D.VectorSubtract(light.origin, r_origin, v); gl.glBegin(GL_TRIANGLE_FAN); gl.glColor3f(light.color[0] * 0.2f, light.color[1] * 0.2f, light.color[2] * 0.2f); for (i = 0; i < 3; i++) v[i] = light.origin[i] - vpn[i] * rad; gl.glVertex3f(v[0], v[1], v[2]); gl.glColor3f(0, 0, 0); for (i = 16; i >= 0; i--) { a = (float) (i / 16.0f * Math.PI * 2); for (j = 0; j < 3; j++) v[j] = (float) (light.origin[j] + vright[j] * Math.cos(a) * rad + vup[j] * Math.sin(a) * rad); gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd(); } /* * ============= R_RenderDlights ============= */ void R_RenderDlights() { int i; dlight_t l; if (gl_flashblend.value == 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame gl.glDepthMask(false); gl.glDisable(GL_TEXTURE_2D); gl.glShadeModel(GL_SMOOTH); gl.glEnable(GL_BLEND); gl.glBlendFunc(GL_ONE, GL_ONE); for (i = 0; i < r_newrefdef.num_dlights; i++) { l = r_newrefdef.dlights[i]; R_RenderDlight(l); } gl.glColor3f(1, 1, 1); gl.glDisable(GL_BLEND); gl.glEnable(GL_TEXTURE_2D); gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl.glDepthMask(true); } /* * ============================================================================= * * DYNAMIC LIGHTS * * ============================================================================= */ /* * ============= R_MarkLights ============= */ void R_MarkLights(dlight_t light, int bit, mnode_t node) { cplane_t splitplane; float dist; msurface_t surf; int i; int sidebit; if (node.contents != -1) return; splitplane = node.plane; dist = Math3D.DotProduct(light.origin, splitplane.normal) - splitplane.dist; if (dist > light.intensity - DLIGHT_CUTOFF) { R_MarkLights(light, bit, node.children[0]); return; } if (dist < -light.intensity + DLIGHT_CUTOFF) { R_MarkLights(light, bit, node.children[1]); return; } // mark the polygons for (i = 0; i < node.numsurfaces; i++) { surf = r_worldmodel.surfaces[node.firstsurface + i]; /* * cwei bugfix for dlight behind the walls */ dist = Math3D.DotProduct(light.origin, surf.plane.normal) - surf.plane.dist; sidebit = (dist >= 0) ? 0 : Defines.SURF_PLANEBACK; if ((surf.flags & Defines.SURF_PLANEBACK) != sidebit) continue; /* * cwei bugfix end */ if (surf.dlightframe != r_dlightframecount) { surf.dlightbits = 0; surf.dlightframe = r_dlightframecount; } surf.dlightbits |= bit; } R_MarkLights(light, bit, node.children[0]); R_MarkLights(light, bit, node.children[1]); } /* * ============= R_PushDlights ============= */ void R_PushDlights() { int i; dlight_t l; if (gl_flashblend.value != 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame for (i = 0; i < r_newrefdef.num_dlights; i++) { l = r_newrefdef.dlights[i]; R_MarkLights(l, 1 << i, r_worldmodel.nodes[0]); } } /* * ============================================================================= * * LIGHT SAMPLING * * ============================================================================= */ float[] pointcolor = { 0, 0, 0 }; // vec3_t cplane_t lightplane; // used as shadow plane float[] lightspot = { 0, 0, 0 }; // vec3_t int RecursiveLightPoint(mnode_t node, float[] start, float[] end) { if (node.contents != -1) return -1; // didn't hit anything msurface_t surf; int s, t, ds, dt; int i; mtexinfo_t tex; ByteBuffer lightmap; int maps; float[] mid = { 0, 0, 0 }; // calculate mid point // FIXME: optimize for axial cplane_t plane = node.plane; float front = Math3D.DotProduct(start, plane.normal) - plane.dist; float back = Math3D.DotProduct(end, plane.normal) - plane.dist; boolean side = (front < 0); int sideIndex = (side) ? 1 : 0; if ((back < 0) == side) return RecursiveLightPoint(node.children[sideIndex], start, end); float frac = front / (front - back); mid[0] = start[0] + (end[0] - start[0]) * frac; mid[1] = start[1] + (end[1] - start[1]) * frac; mid[2] = start[2] + (end[2] - start[2]) * frac; // go down front side int r = RecursiveLightPoint(node.children[sideIndex], start, mid); if (r >= 0) return r; // hit something if ((back < 0) == side) return -1; // didn't hit anuthing // check for impact on this node Math3D.VectorCopy(mid, lightspot); lightplane = plane; int surfIndex = node.firstsurface; float[] scale = { 0, 0, 0 }; for (i = 0; i < node.numsurfaces; i++, surfIndex++) { surf = r_worldmodel.surfaces[surfIndex]; if ((surf.flags & (Defines.SURF_DRAWTURB | Defines.SURF_DRAWSKY)) != 0) continue; // no lightmaps tex = surf.texinfo; s = (int) (Math3D.DotProduct(mid, tex.vecs[0]) + tex.vecs[0][3]); t = (int) (Math3D.DotProduct(mid, tex.vecs[1]) + tex.vecs[1][3]); if (s < surf.texturemins[0] || t < surf.texturemins[1]) continue; ds = s - surf.texturemins[0]; dt = t - surf.texturemins[1]; if (ds > surf.extents[0] || dt > surf.extents[1]) continue; if (surf.samples == null) return 0; ds >>= 4; dt >>= 4; lightmap = surf.samples; int lightmapIndex = 0; Math3D.VectorCopy(Globals.vec3_origin, pointcolor); if (lightmap != null) { //float[] scale = {0, 0, 0}; float[] rgb; lightmapIndex += 3 * (dt * ((surf.extents[0] >> 4) + 1) + ds); for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { rgb = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb; scale[0] = gl_modulate.value * rgb[0]; scale[1] = gl_modulate.value * rgb[1]; scale[2] = gl_modulate.value * rgb[2]; pointcolor[0] += (lightmap.get(lightmapIndex + 0) & 0xFF) * scale[0] * (1.0f / 255); pointcolor[1] += (lightmap.get(lightmapIndex + 1) & 0xFF) * scale[1] * (1.0f / 255); pointcolor[2] += (lightmap.get(lightmapIndex + 2) & 0xFF) * scale[2] * (1.0f / 255); lightmapIndex += 3 * ((surf.extents[0] >> 4) + 1) * ((surf.extents[1] >> 4) + 1); } } return 1; } // go down back side return RecursiveLightPoint(node.children[1 - sideIndex], mid, end); } /* * =============== R_LightPoint =============== */ void R_LightPoint(float[] p, float[] color) { assert (p.length == 3) : "vec3_t bug"; assert (color.length == 3) : "rgb bug"; float[] end = { 0, 0, 0 }; dlight_t dl; float add; if (r_worldmodel.lightdata == null) { color[0] = color[1] = color[2] = 1.0f; return; } end[0] = p[0]; end[1] = p[1]; end[2] = p[2] - 2048; float r = RecursiveLightPoint(r_worldmodel.nodes[0], p, end); if (r == -1) { Math3D.VectorCopy(Globals.vec3_origin, color); } else { Math3D.VectorCopy(pointcolor, color); } // // add dynamic lights // for (int lnum = 0; lnum < r_newrefdef.num_dlights; lnum++) { dl = r_newrefdef.dlights[lnum]; Math3D.VectorSubtract(currententity.origin, dl.origin, end); add = dl.intensity - Math3D.VectorLength(end); add *= (1.0f / 256); if (add > 0) { Math3D.VectorMA(color, add, dl.color, color); } } Math3D.VectorScale(color, gl_modulate.value, color); } // =================================================================== float[] s_blocklights = new float[34 * 34 * 3]; /* * =============== R_AddDynamicLights =============== */ void R_AddDynamicLights(msurface_t surf) { int lnum; int sd, td; float fdist, frad, fminlight; float[] impact = { 0, 0, 0 }; float[] local = { 0, 0, 0 }; int s, t; int i; int smax, tmax; mtexinfo_t tex; dlight_t dl; float[] pfBL; float fsacc, ftacc; smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; tex = surf.texinfo; for (lnum = 0; lnum < r_newrefdef.num_dlights; lnum++) { if ((surf.dlightbits & (1 << lnum)) == 0) continue; // not lit by this light dl = r_newrefdef.dlights[lnum]; frad = dl.intensity; fdist = Math3D.DotProduct(dl.origin, surf.plane.normal) - surf.plane.dist; frad -= Math.abs(fdist); // rad is now the highest intensity on the plane fminlight = DLIGHT_CUTOFF; // FIXME: make configurable? if (frad < fminlight) continue; fminlight = frad - fminlight; for (i = 0; i < 3; i++) { impact[i] = dl.origin[i] - surf.plane.normal[i] * fdist; } local[0] = Math3D.DotProduct(impact, tex.vecs[0]) + tex.vecs[0][3] - surf.texturemins[0]; local[1] = Math3D.DotProduct(impact, tex.vecs[1]) + tex.vecs[1][3] - surf.texturemins[1]; pfBL = s_blocklights; int pfBLindex = 0; for (t = 0, ftacc = 0; t < tmax; t++, ftacc += 16) { td = (int) (local[1] - ftacc); if (td < 0) td = -td; for (s = 0, fsacc = 0; s < smax; s++, fsacc += 16, pfBLindex += 3) { sd = (int) (local[0] - fsacc); if (sd < 0) sd = -sd; if (sd > td) fdist = sd + (td >> 1); else fdist = td + (sd >> 1); if (fdist < fminlight) { pfBL[pfBLindex + 0] += (frad - fdist) * dl.color[0]; pfBL[pfBLindex + 1] += (frad - fdist) * dl.color[1]; pfBL[pfBLindex + 2] += (frad - fdist) * dl.color[2]; } } } } } /* * * R_SetCacheState */ void R_SetCacheState(msurface_t surf) { int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { surf.cached_light[maps] = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].white; } } /* * =============== R_BuildLightMap * * Combine and scale multiple lightmaps into the floating format in * blocklights =============== */ void R_BuildLightMap(msurface_t surf, IntBuffer dest, int stride) { int smax, tmax; int r, g, b, a, max; int i, j, size; ByteBuffer lightmap; float[] scale = { 0, 0, 0, 0 }; int nummaps; float[] bl; lightstyle_t style; int monolightmap; if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0) Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4)) Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { // set to full bright if no light data if (surf.samples == null) { int maps; for (i = 0; i < size * 3; i++) s_blocklights[i] = 255; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { style = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF]; } // goto store; throw new longjmpException(); } // count the # of maps for (nummaps = 0; nummaps < Defines.MAXLIGHTMAPS && surf.styles[nummaps] != (byte) 255; nummaps++) ; lightmap = surf.samples; int lightmapIndex = 0; // add all the lightmaps if (nummaps == 1) { int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; for (i = 0; i < 3; i++) scale[i] = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; if (scale[0] == 1.0F && scale[1] == 1.0F && scale[2] == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale[0]; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale[1]; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale[2]; } } //lightmap += size*3; // skip to next lightmap } } else { int maps; // memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * // 3 ); Arrays.fill(s_blocklights, 0, size * 3, 0.0f); for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; for (i = 0; i < 3; i++) scale[i] = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; if (scale[0] == 1.0F && scale[1] == 1.0F && scale[2] == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale[0]; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale[1]; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale[2]; } } //lightmap += size*3; // skip to next lightmap } } // add all the dynamic lights if (surf.dlightframe == r_framecount) R_AddDynamicLights(surf); // label store: } catch (longjmpException store) { } // put into texture format stride -= smax; bl = s_blocklights; int blp = 0; monolightmap = gl_monolightmap.string.charAt(0); int destp = 0; if (monolightmap == '0') { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } } } else { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } /* * * So if we are doing alpha lightmaps we need to set the * R, G, and B * components to 0 and we need to set alpha to * 1-alpha. */ switch (monolightmap) { case 'L': case 'I': r = a; g = b = 0; break; case 'C': // try faking colored lighting a = 255 - ((r + g + b) / 3); r *= a / 255.0f; g *= a / 255.0f; b *= a / 255.0f; break; case 'A': default: r = g = b = 0; a = 255 - a; break; } r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } } } } } --- NEW FILE: Mesh.java --- /* * Mesh.java * Copyright (C) 2003 * * $Id: Mesh.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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.render.basic; import jake2.Defines; import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; import jake2.util.Lib; import jake2.util.Math3D; import java.nio.FloatBuffer; /** * Mesh * * @author cwei */ public abstract class Mesh extends Light { // g_mesh.c: triangle model functions /* * ============================================================= * * ALIAS MODELS * * ============================================================= */ static final int NUMVERTEXNORMALS = 162; float[][] r_avertexnormals = Anorms.VERTEXNORMALS; float[][] s_lerped = new float[qfiles.MAX_VERTS][4]; float[] shadevector = { 0, 0, 0 }; float[] shadelight = { 0, 0, 0 }; // precalculated dot products for quantized angles static final int SHADEDOT_QUANT = 16; float[][] r_avertexnormal_dots = Anorms.VERTEXNORMAL_DOTS; float[] shadedots = r_avertexnormal_dots[0]; void GL_LerpVerts(int nverts, int[] ov, int[] v, float[][] lerp, float[] move, float[] frontv, float[] backv) { int i; int lerpIndex = 0; int ovv, vv; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { float[] normal; for (i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { vv = v[i]; normal = r_avertexnormals[(vv >>> 24) & 0xFF]; ovv = ov[i]; lerp[i][0] = move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE; lerp[i][1] = move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE; lerp[i][2] = move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE; } } else { for (i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { vv = v[i]; ovv = ov[i]; lerp[i][0] = move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0]; lerp[i][1] = move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1]; lerp[i][2] = move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2]; } } } void GL_LerpVerts(int nverts, int[] ov, int[] v, float[] move, float[] frontv, float[] backv) { int lerpIndex = 0; int ovv, vv; FloatBuffer lerp = vertexArrayBuf; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { float[] normal; int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { vv = v[i]; normal = r_avertexnormals[(v[i] >>> 24) & 0xFF]; ovv = ov[i]; lerp.put(j, move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); j += 3; } } else { int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { ovv = ov[i]; vv = v[i]; lerp.put(j, move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0]); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1]); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2]); j += 3; } } } FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4); FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3); boolean isFilled = false; float[] tmpVec = { 0, 0, 0 }; /* * ============= GL_DrawAliasFrameLerp * * interpolates between two frames and origins FIXME: batch lerp all * vertexes ============= */ void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { float l; qfiles.daliasframe_t frame, oldframe; int[] v, ov; int[] order; int orderIndex = 0; int count; float frontlerp; float alpha; float[] move = { 0, 0, 0 }; // vec3_t float[][] vectors = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } // 3 mal // vec3_t }; float[] frontv = { 0, 0, 0 }; // vec3_t float[] backv = { 0, 0, 0 }; // vec3_t int i; int index_xyz; //float[][] lerp; frame = paliashdr.aliasFrames[currententity.frame]; v = frame.verts; oldframe = paliashdr.aliasFrames[currententity.oldframe]; ov = oldframe.verts; order = paliashdr.glCmds; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) alpha = currententity.alpha; else alpha = 1.0f; // PMM - added double shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) gl.glDisable(GL_TEXTURE_2D); frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp Math3D.VectorSubtract(currententity.oldorigin, currententity.origin, frontv); Math3D.AngleVectors(currententity.angles, vectors[0], vectors[1], vectors[2]); move[0] = Math3D.DotProduct(frontv, vectors[0]); // forward move[1] = -Math3D.DotProduct(frontv, vectors[1]); // left move[2] = Math3D.DotProduct(frontv, vectors[2]); // up Math3D.VectorAdd(move, oldframe.translate, move); for (i = 0; i < 3; i++) { move[i] = backlerp * move[i] + frontlerp * frame.translate[i]; frontv[i] = frontlerp * frame.scale[i]; backv[i] = backlerp * oldframe.scale[i]; } if (gl_vertex_arrays.value != 0.0f) { GL_LerpVerts(paliashdr.num_xyz, ov, v, move, frontv, backv); gl.glEnableClientState(GL_VERTEX_ARRAY); gl.glVertexPointer(3, 0, vertexArrayBuf); // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { gl.glDisableClientState(GL_COLOR_ARRAY); gl.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha); } else { gl.glEnableClientState(GL_COLOR_ARRAY); gl.glColorPointer(4, 0, colorArrayBuf); // // pre light everything // FloatBuffer color = colorArrayBuf; int j = 0; for (i = 0; i < paliashdr.num_xyz; i++) { // light normal index l = shadedots[(v[i] >>> 24) & 0xFF]; color.put(j++, l * shadelight[0]); color.put(j++, l * shadelight[1]); color.put(j++, l * shadelight[2]); color.put(j++, alpha); } } if (qglLockArraysEXT) gl.glLockArraysEXT(0, paliashdr.num_xyz); while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin(GL_TRIANGLE_FAN); } else { gl.glBegin(GL_TRIANGLE_STRIP); } // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { do { index_xyz = order[orderIndex + 2]; orderIndex += 3; /* * vertexArrayBuf.position(4 * index_xyz); * vertexArrayBuf.get(tmpVec); gl.glVertex3fv( tmpVec ); */ gl.glArrayElement(index_xyz); } while (--count != 0); } else { do { // texture coordinates come from the draw list gl.glTexCoord2f(Float .intBitsToFloat(order[orderIndex + 0]), Float .intBitsToFloat(order[orderIndex + 1])); index_xyz = order[orderIndex + 2]; orderIndex += 3; // normals and vertexes come from the frame list gl.glArrayElement(index_xyz); } while (--count != 0); } gl.glEnd(); } if (qglLockArraysEXT) gl.glUnlockArraysEXT(); } else { GL_LerpVerts(paliashdr.num_xyz, ov, v, s_lerped, move, frontv, backv); float[] tmp; while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin(GL_TRIANGLE_FAN); } else { gl.glBegin(GL_TRIANGLE_STRIP); } if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE)) != 0) { do { index_xyz = order[orderIndex + 2]; orderIndex += 3; gl.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha); tmp = s_lerped[index_xyz]; gl.glVertex3f(tmp[0], tmp[1], tmp[2]); } while (--count != 0); } else { do { // texture coordinates come from the draw list // gl.glTexCoord2f (((float *)order)[0], ((float // *)order)[1]); gl.glTexCoord2f(Float .intBitsToFloat(order[orderIndex + 0]), Float .intBitsToFloat(order[orderIndex + 1])); index_xyz = order[orderIndex + 2]; orderIndex += 3; // normals and vertexes come from the frame list l = shadedots[(v[index_xyz] >>> 24) & 0xFF]; gl.glColor4f(l * shadelight[0], l * shadelight[1], l * shadelight[2], alpha); tmp = s_lerped[index_xyz]; gl.glVertex3f(tmp[0], tmp[1], tmp[2]); } while (--count != 0); } gl.glEnd(); } } // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) gl.glEnable(GL_TEXTURE_2D); } /* * ============= GL_DrawAliasShadow ============= */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { float[] point = { 0, 0, 0 }; int count; qfiles.daliasframe_t frame; float lheight = currententity.origin[2] - lightspot[2]; frame = paliashdr.aliasFrames[currententity.frame]; int[] order = paliashdr.glCmds; float height = -lheight + 1.0f; int orderIndex = 0; int index = 0; while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin(GL_TRIANGLE_FAN); } else gl.glBegin(GL_TRIANGLE_STRIP); do { // normals and vertexes come from the frame list /* * point[0] = verts[order[2]].v[0] * frame.scale[0] + * frame.translate[0]; point[1] = verts[order[2]].v[1] * * frame.scale[1] + frame.translate[1]; point[2] = * verts[order[2]].v[2] * frame.scale[2] + frame.translate[2]; */ if (gl_vertex_arrays.value != 0.0f) { index = order[orderIndex + 2] * 3; point[0] = vertexArrayBuf.get(index); point[1] = vertexArrayBuf.get(index + 1); point[2] = vertexArrayBuf.get(index + 2); } else { Math3D.VectorCopy(s_lerped[order[orderIndex + 2]], point); } point[0] -= shadevector[0] * (point[2] + lheight); point[1] -= shadevector[1] * (point[2] + lheight); point[2] = height; gl.glVertex3f(point[0], point[1], point[2]); orderIndex += 3; } while (--count != 0); gl.glEnd(); } } /* * * R_CullAliasModel */ boolean R_CullAliasModel(float[][] bbox, entity_t e) { int i; float[] mins = { 0, 0, 0 }; float[] maxs = { 0, 0, 0 }; qfiles.dmdl_t paliashdr; float[][] vectors = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; float[] thismins = { 0, 0, 0 }; float[] oldmins = { 0, 0, 0 }; float[] thismaxs = { 0, 0, 0 }; float[] oldmaxs = { 0, 0, 0 }; qfiles.daliasframe_t pframe, poldframe; float[] angles = { 0, 0, 0 }; paliashdr = (qfiles.dmdl_t) currentmodel.extradata; if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\n'); e.frame = 0; } if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } pframe = paliashdr.aliasFrames[e.frame]; poldframe = paliashdr.aliasFrames[e.oldframe]; /* * * compute axially aligned mins and maxs */ if (pframe == poldframe) { for (i = 0; i < 3; i++) { mins[i] = pframe.translate[i]; maxs[i] = mins[i] + pframe.scale[i] * 255; } } else { for (i = 0; i < 3; i++) { thismins[i] = pframe.translate[i]; thismaxs[i] = thismins[i] + pframe.scale[i] * 255; oldmins[i] = poldframe.translate[i]; oldmaxs[i] = oldmins[i] + poldframe.scale[i] * 255; if (thismins[i] < oldmins[i]) mins[i] = thismins[i]; else mins[i] = oldmins[i]; if (thismaxs[i] > oldmaxs[i]) maxs[i] = thismaxs[i]; else maxs[i] = oldmaxs[i]; } } /* * * compute a full bounding box */ for (i = 0; i < 8; i++) { float[] tmp = { 0, 0, 0 }; if ((i & 1) != 0) tmp[0] = mins[0]; else tmp[0] = maxs[0]; if ((i & 2) != 0) tmp[1] = mins[1]; else tmp[1] = maxs[1]; if ((i & 4) != 0) tmp[2] = mins[2]; else tmp[2] = maxs[2]; Math3D.VectorCopy(tmp, bbox[i]); } /* * * rotate the bounding box */ Math3D.VectorCopy(e.angles, angles); angles[YAW] = -angles[YAW]; Math3D.AngleVectors(angles, vectors[0], vectors[1], vectors[2]); for (i = 0; i < 8; i++) { float[] tmp = { 0, 0, 0 }; Math3D.VectorCopy(bbox[i], tmp); bbox[i][0] = Math3D.DotProduct(vectors[0], tmp); bbox[i][1] = -Math3D.DotProduct(vectors[1], tmp); bbox[i][2] = Math3D.DotProduct(vectors[2], tmp); Math3D.VectorAdd(e.origin, bbox[i], bbox[i]); } { int p, f; int aggregatemask = ~0; // 0xFFFFFFFF for (p = 0; p < 8; p++) { int mask = 0; for (f = 0; f < 4; f++) { float dp = Math3D.DotProduct(frustum[f].normal, bbox[p]); if ((dp - frustum[f].dist) < 0) { mask |= (1 << f); } } aggregatemask &= mask; } if (aggregatemask != 0) { return true; } return false; } } /* * ================= R_DrawAliasModel * * ================= */ void R_DrawAliasModel(entity_t e) { int i; qfiles.dmdl_t paliashdr; float an; // bounding box float[][] bbox = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; image_t skin; if ((e.flags & Defines.RF_WEAPONMODEL) == 0) { if (R_CullAliasModel(bbox, e)) return; } if ((e.flags & Defines.RF_WEAPONMODEL) != 0) { if (r_lefthand.value == 2.0f) return; } paliashdr = (qfiles.dmdl_t) currentmodel.extradata; // // get lighting information // // PMM - rewrote, reordered to handle new shells & mixing // PMM - 3.20 code .. replaced with original way of doing it to keep mod // authors happy // if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56f; shadelight[1] = 0.59f; shadelight[2] = 0.45f; } if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) { shadelight[0] = 0.9f; shadelight[1] = 0.7f; } if ((currententity.flags & Defines.RF_SHELL_RED) != 0) shadelight[0] = 1.0f; if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0) shadelight[1] = 1.0f; if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0) shadelight[2] = 1.0f; } else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { for (i = 0; i < 3; i++) shadelight[i] = 1.0f; } else { R_LightPoint(currententity.origin, shadelight); // player lighting hack for communication back to server // big hack! if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) { // pick the greatest component, which should be the same // as the mono value returned by software if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) r_lightlevel.value = 150 * shadelight[0]; else r_lightlevel.value = 150 * shadelight[2]; } else { if (shadelight[1] > shadelight[2]) r_lightlevel.value = 150 * shadelight[1]; else r_lightlevel.value = 150 * shadelight[2]; } } if (gl_monolightmap.string.charAt(0) != '0') { float s = shadelight[0]; if (s < shadelight[1]) s = shadelight[1]; if (s < shadelight[2]) s = shadelight[2]; shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ((currententity.flags & Defines.RF_MINLIGHT) != 0) { for (i = 0; i < 3; i++) if (shadelight[i] > 0.1f) break; if (i == 3) { shadelight[0] = 0.1f; shadelight[1] = 0.1f; shadelight[2] = 0.1f; } } if ((currententity.flags & Defines.RF_GLOW) != 0) { // bonus items will // pulse with time float scale; float min; scale = (float) (0.1f * Math.sin(r_newrefdef.time * 7)); for (i = 0; i < 3; i++) { min = shadelight[i] * 0.8f; shadelight[i] += scale; if (shadelight[i] < min) shadelight[i] = min; } } // ================= // PGM ir goggles color override if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1.0f; shadelight[1] = 0.0f; shadelight[2] = 0.0f; } // PGM // ================= shadedots = r_avertexnormal_dots[((int) (currententity.angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; an = (float) (currententity.angles[1] / 180 * Math.PI); shadevector[0] = (float) Math.cos(-an); shadevector[1] = (float) Math.sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); // // locate the proper data // c_alias_polys += paliashdr.num_tris; // // draw all the triangles // if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls gl.glDepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) { gl.glMatrixMode(GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); gl.glScalef(-1, 1, 1); MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096); gl.glMatrixMode(GL_MODELVIEW); gl.glCullFace(GL_BACK); } gl.glPushMatrix(); e.angles[PITCH] = -e.angles[PITCH]; // sigh. R_RotateForEntity(e); e.angles[PITCH] = -e.angles[PITCH]; // sigh. // select skin if (currententity.skin != null) skin = currententity.skin; // custom player skin else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) skin = currentmodel.skins[0]; else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) skin = currentmodel.skins[0]; } } if (skin == null) skin = r_notexture; // fallback... GL_Bind(skin.texnum); // draw it gl.glShadeModel(GL_SMOOTH); GL_TexEnv(GL_MODULATE); if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { gl.glEnable(GL_BLEND); } if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if (r_lerpmodels.value == 0.0f) currententity.backlerp = 0; GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv(GL_REPLACE); gl.glShadeModel(GL_FLAT); gl.glPopMatrix(); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) { gl.glMatrixMode(GL_PROJECTION); gl.glPopMatrix(); gl.glMatrixMode(GL_MODELVIEW); gl.glCullFace(GL_FRONT); } if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { gl.glDisable(GL_BLEND); } if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) gl.glDepthRange(gldepthmin, gldepthmax); if (gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { gl.glPushMatrix(); R_RotateForEntity(e); gl.glDisable(GL_TEXTURE_2D); gl.glEnable(GL_BLEND); gl.glColor4f(0, 0, 0, 0.5f); GL_DrawAliasShadow(paliashdr, currententity.frame); gl.glEnable(GL_TEXTURE_2D); gl.glDisable(GL_BLEND); gl.glPopMatrix(); } gl.glColor4f(1, 1, 1, 1); } } --- NEW FILE: Model.java --- /* * Model.java * Copyright (C) 2003 * * $Id: Model.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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. [...1228 lines suppressed...] { mod.clear(); } /* ================ Mod_FreeAll ================ */ void Mod_FreeAll() { for (int i=0 ; i<mod_numknown ; i++) { if (mod_known[i].extradata != null) Mod_Free(mod_known[i]); } } } --- NEW FILE: Main.java --- /* * Main.java * Copyright (C) 2003 * * $Id: Main.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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. [...1547 lines suppressed...] float[] v; for (i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = start_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd(); gl.glEnable(GL_TEXTURE_2D); gl.glDisable(GL_BLEND); gl.glDepthMask(true); } } --- NEW FILE: Polygon.java --- /* * Polygon.java * Copyright (C) 2003 * * $Id: Polygon.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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.render.basic; import jake2.render.glpoly_t; /** * Polygon * * @author cwei */ public final class Polygon extends glpoly_t { private final static int MAXPOLYS = 20000; private final static int MAX_BUFFER_VERTICES = 120000; private static float[] buffer = new float[MAX_BUFFER_VERTICES * STRIDE]; private static int bufferIndex = 0; private static int polyCount = 0; private static Polygon[] polyCache = new Polygon[MAXPOLYS]; static { for (int i = 0; i < polyCache.length; i++) { polyCache[i] = new Polygon(); } } public static glpoly_t create(int numverts) { Polygon poly = polyCache[polyCount++]; poly.clear(); poly.numverts = numverts; poly.pos = bufferIndex; bufferIndex += numverts; return poly; } public static void reset() { polyCount = 0; bufferIndex = 0; } private Polygon() { } private final void clear() { next = null; chain = null; numverts = 0; flags = 0; } public final float x(int index) { return buffer[offset(index)]; } public final void x(int index, float value) { buffer[offset(index)] = value; } public final float y(int index) { return buffer[offset(index) + 1]; } public final void y(int index, float value) { buffer[offset(index) + 1] = value; } public final float z(int index) { return buffer[offset(index) + 2]; } public final void z(int index, float value) { buffer[offset(index) + 2] = value; } public final float s1(int index) { return buffer[offset(index) + 3]; } public final void s1(int index, float value) { buffer[offset(index) + 3] = value; } public final float t1(int index) { return buffer[offset(index) + 4]; } public final void t1(int index, float value) { buffer[offset(index) + 4] = value; } public final float s2(int index) { return buffer[offset(index) + 5]; } public final void s2(int index, float value) { buffer[offset(index) + 5] = value; } public final float t2(int index) { return buffer[offset(index) + 6]; } public final void t2(int index, float value) { buffer[offset(index) + 6] = value; } public final void beginScrolling(float value) { // not in use } public final void endScrolling() { // not in use } private final int offset(int index) { return (index + pos) * STRIDE; } } --- NEW FILE: Warp.java --- /* * Warp.java * Copyright (C) 2003 * * $Id: Warp.java,v 1.1.2.1 2005/11/14 23:57:19 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the t... [truncated message content] |
From: Carsten W. <ca...@us...> - 2005-11-14 23:57:27
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1863/src/jake2/render Added Files: Tag: render-refactoring Base.java Log Message: this is the refactored (old jogl) renderer impl --- NEW FILE: Base.java --- /* * Base.java * Copyright (C) 2003 * * $Id: Base.java,v 1.1.2.1 2005/11/14 23:57:19 cawe 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.render; import jake2.client.refexport_t; import jake2.client.viddef_t; import jake2.game.cvar_t; import jake2.render.*; import jake2.render.opengl.*; import java.awt.Dimension; /** * Base * * @author dsanders/cwei */ public abstract class Base implements QGLConst { public static final int GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX; public static final String REF_VERSION = "GL 0.01"; // up / down public static final int PITCH = 0; // left / right public static final int YAW = 1; // fall over public static final int ROLL = 2; /* * skins will be outline flood filled and mip mapped pics and sprites with * alpha will be outline flood filled pic won't be mip mapped * * model skin sprite frame wall texture pic */ // enum imagetype_t public static final int it_skin = 0; public static final int it_sprite = 1; public static final int it_wall = 2; public static final int it_pic = 3; public static final int it_sky = 4; // enum modtype_t public static final int mod_bad = 0; public static final int mod_brush = 1; public static final int mod_sprite = 2; public static final int mod_alias = 3; public static final int TEXNUM_LIGHTMAPS = 1024; public static final int TEXNUM_SCRAPS = 1152; public static final int TEXNUM_IMAGES = 1153; public static final int MAX_GLTEXTURES = 1024; public static final int MAX_LBM_HEIGHT = 480; public static final float BACKFACE_EPSILON = 0.01f; /* * * GL config stuff */ public static final int GL_RENDERER_VOODOO = 0x00000001; public static final int GL_RENDERER_VOODOO2 = 0x00000002; public static final int GL_RENDERER_VOODOO_RUSH = 0x00000004; public static final int GL_RENDERER_BANSHEE = 0x00000008; public static final int GL_RENDERER_3DFX = 0x0000000F; public static final int GL_RENDERER_PCX1 = 0x00000010; public static final int GL_RENDERER_PCX2 = 0x00000020; public static final int GL_RENDERER_PMX = 0x00000040; public static final int GL_RENDERER_POWERVR = 0x00000070; public static final int GL_RENDERER_PERMEDIA2 = 0x00000100; public static final int GL_RENDERER_GLINT_MX = 0x00000200; public static final int GL_RENDERER_GLINT_TX = 0x00000400; public static final int GL_RENDERER_3DLABS_MISC = 0x00000800; public static final int GL_RENDERER_3DLABS = 0x00000F00; public static final int GL_RENDERER_REALIZM = 0x00001000; public static final int GL_RENDERER_REALIZM2 = 0x00002000; public static final int GL_RENDERER_INTERGRAPH = 0x00003000; public static final int GL_RENDERER_3DPRO = 0x00004000; public static final int GL_RENDERER_REAL3D = 0x00008000; public static final int GL_RENDERER_RIVA128 = 0x00010000; public static final int GL_RENDERER_DYPIC = 0x00020000; public static final int GL_RENDERER_V1000 = 0x00040000; public static final int GL_RENDERER_V2100 = 0x00080000; public static final int GL_RENDERER_V2200 = 0x00100000; public static final int GL_RENDERER_RENDITION = 0x001C0000; public static final int GL_RENDERER_O2 = 0x00100000; public static final int GL_RENDERER_IMPACT = 0x00200000; public static final int GL_RENDERER_RE = 0x00400000; public static final int GL_RENDERER_IR = 0x00800000; public static final int GL_RENDERER_SGI = 0x00F00000; public static final int GL_RENDERER_MCD = 0x01000000; public static final int GL_RENDERER_OTHER = 0x80000000; // enum rserr_t public static final int rserr_ok = 0; public static final int rserr_invalid_fullscreen = 1; public static final int rserr_invalid_mode = 2; public static final int rserr_unknown = 3; /* * base members */ protected static viddef_t vid = new viddef_t(); protected cvar_t vid_fullscreen; protected QGL gl; protected GLDriver glImpl; public void setGlImpl(GLDriver driver) { glImpl = driver; gl = (QGL)driver; } public static void setVid(int width, int height) { vid.width = width; vid.height = height; } } |