Problem NAV MODE dont work in VC

marcogavazzeni

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
217
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
I tried a thousand times but does not work, the lights come on properly, keyboard works, it is only with the mouse I can not run.
If anyone can help I would be very happy, thanks:hail:
Code:
[FONT=Courier New][FONT=Courier New]oapiVCRegisterArea (AID_NAVMODE, _R( 0,0, 262,32), PANEL_REDRAW_MOUSE|PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex4);[/FONT]
[FONT=Courier New]oapiVCSetAreaClickmode_Quadrilateral (AID_NAVMODE,[/FONT]
[FONT=Courier New]_V(-0.843884764f,0.123497933f,16.36420527f),[/FONT]
[FONT=Courier New]_V(-0.689299533f,0.129213263f,16.35194677f),[/FONT]
[FONT=Courier New]_V(-0.843884764f,0.106857749f,16.35644716f),[/FONT]
[FONT=Courier New]_V(-0.689299533f,0.112573079f,16.34418865f));[/FONT]
[/FONT]
[FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]bool[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New][COLOR=#000000] ShuttlePB::clbkVCMouseEvent ([/COLOR][/FONT][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]int[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New][COLOR=#000000] id, [/COLOR][/FONT][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]int[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]event[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New][COLOR=#000000], VECTOR3 &p)[/COLOR][/FONT]
[FONT=Courier New]{ [/FONT]
[/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]static[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]int[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] ctrl = 1;[/FONT]
[/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]switch[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] (id) {[/FONT]
[/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]case[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] AID_NAVMODE:[/FONT]
[FONT=Courier New]ctrl =([/FONT][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]int[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New])(p.x*262.0f);[/FONT]
[/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] ((ctrl % 44) < 42) {[/FONT]
[FONT=Courier New]ToggleNavmode (6 -ctrl/44);[/FONT]
[/FONT][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000]// oapiTriggerPanelRedrawArea (0, AID_NAVMODE);[/COLOR][/FONT]
[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]           return[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]true[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New];[/FONT]
[FONT=Courier New]        }[/FONT]
[/FONT][FONT=Courier New][FONT=Courier New]      }[/FONT]
[/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]  return[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]false[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New];[/FONT]
[FONT=Courier New]}[/FONT]
[/FONT]

I copied and pasted the code of shuttleA to see if it was a mistake to locate the area of the click
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
36,882
Reaction score
1,538
Points
203
Location
Langendernbach
Can it be you actually wanted to divide at this point?

Code:
[FONT=Courier New][FONT=Courier New]ctrl =([/FONT][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]int[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New])(p.x*262.0f);[/FONT]
[/FONT]


EDIT:
No... you need to multiply at this point, so the rest of the mess works. Too complex and not elegant. Essentially you scale up to texture coordinates, filter out the empty spaces between the buttons and THEN select the new NavMode by the index of the button. In theory it works, in praxis, it can fail a lot. I'd use three tables. MIN_X, MAX_X and NAVMODE. if p.x is between MIN_X and MAX_X, toggle NavMode and return...
 
Last edited:

marcogavazzeni

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
217
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
I do not know, 262 are the pixels of the bitmap, I tried in spherical mode and does not work, the lights come on properly, even the exit of the gear works fine with the mouse

---------- Post added at 11:42 AM ---------- Previous post was at 12:15 AM ----------

I modified the code in this mode:
Code:
oapiVCRegisterArea (AID_NAVMODE, _R( 0,0, 256,32), PANEL_REDRAW_MOUSE|PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex4);
oapiVCRegisterArea (AID_NAVBUTTON1, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
oapiVCSetAreaClickmode_Spherical (AID_NAVBUTTON1 , _V(-0.090,0.277005,0.810118)+offset,0.010);
 
bool ShuttlePB::clbkVCMouseEvent (int id, int event, VECTOR3 &p)
{ 
switch (id) {
case AID_NAVBUTTON1:
ToggleNavmode(NAVMODE_HLEVEL);
return true;

now works!:thumbup:
 
Last edited by a moderator:
Top