From: black Date: Tue, 28 Jun 2005 21:09:58 +0000 (+0000) Subject: -Added sv_playerphysicsqc to control whether the qc physics function is called (if... X-Git-Tag: xonotic-v0.1.0preview~4716 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a9d901739e22f3bb631ff5cd3001992cae51c669;p=xonotic%2Fdarkplaces.git -Added sv_playerphysicsqc to control whether the qc physics function is called (if its available). -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 --- diff --git a/netconn.c b/netconn.c index 870f694f..788b877d 100755 --- 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) diff --git a/progsvm.h b/progsvm.h index 1ca690e1..077058bc 100644 --- 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; diff --git a/prvm_edict.c b/prvm_edict.c index 2a5e0ca6..b570198c 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -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; + } + +/* + SafeWrite (h, &lnotype, sizeof(int)); + SafeWrite (h, &version, sizeof(int)); + SafeWrite (h, &numglobaldefs, sizeof(int)); + SafeWrite (h, &numpr_globals, sizeof(int)); + SafeWrite (h, &numfielddefs, sizeof(int)); + SafeWrite (h, &numstatements, sizeof(int)); + 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; diff --git a/sv_phys.c b/sv_phys.c index 4f06472a..0e37ed3b 100644 --- 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 0bd31005..09e1177a 100644 --- 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) @@ -142,8 +143,6 @@ 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) @@ -373,6 +372,7 @@ 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)