
This is the lowest level entry to the engine. It also maps quite
conveniently to Quake-C stuff, so check that out! This is not an
exhaustive list, but I'll hopefully be adding to it as I find out
more, and people send me in info (hint hint).
How engine functions work
Engine functions are passed by Half-Life to the dll. Pointers to
these functions can be found in g_engfuncs. They are listed
in eiface.h. Valve have nicely provided us with easy-to-use
wrappers for these functions (e.g. VEC_TO_ANGLES. They can
be found in enginecallback.h.
Engine Functions
g_engfuncs.pfnSetClientMaxspeed
void pfnSetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed);
Pass this function an edict to a client (eg a player) and a max
speed, and you've just forced his maximum movement speed. This is
used in TFC to slow down flag holders or heavy-weapons players.
g_engfuncs.pfnChangeYaw
void pfnChangeYaw(edict_t* ent);
void oldCHANGE_YAW(edict_t* ent);
This function should be called every 0.1 seconds. It causes the
given entity to turn towards its pev->ideal_yaw at a speed
specified by pev->yaw_speed. ideal_yaw is measured
in 'world' angles and yaw_speed is measured in degrees per
second (as long as the function is called every 0.1 seconds.)
See the challenge 1 solution for a
description of how to use this.
g_engfuncs.pfnChangePitch
void pfnChangePitch(edict_t* ent);
void CHANGE_PITCH(edict_t* ent);
UNTESTED This probably performs the same function as
pfnChangeYaw, except that it affects the pitch rather than the yaw.
g_engfuncs.pfnWalkMove
int pfnWalkMove(edict_t* ent, float yaw, float dist, int iMode);
int WALK_MOVE(edict_t* ent, float yaw, float dist, int iMode);
This function is used to make an entity move around as if it is
walking. This means that the engine performs the necessary
calculations to make the entity go up slopes and steps. The movetype
of the entity should be MOVETYPE_STEP. iMode can be one of the
following:
- WALKMOVE_NORMAL
- WALKMOVE_WORLDONLY (doesn't hit any entities)
- WALKMOVE_CHECKONLY (doesn't touch triggers)
ent is the entity to move, yaw is the direction in which to move it
and dist is the distance to move it. Sequences define their linear
movement values, and this can be obtained by using the SDK function
GetSequenceInfo. An easier way is to call ResetSequenceInfo which
will automatically set the member variable m_flGroundSpeed to be ten
times the value to pass in to WALK_MOVE.
See the challenge 2 solution for an example of
this function.
|