Skip to content

Commit 46c763a

Browse files
author
acceptthis
committed
Big fat-off commit.
A few changes. Half-Life support is finally getting committed. Some unnecessary filesystem code changes. And there's code for nsapi - meaning we can embed FTE in a browser (firefox and opera on windows work). A couple of CSQC changes, trying to move towards a final EXT_CSQC_1. Revised ruleset format finally implemented. Doesn't compile with msvc6 due to issues with libjpeg not being a clean library. Presumably its fine in vs2005. Your mileage may vary. git-svn-id: https://fteqw.svn.sourceforge.net/svnroot/fteqw/trunk/engine/qclib@3148 fa7d4b81-6910-0410-8d11-a3360c2baa62
1 parent 175d46e commit 46c763a

File tree

4 files changed

+63
-9
lines changed

4 files changed

+63
-9
lines changed

hash.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ void Hash_InitTable(hashtable_t *table, int numbucks, void *mem)
1515
table->bucket = (bucket_t **)mem;
1616
}
1717

18-
int Hash_Key(char *name, int modulus)
18+
int Hash_Key(const char *name, int modulus)
1919
{ //fixme: optimize.
2020
unsigned int key;
2121
for (key=0;*name; name++)
2222
key += ((key<<3) + (key>>28) + *name);
2323

2424
return (int)(key%modulus);
2525
}
26-
int Hash_KeyInsensative(char *name, int modulus)
26+
int Hash_KeyInsensative(const char *name, int modulus)
2727
{ //fixme: optimize.
2828
unsigned int key;
2929
for (key=0;*name; name++)
@@ -37,7 +37,7 @@ int Hash_KeyInsensative(char *name, int modulus)
3737
return (int)(key%modulus);
3838
}
3939

40-
void *Hash_Get(hashtable_t *table, char *name)
40+
void *Hash_Get(hashtable_t *table, const char *name)
4141
{
4242
int bucknum = Hash_Key(name, table->numbuckets);
4343
bucket_t *buck;
@@ -53,7 +53,7 @@ void *Hash_Get(hashtable_t *table, char *name)
5353
}
5454
return NULL;
5555
}
56-
void *Hash_GetInsensative(hashtable_t *table, char *name)
56+
void *Hash_GetInsensative(hashtable_t *table, const char *name)
5757
{
5858
int bucknum = Hash_KeyInsensative(name, table->numbuckets);
5959
bucket_t *buck;

hash.h

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
//David's hash tables
33
//string based.
44

5+
#ifndef HASH_H__
6+
#define HASH_H__
7+
58
#define Hash_BytesForBuckets(b) (sizeof(bucket_t)*b)
69

710
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
811
typedef struct bucket_s {
912
void *data;
1013
union {
11-
char *string;
14+
const char *string;
1215
int value;
1316
} key;
1417
struct bucket_s *next;
@@ -19,9 +22,9 @@ typedef struct hashtable_s {
1922
} hashtable_t;
2023

2124
void Hash_InitTable(hashtable_t *table, int numbucks, void *mem); //mem must be 0 filled. (memset(mem, 0, size))
22-
int Hash_Key(char *name, int modulus);
23-
void *Hash_Get(hashtable_t *table, char *name);
24-
void *Hash_GetInsensative(hashtable_t *table, char *name);
25+
int Hash_Key(const char *name, int modulus);
26+
void *Hash_Get(hashtable_t *table, const char *name);
27+
void *Hash_GetInsensative(hashtable_t *table, const char *name);
2528
void *Hash_GetKey(hashtable_t *table, int key);
2629
void *Hash_GetNext(hashtable_t *table, char *name, void *old);
2730
void *Hash_GetNextInsensative(hashtable_t *table, char *name, void *old);
@@ -31,3 +34,5 @@ void Hash_Remove(hashtable_t *table, char *name);
3134
void Hash_RemoveData(hashtable_t *table, char *name, void *data);
3235
void Hash_RemoveKey(hashtable_t *table, int key);
3336
void *Hash_AddKey(hashtable_t *table, int key, void *data, bucket_t *buck);
37+
38+
#endif

initlib.c

+20
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,26 @@ struct entvars_s *PR_entvars (progfuncs_t *progfuncs, struct edict_s *ed)
172172
return (struct entvars_s *)edvars(ed);
173173
}
174174

175+
int PR_GetFuncArgCount(progfuncs_t *progfuncs, func_t func)
176+
{
177+
unsigned int pnum;
178+
unsigned int fnum;
179+
dfunction_t *f;
180+
181+
pnum = (func & 0xff000000)>>24;
182+
fnum = (func & 0x00ffffff);
183+
184+
if (pnum >= (unsigned)maxprogs || !pr_progstate[pnum].functions)
185+
return -1;
186+
else if (fnum >= pr_progstate[pnum].progs->numfunctions)
187+
return -1;
188+
else
189+
{
190+
f = pr_progstate[pnum].functions + fnum;
191+
return f->numparms;
192+
}
193+
}
194+
175195
func_t PR_FindFunc(progfuncs_t *progfuncs, char *funcname, progsnum_t pnum)
176196
{
177197
dfunction_t *f=NULL;

qccmain.c

+30-1
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,10 @@ pbool QCC_WriteData (int crc)
615615
outputsize = 32;
616616
}
617617

618+
if (qcc_targetformat == QCF_DARKPLACES)
619+
compressoutput = 0;
620+
621+
618622
//compression of blocks?
619623
if (compressoutput) progs.blockscompressed |=1; //statements
620624
if (compressoutput) progs.blockscompressed |=2; //defs
@@ -1881,14 +1885,39 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
18811885
printf("Recognised progs as QuakeWorld\n");
18821886
break;
18831887
case 5927:
1884-
printf("Recognised progs as regular Quake\n");
1888+
printf("Recognised progs as NetQuake server gamecode\n");
1889+
break;
1890+
1891+
case 26940:
1892+
printf("Recognised progs as Quake pre-release...\n");
18851893
break;
1894+
18861895
case 38488:
18871896
printf("Recognised progs as original Hexen2\n");
18881897
break;
18891898
case 26905:
18901899
printf("Recognised progs as Hexen2 Mission Pack\n");
18911900
break;
1901+
case 14046:
1902+
printf("Recognised progs as Hexen2 (demo)\n");
1903+
break;
1904+
1905+
case 32199:
1906+
printf("Recognised progs as a CSQC module\n");
1907+
break;
1908+
case 52195:
1909+
printf("Recognised progs as outdated CSQC module\n");
1910+
break;
1911+
case 10020:
1912+
printf("Recognised progs as a DP/FTE Menu module\n");
1913+
break;
1914+
1915+
case 32401:
1916+
printf("Warning: please update your tenebrae system defs.\n");
1917+
break;
1918+
default:
1919+
printf("Warning: progs CRC not recognised from quake nor clones\n");
1920+
break;
18921921
}
18931922

18941923

0 commit comments

Comments
 (0)