summaryrefslogtreecommitdiff
path: root/src/game/g_active.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-08-03 01:18:00 +0000
committerTim Angus <tim@ngus.net>2001-08-03 01:18:00 +0000
commitde7fdcb516d39976affbea3b69b5a32e11fc4a6a (patch)
tree4704c909e5aa256dd7c657b2e1c5c31c137c2bae /src/game/g_active.c
parent306ec15326090417f16513e962e2956bff1433f5 (diff)
1.29h upgrade.. oooo particles hehehehehehe
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r--src/game/g_active.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index ca7552a3..2a9e27fb 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -677,6 +677,41 @@ static int StuckInOtherClient(gentity_t *ent) {
/*
==============
+SendPendingPredictableEvents
+==============
+*/
+void SendPendingPredictableEvents( playerState_t *ps ) {
+ gentity_t *t;
+ int event, seq;
+ int extEvent, number;
+
+ // if there are still events pending
+ if ( ps->entityEventSequence < ps->eventSequence ) {
+ // create a temporary entity for this event which is sent to everyone
+ // except the client who generated the event
+ seq = ps->entityEventSequence & (MAX_PS_EVENTS-1);
+ event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
+ // set external event to zero before calling BG_PlayerStateToEntityState
+ extEvent = ps->externalEvent;
+ ps->externalEvent = 0;
+ // create temporary entity for event
+ t = G_TempEntity( ps->origin, event );
+ number = t->s.number;
+ BG_PlayerStateToEntityState( ps, &t->s, qtrue );
+ t->s.number = number;
+ t->s.eType = ET_EVENTS + event;
+ t->s.eFlags |= EF_PLAYER_EVENT;
+ t->s.otherEntityNum = ps->clientNum;
+ // send to everyone except the client who generated the event
+ t->r.svFlags |= SVF_NOTSINGLECLIENT;
+ t->r.singleClient = ps->clientNum;
+ // set back external event
+ ps->externalEvent = extEvent;
+ }
+}
+
+/*
+==============
ClientThink
This will be called once for each client frame, which will
@@ -927,6 +962,8 @@ void ClientThink_real( gentity_t *ent ) {
else {
BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );
}
+ SendPendingPredictableEvents( &ent->client->ps );
+
if( !( ent->client->ps.eFlags & EF_FIRING ) )
client->fireHeld = qfalse; // for grapple
if( !( ent->client->ps.eFlags & EF_FIRING2 ) )
@@ -1163,6 +1200,7 @@ void ClientEndFrame( gentity_t *ent ) {
else {
BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );
}
+ SendPendingPredictableEvents( &ent->client->ps );
// set the bit for the reachability area the client is currently in
// i = trap_AAS_PointReachabilityAreaIndex( ent->client->ps.origin );