MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CorpsePhysics

Function CorpsePhysics

code/game/NPC.cpp:89–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87extern int eventClearTime;
88
89void CorpsePhysics( gentity_t *self )
90{
91 // run the bot through the server like it was a real client
92 memset( &ucmd, 0, sizeof( ucmd ) );
93 ClientThink( self->s.number, &ucmd );
94 VectorCopy( self->s.origin, self->s.origin2 );
95
96 //FIXME: match my pitch and roll for the slope of my groundPlane
97 if ( self->client->ps.groundEntityNum != ENTITYNUM_NONE && !(self->flags&FL_DISINTEGRATED) )
98 {//on the ground
99 //FIXME: check 4 corners
100 pitch_roll_for_slope( self );
101 }
102
103 if ( eventClearTime == level.time + ALERT_CLEAR_TIME )
104 {//events were just cleared out so add me again
105 if ( !(self->client->ps.eFlags&EF_NODRAW) )
106 {
107 AddSightEvent( self->enemy, self->currentOrigin, 384, AEL_DISCOVERED );
108 }
109 }
110
111 if ( level.time - self->s.time > 3000 )
112 {//been dead for 3 seconds
113 if ( !debug_subdivision->integer && !g_saberRealisticCombat->integer )
114 {//can't be dismembered once dead
115 if ( self->client->NPC_class != CLASS_PROTOCOL )
116 {
117 self->client->dismembered = true;
118 }
119 }
120 }
121
122 if ( level.time - self->s.time > 500 )
123 {//don't turn "nonsolid" until about 1 second after actual death
124
125 if ((self->client->NPC_class != CLASS_MARK1) && (self->client->NPC_class != CLASS_INTERROGATOR)) // The Mark1 & Interrogator stays solid.
126 {
127 self->contents = CONTENTS_CORPSE;
128 }
129
130 if ( self->message )
131 {
132 self->contents |= CONTENTS_TRIGGER;
133 }
134 }
135}
136
137/*
138----------------------------------------

Callers 2

NPC_RemoveBodyFunction · 0.70
DeadThinkFunction · 0.70

Calls 4

VectorCopyFunction · 0.85
ClientThinkFunction · 0.70
pitch_roll_for_slopeFunction · 0.70
AddSightEventFunction · 0.70

Tested by

no test coverage detected