Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Half-Life Source: Classes in mp.dll

created by Psk

(thing) by Psk (4.9 y) (print)   ?   (I like it!) Tue Jun 13 2000 at 2:07:02

Having started making (well, trying to make) a mod for Half-Life with a few buddies, I have decided to put my notes on the source on Everything. (I may be the wrong person to do it (me sucking so much and all) but we need more of this kind of thing)
  • CGrenade
    • Location: weapons.h
    • Surprisingly enough, this is the grenade class. Derived from CBaseMonster.
    • The member functions for the explosion (Explosion(Vector &, Vector &), Explosion(TraceResult *, int), and void EXPORT Smoke()) are modular enough to transfer to other CBaseMonsters with minor modifications.
  • CHornet
    • Location: hornet.h
    • The homing insects from the grunts and the hornetgun. Another CBasemonster.
  • Vector
  • Vector2D
    • Similar to the 3d vector(and in the same file), but with only 2 axis. According to the comments, used for pathfinding, but not used very frequently
More classes coming soon...

(thing) by Eni9m@ (7.7 y) (print)   ?   (I like it!) Fri Jun 30 2000 at 2:42:42

While working on the mod, I decided that we would need to create custom commands. Unfamiliar with the actual source I had to explore and learn it for myself. This proved to be tought. A word of advice, leave the cl_dll alone until you are familiar with it, because you won't be able to easily add commands there.

The place to look for adding you commands would be in the mp.dll, in the client.cpp file to be more specific. To add you command go to the function ClientCommand()--the line that says "void ClientCommand( edict_t *pEntity )".
Scroll down to about line #384. After the "else if", but before the last "else" put in this code:

...
else if (FStrEq(pcmd, "mycommand")) { DO STUFF HERE }
...

My understanding isnt great but I assume that the FStrEq function compares a player's command (pcmd) with one of the came commands (the second parameter) and returns a TRUE if the two are the same. The bracketed stuff is how the command is gonna reacted when it is called.

This basically adds the code for the command, the next part is optional for if you want the user to be able to change the command's binding in the Half-Life's Controls section in the Configuration Menu.
In your mod directory add a folder called "gfx" (if you don't already have one"), in that folder add another called "shell," it is in this directory where you will place 2 files which will add the control to the game's control menu.

This write-up assumes that you have SDK version 2.0, is not, get it or your mod will not work with the newer version of HL. Now in the "SDK" folder, open the "shell" and find the files "kb_act.lst" and "kb_def.lst" and move them to the shell folder in your mod directory.
Open the "kb_act.lst" file, this basically defines the description that will be used to identify the command in the Controls menu. Go to the end, or beginning, of the file and add this line: "mycommand" "Description"

where mycommand is your command's name as it appears in the source code, and the Description is the very basic description of the command. Next open the "kb_def.lst" file, this sets the default bindings for the game's commands. At the beginning of the file add this line: "key" "command"

where key is the key you want the command to be bound to by defaul, and command is the command's name as it appears in the source code.

This is just a primitive summary of how to add a command, I will hopefully add more write-ups that deal with Half-Life's source code as I figure it out.

printable version
chaos

Aimbot Action Half-Life Quake Done Quick Real Soon Now
What I hate about working on code with others Half-life Pulse Code Modulation configuration
Babylon 5 USS Hornet Everything Esoteric
Hellsing Gordon Freeman advice Travel
Folder vector code grenade
gringo
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
After stirring Everything, these nodes rose to the top:
The Wire
John Prine
Big Bird
How to tenderize an octopus
FINALLY: Morally Bankrupt but Rich on Beads (the New Orleans gathering aftermath node)
stained glass
nontheist
How to give a good PowerPoint presentation
Antietam
electrical engineering
Johannes Kepler
Maine Coon
Buying a house
New Writeups
Ctrl Y
cognitive dissonance(fiction)
SharQ
Gone Baby Gone(review)
halfWit
If I could, I'd title this "Freedom"(thing)
Roninspoon
Airline Hero(thing)
Ktistec
Why Women Are Always Cold(person)
doctor wilson
Drug policy reform(thing)
tejasa
Easy Raspberry Cheesecake(recipe)
Joysim
Drug policy reform(idea)
aneurin
Tyburn(place)
niruena
Boiling to death(idea)
artman2003
summer(thing)
doctor wilson
The Silver City and the Silent Sea(log)
Dreamvirus
The Silver City and the Silent Sea(poetry)
Aerobe
A nihilist's soulmate(poetry)
BookReader
Soup, of the green variety(recipe)
E2 is a by-product of the existence of The Everything Development Company