Posted by: cct
Date posted: Nov 13 2006 User Rating: 5 out of 5.0 | Number of views: 17996 Number of comments: 0 | Description: How to enable it in HL2DM |
Hello guys. This is my very first tutorial so it might be not the best but the code works.
In HL2DM when you start with a clean sdk and you compile as release, you can´t use thirdperson view with a bit of code. I tried a HL1 tutorial and with a little modification it works.
Let´s start:
Open up your client and go to in_camera.cpp.
If you want to hardcode your distance,yaw and pitch you need to add a few defines. I hard coded mine but it also could be done with the convars.
Here are the defines:
| | #define THIRDYAW 0 #define THIRDPITCH 0 #define THIRDDIST 70 |
Then go to line 459 to function
| | void CInput::CAM_ToThirdPerson(void) |
and remove this
| | #if !defined( CSTRIKE_DLL ) #if !defined( _DEBUG )
#if defined ( TF_CLIENT_DLL ) #else if ( gpGlobals->maxClients > 1 ) { } #endif
#endif #endif |
Its easy to explain: If one of those statements become true, it will execute the code which will prevent your 3rd person cam from working.
Next Step is in line 230 inside Cam_Think(). Just remove this one:
This is just for kicking us out from 3rd person cam when we disable sv_cheats. So while we talk about sv_cheats we need to change a little thing that we dont need sv_cheats enabled to use 3rd person cam. Here we go.
Change:
| | static ConCommand thirdperson( \"thirdperson\", ::CAM_ToThirdPerson, \"Switch to thirdperson camera.\",FCVAR_CHEAT); |
to
| | static ConCommand thirdperson( \"thirdperson\", ::CAM_ToThirdPerson, \"Switch to thirdperson camera.\"); |
Its just a few more things left. Now you should have a working 3rd Person Cam. But some things are a bit annoying yet.
I.e. the distance,yaw and pitch. Thats an easy fix. In line 237 you need to change this
| | camAngles[ PITCH ] = cam_idealpitch.GetFloat(); camAngles[ YAW ] = cam_idealyaw.GetFloat(); dist = cam_idealdist.GetFloat();
|
to this
| | camAngles[ PITCH ] = THIRDYAW; camAngles[ YAW ] = THIRDPITCH; dist = THIRDDIST; |
Now the last Step and we are done. If you only want to press one key for switching between first and 3rd person you need to change following. In line 60 inside
| | void CAM_ToThirdPerson(void) |
Change it from
| | void CAM_ToThirdPerson(void) { input->CAM_ToThirdPerson(); } |
to
| | void CAM_ToThirdPerson(void) { if( ::input->CAM_IsThirdPerson()) { input->CAM_ToFirstPerson(); } else input->CAM_ToThirdPerson(); } |
A little sidenote to the defines. This is just if you wanna hardcode your values. You might prefer to change the convars instead which i wont cover in this Tutorial but its easy to figure out on your own.
So we are finished now. As i said in the beginning, this is my very first tutorial. It might not be as informable as others but the code works.
This code is made with a clean,fresh and virgin hl2dm sdk. You do this on your own Risk.
Regards cct |
|
User Comments
No User Comments
You must register to post a comment. If you have already registered, you must login.
|
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (6 guests)
|
|