define the proper item pickup/respawn sounds for ammo/weapons
This commit is contained in:
parent
1f55c43bf3
commit
a9a3966333
33 changed files with 597 additions and 1463 deletions
2
engine.h
2
engine.h
|
@ -1,6 +1,6 @@
|
|||
#define FULLENGINENAME "Rad-Therapy II"
|
||||
#define GAME_SHORTNAME "halflife2"
|
||||
#define GAME_BASEGAMES "platform","hl2"
|
||||
#define GAME_BASEGAMES "hl2","hl2mp"
|
||||
#define GAME_PROTOCOL "FTE-RadTherapy2"
|
||||
#define GAME_DEFAULTCMDS "game_hl2;fteplug_ffmpeg;fteplug_hl2;fteplug_ode;plug_load ffmpeg;plug_load hl2;plug_load ode"
|
||||
#define GAME_DOWNLOADSURL "https://www.frag-net.com/pkgs/list"
|
||||
|
|
38
src/client/entities.qc
Normal file
38
src/client/entities.qc
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
int
|
||||
ClientGame_EntityUpdate(float id, float new)
|
||||
{
|
||||
switch (id) {
|
||||
case ENT_WEAPON:
|
||||
NSENTITY_READENTITY(HLWeapon, new)
|
||||
break;
|
||||
case ENT_PLAYER:
|
||||
#ifdef GEARBOX
|
||||
NSENTITY_READENTITY(OP4Player, new)
|
||||
#elif SCIHUNT
|
||||
NSENTITY_READENTITY(SHPlayer, new)
|
||||
#else
|
||||
NSENTITY_READENTITY(HLPlayer, new)
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
../../../valve/src/client/damage.qc
|
||||
../../../valve/src/client/init.qc
|
||||
../../../valve/src/client/flashlight.qc
|
||||
../../../valve/src/client/entities.qc
|
||||
../../../hl2/src/client/entities.qc
|
||||
../../../valve/src/client/cmds.qc
|
||||
../../../valve/src/client/game_event.qc
|
||||
../../../valve/src/client/camera.qc
|
||||
|
|
443
src/shared/HL2Player.qc
Normal file
443
src/shared/HL2Player.qc
Normal file
|
@ -0,0 +1,443 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../../../valve/src/shared/animations.h"
|
||||
|
||||
/* all custom SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
|
||||
PLAYER_BOTTOMFRAME
|
||||
};
|
||||
|
||||
class HLPlayer:NSClientPlayer
|
||||
{
|
||||
void(void) HLPlayer;
|
||||
|
||||
/* animation */
|
||||
PREDICTED_INT(anim_top)
|
||||
PREDICTED_FLOAT(anim_top_time)
|
||||
PREDICTED_FLOAT(anim_top_delay)
|
||||
PREDICTED_INT(anim_bottom)
|
||||
PREDICTED_FLOAT(anim_bottom_time)
|
||||
|
||||
virtual void Physics_Jump(void);
|
||||
virtual void UpdatePlayerAnimation(float);
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual void UpdatePlayerAttachments(bool);
|
||||
virtual void ReceiveEntity(float,float);
|
||||
virtual void PredictPreFrame(void);
|
||||
virtual void PredictPostFrame(void);
|
||||
virtual void UpdateAliveCam(void);
|
||||
virtual void ClientInputFrame(void);
|
||||
#else
|
||||
virtual void Death(entity, entity, int, vector, int);
|
||||
virtual void EvaluateEntity(void);
|
||||
virtual float SendEntity(entity, float);
|
||||
virtual void Save(float);
|
||||
virtual void Restore(string,string);
|
||||
#endif
|
||||
};
|
||||
|
||||
void Animation_PlayerTop(HLPlayer, float, float);
|
||||
void Animation_PlayerBottom(HLPlayer, float, float);
|
||||
|
||||
void
|
||||
HLPlayer::HLPlayer(void)
|
||||
{
|
||||
anim_top = 0;
|
||||
anim_top_time = 0;
|
||||
anim_top_delay = 0;
|
||||
anim_bottom = 0;
|
||||
anim_bottom_time = 0;
|
||||
}
|
||||
|
||||
void Animation_PlayerUpdate(HLPlayer);
|
||||
void Animation_TimerUpdate(HLPlayer, float);
|
||||
|
||||
void
|
||||
HLPlayer::UpdatePlayerAnimation(float timelength)
|
||||
{
|
||||
/* calculate our skeletal progression */
|
||||
//Animation_PlayerUpdate(this);
|
||||
/* advance animation timers */
|
||||
//Animation_TimerUpdate(this, timelength);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
HLPlayer::ClientInputFrame(void)
|
||||
{
|
||||
if (pSeatLocal->weaponSelectionHUD.Active()) {
|
||||
if (input_buttons & INPUT_PRIMARY) {
|
||||
pSeatLocal->weaponSelectionHUD.Trigger();
|
||||
} else if (input_buttons & INPUT_SECONDARY) {
|
||||
pSeatLocal->weaponSelectionHUD.Deactivate();
|
||||
}
|
||||
|
||||
pSeat->m_flInputBlockTime = time + 0.2;
|
||||
}
|
||||
|
||||
super::ClientInputFrame();
|
||||
}
|
||||
|
||||
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
|
||||
void Camera_StrafeRoll(__inout vector camera_angle);
|
||||
void Shake_Update(NSClientPlayer);
|
||||
|
||||
void
|
||||
HLPlayer::UpdateAliveCam(void)
|
||||
{
|
||||
vector cam_pos = GetEyePos();
|
||||
Camera_RunPosBob(view_angles, cam_pos);
|
||||
|
||||
g_view.SetCameraOrigin(cam_pos);
|
||||
Camera_StrafeRoll(view_angles);
|
||||
g_view.SetCameraAngle(view_angles);
|
||||
|
||||
if (vehicle) {
|
||||
NSVehicle veh = (NSVehicle)vehicle;
|
||||
|
||||
if (veh.UpdateView)
|
||||
veh.UpdateView();
|
||||
} else if (health) {
|
||||
if (autocvar_pm_thirdPerson == TRUE) {
|
||||
makevectors(view_angles);
|
||||
vector vStart = [pSeat->m_vecPredictedOrigin[0], pSeat->m_vecPredictedOrigin[1], pSeat->m_vecPredictedOrigin[2] + 16] + (v_right * 4);
|
||||
vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4);
|
||||
traceline(vStart, vEnd, FALSE, this);
|
||||
g_view.SetCameraOrigin(trace_endpos + (v_forward * 5));
|
||||
}
|
||||
}
|
||||
|
||||
Shake_Update(this);
|
||||
g_view.AddPunchAngle(punchangle);
|
||||
}
|
||||
|
||||
.string oldmodel;
|
||||
//string Weapons_GetPlayermodel(NSClientPlayer, int);
|
||||
|
||||
void
|
||||
HLPlayer::UpdatePlayerAttachments(bool visible)
|
||||
{
|
||||
/* draw the flashlight */
|
||||
if (gflags & GF_FLASHLIGHT) {
|
||||
vector src;
|
||||
vector ang;
|
||||
|
||||
if (entnum != player_localentnum) {
|
||||
src = origin + view_ofs;
|
||||
ang = v_angle;
|
||||
} else {
|
||||
src = pSeat->m_vecPredictedOrigin + view_ofs;
|
||||
ang = view_angles;
|
||||
}
|
||||
|
||||
makevectors(ang);
|
||||
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, this);
|
||||
|
||||
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
|
||||
dynamiclight_add(trace_endpos + (trace_plane_normal * 4), 128, [1,1,1]);
|
||||
} else {
|
||||
float p = dynamiclight_add(src, 512, [1,1,1], 0, "textures/flashlight");
|
||||
dynamiclight_set(p, LFIELD_ANGLES, ang);
|
||||
dynamiclight_set(p, LFIELD_FLAGS, 3);
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: this needs to be incorporated and simplified, now that we can handle it all in-class */
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
/* what's the current weapon model supposed to be anyway? */
|
||||
p_model.oldmodel = 0;//Weapons_GetPlayermodel(this, activeweapon);
|
||||
|
||||
/* we changed weapons, update skeletonindex */
|
||||
if (p_model.model != p_model.oldmodel) {
|
||||
/* free memory */
|
||||
if (p_model.skeletonindex)
|
||||
skel_delete(p_model.skeletonindex);
|
||||
|
||||
/* set the new model and mark us updated */
|
||||
setmodel(p_model, p_model.oldmodel);
|
||||
p_model.model = p_model.oldmodel;
|
||||
|
||||
/* set the new skeletonindex */
|
||||
p_model.skeletonindex = skel_create(p_model.modelindex);
|
||||
|
||||
/* hack this thing in here FIXME: this should be done when popping in/out of a pvs */
|
||||
if (autocvar(cl_himodels, 1, "Use high-quality thisayer models over lower-definition ones"))
|
||||
setcustomskin(this, "", "geomset 0 2\n");
|
||||
else
|
||||
setcustomskin(this, "", "geomset 0 1\n");
|
||||
}
|
||||
|
||||
/* follow thisayer at all times */
|
||||
setorigin(p_model, origin);
|
||||
p_model.angles = angles;
|
||||
skel_build(p_model.skeletonindex, p_model, p_model.modelindex,0, 0, -1);
|
||||
|
||||
/* we have to loop through all valid bones of the weapon model and match them
|
||||
* to the thisayer one */
|
||||
for (float i = 0; i < g_pbones.length; i++) {
|
||||
vector bpos;
|
||||
float pbone = gettagindex(this, g_pbones[i]);
|
||||
float wbone = gettagindex(p_model, g_pbones[i]);
|
||||
|
||||
/* if the bone doesn't ignore in either skeletal mesh, ignore */
|
||||
if (wbone <= 0 || pbone <= 0)
|
||||
continue;
|
||||
|
||||
bpos = gettaginfo(this, pbone);
|
||||
|
||||
/* the most expensive bit */
|
||||
skel_set_bone_world(p_model, wbone, bpos, v_forward, v_right, v_up);
|
||||
}
|
||||
}
|
||||
|
||||
void HUD_AmmoNotify_Check(NSClientPlayer pl);
|
||||
void HUD_ItemNotify_Check(NSClientPlayer pl);
|
||||
/*
|
||||
=================
|
||||
HLPlayer::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
HLPlayer::ReceiveEntity(float new, float flChanged)
|
||||
{
|
||||
/* the generic client attributes */
|
||||
super::ReceiveEntity(new, flChanged);
|
||||
|
||||
/* animation */
|
||||
READENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
|
||||
READENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
|
||||
READENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
|
||||
READENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
READENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
|
||||
setorigin(this, origin);
|
||||
|
||||
/* these only concern the current HLPlayer */
|
||||
CSQC_UpdateSeat();
|
||||
if (this != pSeat->m_ePlayer)
|
||||
return;
|
||||
|
||||
/* do not notify us of updates when spawning initially */
|
||||
if (flChanged == UPDATE_ALL)
|
||||
PredictPreFrame();
|
||||
|
||||
if (flChanged & PLAYER_AMMOTYPES ) {
|
||||
HUD_AmmoNotify_Check(this);
|
||||
}
|
||||
|
||||
if (flChanged & PLAYER_ITEMS || flChanged & PLAYER_HEALTH)
|
||||
HUD_ItemNotify_Check(this);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
HLPlayer::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
so we can roll them back later.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
HLPlayer::PredictPreFrame(void)
|
||||
{
|
||||
/* the generic client attributes */
|
||||
super::PredictPreFrame();
|
||||
|
||||
SAVE_STATE(anim_top)
|
||||
SAVE_STATE(anim_top_delay)
|
||||
SAVE_STATE(anim_top_time)
|
||||
SAVE_STATE(anim_bottom)
|
||||
SAVE_STATE(anim_bottom_time)
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
HLPlayer::PredictPostFrame
|
||||
|
||||
Where we roll back our values to the ones last sent/verified by the server.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
HLPlayer::PredictPostFrame(void)
|
||||
{
|
||||
/* the generic client attributes */
|
||||
super::PredictPostFrame();
|
||||
|
||||
ROLL_BACK(anim_top)
|
||||
ROLL_BACK(anim_top_delay)
|
||||
ROLL_BACK(anim_top_time)
|
||||
ROLL_BACK(anim_bottom)
|
||||
ROLL_BACK(anim_bottom_time)
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
HLPlayer::Save(float handle)
|
||||
{
|
||||
super::Save(handle);
|
||||
|
||||
SaveInt(handle, "anim_top", anim_top);
|
||||
SaveFloat(handle, "anim_top_time", anim_top_time);
|
||||
SaveFloat(handle, "anim_top_delay", anim_top_delay);
|
||||
SaveInt(handle, "anim_bottom", anim_bottom);
|
||||
SaveFloat(handle, "anim_bottom_time", anim_bottom_time);
|
||||
}
|
||||
|
||||
void
|
||||
HLPlayer::Restore(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "anim_top":
|
||||
anim_top = ReadInt(strValue);
|
||||
break;
|
||||
case "anim_top_time":
|
||||
anim_top_time = ReadFloat(strValue);
|
||||
break;
|
||||
case "anim_top_delay":
|
||||
anim_top_delay = ReadFloat(strValue);
|
||||
break;
|
||||
case "anim_bottom":
|
||||
anim_bottom = ReadInt(strValue);
|
||||
break;
|
||||
case "anim_bottom_time":
|
||||
anim_bottom_time = ReadFloat(strValue);
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLPlayer::EvaluateEntity(void)
|
||||
{
|
||||
/* the generic client attributes */
|
||||
NSClientPlayer::EvaluateEntity();
|
||||
|
||||
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
HLPlayer::Death(entity inflictor, entity attacker, int damagePoints, vector dir, int location)
|
||||
{
|
||||
/* either gib, or make a corpse */
|
||||
if (GetHealth()< -50) {
|
||||
vector gibDir = vectoangles(GetOrigin() - attacker.origin);
|
||||
float gibStrength = damagePoints * 2.0f;
|
||||
BreakModel_Entity(this, gibDir, gibStrength);
|
||||
} else {
|
||||
float deathAnimation = ANIM_DIESIMPLE;
|
||||
|
||||
switch (location) {
|
||||
case BODY_HEAD:
|
||||
deathAnimation = ANIM_DIEHEADSHOT;
|
||||
break;
|
||||
case BODY_CHEST:
|
||||
deathAnimation = ANIM_DIESPIN;
|
||||
break;
|
||||
case BODY_STOMACH:
|
||||
deathAnimation = ANIM_DIEGUTSHOT;
|
||||
break;
|
||||
default:
|
||||
bool isFacing = IsFacingPosition(GetOrigin() + (dir * 128));
|
||||
|
||||
/* we still want a change to play ANIM_DIESIMPLE */
|
||||
if (random() < 0.5)
|
||||
if (isFacing == false) {
|
||||
deathAnimation = ANIM_DIEFORWARD;
|
||||
} else {
|
||||
deathAnimation = random() < 0.5 ? ANIM_DIEBACKWARDS1 : ANIM_DIEBACKWARDS1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
NSEntity newCorpse = (NSEntity)FX_Corpse_Spawn(this, deathAnimation);
|
||||
|
||||
/* if we were crouching, adjust the bbox (thx 2 lack of crouch death animation) */
|
||||
if (IsCrouching()) {
|
||||
newCorpse.SetSize(VEC_HULL_MIN, [16, 16, -16]);
|
||||
}
|
||||
}
|
||||
|
||||
super::Death(inflictor, attacker, damagePoints, dir, location);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
HLPlayer::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
HLPlayer::SendEntity(entity ePEnt, float flChanged)
|
||||
{
|
||||
/* just-in-case. */
|
||||
if (IsPlayer() == false)
|
||||
return (0);
|
||||
|
||||
/* don't broadcast invisible HLPlayers */
|
||||
if (IsFakeSpectator() && ePEnt != this)
|
||||
return (0);
|
||||
if (!GetModelindex() && ePEnt != this)
|
||||
return (0);
|
||||
|
||||
flChanged = OptimiseChangedFlags(ePEnt, flChanged);
|
||||
|
||||
/* the generic client attributes */
|
||||
NSClientPlayer::SendEntity(ePEnt, flChanged);
|
||||
|
||||
SENDENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
|
||||
SENDENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
|
||||
SENDENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
|
||||
SENDENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
SENDENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
HLPlayer::Physics_Jump(void)
|
||||
{
|
||||
if (waterlevel >= 2) {
|
||||
if (watertype == CONTENT_WATER) {
|
||||
velocity[2] = 100;
|
||||
} else if (watertype == CONTENT_SLIME) {
|
||||
velocity[2] = 80;
|
||||
} else {
|
||||
velocity[2] = 50;
|
||||
}
|
||||
} else {
|
||||
/* Half-Life: Longjump module */
|
||||
if (IsCrouching() && HasItem("item_longjump")) {
|
||||
makevectors([0, v_angle[1], 0]);
|
||||
velocity = v_forward * 512;
|
||||
velocity[2] += 100;
|
||||
}
|
||||
if (flags & FL_ONGROUND)
|
||||
velocity[2] += 265;
|
||||
}
|
||||
}
|
|
@ -108,7 +108,6 @@ void
|
|||
HLWeapon::UpdateGUI(void)
|
||||
{
|
||||
NSClientPlayer ourOwner = __NULL__;
|
||||
vector ammoPos;
|
||||
|
||||
/* draw crosshair */
|
||||
//HLSprite_DrawCrosshair(m_crossHair);
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
../../../valve/src/shared/events.h
|
||||
../../../valve/src/shared/flags.h
|
||||
../../../valve/src/shared/skeleton.h
|
||||
../../../valve/src/shared/player.qc
|
||||
../../../valve/src/shared/fx_corpse.qc
|
||||
../../../hl2/src/shared/HL2Player.qc
|
||||
../../../valve/src/shared/animations.qc
|
||||
../../../valve/src/shared/fx_blood.qc
|
||||
../../../valve/src/shared/fx_gaussbeam.qc
|
||||
../../../valve/src/shared/fx_corpse.qc
|
||||
../../../valve/src/shared/HLGaussBeam.qc
|
||||
../../../hl2/src/shared/HL2Weapon.qc
|
||||
../../../valve/src/shared/w_tripmine.qc
|
||||
#endlist
|
||||
|
|
|
@ -1,612 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../../../valve/src/shared/skeleton.h"
|
||||
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
|
||||
PLAYER_BOTTOMFRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_FLAG,
|
||||
PLAYER_UNUSED6,
|
||||
PLAYER_UNUSED7
|
||||
};
|
||||
|
||||
class player:NSClientPlayer
|
||||
{
|
||||
/* animation */
|
||||
PREDICTED_INT(anim_top)
|
||||
PREDICTED_FLOAT(anim_top_time)
|
||||
PREDICTED_FLOAT(anim_top_delay)
|
||||
PREDICTED_INT(anim_bottom)
|
||||
PREDICTED_FLOAT(anim_bottom_time)
|
||||
|
||||
/* ammo 1 */
|
||||
PREDICTED_INT(glock_mag)
|
||||
PREDICTED_INT(mp5_mag)
|
||||
PREDICTED_INT(python_mag)
|
||||
PREDICTED_INT(shotgun_mag)
|
||||
PREDICTED_INT(crossbow_mag)
|
||||
PREDICTED_INT(rpg_mag)
|
||||
PREDICTED_INT(satchel_chg)
|
||||
|
||||
/* ammo 2 */
|
||||
PREDICTED_INT(ammo_9mm)
|
||||
PREDICTED_INT(ammo_357)
|
||||
PREDICTED_INT(ammo_buckshot)
|
||||
PREDICTED_INT(ammo_bolt)
|
||||
PREDICTED_INT(ammo_rocket)
|
||||
PREDICTED_INT(ammo_uranium)
|
||||
PREDICTED_INT(ammo_handgrenade)
|
||||
PREDICTED_INT(ammo_satchel)
|
||||
PREDICTED_INT(ammo_tripmine)
|
||||
PREDICTED_INT(ammo_snark)
|
||||
PREDICTED_INT(ammo_hornet)
|
||||
|
||||
/* ammo 3 */
|
||||
PREDICTED_INT(ammo_m203_grenade)
|
||||
PREDICTED_INT(ammo_gauss_volume)
|
||||
PREDICTED_INT(ammo_rpg_state)
|
||||
PREDICTED_INT(mode_tempstate)
|
||||
|
||||
/* gearbox */
|
||||
PREDICTED_INT(eagle_mag)
|
||||
PREDICTED_INT(sniper_mag)
|
||||
PREDICTED_INT(m249_mag)
|
||||
PREDICTED_INT(sporelauncher_mag)
|
||||
PREDICTED_INT(ammo_556)
|
||||
PREDICTED_INT(ammo_762)
|
||||
PREDICTED_INT(ammo_spore)
|
||||
PREDICTED_INT(ammo_shock)
|
||||
PREDICTED_INT(ammo_penguin)
|
||||
PREDICTED_INT(mode_displacer)
|
||||
PREDICTED_INT(mode_eagle)
|
||||
PREDICTED_INT(mode_wrench)
|
||||
PREDICTED_INT(mode_sporelauncher)
|
||||
PREDICTED_INT(mode_m249)
|
||||
|
||||
PREDICTED_FLOAT(flagmodel)
|
||||
PREDICTED_FLOAT(flagskin)
|
||||
|
||||
virtual void(void) Physics_Jump;
|
||||
virtual void UpdatePlayerAnimation(float);
|
||||
|
||||
#ifdef CLIENT
|
||||
NSRenderableEntity m_eFlag;
|
||||
virtual void UpdatePlayerAttachments(bool);
|
||||
virtual void(float,float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
virtual void UpdateAliveCam(void);
|
||||
virtual void OnRemoveEntity(void);
|
||||
#else
|
||||
entity hook;
|
||||
float m_flPickUpTime;
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
void Animation_PlayerUpdate(player);
|
||||
void Animation_TimerUpdate(player, float);
|
||||
|
||||
void
|
||||
player::UpdatePlayerAnimation(float timelength)
|
||||
{
|
||||
/* calculate our skeletal progression */
|
||||
Animation_PlayerUpdate(this);
|
||||
/* advance animation timers */
|
||||
Animation_TimerUpdate(this, timelength);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
|
||||
void Camera_StrafeRoll(__inout vector camera_angle);
|
||||
void Shake_Update(NSClientPlayer);
|
||||
|
||||
void
|
||||
player::UpdateAliveCam(void)
|
||||
{
|
||||
vector cam_pos = GetEyePos();
|
||||
Camera_RunPosBob(view_angles, cam_pos);
|
||||
|
||||
g_view.SetCameraOrigin(cam_pos);
|
||||
Camera_StrafeRoll(view_angles);
|
||||
g_view.SetCameraAngle(view_angles);
|
||||
|
||||
if (vehicle) {
|
||||
NSVehicle veh = (NSVehicle)vehicle;
|
||||
|
||||
if (veh.UpdateView)
|
||||
veh.UpdateView();
|
||||
} else if (health) {
|
||||
if (autocvar_pm_thirdPerson == TRUE) {
|
||||
makevectors(view_angles);
|
||||
vector vStart = [pSeat->m_vecPredictedOrigin[0], pSeat->m_vecPredictedOrigin[1], pSeat->m_vecPredictedOrigin[2] + 16] + (v_right * 4);
|
||||
vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4);
|
||||
traceline(vStart, vEnd, FALSE, this);
|
||||
g_view.SetCameraOrigin(trace_endpos + (v_forward * 5));
|
||||
}
|
||||
}
|
||||
|
||||
Shake_Update(this);
|
||||
g_view.AddPunchAngle(punchangle);
|
||||
}
|
||||
|
||||
.string oldmodel;
|
||||
string Weapons_GetPlayermodel(player, int);
|
||||
|
||||
void
|
||||
player::UpdatePlayerAttachments(bool visible)
|
||||
{
|
||||
if (gflags & GF_FLASHLIGHT) {
|
||||
vector src;
|
||||
vector ang;
|
||||
|
||||
if (entnum != player_localentnum) {
|
||||
src = origin + view_ofs;
|
||||
ang = v_angle;
|
||||
} else {
|
||||
src = pSeat->m_vecPredictedOrigin + view_ofs;
|
||||
ang = view_angles;
|
||||
}
|
||||
|
||||
makevectors(ang);
|
||||
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, this);
|
||||
|
||||
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
|
||||
dynamiclight_add(trace_endpos + (trace_plane_normal * 4), 128, [1,1,1]);
|
||||
} else {
|
||||
float p = dynamiclight_add(src, 512, [1,1,1], 0, "textures/flashlight");
|
||||
dynamiclight_set(p, LFIELD_ANGLES, ang);
|
||||
dynamiclight_set(p, LFIELD_FLAGS, 3);
|
||||
}
|
||||
effects |= EF_NOSHADOW;
|
||||
}
|
||||
|
||||
if (m_eFlag != world) {
|
||||
m_eFlag.SetOrigin(origin);
|
||||
m_eFlag.SetAngles([0, angles[1], 0]);
|
||||
}
|
||||
|
||||
/* FIXME: this needs to be incorporated and simplified, now that we can handle it all in-class */
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
/* what's the current weapon model supposed to be anyway? */
|
||||
p_model.oldmodel = Weapons_GetPlayermodel(this, activeweapon);
|
||||
|
||||
/* we changed weapons, update skeletonindex */
|
||||
if (p_model.model != p_model.oldmodel) {
|
||||
/* free memory */
|
||||
if (p_model.skeletonindex)
|
||||
skel_delete(p_model.skeletonindex);
|
||||
|
||||
/* set the new model and mark us updated */
|
||||
setmodel(p_model, p_model.oldmodel);
|
||||
p_model.model = p_model.oldmodel;
|
||||
|
||||
/* set the new skeletonindex */
|
||||
p_model.skeletonindex = skel_create(p_model.modelindex);
|
||||
|
||||
/* hack this thing in here FIXME: this should be done when popping in/out of a pvs */
|
||||
if (autocvar(cl_himodels, 1, "Use high-quality thisayer models over lower-definition ones"))
|
||||
setcustomskin(this, "", "geomset 0 2\n");
|
||||
else
|
||||
setcustomskin(this, "", "geomset 0 1\n");
|
||||
}
|
||||
|
||||
/* follow thisayer at all times */
|
||||
setorigin(p_model, origin);
|
||||
p_model.angles = angles;
|
||||
skel_build(p_model.skeletonindex, p_model, p_model.modelindex,0, 0, -1);
|
||||
|
||||
/* we have to loop through all valid bones of the weapon model and match them
|
||||
* to the thisayer one */
|
||||
for (float i = 0; i < g_pbones.length; i++) {
|
||||
vector bpos;
|
||||
float pbone = gettagindex(this, g_pbones[i]);
|
||||
float wbone = gettagindex(p_model, g_pbones[i]);
|
||||
|
||||
/* if the bone doesn't ignore in either skeletal mesh, ignore */
|
||||
if (wbone <= 0 || pbone <= 0)
|
||||
continue;
|
||||
|
||||
bpos = gettaginfo(this, pbone);
|
||||
|
||||
/* the most expensive bit */
|
||||
skel_set_bone_world(p_model, wbone, bpos, v_forward, v_right, v_up);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
void HUD_AmmoNotify_Check(player pl);
|
||||
void HUD_ItemNotify_Check(player pl);
|
||||
|
||||
void
|
||||
player::OnRemoveEntity(void)
|
||||
{
|
||||
super::OnRemoveEntity();
|
||||
|
||||
if (m_eFlag) {
|
||||
m_eFlag.Destroy();
|
||||
}
|
||||
}
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new, float flChanged)
|
||||
{
|
||||
/* the generic client attributes */
|
||||
NSClientPlayer::ReceiveEntity(new, flChanged);
|
||||
|
||||
/* animation */
|
||||
READENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
|
||||
READENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
|
||||
READENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
|
||||
READENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
READENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
|
||||
READENTITY_BYTE(glock_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(mp5_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(python_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(shotgun_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(crossbow_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(rpg_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(satchel_chg, PLAYER_AMMO1)
|
||||
|
||||
READENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_357, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_bolt, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_rocket, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_uranium, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_handgrenade, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_satchel, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_tripmine, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_snark, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_hornet, PLAYER_AMMO2)
|
||||
|
||||
READENTITY_BYTE(ammo_m203_grenade, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(ammo_gauss_volume, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
|
||||
|
||||
/* gearbox */
|
||||
READENTITY_BYTE(eagle_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(sniper_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(m249_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(sporelauncher_mag, PLAYER_AMMO1)
|
||||
|
||||
READENTITY_BYTE(ammo_556, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_762, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_spore, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_shock, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_penguin, PLAYER_AMMO2)
|
||||
|
||||
READENTITY_BYTE(mode_displacer, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_eagle, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_wrench, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_sporelauncher, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_m249, PLAYER_AMMO3)
|
||||
|
||||
READENTITY_FLOAT(flagmodel, PLAYER_FLAG)
|
||||
READENTITY_BYTE(flagskin, PLAYER_FLAG)
|
||||
|
||||
setorigin(this, origin);
|
||||
|
||||
/* add/remove flag model */
|
||||
if (flagmodel != 0) {
|
||||
if (!m_eFlag)
|
||||
m_eFlag = spawn(NSRenderableEntity);
|
||||
|
||||
m_eFlag.SetModelindex(flagmodel);
|
||||
m_eFlag.SetSkin(flagskin);
|
||||
m_eFlag.SetFrame(2);
|
||||
} else if (m_eFlag) {
|
||||
m_eFlag.Destroy();
|
||||
remove(m_eFlag);
|
||||
m_eFlag = 0;
|
||||
}
|
||||
|
||||
/* these only concern the current player */
|
||||
CSQC_UpdateSeat();
|
||||
if (this != pSeat->m_ePlayer)
|
||||
return;
|
||||
|
||||
/* do not notify us of updates when spawning initially */
|
||||
if (flChanged == UPDATE_ALL)
|
||||
PredictPreFrame();
|
||||
|
||||
if (flChanged & PLAYER_AMMO1 || flChanged & PLAYER_AMMO2 || flChanged & PLAYER_AMMO3) {
|
||||
Weapons_AmmoUpdate(this);
|
||||
HUD_AmmoNotify_Check(this);
|
||||
}
|
||||
|
||||
if (flChanged & PLAYER_ITEMS || flChanged & PLAYER_HEALTH)
|
||||
HUD_ItemNotify_Check(this);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
so we can roll them back later.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPreFrame(void)
|
||||
{
|
||||
NSClientPlayer::PredictPreFrame();
|
||||
|
||||
SAVE_STATE(anim_top)
|
||||
SAVE_STATE(anim_top_delay)
|
||||
SAVE_STATE(anim_top_time)
|
||||
SAVE_STATE(anim_bottom)
|
||||
SAVE_STATE(anim_bottom_time)
|
||||
|
||||
SAVE_STATE(glock_mag)
|
||||
SAVE_STATE(mp5_mag)
|
||||
SAVE_STATE(python_mag)
|
||||
SAVE_STATE(shotgun_mag)
|
||||
SAVE_STATE(crossbow_mag)
|
||||
SAVE_STATE(rpg_mag)
|
||||
SAVE_STATE(satchel_chg)
|
||||
|
||||
SAVE_STATE(ammo_9mm)
|
||||
SAVE_STATE(ammo_357)
|
||||
SAVE_STATE(ammo_buckshot)
|
||||
SAVE_STATE(ammo_bolt)
|
||||
SAVE_STATE(ammo_rocket)
|
||||
SAVE_STATE(ammo_uranium)
|
||||
SAVE_STATE(ammo_handgrenade)
|
||||
SAVE_STATE(ammo_satchel)
|
||||
SAVE_STATE(ammo_tripmine)
|
||||
SAVE_STATE(ammo_snark)
|
||||
SAVE_STATE(ammo_hornet)
|
||||
|
||||
SAVE_STATE(ammo_m203_grenade)
|
||||
SAVE_STATE(ammo_gauss_volume)
|
||||
SAVE_STATE(ammo_rpg_state)
|
||||
SAVE_STATE(mode_tempstate)
|
||||
|
||||
/* gearbox */
|
||||
SAVE_STATE(eagle_mag)
|
||||
SAVE_STATE(sniper_mag)
|
||||
SAVE_STATE(m249_mag)
|
||||
SAVE_STATE(sporelauncher_mag)
|
||||
SAVE_STATE(ammo_556)
|
||||
SAVE_STATE(ammo_762)
|
||||
SAVE_STATE(ammo_spore)
|
||||
SAVE_STATE(ammo_shock)
|
||||
SAVE_STATE(ammo_penguin)
|
||||
SAVE_STATE(mode_displacer)
|
||||
SAVE_STATE(mode_eagle)
|
||||
SAVE_STATE(mode_wrench)
|
||||
SAVE_STATE(mode_sporelauncher)
|
||||
SAVE_STATE(mode_m249)
|
||||
SAVE_STATE(flagmodel)
|
||||
SAVE_STATE(flagskin)
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Where we roll back our values to the ones last sent/verified by the server.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPostFrame(void)
|
||||
{
|
||||
NSClientPlayer::PredictPostFrame();
|
||||
|
||||
ROLL_BACK(anim_top)
|
||||
ROLL_BACK(anim_top_delay)
|
||||
ROLL_BACK(anim_top_time)
|
||||
ROLL_BACK(anim_bottom)
|
||||
ROLL_BACK(anim_bottom_time)
|
||||
|
||||
ROLL_BACK(glock_mag)
|
||||
ROLL_BACK(mp5_mag)
|
||||
ROLL_BACK(python_mag)
|
||||
ROLL_BACK(shotgun_mag)
|
||||
ROLL_BACK(crossbow_mag)
|
||||
ROLL_BACK(rpg_mag)
|
||||
ROLL_BACK(satchel_chg)
|
||||
|
||||
ROLL_BACK(ammo_9mm)
|
||||
ROLL_BACK(ammo_357)
|
||||
ROLL_BACK(ammo_buckshot)
|
||||
ROLL_BACK(ammo_bolt)
|
||||
ROLL_BACK(ammo_rocket)
|
||||
ROLL_BACK(ammo_uranium)
|
||||
ROLL_BACK(ammo_handgrenade)
|
||||
ROLL_BACK(ammo_satchel)
|
||||
ROLL_BACK(ammo_tripmine)
|
||||
ROLL_BACK(ammo_snark)
|
||||
ROLL_BACK(ammo_hornet)
|
||||
|
||||
ROLL_BACK(ammo_m203_grenade)
|
||||
ROLL_BACK(ammo_gauss_volume)
|
||||
ROLL_BACK(ammo_rpg_state)
|
||||
ROLL_BACK(mode_tempstate)
|
||||
|
||||
/* gearbox */
|
||||
ROLL_BACK(eagle_mag)
|
||||
ROLL_BACK(sniper_mag)
|
||||
ROLL_BACK(m249_mag)
|
||||
ROLL_BACK(sporelauncher_mag)
|
||||
ROLL_BACK(ammo_556)
|
||||
ROLL_BACK(ammo_762)
|
||||
ROLL_BACK(ammo_spore)
|
||||
ROLL_BACK(ammo_shock)
|
||||
ROLL_BACK(ammo_penguin)
|
||||
ROLL_BACK(mode_displacer)
|
||||
ROLL_BACK(mode_eagle)
|
||||
ROLL_BACK(mode_wrench)
|
||||
ROLL_BACK(mode_sporelauncher)
|
||||
ROLL_BACK(mode_m249)
|
||||
ROLL_BACK(flagmodel)
|
||||
ROLL_BACK(flagskin)
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
player::EvaluateEntity(void)
|
||||
{
|
||||
/* the generic client attributes */
|
||||
NSClientPlayer::EvaluateEntity();
|
||||
|
||||
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
|
||||
EVALUATE_FIELD(glock_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(mp5_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(python_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(shotgun_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(crossbow_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(rpg_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(satchel_chg, PLAYER_AMMO1)
|
||||
|
||||
EVALUATE_FIELD(ammo_9mm, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_357, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_buckshot, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_bolt, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_rocket, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_uranium, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_handgrenade, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_satchel, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_tripmine, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_snark, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_hornet, PLAYER_AMMO2)
|
||||
|
||||
EVALUATE_FIELD(ammo_m203_grenade, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(ammo_gauss_volume, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(ammo_rpg_state, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_tempstate, PLAYER_AMMO3)
|
||||
|
||||
/* gearbox */
|
||||
EVALUATE_FIELD(eagle_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(sniper_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(m249_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(sporelauncher_mag, PLAYER_AMMO1)
|
||||
|
||||
EVALUATE_FIELD(ammo_556, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_762, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_spore, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_shock, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_penguin, PLAYER_AMMO2)
|
||||
|
||||
EVALUATE_FIELD(mode_displacer, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_eagle, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_wrench, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_sporelauncher, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_m249, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(flagmodel, PLAYER_FLAG)
|
||||
EVALUATE_FIELD(flagskin, PLAYER_FLAG)
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float flChanged)
|
||||
{
|
||||
/* don't broadcast invisible players */
|
||||
if (IsFakeSpectator() && ePEnt != this)
|
||||
return (0);
|
||||
if (!GetModelindex() && ePEnt != this)
|
||||
return (0);
|
||||
|
||||
flChanged = OptimiseChangedFlags(ePEnt, flChanged);
|
||||
|
||||
WriteByte(MSG_ENTITY, ENT_PLAYER);
|
||||
WriteFloat(MSG_ENTITY, flChanged);
|
||||
|
||||
/* the generic client attributes */
|
||||
NSClientPlayer::SendEntity(ePEnt, flChanged);
|
||||
|
||||
SENDENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
|
||||
SENDENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
|
||||
SENDENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
|
||||
SENDENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
SENDENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
|
||||
SENDENTITY_BYTE(glock_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(mp5_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(python_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(shotgun_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(crossbow_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(rpg_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(satchel_chg, PLAYER_AMMO1)
|
||||
|
||||
SENDENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_357, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_bolt, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_rocket, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_uranium, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_handgrenade, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_satchel, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_tripmine, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_snark, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_hornet, PLAYER_AMMO2)
|
||||
|
||||
SENDENTITY_BYTE(ammo_m203_grenade, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(ammo_gauss_volume, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
|
||||
|
||||
/* gearbox */
|
||||
SENDENTITY_BYTE(eagle_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(sniper_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(m249_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(sporelauncher_mag, PLAYER_AMMO1)
|
||||
|
||||
SENDENTITY_BYTE(ammo_556, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_762, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_spore, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_shock, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_penguin, PLAYER_AMMO2)
|
||||
|
||||
SENDENTITY_BYTE(mode_displacer, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_eagle, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_wrench, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_sporelauncher, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_m249, PLAYER_AMMO3)
|
||||
SENDENTITY_FLOAT(flagmodel, PLAYER_FLAG)
|
||||
SENDENTITY_BYTE(flagskin, PLAYER_FLAG)
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -145,8 +145,8 @@ set sp_decals "128"
|
|||
set sv_friendlyFire "0" // Team-inflicted damage is possible when set.
|
||||
set sv_levelexec "1" // Will search and execute `<gamedir>/maps/currentmap.cfg` when set.
|
||||
set sv_plugins "1" // Enable the use of server-side plugins when set.
|
||||
|
||||
set vehicle_developer "0" // Shows vehicle related debug prints when set.
|
||||
set sv_gameplayfix_setmodelsize_qw "1"
|
||||
|
||||
set vgui_color "255 170 0"
// Default primary color for VGUI widgets.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
entityDef ammo_base
|
||||
{
|
||||
"spawnclass" "NSItem"
|
||||
"snd_acquire" "ammo.pickup"
|
||||
"snd_respawn" "ammo.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
"mins" "-16 -16 0"
|
||||
"maxs" "16 16 16"
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
entityDef item_ammo_ar2
|
||||
{
|
||||
"inherit" "ammo_base"
|
||||
"model" "models/items/BoxBRounds.mdl"
|
||||
"model" "models/items/combine_rifle_cartridge01.mdl"
|
||||
"inv_ammo_ar2" "skill:item_ar2"
|
||||
}
|
||||
|
||||
entityDef item_ammo_ar2_large
|
||||
{
|
||||
"inherit" "ammo_base"
|
||||
"model" "models/items/LargeBoxBRounds.mdl"
|
||||
"model" "models/items/combine_rifle_cartridge01.mdl"
|
||||
"inv_ammo_ar2" "skill:item_ar2_large"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
entityDef item_box_buckshot
|
||||
{
|
||||
"inherit" "ammo_base"
|
||||
"model" "models/items/BoxBRounds.mdl"
|
||||
"model" "models/items/boxbuckshot.mdl"
|
||||
"inv_ammo_buckshot" "skill:item_buckshot"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
entityDef item_rpg_round
|
||||
{
|
||||
"inherit" "ammo_base"
|
||||
"model" "models/items/w_missile_closed.mdl"
|
||||
"model" "models/weapons/w_missile_closed.mdl"
|
||||
"inv_ammo_rpg" "skill:item_rpg"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_357
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_357.mdl"
|
||||
"model_view" "models/weapons/v_357.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_357"
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_alyxgun
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/W_Alyx_Gun.mdl"
|
||||
"model_view" "models/weapons/v_pistol.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_pistol"
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_annabelle
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_annabelle.mdl"
|
||||
"model_view" "models/weapons/v_shotgun.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_annebelle"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_ar2
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Pulse_Rifle"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Pulse_Rifle"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_irifle.mdl"
|
||||
"model_view" "models/weapons/v_irifle.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_ar2"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_bugbait
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Bugbait"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/w_bugbait.mdl"
|
||||
"model_view" "models/v_bugbait.mdl"
|
||||
"snd_acquire" "dmc_weapon.pickup"
|
||||
"snd_respawn" "dmc_item.respawn"
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Bugbait"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/w_bugbait.mdl"
|
||||
"model_view" "models/v_bugbait.mdl"
|
||||
"snd_acquire" "dmc_HL2Player.PickupWeapon"
|
||||
"snd_respawn" "dmc_Item.Materialize"
|
||||
"spin" "1"
|
||||
|
||||
// weapon specific
|
||||
|
@ -67,11 +67,11 @@ entityDef projectile_bugbait
|
|||
"decal_detonate" "ExplosionScorch"
|
||||
"model_detonate" "fx_explosion.main"
|
||||
|
||||
"explode_light_color" "2 1.6 0.8"
|
||||
"explode_light_radius" "320"
|
||||
"explode_light_fadetime" "0.5"
|
||||
"explode_light_color" "2 1.6 0.8"
|
||||
"explode_light_radius" "320"
|
||||
"explode_light_fadetime" "0.5"
|
||||
|
||||
"snd_explode" "weapon_grenadelauncher.explode"
|
||||
"snd_explode" "weapon_grenadelauncher.explode"
|
||||
"snd_bounce" "weapon_grenadelauncher.bounce"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,15 +8,17 @@ entityDef weapon_crossbow
|
|||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_crossbow.mdl"
|
||||
"model_view" "models/weapons/v_crossbow.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"model_view" "models/weapons/v_crossbow_dx7.mdl"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_crossbow"
|
||||
"inv_name" "#HL2_Crossbow"
|
||||
"inv_ammo_crossbow" "4"
|
||||
"clipSize" "1"
|
||||
"ammoType" "ammo_crossbow"
|
||||
"ammoRequired" "1"
|
||||
|
||||
"actFire" "3"
|
||||
"actFireLast" "6"
|
||||
|
@ -39,8 +41,6 @@ entityDef weapon_crossbow
|
|||
entityDef fireInfo_crossbow
|
||||
{
|
||||
"def_onFire" "projectile_bolt"
|
||||
"ammoType" "ammo_crossbow"
|
||||
"ammoRequired" "1"
|
||||
"ammoPerShot" "1"
|
||||
"punchAngle" "-2 0 0"
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_crowbar
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"model_view" "models/weapons/v_crowbar.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_melee" "damage_crowbar"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_frag
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Grenade"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_Grenade"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/items/grenadeAmmo.mdl"
|
||||
"model_view" "models/weapons/v_grenade.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
"inv_name" "#HL2_Grenade"
|
||||
"inv_weapon" "weapon_frag"
|
||||
|
@ -47,11 +47,11 @@ entityDef projectile_grenade
|
|||
"bounce" "1"
|
||||
"angular_velocity" "-350 0 0"
|
||||
"model_detonate" "fx_explosion.main"
|
||||
"snd_explode" "BaseGrenade.Explode"
|
||||
"snd_explode" "BaseGrenade.Explode"
|
||||
"snd_bounce" "WeaponFrag.Roll"
|
||||
|
||||
"def_damage" "damage_grenadeDirect"
|
||||
"def_splash_damage" "damage_grenadeSplash"
|
||||
"def_damage" "damage_grenadeDirect"
|
||||
"def_splash_damage" "damage_grenadeSplash"
|
||||
}
|
||||
|
||||
entityDef damage_grenadeDirect
|
||||
|
@ -63,4 +63,4 @@ entityDef damage_grenadeSplash
|
|||
{
|
||||
"damage" "skill:plr_dmg_grenade"
|
||||
"radius" "250"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_physcannon
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_physcannon.mdl"
|
||||
"model_view" "models/weapons/v_physcannon.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_physcannon"
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_pistol
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_pistol.mdl"
|
||||
"model_view" "models/weapons/v_pistol.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_pistol"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_rpg
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_RPG"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_RPG"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_rocket_launcher.mdl"
|
||||
"model" "models/weapons/w_rocket_launcher.mdl"
|
||||
"model_view" "models/weapons/v_rpg.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
"inv_name" "#HL2_RPG"
|
||||
"def_fireInfo" "fireInfo_rpg"
|
||||
|
@ -38,8 +38,8 @@ entityDef projectile_rocket
|
|||
"spawnclass" "NSProjectile"
|
||||
"model" "models/weapons/w_missile_launch.mdl"
|
||||
|
||||
"def_damage" "damage_rocketDirect"
|
||||
"def_splash_damage" "damage_rocketSplash"
|
||||
"def_damage" "damage_rocketDirect"
|
||||
"def_splash_damage" "damage_rocketSplash"
|
||||
|
||||
"health" "0"
|
||||
"velocity" "250"
|
||||
|
@ -57,15 +57,15 @@ entityDef projectile_rocket
|
|||
|
||||
"smoke_fly" "weapon_rpg.trail"
|
||||
"model_detonate" "fx_explosion.main"
|
||||
"light_color" "1 0.8 0.4"
|
||||
"light_radius" "160"
|
||||
"light_offset" "0 0 0"
|
||||
|
||||
"explode_light_color" "2 1.6 0.8"
|
||||
"explode_light_radius" "320"
|
||||
"explode_light_fadetime" "0.5"
|
||||
"light_color" "1 0.8 0.4"
|
||||
"light_radius" "160"
|
||||
"light_offset" "0 0 0"
|
||||
|
||||
"snd_explode" "fx.explosion"
|
||||
"explode_light_color" "2 1.6 0.8"
|
||||
"explode_light_radius" "320"
|
||||
"explode_light_fadetime" "0.5"
|
||||
|
||||
"snd_explode" "fx.explosion"
|
||||
}
|
||||
|
||||
entityDef projectile_rocket_homing
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_shotgun
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_shotgun.mdl"
|
||||
"model_view" "models/weapons/v_shotgun.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_shotgun"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_slam
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_SLAM"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_SLAM"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_slam.mdl"
|
||||
"model_view" "models/weapons/v_slam.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
"inv_name" "#HL2_SLAM"
|
||||
"ammoType" "ammo_slam"
|
||||
|
@ -54,9 +54,9 @@ entityDef projectile_slam
|
|||
"snd_bounce" "BaseGrenade.BounceSound"
|
||||
"inherit_velocity" "1"
|
||||
|
||||
"def_splash_damage" "damage_satchelExplosion"
|
||||
"def_splash_damage" "damage_satchelExplosion"
|
||||
"model_detonate" "fx_explosion.main"
|
||||
"snd_explode" "BaseGrenade.Explode"
|
||||
"snd_explode" "BaseGrenade.Explode"
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,4 +64,4 @@ entityDef damage_satchelExplosion
|
|||
{
|
||||
"damage" "skill:plr_dmg_satchel"
|
||||
"radius" "skill:satchel_radius"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ entityDef weapon_smg1
|
|||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_smg1.mdl"
|
||||
"model_view" "models/weapons/v_smg1.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_fireInfo" "fireInfo_smg1"
|
||||
|
@ -45,11 +45,11 @@ entityDef projectile_ARgrenade
|
|||
"detonate_on_death" "1"
|
||||
"detonate_on_world" "1"
|
||||
"detonate_on_actor" "1"
|
||||
"snd_explode" "BaseExplosionEffect.Sound"
|
||||
"snd_explode" "BaseExplosionEffect.Sound"
|
||||
"model_detonate" "fx_explosion.main"
|
||||
|
||||
"def_damage" "damage_ARgrneadeDirect"
|
||||
"def_splash_damage" "damage_ARgrneadeSplash"
|
||||
"def_damage" "damage_ARgrneadeDirect"
|
||||
"def_splash_damage" "damage_ARgrneadeSplash"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
entityDef weapon_stunstick
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_StunBaton"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "#HL2_StunBaton"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "HLWeapon"
|
||||
"model" "models/weapons/w_stunbaton.mdl"
|
||||
"model_view" "models/weapons/v_stunbaton.mdl"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
"snd_acquire" "HL2Player.PickupWeapon"
|
||||
"snd_respawn" "Item.Materialize"
|
||||
|
||||
// weapon specific
|
||||
"def_melee" "damage_stunstick"
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu LIGHTSTYLED
|
||||
!!permu REFLECTCUBEMASK
|
||||
!!samps diffuse
|
||||
|
||||
!!samps lightmap
|
||||
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
|
||||
|
||||
!!samps =BUMP normalmap
|
||||
|
||||
// envmaps only
|
||||
!!samps =REFLECTCUBEMASK reflectmask reflectcube
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
|
||||
varying vec2 lm0;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
invsurface = mat3(v_svector, v_tvector, v_normal);
|
||||
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
#include "sys/pcf.h"
|
||||
#endif
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
#define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb
|
||||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
|
||||
/* the light we're getting is always too bright */
|
||||
lightmaps *= 0.75;
|
||||
|
||||
/* clamp at 1.5 */
|
||||
if (lightmaps.r > 1.5)
|
||||
lightmaps.r = 1.5;
|
||||
if (lightmaps.g > 1.5)
|
||||
lightmaps.g = 1.5;
|
||||
if (lightmaps.b > 1.5)
|
||||
lightmaps.b = 1.5;
|
||||
|
||||
return lightmaps;
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 diffuse_f;
|
||||
vec3 light = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
|
||||
#ifdef MASKLT
|
||||
if (diffuse_f.a < float(MASK))
|
||||
discard;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
/* deluxemapping isn't working on Source BSP yet */
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
/* We currently only use the normal/bumpmap for cubemap warping. move this block out once we do proper radiosity normalmapping */
|
||||
#ifdef BUMP
|
||||
/* Source's normalmaps are in the DX format where the green channel is flipped */
|
||||
vec4 normal_f = texture2D(s_normalmap, tex_c);
|
||||
normal_f.g *= -1.0;
|
||||
normal_f.rgb = normalize(normal_f.rgb - 0.5);
|
||||
#else
|
||||
vec4 normal_f = vec4(0.0,0.0,1.0,0.0);
|
||||
#endif
|
||||
|
||||
#if defined(ENVFROMMASK)
|
||||
/* We have a dedicated reflectmask */
|
||||
#define refl texture2D(s_reflectmask, tex_c).r
|
||||
#else
|
||||
/* when ENVFROMBASE is set or a normal isn't present, we're getting the reflectivity info from the diffusemap's alpha channel */
|
||||
#if defined(ENVFROMBASE) || !defined(BUMP)
|
||||
#define refl 1.0 - diffuse_f.a
|
||||
#else
|
||||
#define refl normal_f.a * 0.5
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diffuse_f.rgb += (textureCube(s_reflectcube, cube_c).rgb * vec3(refl,refl,refl));
|
||||
#endif
|
||||
|
||||
light += (e_light_mul * lambert(norm, e_light_dir)) * 2.0;
|
||||
light += (e_light_ambient * lambert(norm, reflect(norm, e_light_dir))) * 0.5;
|
||||
light += (e_light_mul * dot(normal_f, e_light_dir));
|
||||
|
||||
diffuse_f.rgb *= light;
|
||||
|
||||
gl_FragColor = fog4(diffuse_f);
|
||||
}
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
!!ver 110
|
||||
!!samps diffuse
|
||||
!!samps =BUMP normalmap
|
||||
!!samps =REFLECTCUBEMASK reflectmask reflectcube
|
||||
!!samps refraction=0
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying mat3 invsurface;
|
||||
varying vec4 tf_c;
|
||||
varying vec3 eyeminusvertex;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
invsurface[0] = v_svector;
|
||||
invsurface[1] = v_tvector;
|
||||
invsurface[2] = v_normal;
|
||||
tf_c = ftetransform();
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = tf_c;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
void main ( void )
|
||||
{
|
||||
vec2 refl_c;
|
||||
vec3 refr_f;
|
||||
vec3 norm_f;
|
||||
vec4 out_f = vec4( 1.0, 1.0, 1.0, 1.0 );
|
||||
|
||||
norm_f = ( texture2D( s_normalmap, tex_c).xyz);
|
||||
norm_f.g *= -1.0;
|
||||
norm_f = normalize( norm_f );
|
||||
|
||||
// Reflection/View coordinates
|
||||
refl_c = ( 1.0 + ( tf_c.xy / tf_c.w ) ) * 0.5;
|
||||
|
||||
refr_f = texture2D(s_refraction, refl_c + (norm_f.st) ).rgb;
|
||||
out_f.rgb = refr_f * texture2D(s_diffuse, tex_c).rgb;
|
||||
|
||||
gl_FragColor = out_f;
|
||||
}
|
||||
#endif
|
|
@ -1,160 +0,0 @@
|
|||
!!ver 110
|
||||
!!permu FOG
|
||||
!!permu BUMP
|
||||
!!permu LIGHTSTYLED
|
||||
!!permu REFLECTCUBEMASK
|
||||
!!permu UPPERLOWER
|
||||
!!samps diffuse upper
|
||||
|
||||
!!samps lightmap
|
||||
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
|
||||
|
||||
!!samps =BUMP normalmap
|
||||
|
||||
// envmaps only
|
||||
!!samps =REFLECTCUBEMASK reflectmask reflectcube
|
||||
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec4 vex_color;
|
||||
|
||||
varying vec2 lm0;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
varying vec2 lm1, lm2, lm3;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void lightmapped_init(void)
|
||||
{
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
lightmapped_init();
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
vex_color = v_colour;
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
invsurface = mat3(v_svector, v_tvector, v_normal);
|
||||
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
#include "sys/pcf.h"
|
||||
#endif
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
#define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb
|
||||
#define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb
|
||||
#define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb
|
||||
#define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb
|
||||
#else
|
||||
#define LIGHTMAP texture2D(s_lightmap, lm0).rgb
|
||||
#endif
|
||||
|
||||
vec3 lightmap_fragment()
|
||||
{
|
||||
vec3 lightmaps;
|
||||
|
||||
#ifdef LIGHTSTYLED
|
||||
lightmaps = LIGHTMAP0 * e_lmscale[0].rgb;
|
||||
lightmaps += LIGHTMAP1 * e_lmscale[1].rgb;
|
||||
lightmaps += LIGHTMAP2 * e_lmscale[2].rgb;
|
||||
lightmaps += LIGHTMAP3 * e_lmscale[3].rgb;
|
||||
#else
|
||||
lightmaps = LIGHTMAP * e_lmscale.rgb;
|
||||
#endif
|
||||
|
||||
/* the light we're getting is always too bright */
|
||||
lightmaps *= 0.75;
|
||||
|
||||
/* clamp at 1.5 */
|
||||
if (lightmaps.r > 1.5)
|
||||
lightmaps.r = 1.5;
|
||||
if (lightmaps.g > 1.5)
|
||||
lightmaps.g = 1.5;
|
||||
if (lightmaps.b > 1.5)
|
||||
lightmaps.b = 1.5;
|
||||
|
||||
return lightmaps;
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 diffuse_f;
|
||||
diffuse_f.rgb = mix(texture2D(s_diffuse, tex_c).rgb, texture2D(s_upper, tex_c).rgb, vex_color.a);
|
||||
diffuse_f.a = 1.0;
|
||||
|
||||
/* deluxemapping isn't working on Source BSP yet, FIXME */
|
||||
diffuse_f.rgb *= lightmap_fragment();
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
/* We currently only use the normal/bumpmap for cubemap warping. move this block out once we do proper radiosity normalmapping */
|
||||
#ifdef BUMP
|
||||
/* Source's normalmaps are in the DX format where the green channel is flipped */
|
||||
vec4 normal_f = texture2D(s_normalmap, tex_c);
|
||||
normal_f.g *= -1.0;
|
||||
normal_f.rgb = normalize(normal_f.rgb - 0.5);
|
||||
#else
|
||||
vec4 normal_f = vec4(0.0,0.0,1.0,0.0);
|
||||
#endif
|
||||
|
||||
/* when ENVFROMBASE is set or a normal isn't present, we're getting the reflectivity info from the diffusemap's alpha channel */
|
||||
#if defined(ENVFROMBASE) || !defined(BUMP)
|
||||
/* since we're sampling from the diffuse = 1.0 fully visible, 0.0 = fully reflective */
|
||||
#define refl 1.0 - diffuse_f.a
|
||||
#else
|
||||
#define refl normal_f.a * 0.5
|
||||
#endif
|
||||
|
||||
vec3 cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diffuse_f.rgb += (textureCube(s_reflectcube, cube_c).rgb * vec3(refl,refl,refl));
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(diffuse_f);
|
||||
}
|
||||
#endif
|
|
@ -1,30 +0,0 @@
|
|||
!!ver 110
|
||||
!!permu FOG
|
||||
!!samps diffuse
|
||||
|
||||
#include "sys/defs.h"
|
||||
#include "sys/fog.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
vec4 diffuse_f = texture2D( s_diffuse, tex_c );
|
||||
|
||||
#ifdef MASKLT
|
||||
if (diffuse_f.a < float(MASK))
|
||||
discard;
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4( diffuse_f );
|
||||
}
|
||||
#endif
|
|
@ -1,140 +0,0 @@
|
|||
!!ver 110
|
||||
!!permu FRAMEBLEND
|
||||
!!permu BUMP
|
||||
!!permu FOG
|
||||
!!permu SKELETAL
|
||||
!!permu AMBIENTCUBE
|
||||
!!samps diffuse fullbright normalmap
|
||||
!!permu FAKESHADOWS
|
||||
!!cvardf r_glsl_pcf
|
||||
!!samps =FAKESHADOWS shadowmap
|
||||
|
||||
// envmaps only
|
||||
!!samps =REFLECTCUBEMASK reflectmask reflectcube
|
||||
|
||||
!!cvardf r_skipDiffuse
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 norm;
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
varying vec3 eyevector;
|
||||
varying mat3 invsurface;
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
varying vec4 vtexprojcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
tex_c = v_texcoord;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
norm = n;
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
invsurface = mat3(v_svector, v_tvector, v_normal);
|
||||
|
||||
vec3 eyeminusvertex = e_eyepos - v_position.xyz;
|
||||
eyevector.x = dot(eyeminusvertex, v_svector.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, v_tvector.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, v_normal.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
#include "sys/pcf.h"
|
||||
|
||||
float lambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return max(dot(normal, dir), 0.0);
|
||||
}
|
||||
|
||||
float halflambert(vec3 normal, vec3 dir)
|
||||
{
|
||||
return (lambert(normal, dir) * 0.5) + 0.5;
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
vec3 light;
|
||||
|
||||
#ifdef MASKLT
|
||||
if (diffuse_f.a < float(MASK))
|
||||
discard;
|
||||
#endif
|
||||
|
||||
/* Normal/Bumpmap Shenanigans */
|
||||
#ifdef BUMP
|
||||
/* Source's normalmaps are in the DX format where the green channel is flipped */
|
||||
vec3 normal_f = texture2D(s_normalmap, tex_c).rgb;
|
||||
normal_f.g *= -1.0;
|
||||
normal_f = normalize(normal_f.rgb - 0.5);
|
||||
#else
|
||||
vec3 normal_f = vec3(0.0,0.0,1.0);
|
||||
#endif
|
||||
|
||||
/* CUBEMAPS ONLY */
|
||||
#ifdef REFLECTCUBEMASK
|
||||
/* when ENVFROMBASE is set or a normal isn't present, we're getting the reflectivity info from the diffusemap's alpha channel */
|
||||
#if defined(ENVFROMBASE) || !defined(BUMP)
|
||||
#define refl 1.0 - diffuse_f.a
|
||||
#else
|
||||
#define refl texture2D(s_normalmap, tex_c).a
|
||||
#endif
|
||||
vec3 cube_c = reflect(normalize(-eyevector), normal_f.rgb);
|
||||
cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2];
|
||||
cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz;
|
||||
diffuse_f.rgb += (textureCube(s_reflectcube, cube_c).rgb * vec3(refl,refl,refl));
|
||||
#endif
|
||||
|
||||
#ifdef AMBIENTCUBE
|
||||
//no specular effect here. use rtlights for that.
|
||||
vec3 nn = norm*norm; //FIXME: should be worldspace normal.
|
||||
light = nn.x * e_light_ambientcube[(norm.x<0.0)?1:0] +
|
||||
nn.y * e_light_ambientcube[(norm.y<0.0)?3:2] +
|
||||
nn.z * e_light_ambientcube[(norm.z<0.0)?5:4];
|
||||
#else
|
||||
#ifdef HALFLAMBERT
|
||||
light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir));
|
||||
#else
|
||||
light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir));
|
||||
#endif
|
||||
|
||||
/* the light we're getting is always too bright */
|
||||
light *= 0.75;
|
||||
|
||||
/* clamp at 1.5 */
|
||||
if (light.r > 1.5)
|
||||
light.r = 1.5;
|
||||
if (light.g > 1.5)
|
||||
light.g = 1.5;
|
||||
if (light.b > 1.5)
|
||||
light.b = 1.5;
|
||||
#endif
|
||||
|
||||
diffuse_f.rgb *= light;
|
||||
|
||||
#ifdef FAKESHADOWS
|
||||
diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord);
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(diffuse_f * e_colourident) * e_lmscale;
|
||||
}
|
||||
#endif
|
|
@ -1,183 +0,0 @@
|
|||
!!cvardf r_glsl_turbscale_reflect=1 //simpler scaler
|
||||
!!cvardf r_glsl_turbscale_refract=1 //simpler scaler
|
||||
!!samps diffuse normalmap
|
||||
!!samps refract=0 //always present
|
||||
!!samps =REFLECT reflect=1
|
||||
!!samps !REFLECT reflectcube
|
||||
!!permu FOG
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
//modifier: REFLECT (s_t2 is a reflection instead of diffusemap)
|
||||
//modifier: STRENGTH_REFL (distortion strength - 0.1 = fairly gentle, 0.2 = big waves)
|
||||
//modifier: STRENGTH_REFL (distortion strength - 0.1 = fairly gentle, 0.2 = big waves)
|
||||
//modifier: FRESNEL_EXP (5=water)
|
||||
//modifier: TXSCALE (wave size - 0.2)
|
||||
//modifier: RIPPLEMAP (s_t3 contains a ripplemap
|
||||
//modifier: TINT_REFR (some colour value)
|
||||
//modifier: TINT_REFL (some colour value)
|
||||
//modifier: ALPHA (mix in the normal water texture over the top)
|
||||
//modifier: USEMODS (use single-texture scrolling via tcmods - note, also forces the engine to actually use tcmod etc)
|
||||
|
||||
//a few notes on DP compat:
|
||||
//'dpwater' makes numerous assumptions about DP internals
|
||||
//by default there is a single pass that uses the pass's normal tcmods
|
||||
//the fresnel has a user-supplied min+max rather than an exponent
|
||||
//both parts are tinted individually
|
||||
//if alpha is enabled, the regular water texture is blended over the top, again using the same crappy tcmods...
|
||||
|
||||
//legacy crap
|
||||
#ifndef FRESNEL
|
||||
#define FRESNEL 5.0
|
||||
#endif
|
||||
#ifndef TINT
|
||||
#define TINT 0.7,0.8,0.7
|
||||
#endif
|
||||
#ifndef STRENGTH
|
||||
#define STRENGTH 0.1
|
||||
#endif
|
||||
#ifndef TXSCALE
|
||||
#define TXSCALE 1
|
||||
#endif
|
||||
|
||||
//current values (referring to legacy defaults where needed)
|
||||
#ifndef FRESNEL_EXP
|
||||
#define FRESNEL_EXP 4.0
|
||||
#endif
|
||||
#ifndef FRESNEL_MIN
|
||||
#define FRESNEL_MIN 0.0
|
||||
#endif
|
||||
#ifndef FRESNEL_RANGE
|
||||
#define FRESNEL_RANGE 1.0
|
||||
#endif
|
||||
#ifndef STRENGTH_REFL
|
||||
#define STRENGTH_REFL STRENGTH
|
||||
#endif
|
||||
#ifndef STRENGTH_REFR
|
||||
#define STRENGTH_REFR STRENGTH
|
||||
#endif
|
||||
#ifndef TXSCALE1
|
||||
#define TXSCALE1 TXSCALE
|
||||
#endif
|
||||
#ifndef TXSCALE2
|
||||
#define TXSCALE2 TXSCALE
|
||||
#endif
|
||||
#ifndef TINT_REFR
|
||||
#define TINT_REFR TINT
|
||||
#endif
|
||||
#ifndef TINT_REFL
|
||||
#define TINT_REFL 1.0,1.0,1.0
|
||||
#endif
|
||||
#ifndef FOGTINT
|
||||
#define FOGTINT 0.2,0.3,0.2
|
||||
#endif
|
||||
|
||||
varying vec2 tc;
|
||||
varying vec4 tf;
|
||||
varying vec3 norm;
|
||||
varying vec3 eye;
|
||||
#ifdef VERTEX_SHADER
|
||||
void main (void)
|
||||
{
|
||||
tc = v_texcoord.st;
|
||||
tf = ftetransform();
|
||||
norm = v_normal;
|
||||
eye = e_eyepos - v_position.xyz;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
|
||||
|
||||
void main (void)
|
||||
{
|
||||
vec2 stc; //screen tex coords
|
||||
vec2 ntc; //normalmap/diffuse tex coords
|
||||
vec3 n, refr, refl;
|
||||
float fres;
|
||||
float depth;
|
||||
stc = (1.0 + (tf.xy / tf.w)) * 0.5;
|
||||
//hack the texture coords slightly so that there are less obvious gaps
|
||||
stc.t -= 1.5*norm.z/1080.0;
|
||||
|
||||
#if 0//def USEMODS
|
||||
ntc = tc;
|
||||
n = texture2D(s_normalmap, ntc).xyz - 0.5;
|
||||
#else
|
||||
//apply q1-style warp, just for kicks
|
||||
ntc.s = tc.s + sin(tc.t+e_time)*0.125;
|
||||
ntc.t = tc.t + sin(tc.s+e_time)*0.125;
|
||||
|
||||
//generate the two wave patterns from the normalmap
|
||||
n = (texture2D(s_normalmap, vec2(TXSCALE1)*tc + vec2(e_time*0.1, 0.0)).xyz);
|
||||
n += (texture2D(s_normalmap, vec2(TXSCALE2)*tc - vec2(0, e_time*0.097)).xyz);
|
||||
n -= 1.0 - 4.0/256.0;
|
||||
#endif
|
||||
|
||||
#ifdef RIPPLEMAP
|
||||
n += texture2D(s_ripplemap, stc).rgb*3.0;
|
||||
#endif
|
||||
n = normalize(n);
|
||||
|
||||
//the fresnel term decides how transparent the water should be
|
||||
fres = pow(1.0-abs(dot(n, normalize(eye))), float(FRESNEL_EXP)) * float(FRESNEL_RANGE) + float(FRESNEL_MIN);
|
||||
|
||||
#ifdef DEPTH
|
||||
float far = #include "cvar/gl_maxdist";
|
||||
float near = #include "cvar/gl_mindist";
|
||||
//get depth value at the surface
|
||||
float sdepth = gl_FragCoord.z;
|
||||
sdepth = (2.0*near) / (far + near - sdepth * (far - near));
|
||||
sdepth = mix(near, far, sdepth);
|
||||
|
||||
//get depth value at the ground beyond the surface.
|
||||
float gdepth = texture2D(s_refractdepth, stc).x;
|
||||
gdepth = (2.0*near) / (far + near - gdepth * (far - near));
|
||||
if (gdepth >= 0.5)
|
||||
{
|
||||
gdepth = sdepth;
|
||||
depth = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gdepth = mix(near, far, gdepth);
|
||||
depth = gdepth - sdepth;
|
||||
}
|
||||
|
||||
//reduce the normals in shallow water (near walls, reduces the pain of linear sampling)
|
||||
if (depth < 100.0)
|
||||
n *= depth/100.0;
|
||||
#else
|
||||
depth = 1.0;
|
||||
#endif
|
||||
|
||||
|
||||
//refraction image (and water fog, if possible)
|
||||
refr = texture2D(s_refract, stc + n.st*float(STRENGTH_REFR)*float(r_glsl_turbscale_refract)).rgb * vec3(TINT_REFR);
|
||||
#ifdef DEPTH
|
||||
refr = mix(refr, vec3(FOGTINT), min(depth/4096.0, 1.0));
|
||||
#endif
|
||||
|
||||
#ifdef REFLECT
|
||||
//reflection/diffuse
|
||||
refl = texture2D(s_reflect, stc - n.st*float(STRENGTH_REFL)*float(r_glsl_turbscale_reflect)).rgb * vec3(TINT_REFL);
|
||||
#else
|
||||
refl = textureCube(s_reflectcube, n).rgb;// * vec3(TINT_REFL);
|
||||
#endif
|
||||
|
||||
//interplate by fresnel
|
||||
refr = mix(refr, refl, fres);
|
||||
|
||||
#ifdef ALPHA
|
||||
vec4 ts = texture2D(s_diffuse, ntc);
|
||||
vec4 surf = fog4blend(vec4(ts.rgb, float(ALPHA)*ts.a));
|
||||
refr = mix(refr, surf.rgb, surf.a);
|
||||
#else
|
||||
refr = fog3(refr);
|
||||
#endif
|
||||
|
||||
//done
|
||||
gl_FragColor = vec4(refr, 1.0);
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue