X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=prvm_cmds.c;h=716762eddc42ef56b32069a258b272bff396475d;hb=f535fca6e58ecf5e8f85e160369ab2eb1bde3826;hp=819bada04d0f639ac96d5def8469fabf972056fe;hpb=8ad930aa4d11a53a109ef02d7d9bb9a1148c56f3;p=xonotic%2Fdarkplaces.git diff --git a/prvm_cmds.c b/prvm_cmds.c index 819bada0..716762ed 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -2923,7 +2923,8 @@ void VM_getsoundtime (void) } entnum = ((pnum == PRVM_CLIENTPROG) ? MAX_EDICTS : 0) + PRVM_NUM_FOR_EDICT(PRVM_G_EDICT(OFS_PARM0)); entchannel = (int)PRVM_G_FLOAT(OFS_PARM1); - if (entchannel <= 0 || entchannel > 8) + entchannel = CHAN_USER2ENGINE(entchannel); + if (!IS_CHAN(entchannel)) VM_Warning("VM_getsoundtime: %s: bad channel %i\n", PRVM_NAME, entchannel); PRVM_G_FLOAT(OFS_RETURN) = (float)S_GetEntChannelPosition(entnum, entchannel); } @@ -3354,22 +3355,23 @@ void VM_drawcharacter(void) ========= VM_drawstring -float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) +float drawstring(vector position, string text, vector scale, vector rgb, float alpha[, float flag]) ========= */ void VM_drawstring(void) { float *pos,*scale,*rgb; const char *string; - int flag; + int flag = 0; float sx, sy; - VM_SAFEPARMCOUNT(6,VM_drawstring); + VM_SAFEPARMCOUNTRANGE(5,6,VM_drawstring); string = PRVM_G_STRING(OFS_PARM1); pos = PRVM_G_VECTOR(OFS_PARM0); scale = PRVM_G_VECTOR(OFS_PARM2); rgb = PRVM_G_VECTOR(OFS_PARM3); - flag = (int)PRVM_G_FLOAT(OFS_PARM5); + if (prog->argc >= 6) + flag = (int)PRVM_G_FLOAT(OFS_PARM5); if(flag < DRAWFLAG_NORMAL || flag >=DRAWFLAG_NUMFLAGS) { @@ -3697,9 +3699,9 @@ void VM_drawpic(void) { const char *picname; float *size, *pos, *rgb; - int flag; + int flag = 0; - VM_SAFEPARMCOUNT(6,VM_drawpic); + VM_SAFEPARMCOUNTRANGE(5,6,VM_drawpic); picname = PRVM_G_STRING(OFS_PARM1); VM_CheckEmptyString (picname); @@ -3715,7 +3717,8 @@ void VM_drawpic(void) pos = PRVM_G_VECTOR(OFS_PARM0); size = PRVM_G_VECTOR(OFS_PARM2); rgb = PRVM_G_VECTOR(OFS_PARM3); - flag = (int) PRVM_G_FLOAT(OFS_PARM5); + if (prog->argc >= 6) + flag = (int) PRVM_G_FLOAT(OFS_PARM5); if(flag < DRAWFLAG_NORMAL || flag >=DRAWFLAG_NUMFLAGS) { @@ -5881,7 +5884,7 @@ void VM_uri_get (void) handle->prognr = PRVM_GetProgNr(); handle->starttime = prog->starttime; handle->id = id; - if(postseparator) + if(postseparator && posttype && *posttype) { size_t l = strlen(postseparator); if(poststringbuffer >= 0) @@ -6845,7 +6848,7 @@ void VM_getsurfaceclippedpoint(void) animatemodel(model, ed); applytransform_inverted(PRVM_G_VECTOR(OFS_PARM2), ed, p); clippointtosurface(ed, model, surface, p, out); - VectorAdd(out, ed->fields.server->origin, PRVM_G_VECTOR(OFS_RETURN)); + VectorAdd(out, PRVM_serveredictvector(ed, origin), PRVM_G_VECTOR(OFS_RETURN)); } //PF_getsurfacenumtriangles, // #??? float(entity e, float s) getsurfacenumtriangles = #???; @@ -6924,7 +6927,7 @@ void VM_physics_enable(void) return; } // entity should have MOVETYPE_PHYSICS already set, this can damage memory (making leaked allocation) so warn about this even if non-developer - if (ed->fields.server->movetype != MOVETYPE_PHYSICS) + if (PRVM_serveredictfloat(ed, movetype) != MOVETYPE_PHYSICS) { VM_Warning("VM_physics_enable: entity is not MOVETYPE_PHYSICS!\n"); return; @@ -6948,14 +6951,14 @@ void VM_physics_addforce(void) return; } // entity should have MOVETYPE_PHYSICS already set, this can damage memory (making leaked allocation) so warn about this even if non-developer - if (ed->fields.server->movetype != MOVETYPE_PHYSICS) + if (PRVM_serveredictfloat(ed, movetype) != MOVETYPE_PHYSICS) { VM_Warning("VM_physics_addforce: entity is not MOVETYPE_PHYSICS!\n"); return; } f.type = ODEFUNC_RELFORCEATPOS; VectorCopy(PRVM_G_VECTOR(OFS_PARM1), f.v1); - VectorSubtract(ed->fields.server->origin, PRVM_G_VECTOR(OFS_PARM2), f.v2); + VectorSubtract(PRVM_serveredictvector(ed, origin), PRVM_G_VECTOR(OFS_PARM2), f.v2); VM_physics_ApplyCmd(ed, &f); } @@ -6974,7 +6977,7 @@ void VM_physics_addtorque(void) return; } // entity should have MOVETYPE_PHYSICS already set, this can damage memory (making leaked allocation) so warn about this even if non-developer - if (ed->fields.server->movetype != MOVETYPE_PHYSICS) + if (PRVM_serveredictfloat(ed, movetype) != MOVETYPE_PHYSICS) { VM_Warning("VM_physics_addtorque: entity is not MOVETYPE_PHYSICS!\n"); return;