Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Button bindings are as follows:
- const int BTNFLAG_START = 1;
- const int BTNFLAG_SELECT = 2;
- const int BTNFLAG_UP = 4;
- const int BTNFLAG_RIGHT = 32;
- const int BTNFLAG_A = 64;
- const int BTNFLAG_B = 128;
- const int BTNFLAG_L = 256;
- const int BTNFLAG_R = 512;
- const int BTNFLAG_EX1 = 1024;
- const int BTNFLAG_EX2 = 2048;
- const int BTNFLAG_EX3 = 4096;
- const int BTNFLAG_EX4 = 8192;
- const int USE_BUTTON_ONLY = 01b;
- const int USE_AXIS_ONLY = 10b;
- const int USE_BUTTON_AND_AXIS = 11b;
- //Takes an interger to set as many of Link's inputs as you need via a single function.
- //val - Number to input. OR (|) the above BTNFLAG_[input] constants together or add their numbers together to get the desired result.
- //state - Switch input on or off.
- //type - Wherever to set press and/or input. 1 = Input, 2 = Press, 3 = Both. All other values are undefined,
- //axis - When modifying directional inputs. 1 = Button only. 2 = Axis only. 11 = both Axis and button. All other values are undefined,
- //axis -
- //debug - Set to true to enable traces
- void SetInputFlags(int val, bool state, int type, int axis, bool debug){
- if(val&BTNFLAG_START){
- if(type&1){
- Link->InputStart = state;
- if(debug)
- TraceB(Link->InputStart);
- }
- if(type&2){
- Link->PressStart = state;
- if(debug)
- TraceB(Link->PressStart);
- }
- }
- if(val&BTNFLAG_SELECT){
- if(type&1){
- Link->InputMap = state;
- if(debug)
- TraceB(Link->InputMap);
- }
- if(type&2){
- Link->PressMap = state;
- if(debug)
- TraceB(Link->PressMap);
- }
- }
- if(val&BTNFLAG_UP){
- if(type&1){
- if(axis&1){
- Link->InputUp = state;
- if(debug)
- TraceB(Link->InputUp);
- }
- if(axis&2){
- Link->InputAxisUp = state;
- if(debug)
- TraceB(Link->InputAxisUp);
- }
- }
- if(type&2){
- if(axis&1){
- Link->PressUp = state;
- if(debug)
- TraceB(Link->PressUp);
- }
- if(axis&2){
- Link->PressAxisUp = state;
- if(debug)
- TraceB(Link->PressAxisUp);
- }
- }
- }
- if(val&BTNFLAG_DOWN){
- if(type&1){
- if(axis&1){
- Link->InputDown = state;
- if(debug)
- TraceB(Link->InputDown);
- }
- if(axis&2){
- Link->InputAxisDown = state;
- if(debug)
- TraceB(Link->InputAxisDown);
- }
- }
- if(type&2){
- if(axis&1){
- Link->PressDown = state;
- if(debug)
- TraceB(Link->PressDown);
- }
- if(axis&2){
- Link->PressAxisDown = state;
- if(debug)
- TraceB(Link->PressAxisDown);
- }
- }
- }
- if(val&BTNFLAG_LEFT){
- if(type&1){
- if(axis&1){
- Link->InputLeft = state;
- if(debug)
- TraceB(Link->InputLeft);
- }
- if(axis&2){
- Link->InputAxisLeft = state;
- if(debug)
- TraceB(Link->InputAxisLeft);
- }
- }
- if(type&2){
- if(axis&1){
- Link->PressLeft = state;
- if(debug)
- TraceB(Link->PressLeft);
- }
- if(axis&2){
- Link->PressAxisLeft = state;
- if(debug)
- TraceB(Link->PressAxisLeft);
- }
- }
- }
- if(val&BTNFLAG_RIGHT){
- if(type&1){
- if(axis&1){
- Link->InputRight = state;
- if(debug)
- TraceB(Link->InputRight);
- }
- if(axis&2){
- Link->InputAxisRight = state;
- if(debug)
- TraceB(Link->InputAxisRight);
- }
- }
- if(type&2){
- if(axis&1){
- Link->PressRight = state;
- if(debug)
- TraceB(Link->PressRight);
- }
- if(axis&2){
- Link->PressAxisRight = state;
- if(debug)
- TraceB(Link->PressAxisRight);
- }
- }
- }
- if(val&BTNFLAG_A){
- if(type&1){
- Link->InputA = state;
- if(debug)
- TraceB(Link->InputA);
- }
- if(type&2){
- Link->PressA = state;
- if(debug)
- TraceB(Link->PressA);
- }
- }
- if(val&BTNFLAG_B){
- if(type&1){
- Link->InputB = state;
- if(debug)
- TraceB(Link->InputB);
- }
- if(type&2){
- Link->PressB = state;
- if(debug)
- TraceB(Link->PressB);
- }
- }
- if(val&BTNFLAG_L){
- if(type&1){
- Link->InputL = state;
- if(debug)
- TraceB(Link->InputL);
- }
- if(type&2){
- Link->PressL = state;
- if(debug)
- TraceB(Link->PressL);
- }
- }
- if(val&BTNFLAG_R){
- if(type&1){
- Link->InputR = state;
- if(debug)
- TraceB(Link->InputR);
- }
- if(type&2){
- Link->PressR = state;
- if(debug)
- TraceB(Link->PressR);
- }
- }
- if(val&BTNFLAG_R){
- if(type&1){
- Link->InputR = state;
- if(debug)
- TraceB(Link->InputR);
- }
- if(type&2){
- Link->PressR = state;
- if(debug)
- TraceB(Link->PressR);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement