30 Nov 2008
This commit is contained in:
parent
4fcae8e75f
commit
1357ca059c
1098
baserc/client.h
1098
baserc/client.h
File diff suppressed because it is too large
Load Diff
5951
baserc/server.h
5951
baserc/server.h
File diff suppressed because it is too large
Load Diff
2503
baserc/uimenu.h
2503
baserc/uimenu.h
File diff suppressed because it is too large
Load Diff
|
@ -477,7 +477,7 @@ void UnparseEntities( void )
|
|||
char *buf, *end;
|
||||
char line[2048];
|
||||
char key[MAX_KEY], value[MAX_VALUE];
|
||||
const char *value2;
|
||||
char *value2;
|
||||
int i;
|
||||
|
||||
buf = dentdata;
|
||||
|
@ -491,14 +491,20 @@ void UnparseEntities( void )
|
|||
|
||||
// certain entities get stripped from bsp file */
|
||||
value2 = ValueForKey( &entities[i], "classname" );
|
||||
if(!com.stricmp( value2, "_decal" ) || !com.stricmp( value2, "_skybox" ))
|
||||
continue;
|
||||
|
||||
com.strcat( end, "{\n" );
|
||||
end += 2;
|
||||
|
||||
// always place "classname" at first
|
||||
StripTrailing( value2 );
|
||||
com.snprintf( line, 2048, "\"classname\" \"%s\"\n", value2 );
|
||||
com.strcat( end, line );
|
||||
end += com.strlen( line );
|
||||
|
||||
for( ep = entities[i].epairs; ep; ep = ep->next )
|
||||
{
|
||||
if( !com.stricmp( ep->key, "classname" ))
|
||||
continue; // already stored
|
||||
com.strncpy( key, ep->key, MAX_KEY );
|
||||
StripTrailing( key );
|
||||
com.strncpy( value, ep->value, MAX_VALUE );
|
||||
|
|
|
@ -81,7 +81,7 @@ bool CL_ParseUserMessage( int svc_number )
|
|||
// setup args
|
||||
PRVM_G_FLOAT(OFS_PARM0) = (float)svc_number;
|
||||
PRVM_ExecuteProgram (prog->globals.cl->HUD_ParseMessage, "HUD_ParseMessage");
|
||||
msg_parsed = PRVM_G_FLOAT(OFS_RETURN);
|
||||
msg_parsed = (bool)PRVM_G_FLOAT(OFS_RETURN);
|
||||
|
||||
return msg_parsed;
|
||||
}
|
||||
|
@ -638,9 +638,9 @@ VM_TimeStamp, // #31 string Com_TimeStamp( float format )
|
|||
VM_LocalCmd, // #32 void LocalCmd( ... )
|
||||
VM_SubString, // #33 string substring( string s, float start, float length )
|
||||
VM_AddCommand, // #34 void Add_Command( string s )
|
||||
NULL, // #35 -- reserved --
|
||||
NULL, // #36 -- reserved --
|
||||
NULL, // #37 -- reserved --
|
||||
VM_atof, // #35 float atof( string s )
|
||||
VM_atoi, // #36 float atoi( string s )
|
||||
VM_atov, // #37 vector atov( string s )
|
||||
NULL, // #38 -- reserved --
|
||||
NULL, // #39 -- reserved --
|
||||
NULL, // #40 -- reserved --
|
||||
|
|
|
@ -251,6 +251,9 @@ void VM_CvarGetString( void );
|
|||
void VM_AddCommand( void );
|
||||
void VM_Random( void );
|
||||
void VM_ComVA( void );
|
||||
void VM_atof( void );
|
||||
void VM_atoi( void );
|
||||
void VM_atov( void );
|
||||
void VM_ComStrlen( void );
|
||||
void VM_TimeStamp( void );
|
||||
void VM_SubString( void );
|
||||
|
|
|
@ -703,6 +703,45 @@ void VM_ComVA( void )
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
VM_atof
|
||||
|
||||
float atof( string s )
|
||||
=========
|
||||
*/
|
||||
void VM_atof( void )
|
||||
{
|
||||
if(!VM_ValidateArgs( "atof", 1 )) return;
|
||||
PRVM_G_FLOAT(OFS_RETURN) = com.atof(PRVM_G_STRING(OFS_PARM0));
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
VM_atoi
|
||||
|
||||
float atoi( string s )
|
||||
=========
|
||||
*/
|
||||
void VM_atoi( void )
|
||||
{
|
||||
if(!VM_ValidateArgs( "atoi", 1 )) return;
|
||||
PRVM_G_FLOAT(OFS_RETURN) = com.atoi(PRVM_G_STRING(OFS_PARM0));
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
VM_atof
|
||||
|
||||
vector atov( string s )
|
||||
=========
|
||||
*/
|
||||
void VM_atov( void )
|
||||
{
|
||||
if(!VM_ValidateArgs( "atov", 1 )) return;
|
||||
com.atov( PRVM_G_VECTOR(OFS_RETURN), PRVM_G_STRING(OFS_PARM0), 3 );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
VM_ComStrlen
|
||||
|
@ -1590,9 +1629,9 @@ VM_TimeStamp, // #31 string Com_TimeStamp( float format )
|
|||
VM_LocalCmd, // #32 void LocalCmd( ... )
|
||||
VM_SubString, // #33 string substring( string s, float start, float length )
|
||||
VM_AddCommand, // #34 void Add_Command( string s )
|
||||
NULL, // #35 -- reserved --
|
||||
NULL, // #36 -- reserved --
|
||||
NULL, // #37 -- reserved --
|
||||
VM_atof, // #35 float atof( string s )
|
||||
VM_atoi, // #36 float atoi( string s )
|
||||
VM_atov, // #37 vector atov( string s )
|
||||
NULL, // #38 -- reserved --
|
||||
NULL, // #39 -- reserved --
|
||||
NULL, // #40 -- reserved --
|
||||
|
|
|
@ -699,9 +699,9 @@ VM_TimeStamp, // #31 string Com_TimeStamp( float format )
|
|||
VM_LocalCmd, // #32 void LocalCmd( ... )
|
||||
VM_SubString, // #33 string substring( string s, float start, float length )
|
||||
VM_AddCommand, // #34 void Add_Command( string s )
|
||||
NULL, // #35 -- reserved --
|
||||
NULL, // #36 -- reserved --
|
||||
NULL, // #37 -- reserved --
|
||||
VM_atof, // #35 float atof( string s )
|
||||
VM_atoi, // #36 float atoi( string s )
|
||||
VM_atov, // #37 vector atov( string s )
|
||||
NULL, // #38 -- reserved --
|
||||
NULL, // #39 -- reserved --
|
||||
NULL, // #40 -- reserved --
|
||||
|
|
|
@ -42,9 +42,10 @@ struct sv_globalvars_s
|
|||
func_t PlayerPreThink;
|
||||
func_t PlayerPostThink;
|
||||
func_t ClientConnect;
|
||||
func_t ClientCommand;
|
||||
func_t ClientDisconnect;
|
||||
func_t PutClientInServer;
|
||||
func_t ClientCommand;
|
||||
func_t KeyValue;
|
||||
func_t ClientUserInfoChanged;
|
||||
func_t EmitSound;
|
||||
};
|
||||
|
@ -152,6 +153,6 @@ struct sv_entvars_s
|
|||
float team;
|
||||
};
|
||||
|
||||
#define PROG_CRC_SERVER 1737
|
||||
#define PROG_CRC_SERVER 8505
|
||||
|
||||
#endif//SV_EDICT_H
|
|
@ -81,6 +81,15 @@ void SV_UpdateEntityState( edict_t *ent )
|
|||
ent->priv.sv->s.model.controller[i] = ent->progs.sv->controller[i];
|
||||
}
|
||||
|
||||
if( ent->priv.sv->s.ed_type != ED_VIEWMODEL )
|
||||
ent->priv.sv->s.movetype = ent->progs.sv->movetype;
|
||||
|
||||
if( ent->priv.sv->s.ed_type == ED_MOVER || ent->priv.sv->s.ed_type == ED_BSPBRUSH )
|
||||
{
|
||||
// these needs to right calculate direction of scroll texture
|
||||
VectorCopy( ent->progs.sv->movedir, ent->priv.sv->s.velocity );
|
||||
}
|
||||
|
||||
if( ent->priv.sv->s.ed_type == ED_VIEWMODEL )
|
||||
{
|
||||
// copy v_model state from client to viemodel entity
|
||||
|
@ -101,11 +110,11 @@ void SV_UpdateEntityState( edict_t *ent )
|
|||
if( ent->progs.sv->fixangle )
|
||||
{
|
||||
// FIXME: set angles
|
||||
//for( i = 0; i < 3; i++ )
|
||||
// ent->priv.sv->s.delta_angles[i] = ANGLE2SHORT( ent->priv.sv->s.angles[i] );
|
||||
//VectorClear( ent->priv.sv->s.angles );
|
||||
//VectorClear( ent->priv.sv->s.viewangles );
|
||||
//VectorClear( ent->progs.sv->v_angle );
|
||||
for( i = 0; i < 3; i++ )
|
||||
ent->priv.sv->s.delta_angles[i] = ANGLE2SHORT( ent->priv.sv->s.angles[i] );
|
||||
VectorClear( ent->priv.sv->s.angles );
|
||||
VectorClear( ent->priv.sv->s.viewangles );
|
||||
VectorClear( ent->progs.sv->v_angle );
|
||||
|
||||
// and clear fixangle for the next frame
|
||||
ent->progs.sv->fixangle = 0;
|
||||
|
@ -256,6 +265,10 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
|
|||
ent = PRVM_EDICT_NUM( e );
|
||||
force = false; // clear forceflag
|
||||
|
||||
// completely ignore dormant entity
|
||||
if((int)ent->progs.sv->flags & FL_DORMANT )
|
||||
continue;
|
||||
|
||||
// send viewmodel entity always
|
||||
// NOTE: never apply LinkEdict to viewmodel entity, because
|
||||
// we wan't see it in list of entities returned with SV_AreaEdicts
|
||||
|
|
|
@ -1507,7 +1507,7 @@ void SV_Physics_Conveyor( edict_t *ent )
|
|||
{
|
||||
if( tr.plane.normal[2] > 0 )
|
||||
{
|
||||
v[2] = ent->progs.sv->speed * sqrt(1.0 - tr.plane.normal[2]*tr.plane.normal[2]) / tr.plane.normal[2];
|
||||
v[2] = ent->progs.sv->speed * com.sqrt( 1.0 - tr.plane.normal[2]*tr.plane.normal[2]) / tr.plane.normal[2];
|
||||
if(DotProduct( ent->progs.sv->movedir, tr.plane.normal) > 0)
|
||||
v[2] = -v[2]; // then we're moving down
|
||||
move[2] = v[2] * 0.1f;
|
||||
|
|
|
@ -675,11 +675,12 @@ void SV_RestoreEdict( edict_t *ent )
|
|||
ent->priv.sv->s.soundindex = SV_SoundIndex(PRVM_GetString(ent->progs.sv->loopsound));
|
||||
}
|
||||
|
||||
bool SV_ParseKeyValue( edict_t *ent, const char *key, const char *value )
|
||||
void SV_ParseKeyValue( edict_t *ent, const char *key, const char *value )
|
||||
{
|
||||
// FIXME: implement
|
||||
Msg("ParseKeyValue: %s - %s\n", key, value );
|
||||
return false;
|
||||
prog->globals.sv->pev = PRVM_EDICT_TO_PROG( ent );
|
||||
PRVM_G_INT(OFS_PARM0) = PRVM_SetEngineString( key );
|
||||
PRVM_G_INT(OFS_PARM1) = PRVM_SetEngineString( value );
|
||||
PRVM_ExecuteProgram (prog->globals.sv->KeyValue, "KeyValue" );
|
||||
}
|
||||
|
||||
void SV_VM_Begin( void )
|
||||
|
@ -2446,9 +2447,9 @@ VM_TimeStamp, // #31 string Com_TimeStamp( float format )
|
|||
VM_LocalCmd, // #32 void LocalCmd( ... )
|
||||
VM_SubString, // #33 string substring( string s, float start, float length )
|
||||
VM_AddCommand, // #34 void Add_Command( string s )
|
||||
NULL, // #35 -- reserved --
|
||||
NULL, // #36 -- reserved --
|
||||
NULL, // #37 -- reserved --
|
||||
VM_atof, // #35 float atof( string s )
|
||||
VM_atoi, // #36 float atoi( string s )
|
||||
VM_atov, // #37 vector atov( string s )
|
||||
NULL, // #38 -- reserved --
|
||||
NULL, // #39 -- reserved --
|
||||
NULL, // #40 -- reserved --
|
||||
|
|
|
@ -202,14 +202,14 @@ void SV_ClassifyEdict( edict_t *ent )
|
|||
}
|
||||
else if( ent->progs.sv->movetype == MOVETYPE_PHYSIC )
|
||||
sv_ent->s.ed_type = ED_RIGIDBODY;
|
||||
else if( ent->progs.sv->solid == SOLID_BSP )
|
||||
else if( ent->progs.sv->solid == SOLID_BSP || VectorIsNull( ent->progs.sv->origin ))
|
||||
{
|
||||
if((int)ent->progs.sv->flags & FL_WORLDBRUSH )
|
||||
if( ent->progs.sv->movetype == MOVETYPE_CONVEYOR )
|
||||
sv_ent->s.ed_type = ED_MOVER;
|
||||
else if((int)ent->progs.sv->flags & FL_WORLDBRUSH )
|
||||
sv_ent->s.ed_type = ED_BSPBRUSH;
|
||||
else if( ent->progs.sv->movetype == MOVETYPE_PUSH )
|
||||
sv_ent->s.ed_type = ED_MOVER;
|
||||
else if( ent->progs.sv->movetype == MOVETYPE_CONVEYOR )
|
||||
sv_ent->s.ed_type = ED_MOVER;
|
||||
else if( ent->progs.sv->movetype == MOVETYPE_NONE )
|
||||
sv_ent->s.ed_type = ED_BSPBRUSH;
|
||||
}
|
||||
|
|
|
@ -310,10 +310,10 @@ void com_atov( float *vec, const char *str, size_t siz )
|
|||
|
||||
for ( j = 0; j < siz; j++ )
|
||||
{
|
||||
vec[j] = com_atof( pfront );
|
||||
vec[j] = com.atof( pfront );
|
||||
|
||||
// valid separator is space or ,
|
||||
while( *pstr && (*pstr != ' ' || *pstr != ',' ))
|
||||
// valid separator is space
|
||||
while( *pstr && *pstr != ' ' )
|
||||
pstr++;
|
||||
|
||||
if (!*pstr) break;
|
||||
|
|
|
@ -159,7 +159,7 @@ typedef struct prvm_prog_s
|
|||
void (*count_edicts)(void);
|
||||
bool (*load_edict)(edict_t *ent); // initialize edict for first loading
|
||||
void (*restore_edict)(edict_t *ent); // restore edict from savegame or changelevel
|
||||
bool (*keyvalue_edict)(edict_t *ent, const char *key, const char *value ); // KeyValueData
|
||||
void (*keyvalue_edict)(edict_t *ent, const char *key, const char *value ); // KeyValueData
|
||||
void (*init_cmd)(void);
|
||||
void (*reset_cmd)(void);
|
||||
void (*error_cmd)(const char *format, ...);
|
||||
|
|
|
@ -67,5 +67,5 @@ if exist vsound\vsound.plg del /f /q vsound\vsound.plg
|
|||
echo Build succeeded!
|
||||
echo Please wait. Xash is now loading
|
||||
cd D:\Xash3D\
|
||||
quake.exe -game tmpQuArK -dev 3 -log +map qctest
|
||||
quake.exe -game tmpQuArK -dev 3 -log +map newmap
|
||||
:done
|
|
@ -1000,6 +1000,23 @@ static void RB_CalcTextureCoords( stageBundle_t *bundle, uint unit )
|
|||
ref.texCoordArray[unit][j][1] += st[1];
|
||||
}
|
||||
break;
|
||||
case TCMOD_CONVEYOR:
|
||||
if( m_pCurrentEntity->framerate == 0.0f ) return;
|
||||
now = (m_pCurrentEntity->framerate * m_fShaderTime) * 0.0039; // magic number :-)
|
||||
s = m_pCurrentEntity->movedir[0];
|
||||
t = m_pCurrentEntity->movedir[1];
|
||||
|
||||
st[0] = now * s;
|
||||
st[0] -= floor(st[0]);
|
||||
st[1] = now * t;
|
||||
st[1] -= floor(st[1]);
|
||||
|
||||
for( j = 0; j < ref.numVertex; j++ )
|
||||
{
|
||||
ref.texCoordArray[unit][j][0] -= st[0];
|
||||
ref.texCoordArray[unit][j][1] += st[1];
|
||||
}
|
||||
break;
|
||||
case TCMOD_ROTATE:
|
||||
rad = -DEG2RAD( tcMod->params[0] * m_fShaderTime );
|
||||
s = com.sin( rad );
|
||||
|
|
|
@ -522,6 +522,7 @@ typedef struct ref_entity_s
|
|||
|
||||
vec3_t angles;
|
||||
vec3_t origin; // position
|
||||
vec3_t movedir; // forward vector that computed on a server
|
||||
matrix3x3 matrix; // rotation vectors
|
||||
|
||||
float framerate; // custom framerate
|
||||
|
|
|
@ -1080,6 +1080,12 @@ static bool R_AddEntityToScene( entity_state_t *s1, entity_state_t *s2, float le
|
|||
refent->renderfx = s1->renderfx;
|
||||
refent->prev.sequencetime = s1->model.animtime - s2->model.animtime;
|
||||
|
||||
if( refent->ent_type == ED_MOVER || refent->ent_type == ED_BSPBRUSH )
|
||||
{
|
||||
// store conveyor movedir in pev->velocity
|
||||
VectorNormalize2( s1->velocity, refent->movedir );
|
||||
}
|
||||
|
||||
// calculate angles
|
||||
if( refent->effects & EF_ROTATE )
|
||||
{
|
||||
|
|
|
@ -3891,13 +3891,20 @@ static ref_shader_t *R_CreateDefaultShader( const char *name, int shaderType, ui
|
|||
}
|
||||
shader->stages[0]->bundles[0]->numTextures++;
|
||||
|
||||
// support for hl1 "scroll" textures
|
||||
if( com.stristr( shader->stages[0]->bundles[0]->textures[0]->name, "SCROLL" ))
|
||||
{
|
||||
shader->stages[0]->flags |= STAGEBUNDLE_TCMOD;
|
||||
shader->stages[0]->bundles[0]->tcMod[0].type = TCMOD_CONVEYOR;
|
||||
shader->stages[0]->bundles[0]->tcModNum++;
|
||||
}
|
||||
|
||||
// fast presets
|
||||
if( shader->surfaceParm & SURF_BLEND )
|
||||
{
|
||||
shader->stages[0]->flags |= SHADERSTAGE_BLENDFUNC;
|
||||
shader->stages[0]->blendFunc.src = GL_SRC_ALPHA;
|
||||
shader->stages[0]->blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
shader->flags |= SHADER_ENTITYMERGABLE; // using renderamt
|
||||
}
|
||||
else if( shader->surfaceParm & SURF_ALPHA )
|
||||
{
|
||||
|
@ -3906,7 +3913,6 @@ static ref_shader_t *R_CreateDefaultShader( const char *name, int shaderType, ui
|
|||
shader->stages[0]->blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
shader->stages[0]->alphaFunc.func = GL_GREATER;
|
||||
shader->stages[0]->alphaFunc.ref = 0.666;
|
||||
shader->flags |= SHADER_ENTITYMERGABLE; // using renderamt
|
||||
}
|
||||
if( shader->surfaceParm & SURF_WARP )
|
||||
{
|
||||
|
|
|
@ -206,7 +206,8 @@ typedef enum
|
|||
TCMOD_ROTATE,
|
||||
TCMOD_STRETCH,
|
||||
TCMOD_TURB,
|
||||
TCMOD_TRANSFORM
|
||||
TCMOD_TRANSFORM,
|
||||
TCMOD_CONVEYOR // same as TCMOD_SCROLL, but dynamically changed by entity
|
||||
} tcModType_t;
|
||||
|
||||
typedef enum
|
||||
|
|
112
vprogs/pr_comp.c
112
vprogs/pr_comp.c
|
@ -368,15 +368,14 @@ keyword_t pr_keywords[] =
|
|||
{KEYWORD_DEFAULT, "default", "", 0 },
|
||||
{KEYWORD_GOTO, "goto", "", 0 },
|
||||
{KEYWORD_INT, "int", "integer",0 },
|
||||
{KEYWORD_STATE, "state", "", ev_field},
|
||||
{KEYWORD_STATE, "state", "", ev_field},// intrinsic
|
||||
{KEYWORD_CLASS, "class", "", 0 },
|
||||
{KEYWORD_STRUCT, "struct", "", 0 },
|
||||
{KEYWORD_SWITCH, "switch", "", 0 },
|
||||
{KEYWORD_TYPEDEF, "typedef", "", 0 },
|
||||
{KEYWORD_EXTERN, "extern", "", 0 },
|
||||
{KEYWORD_VAR, "var", "", 0 }, // FIXME: get rid of this
|
||||
{KEYWORD_UNION, "union", "", 0 },
|
||||
{KEYWORD_THINKTIME, "thinktime", "", 0 },
|
||||
{KEYWORD_THINKTIME, "thinktime", "", 0 }, // intrinsic
|
||||
{KEYWORD_BOOL, "bool", "BOOL", 0 },
|
||||
{KEYWORD_ASM, "asm", "_asm", 0 },
|
||||
{KEYWORD_SHARED, "shared", "_export",0 }, // rename to ?
|
||||
|
@ -543,7 +542,6 @@ char *PR_NameFromType( etype_t type )
|
|||
case ev_vector: com.strncpy(typeinfo, "vector", 32 ); break;
|
||||
case ev_entity: com.strncpy(typeinfo, "entity", 32 ); break;
|
||||
case ev_integer: com.strncpy(typeinfo, "int", 32 ); break;
|
||||
case ev_variant: com.strncpy(typeinfo, "var", 32 ); break;
|
||||
case ev_struct: com.strncpy(typeinfo, "struct", 32 ); break;
|
||||
case ev_union: com.strncpy(typeinfo, "union", 32 ); break;
|
||||
case ev_void: com.strncpy(typeinfo, "void", 32 ); break;
|
||||
|
@ -564,7 +562,6 @@ void PR_KeyWordValid( char *name, type_t *type )
|
|||
case ev_vector:
|
||||
case ev_entity:
|
||||
case ev_integer:
|
||||
case ev_variant:
|
||||
case ev_struct:
|
||||
case ev_union:
|
||||
typeinfo = PR_NameFromType( type->type );
|
||||
|
@ -592,7 +589,7 @@ void PR_GetEntvarsName( void )
|
|||
def_t *d;
|
||||
|
||||
// for emit class constructor we need before
|
||||
// get name of global entvars pointer (default "self")
|
||||
// get name of global entvars pointer (default "pev")
|
||||
|
||||
if( pr_setevarsname ) return;
|
||||
|
||||
|
@ -1434,13 +1431,12 @@ def_t *PR_ParseFunctionCall (def_t *func)
|
|||
func->timescalled++;
|
||||
t = func->type;
|
||||
|
||||
if(t && t->type == ev_variant) t->aux_type = type_variant;
|
||||
if(t && t->type != ev_function && t->type != ev_variant)
|
||||
if( t && t->type != ev_function )
|
||||
{
|
||||
PR_ParseErrorPrintDef( ERR_NOTAFUNCTION, func, "not a function" );
|
||||
}
|
||||
|
||||
if (!t->num_parms && t->type != ev_variant)
|
||||
if( !t->num_parms )
|
||||
{
|
||||
// intrinsics. These base functions have variable arguments. I would check for (...) args too,
|
||||
// but that might be used for extended builtin functionality. (this code wouldn't compile otherwise)
|
||||
|
@ -1455,18 +1451,19 @@ def_t *PR_ParseFunctionCall (def_t *func)
|
|||
{
|
||||
rettype = TypeForName( PR_ParseName());
|
||||
if( !rettype || rettype->type != ev_entity )
|
||||
PR_ParseError(ERR_NOTANAME, "Spawn operator with undefined class");
|
||||
PR_ParseError(ERR_NOTANAME, "spawn operator with undefined class" );
|
||||
|
||||
PR_Expect(")");
|
||||
}
|
||||
|
||||
if( def_ret.temp->used )
|
||||
PR_ParseWarning(0, "Return value conflict - output is likly to be invalid");
|
||||
PR_ParseWarning( 0, "return value conflict - output is likly to be invalid" );
|
||||
def_ret.temp->used = true;
|
||||
|
||||
if( rettype != type_entity )
|
||||
{
|
||||
char genfunc[2048];
|
||||
|
||||
com.sprintf( genfunc, "Class*%s", rettype->name );
|
||||
func = PR_GetDef( type_function, genfunc, NULL, true, 1 );
|
||||
func->references++;
|
||||
|
@ -1510,16 +1507,11 @@ def_t *PR_ParseFunctionCall (def_t *func)
|
|||
}
|
||||
}
|
||||
}
|
||||
PR_LockActiveTemps(); // any temps before are likly to be used with the return value.
|
||||
PR_LockActiveTemps(); // any temps before are likely to be used with the return value.
|
||||
|
||||
// any temps referenced to build the parameters don't need to be locked.
|
||||
// copy the arguments to the global parameter variables
|
||||
if (t->type == ev_variant)
|
||||
{
|
||||
extraparms = true;
|
||||
np = 0;
|
||||
}
|
||||
else if (t->num_parms < 0)
|
||||
if( t->num_parms < 0 )
|
||||
{
|
||||
extraparms = true;
|
||||
np = (t->num_parms * -1) - 1;
|
||||
|
@ -1665,7 +1657,7 @@ def_t *PR_ParseFunctionCall (def_t *func)
|
|||
// you're allowed to use int 0 to pass a null function pointer
|
||||
// this is basically because __NULL__ is defined as ~0 (int 0)
|
||||
}
|
||||
else if (p->type != ev_variant)
|
||||
else
|
||||
{
|
||||
// can cast to variant whatever happens
|
||||
if (opt_laxcasts || (p->type == ev_function && e->type->type == ev_function))
|
||||
|
@ -1757,20 +1749,15 @@ def_t *PR_ParseFunctionCall (def_t *func)
|
|||
}
|
||||
|
||||
if( old )
|
||||
{
|
||||
if (t->type == ev_variant)
|
||||
{
|
||||
d = PR_GetTemp(type_variant);
|
||||
PR_FreeTemp(PR_Statement(pr_opcodes+OP_STORE_F, &def_ret, d, NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
d = PR_GetTemp(t->aux_type);
|
||||
|
||||
if( t->aux_type->size == 3 ) PR_FreeTemp( PR_Statement( pr_opcodes+OP_STORE_V, &def_ret, d, NULL ));
|
||||
else PR_FreeTemp( PR_Statement( pr_opcodes+OP_STORE_F, &def_ret, d, NULL ));
|
||||
}
|
||||
|
||||
if( def_ret.type->size == 3 ) PR_FreeTemp( PR_Statement(pr_opcodes+OP_STORE_V, old, &def_ret, NULL ));
|
||||
else PR_FreeTemp(PR_Statement( pr_opcodes+OP_STORE_F, old, &def_ret, NULL ));
|
||||
|
||||
PR_FreeTemp( old );
|
||||
PR_UnFreeTemp( &def_ret );
|
||||
PR_UnFreeTemp( d );
|
||||
|
@ -1778,9 +1765,9 @@ def_t *PR_ParseFunctionCall (def_t *func)
|
|||
return d;
|
||||
}
|
||||
|
||||
if (t->type == ev_variant) def_ret.type = type_variant;
|
||||
else def_ret.type = t->aux_type;
|
||||
if (def_ret.temp->used) PR_ParseWarning(WARN_FIXEDRETURNVALUECONFLICT, "Return value conflict - output is inefficient");
|
||||
def_ret.type = t->aux_type;
|
||||
if( def_ret.temp->used )
|
||||
PR_ParseWarning( WARN_FIXEDRETURNVALUECONFLICT, "return value conflict - output is inefficient" );
|
||||
def_ret.temp->used = true;
|
||||
|
||||
return &def_ret;
|
||||
|
@ -2160,22 +2147,19 @@ def_t *PR_ParseValue (type_t *assumeclass)
|
|||
od = d = PR_GetDef( type_function, name, NULL, true, 1 );
|
||||
else if( PR_KeywordEnabled( KEYWORD_CLASS ) && !com.strcmp( name, "this" ))
|
||||
{
|
||||
if (!pr_classtype) PR_ParseError(ERR_NOTANAME, "Cannot use 'this' outside of an OO function\n");
|
||||
if( !pr_classtype )
|
||||
PR_ParseError( ERR_NOTANAME, "cannot use 'this' outside of an OO function\n" );
|
||||
od = PR_GetDef( NULL, pevname, NULL, true, 1 );
|
||||
od = d = PR_DummyDef( pr_classtype, "this", pr_scope, 1, od->ofs, true );
|
||||
}
|
||||
else if( PR_KeywordEnabled( KEYWORD_CLASS ) && !com.strcmp( name, "super" ))
|
||||
{
|
||||
if (!pr_classtype) PR_ParseError(ERR_NOTANAME, "Cannot use 'super' outside of an OO function\n");
|
||||
if( !pr_classtype )
|
||||
PR_ParseError( ERR_NOTANAME, "cannot use 'super' outside of an OO function\n" );
|
||||
od = PR_GetDef( NULL, pevname, NULL, true, 1 );
|
||||
od = d = PR_DummyDef( pr_classtype, "super", pr_scope, 1, od->ofs, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
od = d = PR_GetDef (type_variant, name, pr_scope, true, 1);
|
||||
if (!d) PR_ParseError (ERR_UNKNOWNVALUE, "Unknown value \"%s\"", name);
|
||||
else PR_ParseWarning (ERR_UNKNOWNVALUE, "Unknown value \"%s\".", name);
|
||||
}
|
||||
else PR_ParseError( ERR_UNKNOWNVALUE, "unknown value \"%s\"", name );
|
||||
}
|
||||
reloop:
|
||||
// FIXME: Make this work with double arrays/2nd level structures.
|
||||
|
@ -3244,8 +3228,7 @@ void PR_ParseStatement (void)
|
|||
{
|
||||
int continues;
|
||||
int breaks;
|
||||
int cases;
|
||||
int i;
|
||||
int cases, i;
|
||||
def_t *e, *e2;
|
||||
dstatement_t *patch1, *patch2, *patch3;
|
||||
int statementstart = pr_source_line;
|
||||
|
@ -3277,7 +3260,11 @@ void PR_ParseStatement (void)
|
|||
e = PR_Expression( TOP_PRIORITY, true );
|
||||
PR_Expect( ";" );
|
||||
if( pr_scope->type->aux_type->type != e->type->type )
|
||||
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 )
|
||||
PR_ParseWarning( WARN_WRONGRETURNTYPE, "\'%s\' : 'void' function returning a value", pr_scope->name );
|
||||
else PR_ParseWarning( WARN_WRONGRETURNTYPE, "\'%s\' returned %s, expected %s", pr_scope->name, e->type->name, pr_scope->type->aux_type->name);
|
||||
}
|
||||
PR_FreeTemp(PR_Statement (&pr_opcodes[OP_RETURN], e, 0, NULL));
|
||||
return;
|
||||
}
|
||||
|
@ -3492,8 +3479,7 @@ void PR_ParseStatement (void)
|
|||
{
|
||||
bool result = false;
|
||||
|
||||
if (PR_MatchKeyword(KEYWORD_VAR)) result = true;
|
||||
else if (PR_MatchKeyword(KEYWORD_STRING)) result = true;
|
||||
if( PR_MatchKeyword( KEYWORD_STRING )) result = true;
|
||||
else if( PR_MatchKeyword( KEYWORD_FLOAT )) result = true;
|
||||
else if( PR_MatchKeyword( KEYWORD_ENTITY )) result = true;
|
||||
else if( PR_MatchKeyword( KEYWORD_VECTOR )) result = true;
|
||||
|
@ -4927,7 +4913,6 @@ def_t *PR_DummyDef(type_t *type, char *name, def_t *scope, int arraysize, uint o
|
|||
case ev_integer:
|
||||
case ev_struct:
|
||||
case ev_union:
|
||||
case ev_variant: // for lack of any better alternative
|
||||
com.sprintf( newname, "%s%s.%s", name, array, parttype->name );
|
||||
PR_DummyDef( parttype, newname, scope, 1, ofs + type->size*a + parttype->ofs, false );
|
||||
break;
|
||||
|
@ -5207,7 +5192,6 @@ def_t *PR_DummyFieldDef(type_t *type, char *name, def_t *scope, int arraysize, u
|
|||
case ev_field:
|
||||
case ev_pointer:
|
||||
case ev_integer:
|
||||
case ev_variant:
|
||||
if( *name ) com.sprintf( newname, "%s%s.%s", name, array, parttype->name );
|
||||
else com.sprintf( newname, "%s%s", parttype->name, array );
|
||||
ftype = PR_NewType( "FIELD TYPE", ev_field );
|
||||
|
@ -5274,7 +5258,6 @@ void PR_ParseDefs (char *classname)
|
|||
bool shared = false;
|
||||
bool externfnc = false;
|
||||
bool isconstant = false;
|
||||
bool isvar = false;
|
||||
bool nosave = false;
|
||||
bool allocatenew = true;
|
||||
int ispointer;
|
||||
|
@ -5387,10 +5370,9 @@ void PR_ParseDefs (char *classname)
|
|||
else if( PR_CheckForKeyword( KEYWORD_SHARED ))
|
||||
{
|
||||
shared = true;
|
||||
if (pr_scope) PR_ParseError (ERR_NOSHAREDLOCALS, "Cannot have shared locals");
|
||||
if( pr_scope ) PR_ParseError( ERR_NOSHAREDLOCALS, "cannot have shared locals" );
|
||||
}
|
||||
else if( PR_CheckForKeyword( KEYWORD_CONST )) isconstant = true;
|
||||
else if (PR_CheckForKeyword( KEYWORD_VAR )) isvar = true;
|
||||
else if( PR_CheckForKeyword( KEYWORD_NOSAVE )) nosave = true;
|
||||
else break;
|
||||
}
|
||||
|
@ -5599,14 +5581,13 @@ void PR_ParseDefs (char *classname)
|
|||
if( type->type == ev_function )
|
||||
{
|
||||
def->initialized = 1;
|
||||
def->constant = !isvar;
|
||||
def->constant = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if( type->type == ev_function )
|
||||
{
|
||||
if (isvar) def->constant = false;
|
||||
else def->constant = true;
|
||||
def->constant = true;
|
||||
|
||||
if (PR_CheckToken("0"))
|
||||
{
|
||||
|
@ -5702,8 +5683,7 @@ void PR_ParseDefs (char *classname)
|
|||
int arraypart, partnum;
|
||||
type_t *parttype;
|
||||
def->initialized = 1;
|
||||
if (isvar) def->constant = true;
|
||||
else def->constant = false;
|
||||
def->constant = false;
|
||||
|
||||
// FIXME: should do this recursivly
|
||||
PR_Expect("{");
|
||||
|
@ -5809,9 +5789,7 @@ void PR_ParseDefs (char *classname)
|
|||
}
|
||||
else if( type->type == ev_integer )
|
||||
{
|
||||
// handle these differently, because they may need conversions
|
||||
if (isvar) def->constant = false;
|
||||
else def->constant = true;
|
||||
def->constant = true;
|
||||
|
||||
def->initialized = 1;
|
||||
Mem_Copy (pr_globals + def->ofs, &pr_immediate, 4*type_size[pr_immediate_type->type]);
|
||||
|
@ -5841,8 +5819,7 @@ void PR_ParseDefs (char *classname)
|
|||
|
||||
d->type = type_string;
|
||||
d->name = "IMMEDIATE";
|
||||
if (isvar) d->constant = false;
|
||||
else d->constant = true;
|
||||
d->constant = true;
|
||||
d->initialized = 1;
|
||||
d->scope = NULL;
|
||||
|
||||
|
@ -5858,8 +5835,7 @@ void PR_ParseDefs (char *classname)
|
|||
}
|
||||
else if (arraysize<=1)
|
||||
{
|
||||
if (isvar) def->constant = false;
|
||||
else def->constant = true;
|
||||
def->constant = true;
|
||||
def->initialized = 1;
|
||||
(((int *)pr_globals)[def->ofs]) = PR_CopyString(pr_immediate_string, opt_noduplicatestrings );
|
||||
PR_Lex();
|
||||
|
@ -5889,8 +5865,7 @@ void PR_ParseDefs (char *classname)
|
|||
}
|
||||
else if (arraysize<=1)
|
||||
{
|
||||
if (isvar) def->constant = false;
|
||||
else def->constant = true;
|
||||
def->constant = true;
|
||||
def->initialized = 1;
|
||||
|
||||
if (pr_immediate_type->type != ev_float)
|
||||
|
@ -5936,8 +5911,7 @@ void PR_ParseDefs (char *classname)
|
|||
}
|
||||
else if (arraysize<=1)
|
||||
{
|
||||
if (isvar) def->constant = false;
|
||||
else def->constant = true;
|
||||
def->constant = true;
|
||||
def->initialized = 1;
|
||||
(((float *)pr_globals)[def->ofs+0]) = pr_immediate.vector[0];
|
||||
(((float *)pr_globals)[def->ofs+1]) = pr_immediate.vector[1];
|
||||
|
@ -5969,19 +5943,12 @@ void PR_ParseDefs (char *classname)
|
|||
PR_ParseError (ERR_BADIMMEDIATETYPE, "wrong immediate type for %s - %s", name, pr_token);
|
||||
else Mem_Copy (pr_globals + def->ofs, &pr_immediate, 4*type_size[pr_immediate_type->type]);
|
||||
|
||||
if (isvar) def->constant = false;
|
||||
else def->constant = true;
|
||||
def->constant = true;
|
||||
def->initialized = true;
|
||||
PR_Lex ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type->type == ev_function && isvar)
|
||||
{
|
||||
isconstant = !isvar;
|
||||
def->initialized = 1;
|
||||
}
|
||||
|
||||
// special flag on fields, 2, makes the pointer obtained from them also constant.
|
||||
if (isconstant && type->type == ev_field)
|
||||
def->constant = 2;
|
||||
|
@ -6188,7 +6155,6 @@ void PR_BeginCompilation ( void )
|
|||
type_function = PR_NewType("function", ev_function);
|
||||
type_pointer = PR_NewType("pointer", ev_pointer);
|
||||
type_integer = PR_NewType("__integer", ev_integer);
|
||||
type_variant = PR_NewType("__variant", ev_variant);
|
||||
type_floatfield = PR_NewType("fieldfloat", ev_field);
|
||||
type_pointer->aux_type = PR_NewType("pointeraux", ev_float);
|
||||
if (PR_KeywordEnabled(KEYWORD_INT)) PR_NewType("int", ev_integer);
|
||||
|
|
|
@ -482,7 +482,6 @@ char *PRVM_UglyValueString (etype_t type, prvm_eval_t *val)
|
|||
com.sprintf (line, "%i", val->_int);
|
||||
break;
|
||||
case ev_pointer:
|
||||
case ev_variant:
|
||||
case ev_struct:
|
||||
case ev_union:
|
||||
com.sprintf (line, "skip new type %i", type);
|
||||
|
@ -1077,7 +1076,8 @@ const char *PRVM_ED_ParseEdict( const char *data, edict_t *ent )
|
|||
key = PRVM_ED_FindField( keyname );
|
||||
if( !key )
|
||||
{
|
||||
MsgDev(D_NOTE, "%s: unknown field '%s'\n", PRVM_NAME, keyname);
|
||||
PRVM_GCALL(keyvalue_edict)( ent, keyname, pr_token );
|
||||
else MsgDev( D_WARN, "%s: unknown field '%s'\n", PRVM_NAME, keyname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1440,11 +1440,11 @@ chooseexecprogram:
|
|||
{
|
||||
vm.prog->xfunction->profile += (st - startst);
|
||||
vm.prog->xstatement = st - vm.prog->statements;
|
||||
PRVM_ERROR("OP_STATE not supported by %s", PRVM_NAME);
|
||||
PRVM_ERROR("OP_THINKTIME not supported by %s", PRVM_NAME);
|
||||
}
|
||||
break;
|
||||
case OP_MODULO_I:
|
||||
OPC->_int = (OPA->_int % OPB->_int);
|
||||
OPC->_int = (int)(OPA->_int % OPB->_int);
|
||||
case OP_MODULO_F:
|
||||
OPC->_float = fmod( OPA->_float, OPB->_float );
|
||||
break;
|
||||
|
|
|
@ -120,7 +120,6 @@ enum
|
|||
KEYWORD_SWITCH,
|
||||
KEYWORD_TYPEDEF,
|
||||
KEYWORD_EXTERN,
|
||||
KEYWORD_VAR,
|
||||
KEYWORD_UNION,
|
||||
KEYWORD_THINKTIME,
|
||||
|
||||
|
@ -144,7 +143,6 @@ typedef enum
|
|||
ev_function,
|
||||
ev_pointer,
|
||||
ev_integer,
|
||||
ev_variant,
|
||||
ev_struct,
|
||||
ev_union,
|
||||
ev_bool,
|
||||
|
@ -509,7 +507,6 @@ extern type_t *type_field;
|
|||
extern type_t *type_function;
|
||||
extern type_t *type_pointer;
|
||||
extern type_t *type_integer;
|
||||
extern type_t *type_variant;
|
||||
extern type_t *type_floatfield;
|
||||
extern includechunk_t *currentchunk;
|
||||
extern cachedsourcefile_t *sourcefile;
|
||||
|
|
|
@ -502,7 +502,7 @@ word PR_WriteProgdefs( void )
|
|||
|
||||
switch( crc )
|
||||
{
|
||||
case 1737:
|
||||
case 8505:
|
||||
PR_Message("Xash3D unmodified server.dat\n");
|
||||
if(!com.strcmp(progsoutname, "unknown.dat")) com.strcpy(progsoutname, "server.dat");
|
||||
break;
|
||||
|
|
Reference in New Issue