Guest User

dukectrl changes

a guest
May 22nd, 2017
12
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- a\SRC\LAUNCH.C  1996-02-20 18:48:20.000000000 +0200
  2. +++ b\SRC\LAUNCH.C  2017-05-22 19:35:55.000000000 +0200
  3. @@ -35,12 +35,19 @@
  4.  #include "external.h"
  5.  #include "function.h"
  6.  
  7.  #define CONTROL_STACKSIZE    (2048)
  8.  #define CONTROL_SAFETYMARGIN (8)
  9.  
  10. +struct MouseParameters {
  11. +   int32 scale;
  12. +   int32 offset;
  13. +   int32 threshold;
  14. +   int32 leftover;
  15. +} mouse_params[2] = {{32, 0, 256, 0}, {40, 192, 256, 0}};
  16. +
  17.  typedef enum
  18.     {
  19.     axis_up,
  20.     axis_down,
  21.     axis_left,
  22.     axis_right
  23. @@ -216,18 +223,18 @@
  24.     // Setup our default button mappings
  25.     // the way the mouse is set up, we get
  26.     // LMB in bit 0, RMB in bit 1 and MMB in bit 2
  27.     //
  28.  
  29.     // map single clicked buttons
  30. -   control.buttonmap[0][0] = gamefunc_Fire;
  31. -   control.buttonmap[1][0] = gamefunc_Strafe;
  32. -   control.buttonmap[2][0] = gamefunc_Move_Forward;
  33. +   control.buttonmap[0][0] = gamefunc_Weapon_Fire;
  34. +   control.buttonmap[1][0] = gamefunc_Weapon_Special_Fire;
  35. +   //control.buttonmap[2][0] = gamefunc_Mouse_Aiming;
  36.  
  37.     // map double clicked buttons
  38. -   control.buttonmap[1][1] = gamefunc_Open;
  39. +   //control.buttonmap[1][1] = gamefunc_Open;
  40.  
  41.     // see if our device is available
  42.  
  43.     status = MOUSE_Init();
  44.     if (status)
  45.        {
  46. @@ -260,26 +267,35 @@
  47.  = This function querys your device and gets it's input
  48.  =
  49.  =================
  50.  */
  51.  void GetDeviceInput( void )
  52.     {
  53. +   int i;     
  54. +
  55.     //
  56.     // get movement info
  57.     //
  58.     MOUSE_GetDelta( &control.axes[0], &control.axes[1] );
  59.  
  60. -   // perform some rudimentary filtering
  61. -   if (abs(control.axes[0])>abs(control.axes[1]))
  62. -      control.axes[1]/=3;
  63. -   else
  64. -      control.axes[0]/=3;
  65. -
  66. -   // scale up our values into the game domain
  67. -   control.axes[0]*=32;
  68. -   control.axes[1]*=96;
  69. +   for (i = 0; i < 2; i++) {
  70. +      if (control.axes[i]) {
  71. +          control.axes[i] *= mouse_params[i].scale;
  72. +          control.axes[i] += mouse_params[i].leftover;
  73. +          if (control.axes[i] > 0) {
  74. +               control.axes[i] += mouse_params[i].offset;
  75. +               mouse_params[i].leftover = control.axes[i] % mouse_params[i].threshold;
  76. +          } else {
  77. +               control.axes[i] -= mouse_params[i].offset;
  78. +               mouse_params[i].leftover = -(-control.axes[i] % mouse_params[i].threshold);
  79. +          }
  80. +          control.axes[i] -= mouse_params[i].leftover;
  81. +      }
  82. +   }
  83. +
  84. +   control.axes[1] = -control.axes[1];
  85.  
  86.     //
  87.     // get button info
  88.     //
  89.     control.buttonstate = MOUSE_GetButtons();
  90.     }
  91. @@ -507,12 +523,13 @@
  92.  =============
  93.  */
  94.  
  95.  void main( void )
  96.     {
  97.     int32 i;
  98. +   FILE *f;
  99.  
  100.     // welcome the user
  101.     printf ("External Launch for 3DRealms games.\n");
  102.     printf ("Duke Nukem 3D implementation.\n");
  103.     printf ("Written by Mark Dochtermann.\n");
  104.     printf ("Version 1.0\n");
  105. @@ -543,11 +560,25 @@
  106.  
  107.     // try to initialize the device
  108.     if (InitializeDevice())
  109.        {
  110.        exit(0);
  111.        }
  112. +
  113. +   f = fopen("launch.txt", "r");
  114. +   if (f != NULL) {
  115. +       fscanf(f, "%ld %ld %ld %ld %ld %ld",
  116. +               &mouse_params[0].scale, &mouse_params[0].offset, &mouse_params[0].threshold,
  117. +               &mouse_params[1].scale, &mouse_params[1].offset, &mouse_params[1].threshold);
  118. +       fclose(f);
  119. +       printf("Read mouse parameters from file.\n");
  120. +   }
  121. +
  122. +   printf("Mouse params: %ld %ld %ld %ld %ld %ld\n",
  123. +           mouse_params[0].scale, mouse_params[0].offset, mouse_params[0].threshold,
  124. +           mouse_params[1].scale, mouse_params[1].offset, mouse_params[1].threshold);
  125. +
  126.     // launch the game
  127. -   LaunchGAME ( 1 );
  128. +   LaunchGAME ( 0 );
  129.     // we are back from the game, so clean up and exit
  130.     ShutdownDevice();
  131.     }
  132.  
  133.     --- a\SRC\FUNCTION.H    1996-02-13 19:06:10.000000000 +0200
  134.     +++ b\SRC\FUNCTION.H    2017-05-22 19:38:20.000000000 +0200
  135.     @@ -10,33 +10,90 @@
  136.      #define _function_public_
  137.      
  138.      #define NUMGAMEFUNCTIONS 49
  139.      
  140.      extern char * gamefunctions[];
  141.      
  142.     +// Duke3D
  143.     +/*enum
  144.     +   {
  145.     +   gamefunc_Move_Forward,
  146.     +   gamefunc_Move_Backward,
  147.     +   gamefunc_Turn_Left,
  148.     +   gamefunc_Turn_Right,
  149.     +   gamefunc_Strafe,
  150.     +   gamefunc_Fire,
  151.     +   gamefunc_Open,
  152.     +   gamefunc_Run,
  153.     +   gamefunc_AutoRun,
  154.     +   gamefunc_Jump,
  155.     +   gamefunc_Crouch,
  156.     +   gamefunc_Look_Up,
  157.     +   gamefunc_Look_Down,
  158.     +   gamefunc_Look_Left,
  159.     +   gamefunc_Look_Right,
  160.     +   gamefunc_Strafe_Left,
  161.     +   gamefunc_Strafe_Right,
  162.     +   gamefunc_Aim_Up,
  163.     +   gamefunc_Aim_Down,
  164.     +   gamefunc_Weapon_1,
  165.     +   gamefunc_Weapon_2,
  166.     +   gamefunc_Weapon_3,
  167.     +   gamefunc_Weapon_4,
  168.     +   gamefunc_Weapon_5,
  169.     +   gamefunc_Weapon_6,
  170.     +   gamefunc_Weapon_7,
  171.     +   gamefunc_Weapon_8,
  172.     +   gamefunc_Weapon_9,
  173.     +   gamefunc_Weapon_10,
  174.     +   gamefunc_Inventory,
  175.     +   gamefunc_Inventory_Left,
  176.     +   gamefunc_Inventory_Right,
  177.     +   gamefunc_Holo_Duke,
  178.     +   gamefunc_Jetpack,
  179.     +   gamefunc_NightVision,
  180.     +   gamefunc_MedKit,
  181.     +   gamefunc_TurnAround,
  182.     +   gamefunc_SendMessage,
  183.     +   gamefunc_Map,
  184.     +   gamefunc_Shrink_Screen,
  185.     +   gamefunc_Enlarge_Screen,
  186.     +   gamefunc_Center_View,
  187.     +   gamefunc_Holster_Weapon,
  188.     +   gamefunc_Show_Opponents_Weapon,
  189.     +   gamefunc_Map_Follow_Mode,
  190.     +   gamefunc_See_Coop_View,
  191.     +   gamefunc_Mouse_Aiming,
  192.     +   gamefunc_Toggle_Crosshair,
  193.     +   gamefunc_Steroids,
  194.     +   };*/
  195.     +
  196.      enum
  197.         {
  198.         gamefunc_Move_Forward,
  199.         gamefunc_Move_Backward,
  200.         gamefunc_Turn_Left,
  201.         gamefunc_Turn_Right,
  202.     +   gamefunc_Turn_Around,
  203.         gamefunc_Strafe,
  204.     -   gamefunc_Fire,
  205.     -   gamefunc_Open,
  206.     +   gamefunc_Strafe_Left,
  207.     +   gamefunc_Strafe_Right,
  208.     +   gamefunc_Jump,
  209.     +   gamefunc_Crouch,
  210.         gamefunc_Run,
  211.         gamefunc_AutoRun,
  212.     -   gamefunc_Jump,
  213.     -   gamefunc_Crouch,
  214.     +   gamefunc_Open,
  215.     +   gamefunc_Weapon_Fire,
  216.     +   gamefunc_Weapon_Special_Fire,
  217.     +   gamefunc_Aim_Up,
  218.     +   gamefunc_Aim_Down,
  219.     +   gamefunc_Aim_Center,
  220.         gamefunc_Look_Up,
  221.         gamefunc_Look_Down,
  222.     -   gamefunc_Look_Left,
  223.     -   gamefunc_Look_Right,
  224.     -   gamefunc_Strafe_Left,
  225.     -   gamefunc_Strafe_Right,
  226.     -   gamefunc_Aim_Up,
  227.     -   gamefunc_Aim_Down,
  228.     +   gamefunc_Tilt_Left,
  229.     +   gamefunc_Tilt_Right,
  230.         gamefunc_Weapon_1,
  231.         gamefunc_Weapon_2,
  232.         gamefunc_Weapon_3,
  233.         gamefunc_Weapon_4,
  234.         gamefunc_Weapon_5,
  235.         gamefunc_Weapon_6,
  236.     @@ -44,25 +101,27 @@
  237.         gamefunc_Weapon_8,
  238.         gamefunc_Weapon_9,
  239.         gamefunc_Weapon_10,
  240.         gamefunc_Inventory,
  241.         gamefunc_Inventory_Left,
  242.         gamefunc_Inventory_Right,
  243.     -   gamefunc_Holo_Duke,
  244.     -   gamefunc_Jetpack,
  245.     -   gamefunc_NightVision,
  246.     -   gamefunc_MedKit,
  247.     -   gamefunc_TurnAround,
  248.     -   gamefunc_SendMessage,
  249.     -   gamefunc_Map,
  250.     +   gamefunc_Map_Toggle,
  251.     +   gamefunc_Map_Follow_Mode,
  252.         gamefunc_Shrink_Screen,
  253.         gamefunc_Enlarge_Screen,
  254.     -   gamefunc_Center_View,
  255.     -   gamefunc_Holster_Weapon,
  256.     -   gamefunc_Show_Opponents_Weapon,
  257.     -   gamefunc_Map_Follow_Mode,
  258.     +   gamefunc_Send_Message,
  259.         gamefunc_See_Coop_View,
  260.     +   gamefunc_See_Chase_View,
  261.         gamefunc_Mouse_Aiming,
  262.         gamefunc_Toggle_Crosshair,
  263.     -   gamefunc_Steroids,
  264.     +   gamefunc_Next_Weapon,
  265.     +   gamefunc_Previous_Weapon,
  266.     +   gamefunc_Holster_Weapon,
  267.     +   gamefunc_Show_Opponents_Weapon,
  268.     +   gamefunc_BestVision,
  269.     +   gamefunc_CrystalBall,
  270.     +   gamefunc_JumpBoots,
  271.     +   gamefunc_MedKit,
  272.     +   gamefunc_ProximityBombs,
  273.     +   gamefunc_RemoteBombs
  274.         };
  275.      #endif
RAW Paste Data