2016-11-20 20:52:41 +00:00
# if _MSC_VER >= 1300
# ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
# endif
# ifndef _CRT_NONSTDC_NO_WARNINGS
# define _CRT_NONSTDC_NO_WARNINGS
# endif
# endif
2005-03-01 15:36:23 +00:00
# include "hash.h"
# include <stdlib.h>
# include <string.h>
2005-03-28 00:11:59 +00:00
# ifndef _WIN32
# ifndef stricmp
# define stricmp strcasecmp
# endif
# endif
2008-05-14 18:06:58 +00:00
// hash init assumes we get clean memory
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
void Hash_InitTable ( hashtable_t * table , unsigned int numbucks , void * mem )
2004-08-23 01:38:21 +00:00
{
table - > numbuckets = numbucks ;
table - > bucket = ( bucket_t * * ) mem ;
}
2013-05-03 04:28:08 +00:00
void * Hash_Enumerate ( hashtable_t * table , void ( * callback ) ( void * ctx , void * data ) , void * ctx )
{
unsigned int bucknum ;
bucket_t * buck ;
void * data ;
for ( bucknum = 0 ; bucknum < table - > numbuckets ; bucknum + + )
{
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
data = buck - > data ;
buck = buck - > next ;
//now that we don't care about backlinks etc, we can call the callback and it can safely nuke it (Hash_RemoveData or even destroy the bucket if the hash table is going to die).
callback ( ctx , data ) ;
}
}
return NULL ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int Hash_Key ( const char * name , unsigned int modulus )
2004-08-23 01:38:21 +00:00
{ //fixme: optimize.
unsigned int key ;
for ( key = 0 ; * name ; name + + )
key + = ( ( key < < 3 ) + ( key > > 28 ) + * name ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
return ( key % modulus ) ;
2004-08-23 01:38:21 +00:00
}
2020-10-26 06:30:35 +00:00
unsigned int Hash_KeyInsensitive ( const char * name , unsigned int modulus )
2004-12-05 16:32:44 +00:00
{ //fixme: optimize.
unsigned int key ;
for ( key = 0 ; * name ; name + + )
{
if ( * name > = ' A ' & & * name < = ' Z ' )
key + = ( ( key < < 3 ) + ( key > > 28 ) + ( * name - ' A ' + ' a ' ) ) ;
else
key + = ( ( key < < 3 ) + ( key > > 28 ) + * name ) ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
return ( key % modulus ) ;
2004-12-05 16:32:44 +00:00
}
2004-08-23 01:38:21 +00:00
2013-05-03 04:28:08 +00:00
void * Hash_GetIdx ( hashtable_t * table , unsigned int idx )
{
unsigned int bucknum ;
bucket_t * buck ;
for ( bucknum = 0 ; bucknum < table - > numbuckets ; bucknum + + )
{
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
if ( ! idx - - )
return buck - > data ;
buck = buck - > next ;
}
}
return NULL ;
}
2009-04-01 22:03:56 +00:00
void * Hash_Get ( hashtable_t * table , const char * name )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = Hash_Key ( name , table - > numbuckets ) ;
2004-08-23 01:38:21 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
2007-09-17 20:35:39 +00:00
if ( ! STRCMP ( name , buck - > key . string ) )
2004-08-23 01:38:21 +00:00
return buck - > data ;
buck = buck - > next ;
}
return NULL ;
}
2014-03-30 08:55:06 +00:00
void * Hash_GetInsensitive ( hashtable_t * table , const char * name )
2004-12-05 16:32:44 +00:00
{
2014-03-30 08:55:06 +00:00
unsigned int bucknum = Hash_KeyInsensitive ( name , table - > numbuckets ) ;
2004-12-05 16:32:44 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
2007-09-17 20:35:39 +00:00
if ( ! stricmp ( name , buck - > key . string ) )
2004-12-05 16:32:44 +00:00
return buck - > data ;
buck = buck - > next ;
}
return NULL ;
}
2014-03-30 08:55:06 +00:00
void * Hash_GetInsensitiveBucket ( hashtable_t * table , const char * name )
2012-05-09 15:30:53 +00:00
{
2014-03-30 08:55:06 +00:00
unsigned int bucknum = Hash_KeyInsensitive ( name , table - > numbuckets ) ;
2012-05-09 15:30:53 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
if ( ! stricmp ( name , buck - > key . string ) )
return buck ;
buck = buck - > next ;
}
return NULL ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
void * Hash_GetKey ( hashtable_t * table , unsigned int key )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = key % table - > numbuckets ;
2004-08-23 01:38:21 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
2007-09-17 20:35:39 +00:00
if ( buck - > key . value = = key )
2004-08-23 01:38:21 +00:00
return buck - > data ;
buck = buck - > next ;
}
return NULL ;
}
2010-08-28 17:14:38 +00:00
/*Does _NOT_ support items that are added with two names*/
void * Hash_GetNextKey ( hashtable_t * table , unsigned int key , void * old )
{
unsigned int bucknum = key % table - > numbuckets ;
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
if ( buck - > data = = old ) //found the old one
break ;
buck = buck - > next ;
}
if ( ! buck )
return NULL ;
buck = buck - > next ; //don't return old
while ( buck )
{
if ( buck - > key . value = = key )
return buck - > data ;
buck = buck - > next ;
}
return NULL ;
}
/*Does _NOT_ support items that are added with two names*/
2010-07-11 10:53:13 +00:00
void * Hash_GetNext ( hashtable_t * table , const char * name , void * old )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = Hash_Key ( name , table - > numbuckets ) ;
2004-08-23 01:38:21 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
while ( buck )
{
2010-08-28 17:14:38 +00:00
if ( buck - > data = = old ) //found the old one
// if (!STRCMP(name, buck->key.string))
2004-08-23 01:38:21 +00:00
break ;
buck = buck - > next ;
}
if ( ! buck )
return NULL ;
buck = buck - > next ; //don't return old
while ( buck )
{
2007-09-17 20:35:39 +00:00
if ( ! STRCMP ( name , buck - > key . string ) )
2004-08-23 01:38:21 +00:00
return buck - > data ;
buck = buck - > next ;
}
return NULL ;
}
2010-08-28 17:14:38 +00:00
/*Does _NOT_ support items that are added with two names*/
2014-03-30 08:55:06 +00:00
void * Hash_GetNextInsensitive ( hashtable_t * table , const char * name , void * old )
2004-08-23 01:38:21 +00:00
{
2014-03-30 08:55:06 +00:00
unsigned int bucknum = Hash_KeyInsensitive ( name , table - > numbuckets ) ;
2005-02-09 19:32:30 +00:00
bucket_t * buck ;
2004-08-23 01:38:21 +00:00
2005-02-09 19:32:30 +00:00
buck = table - > bucket [ bucknum ] ;
2004-08-23 01:38:21 +00:00
2005-02-09 19:32:30 +00:00
while ( buck )
{
2010-08-28 17:14:38 +00:00
if ( buck - > data = = old ) //found the old one
2005-02-09 19:32:30 +00:00
{
2010-08-28 17:14:38 +00:00
// if (!stricmp(name, buck->key.string))
2005-02-09 19:32:30 +00:00
break ;
}
2004-08-23 01:38:21 +00:00
2005-02-09 19:32:30 +00:00
buck = buck - > next ;
}
if ( ! buck )
return NULL ;
buck = buck - > next ; //don't return old
while ( buck )
{
2010-08-28 17:14:38 +00:00
if ( ! stricmp ( name , buck - > key . string ) )
2005-02-09 19:32:30 +00:00
return buck - > data ;
buck = buck - > next ;
}
return NULL ;
2004-08-23 01:38:21 +00:00
}
2005-02-09 19:32:30 +00:00
2010-07-11 10:53:13 +00:00
void * Hash_Add ( hashtable_t * table , const char * name , void * data , bucket_t * buck )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = Hash_Key ( name , table - > numbuckets ) ;
2004-08-23 01:38:21 +00:00
buck - > data = data ;
2007-09-17 20:35:39 +00:00
buck - > key . string = name ;
2004-08-23 01:38:21 +00:00
buck - > next = table - > bucket [ bucknum ] ;
table - > bucket [ bucknum ] = buck ;
return buck ;
}
2014-03-30 08:55:06 +00:00
void * Hash_AddInsensitive ( hashtable_t * table , const char * name , void * data , bucket_t * buck )
2004-12-05 16:32:44 +00:00
{
2014-03-30 08:55:06 +00:00
unsigned int bucknum = Hash_KeyInsensitive ( name , table - > numbuckets ) ;
2004-12-05 16:32:44 +00:00
buck - > data = data ;
2007-09-17 20:35:39 +00:00
buck - > key . string = name ;
2004-12-05 16:32:44 +00:00
buck - > next = table - > bucket [ bucknum ] ;
table - > bucket [ bucknum ] = buck ;
return buck ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
void * Hash_AddKey ( hashtable_t * table , unsigned int key , void * data , bucket_t * buck )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = key % table - > numbuckets ;
2004-08-23 01:38:21 +00:00
buck - > data = data ;
2007-09-17 20:35:39 +00:00
buck - > key . value = key ;
2004-08-23 01:38:21 +00:00
buck - > next = table - > bucket [ bucknum ] ;
table - > bucket [ bucknum ] = buck ;
return buck ;
}
2010-07-11 10:53:13 +00:00
void Hash_Remove ( hashtable_t * table , const char * name )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = Hash_Key ( name , table - > numbuckets ) ;
2004-08-23 01:38:21 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
2007-09-17 20:35:39 +00:00
if ( ! STRCMP ( name , buck - > key . string ) )
2004-08-23 01:38:21 +00:00
{
table - > bucket [ bucknum ] = buck - > next ;
return ;
}
while ( buck - > next )
{
2007-09-17 20:35:39 +00:00
if ( ! STRCMP ( name , buck - > next - > key . string ) )
2004-08-23 01:38:21 +00:00
{
buck - > next = buck - > next - > next ;
return ;
}
buck = buck - > next ;
}
return ;
}
2014-03-30 08:55:06 +00:00
void Hash_RemoveDataInsensitive ( hashtable_t * table , const char * name , void * data )
2014-03-01 11:38:53 +00:00
{
2014-03-30 08:55:06 +00:00
unsigned int bucknum = Hash_KeyInsensitive ( name , table - > numbuckets ) ;
2014-03-01 11:38:53 +00:00
bucket_t * * link , * buck ;
for ( link = & table - > bucket [ bucknum ] ; * link ; link = & ( * link ) - > next )
{
buck = * link ;
if ( buck - > data = = data & & ! stricmp ( name , buck - > key . string ) )
{
* link = buck - > next ;
return ;
}
}
}
2010-07-11 10:53:13 +00:00
void Hash_RemoveData ( hashtable_t * table , const char * name , void * data )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = Hash_Key ( name , table - > numbuckets ) ;
2012-05-09 15:30:53 +00:00
bucket_t * * link , * buck ;
2004-08-23 01:38:21 +00:00
2012-05-09 15:30:53 +00:00
for ( link = & table - > bucket [ bucknum ] ; * link ; link = & ( * link ) - > next )
{
buck = * link ;
if ( buck - > data = = data & & ! stricmp ( name , buck - > key . string ) )
2004-08-23 01:38:21 +00:00
{
2012-05-09 15:30:53 +00:00
* link = buck - > next ;
2004-08-23 01:38:21 +00:00
return ;
}
2012-05-09 15:30:53 +00:00
}
}
void Hash_RemoveBucket ( hashtable_t * table , const char * name , bucket_t * data )
{
unsigned int bucknum = Hash_Key ( name , table - > numbuckets ) ;
bucket_t * * link , * buck ;
2004-08-23 01:38:21 +00:00
2012-05-09 15:30:53 +00:00
for ( link = & table - > bucket [ bucknum ] ; * link ; link = & ( * link ) - > next )
2004-08-23 01:38:21 +00:00
{
2012-05-09 15:30:53 +00:00
buck = * link ;
if ( buck = = data & & ! stricmp ( name , buck - > key . string ) )
{
* link = buck - > next ;
return ;
}
2004-08-23 01:38:21 +00:00
}
return ;
}
2018-12-28 00:04:36 +00:00
void Hash_RemoveDataKey ( hashtable_t * table , unsigned int key , void * data )
{
unsigned int bucknum = key % table - > numbuckets ;
bucket_t * * link , * buck ;
for ( link = & table - > bucket [ bucknum ] ; * link ; link = & ( * link ) - > next )
{
buck = * link ;
if ( buck - > data = = data & & buck - > key . value = = key )
{
* link = buck - > next ;
return ;
}
}
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
void Hash_RemoveKey ( hashtable_t * table , unsigned int key )
2004-08-23 01:38:21 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int bucknum = key % table - > numbuckets ;
2004-08-23 01:38:21 +00:00
bucket_t * buck ;
buck = table - > bucket [ bucknum ] ;
2007-09-17 20:35:39 +00:00
if ( buck - > key . value = = key )
2004-08-23 01:38:21 +00:00
{
table - > bucket [ bucknum ] = buck - > next ;
return ;
}
while ( buck - > next )
{
2007-09-17 20:35:39 +00:00
if ( buck - > next - > key . value = = key )
2004-08-23 01:38:21 +00:00
{
buck - > next = buck - > next - > next ;
return ;
}
buck = buck - > next ;
}
return ;
}