give qc access to WriteCoordV and WriteAngleV

This commit is contained in:
Bill Currie 2003-02-28 04:59:40 +00:00
parent ef762e21eb
commit d2edce37a4
4 changed files with 62 additions and 0 deletions

View file

@ -567,6 +567,8 @@ void ClientReliableWrite_Long(client_t *cl, int c);
void ClientReliableWrite_Short(client_t *cl, int c);
void ClientReliableWrite_String(client_t *cl, const char *s);
void ClientReliableWrite_SZ(client_t *cl, void *data, int len);
void ClientReliableWrite_AngleV(client_t *cl, const vec3_t v);
void ClientReliableWrite_CoordV(client_t *cl, const vec3_t v);
void Cvar_Info (struct cvar_s *var);

View file

@ -92,6 +92,8 @@ void PF_WriteShort (progs_t *pr);
void PF_WriteLong (progs_t *pr);
void PF_WriteAngle (progs_t *pr);
void PF_WriteCoord (progs_t *pr);
void PF_WriteAngleV (progs_t *pr);
void PF_WriteCoordV (progs_t *pr);
void PF_WriteString (progs_t *pr);
void PF_WriteEntity (progs_t *pr);
void PF_makestatic (progs_t *pr);

View file

@ -203,3 +203,23 @@ ClientReliableWrite_SZ (client_t *cl, void *data, int len)
} else
SZ_Write (&cl->netchan.message, data, len);
}
void
ClientReliableWrite_AngleV (client_t *cl, const vec3_t v)
{
if (cl->num_backbuf) {
MSG_WriteAngleV (&cl->backbuf, v);
ClientReliable_FinishWrite (cl);
} else
MSG_WriteAngleV (&cl->netchan.message, v);
}
void
ClientReliableWrite_CoordV (client_t *cl, const vec3_t v)
{
if (cl->num_backbuf) {
MSG_WriteCoordV (&cl->backbuf, v);
ClientReliable_FinishWrite (cl);
} else
MSG_WriteCoordV (&cl->netchan.message, v);
}

View file

@ -1165,6 +1165,42 @@ PF_WriteCoord (progs_t *pr)
MSG_WriteCoord (WriteDest (pr), P_FLOAT (pr, 1));
}
void
PF_WriteAngleV (progs_t *pr)
{
float *ang = P_VECTOR (pr, 1);
if (P_FLOAT (pr, 0) == MSG_ONE) {
client_t *cl = Write_GetClient (pr);
ClientReliableCheckBlock (cl, 1);
ClientReliableWrite_AngleV (cl, ang);
if (sv.demorecording) {
DemoWrite_Begin (dem_single, cl - svs.clients, 1);
MSG_WriteAngleV (&demo.dbuf->sz, ang);
}
} else
MSG_WriteAngleV (WriteDest (pr), ang);
}
void
PF_WriteCoordV (progs_t *pr)
{
float *coord = P_VECTOR (pr, 1);
if (P_FLOAT (pr, 0) == MSG_ONE) {
client_t *cl = Write_GetClient (pr);
ClientReliableCheckBlock (cl, 2);
ClientReliableWrite_CoordV (cl, coord);
if (sv.demorecording) {
DemoWrite_Begin (dem_single, cl - svs.clients, 2);
MSG_WriteCoordV (&demo.dbuf->sz, coord);
}
} else
MSG_WriteCoordV (WriteDest (pr), coord);
}
void
PF_WriteString (progs_t *pr)
{
@ -1697,6 +1733,8 @@ SV_PR_Cmds_Init ()
PR_AddBuiltin (&sv_pr_state, "writelong", PF_WriteLong, 55); // void(float to, float f) WriteLong
PR_AddBuiltin (&sv_pr_state, "writecoord", PF_WriteCoord, 56); // void(float to, float f) WriteCoord
PR_AddBuiltin (&sv_pr_state, "writeangle", PF_WriteAngle, 57); // void(float to, float f) WriteAngle
PR_AddBuiltin (&sv_pr_state, "WriteCoordV", PF_WriteCoordV, -1); // void(float to, vector v) WriteCoordV
PR_AddBuiltin (&sv_pr_state, "WriteAngleV", PF_WriteAngleV, -1); // void(float to, vector v) WriteAngleV
PR_AddBuiltin (&sv_pr_state, "writestring", PF_WriteString, 58); // void(float to, string s) WriteString
PR_AddBuiltin (&sv_pr_state, "writeentity", PF_WriteEntity, 59); // void(float to, entity s) WriteEntity
PR_AddBuiltin (&sv_pr_state, "movetogoal", SV_MoveToGoal, 67); // void (float step) movetogoal