Replace Crosshair and More than 255 ammo?

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Stealth Kill
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Replace Crosshair and More than 255 ammo?

Post by Stealth Kill »

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?
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

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.
Stealth Kill
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Post by Stealth Kill »

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?
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Post by frag.machine »

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)
Post Reply