This commit is contained in:
Walter Julius Hennecke 2013-06-07 22:53:20 +02:00
parent c7f9f348f8
commit 4479d9ce51
3 changed files with 23 additions and 16 deletions

View file

@ -1032,7 +1032,7 @@ void SP_target_evosuit (gentity_t *self) {
// //
//================================================================================== //==================================================================================
static void target_turbolift_unlock ( gentity_t *ent ) static void target_turbolift_unlock ( /*@shared@*/ gentity_t *ent )
{ {
gentity_t* otherLift; gentity_t* otherLift;
@ -1175,7 +1175,7 @@ static void target_turbolift_endMove ( /*@shared@*/ gentity_t *ent )
} }
#endif #endif
} }
} else if(ent->s.eventParm && lights->targetname2 != NULL) { } else if(ent->s.eventParm != 0 && lights->targetname2 != NULL) {
if(Q_stricmp(lights->targetname2, va("%s_up", otherLift->target)) == 0) { if(Q_stricmp(lights->targetname2, va("%s_up", otherLift->target)) == 0) {
lights->use(lights, lights, ent); lights->use(lights, lights, ent);
#ifdef G_LUA #ifdef G_LUA
@ -1201,7 +1201,7 @@ static void target_turbolift_endMove ( /*@shared@*/ gentity_t *ent )
// check for shader remaps // check for shader remaps
if(rpg_calcLiftTravelDuration.integer != 0 || level.overrideCalcLiftTravelDuration != 0) { if(rpg_calcLiftTravelDuration.integer != 0 || level.overrideCalcLiftTravelDuration != 0) {
if((ent->truename != NULL && otherLift->truename != NULL) || (ent->falsename != NULL && otherLift->falsename != NULL)) { if((ent->truename != NULL && otherLift->truename != NULL) || (ent->falsename != NULL && otherLift->falsename != NULL)) {
f = level.time * 0.001; f = level.time * 0.001f;
AddRemap(ent->targetShaderName, ent->targetShaderName, f); AddRemap(ent->targetShaderName, ent->targetShaderName, f);
AddRemap(otherLift->targetShaderName, otherLift->targetShaderName, f); AddRemap(otherLift->targetShaderName, otherLift->targetShaderName, f);
} }
@ -1278,10 +1278,11 @@ static void target_turbolift_TeleportPlayers ( gentity_t *ent )
} }
liftTouch = (int *)malloc(MAX_GENTITIES * sizeof(int)); liftTouch = (int *)malloc(MAX_GENTITIES * sizeof(int));
if(!liftTouch) { if(liftTouch == NULL) {
target_turbolift_unlock( ent ); target_turbolift_unlock( ent );
return; return;
} }
memset(liftTouch, 0, sizeof(int) * MAX_GENTITIES);
//scan the turbo region for players //scan the turbo region for players
//in the current lift //in the current lift
@ -1298,11 +1299,12 @@ static void target_turbolift_TeleportPlayers ( gentity_t *ent )
} }
targetLiftTouch = (int *)malloc(MAX_GENTITIES * sizeof(int)); targetLiftTouch = (int *)malloc(MAX_GENTITIES * sizeof(int));
if(!targetLiftTouch) { if(targetLiftTouch == NULL) {
target_turbolift_unlock( ent ); target_turbolift_unlock( ent );
free(liftTouch); free(liftTouch);
return; return;
} }
memset(targetLiftTouch, 0, sizeof(int) * MAX_GENTITIES);
//the target lift //the target lift
{ {
@ -1323,8 +1325,8 @@ static void target_turbolift_TeleportPlayers ( gentity_t *ent )
//TiM - Teleport the main players //TiM - Teleport the main players
TeleportPlayers( ent, targetLift, liftNumEnts, liftTouch ); TeleportPlayers( ent, targetLift, liftNumEnts, liftTouch );
if(rpg_calcLiftTravelDuration.integer) { if(rpg_calcLiftTravelDuration.integer != 0) {
time = targetLift->health - ent->health; time = (float)(targetLift->health - ent->health);
if(time < 0) if(time < 0)
time *= -1; time *= -1;
time *= rpg_liftDurationModifier.value; time *= rpg_liftDurationModifier.value;
@ -1343,8 +1345,13 @@ static void target_turbolift_TeleportPlayers ( gentity_t *ent )
static void target_turbolift_startSoundEnd(gentity_t *ent) { static void target_turbolift_startSoundEnd(gentity_t *ent) {
ent->nextthink = -1; ent->nextthink = -1;
ent->parent->r.svFlags &= ~SVF_NOCLIENT;
ent->touched->r.svFlags &= ~SVF_NOCLIENT; if(ent->parent != NULL) {
ent->parent->r.svFlags &= ~SVF_NOCLIENT;
}
if(ent->touched != NULL) {
ent->touched->r.svFlags &= ~SVF_NOCLIENT;
}
} }
static void target_turbolift_startMove ( gentity_t *ent ) static void target_turbolift_startMove ( gentity_t *ent )
@ -1356,18 +1363,18 @@ static void target_turbolift_startMove ( gentity_t *ent )
float f = 0; float f = 0;
otherLift = &g_entities[ent->count]; otherLift = &g_entities[ent->count];
if ( !otherLift ) if ( otherLift == NULL )
{ {
target_turbolift_unlock( ent ); target_turbolift_unlock( ent );
return; return;
} }
//play move sound //play move sound
if( rpg_calcLiftTravelDuration.integer ) { if( rpg_calcLiftTravelDuration.integer != 0 ) {
time = time2 = ent->health - otherLift->health; time = time2 = (float)(ent->health - otherLift->health);
if(time < 0) if(time < 0)
time *= -1; time *= -1;
if(ent->sound2to1) { if(ent->sound2to1 != 0) {
if( rpg_liftDurationModifier.value * 1000 * time >= ent->distance * 1000 ) { if( rpg_liftDurationModifier.value * 1000 * time >= ent->distance * 1000 ) {
tent = G_Spawn(); tent = G_Spawn();
tent->think = target_turbolift_startSoundEnd; tent->think = target_turbolift_startSoundEnd;

View file

@ -57,7 +57,7 @@ void AddRemap(const char *oldShader, const char *newShader, float timeOffset) {
* *
* @return the shader state config * @return the shader state config
*/ */
const char *BuildShaderStateConfig(void) { /*@shared@*/ const char *BuildShaderStateConfig(void) {
static char buff[MAX_STRING_CHARS*4]; static char buff[MAX_STRING_CHARS*4];
char out[(MAX_QPATH * 2) + 5]; char out[(MAX_QPATH * 2) + 5];
int i; int i;

View file

@ -603,7 +603,7 @@ float Q_crandom( int *seed );
float flrandom(float min, float max); float flrandom(float min, float max);
int irandom(int min, int max); int irandom(int min, int max);
void vectoangles( const vec3_t value1, vec3_t angles); void vectoangles( const vec3_t value1, /*@out@*/ vec3_t angles);
void AnglesToAxis( const vec3_t angles, vec3_t axis[3] ); void AnglesToAxis( const vec3_t angles, vec3_t axis[3] );
void AxisClear( vec3_t axis[3] ); void AxisClear( vec3_t axis[3] );
@ -631,7 +631,7 @@ void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up );
int PlaneTypeForNormal (vec3_t normal); int PlaneTypeForNormal (vec3_t normal);
void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]); void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]);
void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); void AngleVectors( const vec3_t angles, /*@out@*/ vec3_t forward, /*@out@*/ vec3_t right, /*@out@*/ vec3_t up);
void PerpendicularVector( vec3_t dst, const vec3_t src ); void PerpendicularVector( vec3_t dst, const vec3_t src );
void VectorShort(vec3_t vect); void VectorShort(vec3_t vect);
void UnVectorShort(vec3_t vect); void UnVectorShort(vec3_t vect);