Jump to content

Home

Is there a way to set CG commands to affect BG/G code?


Scarlett

Recommended Posts

Posted

I think it may not be possible, but i need to set a flag in cgame and then check for the flag in bgame (specificly bg_pmove.c).

Is there any known way to do this? What i'm trying to do is make it so if the client is in first person, then they won't be able to perform rolls, flips, etc... as it is in single player.

Posted

Well, what you gotta do is add varibles and their data right before you run Pmove (). I've just tried it and it works. There's only like 3 Pmove () calls (2 server, 1 client) so it's not too hard to do.

Posted

Alright, great. But how would you get cg_thirdPerson recognizable in g_active.c (for example)?

 

Also, is there a certain kind of flag that would be best for this? I was just using the pmove->pm_flags type...

Posted

ok, you gotta have that cvar transfer its data to the server (note that this is slower than a "normal" because it's cvar data AND takes more bandwidth) by setting the client cvar with the CVAR_USERINFO flag. Then you retrieve the cvar data from that client and input it into the pmove_t data struct (you can add varibles to this struct freely).

 

See http://www.planetquake.com/code3arena/articles/article9.shtml for more information on cvar communication.

Posted

Then you retrieve the cvar data from that client and input it into the pmove_t data struct

 

But how? In bg_public.h right? I've never done anything like this before. Everything i've done thus far i've accomplished just by looking at existing examples... if there arn't any, i'm lost.

Posted

Yeah.... umm, well i've set the CVAR_USERINFO flag for the cg_thirdPerson cvar and g_active.c still isn't recognizing it...

 

i basicly need it to look something like this, in g_active.c i guess then (before the "Pmove (&pm)" call... i don't think there's any reason to set this before the other one in there):

if (cg_thirdPerson.integer && !cg.snap->ps.zoomMode)
{
   pm->ps->pm_flags &= ~PMF_FIRSTPERSON;
}
else
{
   pm->ps->pm_flags |= PMF_FIRSTPERSON;
}

 

Of course though.. none of that works in there as i have no idea how to set it up specificly for the file...

Posted

It's not working because you need to pull the cg varible data from an individual client. You gotta use trap_GetUserinfo and Info_ValueForKey to do that. Look under the reading client cvars from the server listing in the link I posted above.

Archived

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

×
×
  • Create New...