2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 // $Header: r:/t2repos/thief2/src/dark/drk_bind.cpp,v 1.14 2000/02/19 13:09:06 toml Exp $
8 //dark binds processing
32 #include <dbmem.h> // must be last header!
34 static BOOL g_on_ground
;
35 static BOOL g_in_water
;
36 static BOOL g_climbing
;
37 static BOOL g_mantling
;
39 EXTERN BOOL gNoMoveKeys
; //shock movement lockout. here hacked in for
42 #define MINEYEZOOM 1.0
43 #define MAXEYEZOOM 3.0
44 #define EYEZOOMFACTOR 1.1
45 #define DRUNKEYEZOOM 0.1
47 static void GetStates ()
49 g_on_ground
= PhysObjOnGround (PlayerObject ());
50 g_in_water
= PhysObjInWater (PlayerObject ());
51 g_climbing
= PhysObjIsClimbing (PlayerObject ());
52 g_mantling
= PhysObjIsMantling (PlayerObject ());
55 static BOOL
disallow_action_and_unwind(void)
57 if (GetPlayerMode() == kPM_Dead
)
59 UnwindToMissionLoop();
66 static char *BlockProc (char *, char *val
, BOOL
)
71 if (disallow_action_and_unwind())
74 double dval
= atof (val
);
76 StartWeaponBlock (PlayerObject (), OBJ_NULL
);
78 FinishWeaponAction (PlayerObject (), OBJ_NULL
);
83 static char *UseWeaponOrItemProc (char *cmd
, char *val
, BOOL
)
84 { // this is NOT TOO COOL
85 if (strnicmp(cmd
,"use_weapon",strlen("use_weapon"))==0)
87 if (GetPlayerMode() == kPM_Dead
)
91 if (disallow_action_and_unwind())
94 //if not in FIRST_PERSON mode, frobbing should return you.
96 Camera
* playercam
= PlayerCamera();
97 if (CameraGetMode(playercam
) != FIRST_PERSON
)
99 CameraAttach(playercam
,PlayerObject());
103 double dval
= atof (val
);
104 //for these, start is 0 and end is 1
107 strcat (str
, (dval
== 0.0) ? " 1" : " 0");
108 CommandExecute (str
);
114 static char *InvSelectProc (char *cmd
, char *val
, BOOL
)
116 if (disallow_action_and_unwind())
125 CommandExecute (str
);
132 Camera
* player_cam
= PlayerCamera();
134 //disallow zoom while in remote mode
135 if (CameraIsRemote(player_cam
))
138 float curzoom
= player_cam
->zoom
;
140 curzoom
*= EYEZOOMFACTOR
;
142 if (curzoom
> MAXEYEZOOM
)
143 curzoom
= MAXEYEZOOM
;
145 player_cam
->zoom
= curzoom
;
151 Camera
* player_cam
= PlayerCamera();
153 //disallow zoom while in remote mode
154 if (CameraIsRemote(player_cam
))
157 float curzoom
= player_cam
->zoom
;
159 curzoom
/= EYEZOOMFACTOR
;
161 if (curzoom
< MINEYEZOOM
)
162 curzoom
= MINEYEZOOM
;
164 player_cam
->zoom
= curzoom
;
167 static char *EyeZoomInProc (char *, char *val
, BOOL
)
172 if (disallow_action_and_unwind())
179 bZoomIn
= (count
> 0);
180 count
= abs( count
);
181 for ( i
= 0; i
< count
; i
++ ) {
192 static char *EyeZoomOutProc (char *, char *val
, BOOL
)
197 if (disallow_action_and_unwind())
204 bZoomIn
= (count
< 0);
205 count
= abs( count
);
206 for ( i
= 0; i
< count
; i
++ ) {
217 static char *EyeNoZoomProc (char *, char *val
, BOOL
)
219 if (disallow_action_and_unwind())
222 Camera
* player_cam
= PlayerCamera();
224 //disallow zoom while in remote mode
225 if (CameraIsRemote(player_cam
))
228 float curzoom
= player_cam
->zoom
;
230 curzoom
= MINEYEZOOM
;
232 player_cam
->zoom
= curzoom
;
236 static char *EyeDrunkZoomProc (char *, char *val
, BOOL
)
238 if (disallow_action_and_unwind())
241 Camera
* player_cam
= PlayerCamera();
243 //disallow zoom while in remote mode
244 if (CameraIsRemote(player_cam
))
247 float curzoom
= player_cam
->zoom
;
249 curzoom
/= EYEZOOMFACTOR
;
251 if (curzoom
< DRUNKEYEZOOM
)
252 curzoom
= DRUNKEYEZOOM
;
254 player_cam
->zoom
= curzoom
;
258 static char *JumpBlockProc (char *, char *val
, BOOL
)
263 if (disallow_action_and_unwind())
268 double dval
= atof (val
);
270 AutoAppIPtr_(Inventory
, pInv
);
272 ObjID weapon
= pInv
->Selection(kCurrentWeapon
);
276 owner
= GetWeaponOwnerObjID(weapon
);
278 if (weapon
&& WeaponIsSword(owner
, weapon
))
281 StartWeaponBlock (PlayerObject(), OBJ_NULL
);
283 FinishWeaponAction (PlayerObject(), OBJ_NULL
);
289 if ((g_on_ground
|| g_in_water
|| g_climbing
) && !g_mantling
)
290 PhysPlayerJump (PlayerObject (), JUMP_SPEED
);
293 SetJumpState (FALSE
);
295 BreakMantle (PlayerObject ());
302 static char *DummyProc (char *, char *, BOOL
)
307 IB_var g_drk_ib_vars
[] = {
308 //{var name, starting var val, flags, game callback to be called, agg callback to resolve conflicts, always NULL},
309 {"block", "0", 0, BlockProc
, NULL
, NULL
},
310 {"use_weapon", "0", 0, UseWeaponOrItemProc
, NULL
, NULL
},
311 {"use_item", "0", 0, UseWeaponOrItemProc
, NULL
, NULL
},
312 {"inv_select", "0", 0, InvSelectProc
, NULL
, NULL
},
314 {"jumpblock", "0", 0, JumpBlockProc
, NULL
, NULL
},
315 {"zoominsome", "0", 0, EyeZoomInProc
, NULL
, NULL
},
316 {"zoomoutsome", "0", 0, EyeZoomOutProc
, NULL
, NULL
},
317 {"zoomoutfull", "0", 0, EyeNoZoomProc
, NULL
, NULL
},
318 {"drunkzoom", "0", 0, EyeDrunkZoomProc
, NULL
, NULL
},
320 {"auto_equip", "0", 0, DummyProc
, NULL
, NULL
},
321 {"auto_search", "0", 0, DummyProc
, NULL
, NULL
},
322 {"goal_notify", "0", 0, DummyProc
, NULL
, NULL
},
323 {"climb_touch", "0", 0, DummyProc
, NULL
, NULL
},
330 void InitDarkIBVars ()
332 //input binding stuff
333 g_pInputBinder
->VarSet (g_drk_ib_vars
);