options menu editing (help)

Post tutorials on how to do certain tasks within game or engine code here.
Post Reply
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

options menu editing (help)

Post by ceriux »

Okay so started by editing the options menu. so far so good , i wanted to remove the "always run" option i did so and even lined the option listings back up nicely. the only problem is the yes no sliders dont match up anymore.

im pretty sure it has to do with one of these functions.

Code: Select all

void M_DrawSlider (int x, int y, float range)
{
	int	i;

	if (range < 0)
		range = 0;
	if (range > 1)
		range = 1;
	M_DrawCharacter (x-8, y, 128);
	for (i=0 ; i<SLIDER_RANGE ; i++)
		M_DrawCharacter (x + i*8, y, 129);
	M_DrawCharacter (x+i*8, y, 130);
	M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
}

void M_DrawCheckbox (int x, int y, int on)
{
#if 0
	if (on)
		M_DrawCharacter (x, y, 131);
	else
		M_DrawCharacter (x, y, 129);
#endif
	if (on)
		M_Print (x, y, "on");
	else
		M_Print (x, y, "off");
}
im just not sure which one.

esp. if its the draw check box one, cause it shows x,y, then only gives one number for placement. im im guessing that may not be it. anyone mind pointing me in the right direction?

never mind! i figured it out right as i gave up xD.

to anyone starting off who might be trying to do something similar.

this is it right here.

M_Print (16, 96, " Invert Mouse");
M_DrawCheckbox (220, 96, m_pitch.value < 0);


next its time to learn how to make the selection line up with the options! lol...

all done mainly with the menu.

so next im wondering how do i implement mouse look with y coordinates as well? (with out having told hold button)

im going to replace that always run option with mouse look yes/no
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

Heh, heh; welcome to hell! :twisted:

I rewrote my entire menu system because I was annoyed at the amount of work required to add, remove or move just one option.

Adding mouselooking? Do you mean to the engine in general or just to the menus?
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

both. like it already has a form of mouse look, that you have to hold a button down and you can look with the mouse. but that sucks. i want it to be like a normal modern day move the mouse and look gameplay. i just want it to be toggled in the options.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

My "minimal fixed GLQuake" engine has this (but not in the menus); just look for the qboolean called "mouselooking" and the cvar called "freelook" for all that you need. Source: http://www.quaketastic.com/upload/files/tools/windows/engines/MHGLQFIX.zip. For bonus points it interoperates cleanly with the old +mlook method.

The freelook cvar is just a simple 1 or 0, so you can put it in the menus in much the same way as lookspring or lookstrafe are already done.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

i figured it would be along the lines of that. basically turning +mlook on as long as that value is on. C or C++ is a lot more confusing than .qc though. ill have to take a look through and see what i find.
Post Reply