void menuButton(int state,int code) { if (code == KEY_SHOW_KBRD) { if (state = 1) showKeyboardInt = 1; } else PortableKeyEvent(state, code); }
void EXPORT_ME JAVA_FUNC(keypress) (JNIEnv *env, jobject obj,jint down, jint keycode, jint unicode) { LOGI("keypress %d",keycode); if (controlsContainer.isEditing()) { if (down && (keycode == SDL_SCANCODE_ESCAPE )) controlsContainer.finishEditing(); return; } PortableKeyEvent(down,keycode,unicode); }
void menuButton(int state,int code) { if (code == KEY_SHOW_KBRD) { if (state) toggleKeyboard(); } else if (code == SDL_SCANCODE_F10) //for choch setup f10 to work! { PortableKeyEvent(state, code, 0); } else PortableAction(state, code); }
void EXPORT_ME Java_com_beloko_opengames_prboom_NativeLib_keypress(JNIEnv *env, jobject obj, jint down, jint keycode, jint unicode) { LOGI("keypress %d",keycode); if (controlsContainer.isEditing()) { if (down && (keycode == KEYD_ESCAPE )) controlsContainer.finishEditing(); return; } PortableKeyEvent(down,keycode); }
void gameButton(int state,int code) { if (code == KEY_SHOOT) { shooting = state; PortableAction(state,PORT_ACT_ATTACK); } else if (code == KEY_USE) { PortableAction(state,PORT_ACT_USE); } else if (code == KEY_SHOW_WEAPONS) { if (state == 1) if (!tcGameWeapons->enabled) tcGameWeapons->animateIn(5); } else if (code == KEY_NEXT_WEAPONS) { PortableAction(state,PORT_ACT_NEXT_WEP); } else if (code == KEY_PREV_WEAPONS) { PortableAction(state,PORT_ACT_PREV_WEP); } else if (code == KEY_MAP) { PortableAction(state,PORT_ACT_MAP); } else if (code == KEY_SHOW_KBRD) { if (state = 1) showKeyboardInt = 1; } else if (code == KEY_QUICK_CMD){ if (state == 1) showCustomCommands(); } else { PortableKeyEvent(state, code); } }
void PortableAction(int state, int action) { LOGI("PortableAction %d %d",state,action); if (PortableInMenu()) { if (action >= PORT_ACT_MENU_UP && action <= PORT_ACT_MENU_BACK) { int sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE }; PortableKeyEvent(state, sdl_code[action-PORT_ACT_MENU_UP], 0); return; } } else { int key = -1; switch (action) { case PORT_ACT_LEFT: key = key_left; break; case PORT_ACT_RIGHT: key = key_right; break; case PORT_ACT_FWD: key = key_up; break; case PORT_ACT_BACK: key = key_down; break; case PORT_ACT_MOVE_LEFT: key = key_strafeleft; break; case PORT_ACT_MOVE_RIGHT: key = key_straferight; break; case PORT_ACT_USE: key = key_use; break; case PORT_ACT_ATTACK: key = key_fire; break; case PORT_ACT_JUMP: key = key_jump; break; case PORT_ACT_STRAFE: key = key_strafe; break; case PORT_ACT_SPEED: key = key_speed; break; case PORT_ACT_MAP: key = key_map_toggle; break; case PORT_ACT_MAP_ZOOM_IN: key = key_map_zoomin; break; case PORT_ACT_MAP_ZOOM_OUT: key = key_map_zoomout; break; case PORT_ACT_INVUSE: key = key_useartifact; break; case PORT_ACT_INVDROP: key = key_invdrop; break; case PORT_ACT_INVPREV: key = key_invleft; break; case PORT_ACT_INVNEXT: key = key_invright; break; case PORT_ACT_NEXT_WEP: key = key_nextweapon; break; case PORT_ACT_PREV_WEP: key = key_prevweapon; break; case PORT_ACT_QUICKSAVE: key = key_menu_qsave; break; case PORT_ACT_QUICKLOAD: key = key_menu_qload; break; case PORT_ACT_GAMMA: key = key_menu_gamma; break; case PORT_ACT_HELPCOMP: key = key_mission; break; case PORT_ACT_SHOW_WEAPONS: key = key_invpop; break; case PORT_ACT_SHOW_KEYS: key = key_invkey; break; case PORT_ACT_FLY_UP: key = key_flyup; break; case PORT_ACT_FLY_DOWN: key = key_flydown; break; case PORT_ACT_FLY_CENTER: key = key_flycenter; break; case PORT_ACT_WEAP1: newweapon = 1; break; case PORT_ACT_WEAP2: newweapon = 2; break; case PORT_ACT_WEAP3: newweapon = 3; break; case PORT_ACT_WEAP4: newweapon = 4; break; case PORT_ACT_WEAP5: newweapon = 5; break; case PORT_ACT_WEAP6: newweapon = 6; break; case PORT_ACT_WEAP7: newweapon = 7; break; case PORT_ACT_WEAP8: newweapon = 8; break; } if (key != -1) ActionKey(state,key); } }
//Weapon select callbacks void selectWeaponButton(int state, int code) { PortableKeyEvent(state, code, 0); if (state == 0) tcGameWeapons->animateOut(5); }
void PortableAction(int state, int action) { LOGI("PortableAction %d %d",state,action); if (PortableGetScreenMode() == TS_MENU) { if (action >= PORT_ACT_MENU_UP && action <= PORT_ACT_MENU_BACK) { int sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE }; PortableKeyEvent(state, sdl_code[action-PORT_ACT_MENU_UP], 0); return; } } else { if ((action >= PORT_ACT_CUSTOM_0) && (action <= PORT_ACT_CUSTOM_7)) { PortableKeyEvent(state, SDL_SCANCODE_A + action - PORT_ACT_CUSTOM_0, 0); } else { switch (action) { case PORT_ACT_LEFT: buttonChange(state,&Button_Left); break; case PORT_ACT_RIGHT: buttonChange(state,&Button_Right); break; case PORT_ACT_FWD: buttonChange(state,&Button_Forward); break; case PORT_ACT_BACK: buttonChange(state,&Button_Back); break; case PORT_ACT_MOVE_LEFT: buttonChange(state,&Button_MoveLeft); break; case PORT_ACT_MOVE_RIGHT: buttonChange(state,&Button_MoveRight); break; case PORT_ACT_USE: buttonChange(state,&Button_Use); break; case PORT_ACT_ATTACK: buttonChange(state,&Button_Attack); break; case PORT_ACT_ALT_ATTACK: buttonChange(state,&Button_AltAttack); break; case PORT_ACT_JUMP: buttonChange(state,&Button_Jump); break; case PORT_ACT_DOWN: buttonChange(state,&Button_Crouch); break; case PORT_ACT_NEXT_WEP: if (state) PortableCommand("weapnext"); break; case PORT_ACT_PREV_WEP: if (state) PortableCommand("weapprev"); break; case PORT_ACT_MAP: if (state) PortableCommand("togglemap"); break; case PORT_ACT_QUICKLOAD: if (state) PortableCommand("quickload"); break; case PORT_ACT_QUICKSAVE: if (state) PortableCommand("quicksave"); break; case PORT_ACT_WEAP0: if (state) PortableCommand("slot 0"); break; case PORT_ACT_WEAP1: if (state) PortableCommand("slot 1"); break; case PORT_ACT_WEAP2: if (state) PortableCommand("slot 2"); break; case PORT_ACT_WEAP3: if (state) PortableCommand("slot 3"); break; case PORT_ACT_WEAP4: if (state) PortableCommand("slot 4"); break; case PORT_ACT_WEAP5: if (state) PortableCommand("slot 5"); break; case PORT_ACT_WEAP6: if (state) PortableCommand("slot 6"); break; case PORT_ACT_WEAP7: if (state) PortableCommand("slot 7"); break; case PORT_ACT_WEAP8: if (state) PortableCommand("slot 8"); break; case PORT_ACT_WEAP9: if (state) PortableCommand("slot 9"); break; } } } }
void EXPORT_ME JAVA_FUNC(keypress)(JNIEnv *env, jobject obj,jint down, jint keycode, jint unicode) { //LOGI("keypress %d",keycode); PortableKeyEvent(down,keycode,unicode); }
void PortableAction(int state, int action) { // LOGI("PortableAction %d %d",state, action); if (PortableInMenu()) { if (action >= PORT_ACT_MENU_UP && action <= PORT_ACT_MENU_BACK) { int sdl_code [] = { KEYD_UPARROW, KEYD_DOWNARROW, KEYD_LEFTARROW, KEYD_RIGHTARROW, KEYD_ENTER, KEYD_ESCAPE }; PortableKeyEvent(state, sdl_code[action-PORT_ACT_MENU_UP]); return; } } else { switch (action) { case PORT_ACT_LEFT: PortableKeyEvent(state,key_left); break; case PORT_ACT_RIGHT: PortableKeyEvent(state,key_right); break; case PORT_ACT_FWD: PortableKeyEvent(state,key_up); break; case PORT_ACT_BACK: PortableKeyEvent(state,key_down); break; case PORT_ACT_MOVE_LEFT: PortableKeyEvent(state,key_strafeleft); break; case PORT_ACT_MOVE_RIGHT: PortableKeyEvent(state,key_straferight); break; case PORT_ACT_USE: PortableKeyEvent(state,key_use); break; case PORT_ACT_ATTACK: PortableKeyEvent(state,key_fire); break; case PORT_ACT_NEXT_WEP: PortableKeyEvent(state,key_nextweapon); break; case PORT_ACT_PREV_WEP: PortableKeyEvent(state,key_prevweapon); break; case PORT_ACT_MAP: PortableKeyEvent(state,key_map); break; case PORT_ACT_MAP_UP: PortableKeyEvent(state,key_map_up); break; case PORT_ACT_MAP_DOWN: PortableKeyEvent(state,key_map_down); break; case PORT_ACT_MAP_LEFT: PortableKeyEvent(state,key_map_left); break; case PORT_ACT_MAP_RIGHT: PortableKeyEvent(state,key_map_right); break; case PORT_ACT_MAP_ZOOM_IN: PortableKeyEvent(state,key_map_zoomin); break; case PORT_ACT_MAP_ZOOM_OUT: PortableKeyEvent(state,key_map_zoomout); break; case PORT_ACT_WEAP1: newweapon = wp_fist; break; case PORT_ACT_WEAP2: newweapon = wp_pistol; break; case PORT_ACT_WEAP3: newweapon = wp_shotgun; break; case PORT_ACT_WEAP4: newweapon = wp_chaingun; break; case PORT_ACT_WEAP5: newweapon = wp_missile; break; case PORT_ACT_WEAP6: if (gamemode != shareware) newweapon = wp_plasma; break; case PORT_ACT_WEAP7: if (gamemode != shareware) newweapon = wp_bfg; break; case PORT_ACT_WEAP8: newweapon = wp_chainsaw; break; } } }