Inside3D!
     

how do i change how the ammo is displayed

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
hondobondo



Joined: 26 Sep 2006
Posts: 101

PostPosted: Sun Mar 01, 2009 11:36 pm    Post subject: how do i change how the ammo is displayed Reply with quote

say i want to increase ammo limits past 255. how do i make the status bar read up to 999 ammo like the health?
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Mon Mar 02, 2009 1:01 am    Post subject: Reply with quote

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.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Mar 02, 2009 11:59 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
hondobondo



Joined: 26 Sep 2006
Posts: 101

PostPosted: Mon Mar 02, 2009 6:48 pm    Post subject: yeah i figured Reply with quote

not really interested in breaking protocol. oh well
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Mar 02, 2009 7:13 pm    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Electro



Joined: 29 Dec 2004
Posts: 241
Location: Brisbane, Australia

PostPosted: Mon Mar 02, 2009 9:59 pm    Post subject: Reply with quote

Don't worry Spike, I read your posts at least.
_________________
Unit reporting!
http://www.bendarling.net/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group