quakeC client commands

Discuss programming in the QuakeC language.
Post Reply
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

quakeC client commands

Post by r00k »

I'm trying to find the equivalent to this (self.cl[CL_CMD_FORWARD]) for DP/FTE...
ProQuake has a header file that contains all the offsets to functions in the progs.dat in memory. Using (self.cl[CL_CMD_FORWARD]) i can tell if the player is pressing forward.
here's the other offsets

float CL_ACTIVE
float CL_SPAWNED
float CL_DROPASAP
float CL_PRIVILEGED
float CL_SENDSIGNON
float CL_LAST_MESSAGE
float CL_NETCONNECTION
float CL_CMD
float CL_CMD_FORWARD
float CL_CMD_SIDE
float CL_CMD_UP
float CL_WISHDIR
float CL_MESSAGE
float CL_MESSAGE_DATA
float CL_MESSAGE_MAXSIZE
float CL_MESSAGE_CURSIZE
float CL_MSGBUF
float CL_EDICT
float CL_NAME
float CL_COLORS
float CL_PING_TIMES
float CL_NUM_PINGS
float CL_SPAWN_PARMS
float CL_OLD_FRAGS
float CL_SPAM_TIME

My mod runs on ProQuake servers, using qccx and imtrying to convert this over to FTEQcc.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: quakeC client commands

Post by Spike »

the 'cl' array thingie is a mod-set array.
fteqcc does not officially support such hacks.
fteqw and dp do not support such hacks either, of course (memory access is sandboxed, and offsets would be wrong anyway).

The 'official' way for either dp or fte to read the forward/right/up directions is to somewhere define:
.vector movement;
The server will notice the field is defined and fill it up with the forward/right/up values in each field of the vector (basically what would be in your self.cl[CL_CMD_FORWARD], as a float)


If you want to keep proquake compatibility, you're probably best off just using preprocessor conditions based on which qcc is being used and thus which sort of engine to support (qccx=vanilla vs fteqcc=sandboxed+extended).
That said, you can directly specify asm in fteqcc, like so:
asm {
STORE_F source dest;
}
source and dest can be variables, constants, etc. there's no type checks or automatic type conversions so you can specify integer values as 42i for what would be %42 in qccx.
you can also do this with fteqcc: float *ptr; ptr = &ent.field; *ptr = 42; and you should be able to pass that pointer to functions etc if needed too, as well as use them with either 'asm ADDRESS self modelindx ptr;' 'asm STOREP_F 42 ptr;'. Note that array notation on pointers will not work, as fteqcc cannot emulate the required integer manipulation operations (potentially I guess it could), nor will it let you obtain the address of a global (could be emulated for vanilla, but would break any engines that changed the hunk layout). However, you can't *read* pointers without weird hacks involving assumptions about entity offsets.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: quakeC client commands

Post by r00k »

Thanks Spike, that's easy enough.
Post Reply