From c37285c2173430cf404f1be9b732cbcc724b7eae Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Thu, 15 Jan 2009 20:55:35 +0000 Subject: [PATCH] Fixed typo in mouse delta reading cleaning not up Z-Axis; Giving automap a nicer Frameloop; Small cleanup --- CHANGELOG.txt | 1 + arch/sdl/mouse.c | 2 +- main/automap.c | 8 +++++++- main/game.c | 20 ++++++++++++-------- main/game.h | 1 + main/gameseq.c | 1 + main/kconfig.c | 1 + 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b4f1d8e9f..3b0a6239b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20090115 -------- main/inferno.h, main/netdrv_udp.c, main/netdrv.c, main/game.c: Cleaning up the mess from revision 892... +arch/sdl/mouse.c, main/automap.c, main/game.c, main/game.h, main/gameseq.c, main/kconfig.c: Fixed typo in mouse delta reading cleaning not up Z-Axis; Giving automap a nicer Frameloop; Small cleanup 20090114 -------- diff --git a/arch/sdl/mouse.c b/arch/sdl/mouse.c index e9bd91567..f4a644cd9 100644 --- a/arch/sdl/mouse.c +++ b/arch/sdl/mouse.c @@ -139,7 +139,7 @@ void mouse_get_delta( int *dx, int *dy, int *dz ) Mouse.delta_x = 0; Mouse.delta_y = 0; - Mouse.delta_y = 0; + Mouse.delta_z = 0; } int mouse_get_btns() diff --git a/main/automap.c b/main/automap.c index d89d7f610..5a520b95f 100644 --- a/main/automap.c +++ b/main/automap.c @@ -71,6 +71,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "cntrlcen.h" #include "timer.h" #include "automap.h" +#include "config.h" #define EF_USED 1 // This edge is used #define EF_DEFINING 2 // A structure defining edge that should always draw. @@ -549,12 +550,17 @@ void do_automap( int key_code ) { } t2 = timer_get_fixed_seconds(); - while (t2 - t1 < F1_0 / 100) // ogl is fast enough that the automap can read the input too fast and you start to turn really slow. So delay a bit (and free up some cpu :) + while (t2 - t1 < F1_0 / (GameCfg.VSync?MAXIMUM_FPS:GameArg.SysMaxFPS)) // ogl is fast enough that the automap can read the input too fast and you start to turn really slow. So delay a bit (and free up some cpu :) { + if (GameArg.SysUseNiceFPS && !GameCfg.VSync) + timer_delay(f1_0 / GameArg.SysMaxFPS - (t2 - t1)); t2 = timer_get_fixed_seconds(); } if (pause_game) + { FrameTime=t2-t1; + FixedStepCalc(); + } t1 = t2; } diff --git a/main/game.c b/main/game.c index 3342da1f4..9942faead 100644 --- a/main/game.c +++ b/main/game.c @@ -1574,13 +1574,11 @@ void game_disable_cheats() Physics_cheat_flag = 0; } -// ------------------------------------------------------------------------------------ -//this function is the game. called when game mode selected. runs until -//editor mode or exit selected -void game() -{ - fix frame_rend_time=0; +// game_setup() +// ---------------------------------------------------------------------------- +void game_setup(void) +{ do_lunacy_on(); // Copy values for insane into copy buffer in ai.c do_lunacy_off(); // Restore true insane mode. Game_aborted = 0; @@ -1621,12 +1619,18 @@ void game() fix_object_segs(); game_flush_inputs(); +} + +// ------------------------------------------------------------------------------------ +//this function is the game. called when game mode selected. runs until +//editor mode or exit selected +void game() +{ + game_setup(); if ( setjmp(LeaveGame)==0 ) { while (1) { - frame_rend_time = timer_get_fixed_seconds(); - // GAME LOOP! Automap_flag = 0; Config_menu_flag = 0; diff --git a/main/game.h b/main/game.h index 9df84070b..9e88d3064 100644 --- a/main/game.h +++ b/main/game.h @@ -103,6 +103,7 @@ void init_game (void); void game (void); void close_game (void); void calc_frame_time (void); +void FixedStepCalc(); void do_flythrough (object * obj, int first_time); extern jmp_buf LeaveGame; // Do a long jump to this when game is over. diff --git a/main/gameseq.c b/main/gameseq.c index 726bf120c..a277f2965 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -1199,6 +1199,7 @@ void StartNewLevelSub(int level_num, int page_in_textures) init_morphs(); init_all_matcens(); reset_palette_add(); + game_flush_inputs(); // clear out the keyboard if (!(Game_mode & GM_MULTI) && !Cheats_enabled) set_highest_level(Current_level_num); diff --git a/main/kconfig.c b/main/kconfig.c index 3cb4f61db..8abdec2c5 100644 --- a/main/kconfig.c +++ b/main/kconfig.c @@ -1385,6 +1385,7 @@ void controls_read_all() } else { mouse_axis[0] = 0; mouse_axis[1] = 0; + mouse_axis[2] = 0; mouse_buttons = 0; use_mouse=0; }