From: Rene S. <sa...@us...> - 2005-01-23 21:32:38
|
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8896/src/jake2/game Modified Files: Tag: RST pmove_t.java usercmd_t.java GameUtil.java gitem_t.java PlayerClient.java PlayerHud.java Cmd.java GameSpawn.java GamePWeapon.java GameAI.java pmove_state_t.java client_persistant_t.java Log Message: added debug messages, fixed cooperative multiplayer bugs. Index: pmove_state_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/pmove_state_t.java,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** pmove_state_t.java 20 Aug 2004 21:29:58 -0000 1.2 --- pmove_state_t.java 23 Jan 2005 21:31:47 -0000 1.2.6.1 *************** *** 52,56 **** private static pmove_state_t prototype = new pmove_state_t(); ! public void reset() { this.set(prototype); --- 52,56 ---- private static pmove_state_t prototype = new pmove_state_t(); ! public void clear() { this.set(prototype); Index: PlayerHud.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/PlayerHud.java,v retrieving revision 1.6 retrieving revision 1.6.6.1 diff -C2 -d -r1.6 -r1.6.6.1 *** PlayerHud.java 22 Sep 2004 19:22:03 -0000 1.6 --- PlayerHud.java 23 Jan 2005 21:31:46 -0000 1.6.6.1 *************** *** 110,116 **** continue; // strip players of all keys between units ! for (n = 1; n < Defines.MAX_ITEMS; n++) { ! if ((GameAI.itemlist[n].flags & Defines.IT_KEY) != 0) ! client.client.pers.inventory[n] = 0; } } --- 110,118 ---- continue; // strip players of all keys between units ! for (n = 1; n < GameAI.itemlist.length; n++) { ! // null pointer exception fixed. (RST) ! if (GameAI.itemlist[n] != null) ! if ((GameAI.itemlist[n].flags & Defines.IT_KEY) != 0) ! client.client.pers.inventory[n] = 0; } } Index: GameSpawn.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameSpawn.java,v retrieving revision 1.9.6.1 retrieving revision 1.9.6.2 diff -C2 -d -r1.9.6.1 -r1.9.6.2 *** GameSpawn.java 16 Jan 2005 21:21:02 -0000 1.9.6.1 --- GameSpawn.java 23 Jan 2005 21:31:46 -0000 1.9.6.2 *************** *** 24,27 **** --- 24,28 ---- import jake2.Defines; + import jake2.Globals; import jake2.game.monsters.*; import jake2.qcommon.Com; *************** *** 471,474 **** --- 472,477 ---- public static void SpawnEntities(String mapname, String entities, String spawnpoint) { + + Com.dprintln("SpawnEntities(), mapname=" + mapname); edict_t ent; int inhibit; *************** *** 509,514 **** Com.ParseHelp ph = new Com.ParseHelp(entities); - //Com.DPrintf("* * * die scheiss edict- nummer stimmen nicht ??? * * * - // \n"); while (true) { // parse the opening brace --- 512,515 ---- *************** *** 525,535 **** ent = GameUtil.G_Spawn(); - Com.DPrintf("===\n"); - - Com.DPrintf("allocated new edict:" + ent.index + "\n"); ED_ParseEdict(ph, ent); ! Com.DPrintf("ent.classname:" + ent.classname + "\n"); ! Com.DPrintf("ent.spawnflags:" + Integer.toHexString(ent.spawnflags) ! + "\n"); // yet another map hack if (0 == Lib.Q_stricmp(GameBase.level.mapname, "command") --- 526,533 ---- ent = GameUtil.G_Spawn(); ED_ParseEdict(ph, ent); ! Com.DPrintf("spawning ent[" + ent.index + "], classname=" + ! ent.classname + ", flags= " + Integer.toHexString(ent.spawnflags)); ! // yet another map hack if (0 == Lib.Q_stricmp(GameBase.level.mapname, "command") *************** *** 543,546 **** --- 541,546 ---- if (GameBase.deathmatch.value != 0) { if ((ent.spawnflags & Defines.SPAWNFLAG_NOT_DEATHMATCH) != 0) { + + Com.DPrintf("->inhibited.\n"); GameUtil.G_FreeEdict(ent); inhibit++; *************** *** 555,560 **** --- 555,563 ---- || ((GameBase.skill.value == 1) && (ent.spawnflags & Defines.SPAWNFLAG_NOT_MEDIUM) != 0) || (((GameBase.skill.value == 2) || (GameBase.skill.value == 3)) && (ent.spawnflags & Defines.SPAWNFLAG_NOT_HARD) != 0)) { + + Com.DPrintf("->inhibited.\n"); GameUtil.G_FreeEdict(ent); inhibit++; + continue; } *************** *** 566,574 **** | Defines.SPAWNFLAG_NOT_COOP | Defines.SPAWNFLAG_NOT_DEATHMATCH); } - ED_CallSpawn(ent); } ! //gi.dprintf("player skill level:" +skill.value + "\n"); ! //gi.dprintf(inhibit + " entities inhibited\n"); i = 1; G_FindTeams(); --- 569,577 ---- | Defines.SPAWNFLAG_NOT_COOP | Defines.SPAWNFLAG_NOT_DEATHMATCH); } ED_CallSpawn(ent); + Com.DPrintf("\n"); } ! Com.DPrintf("player skill level:" + GameBase.skill.value + "\n"); ! Com.DPrintf(inhibit + " entities inhibited.\n"); i = 1; G_FindTeams(); Index: PlayerClient.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/PlayerClient.java,v retrieving revision 1.6 retrieving revision 1.6.6.1 diff -C2 -d -r1.6 -r1.6.6.1 *** PlayerClient.java 22 Sep 2004 19:22:06 -0000 1.6 --- PlayerClient.java 23 Jan 2005 21:31:44 -0000 1.6.6.1 *************** *** 521,526 **** while (true) { ! spot = (es = GameBase.G_Find(es, GameBase.findByClass, ! "info_player_coop")).o; if (spot == null) return null; // we didn't have enough... --- 521,533 ---- while (true) { ! es = GameBase.G_Find(es, GameBase.findByClass, ! "info_player_coop"); ! ! // nullpointer exi fixed (RST). ! if (es == null) ! return null; ! ! spot = es.o; ! if (spot == null) return null; // we didn't have enough... *************** *** 793,820 **** // deathmatch wipes most client data every spawn ! if (GameBase.deathmatch.value != 0) { ! String userinfo; ! //char userinfo[MAX_INFO_STRING]; resp.set(client.resp); ! userinfo = client.pers.userinfo; ! ! //memcpy(userinfo, client.pers.userinfo, sizeof(userinfo)); InitClientPersistant(client); userinfo = ClientUserinfoChanged(ent, userinfo); } else if (GameBase.coop.value != 0) { - // int n; - //char userinfo[MAX_INFO_STRING]; - String userinfo; resp.set(client.resp); ! //memcpy(userinfo, client.pers.userinfo, sizeof(userinfo)); ! userinfo = client.pers.userinfo; ! // this is kind of ugly, but it's how we want to handle keys in coop ! // for (n = 0; n < game.num_items; n++) ! // { ! // if (itemlist[n].flags & IT_KEY) ! // resp.coop_respawn.inventory[n] = client.pers.inventory[n]; ! // } resp.coop_respawn.game_helpchanged = client.pers.game_helpchanged; resp.coop_respawn.helpchanged = client.pers.helpchanged; --- 800,817 ---- // deathmatch wipes most client data every spawn ! if (GameBase.deathmatch.value != 0) { resp.set(client.resp); ! String userinfo = client.pers.userinfo; InitClientPersistant(client); + userinfo = ClientUserinfoChanged(ent, userinfo); + } else if (GameBase.coop.value != 0) { resp.set(client.resp); ! ! String userinfo = client.pers.userinfo; ! resp.coop_respawn.game_helpchanged = client.pers.game_helpchanged; resp.coop_respawn.helpchanged = client.pers.helpchanged; *************** *** 824,828 **** client.pers.score = resp.score; } else { - //memset(& resp, 0, sizeof(resp)); resp.clear(); } --- 821,824 ---- *************** *** 830,834 **** // clear everything but the persistant data saved.set(client.pers); - //memset(client, 0, sizeof(* client)); client.clear(); client.pers.set(saved); --- 826,829 ---- *************** *** 867,872 **** // clear playerstate values ! ent.client.ps.clear(); ! //memset(& ent.client.ps, 0, sizeof(client.ps)); client.ps.pmove.origin[0] = (short) (spawn_origin[0] * 8); --- 862,866 ---- // clear playerstate values ! ent.client.ps.clear(); client.ps.pmove.origin[0] = (short) (spawn_origin[0] * 8); *************** *** 1014,1018 **** if (GameBase.game.maxclients > 1) { GameBase.gi.WriteByte(Defines.svc_muzzleflash); - //gi.WriteShort(ent - g_edicts); GameBase.gi.WriteShort(ent.index); GameBase.gi.WriteByte(Defines.MZ_LOGIN); --- 1008,1011 ---- *************** *** 1042,1046 **** // check for malformed or illegal info strings if (!Info.Info_Validate(userinfo)) { - //strcpy(userinfo, "\\name\\badinfo\\skin\\male/grunt"); return "\\name\\badinfo\\skin\\male/grunt"; } --- 1035,1038 ---- *************** *** 1049,1054 **** s = Info.Info_ValueForKey(userinfo, "name"); - //strncpy(ent.client.pers.netname, s, sizeof(ent.client.pers.netname) - - // 1); ent.client.pers.netname = s; --- 1041,1044 ---- *************** *** 1090,1095 **** // save off the userinfo in case we want to check something later - //strncpy(ent.client.pers.userinfo, userinfo, - // sizeof(ent.client.pers.userinfo) - 1); ent.client.pers.userinfo = userinfo; --- 1080,1083 ---- Index: GameUtil.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameUtil.java,v retrieving revision 1.7.6.2 retrieving revision 1.7.6.3 diff -C2 -d -r1.7.6.2 -r1.7.6.3 *** GameUtil.java 16 Jan 2005 21:21:03 -0000 1.7.6.2 --- GameUtil.java 23 Jan 2005 21:31:44 -0000 1.7.6.3 *************** *** 606,610 **** public static void Killed(edict_t targ, edict_t inflictor, edict_t attacker, int damage, float[] point) { ! Com.Printf("Killing a " + targ.classname + "\n"); if (targ.health < -999) targ.health = -999; --- 606,610 ---- 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; Index: gitem_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/gitem_t.java,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -C2 -d -r1.4 -r1.4.6.1 *** gitem_t.java 22 Sep 2004 19:22:04 -0000 1.4 --- gitem_t.java 23 Jan 2005 21:31:44 -0000 1.4.6.1 *************** *** 108,127 **** // use - public static void main(String args[]) { - gitem_t xxx = new gitem_t(123); - gitem_t i2 = new gitem_t("item_armor_combat", GameAI.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, GameAI.combatarmor_info, - Defines.ARMOR_COMBAT, - /* precache */ - ""); - } - public int index; } \ No newline at end of file --- 108,111 ---- Index: GamePWeapon.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GamePWeapon.java,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -C2 -d -r1.6.6.1 -r1.6.6.2 *** GamePWeapon.java 16 Jan 2005 21:21:02 -0000 1.6.6.1 --- GamePWeapon.java 23 Jan 2005 21:31:46 -0000 1.6.6.2 *************** *** 26,29 **** --- 26,30 ---- import jake2.Globals; import jake2.game.monsters.M_Player; + import jake2.qcommon.Com; import jake2.util.Lib; import jake2.util.Math3D; *************** *** 231,235 **** radius_damage); ! GameUtil.T_Damage(ent, ent, ent.owner, ent.velocity, ent.s.origin, ent.s.origin, 25, 0, 0, 0); // send muzzle flash --- 232,237 ---- radius_damage); ! //MOD: sabotage rocket! ! //GameUtil.T_Damage(ent, ent, ent.owner, ent.velocity, ent.s.origin, ent.s.origin, 25, 0, 0, 0); // send muzzle flash *************** *** 759,762 **** --- 761,765 ---- if (item.ammo != null && 0 == GameBase.g_select_empty.value && 0 == (item.flags & Defines.IT_AMMO)) { + ammo_item = GameUtil.FindItem(item.ammo); ammo_index = GameUtil.ITEM_INDEX(ammo_item); *************** *** 1076,1079 **** --- 1079,1083 ---- if (ent.client.pers.weapon != null && ent.client.pers.weapon.ammo != null) + ent.client.ammo_index = GameUtil.ITEM_INDEX(GameUtil .FindItem(ent.client.pers.weapon.ammo)); *************** *** 1091,1094 **** --- 1095,1101 ---- .modelindex(ent.client.pers.weapon.view_model); + Com.dprintln("ChangeWeapon: gunindex=" + ent.client.ps.gunindex); + Com.dprintln("ChangeWeapon: viewmodel=" + ent.client.pers.weapon.view_model); + ent.client.anim_priority = Defines.ANIM_PAIN; if ((ent.client.ps.pmove.pm_flags & pmove_t.PMF_DUCKED) != 0) { *************** *** 1210,1214 **** ent.s.frame = M_Player.FRAME_pain304 + 1; ent.client.anim_end = M_Player.FRAME_pain301; - } } --- 1217,1220 ---- Index: pmove_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/pmove_t.java,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** pmove_t.java 22 Sep 2004 19:22:04 -0000 1.2 --- pmove_t.java 23 Jan 2005 21:31:44 -0000 1.2.6.1 *************** *** 23,28 **** package jake2.game; ! import jake2.*; ! import jake2.server.SV_WORLD; public class pmove_t { --- 23,30 ---- package jake2.game; ! import jake2.Defines; ! import jake2.util.Math3D; ! ! import java.util.Arrays; public class pmove_t { *************** *** 91,108 **** public void clear() { - groundentity = null; waterlevel = watertype = 0; trace = null; pointcontents = null; ! mins = new float[3]; ! maxs = new float[3]; viewheight = 0; ! viewangles = new float[3]; ! touchents = new edict_t[Defines.MAXTOUCH]; numtouch = 0; snapinitial = false; ! cmd = new usercmd_t(); ! s = new pmove_state_t(); } } \ No newline at end of file --- 93,109 ---- public void clear() { groundentity = null; waterlevel = watertype = 0; trace = null; pointcontents = null; ! Math3D.VectorClear(mins); ! Math3D.VectorClear(maxs); viewheight = 0; ! Math3D.VectorClear(viewangles); ! Arrays.fill(touchents, null); numtouch = 0; snapinitial = false; ! cmd.clear(); ! s.clear(); } } \ No newline at end of file Index: usercmd_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/usercmd_t.java,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -C2 -d -r1.3 -r1.3.6.1 *** usercmd_t.java 12 Sep 2004 18:25:49 -0000 1.3 --- usercmd_t.java 23 Jan 2005 21:31:44 -0000 1.3.6.1 *************** *** 27,30 **** --- 27,31 ---- import jake2.util.Lib; + import jake2.util.Math3D; public class usercmd_t implements Cloneable { *************** *** 36,42 **** public byte lightlevel; // light level the player is standing on ! public void reset() { forwardmove= sidemove= upmove= msec= buttons= impulse= lightlevel= 0; ! Arrays.fill(angles, (short) 0); } --- 37,43 ---- public byte lightlevel; // light level the player is standing on ! public void clear() { forwardmove= sidemove= upmove= msec= buttons= impulse= lightlevel= 0; ! angles[0] = angles[1] = angles[2] = 0; } Index: client_persistant_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/client_persistant_t.java,v retrieving revision 1.6 retrieving revision 1.6.6.1 diff -C2 -d -r1.6 -r1.6.6.1 *** client_persistant_t.java 10 Sep 2004 19:02:55 -0000 1.6 --- client_persistant_t.java 23 Jan 2005 21:31:47 -0000 1.6.6.1 *************** *** 77,86 **** // ammo capacities ! int max_bullets; ! int max_shells; ! int max_rockets; ! int max_grenades; ! int max_cells; ! int max_slugs; //pointer gitem_t weapon; --- 77,86 ---- // ammo capacities ! public int max_bullets; ! public int max_shells; ! public int max_rockets; ! public int max_grenades; ! public int max_cells; ! public int max_slugs; //pointer gitem_t weapon; Index: Cmd.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/Cmd.java,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** Cmd.java 16 Jan 2005 21:21:00 -0000 1.8.2.1 --- Cmd.java 23 Jan 2005 21:31:46 -0000 1.8.2.2 *************** *** 267,270 **** --- 267,271 ---- while (true) { + cmd_argv[cmd_argc] = null; // skip whitespace up to a /n char c = ph.skipwhitestoeol(); *************** *** 381,386 **** * ============ Cmd_ExecuteString * ! * A complete command line has been parsed, so try to execute it FIXME: ! * lookupnoadd the token to speed search? ============ */ public static void ExecuteString(String text) { --- 382,387 ---- * ============ Cmd_ExecuteString * ! * A complete command line has been parsed, so try to execute it ! * FIXME: lookupnoadd the token to speed search? */ public static void ExecuteString(String text) { *************** *** 391,401 **** TokenizeString(text.toCharArray(), true); ! // if (Argc() > 0) { ! // Com.DPrintf("tokenized:"); ! // for (int xxx = 0; xxx < Argc(); xxx++) ! // Com.DPrintf("[" + Argv(xxx) + "]"); ! // ! // Com.DPrintf("\n"); ! // } // execute the command line if (Argc() == 0) --- 392,401 ---- TokenizeString(text.toCharArray(), true); ! // if (Argc() > 0) { ! // Com.DPrintf("tokenized:"); ! // for (int xxx = 0; xxx < Argc(); xxx++) ! // Com.dprintln("<" + Argv(xxx) + ">"); ! // } ! // execute the command line if (Argc() == 0) *************** *** 661,665 **** --- 661,667 ---- s = Cmd.Args(); + it = GameUtil.FindItem(s); + Com.dprintln("using:" + s); if (it == null) { SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s *************** *** 668,673 **** } if (it.use == null) { ! SV_GAME ! .PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n"); return; --- 670,674 ---- } if (it.use == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n"); return; Index: GameAI.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameAI.java,v retrieving revision 1.5.6.1 retrieving revision 1.5.6.2 diff -C2 -d -r1.5.6.1 -r1.5.6.2 *** GameAI.java 16 Jan 2005 21:21:03 -0000 1.5.6.1 --- GameAI.java 23 Jan 2005 21:31:46 -0000 1.5.6.2 *************** *** 1359,1363 **** boolean ff; ! if (GameBase.coop.value != 0 && attacker.client != null) GameBase.meansOfDeath |= Defines.MOD_FRIENDLY_FIRE; --- 1359,1364 ---- boolean ff; ! // attacker can be null by some mods! bug fix by rene stoeckel ! if (GameBase.coop.value != 0 && attacker != null && attacker.client != null) GameBase.meansOfDeath |= Defines.MOD_FRIENDLY_FIRE; |