Fix up fteqcc's typedefs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6303 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-08-08 22:45:19 +00:00
parent a0f2ffda90
commit f8af9b18eb
13 changed files with 198 additions and 160 deletions

View file

@ -1534,7 +1534,9 @@ SET(FTE_MENU_SYS true CACHE BOOL "Compile System Menu.")
IF(FTE_MENU_SYS)
ADD_CUSTOM_TARGET(menusys ALL
VERBATIM
COMMAND fteqcc -srcfile "${CMAKE_CURRENT_SOURCE_DIR}/quakec/menusys/menu.src" -o "${CMAKE_CURRENT_BINARY_DIR}/menu.dat"
DEPENDS fteqcc
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/quakec/menusys/"
COMMAND fteqcc -srcfile "menu.src" -o "${CMAKE_CURRENT_BINARY_DIR}/menu.dat"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/menu.dat" "${CMAKE_CURRENT_BINARY_DIR}/menu.lno"
SOURCES
quakec/menusys/menu.src
@ -1572,3 +1574,34 @@ IF(FTE_MENU_SYS)
quakec/menusys/menu/quit.qc
)
ENDIF()
SET(FTE_CSADDON true CACHE BOOL "CS Addon.")
IF(FTE_CSADDON)
ADD_CUSTOM_TARGET(csaddon ALL
VERBATIM
DEPENDS fteqcc
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/quakec/csaddon/src/"
COMMAND fteqcc -srcfile "csaddon.src" -o "${CMAKE_CURRENT_BINARY_DIR}/csaddon.dat"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/csaddon.dat" "${CMAKE_CURRENT_BINARY_DIR}/csaddon.lno"
SOURCES
quakec/csaddon/src/csaddon.src
quakec/csaddon/src/csplat.qc
quakec/csaddon/src/csfixups.qc
quakec/csaddon/src/editor_lights.qc
quakec/csaddon/src/editor_terrain.qc
quakec/csaddon/src/brush_selection.qc
quakec/csaddon/src/brush_history.qc
quakec/csaddon/src/brush_manip.qc
quakec/csaddon/src/brush_draw.qc
quakec/csaddon/src/brush_vertedit.qc
quakec/csaddon/src/editor_brushes.qc
quakec/csaddon/src/editor_ents.qc
quakec/csaddon/src/textfield.qc
quakec/csaddon/src/editor_particles.qc
quakec/csaddon/src/menu.qc
quakec/csaddon/src/cam.qc
quakec/csaddon/src/csaddon.qc
)
ENDIF()

View file

@ -94,7 +94,8 @@ ev_struct, //big complex type
ev_union, //not really sure why this is separate from struct
ev_accessor,//some weird type to provide class-like functions over a basic type.
ev_enum, //just a numeric type
ev_boolean //exists to optimise if(-0) workarounds.
ev_typedef, //so typedefs can refer to their original type (primarily for structs).
ev_boolean, //exists to optimise if(-0) workarounds. engine just sees int/float.
} etype_t;
enum {
DEBUG_TRACE_OFF, //debugging should be off.

View file

@ -595,6 +595,13 @@ extern int pr_token_line_last;
extern QCC_type_t *pr_immediate_type;
extern QCC_eval_t pr_immediate;
extern int verbose;
#define VERBOSE_WARNINGSONLY -1
#define VERBOSE_PROGRESS 0
#define VERBOSE_STANDARD 1
#define VERBOSE_DEBUG 2
#define VERBOSE_DEBUGSTATEMENTS 3 //figuring out the files can be expensive.
extern pbool keyword_asm;
extern pbool keyword_break;
extern pbool keyword_case;
@ -1089,7 +1096,6 @@ void QCC_PR_EmitArraySetFunction(QCC_def_t *defscope, QCC_def_t *thearray, char
void QCC_PR_EmitClassFromFunction(QCC_def_t *defscope, QCC_type_t *basetype);
void QCC_PR_ParseDefs (char *classname, pbool fatal);
void QCC_PR_ParseTypedef(void);
QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *scope, int arraysize, QCC_def_t *rootsymbol, unsigned int ofs, int referable, unsigned int flags);
void QCC_PR_ParseInitializerDef(QCC_def_t *def, unsigned int flags);
void QCC_PR_FinaliseFunctions(void);

View file

@ -37,6 +37,7 @@ const unsigned int type_size[] = {1, //void
0, //ev_union. variable sized.
0, //ev_accessor...
0, //ev_enum...
0, //ev_typedef
1, //ev_bool...
};

View file

@ -9021,7 +9021,7 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
QCC_type_t *t;
QCC_sref_t idx;
QCC_sref_t tmp;
pbool allowarray;
pbool allowarray, arraytype;
unsigned int arraysize;
unsigned int rewindpoint = numstatements;
pbool dereference = false;
@ -9036,11 +9036,14 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
while(1)
{
allowarray = false;
arraytype = (t->type == ev_union && t->num_parms == 1 && !t->params[0].paramname); //FIXME
if (arraytype)
arraytype = true;
if (idx.cast)
allowarray = arraysize>0 ||
(t->type == ev_vector) ||
(t->type == ev_field && t->aux_type->type == ev_vector) ||
(t->type == ev_union && t->num_parms == 1 && !t->params[0].paramname && !arraysize);
(arraytype && !arraysize);
else if (!idx.cast)
{
allowarray = arraysize>0 ||
@ -9048,6 +9051,7 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
(t->type == ev_string) || //strings are effectively pointers
(t->type == ev_vector) || //vectors are mini arrays
(t->type == ev_field && t->aux_type->type == ev_vector) || //as are field vectors
(arraytype && !arraysize) ||
(!arraysize&&t->accessors); //custom accessors
}
@ -9072,7 +9076,7 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
/*if its a pointer that got dereferenced, follow the type*/
if (!idx.cast && t->type == ev_pointer && !arraysize)
t = t->aux_type;
else if (idx.cast && (t->type == ev_union && t->num_parms == 1 && !t->params[0].paramname && !arraysize))
else if (idx.cast && (arraytype && !arraysize))
{
arraysize = t->params[0].arraysize;
t = t->params[0].type;
@ -9221,6 +9225,17 @@ fieldarrayindex:
QCC_FreeTemp(idx);
return QCC_PR_BuildRef(retbuf, REF_GLOBAL, QCC_MakeIntConst(arraysize), nullsref, type_integer, true);
}
else if (arraytype && (QCC_PR_CheckToken(".") || QCC_PR_CheckToken("->")))
{
//the only field of an array type is the 'length' property.
//if we calculated offsets etc, discard those statements.
numstatements = rewindpoint;
QCC_PR_Expect("length");
QCC_FreeTemp(r->base);
QCC_FreeTemp(r->index);
QCC_FreeTemp(idx);
return QCC_PR_BuildRef(retbuf, REF_GLOBAL, QCC_MakeIntConst(t->params[0].arraysize), nullsref, type_integer, true);
}
else if (t->type == ev_vector && !arraysize && !t->accessors && QCC_PR_CheckToken("."))
{
char *swizzle = QCC_PR_ParseName();
@ -13619,16 +13634,11 @@ void QCC_PR_ParseStatement (void)
QCC_PR_ParseDefs (NULL, true);
return;
}
if (QCC_PR_CheckKeyword(keyword_typedef, "typedef"))
{
QCC_PR_ParseTypedef();
return;
}
if (pr_token_type == tt_name)
{
QCC_type_t *type = QCC_TypeForName(pr_token);
if (type && type->typedefed)
if (type)
{
if (strncmp(pr_file_p, "::", 2))
{
@ -13654,6 +13664,7 @@ void QCC_PR_ParseStatement (void)
( !STRCMP ("_Bool", pr_token)) ||
(keyword_static && !STRCMP ("static", pr_token)) ||
(keyword_class && !STRCMP ("class", pr_token)) ||
(keyword_typedef && !STRCMP ("typedef", pr_token)) ||
(keyword_const && !STRCMP ("const", pr_token)))
{
QCC_PR_ParseDefs (NULL, true);
@ -16603,6 +16614,9 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
break;
case ev_void:
break;
case ev_typedef: //invalid
QCC_PR_ParseWarning(ERR_INTERNAL, "unexpected typedef");
break;
}
}
}
@ -17061,6 +17075,9 @@ static QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, QCC_function_t *scope,
break;
case ev_void:
break;
case ev_typedef: //invalid
QCC_PR_ParseWarning(ERR_INTERNAL, "unexpected typedef");
break;
}
if (*fieldofs > maxfield)
maxfield = *fieldofs;
@ -17313,7 +17330,6 @@ QCC_sref_t QCC_PR_ParseInitializerType_Internal(int arraysize, QCC_def_t *basede
}
else
{
pbool isblock;
QCC_type_t *type = def.cast;
if (type->type == ev_function && pr_token_type == tt_punct)
{
@ -17512,8 +17528,14 @@ QCC_sref_t QCC_PR_ParseInitializerType_Internal(int arraysize, QCC_def_t *basede
QCC_PR_Lex();
QCC_PR_Expect(")");
}
else if ((isblock=(type->type == ev_struct || type->type == ev_union) && QCC_PR_CheckToken("{"))
|| (type->type == ev_union && type->num_parms == 1 && !type->params->paramname))
else if (type->type == ev_union && type->num_parms == 1 && !type->params->paramname)
{ //weird typedefed array hack
def.cast = (type)->params[0].type;
ret &= QCC_PR_ParseInitializerType((type)->params[0].arraysize, basedef, def, flags);
def.cast = type;
return ret?def:nullsref;
}
else if ((type->type == ev_struct || type->type == ev_union) && QCC_PR_CheckToken("{"))
{
//structs go recursive
QCC_type_t *parenttype;
@ -17585,8 +17607,6 @@ QCC_sref_t QCC_PR_ParseInitializerType_Internal(int arraysize, QCC_def_t *basede
ret &= QCC_PR_ParseInitializerType((type)->params[partnum].arraysize, basedef, def, flags);
if (isunion || !QCC_PR_CheckToken(","))
{
if (!isblock)
break;
QCC_PR_Expect("}");
break;
}
@ -17962,81 +17982,6 @@ QCC_type_t *QCC_PR_ParseEnum(pbool flags)
return enumtype?enumtype:basetype;
}
void QCC_PR_ParseTypedef(void)
{
QCC_type_t *old;
QCC_type_t *type = QCC_PR_ParseType(false, false);
if (!type)
{
QCC_PR_ParseError(ERR_NOTATYPE, "typedef found unexpected tokens");
}
do
{
char *name;
if (QCC_PR_CheckToken(";"))
return;
while (QCC_PR_CheckToken("*"))
type = QCC_PointerTypeTo(type);
if (QCC_PR_CheckToken("("))
{ //c-style function pointers are annoying.
int levels = 0;
while (QCC_PR_CheckToken("*"))
levels++;
name = QCC_PR_ParseName();
QCC_PR_Expect(")");
//now parse its args
QCC_PR_Expect("(");
type = QCC_PR_ParseFunctionType(false, type);
//and bring it to the intended indirection level...
while (levels --> 1)
type = QCC_PointerTypeTo(type);
}
else
name = QCC_PR_ParseName();
if (QCC_PR_CheckToken("["))
{
struct QCC_typeparam_s *param = qccHunkAlloc(sizeof(*param));
param->type = type;
param->arraysize = QCC_PR_IntConstExpr();
type = QCC_PR_NewType(name, ev_union, true);
type->params = param;
type->num_parms = 1;
type->size = param->type->size * param->arraysize;
QCC_PR_Expect("]");
}
else
{
old = QCC_TypeForName(name);
if (old && old->scope == pr_scope)
{
if (typecmp(old, type))
{
char obuf[1024];
char nbuf[1024];
old->typedefed = false;
QCC_PR_ParseWarning(ERR_NOTATYPE, "Cannot redeclare typedef %s%s%s from %s%s%s to %s%s%s", col_type,name,col_none, col_type,TypeName(old, obuf, sizeof(obuf)),col_none, col_type,TypeName(type, nbuf, sizeof(nbuf)),col_none);
old->typedefed = true;
}
}
else
{
type = QCC_PR_DuplicateType(type, false);
type->name = name;
type->typedefed = true;
type->scope = pr_scope;
pHash_Add(&typedeftable, name, type, qccHunkAlloc(sizeof(bucket_t)));
}
}
} while(QCC_PR_CheckToken(","));
QCC_PR_Expect(";");
return;
}
/*
================
PR_ParseDefs
@ -18054,6 +17999,7 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
pbool shared=false;
pbool isstatic=defaultstatic;
pbool externfnc=false;
pbool istypedef=false;
pbool isconstant = false;
pbool isvar = false;
pbool isinitialised = false;
@ -18078,12 +18024,6 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
while (QCC_PR_CheckToken(";"))
;
if (QCC_PR_CheckKeyword (keyword_typedef, "typedef"))
{
QCC_PR_ParseTypedef();
return;
}
if (flag_acc)
{
char *oldp;
@ -18242,7 +18182,9 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
while(1)
{
if (QCC_PR_CheckKeyword(keyword_extern, "extern"))
if (QCC_PR_CheckKeyword (keyword_typedef, "typedef"))
istypedef=true;
else if (QCC_PR_CheckKeyword(keyword_extern, "extern"))
externfnc=true;
else if (QCC_PR_CheckKeyword(keyword_shared, "shared"))
{
@ -18380,7 +18322,10 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
type = QCC_PR_ParseFunctionTypeReacc(false, basetype);
QCC_PR_Expect(";");
def = QCC_PR_GetDef (basetype, name, NULL, true, 0, false);
if (istypedef)
return;
else
def = QCC_PR_GetDef (basetype, name, NULL, true, 0, false);
if (autoprototype || dostrip)
{ //ignore the code and stuff
@ -18448,6 +18393,11 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
if (QCC_PR_CheckToken (";"))
{
if (istypedef)
{
QCC_PR_ParseWarning(WARN_UNEXPECTEDPUNCT, "typedef defines no types");
return;
}
if (type->type == ev_field && (type->aux_type->type == ev_union || type->aux_type->type == ev_struct))
{
QCC_PR_ExpandUnionToFields(type, &pr.size_fields);
@ -18473,7 +18423,7 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
name = QCC_PR_ParseName ();
}
if (QCC_PR_CheckToken("::") && !classname)
if (!istypedef && QCC_PR_CheckToken("::") && !classname)
{
classname = name;
name = QCC_PR_ParseName();
@ -18491,7 +18441,7 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
if (QCC_PR_CheckToken("]"))
{
//FIXME: preprocessor will hate this with a passion.
if (QCC_PR_CheckToken("="))
if (!istypedef && QCC_PR_CheckToken("="))
{
QCC_PR_Expect("{");
arraysize++;
@ -18592,8 +18542,54 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal_unused)
else
defclass = NULL;
isinitialised = QCC_PR_CheckToken ("=") || ((type->type == ev_function) && (pr_token[0] == '{' || pr_token[0] == '[' || pr_token[0] == ':'));
if (istypedef)
{
QCC_type_t *old;
if (externfnc||shared||isconstant||isvar||forceused||dostrip||allowinline||dowrap||doweak||accumulate||aliasof||deprecated
||(isstatic && !defaultstatic)
||(noref && !defaultnoref)
||(nosave && !defaultnosave) )
QCC_PR_ParseWarning(ERR_BADEXTENSION, "bad combination of modifiers with typedef (defining %s%s%s)", col_type,name,col_none);
if (arraysize)
{
struct QCC_typeparam_s *param = qccHunkAlloc(sizeof(*param));
// QCC_PR_ParseWarning(ERR_BADEXTENSION, "unsupported typedefed array (defining %s%s%s[%i])", col_type,name,col_none, arraysize);
param->type = type;
param->arraysize = arraysize;
param->paramname = NULL;
type = QCC_PR_NewType(name, ev_union, true);
type->params = param;
type->num_parms = 1;
type->size = param->type->size * param->arraysize;
}
else if (dynlength.cast)
{
QCC_PR_ParseWarning(ERR_BADEXTENSION, "unsupported typedefed array (defining %s%s%s[])", col_type,name,col_none);
type = QCC_PointerTypeTo(type);
}
old = QCC_TypeForName(name);
if (old && old->scope == pr_scope)
{
if (typecmp(old, type))
{
char obuf[1024];
char nbuf[1024];
QCC_PR_ParseWarning(ERR_NOTATYPE, "Cannot redeclare typedef %s%s%s from %s%s%s to %s%s%s", col_type,name,col_none, col_type,TypeName(old, obuf, sizeof(obuf)),col_none, col_type,TypeName(type, nbuf, sizeof(nbuf)),col_none);
}
}
else
{
old = type;
type = QCC_PR_NewType(name, ev_typedef, true);
type->aux_type = old;
type->scope = pr_scope;
}
continue;
}
isinitialised = QCC_PR_CheckToken ("=") || ((type->type == ev_function) && (pr_token[0] == '{' || pr_token[0] == '[' || pr_token[0] == ':'));
gd_flags = 0;
if (isstatic)

View file

@ -251,7 +251,7 @@ void QCC_JoinPaths(char *fullname, size_t fullnamesize, const char *newfile, con
extern char qccmsourcedir[];
//also meant to include it.
void QCC_FindBestInclude(char *newfile, char *currentfile, pbool verbose)
void QCC_FindBestInclude(char *newfile, char *currentfile, pbool includetype)
{
struct qccincludeonced_s *onced;
int includepath = 0;
@ -289,9 +289,9 @@ void QCC_FindBestInclude(char *newfile, char *currentfile, pbool verbose)
return;
}
if (verbose)
if (includetype && verbose >= VERBOSE_PROGRESS)
{
if (verbose == 2)
if (includetype == 2)
{
if (autoprototype)
externs->Printf("prototyping %s\n", fullname);
@ -4009,7 +4009,6 @@ void QCC_PR_ParsePrintSRef (int type, QCC_sref_t def)
void *errorscope;
static void QCC_PR_PrintMacro (qcc_includechunk_t *chunk)
{
extern pbool verbose;
if (chunk)
{
QCC_PR_PrintMacro(chunk->prev);
@ -4020,7 +4019,7 @@ static void QCC_PR_PrintMacro (qcc_includechunk_t *chunk)
#else
externs->Printf ("%s:%i: expanding %s\n", chunk->currentfilename, chunk->currentlinenumber, chunk->cnst->name);
#endif
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf ("%s\n", chunk->datastart);
}
else
@ -4913,19 +4912,9 @@ QCC_type_t *QCC_TypeForName(const char *name)
break; //its okay after all.
t = pHash_GetNext(&typedeftable, name, t);
}
if (t && t->type == ev_typedef)
return t->aux_type; //just use its real type.
return t;
/*
int i;
for (i = 0; i < numtypeinfos; i++)
{
if (qcc_typeinfo[i].typedefed && !STRCMP(qcc_typeinfo[i].name, name))
{
return &qcc_typeinfo[i];
}
}
return NULL;*/
}
/*

View file

@ -27,7 +27,9 @@ extern int optres_test1;
extern int optres_test2;
pbool writeasm;
pbool verbose;
int verbose;
#define VERBOSE_WARNINGSONLY -1
#define VERBOSE_PROGRESS 0
#define VERBOSE_STANDARD 1
#define VERBOSE_DEBUG 2
#define VERBOSE_DEBUGSTATEMENTS 3 //figuring out the files can be expensive.
@ -1625,7 +1627,7 @@ static void QCC_UnmarshalLocals(void)
}
}
numpr_globals = biggest;
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("%i shared locals, %i private, %i total\n", biggest - onum, onum - eog, numpr_globals-eog);
}
static void QCC_GenerateFieldDefs(QCC_def_t *def, char *fieldname, int ofs, QCC_type_t *type)
@ -1817,7 +1819,7 @@ static pbool QCC_WriteData (int crc)
{
if (numpr_globals >= 32768) //not much of a different format. Rewrite output to get it working on original executors?
externs->Printf("Globals exceeds 32k - an enhanced QCVM will be required\n");
else if (verbose)
else if (verbose >= VERBOSE_STANDARD)
externs->Printf("Progs should run on any QuakeC VM\n");
break;
}
@ -1866,7 +1868,7 @@ static pbool QCC_WriteData (int crc)
types = false;
}
if (verbose)
if (verbose >= VERBOSE_STANDARD)
{
if (qcc_targetformat == QCF_QSS)
externs->Printf("QSS or FTE will be required\n");
@ -1881,7 +1883,7 @@ static pbool QCC_WriteData (int crc)
case QCF_UHEXEN2:
debugtarget = false;
outputsttype = PST_UHEXEN2;
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("uHexen2 will be required\n");
if (numpr_globals < 65535)
externs->Printf("Warning: outputting 32 uHexen2 format when 16bit would suffice\n");
@ -2117,15 +2119,15 @@ static pbool QCC_WriteData (int crc)
else if (strcmp(def->name, "IMMEDIATE") && qccwarningaction[wt] && !(def->type->type == ev_function && def->symbolheader->timescalled) && !def->symbolheader->used)
{
char typestr[256];
if (QC_strcasestr(def->filen, "extensions") && !verbose)
if (QC_strcasestr(def->filen, "extensions") && verbose < VERBOSE_STANDARD)
{ //try to avoid annoying warnings from dpextensions.qc
extwarncount++;
QCC_PR_Warning(wt, def->filen, def->s_line, NULL);
}
else if (def->arraysize)
QCC_PR_Warning(wt, def->filen, def->s_line, (dupewarncount++ >= 10 && !verbose)?NULL:"%s %s%s%s[%i] no references.", TypeName(def->type, typestr, sizeof(typestr)), col_symbol, def->name, col_none, def->arraysize);
QCC_PR_Warning(wt, def->filen, def->s_line, (dupewarncount++ >= 10 && verbose < VERBOSE_STANDARD)?NULL:"%s %s%s%s[%i] no references.", TypeName(def->type, typestr, sizeof(typestr)), col_symbol, def->name, col_none, def->arraysize);
else
QCC_PR_Warning(wt, def->filen, def->s_line, (dupewarncount++ >= 10 && !verbose)?NULL:"%s %s%s%s no references.", TypeName(def->type, typestr, sizeof(typestr)), col_symbol, def->name, col_none);
QCC_PR_Warning(wt, def->filen, def->s_line, (dupewarncount++ >= 10 && verbose < VERBOSE_STANDARD)?NULL:"%s %s%s%s no references.", TypeName(def->type, typestr, sizeof(typestr)), col_symbol, def->name, col_none);
}
pr_scope = NULL;
@ -2260,7 +2262,7 @@ static pbool QCC_WriteData (int crc)
}
QCC_SortFields();
if (dupewarncount > 10 && !verbose)
if (dupewarncount > 10 && verbose < VERBOSE_STANDARD)
QCC_PR_Note(WARN_NOTREFERENCED, NULL, 0, "suppressed %i more warnings about unreferenced variables, as you clearly don't care about the first 10.", dupewarncount-10);
if (extwarncount)
QCC_PR_Note(WARN_NOTREFERENCED, NULL, 0, "suppressed %i warnings about unused extensions.", extwarncount);
@ -2320,20 +2322,20 @@ static pbool QCC_WriteData (int crc)
for (i = 0; i < nummodels; i++)
{
if (!precache_model[i].used)
dupewarncount+=QCC_PR_Warning(WARN_EXTRAPRECACHE, precache_model[i].filename, precache_model[i].fileline, (dupewarncount>10&&!verbose)?NULL:"Model \"%s\" was precached but not directly used%s", precache_model[i].name, dupewarncount?"":" (annotate the usage with the used_model intrinsic to silence this warning)");
dupewarncount+=QCC_PR_Warning(WARN_EXTRAPRECACHE, precache_model[i].filename, precache_model[i].fileline, (dupewarncount>10&&verbose < VERBOSE_STANDARD)?NULL:"Model \"%s\" was precached but not directly used%s", precache_model[i].name, dupewarncount?"":" (annotate the usage with the used_model intrinsic to silence this warning)");
else if (!precache_model[i].block)
dupewarncount+=QCC_PR_Warning(WARN_NOTPRECACHED, precache_model[i].filename, precache_model[i].fileline, (dupewarncount>10&&!verbose)?NULL:"Model \"%s\" was used but not directly precached", precache_model[i].name);
dupewarncount+=QCC_PR_Warning(WARN_NOTPRECACHED, precache_model[i].filename, precache_model[i].fileline, (dupewarncount>10&&verbose < VERBOSE_STANDARD)?NULL:"Model \"%s\" was used but not directly precached", precache_model[i].name);
}
for (i = 0; i < numsounds; i++)
{
if (!precache_sound[i].used)
dupewarncount+=QCC_PR_Warning(WARN_EXTRAPRECACHE, precache_sound[i].filename, precache_sound[i].fileline, (dupewarncount>10&&!verbose)?NULL:"Sound \"%s\" was precached but not directly used", precache_sound[i].name, dupewarncount?"":" (annotate the usage with the used_sound intrinsic to silence this warning)");
dupewarncount+=QCC_PR_Warning(WARN_EXTRAPRECACHE, precache_sound[i].filename, precache_sound[i].fileline, (dupewarncount>10&&verbose < VERBOSE_STANDARD)?NULL:"Sound \"%s\" was precached but not directly used", precache_sound[i].name, dupewarncount?"":" (annotate the usage with the used_sound intrinsic to silence this warning)");
else if (!precache_sound[i].block)
dupewarncount+=QCC_PR_Warning(WARN_NOTPRECACHED, precache_sound[i].filename, precache_sound[i].fileline, (dupewarncount>10&&!verbose)?NULL:"Sound \"%s\" was used but not directly precached", precache_sound[i].name);
dupewarncount+=QCC_PR_Warning(WARN_NOTPRECACHED, precache_sound[i].filename, precache_sound[i].fileline, (dupewarncount>10&&verbose < VERBOSE_STANDARD)?NULL:"Sound \"%s\" was used but not directly precached", precache_sound[i].name);
}
if (dupewarncount > 10 && !verbose)
if (dupewarncount > 10 && verbose < VERBOSE_STANDARD)
QCC_PR_Note(WARN_NOTREFERENCED, NULL, 0, "suppressed %i more %swarnings%s about precaches.", dupewarncount-10, col_warning, col_none);
//PrintStrings ();
@ -2342,7 +2344,7 @@ static pbool QCC_WriteData (int crc)
//PrintGlobals ();
strofs = (strofs+3)&~3;
if (verbose)
if (verbose >= VERBOSE_STANDARD)
{
externs->Printf ("%6i strofs (of %i)\n", strofs, MAX_STRINGS);
externs->Printf ("%6i numstatements (of %i)\n", numstatements, MAX_STATEMENTS);
@ -2356,7 +2358,7 @@ strofs = (strofs+3)&~3;
if (!*destfile)
strcpy(destfile, "progs.dat");
if (verbose)
if (verbose >= VERBOSE_PROGRESS)
externs->Printf("Writing %s\n", destfile);
h = SafeOpenWrite (destfile, 2*1024*1024);
SafeWrite (h, &progs, sizeof(progs));
@ -2867,7 +2869,7 @@ strofs = (strofs+3)&~3;
externs->Printf ("WARNING: progs format cannot handle extern functions\n");
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf ("%6i TOTAL SIZE\n", (int)SafeSeek (h, 0, SEEK_CUR));
progs.entityfields = pr.size_fields;
@ -2896,7 +2898,7 @@ strofs = (strofs+3)&~3;
i = PRLittleLong(qcc_pr_globals[def->ofs]._int);
else
{ //entsize(=96)+hunk header size(=32)
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("qccx hack - 'entity progs' uninitialised. Assuming 112.\n");
i = 112; //match qccx.
}
@ -2924,7 +2926,7 @@ strofs = (strofs+3)&~3;
if (verbose >= VERBOSE_PROGRESS)
switch(qcc_targetformat)
{
case QCF_QTEST:
@ -2988,7 +2990,7 @@ strofs = (strofs+3)&~3;
strcat(destfile, ".lno");
if (gz)
strcat(destfile, ".gz");
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Writing %s for debugging\n", destfile);
h = SafeOpenWrite (destfile, 2*1024*1024);
SafeWrite (h, &lnotype, sizeof(int));
@ -3881,53 +3883,53 @@ static void QCC_PR_CRCMessages(unsigned short crc)
case 12923: //#pragma sourcefile usage
break;
case 54730:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as QuakeWorld\n");
break;
case 5927:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as NetQuake server gamecode\n");
break;
case 26940:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as Quake pre-release...\n");
break;
case 38488:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as original Hexen2\n");
break;
case 26905:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as Hexen2 Mission Pack\n");
break;
case 14046:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as Hexen2 (demo)\n");
break;
case 22390: //EXT_CSQC_1
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as an EXT_CSQC_1 module\n");
break;
case 17105:
case 32199: //outdated ext_csqc
QCC_PR_Warning(WARN_SYSTEMCRC2, NULL, 0, "Recognised progs as outdated CSQC module\n");
QCC_PR_Warning(WARN_SYSTEMCRC2, NULL, 0, "Recognised progs as outdated CSQC module");
break;
case 52195: //this is what DP requires. don't print it as the warning that it is as that would royally piss off xonotic and their use of -Werror.
externs->Printf("Recognised progs as DP-specific CSQC module\n");
break;
case 10020:
if (verbose)
if (verbose >= VERBOSE_STANDARD)
externs->Printf("Recognised progs as a MenuQC module\n");
break;
case 32401:
QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "please update your tenebrae system defs.\n");
QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "please update your tenebrae system defs.");
break;
default:
QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "system defs not recognised from quake nor clones, probably buggy (sys)defs.qc\n");
QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "system defs not recognised from quake nor clones, probably buggy (sys)defs.qc");
break;
}
}
@ -4497,11 +4499,15 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
{ //explicit output file
i++;
strcpy(destfile, myargv[i]);
if (!destfile_explicit)
verbose--;
destfile_explicit = true;
}
else if ( !strncmp(myargv[i], "-o", 2) )
{ //explicit output file
strcpy(destfile, myargv[i]+2);
if (!destfile_explicit)
verbose--;
destfile_explicit = true;
}
else if ( !strcmp(myargv[i], "-qc") )
@ -4996,7 +5002,7 @@ static void QCC_SetDefaultProperties (void)
qcc_framerate = 0; //depends on target (engine's OP_STATE)
ForcedCRC = 0;
defaultstatic = 0;
verbose = 0;
verbose = VERBOSE_PROGRESS;
*qccmsourcedir = 0;
QCC_PR_CloseProcessor();
@ -5871,7 +5877,7 @@ void QCC_FinishCompile(void)
if (donesomething)
{
if (verbose)
if (verbose >= VERBOSE_STANDARD)
{
externs->Printf ("Compile Complete\n\n");
@ -5926,7 +5932,7 @@ void QCC_FinishCompile(void)
externs->Printf("numtemps %u\n", (unsigned)tempsused);
}
if (!flag_msvcstyle)
if (!flag_msvcstyle && verbose >= VERBOSE_PROGRESS)
externs->Printf("Done. %i warnings\n", pr_warning_count);
}

View file

@ -107,7 +107,7 @@ static int logprintf(const char *format, ...)
#endif
va_end (argptr);
printf("%s", string);
fprintf(stderr, "%s", string);
// fputs(string, stderr);
if (logfile)
fputs(string, logfile);

View file

@ -482,13 +482,13 @@ void(float width, float height, float do2d) CSQC_UpdateView =
void() CSQC_Input_Frame =
{
vector t, o;
if (autocvar_ca_show) //when we're using the UI, don't send any attack or jump stuff. these are generally annoying modifiers or so
input_buttons = 0;
#ifdef WALLBROWSERS
if ((input_buttons & 1) && pointedshadername == "")
{
vector t, o;
t = mousefar;
o = mousenear;
if (vlen(o - t) > 8192)

View file

@ -1,4 +1,4 @@
../csaddon.dat
#output "../csaddon.dat"
//pr_dumpplatform -FFTE -Fdefines -TCS -O csplat
//#pragma flag enable assumeint
@ -9,6 +9,8 @@
#pragma target FTE
//#pragma optimise 2
//#pragma optimise no-filename
#includelist
csplat.qc
csfixups.qc
@ -26,4 +28,4 @@ editor_particles.qc
menu.qc
cam.qc
csaddon.qc
#endlist

View file

@ -271,8 +271,8 @@ void(entedit_t *nent) editor_ents_updated =
for (i = 0; i < 8; i++)
{
nent->bboxverts[i].st = (vec2){{0,0}};
nent->bboxverts[i].rgba = (vec4){{nent->colourmod[0], nent->colourmod[1], nent->colourmod[2], nent->alpha?nent->alpha:1}};
nent->bboxverts[i].st = (vec2){0,0};
nent->bboxverts[i].rgba = (vec4){nent->colourmod[0], nent->colourmod[1], nent->colourmod[2], nent->alpha?nent->alpha:1};
nent->bboxverts[i].xyz[0] = nent->org[0] + ((i&1i)?nent->maxs[0]:nent->mins[0]);
nent->bboxverts[i].xyz[1] = nent->org[1] + (((i&2i)?nent->maxs[1]:nent->mins[1]));
nent->bboxverts[i].xyz[2] = nent->org[2] + ((i&4)?nent->maxs[2]:nent->mins[2]);

View file

@ -36,8 +36,10 @@ static vector(vector v) vtodpp =
//so fucking disgustingly ugly.
if (dp_workarounds)
{
#pragma warning disable F333
v_x *= cvar("vid_width") / cvar("vid_conwidth");
v_y *= cvar("vid_height") / cvar("vid_conheight");
#pragma warning enable F333
}
#endif
return v;

View file

@ -149,6 +149,7 @@ var uiinfo_t ui =
void() queryscreensize =
{
#pragma warning disable F333
#ifdef MENU
//there is no proper way to do this.
//fte thus has special checks for these cvars, and they should not be autocvars if you want them to work properly.
@ -169,6 +170,7 @@ void() queryscreensize =
}
#endif
#endif
#pragma warning enable F333
};
//helper function