X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fapp.cc;h=178b7df122ba0d4bd952585447a873e5a53cc8c5;hp=4c6559b1d42ebc9bfc644e0805d24ad5bf874e9c;hb=HEAD;hpb=3ee6226e6c7110280b4cc05a9c776eed3bfe6555 diff --git a/src/app.cc b/src/app.cc index 4c6559b..178b7df 100644 --- a/src/app.cc +++ b/src/app.cc @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include "app.h" #include "opengl.h" #include "sdr.h" @@ -64,7 +64,7 @@ static bool bnstate[8]; static bool keystate[256]; static bool gpad_bnstate[64]; static Vec2 joy_move, joy_look; -static float joy_deadzone = 0.01; +static float joy_deadzone = 0.1; static float framerate; @@ -325,7 +325,18 @@ static void update(float dt) jlook_lensq -= jdeadsq; float mag = len * len; - avatar.body_rot += mag * joy_look.x / len * 200.0 * dt; + + if(opt.min_turn > 0.0f) { + static long last_turn; + if(len > 0.5 && time_msec - last_turn > 350) { + float sign = joy_look.x > 0.0f ? 1.0f : -1.0f; + avatar.body_rot += opt.min_turn * sign; + last_turn = time_msec; + } + } else { + avatar.body_rot += mag * joy_look.x / len * 200.0 * dt; + } + avatar.head_alt += mag * joy_look.y / len * 100.0 * dt; if(avatar.head_alt < -90.0f) avatar.head_alt = -90.0f; if(avatar.head_alt > 90.0f) avatar.head_alt = 90.0f;