From: Carsten W. <ca...@us...> - 2007-04-16 21:58:41
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15136/src/jake2/client Modified Files: CL_parse.java Log Message: clean up Index: CL_parse.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_parse.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CL_parse.java 15 Apr 2007 20:12:32 -0000 1.23 --- CL_parse.java 16 Apr 2007 21:58:06 -0000 1.24 *************** *** 22,28 **** */ - - // $Id$ - package jake2.client; --- 22,25 ---- *************** *** 67,73 **** */ public static boolean CheckOrDownloadFile(String filename) { - RandomAccessFile fp; - String name; - if (filename.indexOf("..") != -1) { Com.Printf("Refusing to download a path with ..\n"); --- 64,67 ---- *************** *** 75,79 **** } ! if (FS.FileLength(filename) > 0) { // it exists, no need to download return true; } --- 69,74 ---- } ! if (FS.FileLength(filename) > 0) { ! // it exists, no need to download return true; } *************** *** 92,98 **** // resume // open the file if not opened yet ! name = DownloadFileName(Globals.cls.downloadtempname); ! fp = Lib.fopen(name, "r+b"); if (fp != null) { --- 87,93 ---- // resume // open the file if not opened yet ! String name = DownloadFileName(Globals.cls.downloadtempname); ! RandomAccessFile fp = Lib.fopen(name, "r+b"); if (fp != null) { *************** *** 250,255 **** SZ.Print(Globals.cls.netchan.message, "nextdl"); } else { - String oldn, newn; - try { Globals.cls.download.close(); --- 245,248 ---- *************** *** 259,264 **** // rename the temp file to it's final name ! oldn = DownloadFileName(Globals.cls.downloadtempname); ! newn = DownloadFileName(Globals.cls.downloadname); int r = Lib.rename(oldn, newn); if (r != 0) --- 252,257 ---- // rename the temp file to it's final name ! String oldn = DownloadFileName(Globals.cls.downloadtempname); ! String newn = DownloadFileName(Globals.cls.downloadname); int r = Lib.rename(oldn, newn); if (r != 0) *************** *** 287,294 **** //checked once, was ok. public static void ParseServerData() { - - String str; - int i; - Com.DPrintf("ParseServerData():Serverdata packet received.\n"); // --- 280,283 ---- *************** *** 299,303 **** // parse protocol version number ! i = MSG.ReadLong(Globals.net_message); Globals.cls.serverProtocol = i; --- 288,292 ---- // parse protocol version number ! int i = MSG.ReadLong(Globals.net_message); Globals.cls.serverProtocol = i; *************** *** 312,316 **** // game directory ! str = MSG.ReadString(Globals.net_message); Globals.cl.gamedir = str; Com.dprintln("gamedir=" + str); --- 301,305 ---- // game directory ! String str = MSG.ReadString(Globals.net_message); Globals.cl.gamedir = str; Com.dprintln("gamedir=" + str); *************** *** 350,361 **** */ public static void ParseBaseline() { - entity_state_t es; - int newnum; - entity_state_t nullstate = new entity_state_t(null); //memset(nullstate, 0, sizeof(nullstate)); int bits[] = { 0 }; ! newnum = CL_ents.ParseEntityBits(bits); ! es = Globals.cl_entities[newnum].baseline; CL_ents.ParseDelta(nullstate, es, newnum, bits[0]); } --- 339,347 ---- */ public static void ParseBaseline() { entity_state_t nullstate = new entity_state_t(null); //memset(nullstate, 0, sizeof(nullstate)); int bits[] = { 0 }; ! int newnum = CL_ents.ParseEntityBits(bits); ! entity_state_t es = Globals.cl_entities[newnum].baseline; CL_ents.ParseDelta(nullstate, es, newnum, bits[0]); } *************** *** 367,373 **** */ public static void LoadClientinfo(clientinfo_t ci, String s) { - int i; - int t; - //char model_name[MAX_QPATH]; //char skin_name[MAX_QPATH]; --- 353,356 ---- *************** *** 385,389 **** //ci.name[sizeof(ci.name) - 1] = 0; ! t = s.indexOf('\\'); //t = strstr(s, "\\"); --- 368,372 ---- //ci.name[sizeof(ci.name) - 1] = 0; ! int t = s.indexOf('\\'); //t = strstr(s, "\\"); *************** *** 463,467 **** // weapon file ! for (i = 0; i < CL_view.num_cl_weaponmodels; i++) { weapon_filename = "players/" + model_name + "/" + CL_view.cl_weaponmodels[i]; --- 446,450 ---- // weapon file ! for (int i = 0; i < CL_view.num_cl_weaponmodels; i++) { weapon_filename = "players/" + model_name + "/" + CL_view.cl_weaponmodels[i]; *************** *** 500,509 **** */ public static void ParseClientinfo(int player) { ! String s; ! clientinfo_t ci; ! ! s = Globals.cl.configstrings[player + Defines.CS_PLAYERSKINS]; ! ci = Globals.cl.clientinfo[player]; LoadClientinfo(ci, s); --- 483,489 ---- */ public static void ParseClientinfo(int player) { ! String s = Globals.cl.configstrings[player + Defines.CS_PLAYERSKINS]; ! clientinfo_t ci = Globals.cl.clientinfo[player]; LoadClientinfo(ci, s); *************** *** 514,529 **** */ public static void ParseConfigString() { ! int i; ! String s; ! String olds; ! ! i = MSG.ReadShort(Globals.net_message); if (i < 0 || i >= Defines.MAX_CONFIGSTRINGS) Com.Error(Defines.ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); ! s = MSG.ReadString(Globals.net_message); ! olds = Globals.cl.configstrings[i]; Globals.cl.configstrings[i] = s; --- 494,505 ---- */ public static void ParseConfigString() { ! int i = MSG.ReadShort(Globals.net_message); if (i < 0 || i >= Defines.MAX_CONFIGSTRINGS) Com.Error(Defines.ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); ! String s = MSG.ReadString(Globals.net_message); ! String olds = Globals.cl.configstrings[i]; Globals.cl.configstrings[i] = s; *************** *** 577,591 **** */ public static void ParseStartSoundPacket() { ! float pos[]; ! int channel, ent; ! int sound_num; ! float volume; ! float attenuation; ! int flags; ! float ofs; ! ! flags = MSG.ReadByte(Globals.net_message); ! sound_num = MSG.ReadByte(Globals.net_message); if ((flags & Defines.SND_VOLUME) != 0) volume = MSG.ReadByte(Globals.net_message) / 255.0f; --- 553,560 ---- */ public static void ParseStartSoundPacket() { ! int flags = MSG.ReadByte(Globals.net_message); ! int sound_num = MSG.ReadByte(Globals.net_message); + float volume; if ((flags & Defines.SND_VOLUME) != 0) volume = MSG.ReadByte(Globals.net_message) / 255.0f; *************** *** 593,596 **** --- 562,566 ---- volume = Defines.DEFAULT_SOUND_PACKET_VOLUME; + float attenuation; if ((flags & Defines.SND_ATTENUATION) != 0) attenuation = MSG.ReadByte(Globals.net_message) / 64.0f; *************** *** 598,601 **** --- 568,572 ---- attenuation = Defines.DEFAULT_SOUND_PACKET_ATTENUATION; + float ofs; if ((flags & Defines.SND_OFFSET) != 0) ofs = MSG.ReadByte(Globals.net_message) / 1000.0f; *************** *** 603,606 **** --- 574,579 ---- ofs = 0; + int channel; + int ent; if ((flags & Defines.SND_ENT) != 0) { // entity reletive channel = MSG.ReadShort(Globals.net_message); *************** *** 616,619 **** --- 589,593 ---- } + float pos[]; if ((flags & Defines.SND_POS) != 0) { // positioned in space MSG.ReadPos(Globals.net_message, pos_v); *************** *** 640,647 **** */ public static void ParseServerMessage() { - int cmd; - String s; - int i; - // // if recording demos, copy the message out --- 614,617 ---- *************** *** 662,666 **** } ! cmd = MSG.ReadByte(Globals.net_message); if (cmd == -1) { --- 632,636 ---- } ! int cmd = MSG.ReadByte(Globals.net_message); if (cmd == -1) { *************** *** 708,712 **** case Defines.svc_print: ! i = MSG.ReadByte(Globals.net_message); if (i == Defines.PRINT_CHAT) { S.StartLocalSound("misc/talk.wav"); --- 678,682 ---- case Defines.svc_print: ! int i = MSG.ReadByte(Globals.net_message); if (i == Defines.PRINT_CHAT) { S.StartLocalSound("misc/talk.wav"); *************** *** 722,726 **** case Defines.svc_stufftext: ! s = MSG.ReadString(Globals.net_message); Com.DPrintf("stufftext: " + s + "\n"); Cbuf.AddText(s); --- 692,696 ---- case Defines.svc_stufftext: ! String s = MSG.ReadString(Globals.net_message); Com.DPrintf("stufftext: " + s + "\n"); Cbuf.AddText(s); *************** *** 769,774 **** case Defines.svc_layout: ! s = MSG.ReadString(Globals.net_message); ! Globals.cl.layout = s; break; --- 739,743 ---- case Defines.svc_layout: ! Globals.cl.layout = MSG.ReadString(Globals.net_message); break; |