Moving spawn position


(Chruker) #1

Hi

In g_utils.c -> G_SetOrigin I changed the function slightly:


void G_SetOrigin( gentity_t *ent, vec3_t origin ) {
	VectorCopy( origin, ent->s.pos.trBase );
	ent->s.pos.trType = TR_STATIONARY;
	ent->s.pos.trTime = 0;
	ent->s.pos.trDuration = 0;
	VectorClear( ent->s.pos.trDelta );

	VectorCopy( origin, ent->r.currentOrigin );
	VectorCopy( origin, ent->s.origin );					// CHRUKER: Now it works on spawn points too.

	if( ent->client ) {
		VectorCopy( origin, ent->client->ps.origin );
	}
}

However it got me thinking. Why the three places (s.origin, r.currentOrigin and s.pos.trBase) to set the origin? I know one of them is shared by both the client and server ®. And the other two are server side (s), right?

Assuming that does the server side ones ever get copied into the shared one?


(Rain) #2

s.origin - entitystate, sent to clients, might be snapped
s.pos.trBase - entitystate, sent to clients, trajectory base - used for interpolated movement. this has different meanings depending on s.pos.trType, and may only be the initial position versus the current (lerped) position. panzerfaust shots are probably a good example of this.
r.currentOrigin - entityshared, used by engine for collision detection