InitInput()
, and certain input related cvars are also registered there.void IN_UpDown(void) { KeyDown(&in_up); }
void IN_UpUp(void) { KeyUp(&in_up); }
The functions IN_UpDown
and IN_UpUp
are mapped to +moveup and -moveup in InitInput()
.
?
gEngfuncs.pfnAddCommand ("+moveup",IN_UpDown);
gEngfuncs.pfnAddCommand ("-moveup",IN_UpUp);
?
Thus, when the key bound to +moveup is pressed, the function IN_UpDown
( i.e., the "Up" key has been pressed down ) is called. This function, in turn, invokes the KeyDown
utility function and passes in the address of the &in_up
key structure.kbutton_t
in_mykey
;void IN_MyKeyDown(void) {KeyDown(&in_mykey);}
void IN_MyKeyUp(void) {KeyUp(&in_mykey);}
InitInput
:gEngfuncs.pfnAddCommand ("+mykey",IN_MyKeyDown);
gEngfuncs.pfnAddCommand ("-mykey",IN_MyKeyUp);
usercmd_t
structure ( see usercmd.h ).CL_CreateMove
in input.cpp . This function is the core of creating a movement for the user. The current view angles are sampled and adjusted by calling in to CL_AdjustAngles()
. The final view angles are placed into the usercmd_t
structure when the movement is complete. After the view angles are sampled, keyboard influences such as strafing and other movements are added to the movement command. The effects of the keyboard look and the speed key are factored in next. The client caps the maximum requested velocity to the current player maxspeed to avoid prediction glitches on the client. Next, the mouse and joystick are allowed to contribute to the usercmd_t
in IN_Move()
( inputw32.cpp ). Afterward, any impulse command is set and the underlying impulse flag is cleared, and the button bit fields are set.IN_Move()
, it simply calls in to IN_MouseMove()
which accumulates vertical and horizontal offsets for the mouse and converts those into angle changes or movements depending on the user's control settings. Similar sampling code exists for the joystick/controller as well, and that code can be found by tracing into IN_JoyMove()
.
CAM_Think
, which is called by the engine once per frame. The results of CAM_Think
influence the view setup functions discussed elsewhere.
You must log in to post a comment. You can login or register a new account.