Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a\SRC\LAUNCH.C 1996-02-20 18:48:20.000000000 +0200
- +++ b\SRC\LAUNCH.C 2017-05-22 19:35:55.000000000 +0200
- @@ -35,12 +35,19 @@
- #include "external.h"
- #include "function.h"
- #define CONTROL_STACKSIZE (2048)
- #define CONTROL_SAFETYMARGIN (8)
- +struct MouseParameters {
- + int32 scale;
- + int32 offset;
- + int32 threshold;
- + int32 leftover;
- +} mouse_params[2] = {{32, 0, 256, 0}, {40, 192, 256, 0}};
- +
- typedef enum
- {
- axis_up,
- axis_down,
- axis_left,
- axis_right
- @@ -216,18 +223,18 @@
- // Setup our default button mappings
- // the way the mouse is set up, we get
- // LMB in bit 0, RMB in bit 1 and MMB in bit 2
- //
- // map single clicked buttons
- - control.buttonmap[0][0] = gamefunc_Fire;
- - control.buttonmap[1][0] = gamefunc_Strafe;
- - control.buttonmap[2][0] = gamefunc_Move_Forward;
- + control.buttonmap[0][0] = gamefunc_Weapon_Fire;
- + control.buttonmap[1][0] = gamefunc_Weapon_Special_Fire;
- + //control.buttonmap[2][0] = gamefunc_Mouse_Aiming;
- // map double clicked buttons
- - control.buttonmap[1][1] = gamefunc_Open;
- + //control.buttonmap[1][1] = gamefunc_Open;
- // see if our device is available
- status = MOUSE_Init();
- if (status)
- {
- @@ -260,26 +267,35 @@
- = This function querys your device and gets it's input
- =
- =================
- */
- void GetDeviceInput( void )
- {
- + int i;
- +
- //
- // get movement info
- //
- MOUSE_GetDelta( &control.axes[0], &control.axes[1] );
- - // perform some rudimentary filtering
- - if (abs(control.axes[0])>abs(control.axes[1]))
- - control.axes[1]/=3;
- - else
- - control.axes[0]/=3;
- -
- - // scale up our values into the game domain
- - control.axes[0]*=32;
- - control.axes[1]*=96;
- + for (i = 0; i < 2; i++) {
- + if (control.axes[i]) {
- + control.axes[i] *= mouse_params[i].scale;
- + control.axes[i] += mouse_params[i].leftover;
- + if (control.axes[i] > 0) {
- + control.axes[i] += mouse_params[i].offset;
- + mouse_params[i].leftover = control.axes[i] % mouse_params[i].threshold;
- + } else {
- + control.axes[i] -= mouse_params[i].offset;
- + mouse_params[i].leftover = -(-control.axes[i] % mouse_params[i].threshold);
- + }
- + control.axes[i] -= mouse_params[i].leftover;
- + }
- + }
- +
- + control.axes[1] = -control.axes[1];
- //
- // get button info
- //
- control.buttonstate = MOUSE_GetButtons();
- }
- @@ -507,12 +523,13 @@
- =============
- */
- void main( void )
- {
- int32 i;
- + FILE *f;
- // welcome the user
- printf ("External Launch for 3DRealms games.\n");
- printf ("Duke Nukem 3D implementation.\n");
- printf ("Written by Mark Dochtermann.\n");
- printf ("Version 1.0\n");
- @@ -543,11 +560,25 @@
- // try to initialize the device
- if (InitializeDevice())
- {
- exit(0);
- }
- +
- + f = fopen("launch.txt", "r");
- + if (f != NULL) {
- + fscanf(f, "%ld %ld %ld %ld %ld %ld",
- + &mouse_params[0].scale, &mouse_params[0].offset, &mouse_params[0].threshold,
- + &mouse_params[1].scale, &mouse_params[1].offset, &mouse_params[1].threshold);
- + fclose(f);
- + printf("Read mouse parameters from file.\n");
- + }
- +
- + printf("Mouse params: %ld %ld %ld %ld %ld %ld\n",
- + mouse_params[0].scale, mouse_params[0].offset, mouse_params[0].threshold,
- + mouse_params[1].scale, mouse_params[1].offset, mouse_params[1].threshold);
- +
- // launch the game
- - LaunchGAME ( 1 );
- + LaunchGAME ( 0 );
- // we are back from the game, so clean up and exit
- ShutdownDevice();
- }
- --- a\SRC\FUNCTION.H 1996-02-13 19:06:10.000000000 +0200
- +++ b\SRC\FUNCTION.H 2017-05-22 19:38:20.000000000 +0200
- @@ -10,33 +10,90 @@
- #define _function_public_
- #define NUMGAMEFUNCTIONS 49
- extern char * gamefunctions[];
- +// Duke3D
- +/*enum
- + {
- + gamefunc_Move_Forward,
- + gamefunc_Move_Backward,
- + gamefunc_Turn_Left,
- + gamefunc_Turn_Right,
- + gamefunc_Strafe,
- + gamefunc_Fire,
- + gamefunc_Open,
- + gamefunc_Run,
- + gamefunc_AutoRun,
- + gamefunc_Jump,
- + gamefunc_Crouch,
- + gamefunc_Look_Up,
- + gamefunc_Look_Down,
- + gamefunc_Look_Left,
- + gamefunc_Look_Right,
- + gamefunc_Strafe_Left,
- + gamefunc_Strafe_Right,
- + gamefunc_Aim_Up,
- + gamefunc_Aim_Down,
- + gamefunc_Weapon_1,
- + gamefunc_Weapon_2,
- + gamefunc_Weapon_3,
- + gamefunc_Weapon_4,
- + gamefunc_Weapon_5,
- + gamefunc_Weapon_6,
- + gamefunc_Weapon_7,
- + gamefunc_Weapon_8,
- + gamefunc_Weapon_9,
- + gamefunc_Weapon_10,
- + gamefunc_Inventory,
- + gamefunc_Inventory_Left,
- + gamefunc_Inventory_Right,
- + gamefunc_Holo_Duke,
- + gamefunc_Jetpack,
- + gamefunc_NightVision,
- + gamefunc_MedKit,
- + gamefunc_TurnAround,
- + gamefunc_SendMessage,
- + gamefunc_Map,
- + gamefunc_Shrink_Screen,
- + gamefunc_Enlarge_Screen,
- + gamefunc_Center_View,
- + gamefunc_Holster_Weapon,
- + gamefunc_Show_Opponents_Weapon,
- + gamefunc_Map_Follow_Mode,
- + gamefunc_See_Coop_View,
- + gamefunc_Mouse_Aiming,
- + gamefunc_Toggle_Crosshair,
- + gamefunc_Steroids,
- + };*/
- +
- enum
- {
- gamefunc_Move_Forward,
- gamefunc_Move_Backward,
- gamefunc_Turn_Left,
- gamefunc_Turn_Right,
- + gamefunc_Turn_Around,
- gamefunc_Strafe,
- - gamefunc_Fire,
- - gamefunc_Open,
- + gamefunc_Strafe_Left,
- + gamefunc_Strafe_Right,
- + gamefunc_Jump,
- + gamefunc_Crouch,
- gamefunc_Run,
- gamefunc_AutoRun,
- - gamefunc_Jump,
- - gamefunc_Crouch,
- + gamefunc_Open,
- + gamefunc_Weapon_Fire,
- + gamefunc_Weapon_Special_Fire,
- + gamefunc_Aim_Up,
- + gamefunc_Aim_Down,
- + gamefunc_Aim_Center,
- gamefunc_Look_Up,
- gamefunc_Look_Down,
- - gamefunc_Look_Left,
- - gamefunc_Look_Right,
- - gamefunc_Strafe_Left,
- - gamefunc_Strafe_Right,
- - gamefunc_Aim_Up,
- - gamefunc_Aim_Down,
- + gamefunc_Tilt_Left,
- + gamefunc_Tilt_Right,
- gamefunc_Weapon_1,
- gamefunc_Weapon_2,
- gamefunc_Weapon_3,
- gamefunc_Weapon_4,
- gamefunc_Weapon_5,
- gamefunc_Weapon_6,
- @@ -44,25 +101,27 @@
- gamefunc_Weapon_8,
- gamefunc_Weapon_9,
- gamefunc_Weapon_10,
- gamefunc_Inventory,
- gamefunc_Inventory_Left,
- gamefunc_Inventory_Right,
- - gamefunc_Holo_Duke,
- - gamefunc_Jetpack,
- - gamefunc_NightVision,
- - gamefunc_MedKit,
- - gamefunc_TurnAround,
- - gamefunc_SendMessage,
- - gamefunc_Map,
- + gamefunc_Map_Toggle,
- + gamefunc_Map_Follow_Mode,
- gamefunc_Shrink_Screen,
- gamefunc_Enlarge_Screen,
- - gamefunc_Center_View,
- - gamefunc_Holster_Weapon,
- - gamefunc_Show_Opponents_Weapon,
- - gamefunc_Map_Follow_Mode,
- + gamefunc_Send_Message,
- gamefunc_See_Coop_View,
- + gamefunc_See_Chase_View,
- gamefunc_Mouse_Aiming,
- gamefunc_Toggle_Crosshair,
- - gamefunc_Steroids,
- + gamefunc_Next_Weapon,
- + gamefunc_Previous_Weapon,
- + gamefunc_Holster_Weapon,
- + gamefunc_Show_Opponents_Weapon,
- + gamefunc_BestVision,
- + gamefunc_CrystalBall,
- + gamefunc_JumpBoots,
- + gamefunc_MedKit,
- + gamefunc_ProximityBombs,
- + gamefunc_RemoteBombs
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement