centerprint menu problems
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
centerprint menu problems
okay so iv made this centerprint menu and iv had it working before but this time around something just isnt happening right. basically i hijack jump and attack keys to control the menu, jump navigates and attack selects the players choice.
what iv noticed is after i get past the first menu, the following menus afterwords seem to stop. sometimes ill get them to print, but then the actions that go along with them don't work. actually i was sure i had it working for a second but i tested the same menu for the other team and it didnt work for that specific team. iv tried avoiding asking for help. but i just cant seem to figure it out.
anyways it should still resemble a centerprint menu.
here's what i got so far, can anyone take a peek??
this in playerprethink:
This at the top of W_Attack:
what iv noticed is after i get past the first menu, the following menus afterwords seem to stop. sometimes ill get them to print, but then the actions that go along with them don't work. actually i was sure i had it working for a second but i tested the same menu for the other team and it didnt work for that specific team. iv tried avoiding asking for help. but i just cant seem to figure it out.
anyways it should still resemble a centerprint menu.
here's what i got so far, can anyone take a peek??
- Code: Select all
void() Menu_Update =
// menu navigation every menu display has its own number. check menus.
{
if (self.button2_lastframe)
{
// still pressed this frame
if (self.button2)
{
self.button2_lastframe = TRUE;
return;
}
else
{
// not pressed this frame, clear, allow through
self.button2_lastframe = FALSE;
}
}
self.button2_lastframe = self.button2; // bleh
if (!self.button2)
return;
{
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
if (self.menu == 1 && self.button2)
{
self.menu = 2;
self.button2 = 0;
return;
}
else if (self.menu == 2 && self.button2)
{
self.menu = 1;
self.button2 = 0;
return;
}
else if (self.menu == 3 && self.button2)
{
self.menu = 4;
self.button2 = 0;
return;
}
else if (self.menu == 4 && self.button2)
{
self.menu = 5;
self.button2 = 0;
return;
}
else if (self.menu == 5 && self.button2)
{
self.menu = 3;
self.button2 = 0;
return;
}
}
self.button2 = 0;
return;
};
void() Menu_Select =
{
// button0 was pressed last frame
if (self.button0_lastframe)
{
// still pressed this frame
if (self.button0)
{
self.button0_lastframe = TRUE;
return;
}
else
{
// not pressed this frame, clear, allow through
self.button0_lastframe = FALSE;
}
}
self.button0_lastframe = self.button0; // bleh
if (!self.button0)
return;
//bprint("Menu_Select: reached\n");
if (self.menu == 1 && self.button0)
{
self.menu = 3;
//self.pteam = 1;
PutAlliedInServer();
}
if (self.menu == 2 && self.button0)
{
self.menu = 3;
//self.pteam = 2;
PutAxisInServer();
}
else if (self.menu == 3 && self.button0)
{
self.pclass = 1;
self.menu = 0;
}
else if (self.menu == 4 && self.button0)
{
self.pclass = 2;
self.menu = 0;
}
else if (self.menu == 5 && self.button0)
{
self.pclass = 3;
self.menu = 0;
}
//self.button0 = 0;
};
void() Menus =
{
if (self.menu == 0)
return;
else
if (self.menu == 1)
{
centerprint(self,"Select a Team\n>Allied\n Axis\n ");
}
else if (self.menu == 2)
{
centerprint(self,"Select a Team\n Allied\n>Axis\n ");
}
else if (self.menu == 3)
{
centerprint(self,"Select a Class\n>Class1\n Class2\n Class3\n ");
}
else if (self.menu == 4)
{
centerprint(self,"Select a Class\n Class1\n>Class2\n Class3\n ");
}
else if (self.menu == 5)
{
centerprint(self,"Select a Class\n Class1\n Class2\n>Class3\n ");
}
};
this in playerprethink:
- Code: Select all
if(self.menu)//*ceriux*
{
self.velocity_x = 0;
self.velocity_y = 0; // if the menu is up you cant move *ceriux*
self.velocity_z = 0;
Menus();
Menu_Update();
}//*ceriux*
This at the top of W_Attack:
- Code: Select all
if (self.menu > 0)
{
Menu_Select(); // if the menu is up use this function instead. *ceriux*
}
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: centerprint menu problems
its pointless clearing the button fields. the engine will reassert them when the next packet is arrived.
if you get packetloss at a bad time, PlayerPreThink will again be run without the button fields getting reasserted yet. you code will then think its been pressed again after the next packet, which is probably not what you want.
other than that, no idea.
if you get packetloss at a bad time, PlayerPreThink will again be run without the button fields getting reasserted yet. you code will then think its been pressed again after the next packet, which is probably not what you want.
other than that, no idea.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: centerprint menu problems
well, with out that going on, the navigation part of them menu goes crazy it zips through the menus faster than you can select the correct option. do you think it would be better to alias some binds and do it the normal way with impulses?
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: centerprint menu problems
if you're using dp/fte, I'd personally opt for using .movement for it, either timer or toggle based (above a threshhold). .movement potentially gives decent navigation around a more 2d menu, allowing back/forwards etc type things.
using the buttons for it is a little awkward, if only because not everyone has mouse2 bound to +jump. just seems weird.
impulses are perhaps what everyone expects to be used.
using the buttons for it is a little awkward, if only because not everyone has mouse2 bound to +jump. just seems weird.
impulses are perhaps what everyone expects to be used.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: centerprint menu problems
i understand that for the PC but you may laugh or even just feel like you've wasted your time replying when i say this. but its for the psp. although iv tested on pc and i get the same issues. i swear that iv had this working though 100% i just dont know what i did to get it working.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: centerprint menu problems
You have a "local" field button2_pressed and use it to prevent runaway pressing:
- Code: Select all
if (self.button2 && !self.button2_pressed) {
self.button2_pressed = 1;
// do something for button2
} else if (!self.button2)
self.button2_pressed = 0
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
- taniwha
- Posts: 399
- Joined: Thu Jan 14, 2010 7:11 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest