Jump to content

Home

force sight and entities


Tinny

Recommended Posts

Hey guys, just wanted to share tips with you that would help with coop and other gametypes. First one I wanted to share was officers with keys. In sp when force sight is activated they are highlighted with blue instead of red or green like other npcs. To get this working I added at the end of SP_NPC_spawner in NPC_spawn.c this:

 

if(self->message)

{

//force see - hack setting officers with key with hack time to a 100 so can see them in client side with a blue hue

self->s.generic1 = 100;

}

 

 

Then in cg_players.c near the end of CG_Player inside of

 

if ((cg.snap->ps.fd.forcePowersActive & (1 << FP_SEE)) && cg.snap->ps.clientNum != cent->currentState.number && cg_auraShell.integer)

{

 

I did this to implement the request of the server side hack:

 

 

if( cent->currentState.NPC_class == CLASS_IMPERIAL && cent->currentState.generic1 == 100 )

{

legs.shaderRGBA[0] = 0;

legs.shaderRGBA[1] = 0;

legs.shaderRGBA[2] = 255;

}

 

Right after it does the colorings after the other stuff. Ok, now the next part is only useful for people using the ojp basic code as their base, near the end of CG_General in cg_ents.c before:

 

if (cg_debugBB.integer)

{

CG_CreateBBRefEnts(s1, cent->lerpOrigin);

}

 

I did this:

 

if( ( cent->currentState.eFlags & EF_FORCE_VISIBLE ) &&

( cg.snap->ps.fd.forcePowersActive & (1 << FP_SEE) ) )

{

ent.shaderRGBA[0] = 0;

ent.shaderRGBA[1] = 0;

ent.shaderRGBA[2] = 255;

ent.renderfx |= RF_MINLIGHT | RF_NODEPTH;

 

//only level 2+ can see players through walls

if (cg.snap->ps.fd.forcePowerLevel[FP_SEE] < FORCE_LEVEL_2)

ent.renderfx &= ~RF_NODEPTH;

 

ent.renderfx &= ~RF_RGB_TINT;

ent.renderfx &= ~RF_FORCE_ENT_ALPHA;

ent.customShader = cgs.media.sightShell;

 

trap_R_AddRefEntityToScene( &ent );

}

 

That makes the force_visible stuff in the server available to see with force sight :). Hope that is useful.

Link to comment
Share on other sites

Honestly dood, i tried getting them to highlight but had no luck :/

 

You should also note, the SP maps have areaportals and seeing is not immune to them like in SP. Would be bad to mark ents with SVF_BROADCAST too, thats just way too much extra bandwidth and will be extra lag.

Link to comment
Share on other sites

Thanks for the heads up Ensi and will be glad to Razor :). I forgot that entitystates don't carry a lot of the info for npcs and players across the network and it is playerstate that does it, so forget the server side hack for the imperial officers I posted above, it should be in NPC_Spawn_Do inside of:

 

if ( ent->message )

{//has a key

 

and this line should be used instead:

 

newent->client->ps.generic1 = 100;

 

The client side remains the same as above oddly *_~

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...