Client: Use the new Crosshair drawing functions to help with cl_thirdperson and remove obsolete routines.
This commit is contained in:
parent
54a5f52285
commit
9e4eb1dc23
8 changed files with 201 additions and 68 deletions
|
@ -58,7 +58,6 @@ monster_drillsergeant.qc
|
|||
monster_recruit.qc
|
||||
|
||||
../../../valve/src/server/player.qc
|
||||
../../../valve/src/server/spectator.qc
|
||||
../../../valve/src/server/items.qc
|
||||
../../../valve/src/server/item_longjump.qc
|
||||
../../../valve/src/server/item_suit.qc
|
||||
|
@ -80,7 +79,6 @@ gamerules.qc
|
|||
../../../valve/src/server/gamerules_singleplayer.qc
|
||||
../../../valve/src/server/gamerules_multiplayer.qc
|
||||
gamerules_ctf.qc
|
||||
../../../valve/src/server/client.qc
|
||||
server.qc
|
||||
../../../base/src/server/damage.qc
|
||||
../../../valve/src/server/flashlight.qc
|
||||
|
|
|
@ -14,6 +14,89 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
/* Here's a list of bone names that we are aware of on HL player models.
|
||||
Usually we'd use skeletalobjects to share the same skeleton/anim with
|
||||
another model - but because FTEQW does not support that for HLMDL we
|
||||
are forced to manually position the bones of our attachnment
|
||||
by iterating over them and manually setting their position in 3D-space.
|
||||
*/
|
||||
string g_pbones[] =
|
||||
{
|
||||
"Bip01",
|
||||
"Bip01 Footsteps",
|
||||
"Bip01 Pelvis",
|
||||
"Bip01 L Leg",
|
||||
"Bip01 L Leg1",
|
||||
"Bip01 L Foot",
|
||||
"Bip01 L Toe0",
|
||||
"Bip01 L Toe01",
|
||||
"Bip01 L Toe02",
|
||||
"Dummy16",
|
||||
"Bip01 R Leg",
|
||||
"Bip01 R Leg1",
|
||||
"Bip01 R Foot",
|
||||
"Bip01 R Toe0",
|
||||
"Bip01 R Toe01",
|
||||
"Bip01 R Toe02",
|
||||
"Dummy11",
|
||||
"Bip01 Spine",
|
||||
"Bip01 Spine1",
|
||||
"Bip01 Spine2",
|
||||
"Bip01 Spine3",
|
||||
"Bip01 Neck",
|
||||
"Bip01 Head",
|
||||
"Dummy21",
|
||||
"Dummy08",
|
||||
"Bone02",
|
||||
"Bone03",
|
||||
"Bone04",
|
||||
"Dummy05",
|
||||
"Bone09",
|
||||
"Bone10",
|
||||
"Dummy04",
|
||||
"Bone05",
|
||||
"Bone06",
|
||||
"Dummy03",
|
||||
"Bone07",
|
||||
"Bone08",
|
||||
"Dummy09",
|
||||
"Bone11",
|
||||
"Bone12",
|
||||
"Dummy10",
|
||||
"Bone13",
|
||||
"Bone14",
|
||||
"Bone15",
|
||||
"Bip01 L Arm",
|
||||
"Bip01 L Arm1",
|
||||
"Bip01 L Arm2",
|
||||
"Bip01 L Hand",
|
||||
"Bip01 L Finger0",
|
||||
"Bip01 L Finger01",
|
||||
"Bip01 L Finger02",
|
||||
"Dummy06",
|
||||
"Bip01 L Finger1",
|
||||
"Bip01 L Finger11",
|
||||
"Bip01 L Finger12",
|
||||
"Dummy07",
|
||||
"Bip01 R Arm",
|
||||
"Bip01 R Arm1",
|
||||
"Bip01 R Arm2",
|
||||
"Bip01 R Hand",
|
||||
"Bip01 R Finger0",
|
||||
"Bip01 R Finger01",
|
||||
"Bip01 R Finger02",
|
||||
"Dummy01",
|
||||
"Bip01 R Finger1",
|
||||
"Bip01 R Finger11",
|
||||
"Bip01 R Finger12",
|
||||
"Dummy02",
|
||||
"Box02",
|
||||
"Bone08",
|
||||
"Bone15"
|
||||
};
|
||||
#endif
|
||||
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
|
@ -81,8 +164,10 @@ class player:NSClientPlayer
|
|||
PREDICTED_INT(mode_m249)
|
||||
|
||||
virtual void(void) Physics_Jump;
|
||||
virtual void UpdatePlayerAnimation(float);
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual void UpdatePlayerAttachments(bool);
|
||||
virtual void(float,float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
|
@ -92,7 +177,102 @@ class player:NSClientPlayer
|
|||
#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
|
||||
.string oldmodel;
|
||||
string Weapons_GetPlayermodel(player, int);
|
||||
|
||||
void
|
||||
player::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 + [0,0,-8];
|
||||
ang = view_angles;
|
||||
}
|
||||
|
||||
makevectors(ang);
|
||||
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, this);
|
||||
|
||||
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
|
||||
dynamiclight_add(trace_endpos + (v_forward * -2), 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 = 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);
|
||||
|
|
|
@ -268,21 +268,15 @@ void
|
|||
w_displacer_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector cross_pos;
|
||||
vector aicon_pos;
|
||||
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[24,24],
|
||||
Cross_DrawSub(
|
||||
"sprites/ofch1.spr_0.tga",
|
||||
[24,24],
|
||||
[48/72,0],
|
||||
[24/72,24/72],
|
||||
[1,1,1],
|
||||
1,
|
||||
DRAWFLAG_NORMAL
|
||||
[24/72,24/72]
|
||||
);
|
||||
|
||||
drawsubpic(
|
||||
|
|
|
@ -249,7 +249,6 @@ void
|
|||
w_eagle_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector cross_pos;
|
||||
vector aicon_pos;
|
||||
|
||||
/* crosshair/laser */
|
||||
|
@ -258,6 +257,7 @@ w_eagle_crosshair(player pl)
|
|||
vector jitter;
|
||||
Weapons_MakeVectors(pl);
|
||||
vector src = pl.origin + pl.view_ofs;
|
||||
vector cross_pos;
|
||||
traceline(src, src + (v_forward * 256), FALSE, pl);
|
||||
lerp = Math_Lerp(18,6, trace_fraction);
|
||||
jitter[0] = (random(0,2) - 2) * (1 - trace_fraction);
|
||||
|
@ -274,16 +274,11 @@ w_eagle_crosshair(player pl)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[24,24],
|
||||
Cross_DrawSub(
|
||||
"sprites/ofch1.spr_0.tga",
|
||||
[24,24],
|
||||
[0,0],
|
||||
[24/72, 24/72],
|
||||
[1,1,1],
|
||||
1,
|
||||
DRAWFLAG_NORMAL
|
||||
[24/72, 24/72]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,20 +223,14 @@ void
|
|||
w_m249_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector cross_pos;
|
||||
vector aicon_pos;
|
||||
|
||||
/* crosshair */
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[24,24],
|
||||
Cross_DrawSub(
|
||||
"sprites/ofch1.spr_0.tga",
|
||||
[24,24],
|
||||
[24/72,0],
|
||||
[24/72, 24/72],
|
||||
[1,1,1],
|
||||
1.0,
|
||||
DRAWFLAG_NORMAL
|
||||
[24/72, 24/72]
|
||||
);
|
||||
|
||||
/* ammo counters */
|
||||
|
|
|
@ -195,20 +195,13 @@ void
|
|||
w_shockrifle_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector cross_pos;
|
||||
vector aicon_pos;
|
||||
|
||||
/* crosshair */
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[24,24],
|
||||
Cross_DrawSub(
|
||||
"sprites/ofch1.spr_0.tga",
|
||||
[24,24],
|
||||
[0,24/72],
|
||||
[24/72, 24/72],
|
||||
[1,1,1],
|
||||
1.0,
|
||||
DRAWFLAG_NORMAL
|
||||
[24/72, 24/72]
|
||||
);
|
||||
|
||||
/* ammo counter */
|
||||
|
|
|
@ -209,31 +209,17 @@ void
|
|||
w_sniperrifle_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
static vector cross_pos;
|
||||
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[24,24],
|
||||
Cross_DrawSub(
|
||||
"sprites/ofch1.spr_0.tga",
|
||||
[24,24],
|
||||
[0,48/72],
|
||||
[24/72, 24/72],
|
||||
[1,1,1],
|
||||
1,
|
||||
DRAWFLAG_NORMAL
|
||||
[24/72, 24/72]
|
||||
);
|
||||
} else {
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-128,-128];
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[256,256],
|
||||
Cross_Draw(
|
||||
"sprites/ofch2.spr_0.tga",
|
||||
[0,0],
|
||||
[1, 1],
|
||||
[1,1,1],
|
||||
1,
|
||||
DRAWFLAG_NORMAL
|
||||
[256,256]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -335,20 +335,13 @@ void
|
|||
w_sporelauncher_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector cross_pos;
|
||||
vector aicon_pos;
|
||||
|
||||
/* crosshair */
|
||||
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
|
||||
drawsubpic(
|
||||
cross_pos,
|
||||
[24,24],
|
||||
Cross_DrawSub(
|
||||
"sprites/ofch1.spr_0.tga",
|
||||
[24,24],
|
||||
[24/72,24/72],
|
||||
[24/72,24/72],
|
||||
[1,1,1],
|
||||
1.0,
|
||||
DRAWFLAG_NORMAL
|
||||
[24/72,24/72]
|
||||
);
|
||||
|
||||
/* ammo counters */
|
||||
|
|
Loading…
Reference in a new issue