Forum

how do i change how the ammo is displayed

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

how do i change how the ammo is displayed

Postby hondobondo » Sun Mar 01, 2009 11:36 pm

say i want to increase ammo limits past 255. how do i make the status bar read up to 999 ammo like the health?
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Postby frag.machine » Mon Mar 02, 2009 1:01 am

Check SV_WriteClientdataToMessage() in sv_main.c (server) and CL_ParseClientdata () in cl_parse.c (client). Be ready to break network compatibility though, since ammo, armor and other stuff is sent thru network as bytes.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Spike » Mon Mar 02, 2009 11:59 am

You can send larger ammo values if you send svc_updatestat (or whatever the name is) somewhere after the clientupdate svc thingie which would be in SV_WriteClientdataToMessage according to frag.machine. This wouldn't need to modify the protocol, but does need a modified server. I don't think its really possible to do it reliably in qc.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

yeah i figured

Postby hondobondo » Mon Mar 02, 2009 6:48 pm

not really interested in breaking protocol. oh well
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Postby Spike » Mon Mar 02, 2009 7:13 pm

does noone read my posts?
ammo counts are sent as bytes within the svc_clientdata message. If you send an svc_updatestat STAT_MYAMMOTYPE myvalue where myvalue is a long, you can send bigger numbers. the update stat will overwrite the stat sent in the more limited clientdata.
This does not cause protocol incompatibilities!
If you can get the qc to run a frame every single time an outgoing packet is sent (yup, fairly easy really) then you can write into the client's unreliable buffer. But you need to make sure this is done for every single outgoing packet.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Electro » Mon Mar 02, 2009 9:59 pm

Don't worry Spike, I read your posts at least.
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest