- added GuessSDKVersion()
- added rendermode and renderfx prop stocks and defines - added MoveType tag to MOVETYPE defines - changed Movetype functions to MoveType to use correct SourceMod casing --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401843
This commit is contained in:
parent
e1bc3234b2
commit
c033f5415a
@ -436,6 +436,37 @@ static cell_t smn_IsPlayerAlive(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
}
|
||||
|
||||
static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
int version = g_SMAPI->GetSourceEngineBuild();
|
||||
|
||||
if (version == SOURCE_ENGINE_ORIGINAL)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
else if (version == SOURCE_ENGINE_EPISODEONE)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
else if (version == SOURCE_ENGINE_ORANGEBOX)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
#else
|
||||
if (g_HL2.IsOriginalEngine())
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(halflifeNatives)
|
||||
{
|
||||
{"CreateFakeClient", CreateFakeClient},
|
||||
@ -465,5 +496,6 @@ REGISTER_NATIVES(halflifeNatives)
|
||||
{"PrintHintText", PrintHintText},
|
||||
{"ShowVGUIPanel", ShowVGUIPanel},
|
||||
{"IsPlayerAlive", smn_IsPlayerAlive},
|
||||
{"GuessSDKVersion", GuessSDKVersion},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ FreezeClient(client, time)
|
||||
UnfreezeClient(client);
|
||||
}
|
||||
|
||||
SetEntityMovetype(client, MOVETYPE_NONE);
|
||||
SetEntityMoveType(client, MOVETYPE_NONE);
|
||||
SetEntityRenderColor(client, 0, 128, 255, 192);
|
||||
|
||||
new Float:vec[3];
|
||||
@ -81,7 +81,7 @@ UnfreezeClient(client)
|
||||
GetClientEyePosition(client, vec);
|
||||
EmitAmbientSound(SOUND_FREEZE, vec, client, SNDLEVEL_RAIDSIREN);
|
||||
|
||||
SetEntityMovetype(client, MOVETYPE_WALK);
|
||||
SetEntityMoveType(client, MOVETYPE_WALK);
|
||||
SetEntityRenderColor(client, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ public Action:Timer_Freeze(Handle:timer, any:client)
|
||||
|
||||
g_FreezeTracker[client]--;
|
||||
|
||||
SetEntityMovetype(client, MOVETYPE_NONE);
|
||||
SetEntityMoveType(client, MOVETYPE_NONE);
|
||||
SetEntityRenderColor(client, 0, 128, 255, 135);
|
||||
|
||||
new Float:vec[3];
|
||||
|
@ -38,15 +38,15 @@ SetupNoClip()
|
||||
|
||||
PerformNoClip(client, target)
|
||||
{
|
||||
new movetype = GetEntityMovetype(target);
|
||||
PrintToChatAll("movetype was %d", movetype);
|
||||
new MoveType:movetype = GetEntityMoveType(target);
|
||||
|
||||
if (movetype != MOVETYPE_NOCLIP)
|
||||
{
|
||||
SetEntityMovetype(target, MOVETYPE_NOCLIP);
|
||||
SetEntityMoveType(target, MOVETYPE_NOCLIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetEntityMovetype(target, MOVETYPE_WALK);
|
||||
SetEntityMoveType(target, MOVETYPE_WALK);
|
||||
}
|
||||
|
||||
LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
|
||||
|
@ -217,7 +217,7 @@ native GetEntData(entity, offset, size=4);
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
* @noreturn
|
||||
*/
|
||||
native SetEntData(entity, offset, value, size=4, bool:changeState=false);
|
||||
native SetEntData(entity, offset, any:value, size=4, bool:changeState=false);
|
||||
|
||||
/**
|
||||
* Peeks into an entity's object data and retrieves the float value at
|
||||
@ -414,7 +414,7 @@ stock GetEntProp(entity, PropType:type, const String:prop[], size=4)
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
* @noreturn
|
||||
*/
|
||||
stock SetEntProp(entity, PropType:type, const String:prop[], value, size=4)
|
||||
stock SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4)
|
||||
{
|
||||
new offs;
|
||||
|
||||
|
@ -35,20 +35,65 @@
|
||||
#endif
|
||||
#define _entity_prop_stocks_included
|
||||
|
||||
enum
|
||||
enum MoveType
|
||||
{
|
||||
MOVETYPE_NONE = 0, /** never moves */
|
||||
MOVETYPE_ISOMETRIC, /** For players */
|
||||
MOVETYPE_WALK, /** Player only - moving on the ground */
|
||||
MOVETYPE_STEP, /** gravity, special edge handling -- monsters use this */
|
||||
MOVETYPE_FLY, /** No gravity, but still collides with stuff */
|
||||
MOVETYPE_FLYGRAVITY, /** flies through the air + is affected by gravity */
|
||||
MOVETYPE_VPHYSICS, /** uses VPHYSICS for simulation */
|
||||
MOVETYPE_PUSH, /** no clip to world, push and crush */
|
||||
MOVETYPE_NOCLIP, /** No gravity, no collisions, still do velocity/avelocity */
|
||||
MOVETYPE_LADDER, /** Used by players only when going onto a ladder */
|
||||
MOVETYPE_OBSERVER, /** Observer movement, depends on player's observer mode */
|
||||
MOVETYPE_CUSTOM, /** Allows the entity to describe its own physics */
|
||||
MOVETYPE_NONE = 0, /**< never moves */
|
||||
MOVETYPE_ISOMETRIC, /**< For players */
|
||||
MOVETYPE_WALK, /**< Player only - moving on the ground */
|
||||
MOVETYPE_STEP, /**< gravity, special edge handling -- monsters use this */
|
||||
MOVETYPE_FLY, /**< No gravity, but still collides with stuff */
|
||||
MOVETYPE_FLYGRAVITY, /**< flies through the air + is affected by gravity */
|
||||
MOVETYPE_VPHYSICS, /**< uses VPHYSICS for simulation */
|
||||
MOVETYPE_PUSH, /**< no clip to world, push and crush */
|
||||
MOVETYPE_NOCLIP, /**< No gravity, no collisions, still do velocity/avelocity */
|
||||
MOVETYPE_LADDER, /**< Used by players only when going onto a ladder */
|
||||
MOVETYPE_OBSERVER, /**< Observer movement, depends on player's observer mode */
|
||||
MOVETYPE_CUSTOM, /**< Allows the entity to describe its own physics */
|
||||
};
|
||||
|
||||
enum RenderMode
|
||||
{
|
||||
RENDER_NORMAL, /**< src */
|
||||
RENDER_TRANSCOLOR, /**< c*a+dest*(1-a) */
|
||||
RENDER_TRANSTEXTURE, /**< src*a+dest*(1-a) */
|
||||
RENDER_GLOW, /**< src*a+dest -- No Z buffer checks -- Fixed size in screen space */
|
||||
RENDER_TRANSALPHA, /**< src*srca+dest*(1-srca) */
|
||||
RENDER_TRANSADD, /**< src*a+dest */
|
||||
RENDER_ENVIRONMENTAL, /**< not drawn, used for environmental effects */
|
||||
RENDER_TRANSADDFRAMEBLEND, /**< use a fractional frame value to blend between animation frames */
|
||||
RENDER_TRANSALPHAADD, /**< src + dest*(1-a) */
|
||||
RENDER_WORLDGLOW, /**< Same as kRenderGlow but not fixed size in screen space */
|
||||
RENDER_NONE, /**< Don't render. */
|
||||
};
|
||||
|
||||
enum RenderFx
|
||||
{
|
||||
RENDERFX_NONE = 0,
|
||||
RENDERFX_PULSE_SLOW,
|
||||
RENDERFX_PULSE_FAST,
|
||||
RENDERFX_PULSE_SLOW_WIDE,
|
||||
RENDERFX_PULSE_FAST_WIDE,
|
||||
RENDERFX_FADE_SLOW,
|
||||
RENDERFX_FADE_FAST,
|
||||
RENDERFX_SOLID_SLOW,
|
||||
RENDERFX_SOLID_FAST,
|
||||
RENDERFX_STROBE_SLOW,
|
||||
RENDERFX_STROBE_FAST,
|
||||
RENDERFX_STROBE_FASTER,
|
||||
RENDERFX_FLICKER_SLOW,
|
||||
RENDERFX_FLICKER_FAST,
|
||||
RENDERFX_NO_DISSIPATION,
|
||||
RENDERFX_DISTORT, /**< Distort/scale/translate flicker */
|
||||
RENDERFX_HOLOGRAM, /**< kRenderFxDistort + distance fade */
|
||||
RENDERFX_EXPLODE, /**< Scale up really big! */
|
||||
RENDERFX_GLOWSHELL, /**< Glowing Shell */
|
||||
RENDERFX_CLAMP_MIN_SCALE, /**< Keep this sprite from getting very small (SPRITES only!) */
|
||||
RENDERFX_ENV_RAIN, /**< for environmental rendermode, make rain */
|
||||
RENDERFX_ENV_SNOW, /**< " " " , make snow */
|
||||
RENDERFX_SPOTLIGHT, /**< TEST CODE for experimental spotlight */
|
||||
RENDERFX_RAGDOLL, /**< HACKHACK: TEST CODE for signalling death of a ragdoll character */
|
||||
RENDERFX_PULSE_FAST_WIDER,
|
||||
RENDERFX_MAX
|
||||
};
|
||||
|
||||
#define IN_ATTACK (1 << 0)
|
||||
@ -84,10 +129,10 @@ enum
|
||||
* @return Movetype, see enum above.
|
||||
* @error Invalid entity index, or lack of mod compliance.
|
||||
*/
|
||||
stock GetEntityMovetype(entity)
|
||||
stock MoveType:GetEntityMoveType(entity)
|
||||
{
|
||||
new offset = GetEntSendPropOffs(entity, "movetype");
|
||||
return GetEntData(entity, offset, 1);
|
||||
return MoveType:GetEntData(entity, offset, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,12 +143,62 @@ stock GetEntityMovetype(entity)
|
||||
* @noreturn
|
||||
* @error Invalid entity index, or lack of mod compliance.
|
||||
*/
|
||||
stock SetEntityMovetype(entity, mt)
|
||||
stock SetEntityMoveType(entity, MoveType:mt)
|
||||
{
|
||||
new offset = GetEntSendPropOffs(entity, "movetype");
|
||||
SetEntData(entity, offset, mt, 1, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an entity's render mode.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @return RenderMode value.
|
||||
* @error Invalid entity index, or lack of mod compliance.
|
||||
*/
|
||||
stock RenderMode:GetEntityRenderMode(entity)
|
||||
{
|
||||
return RenderMode:GetEntProp(entity, Prop_Send, "m_nRenderMode", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an entity's render mode.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @param mode RenderMode value.
|
||||
* @noreturn
|
||||
* @error Invalid entity index, or lack of mod compliance.
|
||||
*/
|
||||
stock SetEntityRenderMode(entity, RenderMode:mode)
|
||||
{
|
||||
SetEntProp(entity, Prop_Send, "m_nRenderMode", mode, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an entity's render Fx.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @return RenderFx value.
|
||||
* @error Invalid entity index, or lack of mod compliance.
|
||||
*/
|
||||
stock RenderFx:GetEntityRenderFx(entity)
|
||||
{
|
||||
return RenderFx:GetEntProp(entity, Prop_Send, "m_nRenderFX", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an entity's render Fx.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @param fx RenderFx value.
|
||||
* @noreturn
|
||||
* @error Invalid entity index, or lack of mod compliance.
|
||||
*/
|
||||
stock SetEntityRenderFx(entity, RenderFx:fx)
|
||||
{
|
||||
SetEntProp(entity, Prop_Send, "m_nRenderFX", fx, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an entity's color.
|
||||
*
|
||||
@ -124,6 +219,8 @@ stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
|
||||
SetEntData(entity, offset + 3, a, 1, true);
|
||||
}
|
||||
|
||||
/* GuessSDKVersion */
|
||||
|
||||
/**
|
||||
* Gets an entity's gravity.
|
||||
*
|
||||
@ -175,3 +272,14 @@ stock GetClientButtons(client)
|
||||
return GetEntProp(client, Prop_Data, "m_nButtons");
|
||||
}
|
||||
|
||||
#pragma deprecated Case change, use MoveType version
|
||||
stock SetEntityMovetype(entity, any:mt)
|
||||
{
|
||||
SetEntityMoveType(entity, MoveType:mt);
|
||||
}
|
||||
|
||||
#pragma deprecated Case change, use MoveType version
|
||||
stock GetEntityMovetype(entity)
|
||||
{
|
||||
return _:GetEntityMoveType(entity);
|
||||
}
|
||||
|
@ -35,8 +35,13 @@
|
||||
#endif
|
||||
#define _halflife_included
|
||||
|
||||
#define SOURCE_SDK_UNKNOWN 0 /**< Could not determine the engine version */
|
||||
#define SOURCE_SDK_ORIGINAL 10 /**< Original Source engine (still used by "The Ship") */
|
||||
#define SOURCE_SDK_EPISODE1 20 /**< SDK+Engine released after Episode 1 */
|
||||
#define SOURCE_SDK_EPISODE2 30 /**< Engine released after Episode 2 (no SDK yet) */
|
||||
|
||||
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */
|
||||
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */
|
||||
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */
|
||||
#define MOTDPANEL_TYPE_URL 2 /**< Treat msg as an URL link */
|
||||
#define MOTDPANEL_TYPE_FILE 3 /**< Treat msg as a filename to be openned */
|
||||
|
||||
@ -231,6 +236,17 @@ native bool:IsSoundPrecached(const String:sound[]);
|
||||
*/
|
||||
native CreateDialog(client, Handle:kv, DialogType:type);
|
||||
|
||||
/**
|
||||
* Guesses the SDK version a mod was compiled against. If nothing
|
||||
* specific is known about the game, the engine version is used instead.
|
||||
*
|
||||
* The return values are guaranteed to increase chronologically (that is,
|
||||
* a later release will have a higher value).
|
||||
*
|
||||
* @return SOURCE_SDK version code.
|
||||
*/
|
||||
native GuessSDKVersion();
|
||||
|
||||
/**
|
||||
* Prints a message to a specific client in the chat area.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user