1
0
Fork 0
forked from fte/fteqw

use smartjump on nq servers.

try to work around a Chrome webaudio bug, to stop an exception preventing the webgl port from starting any maps.
don't open so many ipv6 client sockets (hybrid sockets don't need it).
fix fteqcc to support qccx a bit better. crmod should now compile when using -fqccx, seems to work in proquake too (ignoring the string replacer hack/tool).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5105 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-05-22 05:12:01 +00:00
parent 445e7f476b
commit f64cb13cab
7 changed files with 230 additions and 165 deletions

View file

@ -284,7 +284,8 @@ void IN_JumpDown (void)
#endif
#ifdef QUAKESTATS
if (condition && cl.playerview[pnum].stats[STAT_HEALTH] > 0 && !cls.demoplayback && !cl.spectator &&
cl.inframes[cl.validsequence&UPDATE_MASK].playerstate[cl.playerview[pnum].playernum].messagenum == cl.validsequence && cl.playerview[pnum].waterlevel >= 2 && (!cl.teamfortress || !(in_forward.state[pnum] & 1))
(cls.protocol==CP_NETQUAKE || cl.inframes[cl.validsequence&UPDATE_MASK].playerstate[cl.playerview[pnum].playernum].messagenum == cl.validsequence)
&& cl.playerview[pnum].waterlevel >= 2 && (!cl.teamfortress || !(in_forward.state[pnum] & 1))
)
KeyDown(&in_up);
else

View file

@ -499,7 +499,6 @@ void OpenAL_CvarInit(void)
Cvar_Register(&s_al_speedofsound, SOUNDVARS);
}
extern float voicevolumemod;
static void OpenAL_ListenerUpdate(soundcardinfo_t *sc, int entnum, vec3_t origin, vec3_t forward, vec3_t right, vec3_t up, vec3_t velocity)
{
oalinfo_t *oali = sc->handle;
@ -913,7 +912,18 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
case 2: //linear, mimic quake.
case 3: //linear clamped to further than ref distance
palSourcef(src, AL_ROLLOFF_FACTOR, 1);
#ifdef FTE_TARGET_WEB
//chrome complains about 0.
//with the expontential model, 0 results in division by zero, but we're not using that model and the maths for the linear model is fine with it.
//the web audio spec says 'The default value is 1. A RangeError exception must be thrown if this is set to a non-negative value.'
//which of course means that the PannerNode's constructor must throw an exception, which kinda prevents you ever creating one.
//it also says elsewhere 'If dref = 0, the value of the [exponential|inverse] model is taken to be 0, ...'
//which shows that the spec should read 'negative values' for rangeerrors (rather than non-positive). so chrome is being shit.
//unfortutely due to the nature of javascript and exceptions, this is fucking everything else up. thanks chrome!
palSourcef(src, AL_REFERENCE_DISTANCE, 0.01);
#else
palSourcef(src, AL_REFERENCE_DISTANCE, 0);
#endif
palSourcef(src, AL_MAX_DISTANCE, 1/chan->dist_mult);
break;
}

View file

@ -2958,9 +2958,26 @@ qboolean NET_PortToAdr (netadrtype_t adrfamily, netproto_t adrprot, const char *
/*just here to prevent the client from spamming new sockets, which can be a problem with certain q2 servers*/
qboolean FTENET_Datagram_ChangeLocalAddress(struct ftenet_generic_connection_s *con, netadr_t *adr)
{
if (adr->type == con->addrtype[0] || adr->type == con->addrtype[1])
if (adr->port == 0)
return true; //they want to use addr_any. it doesn't matter one jot which port we're currently listening on then.
struct sockaddr_qstorage address;
netadr_t current;
int namelen;
if (getsockname (con->thesocket, (struct sockaddr *)&address, &namelen) == 0)
{
SockadrToNetadr(&address, &current);
//make sure the types match (special check for ipv6 hybrid sockets that accept ipv4 too)
if (adr->type == current.type
#if defined(HAVE_IPV4) && defined(HAVE_IPV6)
|| (net_hybriddualstack.ival && adr->type == NA_IP && current.type == NA_IPV6)
#endif
)
{ //make sure the port is currect (or they don't care which port)
if (adr->port == current.port || !adr->port)
return true; //then pretend we changed it, because needed to change in the first place.
}
}
//doesn't match how its currently bound, so I guess we need to rebind then.
return false;
}
@ -7271,12 +7288,21 @@ void NET_InitClient(qboolean loopbackonly)
#endif
if (loopbackonly)
port = "";
#ifdef HAVE_IPV4
FTENET_AddToCollection(cls.sockets, "CLUDP4", port, NA_IP, NP_DGRAM, true);
#endif
#ifdef IPPROTO_IPV6
FTENET_AddToCollection(cls.sockets, "CLUDP6", port, NA_IPV6, NP_DGRAM, true);
#if defined(HAVE_IPV4) && defined(HAVE_IPV6)
if (net_hybriddualstack.ival)
{
FTENET_AddToCollection(cls.sockets, "CLUDP", port, NA_IP, NP_DGRAM, true);
}
else
#endif
{
#ifdef HAVE_IPV4
FTENET_AddToCollection(cls.sockets, "CLUDP4", port, NA_IP, NP_DGRAM, true);
#endif
#ifdef HAVE_IPV6
FTENET_AddToCollection(cls.sockets, "CLUDP6", port, NA_IPV6, NP_DGRAM, true);
#endif
}
#ifdef USEIPX
FTENET_AddToCollection(cls.sockets, "CLIPX", port, NA_IPX, NP_DGRAM, true);
#endif

View file

@ -757,7 +757,8 @@ enum {
WARN_CONSTANTCOMPARISON,
WARN_UNSAFEFUNCTIONRETURNTYPE,
WARN_MISSINGOPTIONAL,
WARN_SYSTEMCRC,
WARN_SYSTEMCRC, //unknown system crc
WARN_SYSTEMCRC2, //legacy/dp system crc
WARN_CONDITIONALTYPEMISMATCH,
WARN_MISSINGMEMBERQUALIFIER,//virtual/static/nonvirtual qualifier is missing
WARN_SELFNOTTHIS, //warned for because 'self' does not have the right type. we convert such references to 'this' instead, which is more usable.

View file

@ -2287,7 +2287,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
if (var_a.sym)
{
var_a.sym->referenced = true;
var_a.sym->referenced = true;
if (flags&STFL_PRESERVEA)
QCC_UnFreeTemp(var_a);
}
@ -5173,7 +5173,6 @@ QCC_sref_t QCC_PR_GenerateFunctionCallRef (QCC_sref_t newself, QCC_sref_t func,
if (copyop_idx == 0)
src.ofs += copyop_v?3:1;
}
QCC_FreeTemp(fparm);
}
else
{ //small and simple. yay.
@ -5224,6 +5223,8 @@ QCC_sref_t QCC_PR_GenerateFunctionCallRef (QCC_sref_t newself, QCC_sref_t func,
else
QCC_FreeTemp(QCC_PR_StatementFlags (&pr_opcodes[OP_STORE_F], args[i].ref, d, NULL, 0));
}
else
QCC_FreeTemp(args[i].ref);
}
args[i].ref = d;
}
@ -5938,9 +5939,13 @@ QCC_sref_t QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the func cou
QCC_PR_ParsePrintSRef(WARN_TOOMANYPARAMETERSFORFUNC, func);
}
if (flag_qccx && QCC_PR_CheckToken("#"))
if (QCC_PR_CheckToken("#"))
{
e = QCC_PR_BuildRef(&parambuf[arg], REF_GLOBAL, QCC_MakeSRef(&def_parms[arg], 0, p?p:type_variant), nullsref, p?p:type_variant, true);
QCC_sref_t sr = QCC_MakeSRefForce(&def_parms[arg], 0, p?p:type_variant);
// sr.sym = &def_parms[arg];
// sr.ofs = 0;
// sr.cast = p?p:type_variant;
e = QCC_PR_BuildRef(&parambuf[arg], REF_GLOBAL, sr, nullsref, p?p:type_variant, true);
}
else if (arg < t->num_parms && (QCC_PR_PeekToken (",") || QCC_PR_PeekToken (")")))
{
@ -6734,7 +6739,8 @@ static QCC_ref_t *QCC_PR_ParseField(QCC_ref_t *refbuf, QCC_ref_t *lhs)
lhs = QCC_PR_ParseField(refbuf, lhs);
}
else if (flag_qccx && t->type == ev_entity && QCC_PR_CheckToken("["))
{
{ //p[%0] gives a regular array reference. except that p is probably a float, and we're expecting OP_LOAD_F
//might also be assigned to, so just create a regular field ref and figure that stuff out later.
QCC_ref_t *field;
QCC_ref_t fieldbuf;
field = QCC_PR_RefExpression(&fieldbuf, TOP_PRIORITY, 0);
@ -6744,6 +6750,21 @@ static QCC_ref_t *QCC_PR_ParseField(QCC_ref_t *refbuf, QCC_ref_t *lhs)
lhs = QCC_PR_BuildRef(refbuf, REF_FIELD, QCC_RefToDef(lhs, true), QCC_RefToDef(field, true), type_float, false);
lhs = QCC_PR_ParseField(refbuf, lhs);
lhs = QCC_PR_ParseRefArrayPointer (refbuf, lhs, false, false);
}
else if (flag_qccx && t->type == ev_entity && QCC_PR_CheckToken("^"))
{ //p^[%0] is evaluated as an OP_LOAD_V (or OP_ADDRESS+OP_STOREP_V)
QCC_ref_t *field;
QCC_ref_t fieldbuf;
QCC_PR_Expect("[");
field = QCC_PR_RefExpression(&fieldbuf, TOP_PRIORITY, 0);
field->cast = type_floatfield;
QCC_PR_Expect("]");
lhs = QCC_PR_BuildRef(refbuf, REF_FIELD, QCC_RefToDef(lhs, true), QCC_RefToDef(field, true), type_vector, false);
lhs = QCC_PR_ParseField(refbuf, lhs);
lhs = QCC_PR_ParseRefArrayPointer (refbuf, lhs, false, false);
}
@ -7186,11 +7207,10 @@ QCC_ref_t *QCC_PR_ParseRefValue (QCC_ref_t *refbuf, QCC_type_t *assumeclass, pbo
if (pr_token_type == tt_immediate)
{
d = QCC_PR_ParseImmediate ();
d.sym->referenced = true;
return QCC_DefToRef(refbuf, d);
// d.sym->referenced = true;
// return QCC_DefToRef(refbuf, d);
}
if (QCC_PR_CheckToken("["))
else if (QCC_PR_CheckToken("["))
{
//originally used for reacc - taking the form of [5 84 2]
//we redefine it to include statements - [a+b, c, 3+(d*2)]
@ -7224,153 +7244,155 @@ QCC_ref_t *QCC_PR_ParseRefValue (QCC_ref_t *refbuf, QCC_type_t *assumeclass, pbo
QCC_PR_Expect("]");
d = QCC_PR_GenerateVector(x,y,z);
d.sym->referenced = true;
return QCC_DefToRef(refbuf, d);
// d.sym->referenced = true;
// return QCC_DefToRef(refbuf, d);
}
if (QCC_PR_CheckToken("::"))
else
{
assumeclass = NULL;
expandmemberfields = false; //::classname is always usable for eg: the find builtin.
}
name = QCC_PR_ParseName ();
//fixme: namespaces should be relative
if (QCC_PR_CheckToken("::"))
{
expandmemberfields = false; //this::classname should also be available to the find builtin, etc. this won't affect self.classname::member nor classname::staticfunc
if (assumeclass && !strcmp(name, "super"))
t = assumeclass->parentclass;
else if (assumeclass && !strcmp(name, "this"))
t = assumeclass;
else
t = QCC_TypeForName(name);
if (!t || t->type != ev_entity)
if (QCC_PR_CheckToken("::"))
{
QCC_PR_ParseError (ERR_NOTATYPE, "Not a class \"%s\"", name);
d = nullsref;
assumeclass = NULL;
expandmemberfields = false; //::classname is always usable for eg: the find builtin.
}
name = QCC_PR_ParseName ();
//fixme: namespaces should be relative
if (QCC_PR_CheckToken("::"))
{
expandmemberfields = false; //this::classname should also be available to the find builtin, etc. this won't affect self.classname::member nor classname::staticfunc
if (assumeclass && !strcmp(name, "super"))
t = assumeclass->parentclass;
else if (assumeclass && !strcmp(name, "this"))
t = assumeclass;
else
t = QCC_TypeForName(name);
if (!t || t->type != ev_entity)
{
QCC_PR_ParseError (ERR_NOTATYPE, "Not a class \"%s\"", name);
d = nullsref;
}
else
{
QCC_type_t *p;
char membername[1024];
name = QCC_PR_ParseName ();
//walk up the parents if needed, to find one that has that field
for(d = nullsref, p = t; !d.cast && p; p = p->parentclass)
{
//use static functions in preference to virtual functions. kinda needed so you can use super::func...
QC_snprintfz(membername, sizeof(membername), "%s::%s", p->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
if (!d.cast)
{
QC_snprintfz(membername, sizeof(membername), "%s::"MEMBERFIELDNAME, p->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
}
}
if (!d.cast)
{
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s::%s\"", t->name, name);
}
}
}
else
{
QCC_type_t *p;
char membername[1024];
name = QCC_PR_ParseName ();
//walk up the parents if needed, to find one that has that field
for(d = nullsref, p = t; !d.cast && p; p = p->parentclass)
{
//use static functions in preference to virtual functions. kinda needed so you can use super::func...
QC_snprintfz(membername, sizeof(membername), "%s::%s", p->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
if (!d.cast)
d = nullsref;
// 'testvar' becomes 'this::testvar'
if (assumeclass && assumeclass->parentclass)
{ //try getting a member.
QCC_type_t *type;
for(type = assumeclass; type && !d.cast; type = type->parentclass)
{
QC_snprintfz(membername, sizeof(membername), "%s::"MEMBERFIELDNAME, p->name, name);
//look for virtual things
QC_snprintfz(membername, sizeof(membername), "%s::"MEMBERFIELDNAME, type->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
}
for(type = assumeclass; type && !d.cast; type = type->parentclass)
{
//look for non-virtual things (functions: after virtual stuff, because this will find the actual function def too)
QC_snprintfz(membername, sizeof(membername), "%s::%s", type->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
}
}
if (!d.cast)
{
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s::%s\"", t->name, name);
}
}
}
else
{
d = nullsref;
// 'testvar' becomes 'this::testvar'
if (assumeclass && assumeclass->parentclass)
{ //try getting a member.
QCC_type_t *type;
for(type = assumeclass; type && !d.cast; type = type->parentclass)
{
//look for virtual things
QC_snprintfz(membername, sizeof(membername), "%s::"MEMBERFIELDNAME, type->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
}
for(type = assumeclass; type && !d.cast; type = type->parentclass)
{
//look for non-virtual things (functions: after virtual stuff, because this will find the actual function def too)
QC_snprintfz(membername, sizeof(membername), "%s::%s", type->name, name);
d = QCC_PR_GetSRef (NULL, membername, pr_scope, false, 0, false);
// look through the defs
d = QCC_PR_GetSRef (NULL, name, pr_scope, false, 0, false);
}
}
if (!d.cast)
{
// look through the defs
d = QCC_PR_GetSRef (NULL, name, pr_scope, false, 0, false);
}
}
if (!d.cast)
{
if (!strcmp(name, "nil"))
d = QCC_MakeIntConst(0);
else if ( (!strcmp(name, "randomv")) ||
(!strcmp(name, "sizeof")) ||
(!strcmp(name, "alloca")) ||
(!strcmp(name, "entnum")) ||
(!strcmp(name, "autocvar")) ||
(!strcmp(name, "used_model")) ||
(!strcmp(name, "used_sound")) ||
(!strcmp(name, "va_arg")) ||
(!strcmp(name, "...")) || //for compat. otherwise wtf?
(!strcmp(name, "_")) ) //intrinsics, any old function with no args will do.
{
d = QCC_PR_GetSRef (type_function, name, NULL, true, 0, false);
// d->initialized = 0;
}
else if ( (!strcmp(name, "random" )) ) //intrinsics, any old function with no args will do. returning a float just in case people declare things in the wrong order
{
d = QCC_PR_GetSRef (type_floatfunction, name, NULL, true, 0, false);
// d.sym->initialized = 0;
}
else if (keyword_class && !strcmp(name, "this"))
{
if (!pr_classtype)
QCC_PR_ParseError(ERR_NOTANAME, "Cannot use 'this' outside of an OO function\n");
d = QCC_PR_GetSRef(type_entity, "self", NULL, true, 0, false);
d.cast = pr_classtype;
}
else if (keyword_class && !strcmp(name, "super"))
{
if (!assumeclass)
QCC_PR_ParseError(ERR_NOTANAME, "Cannot use 'super' outside of an OO function\n");
if (!assumeclass->parentclass)
QCC_PR_ParseError(ERR_NOTANAME, "class %s has no super\n", pr_classtype->name);
d = QCC_PR_GetSRef(NULL, "self", NULL, true, 0, false);
d.cast = assumeclass->parentclass;
}
else if (pr_assumetermtype)
{
d = QCC_PR_GetSRef (pr_assumetermtype, name, pr_assumetermscope, true, 0, pr_assumetermflags);
if (!d.cast)
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s\"", name);
}
else
{
d = QCC_PR_GetSRef (type_variant, name, pr_scope, true, 0, false);
if (!expandmemberfields && assumeclass)
if (!strcmp(name, "nil"))
d = QCC_MakeIntConst(0);
else if ( (!strcmp(name, "randomv")) ||
(!strcmp(name, "sizeof")) ||
(!strcmp(name, "alloca")) ||
(!strcmp(name, "entnum")) ||
(!strcmp(name, "autocvar")) ||
(!strcmp(name, "used_model")) ||
(!strcmp(name, "used_sound")) ||
(!strcmp(name, "va_arg")) ||
(!strcmp(name, "...")) || //for compat. otherwise wtf?
(!strcmp(name, "_")) ) //intrinsics, any old function with no args will do.
{
d = QCC_PR_GetSRef (type_function, name, NULL, true, 0, false);
// d->initialized = 0;
}
else if ( (!strcmp(name, "random" )) ) //intrinsics, any old function with no args will do. returning a float just in case people declare things in the wrong order
{
d = QCC_PR_GetSRef (type_floatfunction, name, NULL, true, 0, false);
// d.sym->initialized = 0;
}
else if (keyword_class && !strcmp(name, "this"))
{
if (!pr_classtype)
QCC_PR_ParseError(ERR_NOTANAME, "Cannot use 'this' outside of an OO function\n");
d = QCC_PR_GetSRef(type_entity, "self", NULL, true, 0, false);
d.cast = pr_classtype;
}
else if (keyword_class && !strcmp(name, "super"))
{
if (!assumeclass)
QCC_PR_ParseError(ERR_NOTANAME, "Cannot use 'super' outside of an OO function\n");
if (!assumeclass->parentclass)
QCC_PR_ParseError(ERR_NOTANAME, "class %s has no super\n", pr_classtype->name);
d = QCC_PR_GetSRef(NULL, "self", NULL, true, 0, false);
d.cast = assumeclass->parentclass;
}
else if (pr_assumetermtype)
{
d = QCC_PR_GetSRef (pr_assumetermtype, name, pr_assumetermscope, true, 0, pr_assumetermflags);
if (!d.cast)
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown field \"%s\" in class \"%s\"", name, assumeclass->name);
else if (!assumeclass->parentclass && assumeclass != type_entity)
{
QCC_PR_ParseWarning (ERR_UNKNOWNVALUE, "Class \"%s\" is not defined, cannot access memeber \"%s\"", assumeclass->name, name);
if (!autoprototype && !autoprototyped)
QCC_PR_Note(ERR_UNKNOWNVALUE, s_filen, pr_source_line, "Consider using #pragma autoproto");
}
else
{
QCC_PR_ParseWarning (ERR_UNKNOWNVALUE, "Unknown field \"%s\" in class \"%s\"", name, assumeclass->name);
}
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s\"", name);
}
else
{
if (!d.cast)
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s\"", name);
d = QCC_PR_GetSRef (type_variant, name, pr_scope, true, 0, false);
if (!expandmemberfields && assumeclass)
{
if (!d.cast)
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown field \"%s\" in class \"%s\"", name, assumeclass->name);
else if (!assumeclass->parentclass && assumeclass != type_entity)
{
QCC_PR_ParseWarning (ERR_UNKNOWNVALUE, "Class \"%s\" is not defined, cannot access memeber \"%s\"", assumeclass->name, name);
if (!autoprototype && !autoprototyped)
QCC_PR_Note(ERR_UNKNOWNVALUE, s_filen, pr_source_line, "Consider using #pragma autoproto");
}
else
{
QCC_PR_ParseWarning (ERR_UNKNOWNVALUE, "Unknown field \"%s\" in class \"%s\"", name, assumeclass->name);
}
}
else
{
QCC_PR_ParseWarning (ERR_UNKNOWNVALUE, "Unknown value \"%s\".", name);
if (!d.cast)
QCC_PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s\"", name);
else
{
QCC_PR_ParseWarning (ERR_UNKNOWNVALUE, "Unknown value \"%s\".", name);
}
}
}
}
@ -7697,12 +7719,13 @@ QCC_ref_t *QCC_PR_RefTerm (QCC_ref_t *retbuf, unsigned int exprflags)
{
r = QCC_PR_RefExpression (retbuf, UNARY_PRIORITY, EXPR_DISALLOW_COMMA);
if (flag_qccx && r->cast->type == ev_float)
{
r->readonly = false;
r->cast = QCC_PR_PointerType(r->cast);
{ //&%342 casts it to a (pre-dereferenced) pointer.
r = QCC_PR_BuildRef(retbuf, REF_POINTER, QCC_RefToDef(r, true), nullsref, type_float, false);
}
else if (flag_qccx && (r->cast->type == ev_string || r->cast->type == ev_field || r->cast->type == ev_entity || r->cast->type == ev_function))
{ //&string casts it to a float. does not dereference it
r->cast = type_float;
}
else
r = QCC_PR_GenerateAddressOf(retbuf, r);
return r;
@ -7711,7 +7734,9 @@ QCC_ref_t *QCC_PR_RefTerm (QCC_ref_t *retbuf, unsigned int exprflags)
{
e = QCC_PR_Expression (UNARY_PRIORITY, EXPR_DISALLOW_COMMA);
if (flag_qccx && (e.cast->type == ev_float || e.cast->type == ev_integer))
{ //just an evil cast. note that qccx assumes offsets rather than indexes, so these are often quite large and typically refer to some index into the world entity.
return QCC_PR_BuildRef(retbuf, REF_GLOBAL, e, nullsref, type_entity, false);
}
else if (e.cast->type == ev_pointer) //FIXME: arrays
return QCC_PR_BuildRef(retbuf, REF_POINTER, e, nullsref, e.cast->aux_type, false);
else if (e.cast->accessors)
@ -9292,17 +9317,14 @@ QCC_ref_t *QCC_PR_RefExpression (QCC_ref_t *retbuf, int priority, int exprflags)
}
else
{
if (flag_qccx && lhsr->cast->type == ev_pointer && rhsd.cast->type == ev_float)
{
char totypename[256], fromtypename[256], destname[256];
TypeName(lhsr->cast, totypename, sizeof(totypename));
TypeName(rhsd.cast, fromtypename, sizeof(fromtypename));
QCC_PR_ParseWarning(WARN_LAXCAST, "Implicit type mismatch on assignment to %s. Needed %s, got %s.", QCC_GetRefName(lhsr, destname, sizeof(destname)), totypename, fromtypename);
/*if (flag_qccx && lhsr->cast->type == ev_pointer && rhsd.cast->type == ev_float)
{ //&%555 = 4.0;
char destname[256];
QCC_PR_ParseWarning(WARN_LAXCAST, "Implicit pointer dereference on assignment to %s", QCC_GetRefName(lhsr, destname, sizeof(destname)));
lhsd = QCC_RefToDef(lhsr, true);
lhsr = QCC_PR_BuildRef(retbuf, REF_POINTER, lhsd, nullsref, lhsd.cast->aux_type, false);
}
else if (QCC_SRef_IsNull(rhsd))
else */if (QCC_SRef_IsNull(rhsd))
{
QCC_FreeTemp(rhsd);
if (lhsr->cast->type == ev_vector)
@ -9865,9 +9887,13 @@ void QCC_PR_ParseStatement (void)
}
else if (pr_scope->type->aux_type->type != e.cast->type)
{
e = QCC_EvaluateCast(e, pr_scope->type->aux_type, true);
//e = QCC_SupplyConversion(e, pr_scope->type->aux_type->type, true);
// QCC_PR_ParseWarning(WARN_WRONGRETURNTYPE, "\'%s\' returned %s, expected %s", pr_scope->name, e->type->name, pr_scope->type->aux_type->name);
if (pr_scope->type->aux_type->type == ev_void)
{ //returning a value inside a function defined to return void is bad dude.
QCC_PR_ParseWarning(WARN_WRONGRETURNTYPE, "\'%s\' returned %s, expected %s", pr_scope->name, e.sym->type->name, pr_scope->type->aux_type->name);
e = QCC_EvaluateCast(e, type_variant, true);
}
else
e = QCC_EvaluateCast(e, pr_scope->type->aux_type, true);
}
PR_GenerateReturnOuts();
QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_RETURN], e, nullsref, NULL));
@ -13608,7 +13634,7 @@ void QCC_PR_ParseEnum(pbool flags)
name = QCC_PR_ParseName();
if (QCC_PR_CheckToken("="))
{
if (pr_token_type == tt_immediate && pr_immediate_type->type == ev_float)
/*if (pr_token_type == tt_immediate && pr_immediate_type->type == ev_float)
{
iv = fv = pr_immediate._float;
QCC_PR_Lex();
@ -13618,10 +13644,10 @@ void QCC_PR_ParseEnum(pbool flags)
fv = iv = pr_immediate._int;
QCC_PR_Lex();
}
else
else*/
{
const QCC_eval_t *eval;
sref = QCC_PR_GetSRef(NULL, QCC_PR_ParseName(), NULL, false, 0, GDF_STRIP);
sref = QCC_PR_Expression(TOP_PRIORITY, EXPR_DISALLOW_COMMA);
eval = QCC_SRef_EvalConst(sref);
if (eval)
{

View file

@ -3445,7 +3445,7 @@ void QCC_PR_Lex (void)
return;
}
if (!flag_qccx && c == '#' && !(pr_file_p[1]=='\"' || pr_file_p[1]=='-' || (pr_file_p[1]>='0' && pr_file_p[1] <='9'))) //hash and not number
if (!flag_qccx && c == '#' && !(pr_file_p[1]==')' || pr_file_p[1]==',' || pr_file_p[1]=='\"' || pr_file_p[1]=='-' || (pr_file_p[1]>='0' && pr_file_p[1] <='9'))) //hash and not number
{
pr_file_p++;
if (!QCC_PR_CheckCompConst())

View file

@ -215,6 +215,7 @@ struct {
{" F208", WARN_NOTREFERENCEDCONST},
{" F209", WARN_EXTRAPRECACHE},
{" F210", WARN_NOTPRECACHED},
{" F211", WARN_SYSTEMCRC2},
//frikqcc errors
//Q608: PrecacheSound: numsounds
@ -2321,7 +2322,7 @@ strofs = (strofs+3)&~3;
size = (size+15)&(~15); //and will allocate it on the hunk with 16-byte alignment
//this global receives the offset from world to the start of the progs def _IN VANILLA QUAKE_.
//this is a negative index due to allocation ordering
//this is a negative index due to allocation ordering with the assumption that the progs.dat was loaded on the heap directly followed by the entities.
//this will NOT work in FTE, DP, QuakeForge due to entity indexes. Various other engines will likely mess up too, if they change the allocation order or sizes etc. 64bit is screwed.
if (progs.blockscompressed&32)
printf("unable to write value for 'entity progs'\n"); //would not work anyway
@ -2332,7 +2333,7 @@ strofs = (strofs+3)&~3;
if (def->initialized)
i = PRLittleLong(qcc_pr_globals[def->ofs]._int);
else
{
{ //entsize(=96)+hunk header size(=32)
if (verbose)
printf("qccx hack - 'entity progs' uninitialised. Assuming 112.\n");
i = 112; //match qccx.
@ -3434,7 +3435,7 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
break;
case 17105:
case 32199: //outdated ext_csqc
QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "Recognised progs as outdated CSQC module\n");
QCC_PR_Warning(WARN_SYSTEMCRC2, NULL, 0, "Recognised progs as outdated CSQC module\n");
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.
printf("Recognised progs as DP-specific CSQC module\n");