C++ conversion: fixed compilation errors for botlib project.
This commit is contained in:
parent
ff834b8b59
commit
0153ac316f
|
|
@ -190,7 +190,7 @@ qboolean AAS_EntityCollision(int entnum,
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
qboolean AAS_inPVS(vec3_t p1, vec3_t p2)
|
qboolean AAS_inPVS(vec3_t p1, vec3_t p2)
|
||||||
{
|
{
|
||||||
return botimport.inPVS(p1, p2);
|
return (qboolean) botimport.inPVS(p1, p2);
|
||||||
} //end of the function AAS_InPVS
|
} //end of the function AAS_InPVS
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// returns true if in Potentially Visible Set
|
// returns true if in Potentially Visible Set
|
||||||
|
|
|
||||||
|
|
@ -390,9 +390,9 @@ int AAS_NearestEntity(vec3_t origin, int modelindex)
|
||||||
ent = &aasworld.entities[i];
|
ent = &aasworld.entities[i];
|
||||||
if (ent->i.modelindex != modelindex) continue;
|
if (ent->i.modelindex != modelindex) continue;
|
||||||
VectorSubtract(ent->i.origin, origin, dir);
|
VectorSubtract(ent->i.origin, origin, dir);
|
||||||
if (abs(dir[0]) < 40)
|
if (fabs(dir[0]) < 40)
|
||||||
{
|
{
|
||||||
if (abs(dir[1]) < 40)
|
if (fabs(dir[1]) < 40)
|
||||||
{
|
{
|
||||||
dist = VectorLength(dir);
|
dist = VectorLength(dir);
|
||||||
if (dist < bestdist)
|
if (dist < bestdist)
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ int AAS_AgainstLadder(vec3_t origin)
|
||||||
//get the plane the face is in
|
//get the plane the face is in
|
||||||
plane = &aasworld.planes[face->planenum ^ side];
|
plane = &aasworld.planes[face->planenum ^ side];
|
||||||
//if the origin is pretty close to the plane
|
//if the origin is pretty close to the plane
|
||||||
if (abs(DotProduct(plane->normal, origin) - plane->dist) < 3)
|
if (fabs(DotProduct(plane->normal, origin) - plane->dist) < 3)
|
||||||
{
|
{
|
||||||
if (AAS_PointInsideFace(abs(facenum), origin, 0.1f)) return qtrue;
|
if (AAS_PointInsideFace(abs(facenum), origin, 0.1f)) return qtrue;
|
||||||
} //end if
|
} //end if
|
||||||
|
|
|
||||||
|
|
@ -592,7 +592,7 @@ int AAS_FallDamageDistance(void)
|
||||||
{
|
{
|
||||||
float maxzvelocity, gravity, t;
|
float maxzvelocity, gravity, t;
|
||||||
|
|
||||||
maxzvelocity = sqrt(30 * 10000);
|
maxzvelocity = sqrt(30.f * 10000.f);
|
||||||
gravity = aassettings.phys_gravity;
|
gravity = aassettings.phys_gravity;
|
||||||
t = maxzvelocity / gravity;
|
t = maxzvelocity / gravity;
|
||||||
return 0.5 * gravity * t * t;
|
return 0.5 * gravity * t * t;
|
||||||
|
|
@ -2478,8 +2478,8 @@ int AAS_Reachability_Ladder(int area1num, int area2num)
|
||||||
VectorMA(area1point, -32, dir, area1point);
|
VectorMA(area1point, -32, dir, area1point);
|
||||||
VectorMA(area2point, 32, dir, area2point);
|
VectorMA(area2point, 32, dir, area2point);
|
||||||
//
|
//
|
||||||
ladderface1vertical = abs(DotProduct(plane1->normal, up)) < 0.1;
|
ladderface1vertical = fabs(DotProduct(plane1->normal, up)) < 0.1;
|
||||||
ladderface2vertical = abs(DotProduct(plane2->normal, up)) < 0.1;
|
ladderface2vertical = fabs(DotProduct(plane2->normal, up)) < 0.1;
|
||||||
//there's only reachability between vertical ladder faces
|
//there's only reachability between vertical ladder faces
|
||||||
if (!ladderface1vertical && !ladderface2vertical) return qfalse;
|
if (!ladderface1vertical && !ladderface2vertical) return qfalse;
|
||||||
//if both vertical ladder faces
|
//if both vertical ladder faces
|
||||||
|
|
@ -2487,7 +2487,7 @@ int AAS_Reachability_Ladder(int area1num, int area2num)
|
||||||
//and the ladder faces do not make a sharp corner
|
//and the ladder faces do not make a sharp corner
|
||||||
&& DotProduct(plane1->normal, plane2->normal) > 0.7
|
&& DotProduct(plane1->normal, plane2->normal) > 0.7
|
||||||
//and the shared edge is not too vertical
|
//and the shared edge is not too vertical
|
||||||
&& abs(DotProduct(sharededgevec, up)) < 0.7)
|
&& fabs(DotProduct(sharededgevec, up)) < 0.7)
|
||||||
{
|
{
|
||||||
//create a new reachability link
|
//create a new reachability link
|
||||||
lreach = AAS_AllocReachability();
|
lreach = AAS_AllocReachability();
|
||||||
|
|
@ -2612,7 +2612,7 @@ int AAS_Reachability_Ladder(int area1num, int area2num)
|
||||||
if (face2->faceflags & FACE_LADDER)
|
if (face2->faceflags & FACE_LADDER)
|
||||||
{
|
{
|
||||||
plane2 = &aasworld.planes[face2->planenum];
|
plane2 = &aasworld.planes[face2->planenum];
|
||||||
if (abs(DotProduct(plane2->normal, up)) < 0.1) break;
|
if (fabs(DotProduct(plane2->normal, up)) < 0.1) break;
|
||||||
} //end if
|
} //end if
|
||||||
} //end for
|
} //end for
|
||||||
//if from another area without vertical ladder faces
|
//if from another area without vertical ladder faces
|
||||||
|
|
|
||||||
|
|
@ -606,34 +606,8 @@ aas_trace_t AAS_TraceClientBBox(vec3_t start, vec3_t end, int presencetype,
|
||||||
//the current node plane
|
//the current node plane
|
||||||
plane = &aasworld.planes[aasnode->planenum];
|
plane = &aasworld.planes[aasnode->planenum];
|
||||||
|
|
||||||
switch(plane->type)
|
|
||||||
{/*FIXME: wtf doesn't this work? obviously the axial node planes aren't always facing positive!!!
|
|
||||||
//check for axial planes
|
|
||||||
case PLANE_X:
|
|
||||||
{
|
|
||||||
front = cur_start[0] - plane->dist;
|
|
||||||
back = cur_end[0] - plane->dist;
|
|
||||||
break;
|
|
||||||
} //end case
|
|
||||||
case PLANE_Y:
|
|
||||||
{
|
|
||||||
front = cur_start[1] - plane->dist;
|
|
||||||
back = cur_end[1] - plane->dist;
|
|
||||||
break;
|
|
||||||
} //end case
|
|
||||||
case PLANE_Z:
|
|
||||||
{
|
|
||||||
front = cur_start[2] - plane->dist;
|
|
||||||
back = cur_end[2] - plane->dist;
|
|
||||||
break;
|
|
||||||
} //end case*/
|
|
||||||
default: //gee it's not an axial plane
|
|
||||||
{
|
|
||||||
front = DotProduct(cur_start, plane->normal) - plane->dist;
|
front = DotProduct(cur_start, plane->normal) - plane->dist;
|
||||||
back = DotProduct(cur_end, plane->normal) - plane->dist;
|
back = DotProduct(cur_end, plane->normal) - plane->dist;
|
||||||
break;
|
|
||||||
} //end default
|
|
||||||
} //end switch
|
|
||||||
// bk010221 - old location of FPE hack and divide by zero expression
|
// bk010221 - old location of FPE hack and divide by zero expression
|
||||||
//if the whole to be traced line is totally at the front of this node
|
//if the whole to be traced line is totally at the front of this node
|
||||||
//only go down the tree with the front child
|
//only go down the tree with the front child
|
||||||
|
|
@ -797,34 +771,8 @@ int AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int max
|
||||||
//the current node plane
|
//the current node plane
|
||||||
plane = &aasworld.planes[aasnode->planenum];
|
plane = &aasworld.planes[aasnode->planenum];
|
||||||
|
|
||||||
switch(plane->type)
|
|
||||||
{/*FIXME: wtf doesn't this work? obviously the node planes aren't always facing positive!!!
|
|
||||||
//check for axial planes
|
|
||||||
case PLANE_X:
|
|
||||||
{
|
|
||||||
front = cur_start[0] - plane->dist;
|
|
||||||
back = cur_end[0] - plane->dist;
|
|
||||||
break;
|
|
||||||
} //end case
|
|
||||||
case PLANE_Y:
|
|
||||||
{
|
|
||||||
front = cur_start[1] - plane->dist;
|
|
||||||
back = cur_end[1] - plane->dist;
|
|
||||||
break;
|
|
||||||
} //end case
|
|
||||||
case PLANE_Z:
|
|
||||||
{
|
|
||||||
front = cur_start[2] - plane->dist;
|
|
||||||
back = cur_end[2] - plane->dist;
|
|
||||||
break;
|
|
||||||
} //end case*/
|
|
||||||
default: //gee it's not an axial plane
|
|
||||||
{
|
|
||||||
front = DotProduct(cur_start, plane->normal) - plane->dist;
|
front = DotProduct(cur_start, plane->normal) - plane->dist;
|
||||||
back = DotProduct(cur_end, plane->normal) - plane->dist;
|
back = DotProduct(cur_end, plane->normal) - plane->dist;
|
||||||
break;
|
|
||||||
} //end default
|
|
||||||
} //end switch
|
|
||||||
|
|
||||||
//if the whole to be traced line is totally at the front of this node
|
//if the whole to be traced line is totally at the front of this node
|
||||||
//only go down the tree with the front child
|
//only go down the tree with the front child
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill)
|
||||||
else if (token.type == TT_STRING)
|
else if (token.type == TT_STRING)
|
||||||
{
|
{
|
||||||
StripDoubleQuotes(token.string);
|
StripDoubleQuotes(token.string);
|
||||||
ch->c[index].value.string = GetMemory((int)strlen(token.string)+1);
|
ch->c[index].value.string = (char*)GetMemory((int)strlen(token.string)+1);
|
||||||
strcpy(ch->c[index].value.string, token.string);
|
strcpy(ch->c[index].value.string, token.string);
|
||||||
ch->c[index].type = CT_STRING;
|
ch->c[index].type = CT_STRING;
|
||||||
} //end else if
|
} //end else if
|
||||||
|
|
|
||||||
|
|
@ -1552,7 +1552,7 @@ bot_stringlist_t *BotCheckChatMessageIntegrety(char *message, bot_stringlist_t *
|
||||||
if (!BotFindStringInList(stringlist, temp))
|
if (!BotFindStringInList(stringlist, temp))
|
||||||
{
|
{
|
||||||
Log_Write("%s = {\"%s\"} //MISSING RANDOM\r\n", temp, temp);
|
Log_Write("%s = {\"%s\"} //MISSING RANDOM\r\n", temp, temp);
|
||||||
s = GetClearedMemory(sizeof(bot_stringlist_t) + (int)strlen(temp) + 1);
|
s = (bot_stringlist_t*) GetClearedMemory(sizeof(bot_stringlist_t) + (int)strlen(temp) + 1);
|
||||||
s->string = (char *) s + sizeof(bot_stringlist_t);
|
s->string = (char *) s + sizeof(bot_stringlist_t);
|
||||||
strcpy(s->string, temp);
|
strcpy(s->string, temp);
|
||||||
s->next = stringlist;
|
s->next = stringlist;
|
||||||
|
|
@ -1855,7 +1855,7 @@ bot_replychat_t *BotLoadReplyChat(char *filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
} //end if
|
} //end if
|
||||||
//
|
//
|
||||||
replychat = GetClearedHunkMemory(sizeof(bot_replychat_t));
|
replychat = (bot_replychat_t*) GetClearedHunkMemory(sizeof(bot_replychat_t));
|
||||||
replychat->keys = NULL;
|
replychat->keys = NULL;
|
||||||
replychat->next = replychatlist;
|
replychat->next = replychatlist;
|
||||||
replychatlist = replychat;
|
replychatlist = replychat;
|
||||||
|
|
@ -2241,7 +2241,7 @@ int BotLoadChatFile(int chatstate, char *chatfile, char *chatname)
|
||||||
} //end if
|
} //end if
|
||||||
if (!LibVarGetValue("bot_reloadcharacters"))
|
if (!LibVarGetValue("bot_reloadcharacters"))
|
||||||
{
|
{
|
||||||
ichatdata[avail] = GetClearedMemory( sizeof(bot_ichatdata_t) );
|
ichatdata[avail] = (bot_ichatdata_t*) GetClearedMemory( sizeof(bot_ichatdata_t) );
|
||||||
ichatdata[avail]->chat = cs->chat;
|
ichatdata[avail]->chat = cs->chat;
|
||||||
Q_strncpyz( ichatdata[avail]->chatname, chatname, sizeof(ichatdata[avail]->chatname) );
|
Q_strncpyz( ichatdata[avail]->chatname, chatname, sizeof(ichatdata[avail]->chatname) );
|
||||||
Q_strncpyz( ichatdata[avail]->filename, chatfile, sizeof(ichatdata[avail]->filename) );
|
Q_strncpyz( ichatdata[avail]->filename, chatfile, sizeof(ichatdata[avail]->filename) );
|
||||||
|
|
@ -2900,7 +2900,7 @@ int BotAllocChatState(void)
|
||||||
{
|
{
|
||||||
if (!botchatstates[i])
|
if (!botchatstates[i])
|
||||||
{
|
{
|
||||||
botchatstates[i] = GetClearedMemory(sizeof(bot_chatstate_t));
|
botchatstates[i] = (bot_chatstate_t*) GetClearedMemory(sizeof(bot_chatstate_t));
|
||||||
return i;
|
return i;
|
||||||
} //end if
|
} //end if
|
||||||
} //end for
|
} //end for
|
||||||
|
|
|
||||||
|
|
@ -1736,7 +1736,7 @@ int BotAllocGoalState(int client)
|
||||||
{
|
{
|
||||||
if (!botgoalstates[i])
|
if (!botgoalstates[i])
|
||||||
{
|
{
|
||||||
botgoalstates[i] = GetClearedMemory(sizeof(bot_goalstate_t));
|
botgoalstates[i] = (bot_goalstate_t*) GetClearedMemory(sizeof(bot_goalstate_t));
|
||||||
botgoalstates[i]->client = client;
|
botgoalstates[i]->client = client;
|
||||||
return i;
|
return i;
|
||||||
} //end if
|
} //end if
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ int BotAllocMoveState(void)
|
||||||
{
|
{
|
||||||
if (!botmovestates[i])
|
if (!botmovestates[i])
|
||||||
{
|
{
|
||||||
botmovestates[i] = GetClearedMemory(sizeof(bot_movestate_t));
|
botmovestates[i] = (bot_movestate_t*) GetClearedMemory(sizeof(bot_movestate_t));
|
||||||
return i;
|
return i;
|
||||||
} //end if
|
} //end if
|
||||||
} //end for
|
} //end for
|
||||||
|
|
@ -2093,7 +2093,7 @@ bot_moveresult_t BotTravel_Elevator(bot_movestate_t *ms, aas_reachability_t *rea
|
||||||
botimport.Print(PRT_MESSAGE, "bot on elevator\n");
|
botimport.Print(PRT_MESSAGE, "bot on elevator\n");
|
||||||
#endif //DEBUG_ELEVATOR
|
#endif //DEBUG_ELEVATOR
|
||||||
//if vertically not too far from the end point
|
//if vertically not too far from the end point
|
||||||
if (abs(ms->origin[2] - reach->end[2]) < sv_maxbarrier->value)
|
if (fabs(ms->origin[2] - reach->end[2]) < sv_maxbarrier->value)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_ELEVATOR
|
#ifdef DEBUG_ELEVATOR
|
||||||
botimport.Print(PRT_MESSAGE, "bot moving to end\n");
|
botimport.Print(PRT_MESSAGE, "bot moving to end\n");
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ int BotAllocWeaponState(void)
|
||||||
{
|
{
|
||||||
if (!botweaponstates[i])
|
if (!botweaponstates[i])
|
||||||
{
|
{
|
||||||
botweaponstates[i] = GetClearedMemory(sizeof(bot_weaponstate_t));
|
botweaponstates[i] = (bot_weaponstate_t*) GetClearedMemory(sizeof(bot_weaponstate_t));
|
||||||
return i;
|
return i;
|
||||||
} //end if
|
} //end if
|
||||||
} //end for
|
} //end for
|
||||||
|
|
|
||||||
|
|
@ -665,10 +665,13 @@ void PC_AddBuiltinDefines(source_t *source)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
define_t *define;
|
define_t *define;
|
||||||
struct builtin
|
struct builtinStruct
|
||||||
{
|
{
|
||||||
char *string;
|
char *string;
|
||||||
int builtin;
|
int builtin;
|
||||||
|
|
||||||
|
builtinStruct(char* istring, int ibuiltin)
|
||||||
|
: string(istring), builtin(ibuiltin) {}
|
||||||
} builtin[] = { // bk001204 - brackets
|
} builtin[] = { // bk001204 - brackets
|
||||||
{ "__LINE__", BUILTIN_LINE },
|
{ "__LINE__", BUILTIN_LINE },
|
||||||
{ "__FILE__", BUILTIN_FILE },
|
{ "__FILE__", BUILTIN_FILE },
|
||||||
|
|
@ -736,7 +739,7 @@ int PC_ExpandBuiltinDefine(source_t *source, token_t *deftoken, define_t *define
|
||||||
case BUILTIN_DATE:
|
case BUILTIN_DATE:
|
||||||
{
|
{
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
curtime = ctime(&t);
|
curtime = ctime((const time_t*)&t);
|
||||||
strcpy(token->string, "\"");
|
strcpy(token->string, "\"");
|
||||||
strncat(token->string, curtime+4, 7);
|
strncat(token->string, curtime+4, 7);
|
||||||
strncat(token->string+7, curtime+20, 4);
|
strncat(token->string+7, curtime+20, 4);
|
||||||
|
|
@ -751,7 +754,7 @@ int PC_ExpandBuiltinDefine(source_t *source, token_t *deftoken, define_t *define
|
||||||
case BUILTIN_TIME:
|
case BUILTIN_TIME:
|
||||||
{
|
{
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
curtime = ctime(&t);
|
curtime = ctime((const time_t*)&t);
|
||||||
strcpy(token->string, "\"");
|
strcpy(token->string, "\"");
|
||||||
strncat(token->string, curtime+11, 8);
|
strncat(token->string, curtime+11, 8);
|
||||||
strcat(token->string, "\"");
|
strcat(token->string, "\"");
|
||||||
|
|
@ -1331,7 +1334,7 @@ define_t *PC_DefineFromString(char *string)
|
||||||
strncpy(src.filename, "*extern", MAX_PATH);
|
strncpy(src.filename, "*extern", MAX_PATH);
|
||||||
src.scriptstack = script;
|
src.scriptstack = script;
|
||||||
#if DEFINEHASHING
|
#if DEFINEHASHING
|
||||||
src.definehash = GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
|
src.definehash = (define_t**) GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
|
||||||
#endif //DEFINEHASHING
|
#endif //DEFINEHASHING
|
||||||
//create a define from the source
|
//create a define from the source
|
||||||
res = PC_Directive_define(&src);
|
res = PC_Directive_define(&src);
|
||||||
|
|
@ -1606,7 +1609,7 @@ int PC_Directive_endif(source_t *source)
|
||||||
//============================================================================
|
//============================================================================
|
||||||
typedef struct operator_s
|
typedef struct operator_s
|
||||||
{
|
{
|
||||||
int operator;
|
int operatorCode;
|
||||||
int priority;
|
int priority;
|
||||||
int parentheses;
|
int parentheses;
|
||||||
struct operator_s *prev, *next;
|
struct operator_s *prev, *next;
|
||||||
|
|
@ -1914,7 +1917,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
|
||||||
{
|
{
|
||||||
//o = (operator_t *) GetClearedMemory(sizeof(operator_t));
|
//o = (operator_t *) GetClearedMemory(sizeof(operator_t));
|
||||||
AllocOperator(o);
|
AllocOperator(o);
|
||||||
o->operator = t->subtype;
|
o->operatorCode = t->subtype;
|
||||||
o->priority = PC_OperatorPriority(t->subtype);
|
o->priority = PC_OperatorPriority(t->subtype);
|
||||||
o->parentheses = parentheses;
|
o->parentheses = parentheses;
|
||||||
o->next = NULL;
|
o->next = NULL;
|
||||||
|
|
@ -1969,8 +1972,8 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
|
||||||
if (o->priority >= o->next->priority) break;
|
if (o->priority >= o->next->priority) break;
|
||||||
} //end if
|
} //end if
|
||||||
//if the arity of the operator isn't equal to 1
|
//if the arity of the operator isn't equal to 1
|
||||||
if (o->operator != P_LOGIC_NOT
|
if (o->operatorCode != P_LOGIC_NOT
|
||||||
&& o->operator != P_BIN_NOT) v = v->next;
|
&& o->operatorCode != P_BIN_NOT) v = v->next;
|
||||||
//if there's no value or no next value
|
//if there's no value or no next value
|
||||||
if (!v)
|
if (!v)
|
||||||
{
|
{
|
||||||
|
|
@ -1994,7 +1997,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
|
||||||
if (v2) Log_Write("value2 = %f", v2->floatvalue);
|
if (v2) Log_Write("value2 = %f", v2->floatvalue);
|
||||||
} //end else
|
} //end else
|
||||||
#endif //DEBUG_EVAL
|
#endif //DEBUG_EVAL
|
||||||
switch(o->operator)
|
switch(o->operatorCode)
|
||||||
{
|
{
|
||||||
case P_LOGIC_NOT: v1->intvalue = !v1->intvalue;
|
case P_LOGIC_NOT: v1->intvalue = !v1->intvalue;
|
||||||
v1->floatvalue = !v1->floatvalue; break;
|
v1->floatvalue = !v1->floatvalue; break;
|
||||||
|
|
@ -2085,13 +2088,13 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
|
||||||
else Log_Write("result value = %f", v1->floatvalue);
|
else Log_Write("result value = %f", v1->floatvalue);
|
||||||
#endif //DEBUG_EVAL
|
#endif //DEBUG_EVAL
|
||||||
if (error) break;
|
if (error) break;
|
||||||
lastoperatortype = o->operator;
|
lastoperatortype = o->operatorCode;
|
||||||
//if not an operator with arity 1
|
//if not an operator with arity 1
|
||||||
if (o->operator != P_LOGIC_NOT
|
if (o->operatorCode != P_LOGIC_NOT
|
||||||
&& o->operator != P_BIN_NOT)
|
&& o->operatorCode != P_BIN_NOT)
|
||||||
{
|
{
|
||||||
//remove the second value if not question mark operator
|
//remove the second value if not question mark operator
|
||||||
if (o->operator != P_QUESTIONMARK) v = v->next;
|
if (o->operatorCode != P_QUESTIONMARK) v = v->next;
|
||||||
//
|
//
|
||||||
if (v->prev) v->prev->next = v->next;
|
if (v->prev) v->prev->next = v->next;
|
||||||
else firstvalue = v->next;
|
else firstvalue = v->next;
|
||||||
|
|
@ -3002,7 +3005,7 @@ source_t *LoadSourceFile(const char *filename)
|
||||||
source->skip = 0;
|
source->skip = 0;
|
||||||
|
|
||||||
#if DEFINEHASHING
|
#if DEFINEHASHING
|
||||||
source->definehash = GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
|
source->definehash = (define_t**) GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
|
||||||
#endif //DEFINEHASHING
|
#endif //DEFINEHASHING
|
||||||
PC_AddGlobalDefinesToSource(source);
|
PC_AddGlobalDefinesToSource(source);
|
||||||
return source;
|
return source;
|
||||||
|
|
@ -3035,7 +3038,7 @@ source_t *LoadSourceMemory(char *ptr, int length, char *name)
|
||||||
source->skip = 0;
|
source->skip = 0;
|
||||||
|
|
||||||
#if DEFINEHASHING
|
#if DEFINEHASHING
|
||||||
source->definehash = GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
|
source->definehash = (define_t**) GetClearedMemory(DEFINEHASHSIZE * sizeof(define_t *));
|
||||||
#endif //DEFINEHASHING
|
#endif //DEFINEHASHING
|
||||||
PC_AddGlobalDefinesToSource(source);
|
PC_AddGlobalDefinesToSource(source);
|
||||||
return source;
|
return source;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
long int intval, intmin = 0, intmax = 0;
|
long int intval, intmin = 0, intmax = 0;
|
||||||
double floatval;
|
double floatval;
|
||||||
|
|
||||||
if (!PC_ExpectAnyToken(source, &token)) return 0;
|
if (!PC_ExpectAnyToken(source, &token)) return (qboolean) 0;
|
||||||
|
|
||||||
//check for minus sign
|
//check for minus sign
|
||||||
if (token.type == TT_PUNCTUATION)
|
if (token.type == TT_PUNCTUATION)
|
||||||
|
|
@ -88,23 +88,23 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
if (fd->type & FT_UNSIGNED)
|
if (fd->type & FT_UNSIGNED)
|
||||||
{
|
{
|
||||||
SourceError(source, "expected unsigned value, found %s", token.string);
|
SourceError(source, "expected unsigned value, found %s", token.string);
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
//if not a minus sign
|
//if not a minus sign
|
||||||
if (strcmp(token.string, "-"))
|
if (strcmp(token.string, "-"))
|
||||||
{
|
{
|
||||||
SourceError(source, "unexpected punctuation %s", token.string);
|
SourceError(source, "unexpected punctuation %s", token.string);
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
negative = qtrue;
|
negative = qtrue;
|
||||||
//read the number
|
//read the number
|
||||||
if (!PC_ExpectAnyToken(source, &token)) return 0;
|
if (!PC_ExpectAnyToken(source, &token)) return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
//check if it is a number
|
//check if it is a number
|
||||||
if (token.type != TT_NUMBER)
|
if (token.type != TT_NUMBER)
|
||||||
{
|
{
|
||||||
SourceError(source, "expected number, found %s", token.string);
|
SourceError(source, "expected number, found %s", token.string);
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
//check for a float value
|
//check for a float value
|
||||||
if (token.subtype & TT_FLOAT)
|
if (token.subtype & TT_FLOAT)
|
||||||
|
|
@ -112,7 +112,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
if ((fd->type & FT_TYPE) != FT_FLOAT)
|
if ((fd->type & FT_TYPE) != FT_FLOAT)
|
||||||
{
|
{
|
||||||
SourceError(source, "unexpected float");
|
SourceError(source, "unexpected float");
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
floatval = token.floatvalue;
|
floatval = token.floatvalue;
|
||||||
if (negative) floatval = -floatval;
|
if (negative) floatval = -floatval;
|
||||||
|
|
@ -121,11 +121,11 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
if (floatval < fd->floatmin || floatval > fd->floatmax)
|
if (floatval < fd->floatmin || floatval > fd->floatmax)
|
||||||
{
|
{
|
||||||
SourceError(source, "float out of range [%f, %f]", fd->floatmin, fd->floatmax);
|
SourceError(source, "float out of range [%f, %f]", fd->floatmin, fd->floatmax);
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
} //end if
|
} //end if
|
||||||
*(float *) p = (float) floatval;
|
*(float *) p = (float) floatval;
|
||||||
return 1;
|
return (qboolean) 1;
|
||||||
} //end if
|
} //end if
|
||||||
//
|
//
|
||||||
intval = token.intvalue;
|
intval = token.intvalue;
|
||||||
|
|
@ -151,7 +151,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
if (intval < intmin || intval > intmax)
|
if (intval < intmin || intval > intmax)
|
||||||
{
|
{
|
||||||
SourceError(source, "value %d out of range [%d, %d]", intval, intmin, intmax);
|
SourceError(source, "value %d out of range [%d, %d]", intval, intmin, intmax);
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
} //end if
|
} //end if
|
||||||
else if ((fd->type & FT_TYPE) == FT_FLOAT)
|
else if ((fd->type & FT_TYPE) == FT_FLOAT)
|
||||||
|
|
@ -161,7 +161,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
if (intval < fd->floatmin || intval > fd->floatmax)
|
if (intval < fd->floatmin || intval > fd->floatmax)
|
||||||
{
|
{
|
||||||
SourceError(source, "value %d out of range [%f, %f]", intval, fd->floatmin, fd->floatmax);
|
SourceError(source, "value %d out of range [%f, %f]", intval, fd->floatmin, fd->floatmax);
|
||||||
return 0;
|
return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
} //end if
|
} //end if
|
||||||
} //end else if
|
} //end else if
|
||||||
|
|
@ -180,7 +180,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
{
|
{
|
||||||
*(float *) p = (float) intval;
|
*(float *) p = (float) intval;
|
||||||
} //end else
|
} //end else
|
||||||
return 1;
|
return (qboolean) 1;
|
||||||
} //end of the function ReadNumber
|
} //end of the function ReadNumber
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
|
@ -192,7 +192,7 @@ qboolean ReadChar(source_t *source, fielddef_t *fd, void *p)
|
||||||
{
|
{
|
||||||
token_t token;
|
token_t token;
|
||||||
|
|
||||||
if (!PC_ExpectAnyToken(source, &token)) return 0;
|
if (!PC_ExpectAnyToken(source, &token)) return (qboolean) 0;
|
||||||
|
|
||||||
//take literals into account
|
//take literals into account
|
||||||
if (token.type == TT_LITERAL)
|
if (token.type == TT_LITERAL)
|
||||||
|
|
@ -203,9 +203,9 @@ qboolean ReadChar(source_t *source, fielddef_t *fd, void *p)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PC_UnreadLastToken(source);
|
PC_UnreadLastToken(source);
|
||||||
if (!ReadNumber(source, fd, p)) return 0;
|
if (!ReadNumber(source, fd, p)) return (qboolean) 0;
|
||||||
} //end if
|
} //end if
|
||||||
return 1;
|
return (qboolean) 1;
|
||||||
} //end of the function ReadChar
|
} //end of the function ReadChar
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
@ -131,6 +132,7 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
@ -155,6 +157,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
@ -179,6 +182,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user