]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
-Added sv_playerphysicsqc to control whether the qc physics function is called (if...
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 28 Jun 2005 21:09:58 +0000 (21:09 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 28 Jun 2005 21:09:58 +0000 (21:09 +0000)
-Added support for loading LNO files (more to follow soon).
-The server now tries other ports (up to 100 above default) if the default port cant be bound.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5468 d7cf8633-e32d-0410-b094-e92efae38249

netconn.c
progsvm.h
prvm_edict.c
sv_phys.c
todo

index 870f694f2083d27055aa82bf8037f5994a132926..788b877d3bc2110a32304950a47347da3bf6efb4 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -661,23 +661,32 @@ void NetConn_OpenServerPort(const char *addressstring, int defaultport)
 {
        lhnetaddress_t address;
        lhnetsocket_t *s;
+       int port;
        char addressstring2[1024];
-       if (LHNETADDRESS_FromString(&address, addressstring, defaultport))
+
+       for (port = defaultport; port <= defaultport + 100; port++)
        {
-               if ((s = LHNET_OpenSocket_Connectionless(&address)))
+               if (LHNETADDRESS_FromString(&address, addressstring, port))
                {
-                       sv_sockets[sv_numsockets++] = s;
-                       LHNETADDRESS_ToString(LHNET_AddressFromSocket(s), addressstring2, sizeof(addressstring2), true);
-                       Con_Printf("Server listening on address %s\n", addressstring2);
+                       if ((s = LHNET_OpenSocket_Connectionless(&address)))
+                       {
+                               sv_sockets[sv_numsockets++] = s;
+                               LHNETADDRESS_ToString(LHNET_AddressFromSocket(s), addressstring2, sizeof(addressstring2), true);
+                               Con_Printf("Server listening on address %s\n", addressstring2);
+                       }
+                       else
+                       {
+                               LHNETADDRESS_ToString(&address, addressstring2, sizeof(addressstring2), true);
+                               Con_Printf("Server failed to open socket on address %s\n", addressstring2);
+                       }
                }
-               else
+               else 
                {
-                       LHNETADDRESS_ToString(&address, addressstring2, sizeof(addressstring2), true);
-                       Con_Printf("Server failed to open socket on address %s\n", addressstring2);
+                       Con_Printf("Server unable to parse address %s\n", addressstring);
+                       // if it cant parse one address, it wont be able to parse another for sure
+                       break;
                }
        }
-       else
-               Con_Printf("Server unable to parse address %s\n", addressstring);
 }
 
 void NetConn_OpenServerPorts(int opennetports)
index 1ca690e16668c675847acb343428cf33125bfa8d..077058bc4de8090225b5e0126e87a93383ab9d48 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -261,6 +261,8 @@ typedef struct prvm_prog_s
        int                                     edict_size;                     // in bytes
        int                                     edictareasize;          // LordHavoc: in bytes (for bound checking)
 
+       int                                     *statement_linenums; // NULL if not available
+
        union {
                float *generic;
                globalvars_t *server;
index 2a5e0ca6bbdf458c677717c70949ac41afd85dc7..b570198c140d2a9c8189fd1b6b6e22d11872e7db 100644 (file)
@@ -1221,6 +1221,51 @@ void PRVM_ResetProg()
        memset(prog,0,sizeof(prvm_prog_t));
 }
 
+/*
+===============
+PRVM_LoadLNO
+===============
+*/
+void PRVM_LoadLNO( const char *progname ) {
+       qbyte *lno;
+       unsigned long *header;
+       char filename[512];
+
+       FS_StripExtension( progname, filename, sizeof( filename ) );
+       strlcat( filename, ".lno", sizeof( filename ) );
+
+       lno = FS_LoadFile( filename, tempmempool, false );
+       if( !lno ) {
+               return;
+       }
+
+/*
+<Spike>    SafeWrite (h, &lnotype, sizeof(int));
+<Spike>    SafeWrite (h, &version, sizeof(int));
+<Spike>    SafeWrite (h, &numglobaldefs, sizeof(int));
+<Spike>    SafeWrite (h, &numpr_globals, sizeof(int));
+<Spike>    SafeWrite (h, &numfielddefs, sizeof(int));
+<Spike>    SafeWrite (h, &numstatements, sizeof(int));
+<Spike>    SafeWrite (h, statement_linenums, numstatements*sizeof(int));
+*/
+       if( (unsigned) fs_filesize < (6 + prog->progs->numstatements) * sizeof( long ) ) {
+        return;
+       }
+
+       header = (unsigned long *) lno;
+       if( header[ 0 ] == *(unsigned long *) "LNOF" &&
+               LittleLong( header[ 1 ] ) == 1 &&
+               LittleLong( header[ 2 ] ) == prog->progs->numglobaldefs && 
+               LittleLong( header[ 3 ] ) == prog->progs->numglobals &&
+               LittleLong( header[ 4 ] ) == prog->progs->numfielddefs &&
+               LittleLong( header[ 5 ] ) == prog->progs->numstatements ) 
+       {
+               prog->statement_linenums = Mem_Alloc(prog->progs_mempool, prog->progs->numstatements * sizeof( long ) );
+               memcpy( prog->statement_linenums, (long *) lno + 6, prog->progs->numstatements * sizeof( long ) ); 
+       }
+       Mem_Free( lno );
+}
+
 /*
 ===============
 PRVM_LoadProgs
@@ -1447,6 +1492,8 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required
                }
        }
 
+       PRVM_LoadLNO( filename );
+
        PRVM_Init_Exec();
 
        prog->loaded = TRUE;
index 4f06472aa052fd3f329c4c20fce72a43c9e5ccde..0e37ed3b6dfad40eef7abebd7edf606f15e879cf 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -49,6 +49,7 @@ cvar_t sv_jumpstep = {CVAR_NOTIFY, "sv_jumpstep", "1"};
 cvar_t sv_wallfriction = {CVAR_NOTIFY, "sv_wallfriction", "1"};
 cvar_t sv_newflymove = {CVAR_NOTIFY, "sv_newflymove", "0"};
 cvar_t sv_freezenonclients = {CVAR_NOTIFY, "sv_freezenonclients", "0"};
+cvar_t sv_playerphysicsqc = {CVAR_NOTIFY, "sv_playerphysicsqc", "1"};
 
 #define        MOVE_EPSILON    0.01
 
@@ -61,6 +62,8 @@ void SV_Phys_Init (void)
        Cvar_RegisterVariable(&sv_wallfriction);
        Cvar_RegisterVariable(&sv_newflymove);
        Cvar_RegisterVariable(&sv_freezenonclients);
+
+       Cvar_RegisterVariable(&sv_playerphysicsqc);
 }
 
 /*
@@ -1332,7 +1335,7 @@ void SV_Physics_Entity (prvm_edict_t *ent, qboolean runmove)
                // make sure the velocity is sane (not a NaN)
                SV_CheckVelocity(ent);
                // LordHavoc: QuakeC replacement for SV_ClientThink (player movement)
-               if (SV_PlayerPhysicsQC)
+               if (SV_PlayerPhysicsQC && sv_playerphysicsqc.integer)
                {
                        prog->globals.server->time = sv.time;
                        prog->globals.server->self = PRVM_EDICT_TO_PROG(ent);
diff --git a/todo b/todo
index 0bd3100561faf5bca71d305d428c63d3e6e87867..09e1177a677a876418aeaadbb944636af374b535 100644 (file)
--- a/todo
+++ b/todo
@@ -1,4 +1,5 @@
 - todo: difficulty ratings are: 0 = trivial, 1 = easy, 2 = easy-moderate, 3 = moderate, 4 = moderate-hard, 5 = hard, 6 = hard++, 7 = nightmare, d = done, -d = done but have not notified the people who asked for it, f = failed, -f = failed but have not notified the people who asked for it
+-d feature darkplaces server: add sv_playerphysicsqc cvar to allow engine to ignore SV_PlayerPhysics function, this would also have to change the reported extensions (Gleeb)
 -d (Baalz) bug darkplaces input: figure out what's wrong with ctrl key in Linux, hitting character keys tends to do nothing, and holding a character key and then hitting ctrl tends to leave the character key stuck on, this sounds like a window manager issue, but somehow quake3 works around it (Baalz)
 -d (Gilgamesh) feature darkplaces protocol: add back colormod extension (FrikaC, Uffe, Gilgamesh, Wazat)
 -d (Kinn, romi) bug darkplaces WGL client: default WGL input back to GDI, the DirectInput driver is malfunctioning, losing key release messages, stuttering mouse input, and lacks mouse wheel support (Wazat, Kinn)
 0 feature darkplaces server: add cl_prydoncursor_centeredcursor cvar and PRYDON_CLIENTCURSOR_CENTEREDCURSOR extension (Wazat)
 0 feature darkplaces server: add filename/line number reporting to progs stack and opcode printouts (Spike)
 0 feature darkplaces server: add sv_antilag cvar which would upgrade the aim() builtin to aim at the creature the player's prydon cursor trace was hitting (Spike)
-0 feature darkplaces server: add sv_playerphysicsqc cvar to allow engine to ignore SV_PlayerPhysics function, this would also have to change the reported extensions (Gleeb)
-0 feature darkplaces server: automatically choose a server port if the bind fails, just keep incrementing the port until it finds an available port (tell Spike)
 0 feature darkplaces server: make fopen builtin have the ability to disable fopen builtin access to read /, read data/, write data/, or disable fopen builtin entirely
 0 feature darkplaces server: make noclip/fly cheats use MOVETYPE_CHEATNOCLIP/MOVETYPE_CHEATFLY which would have the nicer movement interface (Spikester)
 0 feature darkplaces sound: Lordhavoc needs to talk to fuh about snd_macos.c (fuh)
 7 feature darkplaces renderer: mirrors (Sajt)
 7 feature darkplaces renderer: shadow volume clipping (romi)
 d bug darkplaces Mac filesystem: on Mac dlopen is not finding dylib files alongside the executable, do a more thorough search (Zenex)
+d feature darkplaces server: automatically choose a server port if the bind fails, just keep incrementing the port until it finds an available port (tell Spike)
 d bug darkplaces Mac filesystem: on Mac init the basedir to argv[0] truncated to not include the *.app/ part of the path onward (Zenex)
 d bug darkplaces SDL input: changing video mode causes it to ignore all character events from then on
 d bug darkplaces X11 keyboard: make sure that the XLookupString code is not little endian specific (Elric, jitspoe)