commit 2f68e7134abf732c0d577c07f0f11db44c713e41 Author: /dev/humancontroller Date: Fri Jun 17 19:18:53 2011 +0200 AMP DEBUG PLUS diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 1d5ec5e..a465b10 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1161,6 +1161,7 @@ void ABarricade_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) gclient_t *client = other->client; int client_z, min_z; + g_trigger_success = qfalse; if( !client || client->pers.teamSelection != TEAM_ALIENS ) return; @@ -1172,6 +1173,7 @@ void ABarricade_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) if( client_z < min_z ) return; ABarricade_Shrink( self, qtrue ); + g_trigger_success = qtrue; } //================================================================================== @@ -1353,6 +1355,7 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) { gclient_t *client = other->client; + g_trigger_success = qfalse; if( !self->spawned || !self->powered || self->health <= 0 ) return; @@ -1367,6 +1370,7 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) client->ps.stats[ STAT_STATE ] |= SS_BOOSTED; client->boostedTime = level.time; + g_trigger_success = qtrue; } diff --git a/src/game/g_local.h b/src/game/g_local.h index 5b0dc93..e85234b 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -891,6 +891,7 @@ void G_CloseMenus( int clientNum ); qboolean G_Visible( gentity_t *ent1, gentity_t *ent2, int contents ); gentity_t *G_ClosestEnt( vec3_t origin, gentity_t **entities, int numEntities ); +extern qboolean g_trigger_success; void G_LoggedActivation( gentity_t *self, gentity_t *other, gentity_t *activator, trace_t *trace, const char *source ); // diff --git a/src/game/g_mover.c b/src/game/g_mover.c index 9fe940e..f82b49f 100644 --- a/src/game/g_mover.c +++ b/src/game/g_mover.c @@ -1419,6 +1419,7 @@ Touch_DoorTrigger void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) { moverState_t teamState; + g_trigger_success = qfalse; //buildables don't trigger movers if( other->s.eType == ET_BUILDABLE ) @@ -1433,7 +1434,10 @@ void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) Touch_DoorTriggerSpectator( ent, other, trace ); } else if( teamState != MOVER_1TO2 ) + { Use_BinaryMover( ent->parent, ent, other ); + g_trigger_success = qtrue; + } } @@ -1848,6 +1852,7 @@ Don't allow to descend if a player is on it and is alive */ void Touch_Plat( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; // DONT_WAIT if( ent->spawnflags & 1 ) return; @@ -1857,7 +1862,10 @@ void Touch_Plat( gentity_t *ent, gentity_t *other, trace_t *trace ) // delay return-to-pos1 by one second if( ent->moverState == MOVER_POS2 ) + { ent->nextthink = level.time + 1000; + g_trigger_success = qtrue; + } } /* @@ -1869,11 +1877,15 @@ If the plat is at the bottom position, start it going up */ void Touch_PlatCenterTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; if( !other->client ) return; if( ent->parent->moverState == MOVER_POS1 ) + { Use_BinaryMover( ent->parent, ent, other ); + g_trigger_success = qtrue; + } } @@ -2004,11 +2016,15 @@ Touch_Button */ void Touch_Button( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; if( !other->client ) return; if( ent->moverState == MOVER_POS1 ) + { Use_BinaryMover( ent, other, other ); + g_trigger_success = qtrue; + } } diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index 74d2442..2429866 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -82,6 +82,7 @@ void multi_trigger( gentity_t *ent, gentity_t *activator ) G_UseTargets( ent, ent->activator ); trigger_check_wait( ent ); + g_trigger_success = qtrue; } void Use_Multi( gentity_t *ent, gentity_t *other, gentity_t *activator ) @@ -91,6 +92,7 @@ void Use_Multi( gentity_t *ent, gentity_t *other, gentity_t *activator ) void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; if( ( other->client && ( self->buttonMask == -1 || ( other->client->buttons & self->buttonMask ) ) ) || ( other->s.eType == ET_BUILDABLE && self->buttonMask == -1 ) ) @@ -162,8 +164,10 @@ trigger_push void trigger_push_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; if( !other->client ) return; + g_trigger_success = qtrue; } @@ -280,6 +284,7 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace { gentity_t *dest; + g_trigger_success = qfalse; if( self->s.eFlags & EF_NODRAW ) return; @@ -304,6 +309,7 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace } TeleportPlayer( other, dest->s.origin, dest->s.angles, self->speed ); + g_trigger_success = qtrue; } /* @@ -382,6 +388,7 @@ void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { int dflags; + g_trigger_success = qfalse; if( !other->takedamage ) return; @@ -414,6 +421,7 @@ void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace ) G_Damage( other, self, self, NULL, NULL, self->damage, dflags, MOD_TRIGGER_HURT ); other->hurtTime = level.time; + g_trigger_success = qtrue; } void SP_trigger_hurt( gentity_t *self ) @@ -647,11 +655,13 @@ trigger_buildable_touch */ void trigger_buildable_touch( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; //only triggered by buildables if( !other || other->s.eType != ET_BUILDABLE ) return; trigger_buildable_trigger( ent, other ); + g_trigger_success = qtrue; } /* @@ -777,11 +787,13 @@ trigger_class_touch */ void trigger_class_touch( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; //only triggered by clients if( !other->client ) return; trigger_class_trigger( ent, other ); + g_trigger_success = qtrue; } /* @@ -912,11 +924,13 @@ trigger_equipment_touch */ void trigger_equipment_touch( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; //only triggered by clients if( !other->client ) return; trigger_equipment_trigger( ent, other ); + g_trigger_success = qtrue; } /* @@ -975,11 +989,13 @@ trigger_gravity_touch */ void trigger_gravity_touch( gentity_t *ent, gentity_t *other, trace_t *trace ) { + g_trigger_success = qfalse; //only triggered by clients if( !other->client ) return; other->client->ps.gravity = ent->triggerGravity; + g_trigger_success = qtrue; } /* @@ -1035,6 +1051,7 @@ void trigger_heal_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { int max; + g_trigger_success = qfalse; if( !other->client ) return; @@ -1054,6 +1071,7 @@ void trigger_heal_touch( gentity_t *self, gentity_t *other, trace_t *trace ) other->health = max; other->client->ps.stats[ STAT_HEALTH ] = other->health; + g_trigger_success = qtrue; } /* @@ -1092,6 +1110,7 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) int maxClips, maxAmmo; weapon_t weapon; + g_trigger_success = qfalse; if( !other->client ) return; @@ -1131,6 +1150,7 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) } else other->client->ps.ammo += self->damage; + g_trigger_success = qtrue; } /* diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 17ce34c..4ed6eed 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -280,6 +280,7 @@ static void G_PrepareTimePrefix( void ) laTimePfx = laTimeStamp; } +qboolean doPrintLa = qtrue; #define LA_DOWN '|' #define LA_BEND '\'' #define LA_RIGHT '-' @@ -296,6 +297,7 @@ static void G_PrintLA( loggedActivation_t *la ) if( la->parent != NULL && la->next == NULL ) laPfx[ laPfxLen - 2 ] = LA_BEND; + if( doPrintLa ) G_Printf( "%s %s#%i (%s) %s |%i| %i->%i%s\n", laTimePfx, laPfx, la->entityNum, la->classname, la->targetname ? va( "[%s]", la->targetname ) : "][", la->targetGate, la->gateStateBefore, la->gateStateAfter, @@ -327,6 +329,8 @@ static void G_PrintLA( loggedActivation_t *la ) } } +qboolean g_trigger_success; + void G_LoggedActivation( gentity_t *self, gentity_t *other, gentity_t *activator, trace_t *trace, const char *source ) { loggedActivation_t *la; @@ -354,6 +358,7 @@ void G_LoggedActivation( gentity_t *self, gentity_t *other, gentity_t *activator if( top ) { G_PrepareTimePrefix(); + doPrintLa = trace == NULL || g_trigger_success; G_PrintLA( leafLA ); leafLA = NULL; @@ -459,6 +464,7 @@ void G_UseTargets( gentity_t *ent, gentity_t *activator ) leafLA->gateStateAfter = ent->gateState; G_PrepareTimePrefix(); + doPrintLa = qtrue; G_PrintLA( leafLA ); leafLA = NULL;