Forum

Replace Crosshair and More than 255 ammo?

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

Moderator: InsideQC Admins

Replace Crosshair and More than 255 ammo?

Postby Stealth Kill » Wed Nov 14, 2007 10:24 pm

Hi

I´m trying to replace the crosshair from the conchars with a lmp file.

in gl_screen.c

i changed

Code: Select all
if (crosshair.value)
         Draw_Character (scr_vrect.x + scr_vrect.width/2 - 4, scr_vrect.y + scr_vrect.height/2 - 4, '+');;



TO

Code: Select all
if (crosshair.value)
            Draw_CachePic ("gfx/crosshair.lmp")


It doesn´t show my crosshair :(

Second question:

I´m using ammo_cells as money but it prints max 255
i want to print 1000 or more.


Third question:

can i set a max ammo for shells and nails?
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Postby Spike » Thu Nov 15, 2007 1:45 pm

Ammo counts are normally sent as unsigned bytes in the svc_playerinfo packet. Hence the 0 to 255 range. You'd have to find where that packet is sent and change the type to short or long or something. And do the same in the bit of code that reads it the other end. Note that this breaks protocol and demo compatability.

Draw_CachePic caches the picture. It does not draw it. Notice how you stripped out the arguments for where to actually draw it.
It returns a qpic_t * normally. With usable width and height fields/members. I can't remember what the actual draw function is. Try Draw_TransPic.

Maximum values for shells and nails are enforced in the qc code. Note that the engine clamps it to the 255 range in the svc_playerinfo packet, but this only affects what the client can see.

QuakeWorld and later DP (5 onwards ?) protocols send ammo counts seperatly from the svc_playerinfo, allowing it to use bandwidth more effectivly and support bigger values like quakeworld.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Stealth Kill » Fri Nov 30, 2007 12:53 am

Yeah i replaced the crosshair.
Is it possible to change the crosshair when i move?


i tried this

if (sv_accelerate.value ==0)
{
Draw_TransPic(220,60, Draw_CachePic ("gfx/crosshair.lmp"));
}
else if (sv_accelerate.value >=1 )
{
Draw_TransPic (220,60,Draw_CachePic("gfx/crosshair2.lmp"));
}


sv_accelerate doesn´t work

and i tried cl_forwardspeed too.


which command should i use?
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Postby frag.machine » Fri Nov 30, 2007 1:23 am

You should try to watch changes in the client origin and/or speed. From top of my mind it's cl.velocity or something like that. You can check view.c for the camera bobbing code which is based on client movement for a start.
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


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest