Xonotic
sv_model.qh File Reference
#include "common.qh"
+ Include dependency graph for sv_model.qh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CSQCMODEL_ENDIF
 
#define CSQCMODEL_IF(cond)
 
#define CSQCMODEL_PROPERTY(flag, t, r, w, f)
 
#define CSQCMODEL_PROPERTY_SCALED(flag, t, r, w, f, s, mi, ma)
 

Functions

void CSQCModel_CheckUpdate (entity e)
 
void CSQCModel_LinkEntity (entity e)
 
void CSQCModel_UnlinkEntity (entity e)
 

Macro Definition Documentation

◆ CSQCMODEL_ENDIF

#define CSQCMODEL_ENDIF

Definition at line 33 of file sv_model.qh.

◆ CSQCMODEL_IF

#define CSQCMODEL_IF (   cond)

Definition at line 32 of file sv_model.qh.

◆ CSQCMODEL_PROPERTY

#define CSQCMODEL_PROPERTY (   flag,
  t,
  r,
  w,
 
)
Value:
.t f; \
.t csqcmodel_##f;

Definition at line 34 of file sv_model.qh.

◆ CSQCMODEL_PROPERTY_SCALED

#define CSQCMODEL_PROPERTY_SCALED (   flag,
  t,
  r,
  w,
  f,
  s,
  mi,
  ma 
)
Value:
.t f; \
.t csqcmodel_##f;

Definition at line 37 of file sv_model.qh.

Function Documentation

◆ CSQCModel_CheckUpdate()

void CSQCModel_CheckUpdate ( entity  e)

Definition at line 68 of file sv_model.qc.

References ALLPROPERTIES, CSQCMODEL_PROPERTY_FRAME, CSQCMODEL_PROPERTY_FRAME2, CSQCMODEL_PROPERTY_ORIGIN, CSQCMODEL_PROPERTY_TELEPORTED, CSQCPLAYER_FORCE_UPDATES, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, IS_CLIENT, random(), and time.

Referenced by CSQCModel_LinkEntity().

69 {
70  // some nice flags for CSQCMODEL_IF
71  noref float isplayer = IS_CLIENT(e);
72  noref float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
73  noref float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
74 
75 #if CSQCPLAYER_FORCE_UPDATES
76  if(isplayer && time > e.csqcmodel_nextforcedupdate)
77  {
78  e.SendFlags |= CSQCMODEL_PROPERTY_ORIGIN;
79  e.csqcmodel_nextforcedupdate = time + (1 / (CSQCPLAYER_FORCE_UPDATES)) * (0.5 + random()); // ensure about 4 origin sends per sec
80  }
81 #endif
82 
83  if(e.effects & EF_RESTARTANIM_BIT)
84  {
85  e.SendFlags |= CSQCMODEL_PROPERTY_FRAME | CSQCMODEL_PROPERTY_FRAME2; // full anim resend please
86  e.effects &= ~EF_RESTARTANIM_BIT;
87  }
88 
89  if(e.effects & EF_TELEPORT_BIT)
90  {
91  e.SendFlags |= CSQCMODEL_PROPERTY_TELEPORTED; // no interpolation please
92  e.effects &= ~EF_TELEPORT_BIT;
93  }
94 
95 #define CSQCMODEL_IF(cond) if(cond) {
96 #define CSQCMODEL_ENDIF }
97 #define CSQCMODEL_PROPERTY(flag,t,r,w,f) \
98  { \
99  t tmp = e.f; \
100  if(tmp != e.csqcmodel_##f) \
101  { \
102  e.csqcmodel_##f = tmp; \
103  e.SendFlags |= flag; \
104  } \
105  }
106 #define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \
107  { \
108  t tmp = rint(bound(mi, s * e.f, ma) - mi); \
109  if(tmp != e.csqcmodel_##f) \
110  { \
111  e.csqcmodel_##f = tmp; \
112  e.SendFlags |= flag; \
113  } \
114  }
116 #undef CSQCMODEL_PROPERTY_SCALED
117 #undef CSQCMODEL_PROPERTY
118 #undef CSQCMODEL_ENDIF
119 #undef CSQCMODEL_IF
120 }
#define CSQCPLAYER_FORCE_UPDATES
#define IS_CLIENT(v)
Definition: utils.qh:13
const int EF_RESTARTANIM_BIT
const int CSQCMODEL_PROPERTY_ORIGIN
Definition: common.qh:64
const int CSQCMODEL_PROPERTY_FRAME2
Definition: common.qh:67
#define ALLPROPERTIES
Definition: common.qh:93
const int EF_TELEPORT_BIT
const int CSQCMODEL_PROPERTY_FRAME
Definition: common.qh:61
const int CSQCMODEL_PROPERTY_TELEPORTED
Definition: common.qh:62
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CSQCModel_LinkEntity()

void CSQCModel_LinkEntity ( entity  e)

Definition at line 122 of file sv_model.qc.

References CSQCModel_CheckUpdate(), CSQCModel_Send(), and setSendEntity.

123 {
125  e.SendFlags = 0xFFFFFF;
127 }
bool CSQCModel_Send(entity this, entity to, int sf)
Definition: sv_model.qc:28
void CSQCModel_CheckUpdate(entity e)
Definition: sv_model.qc:68
#define setSendEntity(e, f)
Definition: self.qh:97
+ Here is the call graph for this function:

◆ CSQCModel_UnlinkEntity()

void CSQCModel_UnlinkEntity ( entity  e)

Definition at line 129 of file sv_model.qc.

References func_null(), and setSendEntity.

Referenced by Monster_Dead(), and vehicles_enter().

130 {
132 }
#define setSendEntity(e, f)
Definition: self.qh:97
var void func_null()
+ Here is the call graph for this function:
+ Here is the caller graph for this function: