From f98e8c10703078e5e67917c7b5cd96a1b267fcfb Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 22 May 2004 06:56:41 +0000 Subject: [PATCH] make rear view leave_time variable with -rearviewleavetime argument (d1x r1.25, r1.5, r1.27) --- ChangeLog | 6 ++++++ main/game.c | 22 ++++++++++++++-------- main/game.h | 3 ++- main/inferno.c | 10 +++++++++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bf5785c..a102f3ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-21 Matthew Mueller + + * main/game.c, main/game.h, main/inferno.c: make rear view + leave_time variable with -rearviewleavetime argument (d1x r1.25, + r1.5, r1.27) + 2004-05-22 Martin Schaffner * main/inferno.c: change -udp documentation to d2x behaviour diff --git a/main/game.c b/main/game.c index 4e98081d..1f23a1fc 100644 --- a/main/game.c +++ b/main/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.28 2004-05-20 07:54:47 btb Exp $ */ +/* $Id: game.c,v 1.29 2004-05-22 06:56:34 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -407,7 +407,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -char game_rcsid[] = "$Id: game.c,v 1.28 2004-05-20 07:54:47 btb Exp $"; +char game_rcsid[] = "$Id: game.c,v 1.29 2004-05-22 06:56:34 btb Exp $"; #endif #ifdef WINDOWS @@ -2404,12 +2404,11 @@ void show_help() //temp function until Matt cleans up game sequencing extern void temp_reset_stuff_on_level(); +fix Rear_view_leave_time = 0x1000 // how long until we decide key is down (Used to be 0x4000) + //deal with rear view - switch it on, or off, or whatever void check_rear_view() { - - #define LEAVE_TIME 0x1000 //how long until we decide key is down (Used to be 0x4000) - static int leave_mode; static fix entry_time; @@ -2426,8 +2425,15 @@ void check_rear_view() } else { Rear_view = 1; - leave_mode = 0; //means wait for another key - entry_time = timer_get_fixed_seconds(); + if (Rear_view_leave_time <= 0) + { + leave_mode = 1; // set leave mode on here otherwise we will always have to hold for at least 1 frame to get leave_mode on + } + else + { + leave_mode = 0; // means wait for another key + entry_time = timer_get_fixed_seconds(); + } if (Cockpit_mode == CM_FULL_COCKPIT) { Cockpit_mode_save = Cockpit_mode; select_cockpit(CM_REAR_VIEW); @@ -2439,7 +2445,7 @@ void check_rear_view() else if (Controls.rear_view_down_state) { - if (leave_mode==0 && (timer_get_fixed_seconds()-entry_time)>LEAVE_TIME) + if (leave_mode == 0 && (timer_get_fixed_seconds() - entry_time) > Rear_view_leave_time) leave_mode = 1; } else { diff --git a/main/game.h b/main/game.h index c71f7cf4..c692e3ba 100644 --- a/main/game.h +++ b/main/game.h @@ -1,4 +1,4 @@ -/* $Id: game.h,v 1.7 2004-05-20 01:29:16 btb Exp $ */ +/* $Id: game.h,v 1.8 2004-05-22 06:56:38 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -387,6 +387,7 @@ extern int Game_window_w, // width and height of player's game window Game_window_h; extern int Rear_view; // if true, looking back. +extern fix Rear_view_leave_time;// how long until we decide key is down // initalize flying void fly_init(object *obj); diff --git a/main/inferno.c b/main/inferno.c index ac19b277..3f6da66a 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -1,4 +1,4 @@ -/* $Id: inferno.c,v 1.82 2004-05-22 02:31:48 schaffner Exp $ */ +/* $Id: inferno.c,v 1.83 2004-05-22 06:56:41 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -1017,6 +1017,7 @@ void print_commandline_help() printf( " -automap_gameres %s\n","Set automap to use the same resolution as in game"); // printf( " -menux %s\n","Set menu resolution to by "); // printf( " -menu_gameres %s\n","Set menus to use the same resolution as in game"); + printf(" -rearviewtime t %s\n", "time holding rearview key to use toggle mode (default 0.0625 seconds)"); printf( "\n"); printf( "D2X System Options:\n\n"); @@ -1267,6 +1268,13 @@ int main(int argc, char *argv[]) //con_printf(CON_VERBOSE, "\n%s...", "Checking for Descent 2 CD-ROM"); + if ((t = FindArg("-rearviewtime"))) + { + float f = atof(Args[t + 1]); + Rear_view_leave_time = f * f1_0; + } + con_printf(CON_VERBOSE, "Rear_view_leave_time=0x%x (%f sec)\n", Rear_view_leave_time, Rear_view_leave_time / (float)f1_0)); + //added/edited 8/18/98 by Victor Rachels to set maximum fps <= 100 if ((t = FindArg( "-maxfps" ))) { t=atoi(Args[t+1]); -- 2.39.2