From: Holger Z. <hz...@us...> - 2004-09-06 19:40:04
|
Update of /cvsroot/jake2/jake2/src/jake2/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2637/src/jake2/server Modified Files: Tag: r_0_9 SV_CCMDS.java SV_MAIN.java SV_WORLD.java SV_INIT.java SV_GAME.java SV_SEND.java SV_ENTS.java client_t.java SV.java SV_USER.java Removed Files: Tag: r_0_9 scrap.jpage Log Message: merge changes for 0.9.3 Index: SV_WORLD.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_WORLD.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** SV_WORLD.java 9 Jul 2004 08:38:25 -0000 1.3.2.1 --- SV_WORLD.java 6 Sep 2004 19:39:18 -0000 1.3.2.2 *************** *** 24,36 **** package jake2.server; - import jake2.game.edict_t; - import jake2.game.trace_t; - - import jake2.*; - import jake2.client.*; import jake2.game.*; ! import jake2.qcommon.*; ! import jake2.render.*; ! import jake2.util.Vargs; public class SV_WORLD extends SV_CCMDS --- 24,30 ---- package jake2.server; import jake2.game.*; ! import jake2.qcommon.CM; ! import jake2.qcommon.Com; public class SV_WORLD extends SV_CCMDS *************** *** 177,180 **** --- 171,175 ---- if (null == ent.area.prev) return; // not linked in anywhere + RemoveLink(ent.area); ent.area.prev= ent.area.next= null; *************** *** 202,206 **** SV_UnlinkEdict(ent); // unlink from old position ! if (ent == ge.edicts[0]) return; // don't add the world --- 197,201 ---- SV_UnlinkEdict(ent); // unlink from old position ! if (ent == GameBase.g_edicts[0]) return; // don't add the world *************** *** 213,217 **** // encode the size into the entity_state for client prediction if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER)) ! { // assume that x/y are equal and symetric int i= (int) (ent.maxs[0] / 8); if (i < 1) --- 208,213 ---- // encode the size into the entity_state for client prediction if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER)) ! { ! // assume that x/y are equal and symetric int i= (int) (ent.maxs[0] / 8); if (i < 1) *************** *** 245,249 **** // set the abs box if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0)) ! { // expand for rotation float max, v; --- 241,246 ---- // set the abs box if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0)) ! { ! // expand for rotation float max, v; *************** *** 265,269 **** } else ! { // normal VectorAdd(ent.s.origin, ent.mins, ent.absmin); VectorAdd(ent.s.origin, ent.maxs, ent.absmax); --- 262,267 ---- } else ! { ! // normal VectorAdd(ent.s.origin, ent.mins, ent.absmin); VectorAdd(ent.s.origin, ent.maxs, ent.absmax); *************** *** 285,289 **** ent.areanum2= 0; ! //get all leafs, including solids int iw[] = {topnode}; --- 283,287 ---- ent.areanum2= 0; ! // get all leafs, including solids int iw[] = {topnode}; *************** *** 660,664 **** // clip to world clip.trace= CM.BoxTrace(start, end, mins, maxs, 0, contentmask); ! clip.trace.ent= ge.edicts[0]; if (clip.trace.fraction == 0) return clip.trace; // blocked by the world --- 658,662 ---- // clip to world clip.trace= CM.BoxTrace(start, end, mins, maxs, 0, contentmask); ! clip.trace.ent= GameBase.g_edicts[0]; if (clip.trace.fraction == 0) return clip.trace; // blocked by the world Index: SV_MAIN.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_MAIN.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** SV_MAIN.java 9 Jul 2004 08:38:25 -0000 1.2.2.1 --- SV_MAIN.java 6 Sep 2004 19:39:18 -0000 1.2.2.2 *************** *** 90,94 **** // call the prog function for removing a client // this will remove the body, among other things ! SV_GAME.ge.ClientDisconnect(drop.edict); } --- 90,94 ---- // call the prog function for removing a client // this will remove the body, among other things ! PlayerClient.ClientDisconnect(drop.edict); } *************** *** 364,373 **** //edictnum = (newcl-svs.clients)+1; int edictnum = i + 1; ! edict_t ent = ge.edicts[edictnum]; svs.clients[i].edict = ent; svs.clients[i].challenge = challenge; // save challenge for checksumming // get the game a chance to reject this connection or modify the userinfo ! if (!(ge.ClientConnect(ent, userinfo))) { if (Info.Info_ValueForKey(userinfo, "rejmsg") != null) Netchan.OutOfBandPrint( --- 364,373 ---- //edictnum = (newcl-svs.clients)+1; int edictnum = i + 1; ! edict_t ent = GameBase.g_edicts[edictnum]; svs.clients[i].edict = ent; svs.clients[i].challenge = challenge; // save challenge for checksumming // get the game a chance to reject this connection or modify the userinfo ! if (!(PlayerClient.ClientConnect(ent, userinfo))) { if (Info.Info_ValueForKey(userinfo, "rejmsg") != null) Netchan.OutOfBandPrint( *************** *** 445,450 **** for (i = 2; i < Cmd.Argc(); i++) { ! strcat(remaining, Cmd.Argv(i)); ! strcat(remaining, " "); } --- 445,450 ---- for (i = 2; i < Cmd.Argc(); i++) { ! remaining += Cmd.Argv(i); ! remaining += " "; } *************** *** 671,676 **** int i; ! for (i = 0; i < ge.num_edicts; i++) { ! ent = SV_GAME.ge.edicts[i]; // events only last for a single message ent.s.event = 0; --- 671,676 ---- int i; ! for (i = 0; i < GameBase.num_edicts; i++) { ! ent = GameBase.g_edicts[i]; // events only last for a single message ent.s.event = 0; *************** *** 697,701 **** // don't run if paused if (0 == sv_paused.value || maxclients.value > 1) { ! ge.RunFrame(); // never get more than one tic behind --- 697,701 ---- // don't run if paused if (0 == sv_paused.value || maxclients.value > 1) { ! Game.G_RunFrame(); // never get more than one tic behind *************** *** 863,867 **** // call prog code to allow overrides ! SV_GAME.ge.ClientUserinfoChanged(cl.edict, cl.userinfo); // name for C code --- 863,867 ---- // call prog code to allow overrides ! PlayerClient.ClientUserinfoChanged(cl.edict, cl.userinfo); // name for C code *************** *** 1007,1013 **** //memset (&sv, 0, sizeof(sv)); sv = new server_t(); - ! Com.SetServerState (sv.state); // free server static data --- 1007,1012 ---- //memset (&sv, 0, sizeof(sv)); sv = new server_t(); ! Globals.server_state= sv.state; // free server static data Index: SV_INIT.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_INIT.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** SV_INIT.java 9 Jul 2004 08:38:24 -0000 1.3.2.1 --- SV_INIT.java 6 Sep 2004 19:39:18 -0000 1.3.2.2 *************** *** 24,42 **** package jake2.server; ! import java.io.IOException; ! import java.io.RandomAccessFile; ! ! import jake2.*; ! import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; - import jake2.render.*; import jake2.sys.NET; - import jake2.util.Lib; ! public class SV_INIT extends Globals { ! public static server_static_t svs = new server_static_t(); // persistant server info ! public static server_t sv = new server_t(); // local server /* --- 24,41 ---- package jake2.server; ! import jake2.Globals; ! import jake2.client.CL; ! import jake2.client.SCR; import jake2.game.*; import jake2.qcommon.*; import jake2.sys.NET; ! import java.io.IOException; ! import java.io.RandomAccessFile; ! public class SV_INIT extends Globals { ! ! public static server_static_t svs= new server_static_t(); // persistant server info ! public static server_t sv= new server_t(); // local server /* *************** *** 52,56 **** return 0; ! for (i = 1; i < max && sv.configstrings[start + i] != null; i++) if (0 == strcmp(sv.configstrings[start + i], name)) return i; --- 51,55 ---- return 0; ! for (i= 1; i < max && sv.configstrings[start + i] != null; i++) if (0 == strcmp(sv.configstrings[start + i], name)) return i; *************** *** 63,67 **** //strncpy (sv.configstrings[start+i], name, sizeof(sv.configstrings[i])); ! sv.configstrings[start + i] = name; if (sv.state != ss_loading) { // send the update to everyone --- 62,66 ---- //strncpy (sv.configstrings[start+i], name, sizeof(sv.configstrings[i])); ! sv.configstrings[start + i]= name; if (sv.state != ss_loading) { // send the update to everyone *************** *** 101,107 **** int entnum; ! for (entnum = 1; entnum < SV_GAME.ge.num_edicts; entnum++) { //svent = EDICT_NUM(entnum); ! svent = SV_GAME.ge.edicts[entnum]; if (!svent.inuse) --- 100,106 ---- int entnum; ! for (entnum= 1; entnum < GameBase.num_edicts; entnum++) { //svent = EDICT_NUM(entnum); ! svent= GameBase.g_edicts[entnum]; if (!svent.inuse) *************** *** 109,113 **** if (0 == svent.s.modelindex && 0 == svent.s.sound && 0 == svent.s.effects) continue; ! svent.s.number = entnum; // --- 108,112 ---- if (0 == svent.s.modelindex && 0 == svent.s.sound && 0 == svent.s.effects) continue; ! svent.s.number= entnum; // *************** *** 116,120 **** VectorCopy(svent.s.origin, svent.s.old_origin); // rst: bugfix ! sv.baselines[entnum].set(svent.s);// = svent.s.getClone(); } } --- 115,119 ---- VectorCopy(svent.s.origin, svent.s.old_origin); // rst: bugfix ! sv.baselines[entnum].set(svent.s); // = svent.s.getClone(); } } *************** *** 126,132 **** */ public static void SV_CheckForSavegame() { ! //char name[MAX_OSPATH]; String name; - //FILE *f; RandomAccessFile f; --- 125,130 ---- */ public static void SV_CheckForSavegame() { ! String name; RandomAccessFile f; *************** *** 139,149 **** return; ! name = FS.Gamedir() + "/save/current/" + sv.name + ".sav"; try { ! f = new RandomAccessFile(name, "r"); } catch (Exception e) { ! return; // no savegame } --- 137,147 ---- return; ! name= FS.Gamedir() + "/save/current/" + sv.name + ".sav"; try { ! f= new RandomAccessFile(name, "r"); } catch (Exception e) { ! return; } *************** *** 168,177 **** int previousState; // PGM ! previousState = sv.state; // PGM ! sv.state = ss_loading; // PGM ! for (i = 0; i < 100; i++) ! SV_GAME.ge.RunFrame(); ! sv.state = previousState; // PGM } } --- 166,175 ---- int previousState; // PGM ! previousState= sv.state; // PGM ! sv.state= ss_loading; // PGM ! for (i= 0; i < 100; i++) ! Game.G_RunFrame(); ! sv.state= previousState; // PGM } } *************** *** 186,197 **** ================ */ ! public static void SV_SpawnServer( ! String server, ! String spawnpoint, ! int serverstate, ! boolean attractloop, ! boolean loadgame) { int i; ! int checksum = 0; if (attractloop) --- 184,190 ---- ================ */ ! public static void SV_SpawnServer(String server, String spawnpoint, int serverstate, boolean attractloop, boolean loadgame) { int i; ! int checksum= 0; if (attractloop) *************** *** 210,265 **** svs.spawncount++; // any partially connected client will be // restarted ! sv.state = ss_dead; ! ! Com.SetServerState(sv.state); // wipe the entire per-level structure //memset(sv, 0, sizeof(sv)); ! sv = new server_t(); ! ! svs.realtime = 0; ! sv.loadgame = loadgame; ! sv.attractloop = attractloop; // save name for levels that don't set message sv.configstrings[CS_NAME]= server; ! ! if (Cvar.VariableValue("deathmatch")!=0) { ! sv.configstrings[CS_AIRACCEL] = ""+SV_MAIN.sv_airaccelerate.value; ! PMove.pm_airaccelerate = SV_MAIN.sv_airaccelerate.value; } else { ! sv.configstrings[CS_AIRACCEL] = "0"; ! PMove.pm_airaccelerate = 0; } SZ.Init(sv.multicast, sv.multicast_buf, sv.multicast_buf.length); ! sv.name = server; // leave slots at start for clients only ! for (i = 0; i < SV_MAIN.maxclients.value; i++) { // needs to reconnect if (svs.clients[i].state > cs_connected) ! svs.clients[i].state = cs_connected; ! svs.clients[i].lastframe = -1; } ! sv.time = 1000; ! sv.name=server; ! sv.configstrings[CS_NAME] = server; ! ! int iw[] = {checksum}; if (serverstate != ss_game) { ! sv.models[1] = CM.CM_LoadMap("", false, iw); // no real map } else { ! sv.configstrings[CS_MODELS + 1] = "maps/" + server + ".bsp"; ! sv.models[1] = CM.CM_LoadMap(sv.configstrings[CS_MODELS + 1], false, iw); } ! checksum = iw[0]; ! sv.configstrings[CS_MAPCHECKSUM] = "" + checksum; // --- 203,259 ---- svs.spawncount++; // any partially connected client will be // restarted ! ! sv.state= ss_dead; ! ! Globals.server_state= sv.state; // wipe the entire per-level structure //memset(sv, 0, sizeof(sv)); ! sv= new server_t(); ! ! svs.realtime= 0; ! sv.loadgame= loadgame; ! sv.attractloop= attractloop; // save name for levels that don't set message sv.configstrings[CS_NAME]= server; ! ! if (Cvar.VariableValue("deathmatch") != 0) { ! sv.configstrings[CS_AIRACCEL]= "" + SV_MAIN.sv_airaccelerate.value; ! PMove.pm_airaccelerate= SV_MAIN.sv_airaccelerate.value; } else { ! sv.configstrings[CS_AIRACCEL]= "0"; ! PMove.pm_airaccelerate= 0; } SZ.Init(sv.multicast, sv.multicast_buf, sv.multicast_buf.length); ! sv.name= server; // leave slots at start for clients only ! for (i= 0; i < SV_MAIN.maxclients.value; i++) { // needs to reconnect if (svs.clients[i].state > cs_connected) ! svs.clients[i].state= cs_connected; ! svs.clients[i].lastframe= -1; } ! sv.time= 1000; ! sv.name= server; ! sv.configstrings[CS_NAME]= server; ! ! int iw[]= { checksum }; if (serverstate != ss_game) { ! sv.models[1]= CM.CM_LoadMap("", false, iw); // no real map } else { ! sv.configstrings[CS_MODELS + 1]= "maps/" + server + ".bsp"; ! sv.models[1]= CM.CM_LoadMap(sv.configstrings[CS_MODELS + 1], false, iw); } ! checksum= iw[0]; ! sv.configstrings[CS_MAPCHECKSUM]= "" + checksum; // *************** *** 268,275 **** SV_WORLD.SV_ClearWorld(); ! for (i = 1; i < CM.CM_NumInlineModels(); i++) { ! sv.configstrings[CS_MODELS + 1 + i] = "*" + i; // copy references ! sv.models[i + 1] = CM.InlineModel(sv.configstrings[CS_MODELS + 1 + i]); } --- 262,269 ---- SV_WORLD.SV_ClearWorld(); ! for (i= 1; i < CM.CM_NumInlineModels(); i++) { ! sv.configstrings[CS_MODELS + 1 + i]= "*" + i; // copy references ! sv.models[i + 1]= CM.InlineModel(sv.configstrings[CS_MODELS + 1 + i]); } *************** *** 280,296 **** // precache and static commands can be issued during // map initialization ! sv.state = ss_loading; ! Com.SetServerState(sv.state); // load and spawn all other entities ! SV_GAME.ge.SpawnEntities(sv.name, CM.CM_EntityString(), spawnpoint); // run two frames to allow everything to settle ! SV_GAME.ge.RunFrame(); ! SV_GAME.ge.RunFrame(); // all precaches are complete ! sv.state = serverstate; ! Com.SetServerState(sv.state); // create a baseline for more efficient communications --- 274,291 ---- // precache and static commands can be issued during // map initialization ! ! sv.state= ss_loading; ! Globals.server_state= sv.state; // load and spawn all other entities ! Game.SpawnEntities(sv.name, CM.CM_EntityString(), spawnpoint); // run two frames to allow everything to settle ! Game.G_RunFrame(); ! Game.G_RunFrame(); // all precaches are complete ! sv.state= serverstate; ! Globals.server_state= sv.state; // create a baseline for more efficient communications *************** *** 315,319 **** public static void SV_InitGame() { int i; ! edict_t ent; //char idmaster[32]; String idmaster; --- 310,314 ---- public static void SV_InitGame() { int i; ! edict_t ent; //char idmaster[32]; String idmaster; *************** *** 332,338 **** Cvar.GetLatchedVars(); ! svs.initialized = true; ! if (Cvar.VariableValue("coop")!=0 && Cvar.VariableValue("deathmatch")!=0) { Com.Printf("Deathmatch and Coop both set, disabling Coop\n"); Cvar.FullSet("coop", "0", CVAR_SERVERINFO | CVAR_LATCH); --- 327,333 ---- Cvar.GetLatchedVars(); ! svs.initialized= true; ! if (Cvar.VariableValue("coop") != 0 && Cvar.VariableValue("deathmatch") != 0) { Com.Printf("Deathmatch and Coop both set, disabling Coop\n"); Cvar.FullSet("coop", "0", CVAR_SERVERINFO | CVAR_LATCH); *************** *** 341,357 **** // dedicated servers are can't be single player and are usually DM // so unless they explicity set coop, force it to deathmatch ! if (dedicated.value!=0) { ! if (0==Cvar.VariableValue("coop")) Cvar.FullSet("deathmatch", "1", CVAR_SERVERINFO | CVAR_LATCH); } // init clients ! if (Cvar.VariableValue("deathmatch")!=0) { if (SV_MAIN.maxclients.value <= 1) Cvar.FullSet("maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH); else if (SV_MAIN.maxclients.value > MAX_CLIENTS) ! Cvar.FullSet("maxclients", "" + MAX_CLIENTS, CVAR_SERVERINFO | CVAR_LATCH); } ! else if (Cvar.VariableValue("coop")!=0) { if (SV_MAIN.maxclients.value <= 1 || SV_MAIN.maxclients.value > 4) Cvar.FullSet("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); --- 336,352 ---- // dedicated servers are can't be single player and are usually DM // so unless they explicity set coop, force it to deathmatch ! if (dedicated.value != 0) { ! if (0 == Cvar.VariableValue("coop")) Cvar.FullSet("deathmatch", "1", CVAR_SERVERINFO | CVAR_LATCH); } // init clients ! if (Cvar.VariableValue("deathmatch") != 0) { if (SV_MAIN.maxclients.value <= 1) Cvar.FullSet("maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH); else if (SV_MAIN.maxclients.value > MAX_CLIENTS) ! Cvar.FullSet("maxclients", "" + MAX_CLIENTS, CVAR_SERVERINFO | CVAR_LATCH); } ! else if (Cvar.VariableValue("coop") != 0) { if (SV_MAIN.maxclients.value <= 1 || SV_MAIN.maxclients.value > 4) Cvar.FullSet("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); *************** *** 363,378 **** } ! svs.spawncount = rand(); //svs.clients = Z_Malloc(sizeof(client_t) * maxclients.value); ! svs.clients = new client_t[(int) SV_MAIN.maxclients.value]; ! for (int n=0; n < svs.clients.length; n++) svs.clients[n]= new client_t(); ! ! svs.num_client_entities = ((int) SV_MAIN.maxclients.value) * UPDATE_BACKUP * 64; //ok. ! //svs.client_entities = Z_Malloc(sizeof(entity_state_t) * svs.num_client_entities); ! svs.client_entities = new entity_state_t[svs.num_client_entities]; ! for (int n=0; n < svs.client_entities.length; n++) ! svs.client_entities[n] = new entity_state_t(null); // init network stuff --- 358,373 ---- } ! svs.spawncount= rand(); //svs.clients = Z_Malloc(sizeof(client_t) * maxclients.value); ! svs.clients= new client_t[(int) SV_MAIN.maxclients.value]; ! for (int n= 0; n < svs.clients.length; n++) svs.clients[n]= new client_t(); ! ! svs.num_client_entities= ((int) SV_MAIN.maxclients.value) * UPDATE_BACKUP * 64; //ok. ! //svs.client_entities = Z_Malloc(sizeof(entity_state_t) * svs.num_client_entities); ! svs.client_entities= new entity_state_t[svs.num_client_entities]; ! for (int n= 0; n < svs.client_entities.length; n++) ! svs.client_entities[n]= new entity_state_t(null); // init network stuff *************** *** 380,397 **** // heartbeats will always be sent to the id master ! svs.last_heartbeat = -99999; // send immediately ! idmaster = "192.246.40.37:" + PORT_MASTER; NET.StringToAdr(idmaster, SV_MAIN.master_adr[0]); // init game SV_GAME.SV_InitGameProgs(); // bis hier alles ok! ! ! for (i = 0; i < SV_MAIN.maxclients.value; i++) { ! ent = SV_GAME.ge.edicts[i + 1]; ! //ent.s.number = i + 1; //dont need this, ent.s.number already set. ! svs.clients[i].edict = ent; //memset(& svs.clients[i].lastcmd, 0, sizeof(svs.clients[i].lastcmd)); ! svs.clients[i].lastcmd = new usercmd_t(); } } --- 375,392 ---- // heartbeats will always be sent to the id master ! svs.last_heartbeat= -99999; // send immediately ! idmaster= "192.246.40.37:" + PORT_MASTER; NET.StringToAdr(idmaster, SV_MAIN.master_adr[0]); // init game SV_GAME.SV_InitGameProgs(); // bis hier alles ok! ! ! for (i= 0; i < SV_MAIN.maxclients.value; i++) { ! ent= GameBase.g_edicts[i + 1]; ! //ent.s.number = i + 1; //dont need this, ent.s.number already set. ! svs.clients[i].edict= ent; //memset(& svs.clients[i].lastcmd, 0, sizeof(svs.clients[i].lastcmd)); ! svs.clients[i].lastcmd= new usercmd_t(); } } *************** *** 421,431 **** String level, ch, spawnpoint; ! sv.loadgame = loadgame; ! sv.attractloop = attractloop; if (sv.state == ss_dead && !sv.loadgame) SV_InitGame(); // the game is just starting ! level = levelstring; // bis hier her ok. // if there is a + in the map, set nextserver to the remainder --- 416,426 ---- String level, ch, spawnpoint; ! sv.loadgame= loadgame; ! sv.attractloop= attractloop; if (sv.state == ss_dead && !sv.loadgame) SV_InitGame(); // the game is just starting ! level= levelstring; // bis hier her ok. // if there is a + in the map, set nextserver to the remainder *************** *** 441,448 **** // Cvar_Set ("nextserver", ""); ! int c = level.indexOf('+'); if (c != -1) { ! Cvar.Set("nextserver","gamemap \"" + level.substring(c+1) + "\""); ! level = level.substring(0, c); } else { --- 436,443 ---- // Cvar_Set ("nextserver", ""); ! int c= level.indexOf('+'); if (c != -1) { ! Cvar.Set("nextserver", "gamemap \"" + level.substring(c + 1) + "\""); ! level= level.substring(0, c); } else { *************** *** 451,474 **** //ZOID special hack for end game screen in coop mode ! if (Cvar.VariableValue("coop")!=0 && !level.equals( "victory.pcx")) Cvar.Set("nextserver", "gamemap \"*base1\""); // if there is a $, use the remainder as a spawnpoint ! int pos = level.indexOf('$'); ! if (pos!=-1) { //* ch = 0; ! spawnpoint = level.substring(pos + 1); ! level = level.substring(0,pos); ! } else //spawnpoint[0] = 0; ! spawnpoint = ""; // skip the end-of-unit flag if necessary if (level.charAt(0) == '*') ! level = level.substring(1); ! l = level.length(); if (l > 4 && level.endsWith(".cin")) { SCR.BeginLoadingPlaque(); // for local system --- 446,469 ---- //ZOID special hack for end game screen in coop mode ! if (Cvar.VariableValue("coop") != 0 && !level.equals("victory.pcx")) Cvar.Set("nextserver", "gamemap \"*base1\""); // if there is a $, use the remainder as a spawnpoint ! int pos= level.indexOf('$'); ! if (pos != -1) { //* ch = 0; ! spawnpoint= level.substring(pos + 1); ! level= level.substring(0, pos); ! } else //spawnpoint[0] = 0; ! spawnpoint= ""; // skip the end-of-unit flag if necessary if (level.charAt(0) == '*') ! level= level.substring(1); ! l= level.length(); if (l > 4 && level.endsWith(".cin")) { SCR.BeginLoadingPlaque(); // for local system Index: SV.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** SV.java 8 Jul 2004 15:58:45 -0000 1.2 --- SV.java 6 Sep 2004 19:39:18 -0000 1.2.2.1 *************** *** 5,9 **** * $Id$ */ ! /* Copyright (C) 1997-2001 Id Software, Inc. --- 5,9 ---- * $Id$ */ ! /* Copyright (C) 1997-2001 Id Software, Inc. [...2073 lines suppressed...] ====================== ! *///ok ! public static boolean SV_CloseEnough(edict_t ent, edict_t goal, float dist) { int i; ! ! for (i = 0; i < 3; i++) { if (goal.absmin[i] > ent.absmax[i] + dist) return false; --- 1193,1203 ---- ====================== ! */ //ok ! public static boolean SV_CloseEnough(edict_t ent, edict_t goal, float dist) ! { int i; ! ! for (i= 0; i < 3; i++) ! { if (goal.absmin[i] > ent.absmax[i] + dist) return false; Index: SV_CCMDS.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_CCMDS.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** SV_CCMDS.java 9 Jul 2004 08:38:25 -0000 1.2.2.1 --- SV_CCMDS.java 6 Sep 2004 19:39:18 -0000 1.2.2.2 *************** *** 29,37 **** import jake2.sys.NET; import jake2.sys.Sys; ! import jake2.util.Lib; import jake2.util.Vargs; import java.io.*; ! import java.util.Date; public class SV_CCMDS extends SV_ENTS { --- 29,37 ---- [...1043 lines suppressed...] } *************** *** 1082,1091 **** */ public static void SV_ServerCommand_f() { - if (SV_GAME.ge == null) { - Com.Printf("No game loaded.\n"); - return; - } ! SV_GAME.ge.ServerCommand(); } --- 1052,1057 ---- */ public static void SV_ServerCommand_f() { ! Game.ServerCommand(); } Index: SV_ENTS.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_ENTS.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** SV_ENTS.java 8 Jul 2004 15:58:45 -0000 1.2 --- SV_ENTS.java 6 Sep 2004 19:39:18 -0000 1.2.2.1 *************** *** 24,35 **** package jake2.server; - import java.io.IOException; - - import jake2.*; - import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; ! import jake2.render.*; ! import jake2.util.Vargs; public class SV_ENTS extends SV_USER { --- 24,31 ---- package jake2.server; import jake2.game.*; import jake2.qcommon.*; ! ! import java.io.IOException; public class SV_ENTS extends SV_USER { *************** *** 384,388 **** leafs[i] = CM.CM_LeafCluster(leafs[i]); ! memcpy(fatpvs, CM.CM_ClusterPVS(leafs[0]), longs << 2); // or in all the other leaf bits for (i = 1; i < count; i++) { --- 380,384 ---- leafs[i] = CM.CM_LeafCluster(leafs[i]); ! System.arraycopy(CM.CM_ClusterPVS(leafs[0]), 0, fatpvs, 0, longs << 2); // or in all the other leaf bits for (i = 1; i < count; i++) { *************** *** 461,466 **** c_fullsend = 0; ! for (e = 1; e < SV_GAME.ge.num_edicts; e++) { ! ent = SV_GAME.ge.edicts[e]; // ignore ents without visible models --- 457,462 ---- c_fullsend = 0; ! for (e = 1; e < GameBase.num_edicts; e++) { ! ent = GameBase.g_edicts[e]; // ignore ents without visible models *************** *** 572,578 **** e = 1; ! ent = SV_GAME.ge.edicts[e]; ! while (e < SV_GAME.ge.num_edicts) { // ignore ents without visible models unless they have an effect if (ent.inuse --- 568,574 ---- e = 1; ! ent = GameBase.g_edicts[e]; ! while (e < GameBase.num_edicts) { // ignore ents without visible models unless they have an effect if (ent.inuse *************** *** 583,587 **** e++; ! ent = SV_GAME.ge.edicts[e]; } --- 579,583 ---- e++; ! ent = GameBase.g_edicts[e]; } Index: SV_SEND.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_SEND.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** SV_SEND.java 8 Jul 2004 20:56:54 -0000 1.3 --- SV_SEND.java 6 Sep 2004 19:39:18 -0000 1.3.2.1 *************** *** 41,49 **** */ ! public static byte sv_outputbuf[] = new byte[SV_OUTPUTBUF_LENGTH]; public static void SV_FlushRedirect(int sv_redirected, byte outputbuf[]) { if (sv_redirected == RD_PACKET) { ! String s = ("print\n" + outputbuf); Netchan.Netchan_OutOfBand(NS_SERVER, Netchan.net_from, s.length(), s.getBytes()); } --- 41,49 ---- */ ! public static byte sv_outputbuf[]= new byte[SV_OUTPUTBUF_LENGTH]; public static void SV_FlushRedirect(int sv_redirected, byte outputbuf[]) { if (sv_redirected == RD_PACKET) { ! String s= ("print\n" + outputbuf); Netchan.Netchan_OutOfBand(NS_SERVER, Netchan.net_from, s.length(), s.getBytes()); } *************** *** 104,124 **** // echo to console ! if (dedicated.value!=0) ! { ! ! //char copy[1024]; ! //int i; ! ! // mask off high bits ! //for (i=0 ; i<1023 && string[i] ; i++) ! //copy[i] = string[i]&127; ! //copy[i] = 0; ! //Com_Printf ("%s", copy); ! ! Com.Printf(s); ! } ! for (int i = 0; i < SV_MAIN.maxclients.value; i++) { ! cl = SV_MAIN.svs.clients[i]; if (level < cl.messagelevel) continue; --- 104,123 ---- // echo to console ! if (dedicated.value != 0) { ! //char copy[1024]; ! //int i; ! ! // mask off high bits ! //for (i=0 ; i<1023 && string[i] ; i++) ! //copy[i] = string[i]&127; ! //copy[i] = 0; ! //Com_Printf ("%s", copy); ! ! Com.Printf(s); ! } ! ! for (int i= 0; i < SV_MAIN.maxclients.value; i++) { ! cl= SV_MAIN.svs.clients[i]; if (level < cl.messagelevel) continue; *************** *** 174,186 **** int area1, area2; ! reliable = false; if (to != MULTICAST_ALL_R && to != MULTICAST_ALL) { ! leafnum = CM.CM_PointLeafnum(origin); ! area1 = CM.CM_LeafArea(leafnum); } else { ! leafnum = 0; // just to avoid compiler warnings ! area1 = 0; } --- 173,185 ---- int area1, area2; ! reliable= false; if (to != MULTICAST_ALL_R && to != MULTICAST_ALL) { ! leafnum= CM.CM_PointLeafnum(origin); ! area1= CM.CM_LeafArea(leafnum); } else { ! leafnum= 0; // just to avoid compiler warnings ! area1= 0; } *************** *** 191,224 **** switch (to) { case MULTICAST_ALL_R : ! reliable = true; // intentional fallthrough, no break here case MULTICAST_ALL : ! leafnum = 0; ! mask = null; break; case MULTICAST_PHS_R : ! reliable = true; // intentional fallthrough case MULTICAST_PHS : ! leafnum = CM.CM_PointLeafnum(origin); ! cluster = CM.CM_LeafCluster(leafnum); ! mask = CM.CM_ClusterPHS(cluster); break; case MULTICAST_PVS_R : ! reliable = true; // intentional fallthrough case MULTICAST_PVS : ! leafnum = CM.CM_PointLeafnum(origin); ! cluster = CM.CM_LeafCluster(leafnum); ! mask = CM.CM_ClusterPVS(cluster); break; default : ! mask = null; Com.Error(ERR_FATAL, "SV_Multicast: bad to:" + to + "\n"); } // send the data to all relevent clients ! for (j = 0; j < maxclients.value; j++) { ! client = svs.clients[j]; if (client.state == cs_free || client.state == cs_zombie) --- 190,223 ---- switch (to) { case MULTICAST_ALL_R : ! reliable= true; // intentional fallthrough, no break here case MULTICAST_ALL : ! leafnum= 0; ! mask= null; break; case MULTICAST_PHS_R : ! reliable= true; // intentional fallthrough case MULTICAST_PHS : ! leafnum= CM.CM_PointLeafnum(origin); ! cluster= CM.CM_LeafCluster(leafnum); ! mask= CM.CM_ClusterPHS(cluster); break; case MULTICAST_PVS_R : ! reliable= true; // intentional fallthrough case MULTICAST_PVS : ! leafnum= CM.CM_PointLeafnum(origin); ! cluster= CM.CM_LeafCluster(leafnum); ! mask= CM.CM_ClusterPVS(cluster); break; default : ! mask= null; Com.Error(ERR_FATAL, "SV_Multicast: bad to:" + to + "\n"); } // send the data to all relevent clients ! for (j= 0; j < maxclients.value; j++) { ! client= svs.clients[j]; if (client.state == cs_free || client.state == cs_zombie) *************** *** 228,237 **** if (mask != null) { ! leafnum = CM.CM_PointLeafnum(client.edict.s.origin); ! cluster = CM.CM_LeafCluster(leafnum); ! area2 = CM.CM_LeafArea(leafnum); if (!CM.CM_AreasConnected(area1, area2)) continue; ! // quake2 bugfix if (cluster == -1) --- 227,236 ---- if (mask != null) { ! leafnum= CM.CM_PointLeafnum(client.edict.s.origin); ! cluster= CM.CM_LeafCluster(leafnum); ! area2= CM.CM_LeafArea(leafnum); if (!CM.CM_AreasConnected(area1, area2)) continue; ! // quake2 bugfix if (cluster == -1) *************** *** 288,292 **** int i; int ent; ! float[] origin_v = {0,0,0}; boolean use_phs; --- 287,291 ---- int i; int ent; ! float[] origin_v= { 0, 0, 0 }; boolean use_phs; *************** *** 303,321 **** Com.Error(ERR_FATAL, "SV_StartSound: timeofs = " + timeofs); ! //ent = NUM_FOR_EDICT(entity); ! //TODO: somehow risky (dont know if constant correct index) ! ent = entity.index; ! if ((channel & 8) != 0) // no PHS flag ! { ! use_phs = false; channel &= 7; } else ! use_phs = true; ! sendchan = (ent << 3) | (channel & 7); ! flags = 0; if (volume != Defines.DEFAULT_SOUND_PACKET_VOLUME) flags |= SND_VOLUME; --- 302,318 ---- Com.Error(ERR_FATAL, "SV_StartSound: timeofs = " + timeofs); ! ent= entity.index; ! // no PHS flag ! if ((channel & 8) != 0) { ! use_phs= false; channel &= 7; } else ! use_phs= true; ! sendchan= (ent << 3) | (channel & 7); ! flags= 0; if (volume != Defines.DEFAULT_SOUND_PACKET_VOLUME) flags |= SND_VOLUME; *************** *** 336,343 **** // use the entity origin unless it is a bmodel or explicitly specified if (origin == null) { ! origin = origin_v; if (entity.solid == SOLID_BSP) { ! for (i = 0; i < 3; i++) ! origin_v[i] = entity.s.origin[i] + 0.5f * (entity.mins[i] + entity.maxs[i]); } else { --- 333,340 ---- // use the entity origin unless it is a bmodel or explicitly specified if (origin == null) { ! origin= origin_v; if (entity.solid == SOLID_BSP) { ! for (i= 0; i < 3; i++) ! origin_v[i]= entity.s.origin[i] + 0.5f * (entity.mins[i] + entity.maxs[i]); } else { *************** *** 366,370 **** // (global radio chatter, voiceovers, etc) if (attenuation == ATTN_NONE) ! use_phs = false; if ((channel & CHAN_RELIABLE) != 0) { --- 363,367 ---- // (global radio chatter, voiceovers, etc) if (attenuation == ATTN_NONE) ! use_phs= false; if ((channel & CHAN_RELIABLE) != 0) { *************** *** 396,410 **** */ public static boolean SV_SendClientDatagram(client_t client) { ! byte msg_buf[] = new byte[MAX_MSGLEN]; ! sizebuf_t msg = new sizebuf_t(); SV_ENTS.SV_BuildClientFrame(client); SZ.Init(msg, msg_buf, msg_buf.length); ! msg.allowoverflow = true; // send over all the relevant entity_state_t // and the player_state_t ! SV_CCMDS.SV_WriteFrameToClient (client, msg); // copy the accumulated multicast datagram --- 393,407 ---- */ public static boolean SV_SendClientDatagram(client_t client) { ! byte msg_buf[]= new byte[MAX_MSGLEN]; ! sizebuf_t msg= new sizebuf_t(); SV_ENTS.SV_BuildClientFrame(client); SZ.Init(msg, msg_buf, msg_buf.length); ! msg.allowoverflow= true; // send over all the relevant entity_state_t // and the player_state_t ! SV_CCMDS.SV_WriteFrameToClient(client, msg); // copy the accumulated multicast datagram *************** *** 427,431 **** // record the size for rate estimation ! client.message_size[sv.framenum % RATE_MESSAGES] = msg.cursize; return true; --- 424,428 ---- // record the size for rate estimation ! client.message_size[sv.framenum % RATE_MESSAGES]= msg.cursize; return true; *************** *** 445,449 **** Com.Printf("IOError closing d9emo fiele:" + e); } ! sv.demofile = null; } SV_ENTS.SV_Nextserver(); --- 442,446 ---- Com.Printf("IOError closing d9emo fiele:" + e); } ! sv.demofile= null; } SV_ENTS.SV_Nextserver(); *************** *** 466,472 **** return false; ! total = 0; ! for (i = 0; i < RATE_MESSAGES; i++) { total += c.message_size[i]; } --- 463,469 ---- return false; ! total= 0; ! for (i= 0; i < RATE_MESSAGES; i++) { total += c.message_size[i]; } *************** *** 474,478 **** if (total > c.rate) { c.surpressCount++; ! c.message_size[sv.framenum % RATE_MESSAGES] = 0; return true; } --- 471,475 ---- if (total > c.rate) { c.surpressCount++; ! c.message_size[sv.framenum % RATE_MESSAGES]= 0; return true; } *************** *** 490,507 **** client_t c; int msglen; ! byte msgbuf[] = new byte[MAX_MSGLEN]; int r; ! msglen = 0; // read the next demo message if needed if (sv.state == ss_demo && sv.demofile != null) { if (sv_paused.value != 0) ! msglen = 0; else { // get the next message //r = fread (&msglen, 4, 1, sv.demofile); try { ! msglen = EndianHandler.swapInt(sv.demofile.readInt()); } catch (Exception e) { --- 487,504 ---- client_t c; int msglen; ! byte msgbuf[]= new byte[MAX_MSGLEN]; int r; ! msglen= 0; // read the next demo message if needed if (sv.state == ss_demo && sv.demofile != null) { if (sv_paused.value != 0) ! msglen= 0; else { // get the next message //r = fread (&msglen, 4, 1, sv.demofile); try { ! msglen= EndianHandler.swapInt(sv.demofile.readInt()); } catch (Exception e) { *************** *** 519,525 **** //r = fread (msgbuf, msglen, 1, sv.demofile); ! r = 0; try { ! r = sv.demofile.read(msgbuf, 0, msglen); } catch (IOException e1) { --- 516,522 ---- //r = fread (msgbuf, msglen, 1, sv.demofile); ! r= 0; try { ! r= sv.demofile.read(msgbuf, 0, msglen); } catch (IOException e1) { *************** *** 534,539 **** // send a message to each connected client ! for (i = 0; i < maxclients.value; i++) { ! c = svs.clients[i]; if (c.state == 0) --- 531,536 ---- // send a message to each connected client ! for (i= 0; i < maxclients.value; i++) { ! c= svs.clients[i]; if (c.state == 0) Index: client_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/client_t.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** client_t.java 7 Jul 2004 19:59:50 -0000 1.1 --- client_t.java 6 Sep 2004 19:39:18 -0000 1.1.2.1 *************** *** 44,48 **** int state; - //char userinfo[MAX_INFO_STRING]; // name, etc String userinfo = ""; --- 44,47 ---- *************** *** 86,90 **** netchan_t netchan = new netchan_t(); ! //TODO: this was introduced by rst, since java can't calculate the index out of the address. int serverindex; } --- 85,89 ---- netchan_t netchan = new netchan_t(); ! //this was introduced by rst, since java can't calculate the index out of the address. int serverindex; } Index: SV_USER.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_USER.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** SV_USER.java 9 Jul 2004 08:38:25 -0000 1.3.2.1 --- SV_USER.java 6 Sep 2004 19:39:18 -0000 1.3.2.2 *************** *** 125,129 **** { // set up the entity for the client ! ent= SV_GAME.ge.edicts[playernum + 1]; ent.s.number= playernum + 1; sv_client.edict= ent; --- 125,129 ---- { // set up the entity for the client ! ent= GameBase.g_edicts[playernum + 1]; ent.s.number= playernum + 1; sv_client.edict= ent; *************** *** 270,274 **** // call the game begin function ! SV_GAME.ge.ClientBegin(sv_player); Cbuf.InsertFromDefer(); --- 270,274 ---- // call the game begin function ! PlayerClient.ClientBegin(sv_player); Cbuf.InsertFromDefer(); *************** *** 553,557 **** if (i == ucmds.length && sv.state == ss_game) ! SV_GAME.ge.ClientCommand(sv_player); // SV_EndRedirect (); --- 553,557 ---- if (i == ucmds.length && sv.state == ss_game) ! PlayerClient.ClientCommand(sv_player); // SV_EndRedirect (); *************** *** 576,580 **** } ! SV_GAME.ge.ClientThink(cl.edict, cmd); } --- 576,580 ---- } ! PlayerClient.ClientThink(cl.edict, cmd); } Index: SV_GAME.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_GAME.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** SV_GAME.java 9 Jul 2004 08:38:25 -0000 1.4.2.1 --- SV_GAME.java 6 Sep 2004 19:39:18 -0000 1.4.2.2 *************** *** 24,39 **** package jake2.server; - import jake2.*; - import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; - import jake2.render.*; - import jake2.sys.Sys; public class SV_GAME extends SV_INIT { - // sv_game.c -- interface to the game dll - - public static game_export_t ge; /* --- 24,32 ---- *************** *** 51,55 **** return; - //p = NUM_FOR_EDICT(ent); p = ent.index; if (p < 1 || p > SV_MAIN.maxclients.value) --- 44,47 ---- *************** *** 74,87 **** */ public static void PF_dprintf(String fmt) { - /* - char msg[1024]; - va_list argptr; - - va_start (argptr,fmt); - vsprintf (msg, fmt, argptr); - va_end (argptr); - - */ - Com.Printf(fmt); } --- 66,69 ---- *************** *** 95,105 **** */ public static void PF_cprintf(edict_t ent, int level, String fmt) { ! //char msg[1024]; ! //va_list argptr; int n = 0; if (ent != null) { - - //n = NUM_FOR_EDICT(ent); n = ent.index; if (n < 1 || n > SV_MAIN.maxclients.value) --- 77,84 ---- */ public static void PF_cprintf(edict_t ent, int level, String fmt) { ! int n = 0; if (ent != null) { n = ent.index; if (n < 1 || n > SV_MAIN.maxclients.value) *************** *** 107,114 **** } - // va_start (argptr,fmt); - // vsprintf (msg, fmt, argptr); - // va_end (argptr); - if (ent != null) SV_SEND.SV_ClientPrintf(svs.clients[n - 1], level, fmt); --- 86,89 ---- *************** *** 125,142 **** */ public static void PF_centerprintf(edict_t ent, String fmt) { - //char msg[1024]; - //va_list argptr; int n; - //TODO: NUM_FOR_EDICT - //n = NUM_FOR_EDICT(ent); n = ent.index; if (n < 1 || n > SV_MAIN.maxclients.value) return; // Com_Error (ERR_DROP, "centerprintf to a non-client"); - // va_start (argptr,fmt); - // vsprintf (msg, fmt, argptr); - // va_end (argptr); - MSG.WriteByte(sv.multicast, svc_centerprint); MSG.WriteString(sv.multicast, fmt); --- 100,109 ---- *************** *** 175,179 **** i = SV_ModelIndex(name); - //ent.model = name; ent.s.modelindex = i; --- 142,145 ---- *************** *** 327,335 **** */ public static void SV_ShutdownGameProgs() { ! if (ge == null) ! return; ! ge.Shutdown(); ! Sys.UnloadGame(); ! ge = null; } --- 293,297 ---- */ public static void SV_ShutdownGameProgs() { ! Game.ShutdownGame(); } *************** *** 345,362 **** // unload anything we have now ! if (ge != null) ! SV_ShutdownGameProgs(); game_import_t gimport = new game_import_t(); // all functions set in game_export_t (rst) ! ge = GameBase.GetGameApi(gimport); ! ! if (ge == null) ! Com.Error(ERR_DROP, "failed to load game DLL"); ! if (ge.apiversion != GAME_API_VERSION) ! Com.Error(ERR_DROP, "game is version " + ge.apiversion + " not " + GAME_API_VERSION); ! ge.Init(); } } --- 307,318 ---- // unload anything we have now ! SV_ShutdownGameProgs(); game_import_t gimport = new game_import_t(); // all functions set in game_export_t (rst) ! GameBase.GetGameApi(gimport); ! Game.InitGame(); } } --- scrap.jpage DELETED --- |