+#include "quakedef.h"
+
#include "prvm_cmds.h"
//============================================================================
"DP_QC_TRACE_MOVETYPE_HITMODEL "
"DP_QC_TRACE_MOVETYPE_WORLDONLY "
"DP_QC_UNLIMITEDTEMPSTRINGS "
+"DP_QC_VECTOANGLES_WITH_ROLL "
"DP_QC_VECTORVECTORS "
"DP_QUAKE2_MODEL "
"DP_QUAKE2_SPRITE "
"DP_SV_PING "
"DP_SV_PLAYERPHYSICS "
"DP_SV_POINTPARTICLES "
+"DP_SV_POINTSOUND "
"DP_SV_PRECACHEANYTIME "
"DP_SV_PRINT "
"DP_SV_PUNCHVECTOR "
"DP_SV_CMD "
"DP_QC_CMD "
"FTE_STRINGS "
+"DP_CON_BESTWEAPON "
+"DP_QC_STRREPLACE "
;
/*
MSG_WriteVector(&sv.signon, pos, sv.protocol);
- if (large)
+ if (large || sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
MSG_WriteShort (&sv.signon, soundnum);
else
MSG_WriteByte (&sv.signon, soundnum);
SV_StartSound (entity, channel, sample, volume, attenuation);
}
+/*
+=================
+VM_SV_pointsound
+
+Follows the same logic as VM_SV_sound, except instead of
+an entity, an origin for the sound is provided, and channel
+is omitted (since no entity is being tracked).
+
+=================
+*/
+static void VM_SV_pointsound(void)
+{
+ const char *sample;
+ int volume;
+ float attenuation;
+ vec3_t org;
+
+ VM_SAFEPARMCOUNT(4, VM_SV_pointsound);
+
+ VectorCopy(PRVM_G_VECTOR(OFS_PARM0), org);
+ sample = PRVM_G_STRING(OFS_PARM1);
+ volume = (int)(PRVM_G_FLOAT(OFS_PARM2) * 255);
+ attenuation = PRVM_G_FLOAT(OFS_PARM3);
+
+ if (volume < 0 || volume > 255)
+ {
+ VM_Warning("SV_StartPointSound: volume must be in range 0-1\n");
+ return;
+ }
+
+ if (attenuation < 0 || attenuation > 4)
+ {
+ VM_Warning("SV_StartPointSound: attenuation must be in range 0-4\n");
+ return;
+ }
+
+ SV_StartPointSound (org, sample, volume, attenuation);
+}
+
/*
=================
VM_SV_traceline
VectorAdd(ent->fields.server->origin, ent->fields.server->view_ofs, org);
checkpvsbytes = 0;
if (sv.worldmodel && sv.worldmodel->brush.FatPVS)
- checkpvsbytes = sv.worldmodel->brush.FatPVS(sv.worldmodel, org, 0, checkpvs, sizeof(checkpvs));
+ checkpvsbytes = sv.worldmodel->brush.FatPVS(sv.worldmodel, org, 0, checkpvs, sizeof(checkpvs), false);
return i;
}
static void VM_SV_precache_sound (void)
{
VM_SAFEPARMCOUNT(1, VM_SV_precache_sound);
- SV_SoundIndex(PRVM_G_STRING(OFS_PARM0), 2);
- PRVM_G_INT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0);
+ PRVM_G_FLOAT(OFS_RETURN) = SV_SoundIndex(PRVM_G_STRING(OFS_PARM0), 2);
}
static void VM_SV_precache_model (void)
MSG_WriteShort (&sv.signon, (int)ent->fields.server->modelindex);
MSG_WriteShort (&sv.signon, (int)ent->fields.server->frame);
}
+ else if (sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
+ {
+ MSG_WriteByte (&sv.signon,svc_spawnstatic);
+ MSG_WriteShort (&sv.signon, (int)ent->fields.server->modelindex);
+ MSG_WriteByte (&sv.signon, (int)ent->fields.server->frame);
+ }
else
{
MSG_WriteByte (&sv.signon,svc_spawnstatic);
// FIXME: implement rotation/scaling
VectorAdd(&(model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex)[pointnum * 3], ed->fields.server->origin, PRVM_G_VECTOR(OFS_RETURN));
}
+//PF_getsurfacepointattribute, // #486 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
+// float SPA_POSITION = 0;
+// float SPA_S_AXIS = 1;
+// float SPA_R_AXIS = 2;
+// float SPA_T_AXIS = 3; // same as SPA_NORMAL
+// float SPA_TEXCOORDS0 = 4;
+// float SPA_LIGHTMAP0_TEXCOORDS = 5;
+// float SPA_LIGHTMAP0_COLOR = 6;
+static void VM_SV_getsurfacepointattribute(void)
+{
+ prvm_edict_t *ed;
+ model_t *model;
+ msurface_t *surface;
+ int pointnum;
+ int attributetype;
+
+ VM_SAFEPARMCOUNT(3, VM_SV_getsurfacepoint);
+ VectorClear(PRVM_G_VECTOR(OFS_RETURN));
+ ed = PRVM_G_EDICT(OFS_PARM0);
+ if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
+ return;
+ // note: this (incorrectly) assumes it is a simple polygon
+ pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
+ if (pointnum < 0 || pointnum >= surface->num_vertices)
+ return;
+ // FIXME: implement rotation/scaling
+ attributetype = (int) PRVM_G_FLOAT(OFS_PARM3);
+
+ switch( attributetype ) {
+ // float SPA_POSITION = 0;
+ case 0:
+ VectorAdd(&(model->surfmesh.data_vertex3f + 3 * surface->num_firstvertex)[pointnum * 3], ed->fields.server->origin, PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ // float SPA_S_AXIS = 1;
+ case 1:
+ VectorCopy(&(model->surfmesh.data_svector3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ // float SPA_R_AXIS = 2;
+ case 2:
+ VectorCopy(&(model->surfmesh.data_tvector3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ // float SPA_T_AXIS = 3; // same as SPA_NORMAL
+ case 3:
+ VectorCopy(&(model->surfmesh.data_normal3f + 3 * surface->num_firstvertex)[pointnum * 3], PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ // float SPA_TEXCOORDS0 = 4;
+ case 4: {
+ float *ret = PRVM_G_VECTOR(OFS_RETURN);
+ float *texcoord = &(model->surfmesh.data_texcoordtexture2f + 2 * surface->num_firstvertex)[pointnum * 2];
+ ret[0] = texcoord[0];
+ ret[1] = texcoord[1];
+ ret[2] = 0.0f;
+ break;
+ }
+ // float SPA_LIGHTMAP0_TEXCOORDS = 5;
+ case 5: {
+ float *ret = PRVM_G_VECTOR(OFS_RETURN);
+ float *texcoord = &(model->surfmesh.data_texcoordlightmap2f + 2 * surface->num_firstvertex)[pointnum * 2];
+ ret[0] = texcoord[0];
+ ret[1] = texcoord[1];
+ ret[2] = 0.0f;
+ break;
+ }
+ // float SPA_LIGHTMAP0_COLOR = 6;
+ case 6:
+ // ignore alpha for now..
+ VectorCopy( &(model->surfmesh.data_normal3f + 4 * surface->num_firstvertex)[pointnum * 4], PRVM_G_VECTOR(OFS_RETURN));
+ break;
+ default:
+ VectorSet( PRVM_G_VECTOR(OFS_RETURN), 0.0f, 0.0f, 0.0f );
+ break;
+ }
+}
//PF_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal = #436;
static void VM_SV_getsurfacenormal(void)
{
{
tag_index = SV_GetTagIndex(ent, tag_name);
if (tag_index == 0)
- Con_DPrintf("gettagindex(entity #%i): tag \"%s\" not found\n", PRVM_NUM_FOR_EDICT(ent), tag_name);
+ if(developer.integer >= 100)
+ Con_Printf("gettagindex(entity #%i): tag \"%s\" not found\n", PRVM_NUM_FOR_EDICT(ent), tag_name);
}
PRVM_G_FLOAT(OFS_RETURN) = tag_index;
};
VM_strtolower, // #480 string(string s) VM_strtolower (DP_QC_STRING_CASE_FUNCTIONS)
VM_strtoupper, // #481 string(string s) VM_strtoupper (DP_QC_STRING_CASE_FUNCTIONS)
VM_cvar_defstring, // #482 string(string s) cvar_defstring (DP_QC_CVAR_DEFSTRING)
-NULL, // #483
-NULL, // #484
-NULL, // #485
-NULL, // #486
+VM_SV_pointsound, // #483 void(vector origin, string sample, float volume, float attenuation) (DP_SV_POINTSOUND)
+VM_strreplace, // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
+VM_strireplace, // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
+VM_SV_getsurfacepointattribute,// #486 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
NULL, // #487
NULL, // #488
NULL, // #489