Third Party Mods Through Steam

leadfish

Newbie
Joined
Oct 25, 2003
Messages
336
Reaction score
0
Hey, I'm just tooling around with the hl1 source code, and just making tiny little changes, but how do I make a third party mod run through steam? The only changes I've made are to the single-player side of things, so I'm the only one who's gonna use it. I've looked around, but haven't been able to find anything of use to me. Thanks for any help you can give me :)
 
Sorry, nevermind me :( It was really late and I forgot the liblist.gam file. Oh and edit time limit ran out, so sorry for the double-post.
 
Thanks guys...I'm only new to C++ (just learnt the theory behind pointers/enum/structures/linked lists this morning), so I'm winging it based on the tiny bit of java I know :p

I do have a new query though; after adding a zoom function to the mp5 (CMP5::Zoom( void ) in mp5.cpp iirc), how do i bind the action to a key ingame? eg: bind MOUSE1 +attack for primary attack...bind MOUSEx +zoom <- how do I make it work?

For the zoom function, I basically ripped the code from the crossbow.cpp, and then prototyped the necessary function and variable in weapons.h.

Any help is greatly appreciated :thumbs:

PS: IRT hasan, thanks for those links mate. I'll read them as soon as I get a chance :)
 
I think you have to add a new console command for that .. unless you replace the secondary function with the zooming.

There is function called CLientCommand somehwhere (I think client.cpp?) it has a switch structure with whole bunch of case <command>:

I've never done this before but I'd guess you would add a new case with your own new command that zooms the MP5 (maybe check if the wepoan you are holding can zoom? I'd add a new member bool to the wepoan class "zoomability" and default it to false, make it true to the MP5)

Anyway, you can read around that site's coding tutorials.
I never really done any major coding on HL just simple silly stuff so I'm not in a position to give acurate information and/or reliable assistance.

EDIT:
hmm .. I think this is a good idea .. I'm gonna try to do it :) for practice
 
ok well, it's not a swtch .. it's a whole bunch of else if's
 
Haven't had a chance to read those sites yet because I've had a big day at TAFE, but thanks for all your help mate :) I'll test it out tonight for sure!
 
Heheh .. I did it. I added a HL2 like zoom function to the HEV Suit (codewise, I added it to the play class), it even zooms "smoothly" like HL2.

It's too easy, I did run into some troubles though.
I might write a tut about it, even thu it's not that special, but .. I sorta like it heh :D
 
Congrats mate :thumbs: I haven't had a lot of time for my effort in the last couple days, but I am in the middle of figuring out how I should do it lol. If you could even write a mini-tut just for me, that'd be awesome. I'd love any help I could get :)
 
sure, I also love to make tuts, makes me feel like I'm something special even though in reality I'm just a n00b :p

anyways, here goes:
I added two methods to the CBasePlayer class, one which toggels zooming, and one which does the zooming (one I called HevZoom, the other ZoomThink).
I also added a member int, it's used as a flag. I created an enum for 4 statuses of the zoom. It's either zoomed in, zoomed out, zooming in or zooming out.

to zoom in or out all you have to do ofcourse is change the pev->fov and the m_iFOV, maybe the m_iClientFov. I usually only mess with pev->fov and at the end of the function I equate the other two to it.

now, you'd think fov = 0 is zoomed out, nd fov = 20 is zoomed in.
The truth is, 0 isn't a value for the fov it just resets it to the default, which is 90. so for a smooth zoom you don't increment FOV from 0 -> 20, you decrement it from 90 -> 20 or any other value.

The bottom line is, 90 is unzoomed, to zoom in go below 90 (i.e. 70).

For the console command, I added the following to
Code:
ClientCommand:
	else if (FStrEq(pcmd, "zoom" ))
	{
		GetClassPtr((CBasePlayer *)pev)->HevZoom();
	}
right under
Code:
	else if (FStrEq(pcmd, "lastinv" ))
	{
		GetClassPtr((CBasePlayer *)pev)->SelectLastItem();
	}

HevZoom checks the zoom state flag, if its zoomed out or zooming out, it sets it to zooming in. if it's zooming in or zoomed in, it sets it to zoomeing out.

now, in CBasePlayer::postThink or PreThink (I don't really know the difference between the two) I add a check for the zoom state flag, and if it's zooming in or out, I call ZoomThink() which increments fov a certain value at a time or decrement it based on whether we are zooming in or out.

and ofcourse, don't forget to bind something to "zoom".

I also let HevZoom check whether or not we are wearing a suit, I took the code for that from CheckSuitUpdate. the zooming is a function of the HEV Suit and shouldn't work if we are not wearing one.


All these changes are made in the dlls workspace, but you will need some minor coding to the cl_dll
open hl_baseentity.cpp and look for CBasePlayer:: methods, add your methods somewhere there.
I don't really know what's that for, but probably the client needs to know about these functions or something.
I put:
void CBasePlayer::HevZoom() { }
void CBasePlayer::ZoomThink() { }
right above
void CBasePlayer::postThink() { }


There are a couple of problems:
try using this zoom with a python .. it gets messy. I'm playing around with it to try and fix it.

I can post the whole code for anybody who wants or something lol.
 
I'd personally add the command in input.cpp on the client rather than clientcommand. feel free to post your problems with the python, sure we could help :)
 
Back
Top