home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / arcade.c < prev    next >
C/C++ Source or Header  |  1998-06-08  |  5KB  |  159 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/arcade.c $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:29:12 $
  18.  * 
  19.  * Routines for arcade version
  20.  * 
  21.  * $Log: arcade.c $
  22.  * Revision 2.0  1995/02/27  11:29:12  john
  23.  * New version 2.0, which has no anonymous unions, builds with
  24.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  25.  * 
  26.  * Revision 1.7  1994/09/21  15:48:52  matt
  27.  * Made digital joystick less "soft"
  28.  * 
  29.  * Revision 1.6  1994/09/16  18:50:47  matt
  30.  * Read vfx1 head sensing when in arcade mode
  31.  * 
  32.  * Revision 1.5  1994/09/16  16:15:00  john
  33.  * Added acrade sequencing.
  34.  * 
  35.  * Revision 1.4  1994/09/16  12:52:07  mike
  36.  * fix compile errors.
  37.  * 
  38.  * Revision 1.3  1994/09/16  12:36:48  john
  39.  * Fixed ramping pitch, heading.
  40.  * 
  41.  * Revision 1.2  1994/09/16  11:51:00  john
  42.  * Added first version of arcade joystick support;
  43.  * Also fixed some bugs in kconfig.c, such as reading non-present
  44.  * joysticks, which killed frame rate, and not reading key_down_time
  45.  * when in slide mode or bank mode.
  46.  * 
  47.  * Revision 1.1  1994/09/16  09:59:16  john
  48.  * Initial revision
  49.  * 
  50.  * 
  51.  */
  52.  
  53.  
  54. #pragma off (unreferenced)
  55. static char rcsid[] = "$Id: arcade.c 2.0 1995/02/27 11:29:12 john Exp $";
  56. #pragma on (unreferenced)
  57.  
  58. #include <stdio.h>
  59. #include <stdlib.h>
  60. #include <string.h>
  61. #include <dos.h>
  62. #include <io.h>
  63. #include <stdarg.h>
  64. #include <ctype.h>
  65.  
  66. #include "error.h"
  67. #include "types.h"
  68. #include "gr.h"
  69. #include "mono.h"
  70. #include "key.h"
  71. #include "palette.h"
  72. #include "game.h"
  73. #include "gamefont.h"
  74. #include "iff.h"
  75. #include "mem.h"
  76. #include "joy.h"
  77. #include "mouse.h"
  78. #include "kconfig.h"
  79. #include "gauges.h"
  80. #include "joydefs.h"
  81. #include "vfx1.h"
  82. #include "render.h"
  83. #include "arcade.h"
  84.  
  85. int Arcade_mode = 0;
  86. fix Arcade_timer = 0;
  87.  
  88. #define    PH_SCALE    1    //8
  89.  
  90. void arcade_init()
  91. {
  92.     Arcade_mode = 1;
  93. }
  94.  
  95. extern read_vfx1_sense();
  96.  
  97. void arcade_read_controls()
  98. {
  99.     fix pitch, heading;
  100.  
  101.     if (!Arcade_mode) return;
  102.  
  103.     pitch = Controls.pitch_time;
  104.     heading = Controls.heading_time;
  105.     memset( &Controls, 0, sizeof(control_info) );
  106.     Controls.pitch_time = pitch;
  107.     Controls.heading_time = heading;
  108.     
  109.     pitch = heading = 0;
  110.                 
  111. //----------- Read fire_primary_down_count
  112.     Controls.fire_primary_down_count += joy_get_button_down_cnt(20);
  113.  
  114. //----------- Read fire_primary_state
  115.     Controls.fire_primary_state |= joy_get_button_state(20);
  116.  
  117. //------------ Read forward_thrust_time ---------
  118.     Controls.forward_thrust_time += joy_get_button_down_time( 21 );
  119.     Controls.forward_thrust_time -= joy_get_button_down_time( 22 );
  120.  
  121. //------------ Read pitch_time -----------
  122.     pitch += joy_get_button_down_time(24)/(PH_SCALE*2);
  123.     pitch -= joy_get_button_down_time(25)/(PH_SCALE*2);
  124.  
  125. //------------ Read heading_time -----------
  126.     heading += joy_get_button_down_time(27)/PH_SCALE;
  127.     heading -= joy_get_button_down_time(26)/PH_SCALE;
  128.  
  129.     //@@if ( pitch!=0)    {
  130.     //@@    if ((pitch>0) && (Controls.pitch_time<0))
  131.     //@@        Controls.pitch_time=0;
  132.     //@@    if ((pitch<0) && (Controls.pitch_time>0))
  133.     //@@        Controls.pitch_time=0;
  134.     //@@    Controls.pitch_time += pitch;
  135.     //@@} else
  136.     //@@    Controls.pitch_time = 0;
  137.     //@@if ( heading!=0)    {
  138.     //@@    if ((heading>0) && (Controls.heading_time<0))
  139.     //@@        Controls.heading_time=0;
  140.     //@@    if ((heading<0) && (Controls.heading_time>0))
  141.     //@@        Controls.heading_time=0;
  142.     //@@    Controls.heading_time += heading;
  143.     //@@} else
  144.     //@@    Controls.heading_time = 0;
  145.  
  146.     Controls.pitch_time = pitch;
  147.     Controls.heading_time = heading;
  148.  
  149. //------- saturate to +/- frame_time -----------
  150.     if (Controls.pitch_time>FrameTime) Controls.pitch_time=FrameTime;
  151.     if (Controls.pitch_time<-FrameTime) Controls.pitch_time=-FrameTime;
  152.     if (Controls.heading_time>FrameTime) Controls.heading_time=FrameTime;
  153.     if (Controls.heading_time<-FrameTime) Controls.heading_time=-FrameTime;
  154.  
  155.     read_vfx1_sense();
  156. }
  157.  
  158.  
  159.