From 5727c9874e7f3539ed042a638a7b4850f79d9aa8 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Tue, 16 Jun 2020 14:52:30 +0000 Subject: [PATCH] Correct wrong function names in the VM_SAFEPARMCOUNT calls, found by terencehill These didn't break the built-ins, because they just applied to error messages. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12684 d7cf8633-e32d-0410-b094-e92efae38249 --- clvm_cmds.c | 12 ++++++------ mvm_cmds.c | 10 +++++----- prvm_cmds.c | 44 ++++++++++++++++++++++---------------------- sv_move.c | 4 ++-- svvm_cmds.c | 6 +++--- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/clvm_cmds.c b/clvm_cmds.c index 1f857d11..ef432e6e 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -2924,7 +2924,7 @@ static void VM_CL_SpawnParticle (prvm_prog_t *prog) particle_t *part; int themenum; - VM_SAFEPARMCOUNTRANGE(2, 3, VM_CL_SpawnParticle2); + VM_SAFEPARMCOUNTRANGE(2, 3, VM_CL_SpawnParticle); if (vmpartspawner.verified == false) { VM_Warning(prog, "VM_CL_SpawnParticle: particle spawner not initialized\n"); @@ -3046,10 +3046,10 @@ static void VM_CL_SpawnParticleDelayed (prvm_prog_t *prog) particle_t *part; int themenum; - VM_SAFEPARMCOUNTRANGE(4, 5, VM_CL_SpawnParticle2); + VM_SAFEPARMCOUNTRANGE(4, 5, VM_CL_SpawnParticleDelayed); if (vmpartspawner.verified == false) { - VM_Warning(prog, "VM_CL_SpawnParticle: particle spawner not initialized\n"); + VM_Warning(prog, "VM_CL_SpawnParticleDelayed: particle spawner not initialized\n"); PRVM_G_FLOAT(OFS_RETURN) = 0; return; } @@ -3095,7 +3095,7 @@ static void VM_CL_SpawnParticleDelayed (prvm_prog_t *prog) themenum = (int)PRVM_G_FLOAT(OFS_PARM4); if (themenum <= 0 || themenum >= vmpartspawner.max_themes) { - VM_Warning(prog, "VM_CL_SpawnParticle: bad theme number %i\n", themenum); + VM_Warning(prog, "VM_CL_SpawnParticleDelayed: bad theme number %i\n", themenum); PRVM_G_FLOAT(OFS_RETURN) = 0; return; } @@ -3157,7 +3157,7 @@ static void VM_CL_GetEntity (prvm_prog_t *prog) { int entnum, fieldnum; vec3_t forward, left, up, org; - VM_SAFEPARMCOUNT(2, VM_CL_GetEntityVec); + VM_SAFEPARMCOUNT(2, VM_CL_GetEntity); entnum = PRVM_G_FLOAT(OFS_PARM0); if (entnum < 0 || entnum >= cl.num_entities) @@ -3705,7 +3705,7 @@ static void VM_CL_checkpvs (prvm_prog_t *prog) unsigned char fatpvs[MAX_MAP_LEAFS/8]; #endif - VM_SAFEPARMCOUNT(2, VM_SV_checkpvs); + VM_SAFEPARMCOUNT(2, VM_CL_checkpvs); VectorCopy(PRVM_G_VECTOR(OFS_PARM0), viewpos); viewee = PRVM_G_EDICT(OFS_PARM1); diff --git a/mvm_cmds.c b/mvm_cmds.c index 58e089a0..df6497fa 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -171,7 +171,7 @@ vector getresolution(float number) static void VM_M_getresolution(prvm_prog_t *prog) { int nr, fs; - VM_SAFEPARMCOUNTRANGE(1, 2, VM_getresolution); + VM_SAFEPARMCOUNTRANGE(1, 2, VM_M_getresolution); nr = (int)PRVM_G_FLOAT(OFS_PARM0); @@ -521,7 +521,7 @@ static void VM_M_getserverlistnumber(prvm_prog_t *prog) const serverlist_entry_t *cache; int hostnr; - VM_SAFEPARMCOUNT(2, VM_M_getserverliststring); + VM_SAFEPARMCOUNT(2, VM_M_getserverlistnumber); PRVM_G_INT(OFS_RETURN) = OFS_NULL; @@ -868,7 +868,7 @@ static void VM_M_crypto_getmykeyfp(prvm_prog_t *prog) int i; char keyfp[FP64_SIZE + 1]; - VM_SAFEPARMCOUNT(1,VM_M_crypto_getmykey); + VM_SAFEPARMCOUNT(1, VM_M_crypto_getmykeyfp); i = PRVM_G_FLOAT( OFS_PARM0 ); switch(Crypto_RetrieveLocalKey(i, keyfp, sizeof(keyfp), NULL, 0, NULL)) @@ -890,7 +890,7 @@ static void VM_M_crypto_getmyidfp(prvm_prog_t *prog) int i; char idfp[FP64_SIZE + 1]; - VM_SAFEPARMCOUNT(1,VM_M_crypto_getmykey); + VM_SAFEPARMCOUNT(1, VM_M_crypto_getmyidfp); i = PRVM_G_FLOAT( OFS_PARM0 ); switch(Crypto_RetrieveLocalKey(i, NULL, 0, idfp, sizeof(idfp), NULL)) @@ -912,7 +912,7 @@ static void VM_M_crypto_getmyidstatus(prvm_prog_t *prog) int i; qboolean issigned; - VM_SAFEPARMCOUNT(1,VM_M_crypto_getmykey); + VM_SAFEPARMCOUNT(1, VM_M_crypto_getmyidstatus); i = PRVM_G_FLOAT( OFS_PARM0 ); switch(Crypto_RetrieveLocalKey(i, NULL, 0, NULL, 0, &issigned)) diff --git a/prvm_cmds.c b/prvm_cmds.c index 3dbac750..b0c67c3a 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -615,7 +615,7 @@ cmd (string, ...) void VM_localcmd_client(prvm_prog_t *prog) { char string[VM_STRINGTEMP_LENGTH]; - VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd); + VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_client); VM_VarString(prog, 0, string, sizeof(string)); Cbuf_AddText(&cmd_client, string); } @@ -633,7 +633,7 @@ cmd (string, ...) void VM_localcmd_server(prvm_prog_t *prog) { char string[VM_STRINGTEMP_LENGTH]; - VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd); + VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_server); VM_VarString(prog, 0, string, sizeof(string)); Cbuf_AddText(&cmd_server, string); } @@ -680,7 +680,7 @@ void VM_cvar_type(prvm_prog_t *prog) cvar_t *cvar; int ret; - VM_SAFEPARMCOUNTRANGE(1,8,VM_cvar); + VM_SAFEPARMCOUNTRANGE(1, 8, VM_cvar_type); VM_VarString(prog, 0, string, sizeof(string)); VM_CheckEmptyString(prog, string); cvar = Cvar_FindVar(prog->console_cmd->cvars, string, prog->console_cmd->cvars_flagsmask); @@ -2459,7 +2459,7 @@ void VM_strireplace(prvm_prog_t *prog) char string[VM_STRINGTEMP_LENGTH]; int search_len, replace_len, subject_len; - VM_SAFEPARMCOUNT(3,VM_strreplace); + VM_SAFEPARMCOUNT(3, VM_strireplace); search = PRVM_G_STRING(OFS_PARM0); replace = PRVM_G_STRING(OFS_PARM1); @@ -2645,7 +2645,7 @@ void VM_tokenize_console (prvm_prog_t *prog) { const char *p; - VM_SAFEPARMCOUNT(1,VM_tokenize); + VM_SAFEPARMCOUNT(1, VM_tokenize_console); strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); p = tokenize_string; @@ -2813,7 +2813,7 @@ float isserver() */ void VM_isserver(prvm_prog_t *prog) { - VM_SAFEPARMCOUNT(0,VM_serverstate); + VM_SAFEPARMCOUNT(0, VM_isserver); PRVM_G_FLOAT(OFS_RETURN) = sv.active; } @@ -2989,7 +2989,7 @@ loadfromdata(string data) */ void VM_loadfromdata(prvm_prog_t *prog) { - VM_SAFEPARMCOUNT(1,VM_loadentsfromfile); + VM_SAFEPARMCOUNT(1, VM_loadfromdata); PRVM_ED_LoadFromFile(prog, PRVM_G_STRING(OFS_PARM0)); } @@ -3066,7 +3066,7 @@ float mod(float val, float m) void VM_modulo(prvm_prog_t *prog) { prvm_int_t val, m; - VM_SAFEPARMCOUNT(2,VM_module); + VM_SAFEPARMCOUNT(2, VM_modulo); val = (prvm_int_t) PRVM_G_FLOAT(OFS_PARM0); m = (prvm_int_t) PRVM_G_FLOAT(OFS_PARM1); @@ -3176,7 +3176,7 @@ float search_getsize(float handle) void VM_search_getsize(prvm_prog_t *prog) { int handle; - VM_SAFEPARMCOUNT(1, VM_M_search_getsize); + VM_SAFEPARMCOUNT(1, VM_search_getsize); handle = (int)PRVM_G_FLOAT(OFS_PARM0); @@ -3533,7 +3533,7 @@ void VM_stringwidth(prvm_prog_t *prog) int colors; float sx, sy; size_t maxlen = 0; - VM_SAFEPARMCOUNTRANGE(2,3,VM_drawstring); + VM_SAFEPARMCOUNTRANGE(2, 3, VM_stringwidth); getdrawfontscale(prog, &sx, &sy); if(prog->argc == 3) @@ -4067,7 +4067,7 @@ float stringtokeynum(string key) */ void VM_stringtokeynum (prvm_prog_t *prog) { - VM_SAFEPARMCOUNT( 1, VM_keynumtostring ); + VM_SAFEPARMCOUNT( 1, VM_stringtokeynum ); PRVM_G_FLOAT(OFS_RETURN) = Key_StringToKeynum(PRVM_G_STRING(OFS_PARM0)); } @@ -4082,7 +4082,7 @@ string getkeybind(float key, float bindmap) void VM_getkeybind (prvm_prog_t *prog) { int bindmap; - VM_SAFEPARMCOUNTRANGE(1, 2, VM_CL_getkeybind); + VM_SAFEPARMCOUNTRANGE(1, 2, VM_getkeybind); if(prog->argc == 2) bindmap = bound(-1, PRVM_G_FLOAT(OFS_PARM1), MAX_BINDMAPS-1); else @@ -4101,7 +4101,7 @@ float setkeybind(float key, string cmd, float bindmap) void VM_setkeybind (prvm_prog_t *prog) { int bindmap; - VM_SAFEPARMCOUNTRANGE(2, 3, VM_CL_setkeybind); + VM_SAFEPARMCOUNTRANGE(2, 3, VM_setkeybind); if(prog->argc == 3) bindmap = bound(-1, PRVM_G_FLOAT(OFS_PARM2), MAX_BINDMAPS-1); else @@ -4122,7 +4122,7 @@ vector getbindmaps() void VM_getbindmaps (prvm_prog_t *prog) { int fg, bg; - VM_SAFEPARMCOUNT(0, VM_CL_getbindmap); + VM_SAFEPARMCOUNT(0, VM_getbindmaps); Key_GetBindMap(&fg, &bg); PRVM_G_VECTOR(OFS_RETURN)[0] = fg; PRVM_G_VECTOR(OFS_RETURN)[1] = bg; @@ -4138,7 +4138,7 @@ float setbindmaps(vector bindmap) */ void VM_setbindmaps (prvm_prog_t *prog) { - VM_SAFEPARMCOUNT(1, VM_CL_setbindmap); + VM_SAFEPARMCOUNT(1, VM_setbindmaps); PRVM_G_FLOAT(OFS_RETURN) = 0; if(PRVM_G_VECTOR(OFS_PARM0)[2] == 0) if(Key_SetBindMap((int)PRVM_G_VECTOR(OFS_PARM0)[0], (int)PRVM_G_VECTOR(OFS_PARM0)[1])) @@ -4204,7 +4204,7 @@ void VM_cin_setstate(prvm_prog_t *prog) clvideostate_t state; clvideo_t *video; - VM_SAFEPARMCOUNT( 2, VM_cin_netstate ); + VM_SAFEPARMCOUNT( 2, VM_cin_setstate ); name = PRVM_G_STRING( OFS_PARM0 ); VM_CheckEmptyString(prog, name ); @@ -4787,9 +4787,9 @@ void VM_buf_create (prvm_prog_t *prog) { prvm_stringbuffer_t *stringbuffer; int i; - + VM_SAFEPARMCOUNTRANGE(0, 2, VM_buf_create); - + // VorteX: optional parm1 (buffer format) is unfinished, to keep intact with future databuffers extension must be set to "string" if(prog->argc >= 1 && strcmp(PRVM_G_STRING(OFS_PARM0), "string")) { @@ -7108,7 +7108,7 @@ void VM_getsurfacepointattribute(prvm_prog_t *prog) int attributetype; vec3_t result; - VM_SAFEPARMCOUNT(4, VM_getsurfacepoint); + VM_SAFEPARMCOUNT(4, VM_getsurfacepointattribute); VectorClear(PRVM_G_VECTOR(OFS_RETURN)); ed = PRVM_G_EDICT(OFS_PARM0); if (!(model = getmodel(prog, ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1)))) @@ -7256,7 +7256,7 @@ void VM_getsurfaceclippedpoint(prvm_prog_t *prog) dp_model_t *model; msurface_t *surface; vec3_t p, out, inp; - VM_SAFEPARMCOUNT(3, VM_te_getsurfaceclippedpoint); + VM_SAFEPARMCOUNT(3, VM_getsurfaceclippedpoint); VectorClear(PRVM_G_VECTOR(OFS_RETURN)); ed = PRVM_G_EDICT(OFS_PARM0); if (!(model = getmodel(prog, ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1)))) @@ -7273,7 +7273,7 @@ void VM_getsurfacenumtriangles(prvm_prog_t *prog) { dp_model_t *model; msurface_t *surface; - VM_SAFEPARMCOUNT(2, VM_SV_getsurfacenumtriangles); + VM_SAFEPARMCOUNT(2, VM_getsurfacenumtriangles); // return 0 if no such surface if (!(model = getmodel(prog, PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1)))) { @@ -7291,7 +7291,7 @@ void VM_getsurfacetriangle(prvm_prog_t *prog) dp_model_t *model; msurface_t *surface; int trinum; - VM_SAFEPARMCOUNT(3, VM_SV_getsurfacetriangle); + VM_SAFEPARMCOUNT(3, VM_getsurfacetriangle); VectorClear(PRVM_G_VECTOR(OFS_RETURN)); ed = PRVM_G_EDICT(OFS_PARM0); if (!(model = getmodel(prog, ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1)))) diff --git a/sv_move.c b/sv_move.c index ced05ac1..62060b13 100644 --- a/sv_move.c +++ b/sv_move.c @@ -413,7 +413,7 @@ static qboolean SV_CloseEnough (prvm_edict_t *ent, prvm_edict_t *goal, float dis /* ====================== -SV_MoveToGoal +VM_SV_MoveToGoal ====================== */ @@ -422,7 +422,7 @@ void VM_SV_MoveToGoal(prvm_prog_t *prog) prvm_edict_t *ent, *goal; float dist; - VM_SAFEPARMCOUNT(1, SV_MoveToGoal); + VM_SAFEPARMCOUNT(1, VM_SV_MoveToGoal); ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self)); goal = PRVM_PROG_TO_EDICT(PRVM_serveredictedict(ent, goalentity)); diff --git a/svvm_cmds.c b/svvm_cmds.c index 93376ee9..40523c78 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -244,7 +244,7 @@ static void VM_SV_setorigin(prvm_prog_t *prog) { prvm_edict_t *e; - VM_SAFEPARMCOUNT(2, VM_setorigin); + VM_SAFEPARMCOUNT(2, VM_SV_setorigin); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -295,7 +295,7 @@ static void VM_SV_setsize(prvm_prog_t *prog) prvm_edict_t *e; vec3_t mins, maxs; - VM_SAFEPARMCOUNT(3, VM_setsize); + VM_SAFEPARMCOUNT(3, VM_SV_setsize); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) @@ -328,7 +328,7 @@ static void VM_SV_setmodel(prvm_prog_t *prog) dp_model_t *mod; int i; - VM_SAFEPARMCOUNT(2, VM_setmodel); + VM_SAFEPARMCOUNT(2, VM_SV_setmodel); e = PRVM_G_EDICT(OFS_PARM0); if (e == prog->edicts) -- 2.39.2