void SP_game_score( gentity_t *self ) { if ( !self->config.amount ) { if( G_SpawnInt( "count", "0", &self->config.amount) ) { G_WarnAboutDeprecatedEntityField( self, "amount", "count", ENT_V_RENAMED ); } else { self->config.amount = 1; } } self->act = game_score_act; }
void SP_fx_rumble( gentity_t *self ) { if ( !self->config.amount ) { if( G_SpawnInt( "count", "0", &self->config.amount) ) { G_WarnAboutDeprecatedEntityField( self, "amount", "count", ENT_V_RENAMED ); } else { self->customNumber = 10; } } if ( !self->config.speed ) { self->config.speed = 100; } self->think = fx_rumble_think; self->act = fx_rumble_act; }
/* =============== G_ParseField Takes a key/value pair and sets the binary values in a gentity =============== */ void G_ParseField( const char *key, const char *rawString, gentity_t *entity ) { fieldDescriptor_t *fieldDescriptor; byte *entityDataField; vec4_t tmpFloatData; variatingTime_t varTime = {0, 0}; fieldDescriptor = bsearch( key, fields, ARRAY_LEN( fields ), sizeof( fieldDescriptor_t ), cmdcmp ); if ( !fieldDescriptor ) { return; } entityDataField = ( byte * ) entity + fieldDescriptor->offset; switch ( fieldDescriptor->type ) { case F_STRING: * ( char ** ) entityDataField = G_NewString( rawString ); break; case F_TARGET: if(entity->targetCount >= MAX_ENTITY_TARGETS) G_Error("Maximal number of %i targets reached.", MAX_ENTITY_TARGETS); ( ( char ** ) entityDataField ) [ entity->targetCount++ ] = G_NewString( rawString ); break; case F_CALLTARGET: if(entity->callTargetCount >= MAX_ENTITY_CALLTARGETS) G_Error("Maximal number of %i calltargets reached. You can solve this by using a Relay.", MAX_ENTITY_CALLTARGETS); ( ( gentityCallDefinition_t * ) entityDataField ) [ entity->callTargetCount++ ] = G_NewCallDefinition( fieldDescriptor->replacement ? fieldDescriptor->replacement : fieldDescriptor->name, rawString ); break; case F_TIME: sscanf( rawString, "%f %f", &varTime.time, &varTime.variance ); * ( variatingTime_t * ) entityDataField = varTime; break; case F_3D_VECTOR: sscanf( rawString, "%f %f %f", &tmpFloatData[ 0 ], &tmpFloatData[ 1 ], &tmpFloatData[ 2 ] ); ( ( float * ) entityDataField ) [ 0 ] = tmpFloatData[ 0 ]; ( ( float * ) entityDataField ) [ 1 ] = tmpFloatData[ 1 ]; ( ( float * ) entityDataField ) [ 2 ] = tmpFloatData[ 2 ]; break; case F_4D_VECTOR: sscanf( rawString, "%f %f %f %f", &tmpFloatData[ 0 ], &tmpFloatData[ 1 ], &tmpFloatData[ 2 ], &tmpFloatData[ 3 ] ); ( ( float * ) entityDataField ) [ 0 ] = tmpFloatData[ 0 ]; ( ( float * ) entityDataField ) [ 1 ] = tmpFloatData[ 1 ]; ( ( float * ) entityDataField ) [ 2 ] = tmpFloatData[ 2 ]; ( ( float * ) entityDataField ) [ 3 ] = tmpFloatData[ 3 ]; break; case F_INT: * ( int * ) entityDataField = atoi( rawString ); break; case F_FLOAT: * ( float * ) entityDataField = atof( rawString ); break; case F_YAW: ( ( float * ) entityDataField ) [ PITCH ] = 0; ( ( float * ) entityDataField ) [ YAW ] = atof( rawString ); ( ( float * ) entityDataField ) [ ROLL ] = 0; break; case F_SOUNDINDEX: if ( strlen( rawString ) >= MAX_QPATH ) { G_Error( S_ERROR "Sound filename %s in field %s of %s exceeds MAX_QPATH\n", rawString, fieldDescriptor->name, etos( entity ) ); } * ( int * ) entityDataField = G_SoundIndex( rawString ); break; default: G_Printf( S_ERROR "unknown datatype %i for field %s\n", fieldDescriptor->type, fieldDescriptor->name ); break; } if ( fieldDescriptor->replacement && fieldDescriptor->versionState ) G_WarnAboutDeprecatedEntityField(entity, fieldDescriptor->replacement, key, fieldDescriptor->versionState ); }