From e69f80c65b439602dda8f93729f79c61352af251 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 8 Feb 2025 13:35:38 +0100 Subject: [PATCH] rogueviz::nilrider:: reuse basic keys --- rogueviz/nilrider/nilrider.cpp | 68 ++++++++++++++++------------------ 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/rogueviz/nilrider/nilrider.cpp b/rogueviz/nilrider/nilrider.cpp index 21af7290..539cc549 100644 --- a/rogueviz/nilrider/nilrider.cpp +++ b/rogueviz/nilrider/nilrider.cpp @@ -39,8 +39,6 @@ namespace nilrider { -multi::config scfg_nilrider; - /** is the game paused? */ bool paused = false; @@ -50,7 +48,16 @@ int simulation_start_tick; ld aimspeed_key_x = 1, aimspeed_key_y = 1, aimspeed_mouse_x = 1, aimspeed_mouse_y = 1; -vector move_names = { "camera down", "move left", "camera up", "move right", "fine control", "pause", "reverse time", "view simulation", "menu" }; +vector move_names = { "", "", "", "", "camera down", "move left", "camera up", "move right", "fine control", "pause", "reverse time", "view simulation", "menu" }; + +enum nilrider_moves { nrCameraUp=4, nrMoveRight=5, nrCameraDown=6, nrMoveLeft=7, nrFineControl=8, nrPause=9, nrReverseTime=10, nrViewSimulation=11, nrMenu=12 }; + +enum pcmds { + pcForward, pcBackward, pcTurnLeft, pcTurnRight, + pcMoveUp, pcMoveRight, pcMoveDown, pcMoveLeft, + pcFire, pcFace, pcFaceFire, + pcDrop, pcCenter, pcOrbPower, pcOrbKey + }; int reversals = 0; bool loaded_or_planned = false; @@ -102,15 +109,15 @@ void sync_music(eLand l) { bool turn(int delta) { if(planning_mode && !view_replay) return false; - multi::get_actions(scfg_nilrider); + multi::get_actions(multi::scfg_default); auto& act = multi::action_states[1]; ld mul = 1; - if(act[4]) mul /= 5; - if(act[3] && !paused) curlev->current.heading_angle -= aimspeed_key_x * mul * delta / 1000.; - if(act[1] && !paused) curlev->current.heading_angle += aimspeed_key_x * mul * delta / 1000.; - if(act[2] && !paused) min_gfx_slope -= aimspeed_key_y * mul * delta / 1000.; - if(act[0] && !paused) min_gfx_slope += aimspeed_key_y * mul * delta / 1000.; + if(act[nrFineControl]) mul /= 5; + if(act[nrMoveRight] && !paused) curlev->current.heading_angle -= aimspeed_key_x * mul * delta / 1000.; + if(act[nrMoveLeft] && !paused) curlev->current.heading_angle += aimspeed_key_x * mul * delta / 1000.; + if(act[nrCameraDown] && !paused) min_gfx_slope -= aimspeed_key_y * mul * delta / 1000.; + if(act[nrCameraUp] && !paused) min_gfx_slope += aimspeed_key_y * mul * delta / 1000.; curlev->current.heading_angle -= aimspeed_mouse_x * mouseaim_x * mul; min_gfx_slope += aimspeed_mouse_y * mouseaim_y * mul; @@ -127,8 +134,8 @@ bool turn(int delta) { backing = false; - if(act[6]) { - if(!act[6].last) reversals++; + if(act[nrReverseTime]) { + if(!act[nrReverseTime].last) reversals++; if(planning_mode) simulation_start_tick += 2*delta; else for(int i=0; i