// side-scrolling crosshair
seta crosshair_2d 54 "selects crosshair to use in side-scrolling mode (\"\" uses regular crosshair and 0 is none)"
+// third person chase-camera crosshair
+seta crosshair_chase 1 "adjust the crosshair while in third person mode to where the shot will actually hit"
+seta crosshair_chase_playeralpha 0.25 "opacity of the player while they obstruct the view when crosshair_chase is enabled, can be a value between 0 and 1"
+
// =========================
// Crosshair ring settings
float autocvar_crosshair_ring_reload_alpha;
float autocvar_crosshair_ring_reload_size;
float autocvar_crosshair_size;
+bool autocvar_crosshair_chase = true;
+float crosshair_chase_playeralpha = 0.25;
int autocvar_ekg;
float autocvar_fov;
bool autocvar_hud_cursormode = true;
// wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
if(csqcplayer.viewloc && (csqcplayer.viewloc.spawnflags & VIEWLOC_FREEAIM))
wcross_origin = viewloc_mousepos;
+ else if(autocvar_chase_active && autocvar_crosshair_chase)
+ {
+ vector player_org = ((csqcplayer) ? csqcplayer.origin + csqcplayer.view_ofs : view_origin);
+ if(csqcplayer && crosshair_chase_playeralpha && crosshair_chase_playeralpha < 1)
+ {
+ traceline(view_origin, view_origin + max_shot_distance * view_forward, MOVE_NORMAL, NULL);
+ if(trace_ent == csqcplayer)
+ csqcplayer.alpha = crosshair_chase_playeralpha;
+ else
+ csqcplayer.alpha = csqcplayer.m_alpha;
+ }
+ traceline(player_org, player_org + max_shot_distance * view_forward, MOVE_WORLDONLY, NULL);
+ wcross_origin = project_3d_to_2d(trace_endpos);
+ }
else
wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward);
wcross_origin.z = 0;
# define TAG_VIEWLOC_NAME tag_networkviewloc
# define TAG_VIEWLOC_TYPE int
.float tag_networkviewloc;
+
+# define ALPHA m_alpha
+.float m_alpha;
#else
# define TAG_ENTITY_NAME tag_entity
# define TAG_ENTITY_TYPE entity
# define TAG_VIEWLOC_NAME viewloc
# define TAG_VIEWLOC_TYPE entity
+
+# define ALPHA alpha
#endif
// add properties you want networked to CSQC here
CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \
CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \
CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \
- CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, alpha, 254, -1, 254) \
+ CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, ALPHA, 254, -1, 254) \
CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, skin) \
CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
CSQCMODEL_PROPERTY(BIT(6), float, ReadByte, WriteByte, solid) \
this.csqcmodel_teleported = 1;
}
+ if(sf & BIT(3))
+ this.alpha = this.m_alpha;
+
if(sf & BIT(14))
viewloc_SetTags(this);
#define CSQCMODEL_ENDIF
#define CSQCMODEL_PROPERTY(flag,t,r,w,f) \
.t f;
-#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f)
+#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \
+ .t f;
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY
{ \
w(MSG_ENTITY, this.csqcmodel_##f); \
}
-#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f)
+#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \
+ if(sf & flag) \
+ { \
+ w(MSG_ENTITY, this.csqcmodel_##f); \
+ }
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY
#define CSQCMODEL_PROPERTY(flag,t,r,w,f) \
.t f; \
.t csqcmodel_##f;
-#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f)
+#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \
+ .t f; \
+ .t csqcmodel_##f;
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY